diff options
Diffstat (limited to 'debian')
100 files changed, 15970 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..4519eb90 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,1501 @@ +hurd (20130727-1) UNRELEASED; urgency=low + + [ Samuel Thibault ] + * New upstream snapshot. Adds firewalling support. + + [ Justus Winter ] + * Include the umount utility in hurd and hurd-udeb. + + -- GNU Hurd Maintainers <debian-hurd@lists.debian.org> Tue, 09 Jul 2013 10:56:23 +0200 + +hurd (20130707-1) unstable; urgency=low + + * New upstream snapshot (Closes: Bug#714733). + + * patches/{mount-{f,n,remount,test-opts,ignore-mounted-all,t-auto}, + sutils-{types,multiple-none}}.patch: New + patches from Justus Winter to make mount more compatible with Linux'. + * patches/mount-loop.patch: New patch to ignore loop option. + * patches/umount.patch: New patch to add umount tool. + * patches/procfs-{update,default,get-options}.patch: New patches from Justus + Winter to make procfs behave as sysvinit desires. + + -- Samuel Thibault <sthibault@debian.org> Sun, 07 Jul 2013 22:25:25 +0000 + +hurd (20130620-1) unstable; urgency=low + + * New upstream release. + + * patches/exec_filename_fs.patch,exec_filename_use.patch,external.patch: + Refresh. + * io_select_timeout, doc-fix.patch: Remove merged patches. + + -- Samuel Thibault <sthibault@debian.org> Wed, 19 Jun 2013 23:32:07 +0000 + +hurd (20130226-3) unstable; urgency=low + + [ Pino Toscano ] + * Stop installing the upstream ChangeLog, since it is just a pointer to the + pre-Git ChangeLog files. + * Install the Debian NEWS file only in the hurd binary. + * hurd: pre-depend on hurd-libs0.3. (Closes: #704998) + * control: build-depend on gawk. + + [ Samuel Thibault ] + * Do not create lpr3, it does not exist in standard PC hardware. + * Add doc-fix.patch to fix documentation build. + * Add io_select_timeout patch to introduce the RPC definition for libc to + build the RPC stubs. + + -- Samuel Thibault <sthibault@debian.org> Wed, 19 Jun 2013 10:56:03 +0000 + +hurd (20130226-2) unstable; urgency=low + + [ Pino Toscano ] + * Split the hurd libraries in own hurd-libs0.3{,-udeb} packages. + + [ Samuel Thibault ] + * Bump netdde breaking version, our updated pfinet wants a rebuilt one. + + [ Pino Toscano ] + * Move /bin/timertest and /bin/fstests from hurd to hurd-dev, since they are + development-related utilities; add proper breaks/replaces. + * Remove the libsem-dev conflicts/replaces/provides from hurd-dev, obsolete. + * Update the hurd-doc suggests: + - Remove hurd (a bit pointless, since it is essential). + - Add www-browser (for the HTML documentation). + * Add missing autotools-dev build dependency (for the autotools_dev dh addon). + * Rename hurd{,-dev,-udeb}.install to hurd{,-dev,-udeb}.install.in, and + generate the .install files at build time. + * Call dh_install with --list-missing. + * Install the hurd libraries in multiarch library directories, but not in + the udeb. + * Update lintian overrides. + + -- Samuel Thibault <sthibault@debian.org> Sat, 16 Mar 2013 00:06:39 +0000 + +hurd (20130226-1) unstable; urgency=low + + [ Samuel Thibault ] + * New upstream snapshot. + * local/finish-install.d/51hurd_config-console: Disable the Hurd console on + the installed system if installation was done without it. + * Add remap script. + + [ Pino Toscano ] + * Bump debhelper compatibility to 7: + - Bump compat to 7. + - Bump the debhelper build dependency to >= 7. + - Fix the dh_strip parameters. + * Rename hurd-console.default to hurd.hurd-console.default, and let it be + installed by dh_installinit. + * hurd/hurd-dev: install more stuff via dh_install, instead of copying them + manually. + * Turn the X11 compose data into static files in the debian directory + (instead of being generated at build time), and install them in hurd-udeb. + * Drop hurd-dbg.dirs, useless. + * hurd-udeb: remove XC-Package-Type, redundant with Package-Type. + * Fix Vcs-* keys to point to anonscm.debian.org. + * Remove asterisks from NEWS file. + * Update lintian overrides. + * Switch rules from cdbs to the sequential `dh': + - Bump the debhelper build dependency to >= 7.0.50~. + - Drop the cdbs build dependency. + - Install BUGS, NEWS, README, and TODO only in hurd. + + -- Samuel Thibault <sthibault@debian.org> Tue, 26 Feb 2013 02:12:55 +0000 + +hurd (20130105-1) unstable; urgency=low + + [ Samuel Thibault ] + * New ustream snapshot + - Migrates everything to libpthread. + - Bump libc0.3-dev build dependency to get pthread_hurd_cond_wait. + - Break libthreads-based netdde. + - Remove install-msgids.diff, pflocal.patch, + runsystem_setup_pflocal.patch, makedev_keep_options.patch, + makedev_parted_store.patch, ext2fs_nowait.patch, libpager_deadlock.patch, + libdiskfs_self-reauth.patch, libdiskfs_sync.patch, merged upstream + - Refresh exec_filename_exec.patch, exec_filename_fs.patch, + ext2fs_large_stores.patch, external.patch, init_try_runsystem.gnu.patch, + libdde_workqueue.patch, libports_stability.patch, pfinet_dhcp.patch, + posix-sigcodes.patch, proxy-defpager.diff. + * New patch ext2fs_large_stores_pthread.patch to move ext2fs large store + support to pthread. + * control: + - Add missing libx11-dev, x11proto-core-dev, pkg-config, xkb-data, flex, + and bison build-dependencies. + - Drop hurd dependency on libc0.3, it is now properly automatically + computed. + * Fix g-i by putting console keyboard parameters before mouse parameters, + otherwise it seems the -c option gets lost. + * Install all msgids files, not only hurd.msgids. + + -- Samuel Thibault <sthibault@debian.org> Sat, 05 Jan 2013 22:30:06 +0000 + +hurd (20120710-3) unstable; urgency=low + + * control: Make hurd depend on xkb-data. + + -- Samuel Thibault <sthibault@debian.org> Thu, 12 Jul 2012 14:14:20 +0000 + +hurd (20120710-2) unstable; urgency=low + + * control: Make hurd-udeb depend on xkb-data-udeb. Make hurd + conflict/replace console-driver-xkb (Closes: Bug#681183). + * rules: Add empty compose file for hurd-udeb. + * hurd.install: Do not install empty compose file. + * local/runsystem: Read keyboard layout from console-setup, restart the + console automatically. + + -- Samuel Thibault <sthibault@debian.org> Wed, 11 Jul 2012 12:32:57 +0000 + +hurd (20120710-1) unstable; urgency=low + + * New upstream snapshot. + - patches/balloc.patch: Remove, merged upstream. + - patches/libdde_config.patch: Remove, merged upstream. + - patches/libdde_fixes.patch: Remove, merged upstream. + - patches/ext2fs_large_stores.patch: Refresh. + * hurd-console.default: Get keyboard layout from console-setup. + * rules: Set XKB_DATA root for installing in debian/tmp. + * hurd.install, hurd-dev.install: Install hurd xkb data. + + -- Samuel Thibault <sthibault@debian.org> Tue, 10 Jul 2012 01:36:55 +0000 + +hurd (20120605-2) unstable; urgency=low + + * control: Add missing autoconf build-dependency. + + -- Samuel Thibault <sthibault@debian.org> Wed, 06 Jun 2012 21:20:43 +0200 + +hurd (20120605-1) unstable; urgency=low + + * New upstream snapshot. + - patches/ext2fs_large_stores.patch,libmachdev.patch: Refresh. + * control: + - Do not make hurd-udeb depend on netdde-udeb, it leads to configure + recursion, and is not actually needed. + - Depend on libpciaccess-dev for libddekit. + * hurd.postinst: Drop error messages while fetching pfinet options. + * local/setup-translators: Remove /dev/shm directory if any, to be replaced + with symlink to /run/shm. + * patches/balloc.patch: Fix parentheses. + * patches/exec_filename_{exec,fs,use}.patch: Add support for passing + filename through exec() call. + + -- Samuel Thibault <sthibault@debian.org> Tue, 22 May 2012 00:07:09 +0000 + +hurd (20120520-1) unstable; urgency=low + + * New upstream snapshot, remove libpthread. + * rules: Bump to gcc-4.7. + * control: Depend on netdde, recent enough (>= 0.0.20120518~) to avoid + conflicts with gnumach drivers. + * local/setup-translators: + - Setup netdde translator and /dev/eth*. + - Add hd4 and hd5 /dev entries, for some SATA controlers. + * hurd.postinst: Migrate pfinet into using /dev/eth0. + * patches/libmachdev.patch: Fix packet delivery on pfinet restart. + * hurd-udev.install: Add devnode. + + -- Samuel Thibault <sthibault@debian.org> Thu, 03 May 2012 01:53:00 +0200 + +hurd (20120408-3) unstable; urgency=low + + * patches/libpthread*, control, patches/external.patch: Remove libpthread, now + shipped by glibc, and depend on it. + + -- Samuel Thibault <sthibault@debian.org> Wed, 25 Apr 2012 02:14:04 +0000 + +hurd (20120408-2) unstable; urgency=low + + * debian/patches/libdde_{addr_fix,addr_list,config,devres,dma_head,ethoc, + ethtool,fixes,group_addr,mdio,netdev_tx_t,pci-needs_freset,pci_ids.h,phy, + pr_cont,rcu,rculist,rx_queue,trans_start,ucast_list,workqueue}: New patches + to upgrade the libdde_linux26 layer to 2.6.32 compatibility. + * debian/copyright: Add copyright information for libdde_linux26. + + -- Samuel Thibault <sthibault@debian.org> Mon, 16 Apr 2012 00:31:41 +0000 + +hurd (20120408-1) unstable; urgency=low + + * New upstream snapshot. + - Fixes tmpfs, thanks Maksym! + - Remove patches/console_utf-8.patch and patches/extern_inline_fix.patch, + merged upstream. + - patches/ext2fs_large_stores.patch: Refresh. + * control: + - Bump Standards-Version to 3.9.3 (no changes). + - Set hurd-udeb XC-Package-Type to udeb. + * patches/libexec.patch: Switch to gnu-mach-color TERM. + * hurd-console.default: Document the -f option of the vga module. + * patches/run.patch: Fix utmp database creation, and thus w command. + * rules: Remove dde drivers, will be shipped by netdde. + + -- Samuel Thibault <sthibault@debian.org> Fri, 06 Apr 2012 19:07:15 +0200 + +hurd (20120222-1) unstable; urgency=low + + * New upstream snapshot + * Add libddekit and libdde_linux26 headers. + + -- Samuel Thibault <sthibault@debian.org> Wed, 22 Feb 2012 01:57:29 +0000 + +hurd (20120219-1) unstable; urgency=low + + [ Samuel Thibault ] + * New upstream snapshot. + - And merge DDE work from Zheng Da. + * patches/ext2fs_large_stores.patch: Fix memory leak, thanks Sergio Lopez! + * debian/hurd-console.default: Enable the console by default. + * debian/patches/libpthread_procfs.patch: Rename to external.patch. + + [ Pino Toscano ] + * hurd.install, hurd.postinst, rules: Rename halt/reboot to + halt-hurd/reboot-hurd, and register them as slaves of the runsystem + alternative. + + -- Samuel Thibault <sthibault@debian.org> Sun, 19 Feb 2012 06:17:49 +0000 + +hurd (20111206-1) unstable; urgency=low + + * New upstream snapshot. + - Drop debian/patches/libpager_update_seqno.patch, applied upstream. + - Closes: #650097, #650186, #650096. + * control: + - Use hurd-any instead of hurd-i386. + - Recommend bf-utf-source to get more than just latin1 on the console. + * hurd.postinst: Set up "*random" alternatives and generate seed on + first install too. + * patches/libexec.patch, hurd.install, hurd-udeb.install, hurd.postinst, + rules: Move getty, console-run, and runttys to /sbin, runsystem and rc to + /etc/hurd (Closes: Bug#556526). + * hurd-udeb.lintian-overrides: Drop override about /libexec + * local/random-hurd.sh, urandom-hurd.sh: Add scripts to be used as + hurd-provided translators for /dev/*random. + * hurd.postinst: Remove "random" alternative introduced by 20111106-1, as it + makes rgrep in /etc not working any more. Install random.sh alternative + instead, which sets /hurd/u?random.sh scripts. + * local/setup-translators: Set /dev/u?random translator from + /hurd/u?random.sh instead of making them alternatives. Set up + /dev/u?random in hurd-udeb too. + * hurd-udeb.install: Add /hurd/random. + * hurd.install: Add /etc/securetty. + * local/setup-translators: Move /run initialization to... + * patches/run.patch: ... boot time. + + -- Samuel Thibault <sthibault@debian.org> Tue, 06 Dec 2011 01:49:34 +0100 + +hurd (20111106-1) unstable; urgency=low + + * New upstream snapshot. + - Drop debian/patches/ttys.patch.patch, applied upstream. + - Drop debian/patches/auth-intr-cure.patch, applied upstream. + - Drop debian/patches/libpthread_tls.patch, applied upstream. + - debian/patches/libpthread_procfs.patch: Refresh. + - Closes: #639010. + * local/setup-translators: + - Restore /dev/shm creation. + - create /run/shm and /run/lock, to fix locking until we properly start + rcS.d scripts. + - Add cd[01] SCSI CD-ROMs. + * patches/libdiskfs_sync.patch: New patch to fix sync at shutdown. + * patches/libpthread_procfs.patch: Add random server. + * local/setup-translators: Use random server, set up its entropy pool in + /var/spool. + * debian/control, debian/local/setup-translators: Use native random server + set on /dev/u?random-hurd instead of random-egd on /dev/u?random. + (Closes: bug#637231) + * debian/hurd.{postinst,prerm}: Handle alternative for /dev/u?random, + default to u?random-hurd, generate an initial pseudo-random seed. + * debian/hurd.lintian-overrides: Override warnings about the /dev/u?random + mangling. + * debian/local/cdrom.h: Add header for basic CD-ROM ioctl support. + * debian/patches/libpthread_globsigdisp.patch,posix-sigcodes.patch: New + patches from Jeremie Koenig to enable global signal support. + * debian/patches/libpthread_sigmask.patch: Update to global signal support. + * debian/copyright: Fix copyright notice. + * debian/control: + - Drop article from synopsis. + - Tighten hurd-dev dependency on hurd to the same version. + * debian/hurd-udeb.install: Only include the necessary console drivers. + * debian/patches/random-default-fast.patch: Set default randomness to fast, + until we set up a daemon to feed /dev/random with entropy. + + -- Samuel Thibault <sthibault@debian.org> Thu, 18 Aug 2011 01:15:04 +0000 + +hurd (20110519-3) unstable; urgency=low + + * debian/local/runsystem: Set d-i umask to 022. + + -- Samuel Thibault <sthibault@debian.org> Sat, 11 Jun 2011 19:21:25 +0200 + +hurd (20110519-2) unstable; urgency=low + + * debian/control: Make the hurd package depend on random-egd, to get + /dev/*random working as early as d-i's base install. + * debian/local/setup-translators: Add entries for partitions 9-16 too, as the + full partman layout at least uses slice 9. Add comX and random translators + on installed system. + * debian/hurd-console.default: Enable keyboard and mouse repeaters by + default for X11. + * debian/hurd.lintian-overrides, debian/hurd-dev.lintian-overrides: Update to + newer lintian format. + + -- Samuel Thibault <sthibault@debian.org> Wed, 08 Jun 2011 22:26:15 +0000 + +hurd (20110519-1) unstable; urgency=low + + * New upstream snapshot. + * debian/control: + - Depend on gcc-4.6 instead of gcc-4.4. + - Bump Standards-Version to 3.9.2 (no change needed) + * debian/rules: Build with gcc-4.6. + * debian/local/runsystem, setup-translators: Enable mouse and keyboard + repeaters for g-i support. + * debian/local/setup-translators: Pass the --compatible option to procfs to + tweak it a bit to get proc-related tools working without too much patching. + Add fd[01]. + * debian/patches/disable-proc_getnports.patch: Remove patch, libc0.3 now + has proc_getnports, and the hurd package already breaks older versions. + * debian/patches/uptime_w_path_fix.patch: Fix /usr/bin/w-hurd command name, + thanks harish badrinath for the notice. + + -- Samuel Thibault <sthibault@debian.org> Sun, 10 Apr 2011 20:42:45 +0200 + +hurd (20110319-2) unstable; urgency=low + + * debian/hurd.postinst: use useradd from required passwd package instead of + adduser, which is not required and thus not available at debootstrap. + * debian/control: Bump Standards-Version to 3.9.1 (no change needed). + + -- Samuel Thibault <sthibault@debian.org> Mon, 21 Mar 2011 17:33:19 +0100 + +hurd (20110319-1) unstable; urgency=low + + [ Samuel Thibault ] + * New upstream snapshot. + * debian/local/setup-translators: Add inet6 -> 26 symlink. + * debian/local/finish-install.d/51hurd_config-target-network: Set pfinet + translator on /servers/socket/26 too, add +x permission. + * debian/local/partman/commit.d/40hurd_reload-partitions: Add +x permission. + * debian/local/runsystem: Don't let d-i start if there is less then 256MiB + memory. Tell the user he needs to be patient while the d-i templates get + loaded. + * debian/patches/ext2fs_nowait.patch: Avoid systematically waiting for all + disk writes, as it slows us down awfully. + * debian/control: Recommend random-egd, to provide /dev/*random + (Closes: Bug#558664). Break old gnumach packages, instead of depending on + them. Break libc0.3 before getifaddrs fix, now that pfinet provides a + correct response. + * debian/patches/auth-intr-cure.patch: Add patch to mitigate + reauthentication issue triggered by sudo. + * debian/patches/libpager_deadlock.patch: Add patch to fix a known + synchronization deadlock. + * debian/local/finish-install.d/51hurd_config-target-network: Record active + network configuration, not only passive. Create /servers/socket/26 node if + it doesn't exist yet. + * debian/local/setup-translators, debian/patches/makedev_keep_options.patch: + Fix -K option into not starting existing translators. + * debian/patches/libdiskfs_self-reauth.patch: Add patch to fix one of the + spurious mach port deallocation issues. + + [ Justus Winter ] + * debian/hurd.{postinst,postrm}: Add/remove loginpr shell and login user with + loginpr shell, to drop the login shell in order to match common Debian + convention, in particular for remote telnet access... + (Closes: Bug#556522) + + [ Samuel Thibault ] + * debian/NEWS: Add a notice about that. + + -- Samuel Thibault <sthibault@debian.org> Sun, 27 Feb 2011 19:02:04 +0100 + +hurd (20100926-1) unstable; urgency=low + + [ Samuel Thibault ] + * New upstream snapshot. Switch to jkoenig's procfs. + * debian/control: Depend on gcc-4.4 instead of gcc-4.3. Thanks Emilio! + * debian/rules: Fix back debugging symbols into the hurd-dbg package. + * debian/local/runsystem: Do not start the Hurd console if the TERM variable + is given. Should permit mach-console install for better debugging as well + as Xen or sub-hurd support. + * debian/patches/disable-proc_getnports.patch: New patch to disable + usage of proc_getnports until libc0.3 provides it. + * debian/patches/libpthread_procfs.patch: Update patch to integrate procfs + build. + + [ Jeremie Koenig ] + * debian/patches/libpthread_sigmask.patch: New patch to fix missed signals + when using pthread_sigmask. + + -- Samuel Thibault <sthibault@debian.org> Sun, 26 Sep 2010 22:15:43 +0000 + +hurd (20100829-1) unstable; urgency=low + + [ Samuel Thibault ] + * New upstream 20100827 snapshot. + - debian/patches/dir_acces_fix.patch: Remove patch, merged upstream. + - debian/patches/exec_fix.patch: Likewise. + - debian/patches/libdiskfs-rename.patch: Likewise. + - debian/patches/libpthread_mutex_owner.patch: Likewise. + - debian/patches/libpthread_recursive_mutex_initializer.patch: Likewise. + - debian/patches/libpthread_setcancel.patch: Likewise. + - debian/patches/pfinet-gcc-4.3-fix.patch: Likewise. + - debian/patches/procfs.patch: Likewise. + - debian/patches/ext2fs_large_stores.patch: Resync. + - debian/patches/libpthread_procfs.patch: New patch, to enable libpthread + and procfs build. + * debian/rules: Really put debugging symbols into the hurd-dbg package. + * debian/patches/hurd_console_startup.patch: Add -d current_vcs to enable + /dev/cons/vcs by default. + * debian/copyright: Reference /usr/share/common-licenses/GPL-2 instead of + just GPL. + * debian/hurd.dirs: Add /etc/sysctl.d. + * debian/control (hurd-udeb): Add Provides: *-modules. + * debian/patches/diskfs_no_inherit_dir_group.patch: Fix documentation too. + * debian/control: + - Drop duplicate priority and section fields. + - Add ${misc:Depends}. + - Add dpkg (>= 1.15.4) | install-info dependency. + - Drop -1 from gnumach-dev dependency. + - Bump Standards-Version to 3.8.4 (no change needed). + * debian/local/runsystem.gnu: New runsystem file for the d-i case, incomplete + for now. + * debian/hurd-udeb.install: Remove getty, runttys, /etc/ttys ftpcp, ftpdir, + ftpfs, hostmux, usermux, nfs, isofs.static, rpctrace, gcore, forks. Install + local/runsystem.gnu in /libexec, install ext2fs.static in /boot + * debian/rules: Do not ship *_pic.a, as mklibs breaks them. + * debian/patches/proxy-defpager.diff: New patch to fix proxying defpager. + * debian/patches/ext2fs_large_stores.patch: Apply Alioth fix #312328 from + Fredrik Hammar to fix random startup crash (Closes: Bug#576519). + * debian/patches/procfs.patch: Fix swap size printout. + * debian/hurd-udeb.install: remove reboot and halt (will be provided by + busybox), remove crash and password (not useful), add procfs, remove rc. + * debian/local/runsystem.gnu: Integrate jkoenig d-i changes, rename to + debian/local/runsystem. + * debian/hurd.links: Add symlink to /usr/src/unifont.bdf from the unifont + package to /usr/share/hurd/vga-system.bdf so the console can pick it up + when installed. + * debian/source/options: Set compression to bzip2. + * debian/control: Update Vcs fields to point to the new git repositories. + * debian/patches/console_ignore_bdf_err.patch: New patch to ignore erroneous + number of glyphs in bdf files. + * debian/rules: Remove debian/ChangeLog generation. + * debian/local/runsystem: Pass -g option to the console to maximize glyph + usage for chinese. + * debian/hurd.lintian-overrides: New overrides to announce which servers are + supposed to be statically linked, accept hurd to be essential, and accept + some setuid binaries. + * debian/hurd-udeb.lintian-overrides: New overrides to validate + hurd-i386-specific paths. + * debian/hurd-dev.lintian-overrides: New overrides to allow libstore_* not + being stripped (they wouldn't work, else). + * debian/local/runsystem: Export kernel parameters into environment, like + Linux does. + * debian/control: Use Package-Type instead of XC-Package-Type. + * debian/rules: Switch to gcc-4.4 (Closes: Bug#594285). + + [ Guillem Jover ] + * Update make-new-tarball.sh to exclude git instead of CVS paths. + * Refresh patches with -pab to allow migration to source format 3.0 (quilt). + * Switch to source format “3.0 (quilt)”: + - Remove quilt from Build-Depends. + - Remove patchsys-quilt.mk include from debian/rules. + + [ Michael Banck ] + * debian/control (Uploaders): Removed Marcus Brinkmann. (Closes: #503564) + + [ Jeremie Koenig ] + * debian/control: Build-Depend on libparted-dev. + * debian/local/partman/commit.d/40hurd_reload-partitions: New file for + hurd-udeb, make partman restart the partition translators after the + partition table has been changed. + * debian/hurd-udeb.install: Install file above. + * debian/local/runsystem (hurd-udeb): Start mach-defpager. + * debian/hurd-udeb.dirs: Include /servers. + * Sort out the way device and server nodes are created: + - debian/patches/makedev_keep_options.patch: Introduces the -k and -K + options to MAKEDEV, respectively to keep active translators running or + leave existing files alone completely. + - debian/patches/makedev_parted_store.patch: MAKEDEV -p will use parted + instead of device stores for disk partitions. + - debian/local/setup-translators: New script installed in /usr/lib/hurd, + uses MAKEDEV's new options to create all the necessary device and + server nodes. + - debian/local/runsystem (hurd-udeb): Uses setup-translators in "minimal + mode" to prepare the initrd when the installer is started. Parted + stores are used to avoid problems when reloading the partition table. + - debian/hurd.postinst: Uses setup-translators to create missing nodes on + upgrades (on initial installs, debootstrap will use the + setup-translators script from the installed hurd package to setup the + devices and servers itself). + * debian/local/finish-install.d/51hurd_config-target-network: copy the + /servers/socket/2 translator settings into the target system. + * debian/hurd-udeb.links: Include the unifont.bdf link in hurd-udeb too. + + -- Samuel Thibault <sthibault@debian.org> Fri, 27 Aug 2010 13:12:12 +0200 + +hurd (20090404-2) unstable; urgency=low + + * debian/patches/libpthread_no_recursive_mutex_initializer.patch: Remove + unused patch. + * debian/patches/procfs.patch: Fix a couple of memory leaks, fix swap size + report. + * debian/control: Add missing comma in Build-Depends. + * debian/patches/pfinet-gcc-4.3-fix.patch: Cherry-pick upstream patch to fix + build with gcc-4.3 + * debian/rules: Set CC to gcc-4.3 instead of gcc-4.2. + * debian/control: Build-Depend on gcc-4.3 instead of gcc-4.2. + (Closes: Bug#533782) + * debian/control: Add Provides: hurd to the hurd-udeb package, to meet + dependencies. + * debian/rules: Add --add-udeb="hurd-udeb" option to dh_makeshlibs + invocation for the hurd package, to fix udeb dependency generation. + * debian/patches/MAKEDEV.patch: New patch to use bash for MAKEDEV. + (Closes: Bug#548587) + * debian/patches/libdiskfs-rename.patch: New patch to fix ext2fs hang on + renaming directory to something/. + + -- Samuel Thibault <sthibault@debian.org> Sun, 11 Oct 2009 04:38:02 +0200 + +hurd (20090404-1) unstable; urgency=low + + [ Michael Banck ] + * New snapshot from CVS. + + debian/patches/diskfs_lookup_error_fix.patch: Removed, applied upstream. + + debian/patches/libpthread_mutex-no-include.patch: Likewise. + + debian/patches/libpthread_pthreadtypes_h.patch: Likewise. + + debian/patches/libpthread_spin-lock-inline.patch: Likewise. + + debian/patches/lock-memory-clobber.patch: Likewise. + + debian/patches/pflocal-port-leak.patch: Likewise. + + debian/patches/libpthread_pthreadexit-safety.patch: Removed, no longer + needed. + + debian/patches/libpthread_tls.patch: Refreshed. + * Change packaging to no tarball-in-tarball and quilt. + + debian/control (Build-Depends): Added quilt. + + debian/rules (DEB_TAR_SRCDIR): Removed. + + debian/rules (tarball.mk) No longer include it. + + debian/rules (simple-patchsys.mk) Replaced with ... + + debian/rules (patchsys-quilt.mk) ... this. + + debian/patches/series: New file. + + debian/rules (build/hurd): Replace build-tree with $(DEB_SRCDIR). + + debian/rules (install/hurd): Likewise. + + debian/hurd-doc.docs: Adjust paths. + * debian/hurd.postinst: Install ps alternatives link in /bin, not + /usr/bin. + * debian/hurd.postinst: Install /proc as passive translator only. + * debian/patches/uptime_w_path_fix.patch: New patch, run /usr/bin/w instead + of /bin/w. + * debian/rules: Install fakeroot, uptime and vmstat into /usr/bin, not /bin. + * debian/rules (binary-predeb/hurd): Adjust paths. + * debian/hurd.install: Likewise. + * debian/hurd-udeb.install: Likewise. + * debian/hurd.dirs: Added /usr/bin. + * debian/hurd.postinst: Update accordingly. + * debian/patches/libpthread_mutex_owner.patch: New patch, fix a hang in + libpthread, by Neal Walfield. + + [ Samuel Thibault ] + * debian/patches/thread-throttle.patch: Remove patch, makes ext2fs hang on + big syncs. + * debian/control (Build-Depends): Bump libc0.3-dev to (>= 2.9). + * debian/patches/stat_round.patch: New temporary patch, fixes symlink issues + with tar. + * debian/patches/dir_acces_fix.patch: New patch, fixes ext2fs crashes. + * debian/patches/libports_stability.patch: New patch to keep the old + behavior of libports. + * debian/patches/libpthread_fix.patch: New patch from Thomas Schwinge to fix + libpthread. + * debian/patches/libpthread_setcancel.patch: New patch to fix configuration + of octave3.0. + * debian/patches/extern_inline_fix.patch: New patch from Marc Dequène to + fix extern inline declarations. + * debian/patches/exec_fix.patch: New patch to fix random hang of exec. + * debian/patches/libpthread_recursive_mutex_initializer.patch: New patch + to fix the recursive mutex initializers usage in libraries not linking + against libpthread. + * debian/control: Now using Standards-Version 3.8.2 (no changes needed). + * debian/control: Add myself to uploaders. + + [ Guillem Jover ] + * Change hurd-dbg section to debug. + + -- Samuel Thibault <sthibault@debian.org> Sun, 28 Jun 2009 22:19:07 +0000 + +hurd (20080607-6) unstable; urgency=low + + * debian/rules (install/hurd): Move away ps, uptime, vmstat and w in order + to have them handled by update-alternatives. + * debian/hurd.install: Update accordingly. + * debian/hurd-udev.install: Likewise. + * debian/rules (SUID_PROGRAMS): Likewise. + * debian/hurd.postinst: Run update-alternatives for ps, uptime, vmstat and + w. + * debian/hurd.postinst: Setup /proc if it hasn't been already. + + -- Michael Banck <mbanck@debian.org> Fri, 12 Sep 2008 22:58:08 +0200 + +hurd (20080607-5) unstable; urgency=low + + * debian/patches/procfs.patch: New patch, implements a /proc translator, by + Madhusudan C.S., taken from a CVS branch. + + -- Michael Banck <mbanck@debian.org> Tue, 02 Sep 2008 00:24:36 +0200 + +hurd (20080607-4) unstable; urgency=low + + [ Samuel Thibault ] + * debian/patches/pflocal-port-leak.patch: New patch to fix port leaks in + pflocal which was making tcl-related builds hang. + * debian/patches/lock-memory-clobber.patch: New patch to fix lock safety. + * debian/patches/libpthread_mutex-no-include.patch: New patch to drop + useless (and problematic) inclusion from mutex.h. + * debian/patches/libpthread_spin-lock-inline.patch: New patch to split off + inlines from spin-lock.h into spin-lock-inline.h to avoid including too + many headers from pthreadtypes.h (fixes glibc 2.7-13 compilation). + * debian/patches/libpthread_pthreadtypes_h.patch: Remove comma at end of + enumeration. + * debian/patches/diskfs_lookup_error_fix.patch: New patch to fix deadlock in + lookup error conditions. + + -- Michael Banck <mbanck@debian.org> Fri, 29 Aug 2008 22:53:20 +0200 + +hurd (20080607-3) unstable; urgency=low + + [ Samuel Thibault ] + * debian/patches/libpthread_pthreadtypes_h.patch: fix patch into really + installing <pthread/pthreadtypes.h>. + + -- Michael Banck <mbanck@debian.org> Sat, 12 Jul 2008 02:23:21 +0200 + +hurd (20080607-2) unstable; urgency=low + + [ Samuel Thibault ] + * debian/patches/libpthread_pthreadtypes_h.patch: New patch to get pthread + types into <pthread/pthreadtypes.h>, which <bits/pthreadtypes.h> will be + able to include. + * debian/patches/libpthread_stubs.patch: Fix build. + * debian/patches/libpthread_pthreadexit-safety.patch: New patch to fix a + race during thread exit. Fixes e.g. libatomic-ops' testsuite, and + probably also a lot of others'. + + -- Michael Banck <mbanck@debian.org> Fri, 11 Jul 2008 15:33:27 +0200 + +hurd (20080607-1) unstable; urgency=low + + * New snapshot from CVS. + + debian/patches/ext2fs_large_stores.patch: Removed copyright year + changes. + + debian/patches/libpthread_getattr.patch: Removed, applied upstream. + + debian/patches/libpthread_inline.patch: Likewise. + + debian/patches/mmx.patch: Likewise. + + debian/patches/libpthread_stubs.patch: Updated, one hunk got applied + upstream. + * debian/rules (CC): New variable, set to gcc-4.2. + * debian/control (Build-Depends): Added gcc-4.2. + + -- Michael Banck <mbanck@debian.org> Wed, 11 Jun 2008 01:02:01 +0200 + +hurd (20071119-2) unstable; urgency=low + + [ Michael Banck ] + * debian/local/menu.lst: Add some comments. + * debian/patches/libpthread_getattr.patch: New patch, implements + pthread_getattr_np, taken from CVS. + + [ Guillem Jover ] + * debian/copyright: Update FSF address. + * debian/control: Use binary:Version and source:Version instead of + deprecated Source-Version substvar. + * debian/changelog: Fix Neal's mail address in ancient entry. + * debian/control: Line-wrap Build-Depends and Uploaders fields. + * debian/control: Now using Standards-Version 3.7.3 (no changes needed). + * debian/control: Move packages from base Section to admin. + * debian/control: Add Homepage field. + * debian/control: Add Vcs-Browser and Vcs-Svn fields. + + [ Samuel Thibault] + * debian/patches/mmx.patch: New patch to align the stack of created + threads. + * debian/patches/thread-throttle.patch: New patch, add a fix for ext2fs to + keep the superblock in memory so as to avoid a thread creation dead lock. + * debian/patches/libpthread_stubs.diff: New patch, add generation of + <gnu/stubs-pthread.h> to advertise libpthread stubs. + + -- Michael Banck <mbanck@debian.org> Sun, 18 May 2008 20:22:32 +0200 + +hurd (20071119-1) unstable; urgency=low + + * New snapshot from CVS. + + Includes a port of Linux' IPv6 support by Stefan Siegl. + (Closes: #274156) + + debian/patches/glibc_stat_updates.patch: Removed, applied upstream. + + debian/patches/libpthread_no-inline.patch: Likewise. + + debian/patches/pfinet_-fno-strict-aliasing.patch: Likewise. + + debian/patches/servers.boot-update.patch: Likewise. + + debian/patches/siocgifhwaddr.patch: Likewise. + + debian/patches/pfinet_dhcp.patch: Rediffed. + + debian/patches/pflocal.patch: Likewise. + + [ Samuel Thibault ] + * debian/local/soundcard.h: Add _PATCHKEY definition. + * debian/patches/libpthread_tls.patch: New patch, replaces + debian/patches/libpthread_tls_transitional.patch. + * debian/patches/libpthread_inline.patch: New patch to fix extern inlines + with gcc 4.3. + + [ Michael Banck ] + * debian/patches/runsystem_setup_pflocal.patch: New patch, sets up + pflocal during bootup if this has not been done before (in the install + case). + * debian/hurd.dirs: Added servers/socket. + * debian/patches/init_try_runsystem.gnu.patch: New patch, try + /libexec/runsystem.gnu as well if /libexec/runsystem is not + available. + * debian/patches/tmp_exec_startup.patch: New patch, try to attach the + exec server to /tmp/exec if /servers/exec is not yet available. + * debian/patches/diskfs_no_inherit_dir_group.patch: Update with better + patch by Thomas Schwinge. + * debian/patches/pfinet_dhcp.patch: Updated with new patch by Christian + Dietrich and Stefan Siegl. + * debian/local/menu.lst: New file. + * debian/hurd.examples: Ship it. + + -- Michael Banck <mbanck@debian.org> Tue, 08 Jan 2008 01:10:07 +0100 + +hurd (20070606-3) unstable; urgency=low + + [ Michael Banck ] + * debian/patches/patches/servers.boot-update.patch: New patch, updates + the servers.boot script to use the currently used Grub module lines. + * debian/rules (install/hurd::): Install release/servers.boot into /boot. + * debian/patches/pfinet_-fno-strict-aliasing.patch: New patch, adding + -fno-strict-aliasing to pfinet's CFLAGS to fix compilation with gcc-4.2, + taken from CVS. + * debian/hurd.dirs: Added /boot. + + [ Samuel Thibault ] + * debian/patches/patches/libpthread_no-inline.patch: New patch, removes + extern inlines to fix g++ and gettext FTBFS, by Samuel Thibault. + + -- Michael Banck <mbanck@debian.org> Thu, 9 Aug 2007 17:08:01 +0200 + +hurd (20070606-2) unstable; urgency=low + + * debian/patches/libpthread_tls_transitional.patch: New patch, + implements TLS for libpthread, by Samuel Thibault. + * debian/patches/libpthread_weak_inline.patch: Removed. + + -- Michael Banck <mbanck@debian.org> Sun, 22 Jul 2007 23:45:39 +0200 + +hurd (20070606-1) unstable; urgency=low + + * New snapshot from CVS. + + Includes a patch to make pthread_* function aliases strong. + (Closes: #407208) + + debian/patches/console_ioperms.patch: Removed, fixed upstream. + + debian/patches/no-debian-dir.patch: Removed, applied upstream. + * debian/local/soundcard.h: Updated by Samuel Thibault. + * debian/control (Build-Depends): Added libc0.3-dev (>= 2.5-5). + * debian/copyright: Clarify that the package is maintained by the + Debian GNU Hurd maintainers and no longer by upstream. + * debian/control (Build-Depends): Bumped gnumach-dev version to + 2:1.3.99.dfsg.cvs20070526-1. + * debian/control (hurd/Depends): Bumped gnumach version to + 2:1.3.99.dfsg.cvs20070526-1. + + -- Michael Banck <mbanck@debian.org> Wed, 6 Jun 2007 18:54:37 +0200 + +hurd (20060825-2) unstable; urgency=low + + * Rebuilt against gnumach_1:20060826.dfsg.1-1. + * debian/control (hurd/Depends): Bump versioned dependency of gnumach + to 1:20060826.dfsg.1-1. + * debian/control (Build-Depends): Added versioned Build-Depends on + gnumach-dev 1:20060826.dfsg.1-1. + * debian/control (Build-Depends-Indep): Moved texi2html to ... + * debian/control (Build-Depends): ... here. + + -- Michael Banck <mbanck@debian.org> Wed, 30 Aug 2006 00:17:15 +0200 + +hurd (20060825-1) unstable; urgency=low + + * New snapshot from CVS. + * debian/patches/beta_make.patch: Removed, fixed upstream. + * debian/patches/ext2fs_large_stores.patch: Resynced. + * debian/patches/pfinet_dhcp.patch: Likewise. + * debian/patches/ftpfs_fix.patch: Removed, applied upstream. + * debian/patches/gcc-4.0_fixes.patch: Likewise. + * debian/patches/libpthread_need_clockid_t.patch: Likewise. + * debian/patches/libstore_attribute.patch: Likewise. + * debian/patches/magic_port_leak.patch: Likewise. + * debian/patches/pfinet_packet_filter.diff: Likewise. + * debian/patches/semaphore_restrict_fix.patch: Likewise. + * debian/rules (build/hurd::): Assemble all upstream ChangeLogs to one + big ChangeLog. + * debian/rules (DEB_INSTALL_CHANGELOGS_ALL): New variable, install it. + * debian/patches/no_shm_makedev.diff: Renamed to ... + * debian/patches/makedev.diff: ... this. + * debian/patches/console_utf-8.patch: New patch, setting the Hurd + console to UTF-8 by default. (Closes: #348260) + + -- Michael Banck <mbanck@debian.org> Sat, 26 Aug 2006 01:00:41 +0200 + +hurd (20050513-8) unstable; urgency=low + + * debian/patches/pfinet_packet_filter: New patch, adding support for + gathering incoming packets, taken from CVS. + * debian/hurd.install: Install hurd.msgids into /usr/share/msgids. + * debian/hurd.dirs: Added /usr/share/msgids. + * debian/patches/sysvshm.patch: Removed, it was causing deadlocks. + + -- Michael Banck <mbanck@debian.org> Fri, 4 Aug 2006 15:54:09 +0200 + +hurd (20050513-7) unstable; urgency=low + + * debian/patches/diskfs_no_inherit_dir_group.patch: New patch, + enabling SysV style behaviour (i.e. adopt the user's gid, not the + one from the parent directory) for group permissions of newly + created files by default. + * debian/rules (install/hurd::): Install motd.UTF8 into /etc. + * debian/patches/install-msgids.diff: New patch, install RPC message + IDs in $(datadir)/msgids, by Alfred M. Szmidt. + * debian/hurd.postinst: Create symlinks for /dev/kbd and /dev/mouse to + /dev/cons/{kbd,mouse} if not present already. (Closes: #355002) + * debian/patches/no_shm_makedev.diff: New patch, skip /dev/shm device + when generating the standard devices. + * debian/hurd.postinst: Create /dev/shm directory if not present + already. + * debian/patches/ext2fs_large_stores.patch: Include <hurd/pager.h> + rather than "../libpager/pager.h" and add pager to libdiskfs' + HURDLIBS. + * local/soundcard.h: New file by Samuel Thibault. + * debian/rules (install/hurd-dev::) New rule, install soundcard.h + in debian/tmp/include/sys. + + -- Michael Banck <mbanck@debian.org> Tue, 25 Apr 2006 19:30:33 +0200 + +hurd (20050513-6) unstable; urgency=low + + * debian/patches/console_ioperms.patch: New patch by Samuel Thibault. + * debian/control (hurd): Add versioned Depends on gnumach 1:20050801-3. + * debian/patches/beta_make.patch: New patch, support newer make. + + -- Michael Banck <mbanck@debian.org> Thu, 12 Jan 2006 02:42:36 +0100 + +hurd (20050513-5) unstable; urgency=low + + * debian/patches/thread-throttle.patch: New patch by Sergio Lopez. + * debian/patches/gcc-4.0_fixes.patch: New patch by Thomas Schwinge. + * debian/patches/libstore_attribute.patch: New patch by Roland + McGrath, taken from CVS. + * debian/rules (CC): Removed. + * debian/control (Build-Depends): Removed gcc-3.3. + * debian/patches/libpthread_weak_inline.patch: New patch by Neal + Walfield. + + -- Michael Banck <mbanck@debian.org> Sun, 11 Dec 2005 13:31:11 +0100 + +hurd (20050513-4) unstable; urgency=low + + * debian/rules (DEB_CONFIGURE_USER_FLAGS): Build iso9660fs.static + as well. + * debian/hurd-udeb.install: Added iso9660fs.static. + * debian/patches/hurd_console_startup.patch: New patch, adding + support for starting the Hurd console on bootup. + * debian/hurd.dirs: Added `etc/default'. + * debian/hurd-console.default: New file. + * debian/rules (install/hurd::) Install it into debian/hurd/etc/default. + * debian/hurd.postinst: Removed creation of user `login'. + * debian/NEWS: Mention the possibility of starting the Hurd console + on bootup. + * debian/patches/magic_port_leak.patch: New patch by Marcus + Brinkmann, taken from CVS. + * debian/patches/ftpfs_fix.patch: New patch by Samuel Thibault. + * debian/patches/sysvshm.patch: New patch by Marcus Brinkmann. + * debian/patches/libpager_update_seqno.patch: New patch by Sergio Lopez. + * debian/patches/semaphore_restrict_fix.patch: New patch by Samuel + Thibault. (Closes: #320121) + * debian/control (Build-Depends): Added gcc-3.3. + * debian/rules (CC): New variable, set to gcc-3.3. + + -- Michael Banck <mbanck@debian.org> Sun, 28 Aug 2005 14:45:55 +0200 + +hurd (20050513-3) unstable; urgency=low + + * debian/control (hurd-doc): Fix description to indicate the manual + is included in HTML and not PostScript format. (Closes: #309748) + * debian/control (hurd-dev): Provide/Replace/Conflict libsem-dev. + * debian/control (Build-Depends): Version dependency on debhelper to + >= 4.2. + * debian/control (hurd-udeb): New package. + * debian/hurd-udeb.install: New file. + * debian/patches/libpthread_need_clockid_t.patch: Updated from CVS. + + -- Michael Banck <mbanck@debian.org> Thu, 9 Jun 2005 01:40:31 +0200 + +hurd (20050513-2) unstable; urgency=low + + * debian/patches/libpthread_need_clockid_t.patch: New patch by Neal + Walfield. + * debian/patches/pflocal.patch: New patch by Neal Walfield. + + -- Michael Banck <mbanck@debian.org> Tue, 17 May 2005 18:37:08 +0200 + +hurd (20050513-1) unstable; urgency=low + + * New snapshot from CVS. + + Contains a POSIX semaphore implementation by Neal Walfield. + + Contains more libpthread fixes for test suites by Neal Walfield. + * debian/hurd.postinst: Handle /bin/fakeroot-hurd by alternatives. + + -- Michael Banck <mbanck@debian.org> Sun, 15 May 2005 13:00:12 +0200 + +hurd (20050507-1) unstable; urgency=low + + * New snapshot from CVS. + + Contains libpthread fixes for various test suites by Neal + Walfield. + * debian/changelog (20050119-3): Added overlooked Closes: tag. + * debian/control (hurd-dbg/Priority:) Set to extra as requested by + the ftp-masters. + * debian/patches/isofs_boot.patch: Removed, applied upstream. + * debian/patches/libpthread_linker_script.patch: Likewise. + + -- Michael Banck <mbanck@debian.org> Sat, 7 May 2005 15:28:51 +0200 + +hurd (20050119-3) unstable; urgency=low + + * debian/control (hurd-dbg): New package. + * debian/rules (DEB_DH_STRIP_ARGS): Add support for hurd-dbg. + * debian/hurd-dbg.dirs: New file. + * debian/control (hurd-doc): New package. (Closes: #264858) + (Build-Depends-Indep): Added texi2html. + * debian/rules (build/hurd::): Generate html version of the manual. + * debian/hurd-doc.info: New file. + * debian/hurd-doc.docs: New file. + + -- Michael Banck <mbanck@debian.org> Fri, 15 Apr 2005 23:03:34 +0200 + +hurd (20050119-2) unstable; urgency=low + + [ Michael Banck ] + * debian/hurd-dev.install: Install development libraries into /lib, + not /usr/lib. + * debian/hurd.install: Install Hurd console drivers into + /usr/lib/hurd/console, not /lib/hurd/console. + * debian/copyright: Clarify that the FSF is the copyright holder. + * debian/copyright: Update download location to Savannah's GNU Hurd + project page. + + -- Michael Banck <mbanck@debian.org> Mon, 4 Apr 2005 12:08:40 +0200 + +hurd (20050119-1) unstable; urgency=low + + * New snapshot from CVS. + + Contains libpthread header fixes by Neal Walfield and + Pietro Ferrari. (Closes: #184344) + + Contains console repeaters by Marco Gerards. + + Contains mount argp fixes. (Closes: #151407) + + [ Michael Banck] + * debian/patches/exec.patch: Removed, no longer needed. + * debian/patches/mouse.patch: Likewise. + * debian/patches/console_repeater.patch: Removed, applied upstream. + * debian/patches/libcons_repeater.patch: Likewise. + * debian/patches/netfs_io_select.patch: Likewise. + * debian/patches/netfs_nonblock.patch: Likewise. + * debian/patches-contrib/kbd.patch: Removed, no longer needed. + * debian/patches/libpthread_linker_script.patch: New patch. Install + libpthread.a linker script correctly. (Closes: #291307) + * debian/rules (install/hurd::): Rename /bin/fakeroot to + /bin/fakeroot-hurd. + * debian/control (hurd): Removed fakeroot from Provides:, Replaces: + and Conflicts:. (Closes: #293511) + * debian/hurd.install: Install debian/tmp/bin/fakeroot-hurd instead + of debian/tmp/bin/fakeroot. + * NEWS: New file. Explain the console-client command line interface + changes. + * debian/patches/siocgifhwaddr.patch: New patch by Marco Gerards. + * debian/patches/isofs_boot.patch: New patch by Alfred M. Szmidt. + + -- Michael Banck <mbanck@debian.org> Wed, 23 Feb 2005 20:52:07 +0100 + +hurd (20040508-6) unstable; urgency=low + + [ Michael Banck ] + * debian/patches/pfinet_dhcp.patch: New patch by Marco Gerards. + + -- Michael Banck <mbanck@debian.org> Sat, 15 Jan 2005 21:04:33 +0100 + +hurd (20040508-5) unstable; urgency=low + + [ Michael Banck ] + * debian/patches-contrib/ext2fs_20040930.diff: Moved to ... + * debian/patches/ext2fs_large_stores.diff: ... here, updated from + Ognyan Kulev's 20041111 version. Set DISK_CACHE_BLOCKS to + 65536 in ext2fs.h. + + -- Michael Banck <mbanck@debian.org> Sun, 12 Dec 2004 17:54:32 +0100 + +hurd (20040508-4) unstable; urgency=low + + [ Michael Banck ] + * debian/changelog: Added back 20040301-1 entry which got lost. + * debian/hurd.install: Do not install /sbin/fsck. (Closes: #272655) + * debian/patches/rc.patch: Updated to use e2fsprog's /sbin/fsck + command-line options. Make sure the root file system is read-only + during the fsck run, and update it to be writable again if fsck + succeeds. (Closes: #273508) + * debian/patches-contrib/ext2fs_20040930.diff: New file. Just put it + in debian/patches and recompile the package to get (experimental) + support for ext2 files systems larger than 2GB. + * debian/control (Maintainer): Changed Maintainer address. + + [ Guillem Jover ] + * debian/hurd.postinst: + - Move /bin/login suid root chmod to debian/rules. + - Set suid bit to other binaries (/bin/ps, /bin/ids, /bin/w). + (Closes: #273507) + Thanks Ognyan Kulev <ogi@fmi.uni-sofia.bg>. + + -- Michael Banck <mbanck@debian.org> Thu, 7 Oct 2004 20:11:38 +0200 + +hurd (20040508-3) unstable; urgency=low + + * debian/local/rc: Removed. + * debian/patches/rc.patch: New file. (Closes: #254147) + * debian/hurd.install: Install tmp/libexec/rc. + * debian/patches/console_switch3.patch: Removed. + * debian/patches/console_repeater.patch: New patch by Marco Gerards. + * debian/patches/libcons_repeater.patch: New patch by Marco Gerards. + * debian/patches/netfs_io_select.patch: New patch by Marco Gerards. + * debian/patches/netfs_nonblock.patch: New patch by Marco Gerards. + * Rebuilt against glibc_2.3.2.ds1-16. + * debian/hurd.postinst: Make sure /bin/login is suid. (Closes: #251863) + * debian/control (Uploaders): Added myself. + * debian/hurd.postinst: Only create the tty devices if they do not + exist already. (Closes: #268347) + + -- Michael Banck <mbanck@debian.org> Thu, 9 Sep 2004 22:32:07 +0200 + +hurd (20040508-2) unstable; urgency=low + + * Fix typo in postinst. (Closes: #253662) + Thanks to Michael Banck. + * Support /usr tree in startup scripts (Closes: #229572) + Thanks to Guillem Jover + + -- Jeff Bailey <jbailey@raspberryginger.com> Fri, 11 Jun 2004 11:17:26 -0400 + +hurd (20040508-1) unstable; urgency=low + + * New snapshot from CVS. + * Switch packaging to cdbs + * Do not provide /boot/serverboot or /boot/servers.boot + * Update policy to 3.6.1.0 + * Do not provide update-rc.d, use the one from sysvinit instead + (Closes: #246813) - Thanks to Robert Millan + * Do not provide /sbin/fsck, use the one from e2fsprogs instead + Thanks to Robert Millan + + -- Jeff Bailey <jbailey@raspberryginger.com> Sat, 8 May 2004 16:55:18 -0400 + +hurd (20040301-1) unstable; urgency=low + + * New snapshot from CVS. + kbd, mouse as usual. exec/exec.c PT_GNU_STACK work-around. + Provide example entries for new console in config/ttys. + * debian/rules: Do not call autoconf. + * debian/control: Remove build dependency autoconf. + + -- Marcus Brinkmann <brinkmd@debian.org> Mon, 1 Mar 2004 01:36:23 +0200 + +hurd (20021118-1) unstable; urgency=low + + * New snapshot from CVS. + kbd, mouse as usual, with bug fixes from David Walter. + Change terminal type to mach-color. + + -- Marcus Brinkmann <brinkmd@debian.org> Tue, 18 Nov 2002 21:32:22 +0200 + +hurd (20021011-1) unstable; urgency=low + + * New snapshot from CVS. + kbd, mouse as usual. + Build libpthread. + debian/control: Add libncursesw5-dev as build-dependency. + debian/shlibs: Add libpthread + debian/control: Add myself as an uploader. + + -- Neal H. Walfield <neal@debian.org> Fri, 11 Oct 2002 21:42:21 -0400 + +hurd (20020918-1) unstable; urgency=low + + * New snapshot from CVS. + kbd, mouse as usual. + Change terminal type to mach-color. + + -- Marcus Brinkmann <brinkmd@debian.org> Tue, 18 Sep 2002 23:13:06 +0200 + +hurd (20020804-1) unstable; urgency=low + + * New snapshot from CVS. + kbd, mouse as usual. + Change terminal type to mach-color. + + -- Marcus Brinkmann <brinkmd@debian.org> Sun, 4 Aug 2002 20:46:28 +0200 + +hurd (20020523-1) unstable; urgency=low + + * New snapshot from CVS. + kbd, mouse as usual. + Change terminal type to mach-color. + + -- Marcus Brinkmann <brinkmd@debian.org> Thu, 23 May 2002 15:29:40 +0200 + +hurd (20020418-1) unstable; urgency=low + + * New snapshot from CVS. + kbd, mouse as usual. + Change terminal type to mach-color. + + -- Marcus Brinkmann <brinkmd@debian.org> Thu, 18 Apr 2002 15:22:39 +0200 + +hurd (20011105-1) unstable; urgency=low + + * New snapshot from CVS. + * Additional patches: + kbd, mouse as usual (well, the intention was there :). + Change terminal type to mach-color. + Compiled with -O2 rather than -O3. + + -- Marcus Brinkmann <brinkmd@debian.org> Mon, 5 Nov 2001 00:00:26 +0100 + +hurd (20011016-1) unstable; urgency=low + + * New snapshot from CVS. + * Additional patches: + kbd, mouse as usual. + Change terminal type to mach-color. + Compiled with -O2 rather than -O3. + + -- Marcus Brinkmann <brinkmd@debian.org> Tue, 16 Oct 2001 19:43:21 +0200 + +hurd (20011013-1) unstable; urgency=low + + * New snapshot from CVS. + * Additional patches: + kbd, mouse as usual. + Change terminal type to mach-color. + Compiled with -O2 rather than -O3. + * debian/rules: Change way how to find executables by Kevin Kreamer. + * debian/control: Add `file' to build dependencies by Kevin Kreamer. + + -- Marcus Brinkmann <brinkmd@debian.org> Sat, 13 Oct 2001 01:05:30 +0200 + +hurd (20010817-2) unstable; urgency=low + + * Include a copy of update-rc.d, moved from dpkg to init providing + package. + + -- Marcus Brinkmann <brinkmd@debian.org> Sun, 2 Sep 2001 19:40:00 +0200 + +hurd (20010817-1) unstable; urgency=low + + * New snapshot from CVS, closes: #105476, #39894. + * Additional patches: + kbd, mouse as usual. + Change terminal type to mach-color. + Compiled with -O2 rather than -O3. + + -- Marcus Brinkmann <brinkmd@debian.org> Fri, 17 Aug 2001 22:16:01 +0200 + +hurd (20010718-1) unstable; urgency=low + + * New snapshot from CVS. + * Additional patches: + kbd, mouse as usual. + Change terminal type to mach-color. + Compiled with -O2 rather than -O3. + + -- Marcus Brinkmann <brinkmd@debian.org> Thu, 18 Jul 2001 21:43:52 +0200 + +hurd (20010608) unstable; urgency=low + + * New snapshot from CVS. + * Additional patches: + kbd, mouse as usual. + Change terminal type to mach-color. + Compiled with -O2 rather than -O3. + + -- Marcus Brinkmann <brinkmd@debian.org> Fri, 8 Jun 2001 23:02:47 +0200 + +hurd (20010527) unstable; urgency=low + + * New snapshot from CVS. + * Additional patches: + kbd, mouse as usual. + Change terminal type to mach-color. + + -- Marcus Brinkmann <brinkmd@debian.org> Sat, 27 May 2001 01:34:21 +0200 + +hurd (20010426) unstable; urgency=low + + * New snapshot from CVS. + * Additional patches: + kbd, mouse as usual. + Change terminal type to mach-color. + storeio hack to prevent double activation. + + -- Marcus Brinkmann <brinkmd@debian.org> Fri, 27 Apr 2001 00:09:56 +0200 + +hurd (20010311) unstable; urgency=low + + * New snapshot from CVS. + * Additional patches: + kbd, mouse as usual. + Change terminal type to mach-color. + + -- Marcus Brinkmann <brinkmd@debian.org> Sun, 11 Mar 2001 22:45:21 +0100 + +hurd (20010111) unstable; urgency=low + + * New snapshot from CVS, containing lots of small bug fixes, and: + + Together with gnumach 1.2-9, you can access large stores with + storeinfo, storeread (because libstore uses the new interface in + gnumach, and off64_t internally). + + pfinet contains support for network ioctls. The corresponding + changes in the glibc library are not available in Debian yet, though. + * streamdev is renamed to streamio. + + -- Marcus Brinkmann <brinkmd@debian.org> Fri, 12 Jan 2001 00:06:41 +0100 + +hurd (20001204) unstable; urgency=low + + * New snapshot from CVS, with a couple of bug fixes: + pfinet: Don't leak references. + ext2fs, ufs: Avoid a dn_set_?time vs sync thread race. + Corretly deny too long filenames. + nfsd: Fix a couple of memory leaks. + + * Additional patchs: + libdiskfs: Don't crash when symlink target is the empty string. + streamdev, kbd, mouse: New translators for X and klog device. + + -- Marcus Brinkmann <brinkmd@debian.org> Mon, 4 Dec 2000 15:18:39 +0100 + +hurd (20001127) unstable; urgency=low + + * New snapshot from CVS, really fixes isofs now. + + -- Marcus Brinkmann <brinkmd@debian.org> Mon, 27 Nov 2000 21:07:03 +0100 + +hurd (20001126) unstable; urgency=low + + * New snapshot from CVS, closes: #68417, #69281, #68626 + * Fix in 20001030 closes: #72319 + * debian/control: Add build dependencies, closes: #75734 + + -- Marcus Brinkmann <brinkmd@debian.org> Sun, 26 Nov 2000 05:53:19 +0100 + +hurd (20001030) unstable; urgency=low + + * New snapshot from CVS. + * Still contains all the goodies, streadev, kbd, mouse. Now opening + kbd, mouse more than once doesn't crash them (thanks Erik Verbruggen + <ejv@cs.kun.nl>) + * sutils/MAKEDEV.sh: kmsg is really klog. + + -- Marcus Brinkmann <brinkmd@debian.org> Tue, 30 Oct 2000 18:02:29 +0200 + +hurd (20000921) unstable; urgency=low + + * New snapshot from CVS + * Add streamdev by OKUJI Yoshinori + (source: ftp://alpha.gnu.org/contrib/okuji/hurd/streamdev-19990920.tar.gz) + * Add kbd and mouse by UCHIYAMA Yasushi <uch@nop.or.jp>. + * sutils/MAKEDEV.sh: Add kbd and kmsg. No sense to add mouse, as you need + to configure it (see /hurd/mouse --help). + + -- Marcus Brinkmann <brinkmd@debian.org> Sat, 23 Sep 2000 04:27:58 +0200 + +hurd (20000803) unstable; urgency=low + + * New snapshot from CVS. + * isofs: Patch to fix symlink handling. + + -- Marcus Brinkmann <brinkmd@debian.org> Thu, 3 Aug 2000 21:09:44 +0200 + +hurd (20000726) unstable; urgency=low + + * New snapshot from CVS. + * Fixes the infamous zero hole bug (actually both of them). + + -- Marcus Brinkmann <brinkmd@debian.org> Wed, 26 Jul 2000 02:24:06 +0200 + +hurd (20000703) unstable; urgency=low + + * New snapshot from CVS. + * exec/hashexec.c (check_hashbang: Fix off by one error in line 178. + Patch by Kalle Olavi Niemital. + + -- Marcus Brinkmann <bug-hurd@gnu.org> Mon, 3 Jul 2000 00:44:47 +0200 + +hurd (20000130) unstable; urgency=low + + * New snapshot from CVS. Closes: Bug#54282, Bug#40302, Bug#56076. + + -- Marcus Brinkmann <brinkmd@debian.org> Sun, 30 Jan 2000 14:55:39 +0100 + +hurd (19991209) unstable; urgency=low + + * New snapshot from CVS. + + -- Marcus Brinkmann <brinkmd@debian.org> Thu, 9 Dec 1999 23:43:23 +0100 + +hurd (19991022) unstable; urgency=low + + * New snapshot from CVS. + * libdiskfs/init-startup.c: Disable periodic syncing before shutting down. + This fixes the fs-unclean-on-reboot bug! + + -- Marcus Brinkmann <brinkmd@debian.org> Fri, 22 Oct 1999 21:32:02 +0200 + +hurd (19991004) unstable; urgency=high + + * New snapshot from CVS. + term: Realize bogus devices. + ext2fs: Important bug fixes! + + -- Marcus Brinkmann <brinkmd@debian.org> Sun, 3 Oct 1999 18:01:17 +0200 + +hurd (19990923) unstable; urgency=low + + * New snapshot from CVS. + MAKEDEV: pty created with mode 0666. + Implements pathconf for libdiskfs and libnetfs. + Various bug fixes. + * Development package now includes pic libraries. + + -- Marcus Brinkmann <brinkmd@debian.org> Sun, 19 Sep 1999 19:29:00 +0200 + +hurd (19990907) unstable; urgency=low + + * New snapshot from CVS. + * gzip /boot/serverboot to /boot/serverboot.gz + + -- Marcus Brinkmann <brinkmd@debian.org> Mon, 23 Aug 1999 15:12:10 +0200 + +hurd (19990725) unstable; urgency=low + + * New snapshot from CVS. + + -- Marcus Brinkmann <brinkmd@debian.org> Thu, 25 Jul 1999 16:16:03 +0200 + +hurd (19990714) unstable; urgency=low + + * New snapshot from CVS. + * debian/rules: etc/motd is in base-files, do not include it. + * Activate split-init. + + -- Marcus Brinkmann <brinkmd@debian.org> Wed, 14 Jul 1999 16:38:00 +0200 + +hurd (19990616) unstable; urgency=low + + * New snapshot from CVS. + * Now contains info and ps documentation. + + -- Marcus Brinkmann <brinkmd@debian.org> Thu, 17 Jun 1999 17:35:54 +0200 + +hurd (19990524) unstable; urgency=low + + * New snapshot from CVS. + + -- Marcus Brinkmann <brinkmd@debian.org> Mon, 24 May 1999 15:09:45 +0200 + +hurd (19990523) unstable; urgency=low + + * New snapshot from CVS, fixes: #38062, #37670, #37878, #37944. + + -- Marcus Brinkmann <brinkmd@debian.org> Mon, 24 May 1999 01:08:26 +0200 + +hurd (19990517fixed) unstable; urgency=low + + * debian/shlibs: corrected. + * exec/hashexec.c: Applied patch by Roland to make it work. + + -- Marcus Brinkmann <brinkmd@debian.org> Sun, 17 May 1999 00:25:11 +0200 + +hurd (19990517) unstable; urgency=low + + * New snapshot from CVS. + * Add shlibs file. + + -- Marcus Brinkmann <brinkmd@debian.org> Sun, 16 May 1999 15:28:09 +0200 + +hurd (19990425-1) unstable; urgency=low + + * Put shared library symlinks into the hurd-dev package. + * Clarify instructions in provided servers.boot. + * libfshelp/fetch-root.c: De-patched a change by tb which produced + strange errors. + + -- Marcus Brinkmann <brinkmd@debian.org> Thu, 29 Apr 1999 22:47:51 +0200 + +hurd (19990212-2) unstable; urgency=low + + * debian/control: Added Depends line for Hurd. + * Update docs to reflect new group maintainership. + * debian/copyright: Hurd libraries are *not* under the LGPL, so add a + clarifying note. + * Put static libraries and header files into /usr/lib and /usr/include + for people without the /usr symlink. + + -- Gordon Matzigkeit <bug-hurd@gnu.org> Wed, 17 Feb 1999 15:40:44 -0600 + +hurd (19990212-1) unstable; urgency=low + + * New upstream version from CVS. + * Deleted old libthreads... there's no going back now. + + -- Gordon Matzigkeit <gord@debian.org> Fri, 12 Feb 1999 03:25:55 -0600 + +hurd (19981204-1) unstable; urgency=low + + * New upstream release, supposed to work with glibc 2.0.106. + * Commented out use of old libthreads. + + -- Marcus Brinkmann <brinkmd@debian.org> Sun, 20 Dec 1998 04:24:40 +0100 + +hurd (19980915-2) unstable; urgency=low + + * exec/hashexec.c: Applied patch by Thomas Bushnell to fix make. + + -- Marcus Brinkmann <brinkmd@debian.org> Fri, 6 Nov 1998 23:10:11 +0100 + +hurd (19980915-1) unstable; urgency=low + + * New upstream release. + * debian/rules: Strip all binaries. + * debian/TODO: New file. + + -- Marcus Brinkmann <brinkmd@debian.org> Thu, 8 Oct 1998 03:34:40 +0200 + +hurd (19980716-2) unstable; urgency=low + + * Reverted libthreads to provide threadsafe malloc, as we use older + version of glibc2 for now. + * Do not remove size 0 files in 'rules clean', because hurd depends on + them. + * Do not build profiling libraries. + + -- Marcus Brinkmann <brinkmd@debian.org> Tue, 4 Aug 1998 21:58:55 +0200 + +hurd (19980716-1) unstable; urgency=low + + * Initial Version. + + -- Marcus Brinkmann <brinkmd@debian.org> Tue, 4 Aug 1998 21:58:55 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..7f8f011e --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..4d8a73b1 --- /dev/null +++ b/debian/control @@ -0,0 +1,87 @@ +Source: hurd +Section: admin +Priority: required +Maintainer: GNU Hurd Maintainers <debian-hurd@lists.debian.org> +Standards-Version: 3.9.3 +Build-Depends: mig (>= 1.3-2), gnumach-dev (>= 2:1.3.99.dfsg.cvs20070526), + libc0.3-dev (>= 2.13-38~), texinfo, texi2html, libncursesw5-dev, + debhelper (>= 7.0.50~), gcc-4.7, dpkg (>= 1.15.4) | install-info, autoconf, + libparted-dev, libpciaccess-dev, libx11-dev, x11proto-core-dev, pkg-config, + xkb-data, gawk, flex, bison, autotools-dev +Uploaders: Jeff Bailey <jbailey@raspberryginger.com>, + Neal H. Walfield <neal@debian.org>, Michael Banck <mbanck@debian.org>, + Samuel Thibault <sthibault@debian.org> +Homepage: http://www.gnu.org/software/hurd/hurd.html +Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-hurd/hurd.git +Vcs-Git: git://anonscm.debian.org/pkg-hurd/hurd.git + +Package: hurd-libs0.3 +Section: libs +Pre-Depends: ${misc:Pre-Depends} +Depends: ${misc:Depends}, ${shlibs:Depends} +Architecture: hurd-any +Multi-Arch: same +Description: GNU Hurd (libraries) + This package contains the libraries used by GNU Hurd. + +Package: hurd +Essential: yes +Pre-Depends: hurd-libs0.3 +Depends: ${misc:Depends}, hurd-libs0.3 (= ${binary:Version}), sysv-rc, netdde (>= 0.0.20120518~), ${shlibs:Depends}, xkb-data +Breaks: gnumach (<< 2:1.3.99.dfsg.cvs20070526-1), libc0.3 (<< 2.11.2-12), netdde (<< 0.0.20121127-2) +Suggests: hurd-doc +Recommends: bf-utf-source +Provides: makedev, login, console-driver-xkb +Replaces: makedev, login, random-egd, console-driver-xkb +Conflicts: makedev, login, console-driver-xkb +Architecture: hurd-any +Description: GNU Hurd + This is the GNU Hurd package. It contains essential system software and + libraries. + +Package: hurd-dev +Priority: standard +Section: libdevel +Architecture: hurd-any +Depends: ${misc:Depends}, ${shlibs:Depends}, libc0.3-dev (>= 2.13-31~), hurd (= ${binary:Version}) +Replaces: hurd (<< 20130226-2~) +Breaks: hurd (<< 20130226-2~) +Description: GNU Hurd (development files) + This package includes the header files and the static libraries. + +Package: hurd-dbg +Priority: extra +Section: debug +Architecture: hurd-any +Depends: ${misc:Depends}, hurd (= ${binary:Version}) +Description: GNU Hurd (debugging files) + This package includes the unstripped binaries and libraries. + +Package: hurd-doc +Priority: optional +Section: doc +Architecture: all +Depends: ${misc:Depends} +Suggests: www-browser +Description: GNU Hurd manual + This package includes the manual in info and HTML format. + +Package: hurd-libs0.3-udeb +Section: debian-installer +Package-Type: udeb +Priority: optional +Architecture: hurd-any +Depends: ${misc:Depends} +Description: GNU Hurd (libraries) - udeb + This package contains the libraries used by GNU Hurd udeb. + +Package: hurd-udeb +Package-Type: udeb +Priority: optional +Section: debian-installer +Architecture: hurd-any +Depends: ${misc:Depends}, hurd-libs0.3-udeb (= ${binary:Version}), xkb-data-udeb +Provides: hurd, ext2-modules, fat-modules, ipv6-modules, isofs-modules, loop-modules, mouse-modules, nfs-modules, socket-modules, ufs-modules +Description: GNU Hurd - udeb + This is the GNU Hurd udeb package. It contains essential system software and + libraries. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..a3717120 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,56 @@ +This package was debianized by Marcus Brinkmann <brinkmd@debian.org> +on Tue, 4 Aug 1998 21:52:45 +0200 + +It is currently maintained by the Debian GNU Hurd maintainers, who can be +reached via <debian-hurd@lists.debian.org>. + +libdde_linux26/ is from http://svn.tudos.org/repos/tudos/trunk/l4/pkg/dde/linux26 +and is a modified copy of the Linux kernel. + +Copyright: + + Copyright (C) 1991-2009 Linus Torvalds + and many others + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This package 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 package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General Public License version +2 can be found in `/usr/share/common-licenses/GPL-2'. + + +The rest of the sources are from http://savannah.gnu.org/projects/hurd + +Copyright 1992-2011 the Free Software Foundation, Inc. + +Note that the libraries distributed with the GNU Hurd are placed under +the standard GNU General Public License (*not* the Library General +Public License). + + 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 dated June, 1991. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General Public License +version 2 can be found in `/usr/share/common-licenses/GPL-2'. diff --git a/debian/hurd-dev.install.in b/debian/hurd-dev.install.in new file mode 100644 index 00000000..b563626a --- /dev/null +++ b/debian/hurd-dev.install.in @@ -0,0 +1,11 @@ +debian/tmp/bin/timertest +debian/tmp/bin/fstests +debian/tmp/lib/@DEB_HOST_MULTIARCH@/*.a lib/@DEB_HOST_MULTIARCH@ +debian/tmp/include/* usr/include +debian/tmp/lib/@DEB_HOST_MULTIARCH@/*.so lib/@DEB_HOST_MULTIARCH@ +libdde_linux26/lib/src/libdde_*.a usr/lib/@DEB_HOST_MULTIARCH@ +libdde_linux26/mk usr/share/libdde_linux26 +libdde_linux26/Makeconf* usr/share/libdde_linux26 +debian/tmp/usr/share/libdde_linux26/build usr/share/libdde_linux26 +debian/local/cdrom.h usr/include/sys +debian/local/soundcard.h usr/include/sys diff --git a/debian/hurd-dev.lintian-overrides b/debian/hurd-dev.lintian-overrides new file mode 100644 index 00000000..cde03032 --- /dev/null +++ b/debian/hurd-dev.lintian-overrides @@ -0,0 +1,15 @@ +unstripped-binary-or-object lib/*/libstore_bunzip2.a +unstripped-binary-or-object lib/*/libstore_concat.a +unstripped-binary-or-object lib/*/libstore_copy.a +unstripped-binary-or-object lib/*/libstore_device.a +unstripped-binary-or-object lib/*/libstore_file.a +unstripped-binary-or-object lib/*/libstore_gunzip.a +unstripped-binary-or-object lib/*/libstore_ileave.a +unstripped-binary-or-object lib/*/libstore_memobj.a +unstripped-binary-or-object lib/*/libstore_module.a +unstripped-binary-or-object lib/*/libstore_mvol.a +unstripped-binary-or-object lib/*/libstore_nbd.a +unstripped-binary-or-object lib/*/libstore_part.a +unstripped-binary-or-object lib/*/libstore_remap.a +unstripped-binary-or-object lib/*/libstore_task.a +unstripped-binary-or-object lib/*/libstore_zero.a diff --git a/debian/hurd-doc.docs b/debian/hurd-doc.docs new file mode 100644 index 00000000..5d7f66d2 --- /dev/null +++ b/debian/hurd-doc.docs @@ -0,0 +1,2 @@ +build/doc/hurd*html +doc/navigating diff --git a/debian/hurd-doc.info b/debian/hurd-doc.info new file mode 100644 index 00000000..183900da --- /dev/null +++ b/debian/hurd-doc.info @@ -0,0 +1 @@ +debian/tmp/share/info/hurd.info diff --git a/debian/hurd-libs0.3-udeb.install.in b/debian/hurd-libs0.3-udeb.install.in new file mode 100644 index 00000000..8b69f0c1 --- /dev/null +++ b/debian/hurd-libs0.3-udeb.install.in @@ -0,0 +1 @@ +debian/tmp/lib/@DEB_HOST_MULTIARCH@/*.so.* lib diff --git a/debian/hurd-libs0.3.install.in b/debian/hurd-libs0.3.install.in new file mode 100644 index 00000000..5c37f7cd --- /dev/null +++ b/debian/hurd-libs0.3.install.in @@ -0,0 +1 @@ +debian/tmp/lib/@DEB_HOST_MULTIARCH@/*.so.* diff --git a/debian/hurd-udeb.dirs b/debian/hurd-udeb.dirs new file mode 100644 index 00000000..a0a464b2 --- /dev/null +++ b/debian/hurd-udeb.dirs @@ -0,0 +1 @@ +servers diff --git a/debian/hurd-udeb.install.in b/debian/hurd-udeb.install.in new file mode 100644 index 00000000..9b2601e1 --- /dev/null +++ b/debian/hurd-udeb.install.in @@ -0,0 +1,72 @@ +debian/local/runsystem etc/hurd +debian/local/setup-translators usr/lib/hurd +debian/local/partman lib +debian/local/finish-install.d usr/lib +debian/local/X11/locale usr/share/X11 +debian/tmp/lib/@DEB_HOST_MULTIARCH@/hurd/console/pc_kbd.so.* usr/lib/hurd/console +debian/tmp/lib/@DEB_HOST_MULTIARCH@/hurd/console/pc_mouse.so.* usr/lib/hurd/console +debian/tmp/lib/@DEB_HOST_MULTIARCH@/hurd/console/vga.so.* usr/lib/hurd/console +debian/tmp/lib/hurd/console-run sbin +debian/tmp/sbin/e2os +debian/tmp/sbin/MAKEDEV +debian/tmp/sbin/losetup +debian/tmp/sbin/swapon +debian/tmp/sbin/swapoff +debian/tmp/bin/boot +debian/tmp/bin/console +debian/tmp/bin/shd +debian/tmp/bin/ps-hurd +debian/tmp/bin/settrans +debian/tmp/bin/showtrans +debian/tmp/bin/syncfs +debian/tmp/bin/fsysopts +debian/tmp/bin/storeinfo +debian/tmp/bin/login +debian/tmp/usr/bin/w-hurd +debian/tmp/usr/bin/uptime-hurd +debian/tmp/bin/ids +debian/tmp/bin/loginpr +debian/tmp/bin/sush +debian/tmp/usr/bin/vmstat-hurd +debian/tmp/bin/portinfo +debian/tmp/bin/devprobe +debian/tmp/bin/vminfo +debian/tmp/bin/addauth +debian/tmp/bin/rmauth +debian/tmp/bin/unsu +debian/tmp/bin/setauth +debian/tmp/bin/storecat +debian/tmp/bin/storeread +debian/tmp/bin/msgport +debian/tmp/bin/mount +debian/tmp/bin/umount +debian/tmp/dev/MAKEDEV +debian/tmp/hurd/auth +debian/tmp/hurd/console +debian/tmp/hurd/devnode +debian/tmp/hurd/exec +debian/tmp/hurd/ext2fs +debian/tmp/hurd/ext2fs.static /boot +debian/tmp/hurd/fatfs +debian/tmp/hurd/fifo +debian/tmp/hurd/firmlink +debian/tmp/hurd/fwd +debian/tmp/hurd/ifsock +debian/tmp/hurd/init +debian/tmp/hurd/iso9660fs +debian/tmp/hurd/mach-defpager +debian/tmp/hurd/magic +debian/tmp/hurd/new-fifo +debian/tmp/hurd/null +debian/tmp/hurd/pfinet +debian/tmp/hurd/pflocal +debian/tmp/hurd/proc +debian/tmp/hurd/procfs +debian/tmp/hurd/proxy-defpager +debian/tmp/hurd/random +debian/tmp/hurd/storeio +debian/tmp/hurd/streamio +debian/tmp/hurd/symlink +debian/tmp/hurd/term +debian/tmp/hurd/tmpfs +debian/tmp/usr/share/X11 diff --git a/debian/hurd-udeb.links b/debian/hurd-udeb.links new file mode 100644 index 00000000..70c452f7 --- /dev/null +++ b/debian/hurd-udeb.links @@ -0,0 +1 @@ +/lib/unifont.bdf /usr/share/hurd/vga-system.bdf diff --git a/debian/hurd-udeb.lintian-overrides b/debian/hurd-udeb.lintian-overrides new file mode 100644 index 00000000..7f67c429 --- /dev/null +++ b/debian/hurd-udeb.lintian-overrides @@ -0,0 +1,3 @@ +non-standard-toplevel-dir hurd/ +non-standard-toplevel-dir servers/ +package-contains-empty-directory servers/ diff --git a/debian/hurd.NEWS b/debian/hurd.NEWS new file mode 100644 index 00000000..ca0b9de0 --- /dev/null +++ b/debian/hurd.NEWS @@ -0,0 +1,31 @@ +hurd (20110319-1) unstable; urgency=low + + To harmonize with Debian security conventions, the Debian + GNU/Hurd login prompt is now a standard login/password prompt, + and not a login shell any more. To revert to a standard login, set the + shell of the login user to /bin/bash. + + -- Samuel Thibault <sthibault@debian.org> Tue, 15 Mar 2011 00:15:55 +0100 + +hurd (20050513-4) unstable; urgency=low + + The Hurd console may now be started automatically on bootup. The + file `/etc/default/hurd-console' controls whether the Hurd console + will be started, and if so, which options are used. To get the + Hurd console on bootup, change ENABLE to `true' and adjust the + other options to your liking. + + -- Michael Banck <mbanck@debian.org> Sun, 28 Aug 2005 14:43:31 +0200 + +hurd (20050119-1) unstable; urgency=low + + The command line syntax for the console client has slightly + changed. It is no longer necessary or even allowed to specify the + consnode path to the short `-c' option (e.g. `-c /dev/cons'), + /dev/cons is implied as default (but can be changed using the long + option, `--consnode=FOO'). When using the mouse or keyboard + repeater, the console client command line should now be as follows: + console -d vga -d pc_kbd --repeat=kbd -d pc_mouse --repeat=mouse \ + -d generic_speaker -c /dev/vcs + + -- Michael Banck <mbanck@debian.org> Fri, 21 Jan 2005 02:33:36 +0100 diff --git a/debian/hurd.dirs b/debian/hurd.dirs new file mode 100644 index 00000000..7af900ee --- /dev/null +++ b/debian/hurd.dirs @@ -0,0 +1,7 @@ +servers +servers/socket +etc/default +etc/sysctl.d +usr/share/msgids +usr/bin +boot diff --git a/debian/hurd.docs b/debian/hurd.docs new file mode 100644 index 00000000..b5c73628 --- /dev/null +++ b/debian/hurd.docs @@ -0,0 +1,4 @@ +BUGS +NEWS +README +TODO diff --git a/debian/hurd.examples b/debian/hurd.examples new file mode 100644 index 00000000..8b0bfeea --- /dev/null +++ b/debian/hurd.examples @@ -0,0 +1 @@ +debian/local/menu.lst diff --git a/debian/hurd.hurd-console.default b/debian/hurd.hurd-console.default new file mode 100644 index 00000000..db67f3fa --- /dev/null +++ b/debian/hurd.hurd-console.default @@ -0,0 +1,31 @@ +# Options to start the Hurd console. + +# Set this to 'false' to avoid running the Hurd console on bootup. +ENABLE='true' + +# The display driver, mandatory. Either `vga' or `ncursesw'. In the case of +# VGA, -f /some/where/file.bdf can be appended to load a specific font. +DISPLAY='-d vga' + +# The keyboard driver, mandatory. Either `pc_kbd' or `xkb' from the +# console-driver-xkb package. +KBD='-d pc_kbd' + +# this is bogus for a lot of cases, but the best we can do for now. +if [ -f /etc/default/keyboard ] +then + . /etc/default/keyboard +fi +[ -z "$XKBLAYOUT" ] || KBD="$KBD --keymap $XKBLAYOUT" + +# The keyboard repeater. Required for running X11. +KBD_REPEAT='--repeat=kbd' + +# The mouse driver. Optional. +MOUSE='-d pc_mouse --protocol=ps/2' + +# The mouse repeater. Required for running X11. +MOUSE_REPEAT='--repeat=mouse' + +# The pc speaker. Optional. +#SPEAKER='-d generic_speaker' diff --git a/debian/hurd.install.in b/debian/hurd.install.in new file mode 100644 index 00000000..eb16d79b --- /dev/null +++ b/debian/hurd.install.in @@ -0,0 +1,71 @@ +debian/local/setup-translators usr/lib/hurd +debian/local/random-hurd.sh hurd +debian/local/urandom-hurd.sh hurd +debian/local/securetty etc +debian/tmp/lib/@DEB_HOST_MULTIARCH@/hurd/console/*.so.* usr/lib/hurd/console +debian/tmp/hurd/* +debian/tmp/lib/hurd/rc etc/hurd +debian/tmp/lib/hurd/getty sbin +debian/tmp/lib/hurd/console-run sbin +debian/tmp/lib/hurd/runttys sbin +debian/tmp/lib/hurd/runsystem.gnu etc/hurd +debian/tmp/sbin/nfsd +debian/tmp/sbin/e2os +debian/tmp/sbin/MAKEDEV +debian/tmp/sbin/losetup +debian/tmp/sbin/reboot-hurd +debian/tmp/sbin/halt-hurd +debian/tmp/sbin/swapon +debian/tmp/sbin/swapoff +debian/tmp/sbin/fsck.ufs +debian/tmp/sbin/mkfs.ufs +debian/tmp/sbin/clri.ufs +debian/tmp/sbin/stati.ufs +debian/tmp/bin/boot +debian/tmp/bin/console +debian/tmp/bin/shd +debian/tmp/bin/ps-hurd +debian/tmp/bin/settrans +debian/tmp/bin/showtrans +debian/tmp/bin/syncfs +debian/tmp/bin/fsysopts +debian/tmp/bin/storeinfo +debian/tmp/bin/login +debian/tmp/usr/bin/w-hurd +debian/tmp/usr/bin/uptime-hurd +debian/tmp/bin/ids +debian/tmp/bin/loginpr +debian/tmp/bin/sush +debian/tmp/usr/bin/vmstat-hurd +debian/tmp/bin/portinfo +debian/tmp/bin/devprobe +debian/tmp/bin/vminfo +debian/tmp/bin/addauth +debian/tmp/bin/rmauth +debian/tmp/bin/unsu +debian/tmp/bin/setauth +debian/tmp/bin/ftpcp +debian/tmp/bin/ftpdir +debian/tmp/bin/storecat +debian/tmp/bin/storeread +debian/tmp/bin/msgport +debian/tmp/bin/rpctrace +debian/tmp/bin/mount +debian/tmp/bin/umount +debian/tmp/bin/gcore +debian/tmp/bin/fakeauth +debian/tmp/usr/bin/fakeroot-hurd +debian/tmp/bin/forks +debian/tmp/bin/remap +debian/tmp/etc/login +debian/tmp/etc/login/.bash_login +debian/tmp/etc/login/.bashrc +debian/tmp/etc/login/.hushlogin +debian/tmp/etc/login/.profile +debian/tmp/etc/login/README +debian/tmp/etc/ttys +debian/tmp/dev/MAKEDEV +debian/tmp/share/msgids/*.msgids usr/share/msgids +debian/tmp/usr/share/X11/xkb +console/motd.UTF8 etc +release/servers.boot boot diff --git a/debian/hurd.links b/debian/hurd.links new file mode 100644 index 00000000..d1481a66 --- /dev/null +++ b/debian/hurd.links @@ -0,0 +1 @@ +/usr/src/unifont.bdf /usr/share/hurd/vga-system.bdf diff --git a/debian/hurd.lintian-overrides b/debian/hurd.lintian-overrides new file mode 100644 index 00000000..9b19749e --- /dev/null +++ b/debian/hurd.lintian-overrides @@ -0,0 +1,7 @@ +statically-linked-binary hurd/mach-defpager +setuid-binary bin/ids 4755 root/root +setuid-binary bin/login 4755 root/root +setuid-binary bin/ps-hurd 4755 root/root +setuid-binary usr/bin/w-hurd 4755 root/root +possibly-insecure-handling-of-tmp-files-in-maintainer-script postinst:75 +package-contains-empty-directory servers/socket/ diff --git a/debian/hurd.postinst b/debian/hurd.postinst new file mode 100644 index 00000000..eb079b71 --- /dev/null +++ b/debian/hurd.postinst @@ -0,0 +1,105 @@ +#!/bin/sh + +set -e + +if [ "$1" = configure ] && [ "$2" ]; then + # Upgrade from old version: drop /libexec/runsystem + update-alternatives --quiet \ + --remove runsystem /libexec/runsystem.gnu +fi +update-alternatives --quiet \ + --install /etc/hurd/runsystem runsystem /etc/hurd/runsystem.gnu 20 \ + --slave /sbin/halt halt /sbin/halt-hurd \ + --slave /sbin/reboot reboot /sbin/reboot-hurd + +update-alternatives \ + --install /usr/bin/fakeroot fakeroot /usr/bin/fakeroot-hurd 30 + +update-alternatives \ + --install /bin/ps ps /bin/ps-hurd 60 + +update-alternatives \ + --install /usr/bin/uptime uptime /usr/bin/uptime-hurd 30 + +update-alternatives \ + --install /usr/bin/vmstat vmstat /usr/bin/vmstat-hurd 60 + +update-alternatives \ + --install /usr/bin/w w /usr/bin/w-hurd 60 + +ADDUSERCONF='/etc/adduser.conf' + +if test -f $ADDUSERCONF; then + FIRST_SYSTEM_UID=$(sed -n "s/^[[:space:]]*FIRST_SYSTEM_UID[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" $ADDUSERCONF) + LAST_SYSTEM_UID=$(sed -n "s/^[[:space:]]*LAST_SYSTEM_UID[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" $ADDUSERCONF) + FIRST_SYSTEM_GID=$(sed -n "s/^[[:space:]]*FIRST_SYSTEM_GID[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" $ADDUSERCONF) + LAST_SYSTEM_GID=$(sed -n "s/^[[:space:]]*LAST_SYSTEM_GID[[:space:]]*=[[:space:]]*[\"']\?\([^\"']*\)[\"']\?/\1/p" $ADDUSERCONF) +fi + +if test -z "$FIRST_SYSTEM_UID"; then + FIRST_SYSTEM_UID=100 +fi +if test -z "$LAST_SYSTEM_UID"; then + LAST_SYSTEM_UID=999 +fi +if test -z "$FIRST_SYSTEM_GID"; then + FIRST_SYSTEM_GID=100 +fi +if test -z "$LAST_SYSTEM_GID"; then + LAST_SYSTEM_GID=999 +fi + +if [ "$1" = configure ]; then + add-shell /bin/loginpr || true + if ! getent passwd login >/dev/null; then + useradd -K UID_MIN=$FIRST_SYSTEM_UID -K UID_MAX=$LAST_SYSTEM_UID \ + -K GID_MIN=$FIRST_SYSTEM_GID -K GID_MAX=$LAST_SYSTEM_GID \ + --home-dir /etc/login --no-create-home \ + --shell /bin/loginpr --comment "login user" \ + --user-group login + fi +fi + +#DEBHELPER# + +# Remove alternative introduced by 20111106-1 +update-alternatives --remove random /dev/random-hurd + +if [ "$1" = configure ] && [ "$2" ]; then + # Upgrade: create the missing device and server nodes + if showtrans /dev/random 2> /dev/null | grep -q /tmp/entropy.sock + then + # old random-egd translator, remove + settrans -go /dev/random + settrans -go /dev/urandom + ( cd /dev ; rm -f random urandom ) + fi + /usr/lib/hurd/setup-translators -K + + # upgrade pfinet into using DDE node + if PFINET=`showtrans /servers/socket/2` 2> /dev/null + then + PFINET=`echo "$PFINET" | sed 's_ eth_ /dev/eth_'` + PFINET=`echo "$PFINET" | sed 's_=eth_=/dev/eth_'` + settrans -pk /servers/socket/2 $PFINET + fi + if PFINET6="`showtrans /servers/socket/26`" 2> /dev/null + then + PFINET6=`echo "$PFINET6" | sed 's_ eth_ /dev/eth_'` + PFINET6=`echo "$PFINET6" | sed 's_=eth_=/dev/eth_'` + settrans -pk /servers/socket/26 $PFINET6 + fi +fi + +update-alternatives --install /hurd/random.sh random.sh /hurd/random-hurd.sh 10 \ + --slave /hurd/urandom.sh urandom.sh /hurd/urandom-hurd.sh + +if [ "$1" = configure ] ; then + # Generate initial pool + UMASK=`umask` + umask 077 + [ -f /var/spool/random-seed ] || dd < /dev/urandom > /var/spool/random-seed bs=1 count=600 2> /dev/null + # TODO: will need to run settrans -ga /dev/random at system stop to make + # it save it back + umask $UMASK +fi diff --git a/debian/hurd.postrm b/debian/hurd.postrm new file mode 100644 index 00000000..ea209f71 --- /dev/null +++ b/debian/hurd.postrm @@ -0,0 +1,20 @@ +#!/bin/sh +set -e + +if [ "$1" = purge ]; then + remove-shell /bin/loginpr + if ! deluser --quiet --system login > /dev/null; then + echo " +Removing the user 'login' failed, most likely because the user is still +logged in. To remove the user and group terminate the session in question +and execute + + deluser --quiet --system login + delgroup --quiet --system login +" + else + delgroup --quiet --system login > /dev/null || true + fi +fi + +#DEBHELPER# diff --git a/debian/hurd.prerm b/debian/hurd.prerm new file mode 100644 index 00000000..78105cdc --- /dev/null +++ b/debian/hurd.prerm @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +if [ "$1" = remove ]; then + update-alternatives --remove random /dev/random-hurd +fi + +#DEBHELPER# diff --git a/debian/local/X11/locale/Compose b/debian/local/X11/locale/Compose new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/debian/local/X11/locale/Compose diff --git a/debian/local/X11/locale/compose.dir b/debian/local/X11/locale/compose.dir new file mode 100644 index 00000000..875529f9 --- /dev/null +++ b/debian/local/X11/locale/compose.dir @@ -0,0 +1 @@ +Compose C diff --git a/debian/local/cdrom.h b/debian/local/cdrom.h new file mode 100644 index 00000000..f967a852 --- /dev/null +++ b/debian/local/cdrom.h @@ -0,0 +1,941 @@ +/* + * From + * -- <linux/cdrom.h> + * General header file for linux CD-ROM drivers + * Copyright (C) 1992 David Giller, rafetmad@oxy.edu + * 1994, 1995 Eberhard Mönkeberg, emoenke@gwdg.de + * 1996 David van Leeuwen, david@tm.tno.nl + * 1997, 1998 Erik Andersen, andersee@debian.org + * 1998-2002 Jens Axboe, axboe@suse.de + */ + +#ifndef _SYS_CDROM_H +#define _SYS_CDROM_H + +#include <endian.h> + +/******************************************************* + * As of Linux 2.1.x, all Linux CD-ROM application programs will use this + * (and only this) include file. It is my hope to provide Linux with + * a uniform interface between software accessing CD-ROMs and the various + * device drivers that actually talk to the drives. There may still be + * 23 different kinds of strange CD-ROM drives, but at least there will + * now be one, and only one, Linux CD-ROM interface. + * + * Additionally, as of Linux 2.1.x, all Linux application programs + * should use the O_NONBLOCK option when opening a CD-ROM device + * for subsequent ioctl commands. This allows for neat system errors + * like "No medium found" or "Wrong medium type" upon attempting to + * mount or play an empty slot, mount an audio disc, or play a data disc. + * Generally, changing an application program to support O_NONBLOCK + * is as easy as the following: + * - drive = open("/dev/cdrom", O_RDONLY); + * + drive = open("/dev/cdrom", O_RDONLY | O_NONBLOCK); + * It is worth the small change. + * + * Patches for many common CD programs (provided by David A. van Leeuwen) + * can be found at: ftp://ftp.gwdg.de/pub/linux/cdrom/drivers/cm206/ + * + *******************************************************/ + +/* When a driver supports a certain function, but the cdrom drive we are + * using doesn't, we will return the error EDRIVE_CANT_DO_THIS. We will + * borrow the "Operation not supported" error from the network folks to + * accomplish this. Maybe someday we will get a more targeted error code, + * but this will do for now... */ +#define EDRIVE_CANT_DO_THIS EOPNOTSUPP + +/******************************************************* + * The CD-ROM IOCTL commands -- these should be supported by + * all the various cdrom drivers. For the CD-ROM ioctls, we + * will commandeer byte 0x53, or 'S'. + *******************************************************/ +#define CDROMPAUSE _IO('S', 0x01) /* Pause Audio Operation */ +#define CDROMRESUME _IO('S', 0x02) /* Resume paused Audio Operation */ +#define CDROMPLAYMSF _IOW('S', 0x03, struct cdrom_msf) /* Play Audio MSF */ +#define CDROMPLAYTRKIND _IOW('S', 0x04, struct cdrom_ti) /* Play Audio Track/index */ +#define CDROMREADTOCHDR _IOWR('S', 0x05, struct cdrom_tochdr) /* Read TOC header */ +#define CDROMREADTOCENTRY _IOWR('S', 0x06, struct cdrom_tocentry) /* Read TOC entry */ +#define CDROMSTOP _IO('S', 0x07) /* Stop the cdrom drive */ +#define CDROMSTART _IO('S', 0x08) /* Start the cdrom drive */ +#define CDROMEJECT _IO('S', 0x09) /* Ejects the cdrom media */ +#define CDROMVOLCTRL _IOW('S', 0x0a, struct cdrom_volctrl) /* Control output volume */ +#define CDROMSUBCHNL _IOWR('S', 0x0b, struct cdrom_subchnl) /* Read subchannel data */ +#define CDROMREADMODE2 _IOWR('S', 0x0c, union cdrom_read_mode2) /* Read CDROM mode 2 data (2336 Bytes) */ +#define CDROMREADMODE1 _IOWR('S', 0x0d, union cdrom_read_mode1) /* Read CDROM mode 1 data (2048 Bytes) */ +#define CDROMREADAUDIO _IOWR('S', 0x0e, struct cdrom_read_audio) +#define CDROMEJECT_SW _IOIW('S', 0x0f, int) /* enable(1)/disable(0) auto-ejecting */ +#define CDROMMULTISESSION _IOWR('S', 0x10, struct cdrom_multisession) /* Obtain the start-of-last-session + address of multi session disks */ +#define CDROM_GET_MCN _IOR('S', 0x11, struct cdrom_mcn) /* Obtain the "Universal Product Code" + if available */ +#define CDROM_GET_UPC CDROM_GET_MCN /* This one is deprecated, + but here anyway for compatibility */ +#define CDROMRESET _IO('S', 0x12) /* hard-reset the drive */ +#define CDROMVOLREAD _IOR('S', 0x13, struct cdrom_volctrl) /* Get the drive's volume setting */ +#define CDROMREADRAW _IOWR('S', 0x14, union cdrom_read_raw) /* read data in raw mode (2352 Bytes) */ +/* + * These ioctls are used only used in aztcd.c and optcd.c + */ +#define CDROMREADCOOKED _IOR('S', 0x15, struct cdrom_read_cooked) /* read data in cooked mode */ +#define CDROMSEEK _IOW('S', 0x16, struct cdrom_msf) /* seek msf address */ + +/* + * This ioctl is only used by the scsi-cd driver. + It is for playing audio in logical block addressing mode. + */ +#define CDROMPLAYBLK _IOW('S', 0x17, struct cdrom_blk) /* (struct cdrom_blk) */ + +/* + * These ioctls are only used in optcd.c + */ +#define CDROMREADALL _IOR('S', 0x18, struct cdrom_read_all) /* read all 2646 bytes */ + +/* + * These ioctls are (now) only in ide-cd.c for controlling + * drive spindown time. They should be implemented in the + * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10, + * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE... + * -Erik + */ +#define CDROMGETSPINDOWN _IOR('S', 0x1d, char) +#define CDROMSETSPINDOWN _IOW('S', 0x1e, char) + +/* + * These ioctls are implemented through the uniform CD-ROM driver + * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM + * drivers are eventually ported to the uniform CD-ROM driver interface. + */ +#define CDROMCLOSETRAY _IO('S', 0x19) /* pendant of CDROMEJECT */ +#define CDROM_SET_OPTIONS _IOIW('S', 0x20, int) /* Set behavior options */ +#define CDROM_CLEAR_OPTIONS _IOIW('S', 0x21, int) /* Clear behavior options */ +#define CDROM_SELECT_SPEED _IOIW('S', 0x22, int) /* Set the CD-ROM speed */ +#define CDROM_SELECT_DISC _IOIW('S', 0x23, int) /* Select disc (for juke-boxes) */ +#define CDROM_MEDIA_CHANGED _IOIW('S', 0x25, int) /* Check is media changed */ +#define CDROM_DRIVE_STATUS _IOIW('S', 0x26, int) /* Get tray position, etc. */ +#define CDROM_DISC_STATUS _IO('S', 0x27) /* Get disc type, etc. */ +#define CDROM_CHANGER_NSLOTS _IO('S', 0x28) /* Get number of slots */ +#define CDROM_LOCKDOOR _IOIW('S', 0x29, int) /* lock or unlock door */ +#define CDROM_DEBUG _IOIW('S', 0x30, int) /* Turn debug messages on/off */ +#define CDROM_GET_CAPABILITY _IO('S', 0x31) /* get capabilities */ + +/* Note that scsi/scsi_ioctl.h also uses _IO('S', 0x82, ) - 0x5386. + * Future CDROM ioctls should be kept below 0x537F + */ + +/* This ioctl is only used by sbpcd at the moment */ +#define CDROMAUDIOBUFSIZ _IOIW('S', 0x82, int) /* set the audio buffer size */ + /* conflict with SCSI_IOCTL_GET_IDLUN */ + +/* DVD-ROM Specific ioctls */ +#define DVD_READ_STRUCT _IOWR('S', 0x90, dvd_struct) /* Read structure */ +#if 0 +#define DVD_WRITE_STRUCT _IO('S', 0x91, ) /* Write structure */ +#endif +#define DVD_AUTH _IOWR('S', 0x92, dvd_authinfo) /* Authentication */ + +#define CDROM_SEND_PACKET _IOWR('S', 0x93, struct cdrom_generic_command) /* send a packet to the drive */ +#define CDROM_NEXT_WRITABLE _IOR('S', 0x94, long) /* get next writable block */ +#define CDROM_LAST_WRITTEN _IOR('S', 0x95, long) /* get last block written on disc */ + +/******************************************************* + * CDROM IOCTL structures + *******************************************************/ + +/* Address in MSF format */ +#define _IOT_cdrom_msf0 _IOT (_IOTS (char), 3, 0, 0, 0, 0) +struct cdrom_msf0 +{ + unsigned char minute; + unsigned char second; + unsigned char frame; +}; + +/* Address in either MSF or logical format */ +#define _IOT_cdrom_addr _IOT (_IOTS (int), 1, 0, 0, 0, 0) +union cdrom_addr +{ + struct cdrom_msf0 msf; + int lba; +}; + +/* This struct is used by the CDROMPLAYMSF ioctl */ +#define _IOT_cdrom_msf _IOT (_IOTS (char), 6, 0, 0, 0, 0) +struct cdrom_msf +{ + unsigned char cdmsf_min0; /* start minute */ + unsigned char cdmsf_sec0; /* start second */ + unsigned char cdmsf_frame0; /* start frame */ + unsigned char cdmsf_min1; /* end minute */ + unsigned char cdmsf_sec1; /* end second */ + unsigned char cdmsf_frame1; /* end frame */ +}; + +/* This struct is used by the CDROMPLAYTRKIND ioctl */ +#define _IOT_cdrom_ti _IOT (_IOTS (char), 4, 0, 0, 0, 0) +struct cdrom_ti +{ + unsigned char cdti_trk0; /* start track */ + unsigned char cdti_ind0; /* start index */ + unsigned char cdti_trk1; /* end track */ + unsigned char cdti_ind1; /* end index */ +}; + +/* This struct is used by the CDROMREADTOCHDR ioctl */ +#define _IOT_cdrom_tochdr _IOT (_IOTS (char), 2, 0, 0, 0, 0) +struct cdrom_tochdr +{ + unsigned char cdth_trk0; /* start track */ + unsigned char cdth_trk1; /* end track */ +}; + +/* This struct is used by the CDROMVOLCTRL and CDROMVOLREAD ioctls */ +#define _IOT_cdrom_volctrl _IOT (_IOTS (char), 4, 0, 0, 0, 0) +struct cdrom_volctrl +{ + unsigned char channel0; + unsigned char channel1; + unsigned char channel2; + unsigned char channel3; +}; + +/* This struct is used by the CDROMSUBCHNL ioctl */ +#define _IOT_cdrom_subchnl _IOT (_IOTS (char), 5, _IOTS (int), 2, 0, 0) +struct cdrom_subchnl +{ + unsigned char cdsc_format; + unsigned char cdsc_audiostatus; + unsigned char cdsc_adr: 4; + unsigned char cdsc_ctrl: 4; + unsigned char cdsc_trk; + unsigned char cdsc_ind; + union cdrom_addr cdsc_absaddr; + union cdrom_addr cdsc_reladdr; +}; + +/* This struct is used by the CDROMREADTOCENTRY ioctl */ +#define _IOT_cdrom_tocentry _IOT (_IOTS (char), 3, _IOTS (int), 1, _IOTS (char), 1) +struct cdrom_tocentry +{ + unsigned char cdte_track; + unsigned char cdte_adr :4; + unsigned char cdte_ctrl :4; + unsigned char cdte_format; + union cdrom_addr cdte_addr; + unsigned char cdte_datamode; +}; + +/* This struct used by the CDROMREADMODE1, and CDROMREADMODE2 ioctls */ +struct cdrom_read +{ + int cdread_lba; + char *cdread_bufaddr; + int cdread_buflen; +}; + +/* This struct is used by the CDROMREADAUDIO ioctl */ +struct cdrom_read_audio +{ + union cdrom_addr addr; /* frame address */ + unsigned char addr_format; /* CDROM_LBA or CDROM_MSF */ + int nframes; /* number of 2352-byte-frames to read at once */ + unsigned char *buf; /* frame buffer (size: nframes*2352 bytes) */ +}; + +/* This struct is used with the CDROMMULTISESSION ioctl */ +#define _IOT_cdrom_multisession _IOT (_IOTS (int), 1, _IOTS (char), 2, 0, 0) +struct cdrom_multisession +{ + union cdrom_addr addr; /* frame address: start-of-last-session + (not the new "frame 16"!). Only valid + if the "xa_flag" is true. */ + unsigned char xa_flag; /* 1: "is XA disk" */ + unsigned char addr_format; /* CDROM_LBA or CDROM_MSF */ +}; + +/* This struct is used with the CDROM_GET_MCN ioctl. + * Very few audio discs actually have Universal Product Code information, + * which should just be the Medium Catalog Number on the box. Also note + * that the way the codeis written on CD is _not_ uniform across all discs! + */ +#define _IOT_cdrom_mcn _IOT (_IOTS (char), 14, 0, 0, 0, 0) +struct cdrom_mcn +{ + unsigned char medium_catalog_number[14]; /* 13 ASCII digits, null-terminated */ +}; + +/* This is used by the CDROMPLAYBLK ioctl */ +#define _IOT_cdrom_blk _IOT (_IOTS (unsigned), 1, _IOTS (short), 1, 0, 0) +struct cdrom_blk +{ + unsigned from; + unsigned short len; +}; + +#define CDROM_PACKET_SIZE 12 + +#define CGC_DATA_UNKNOWN 0 +#define CGC_DATA_WRITE 1 +#define CGC_DATA_READ 2 +#define CGC_DATA_NONE 3 + +/* for CDROM_PACKET_COMMAND ioctl */ +struct cdrom_generic_command +{ + unsigned char cmd[CDROM_PACKET_SIZE]; + unsigned char *buffer; + unsigned int buflen; + int stat; + struct request_sense *sense; + unsigned char data_direction; + int quiet; + int timeout; + void *reserved[1]; /* unused, actually */ +}; + +/* + * A CD-ROM physical sector size is 2048, 2052, 2056, 2324, 2332, 2336, + * 2340, or 2352 bytes long. + +* Sector types of the standard CD-ROM data formats: + * + * format sector type user data size (bytes) + * ----------------------------------------------------------------------------- + * 1 (Red Book) CD-DA 2352 (CD_FRAMESIZE_RAW) + * 2 (Yellow Book) Mode1 Form1 2048 (CD_FRAMESIZE) + * 3 (Yellow Book) Mode1 Form2 2336 (CD_FRAMESIZE_RAW0) + * 4 (Green Book) Mode2 Form1 2048 (CD_FRAMESIZE) + * 5 (Green Book) Mode2 Form2 2328 (2324+4 spare bytes) + * + * + * The layout of the standard CD-ROM data formats: + * ----------------------------------------------------------------------------- + * - audio (red): | audio_sample_bytes | + * | 2352 | + * + * - data (yellow, mode1): | sync - head - data - EDC - zero - ECC | + * | 12 - 4 - 2048 - 4 - 8 - 276 | + * + * - data (yellow, mode2): | sync - head - data | + * | 12 - 4 - 2336 | + * + * - XA data (green, mode2 form1): | sync - head - sub - data - EDC - ECC | + * | 12 - 4 - 8 - 2048 - 4 - 276 | + * + * - XA data (green, mode2 form2): | sync - head - sub - data - Spare | + * | 12 - 4 - 8 - 2324 - 4 | + * + */ + +/* Some generally useful CD-ROM information -- mostly based on the above */ +#define CD_MINS 74 /* max. minutes per CD, not really a limit */ +#define CD_SECS 60 /* seconds per minute */ +#define CD_FRAMES 75 /* frames per second */ +#define CD_SYNC_SIZE 12 /* 12 sync bytes per raw data frame */ +#define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */ +#define CD_CHUNK_SIZE 24 /* lowest-level "data bytes piece" */ +#define CD_NUM_OF_CHUNKS 98 /* chunks per frame */ +#define CD_FRAMESIZE_SUB 96 /* subchannel data "frame" size */ +#define CD_HEAD_SIZE 4 /* header (address) bytes per raw data frame */ +#define CD_SUBHEAD_SIZE 8 /* subheader bytes per raw XA data frame */ +#define CD_EDC_SIZE 4 /* bytes EDC per most raw data frame types */ +#define CD_ZERO_SIZE 8 /* bytes zero per yellow book mode 1 frame */ +#define CD_ECC_SIZE 276 /* bytes ECC per most raw data frame types */ +#define CD_FRAMESIZE 2048 /* bytes per frame, "cooked" mode */ +#define CD_FRAMESIZE_RAW 2352 /* bytes per frame, "raw" mode */ +#define CD_FRAMESIZE_RAWER 2646 /* The maximum possible returned bytes */ +/* most drives don't deliver everything: */ +#define CD_FRAMESIZE_RAW1 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE) /*2340*/ +#define CD_FRAMESIZE_RAW0 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE-CD_HEAD_SIZE) /*2336*/ + +union cdrom_read_mode1 +{ + struct cdrom_msf msf; + char buffer[CD_FRAMESIZE]; +}; + +union cdrom_read_mode2 +{ + struct cdrom_msf msf; + char buffer[CD_FRAMESIZE_RAW0]; +}; + +union cdrom_read_raw +{ + struct cdrom_msf msf; + char buffer[CD_FRAMESIZE_RAW]; +}; + +struct cdrom_read_cooked +{ + char buffer[CD_FRAMESIZE]; +}; + +struct cdrom_read_all +{ + char buffer[CD_FRAMESIZE_RAWER]; +}; + +#define CD_XA_HEAD (CD_HEAD_SIZE+CD_SUBHEAD_SIZE) /* "before data" part of raw XA frame */ +#define CD_XA_TAIL (CD_EDC_SIZE+CD_ECC_SIZE) /* "after data" part of raw XA frame */ +#define CD_XA_SYNC_HEAD (CD_SYNC_SIZE+CD_XA_HEAD) /* sync bytes + header of XA frame */ + +/* CD-ROM address types (cdrom_tocentry.cdte_format) */ +#define CDROM_LBA 0x01 /* "logical block": first frame is #0 */ +#define CDROM_MSF 0x02 /* "minute-second-frame": binary, not bcd here! */ + +/* bit to tell whether track is data or audio (cdrom_tocentry.cdte_ctrl) */ +#define CDROM_DATA_TRACK 0x04 + +/* The leadout track is always 0xAA, regardless of # of tracks on disc */ +#define CDROM_LEADOUT 0xAA + +/* audio states (from SCSI-2, but seen with other drives, too) */ +#define CDROM_AUDIO_INVALID 0x00 /* audio status not supported */ +#define CDROM_AUDIO_PLAY 0x11 /* audio play operation in progress */ +#define CDROM_AUDIO_PAUSED 0x12 /* audio play operation paused */ +#define CDROM_AUDIO_COMPLETED 0x13 /* audio play successfully completed */ +#define CDROM_AUDIO_ERROR 0x14 /* audio play stopped due to error */ +#define CDROM_AUDIO_NO_STATUS 0x15 /* no current audio status to return */ + +/* capability flags used with the uniform CD-ROM driver */ +#define CDC_CLOSE_TRAY 0x1 /* caddy systems _can't_ close */ +#define CDC_OPEN_TRAY 0x2 /* but _can_ eject. */ +#define CDC_LOCK 0x4 /* disable manual eject */ +#define CDC_SELECT_SPEED 0x8 /* programmable speed */ +#define CDC_SELECT_DISC 0x10 /* select disc from juke-box */ +#define CDC_MULTI_SESSION 0x20 /* read sessions>1 */ +#define CDC_MCN 0x40 /* Medium Catalog Number */ +#define CDC_MEDIA_CHANGED 0x80 /* media changed */ +#define CDC_PLAY_AUDIO 0x100 /* audio functions */ +#define CDC_RESET 0x200 /* hard reset device */ +#define CDC_DRIVE_STATUS 0x800 /* driver implements drive status */ +#define CDC_GENERIC_PACKET 0x1000 /* driver implements generic packets */ +#define CDC_CD_R 0x2000 /* drive is a CD-R */ +#define CDC_CD_RW 0x4000 /* drive is a CD-RW */ +#define CDC_DVD 0x8000 /* drive is a DVD */ +#define CDC_DVD_R 0x10000 /* drive can write DVD-R */ +#define CDC_DVD_RAM 0x20000 /* drive can write DVD-RAM */ +#define CDC_MO_DRIVE 0x40000 /* drive is an MO device */ +#define CDC_MRW 0x80000 /* drive can read MRW */ +#define CDC_MRW_W 0x100000 /* drive can write MRW */ +#define CDC_RAM 0x200000 /* ok to open for WRITE */ + +/* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */ +#define CDS_NO_INFO 0 /* if not implemented */ +#define CDS_NO_DISC 1 +#define CDS_TRAY_OPEN 2 +#define CDS_DRIVE_NOT_READY 3 +#define CDS_DISC_OK 4 + +/* return values for the CDROM_DISC_STATUS ioctl */ +/* can also return CDS_NO_[INFO|DISC], from above */ +#define CDS_AUDIO 100 +#define CDS_DATA_1 101 +#define CDS_DATA_2 102 +#define CDS_XA_2_1 103 +#define CDS_XA_2_2 104 +#define CDS_MIXED 105 + +/* User-configurable behavior options for the uniform CD-ROM driver */ +#define CDO_AUTO_CLOSE 0x1 /* close tray on first open() */ +#define CDO_AUTO_EJECT 0x2 /* open tray on last release() */ +#define CDO_USE_FFLAGS 0x4 /* use O_NONBLOCK information on open */ +#define CDO_LOCK 0x8 /* lock tray on open files */ +#define CDO_CHECK_TYPE 0x10 /* check type on open for data */ + +/* Special codes used when specifying changer slots. */ +#define CDSL_NONE (INT_MAX-1) +#define CDSL_CURRENT INT_MAX + +/* For partition based multisession access. IDE can handle 64 partitions + * per drive - SCSI CD-ROM's use minors to differentiate between the + * various drives, so we can't do multisessions the same way there. + * Use the -o session=x option to mount on them. + */ +#define CD_PART_MAX 64 +#define CD_PART_MASK (CD_PART_MAX - 1) + +/********************************************************************* + * Generic Packet commands, MMC commands, and such + *********************************************************************/ + + /* The generic packet command opcodes for CD/DVD Logical Units, + * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */ +#define GPCMD_BLANK 0xa1 +#define GPCMD_CLOSE_TRACK 0x5b +#define GPCMD_FLUSH_CACHE 0x35 +#define GPCMD_FORMAT_UNIT 0x04 +#define GPCMD_GET_CONFIGURATION 0x46 +#define GPCMD_GET_EVENT_STATUS_NOTIFICATION 0x4a +#define GPCMD_GET_PERFORMANCE 0xac +#define GPCMD_INQUIRY 0x12 +#define GPCMD_LOAD_UNLOAD 0xa6 +#define GPCMD_MECHANISM_STATUS 0xbd +#define GPCMD_MODE_SELECT_10 0x55 +#define GPCMD_MODE_SENSE_10 0x5a +#define GPCMD_PAUSE_RESUME 0x4b +#define GPCMD_PLAY_AUDIO_10 0x45 +#define GPCMD_PLAY_AUDIO_MSF 0x47 +#define GPCMD_PLAY_AUDIO_TI 0x48 +#define GPCMD_PLAY_CD 0xbc +#define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e +#define GPCMD_READ_10 0x28 +#define GPCMD_READ_12 0xa8 +#define GPCMD_READ_BUFFER 0x3c +#define GPCMD_READ_BUFFER_CAPACITY 0x5c +#define GPCMD_READ_CDVD_CAPACITY 0x25 +#define GPCMD_READ_CD 0xbe +#define GPCMD_READ_CD_MSF 0xb9 +#define GPCMD_READ_DISC_INFO 0x51 +#define GPCMD_READ_DVD_STRUCTURE 0xad +#define GPCMD_READ_FORMAT_CAPACITIES 0x23 +#define GPCMD_READ_HEADER 0x44 +#define GPCMD_READ_TRACK_RZONE_INFO 0x52 +#define GPCMD_READ_SUBCHANNEL 0x42 +#define GPCMD_READ_TOC_PMA_ATIP 0x43 +#define GPCMD_REPAIR_RZONE_TRACK 0x58 +#define GPCMD_REPORT_KEY 0xa4 +#define GPCMD_REQUEST_SENSE 0x03 +#define GPCMD_RESERVE_RZONE_TRACK 0x53 +#define GPCMD_SEND_CUE_SHEET 0x5d +#define GPCMD_SCAN 0xba +#define GPCMD_SEEK 0x2b +#define GPCMD_SEND_DVD_STRUCTURE 0xbf +#define GPCMD_SEND_EVENT 0xa2 +#define GPCMD_SEND_KEY 0xa3 +#define GPCMD_SEND_OPC 0x54 +#define GPCMD_SET_READ_AHEAD 0xa7 +#define GPCMD_SET_STREAMING 0xb6 +#define GPCMD_START_STOP_UNIT 0x1b +#define GPCMD_STOP_PLAY_SCAN 0x4e +#define GPCMD_TEST_UNIT_READY 0x00 +#define GPCMD_VERIFY_10 0x2f +#define GPCMD_WRITE_10 0x2a +#define GPCMD_WRITE_12 0xaa +#define GPCMD_WRITE_AND_VERIFY_10 0x2e +#define GPCMD_WRITE_BUFFER 0x3b +/* This is listed as optional in ATAPI 2.6, but is (curiously) + * missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji + * Table 377 as an MMC command for SCSi devices though... Most ATAPI + * drives support it. */ +#define GPCMD_SET_SPEED 0xbb +/* This seems to be a SCSI specific CD-ROM opcode + * to play data at track/index */ +#define GPCMD_PLAYAUDIO_TI 0x48 +/* + * From MS Media Status Notification Support Specification. For + * older drives only. + */ +#define GPCMD_GET_MEDIA_STATUS 0xda + +/* Mode page codes for mode sense/set */ +#define GPMODE_VENDOR_PAGE 0x00 +#define GPMODE_R_W_ERROR_PAGE 0x01 +#define GPMODE_WRITE_PARMS_PAGE 0x05 +#define GPMODE_WCACHING_PAGE 0x08 +#define GPMODE_AUDIO_CTL_PAGE 0x0e +#define GPMODE_POWER_PAGE 0x1a +#define GPMODE_FAULT_FAIL_PAGE 0x1c +#define GPMODE_TO_PROTECT_PAGE 0x1d +#define GPMODE_CAPABILITIES_PAGE 0x2a +#define GPMODE_ALL_PAGES 0x3f +/* Not in Mt. Fuji, but in ATAPI 2.6 -- deprecated now in favor + * of MODE_SENSE_POWER_PAGE */ +#define GPMODE_CDROM_PAGE 0x0d + + + +/* DVD struct types */ +#define DVD_STRUCT_PHYSICAL 0x00 +#define DVD_STRUCT_COPYRIGHT 0x01 +#define DVD_STRUCT_DISCKEY 0x02 +#define DVD_STRUCT_BCA 0x03 +#define DVD_STRUCT_MANUFACT 0x04 + +struct dvd_layer { + unsigned char book_version : 4; + unsigned char book_type : 4; + unsigned char min_rate : 4; + unsigned char disc_size : 4; + unsigned char layer_type : 4; + unsigned char track_path : 1; + unsigned char nlayers : 2; + unsigned char track_density : 4; + unsigned char linear_density : 4; + unsigned char bca : 1; + unsigned int start_sector; + unsigned int end_sector; + unsigned int end_sector_l0; +}; + +#define DVD_LAYERS 4 + +struct dvd_physical { + unsigned char type; + unsigned char layer_num; + struct dvd_layer layer[DVD_LAYERS]; +}; + +#define _IOT_dvd_copyright _IOT (_IOTS (char), 4, 0, 0, 0, 0) +struct dvd_copyright { + unsigned char type; + + unsigned char layer_num; + unsigned char cpst; + unsigned char rmi; +}; + +struct dvd_disckey { + unsigned char type; + + unsigned agid : 2; + unsigned char value[2048]; +}; + +struct dvd_bca { + unsigned char type; + + int len; + unsigned char value[188]; +}; + +struct dvd_manufact { + unsigned char type; + + unsigned char layer_num; + int len; + unsigned char value[2048]; +}; + +typedef union { + unsigned char type; + + struct dvd_physical physical; + struct dvd_copyright copyright; + struct dvd_disckey disckey; + struct dvd_bca bca; + struct dvd_manufact manufact; +} dvd_struct; + +/* + * DVD authentication ioctl + */ + +/* Authentication states */ +#define DVD_LU_SEND_AGID 0 +#define DVD_HOST_SEND_CHALLENGE 1 +#define DVD_LU_SEND_KEY1 2 +#define DVD_LU_SEND_CHALLENGE 3 +#define DVD_HOST_SEND_KEY2 4 + +/* Termination states */ +#define DVD_AUTH_ESTABLISHED 5 +#define DVD_AUTH_FAILURE 6 + +/* Other functions */ +#define DVD_LU_SEND_TITLE_KEY 7 +#define DVD_LU_SEND_ASF 8 +#define DVD_INVALIDATE_AGID 9 +#define DVD_LU_SEND_RPC_STATE 10 +#define DVD_HOST_SEND_RPC_STATE 11 + +/* State data */ +typedef unsigned char dvd_key[5]; /* 40-bit value, MSB is first elem. */ +typedef unsigned char dvd_challenge[10]; /* 80-bit value, MSB is first elem. */ + +struct dvd_lu_send_agid { + unsigned char type; + unsigned agid : 2; +}; + +struct dvd_host_send_challenge { + unsigned char type; + unsigned agid : 2; + + dvd_challenge chal; +}; + +struct dvd_send_key { + unsigned char type; + unsigned agid : 2; + + dvd_key key; +}; + +struct dvd_lu_send_challenge { + unsigned char type; + unsigned agid : 2; + + dvd_challenge chal; +}; + +#define DVD_CPM_NO_COPYRIGHT 0 +#define DVD_CPM_COPYRIGHTED 1 + +#define DVD_CP_SEC_NONE 0 +#define DVD_CP_SEC_EXIST 1 + +#define DVD_CGMS_UNRESTRICTED 0 +#define DVD_CGMS_SINGLE 2 +#define DVD_CGMS_RESTRICTED 3 + +struct dvd_lu_send_title_key { + unsigned char type; + unsigned agid : 2; + + dvd_key title_key; + int lba; + unsigned cpm : 1; + unsigned cp_sec : 1; + unsigned cgms : 2; +}; + +struct dvd_lu_send_asf { + unsigned char type; + unsigned agid : 2; + + unsigned asf : 1; +}; + +struct dvd_host_send_rpcstate { + unsigned char type; + unsigned char pdrc; +}; + +struct dvd_lu_send_rpcstate { + unsigned char type : 2; + unsigned char vra : 3; + unsigned char ucca : 3; + unsigned char region_mask; + unsigned char rpc_scheme; +}; + +typedef union { + unsigned char type; + + struct dvd_lu_send_agid lsa; + struct dvd_host_send_challenge hsc; + struct dvd_send_key lsk; + struct dvd_lu_send_challenge lsc; + struct dvd_send_key hsk; + struct dvd_lu_send_title_key lstk; + struct dvd_lu_send_asf lsasf; + struct dvd_host_send_rpcstate hrpcs; + struct dvd_lu_send_rpcstate lrpcs; +} dvd_authinfo; + +struct request_sense { +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned char valid : 1; + unsigned char error_code : 7; +#elif __BYTE_ORDER == __LITTLE_ENDIAN + unsigned char error_code : 7; + unsigned char valid : 1; +#endif + unsigned char segment_number; +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned char reserved1 : 2; + unsigned char ili : 1; + unsigned char reserved2 : 1; + unsigned char sense_key : 4; +#elif __BYTE_ORDER == __LITTLE_ENDIAN + unsigned char sense_key : 4; + unsigned char reserved2 : 1; + unsigned char ili : 1; + unsigned char reserved1 : 2; +#endif + unsigned char information[4]; + unsigned char add_sense_len; + unsigned char command_info[4]; + unsigned char asc; + unsigned char ascq; + unsigned char fruc; + unsigned char sks[3]; + unsigned char asb[46]; +}; + +/* + * feature profile + */ +#define CDF_RWRT 0x0020 /* "Random Writable" */ +#define CDF_HWDM 0x0024 /* "Hardware Defect Management" */ +#define CDF_MRW 0x0028 + +/* + * media status bits + */ +#define CDM_MRW_NOTMRW 0 +#define CDM_MRW_BGFORMAT_INACTIVE 1 +#define CDM_MRW_BGFORMAT_ACTIVE 2 +#define CDM_MRW_BGFORMAT_COMPLETE 3 + +/* + * mrw address spaces + */ +#define MRW_LBA_DMA 0 +#define MRW_LBA_GAA 1 + +/* + * mrw mode pages (first is deprecated) -- probed at init time and + * cdi->mrw_mode_page is set + */ +#define MRW_MODE_PC_PRE1 0x2c +#define MRW_MODE_PC 0x03 + +struct mrw_feature_desc { + unsigned short feature_code; +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned char reserved1 : 2; + unsigned char feature_version : 4; + unsigned char persistent : 1; + unsigned char curr : 1; +#elif __BYTE_ORDER == __LITTLE_ENDIAN + unsigned char curr : 1; + unsigned char persistent : 1; + unsigned char feature_version : 4; + unsigned char reserved1 : 2; +#endif + unsigned char add_len; +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned char reserved2 : 7; + unsigned char write : 1; +#elif __BYTE_ORDER == __LITTLE_ENDIAN + unsigned char write : 1; + unsigned char reserved2 : 7; +#endif + unsigned char reserved3; + unsigned char reserved4; + unsigned char reserved5; +}; + +/* cf. mmc4r02g.pdf 5.3.10 Random Writable Feature (0020h) pg 197 of 635 */ +struct rwrt_feature_desc { + unsigned short feature_code; +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned char reserved1 : 2; + unsigned char feature_version : 4; + unsigned char persistent : 1; + unsigned char curr : 1; +#elif __BYTE_ORDER == __LITTLE_ENDIAN + unsigned char curr : 1; + unsigned char persistent : 1; + unsigned char feature_version : 4; + unsigned char reserved1 : 2; +#endif + unsigned char add_len; + unsigned int last_lba; + unsigned int block_size; + unsigned short blocking; +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned char reserved2 : 7; + unsigned char page_present : 1; +#elif __BYTE_ORDER == __LITTLE_ENDIAN + unsigned char page_present : 1; + unsigned char reserved2 : 7; +#endif + unsigned char reserved3; +}; + +typedef struct { + unsigned short disc_information_length; +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned char reserved1 : 3; + unsigned char erasable : 1; + unsigned char border_status : 2; + unsigned char disc_status : 2; +#elif __BYTE_ORDER == __LITTLE_ENDIAN + unsigned char disc_status : 2; + unsigned char border_status : 2; + unsigned char erasable : 1; + unsigned char reserved1 : 3; +#endif + unsigned char n_first_track; + unsigned char n_sessions_lsb; + unsigned char first_track_lsb; + unsigned char last_track_lsb; +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned char did_v : 1; + unsigned char dbc_v : 1; + unsigned char uru : 1; + unsigned char reserved2 : 2; + unsigned char dbit : 1; + unsigned char mrw_status : 2; +#elif __BYTE_ORDER == __LITTLE_ENDIAN + unsigned char mrw_status : 2; + unsigned char dbit : 1; + unsigned char reserved2 : 2; + unsigned char uru : 1; + unsigned char dbc_v : 1; + unsigned char did_v : 1; +#endif + unsigned char disc_type; + unsigned char n_sessions_msb; + unsigned char first_track_msb; + unsigned char last_track_msb; + unsigned int disc_id; + unsigned int lead_in; + unsigned int lead_out; + unsigned char disc_bar_code[8]; + unsigned char reserved3; + unsigned char n_opc; +} disc_information; + +typedef struct { + unsigned short track_information_length; + unsigned char track_lsb; + unsigned char session_lsb; + unsigned char reserved1; +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned char reserved2 : 2; + unsigned char damage : 1; + unsigned char copy : 1; + unsigned char track_mode : 4; + unsigned char rt : 1; + unsigned char blank : 1; + unsigned char packet : 1; + unsigned char fp : 1; + unsigned char data_mode : 4; + unsigned char reserved3 : 6; + unsigned char lra_v : 1; + unsigned char nwa_v : 1; +#elif __BYTE_ORDER == __LITTLE_ENDIAN + unsigned char track_mode : 4; + unsigned char copy : 1; + unsigned char damage : 1; + unsigned char reserved2 : 2; + unsigned char data_mode : 4; + unsigned char fp : 1; + unsigned char packet : 1; + unsigned char blank : 1; + unsigned char rt : 1; + unsigned char nwa_v : 1; + unsigned char lra_v : 1; + unsigned char reserved3 : 6; +#endif + unsigned int track_start; + unsigned int next_writable; + unsigned int free_blocks; + unsigned int fixed_packet_size; + unsigned int track_size; + unsigned int last_rec_address; +} track_information; + +struct feature_header { + unsigned int data_len; + unsigned char reserved1; + unsigned char reserved2; + unsigned short curr_profile; +}; + +struct mode_page_header { + unsigned short mode_data_length; + unsigned char medium_type; + unsigned char reserved1; + unsigned char reserved2; + unsigned char reserved3; + unsigned short desc_length; +}; + + +#endif /* _SYS_CDROM_H */ diff --git a/debian/local/finish-install.d/51hurd_config-console b/debian/local/finish-install.d/51hurd_config-console new file mode 100755 index 00000000..03cc7697 --- /dev/null +++ b/debian/local/finish-install.d/51hurd_config-console @@ -0,0 +1,3 @@ +#!/bin/sh + +[ -f /var/run/hurd-console.pid ] || sed -i -e "s/ENABLE='true'/ENABLE='false'/" /target/etc/default/hurd-console diff --git a/debian/local/finish-install.d/51hurd_config-target-network b/debian/local/finish-install.d/51hurd_config-target-network new file mode 100755 index 00000000..13191653 --- /dev/null +++ b/debian/local/finish-install.d/51hurd_config-target-network @@ -0,0 +1,9 @@ +#!/bin/sh + +# Make sure the firmlink is gone +settrans -ag /target/servers + +# Transfer the network configuration to /target +settrans -pk /target/servers/socket/2 $(fsysopts /servers/socket/2) -6 /servers/socket/26 +settrans -cpk /target/servers/socket/26 $(fsysopts /servers/socket/2) -4 /servers/socket/2 + diff --git a/debian/local/menu.lst b/debian/local/menu.lst new file mode 100644 index 00000000..9e2ba4c0 --- /dev/null +++ b/debian/local/menu.lst @@ -0,0 +1,19 @@ +# Example GRUB configuration to boot Debian GNU/Hurd off the first partition. +# Adjust the partition setting for GRUB's root command and the gnumach.gz +# root device. + +timeout 5 + +default 0 + +title Debian GNU/Hurd +root (hd0,0) +kernel /boot/gnumach.gz root=device:hd0s1 +module /hurd/ext2fs.static --multiboot-command-line=${kernel-command-line} --host-priv-port=${host-port} --device-master-port=${device-port} --exec-server-task=${exec-task} -T typed ${root} $(task-create) $(task-resume) +module /lib/ld.so.1 /hurd/exec $(exec-task=task-create) + +title Debian GNU/Hurd (single user mode) +root (hd0,0) +kernel /boot/gnumach.gz -s root=device:hd0s1 +module /hurd/ext2fs.static --multiboot-command-line=${kernel-command-line} --host-priv-port=${host-port} --device-master-port=${device-port} --exec-server-task=${exec-task} -T typed ${root} $(task-create) $(task-resume) +module /lib/ld.so.1 /hurd/exec $(exec-task=task-create) diff --git a/debian/local/partman/commit.d/40hurd_reload-partitions b/debian/local/partman/commit.d/40hurd_reload-partitions new file mode 100755 index 00000000..6c105872 --- /dev/null +++ b/debian/local/partman/commit.d/40hurd_reload-partitions @@ -0,0 +1,5 @@ +#!/bin/sh + +for part in /dev/[hs]d?s*; do + settrans -ag $part +done diff --git a/debian/local/random-hurd.sh b/debian/local/random-hurd.sh new file mode 100755 index 00000000..6b583c42 --- /dev/null +++ b/debian/local/random-hurd.sh @@ -0,0 +1,2 @@ +#!/bin/sh +exec /hurd/random --seed-file /var/spool/random-seed diff --git a/debian/local/runsystem b/debian/local/runsystem new file mode 100755 index 00000000..a59ff716 --- /dev/null +++ b/debian/local/runsystem @@ -0,0 +1,83 @@ +#!/bin/sh + +PATH=/bin:/sbin:/usr/bin:/usr/sbin +export PATH + +umask 022 + +# Create a minimal subset of device and server nodes +/usr/lib/hurd/setup-translators -m -k -p + +/hurd/mach-defpager + +mem=`vmstat-hurd --size -k` +if [ "$mem" -lt 240000 ] +then + echo "You only have ${mem}KiB memory." + echo "Debian GNU/Hurd installation has not been optimized for memory usage yet, and thus currently needs at least 256MiB memory, sorry." + while true + do + sleep 60 + done +fi + +# Get all kernel parameters that can be exported as environment variables +envvars="$(echo $* | tr ' ' '\012' | egrep '^[-_/[:alnum:]]+=.*$')" + +# Invoke init as linuxrc to work around pid != 1 +init='/bin/busybox linuxrc' + +# Parse kernel parameters +for i in $envvars ; do + case "$i" in + init="/sbin/init"|init="init") + # Avoid endless loop + : ;; + init=*) + init=${i#init=} + ;; + noshell=*) + sed -i '/^tty[12]/s/^/#/' /etc/inittab + ;; + TERM=*) + term=yes + ;; + esac +done + +if [ "$term" != yes ] +then + # No terminal type set, assume we can start the Hurd console + + # Touch the first tty so that the Hurd console is certain to pick it + # and not some random other tty. + sleep 1 + touch /dev/tty1 + + echo -n "Starting the Hurd console..." + while true + do + LAYOUT="" + if [ -f /etc/default/keyboard ] + then + . /etc/default/keyboard + [ -z "$XKBLAYOUT" ] || LAYOUT="--keymap $XKBLAYOUT" + fi + console -d vga -g -d pc_kbd --repeat=kbd $LAYOUT -d pc_mouse --repeat=mouse -c /dev/vcs & + echo $! > /var/run/hurd-console.pid + wait + echo + echo -n "Restarting the Hurd console..." + done & + + # Switch over + envvars="$envvars TERM=hurd" + exec < /dev/tty1 > /dev/tty1 2>&1 + echo "Console started" + + # Set the console device used by /sbin/reopen-console + echo /dev/tty1 >/var/run/console-device +fi + +# Preset the terminal type for /lib/debian-installer/detect-console +eval exec env - $envvars TERM_TYPE=virtual $init diff --git a/debian/local/securetty b/debian/local/securetty new file mode 100644 index 00000000..61d7a06a --- /dev/null +++ b/debian/local/securetty @@ -0,0 +1,76 @@ +# /etc/securetty: list of terminals on which root is allowed to login. +# See securetty(5) and login(1). + +console + +# Local X displays (allows empty passwords with pam_unix's nullok_secure) +:0 +:0.0 +:0.1 +:1 +:1.0 +:1.1 +:2 +:2.0 +:2.1 +:3 +:3.0 +:3.1 +#... + +# Virtual consoles +tty1 +tty2 +tty3 +tty4 +tty5 +tty6 +tty7 +tty8 +tty9 +tty10 +tty11 +tty12 +tty13 +tty14 +tty15 +tty16 +tty17 +tty18 +tty19 +tty20 +tty21 +tty22 +tty23 +tty24 +tty25 +tty26 +tty27 +tty28 +tty29 +tty30 +tty31 +tty32 +tty33 +tty34 +tty35 +tty36 +tty37 +tty38 +tty39 +tty40 +tty41 +tty42 +tty43 +tty44 +tty45 +tty46 +tty47 +tty48 +tty49 + +# UART serial ports +com0 +com1 +com2 +com3 diff --git a/debian/local/setup-translators b/debian/local/setup-translators new file mode 100755 index 00000000..d4ddd892 --- /dev/null +++ b/debian/local/setup-translators @@ -0,0 +1,163 @@ +#!/bin/sh +# Set up device nodes and /servers translators. +# +# Use cases: +# - from d-i's /libexec/runsystem, to create a minimal set of device nodes +# and translators for the installer environment; +# - from debootstrap on initial installation, to create device and server +# nodes before /dev and /servers are firmlinked to the host system. +# - from hurd.postinst, on upgrade, where only non-existant nodes should be +# created, and the other ones should be left alone. + + +PATH=/bin:/sbin:/usr/bin:/usr/sbin +export PATH + +usage () { +cat >&2 <<EOU +Usage: $0 [OPTIONS] +Set up device nodes and /servers translators. + + -k, --keep-active Keep active translators running + -K, --keep-all Don't even set passive translators on existing files + -m, --minimal Create a minimal subset of nodes only + -p, --parted Prefer parted stores for partition devices + +At least one of -k or -K must be given. +EOU +} + +# Parse command-line arguments +REPLACE= +MDFLAGS= +MINIMAL= +while [ $# -gt 0 ]; do + case "$1" in + -k|--keep-active) + MDFLAGS="$MDFLAGS -k" + REPLACE=y + shift;; + -K|--keep-all) + MDFLAGS="$MDFLAGS -K" + REPLACE=n + shift;; + -m|--minimal) + MINIMAL=y + shift;; + -p|--parted) + MDFLAGS="$MDFLAGS -p" + shift;; + *) + usage + exit 1;; + esac +done + +if [ -z "$REPLACE" ]; then + usage + exit 1 +fi + +# Usage: foldsubst <pat> xxxx yyyy zzzz ... +# <pat> is substituted for every character of xxxx with sed, the character in +# question being accessible as a '\0' in <pat>, and the result is used as the +# new pattern to handle the remaining arguments. +foldsubst () { + [ "$2" ] || { echo $1; return; } + expanded=$(echo "$2" | sed "s/./ $1/g"); shift 2 + foldsubst "$expanded" $@; +} + +# Verbosely attach a translator. +st () { + node=$1 + cmdl=$2 + name=${3:-$cmdl} + + echo -n " $name" + if [ "$REPLACE" = y ] || ! showtrans $1 > /dev/null 2>&1 ; then + # Work around a bug in ext2fs, which crashes if a non-empty + # file is turned into a symlink through settrans, by clearing + # the passive translator first. + settrans -ck $node + settrans -ck $node $cmdl + fi +} + +# Verbosely create device nodes, with some help from foldsubst. +md () { + pattern=$1; shift + sedrepl=$(echo $pattern | sed -e 's/X/\\0/' -e 's/Y/\\\\0/') + devs=$(foldsubst "$sedrepl" $@) + + echo -n " $pattern" + /sbin/MAKEDEV $MDFLAGS $devs +} + + +echo -n "Setting up translators:" +cd /servers +mkdir -p socket + +st exec /hurd/exec +st default-pager /hurd/proxy-defpager +st socket/1 /hurd/pflocal +st socket/local '/hurd/symlink 1' '(+link)' +st socket/2 /hurd/pfinet +st socket/inet '/hurd/symlink 2' '(+link)' +st socket/inet6 '/hurd/symlink 26' '(+link)' +st /proc '/hurd/procfs -c' + +if [ -z "$MINIMAL" ]; then + st password /hurd/password + st crash-kill '/hurd/crash --kill' crash-kill + st crash-suspend '/hurd/crash --suspend' crash-suspend + st crash-dump-core '/hurd/crash --dump-core' crash-dump-core + st crash '/hurd/symlink crash-kill' crash +fi + +echo . + + +echo -n "Creating device nodes:" +cd /dev + +md fd +md fdX 01 +md std +md vcs +md hdX 012345 +md hdXsY 012345 123456789 +md hdXs1Y 012345 0123456 +md sdX 012345 +md sdXsY 012345 123456789 +md sdXs1Y 012345 0123456 +md cdX 01 +md netdde +md ethX 0123 + +if [ "$MINIMAL" ]; then + md loopX 0123 + md ttyX 1234 + md ptypX 0123 + md comX 0123 + st random /hurd/random random + st urandom /hurd/random urandom +else + md loopX 01234567 + md ttyX 123456 + md ptyp + md ptyq + md lprX 012 + md comX 0123 + st random /etc/alternatives/random.sh random + st urandom /etc/alternatives/urandom.sh urandom +fi + +st kbd '/hurd/symlink cons/kbd' kbd +st mouse '/hurd/symlink cons/mouse' mouse +[ -d shm ] && ! [ -L shm ] && rmdir shm +st shm '/hurd/symlink /run/shm' shm + +echo . + diff --git a/debian/local/soundcard.h b/debian/local/soundcard.h new file mode 100644 index 00000000..3c32819a --- /dev/null +++ b/debian/local/soundcard.h @@ -0,0 +1,1298 @@ +#ifndef _SYS_SOUNDCARD_H +#define _SYS_SOUNDCARD_H +/* + * Copyright by Hannu Savolainen 1993-1997 + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. 2. + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + */ + + +/* + * OSS interface version. With versions earlier than 3.6 this value is + * an integer with value less than 361. In versions 3.6 and later + * it's a six digit hexadecimal value. For example value + * of 0x030600 represents OSS version 3.6.0. + * Use ioctl(fd, OSS_GETVERSION, &int) to get the version number of + * the currently active driver. + */ +#define SOUND_VERSION 0x030802 +#define OPEN_SOUND_SYSTEM + +#include <sys/ioctl.h> +#include <endian.h> + +/* + * Supported card ID numbers (Should be somewhere else?) + */ + +#define SNDCARD_ADLIB 1 +#define SNDCARD_SB 2 +#define SNDCARD_PAS 3 +#define SNDCARD_GUS 4 +#define SNDCARD_MPU401 5 +#define SNDCARD_SB16 6 +#define SNDCARD_SB16MIDI 7 +#define SNDCARD_UART6850 8 +#define SNDCARD_GUS16 9 +#define SNDCARD_MSS 10 +#define SNDCARD_PSS 11 +#define SNDCARD_SSCAPE 12 +#define SNDCARD_PSS_MPU 13 +#define SNDCARD_PSS_MSS 14 +#define SNDCARD_SSCAPE_MSS 15 +#define SNDCARD_TRXPRO 16 +#define SNDCARD_TRXPRO_SB 17 +#define SNDCARD_TRXPRO_MPU 18 +#define SNDCARD_MAD16 19 +#define SNDCARD_MAD16_MPU 20 +#define SNDCARD_CS4232 21 +#define SNDCARD_CS4232_MPU 22 +#define SNDCARD_MAUI 23 +#define SNDCARD_PSEUDO_MSS 24 +#define SNDCARD_GUSPNP 25 +#define SNDCARD_UART401 26 +/* Sound card numbers 27 to N are reserved. Don't add more numbers here. */ + +/*********************************** + * IOCTL Commands for /dev/sequencer + */ + +#ifndef _SIOWR +/* Use already defined ioctl defines if they exist (except with Sun or Sparc) */ +#define SIOCPARM_MASK IOCPARM_MASK +#define SIOC_VOID IOC_VOID +#define SIOC_OUT IOC_OUT +#define SIOC_IN IOC_IN +#define SIOC_INOUT IOC_INOUT +#define _SIOC_SIZE _IOC_SIZE +#define _SIOC_DIR _IOC_DIR +#define _SIOC_NONE _IOC_NONE +#define _SIOC_READ _IOC_READ +#define _SIOC_WRITE _IOC_WRITE +#define _SIO _IO +#define _SIOR _IOR +#define _SIOW _IOW +#define _SIOWR _IOWR +#endif /* !_SIOWR */ + +#define SNDCTL_SEQ_RESET _SIO ('q', 0) +#define SNDCTL_SEQ_SYNC _SIO ('q', 1) +#define SNDCTL_SYNTH_INFO _SIOWR('q', 2, struct synth_info) +#define SNDCTL_SEQ_CTRLRATE _SIOWR('q', 3, int) /* Set/get timer resolution (HZ) */ +#define SNDCTL_SEQ_GETOUTCOUNT _SIOR ('q', 4, int) +#define SNDCTL_SEQ_GETINCOUNT _SIOR ('q', 5, int) +#define SNDCTL_SEQ_PERCMODE _SIOW ('q', 6, int) +#define SNDCTL_FM_LOAD_INSTR _SIOW ('q', 7, struct sbi_instrument) /* Obsolete. Don't use!!!!!! */ +#define SNDCTL_SEQ_TESTMIDI _SIOW ('q', 8, int) +#define SNDCTL_SEQ_RESETSAMPLES _SIOW ('q', 9, int) +#define SNDCTL_SEQ_NRSYNTHS _SIOR ('q',10, int) +#define SNDCTL_SEQ_NRMIDIS _SIOR ('q',11, int) +#define SNDCTL_MIDI_INFO _SIOWR('q',12, struct midi_info) +#define SNDCTL_SEQ_THRESHOLD _SIOW ('q',13, int) +#define SNDCTL_SYNTH_MEMAVL _SIOWR('q',14, int) /* in=dev#, out=memsize */ +#define SNDCTL_FM_4OP_ENABLE _SIOW ('q',15, int) /* in=dev# */ +#define SNDCTL_SEQ_PANIC _SIO ('q',17) +#define SNDCTL_SEQ_OUTOFBAND _SIOW ('q',18, struct seq_event_rec) +#define SNDCTL_SEQ_GETTIME _SIOR ('q',19, int) +#define SNDCTL_SYNTH_ID _SIOWR('q',20, struct synth_info) +#define SNDCTL_SYNTH_CONTROL _SIOWR('q',21, struct synth_control) +#define SNDCTL_SYNTH_REMOVESAMPLE _SIOWR('q',22, struct remove_sample) + +typedef struct synth_control +{ + /* XXX */ + char data[62]; /* Device spesific command/data record */ + int devno; /* Synthesizer # */ +}synth_control; +#define _IOT_synth_control _IOT (_IOTS (char), 31, _IOTS (char), 31, _IOTS (int), 1) + +typedef struct remove_sample +{ + int devno; /* Synthesizer # */ + int bankno; /* MIDI bank # (0=General MIDI) */ + int instrno; /* MIDI instrument number */ +} remove_sample; +#define _IOT_remove_sample _IOT (_IOTS (int), 3, 0, 0, 0, 0) + +typedef struct seq_event_rec { + unsigned char arr[8]; +} seq_event_rec; +#define _IOT_seq_event_rec _IOT (_IOTS (char), 8, 0, 0, 0, 0) + +#define SNDCTL_TMR_TIMEBASE _SIOWR('t', 1, int) +#define SNDCTL_TMR_START _SIO ('t', 2) +#define SNDCTL_TMR_STOP _SIO ('t', 3) +#define SNDCTL_TMR_CONTINUE _SIO ('t', 4) +#define SNDCTL_TMR_TEMPO _SIOWR('t', 5, int) +#define SNDCTL_TMR_SOURCE _SIOWR('t', 6, int) +# define TMR_INTERNAL 0x00000001 +# define TMR_EXTERNAL 0x00000002 +# define TMR_MODE_MIDI 0x00000010 +# define TMR_MODE_FSK 0x00000020 +# define TMR_MODE_CLS 0x00000040 +# define TMR_MODE_SMPTE 0x00000080 +#define SNDCTL_TMR_METRONOME _SIOW ('t', 7, int) +#define SNDCTL_TMR_SELECT _SIOW ('t', 8, int) + +/* + * Some big endian/little endian handling macros + */ + +#if defined(__BYTE_ORDER) +# if __BYTE_ORDER == __BIG_ENDIAN +# define _PATCHKEY(id) (0xfd00|id) +# define AFMT_S16_NE AFMT_S16_BE +# elif __BYTE_ORDER == __LITTLE_ENDIAN +# define _PATCHKEY(id) ((id<<8)|0x00fd) +# define AFMT_S16_NE AFMT_S16_LE +# else +# error "could not determine byte order" +# endif +#endif + +/* + * Sample loading mechanism for internal synthesizers (/dev/sequencer) + * The following patch_info structure has been designed to support + * Gravis UltraSound. It tries to be universal format for uploading + * sample based patches but is probably too limited. + * + * (PBD) As Hannu guessed, the GUS structure is too limited for + * the WaveFront, but this is the right place for a constant definition. + */ + +struct patch_info { + unsigned short key; /* Use WAVE_PATCH here */ +#define WAVE_PATCH _PATCHKEY(0x04) +#define GUS_PATCH WAVE_PATCH +#define WAVEFRONT_PATCH _PATCHKEY(0x06) + + short device_no; /* Synthesizer number */ + short instr_no; /* Midi pgm# */ + + unsigned int mode; +/* + * The least significant byte has the same format than the GUS .PAT + * files + */ +#define WAVE_16_BITS 0x01 /* bit 0 = 8 or 16 bit wave data. */ +#define WAVE_UNSIGNED 0x02 /* bit 1 = Signed - Unsigned data. */ +#define WAVE_LOOPING 0x04 /* bit 2 = looping enabled-1. */ +#define WAVE_BIDIR_LOOP 0x08 /* bit 3 = Set is bidirectional looping. */ +#define WAVE_LOOP_BACK 0x10 /* bit 4 = Set is looping backward. */ +#define WAVE_SUSTAIN_ON 0x20 /* bit 5 = Turn sustaining on. (Env. pts. 3)*/ +#define WAVE_ENVELOPES 0x40 /* bit 6 = Enable envelopes - 1 */ +#define WAVE_FAST_RELEASE 0x80 /* bit 7 = Shut off immediately after note off */ + /* (use the env_rate/env_offs fields). */ +/* Linux specific bits */ +#define WAVE_VIBRATO 0x00010000 /* The vibrato info is valid */ +#define WAVE_TREMOLO 0x00020000 /* The tremolo info is valid */ +#define WAVE_SCALE 0x00040000 /* The scaling info is valid */ +#define WAVE_FRACTIONS 0x00080000 /* Fraction information is valid */ +/* Reserved bits */ +#define WAVE_ROM 0x40000000 /* For future use */ +#define WAVE_MULAW 0x20000000 /* For future use */ +/* Other bits must be zeroed */ + + int len; /* Size of the wave data in bytes */ + int loop_start, loop_end; /* Byte offsets from the beginning */ + +/* + * The base_freq and base_note fields are used when computing the + * playback speed for a note. The base_note defines the tone frequency + * which is heard if the sample is played using the base_freq as the + * playback speed. + * + * The low_note and high_note fields define the minimum and maximum note + * frequencies for which this sample is valid. It is possible to define + * more than one samples for an instrument number at the same time. The + * low_note and high_note fields are used to select the most suitable one. + * + * The fields base_note, high_note and low_note should contain + * the note frequency multiplied by 1000. For example value for the + * middle A is 440*1000. + */ + + unsigned int base_freq; + unsigned int base_note; + unsigned int high_note; + unsigned int low_note; + int panning; /* -128=left, 127=right */ + int detuning; + +/* New fields introduced in version 1.99.5 */ + + /* Envelope. Enabled by mode bit WAVE_ENVELOPES */ + unsigned char env_rate[ 6 ]; /* GUS HW ramping rate */ + unsigned char env_offset[ 6 ]; /* 255 == 100% */ + + /* + * The tremolo, vibrato and scale info are not supported yet. + * Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or + * WAVE_SCALE + */ + + unsigned char tremolo_sweep; + unsigned char tremolo_rate; + unsigned char tremolo_depth; + + unsigned char vibrato_sweep; + unsigned char vibrato_rate; + unsigned char vibrato_depth; + + int scale_frequency; + unsigned int scale_factor; /* from 0 to 2048 or 0 to 2 */ + + int volume; + int fractions; + int reserved1; + int spare[2]; + char data[1]; /* The waveform data starts here */ + }; + +struct sysex_info { + short key; /* Use SYSEX_PATCH or MAUI_PATCH here */ +#define SYSEX_PATCH _PATCHKEY(0x05) +#define MAUI_PATCH _PATCHKEY(0x06) + short device_no; /* Synthesizer number */ + int len; /* Size of the sysex data in bytes */ + unsigned char data[1]; /* Sysex data starts here */ + }; + +/* + * /dev/sequencer input events. + * + * The data written to the /dev/sequencer is a stream of events. Events + * are records of 4 or 8 bytes. The first byte defines the size. + * Any number of events can be written with a write call. There + * is a set of macros for sending these events. Use these macros if you + * want to maximize portability of your program. + * + * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events. + * (All input events are currently 4 bytes long. Be prepared to support + * 8 byte events also. If you receive any event having first byte >= 128, + * it's a 8 byte event. + * + * The events are documented at the end of this file. + * + * Normal events (4 bytes) + * There is also a 8 byte version of most of the 4 byte events. The + * 8 byte one is recommended. + */ +#define SEQ_NOTEOFF 0 +#define SEQ_FMNOTEOFF SEQ_NOTEOFF /* Just old name */ +#define SEQ_NOTEON 1 +#define SEQ_FMNOTEON SEQ_NOTEON +#define SEQ_WAIT TMR_WAIT_ABS +#define SEQ_PGMCHANGE 3 +#define SEQ_FMPGMCHANGE SEQ_PGMCHANGE +#define SEQ_SYNCTIMER TMR_START +#define SEQ_MIDIPUTC 5 +#define SEQ_DRUMON 6 /*** OBSOLETE ***/ +#define SEQ_DRUMOFF 7 /*** OBSOLETE ***/ +#define SEQ_ECHO TMR_ECHO /* For synching programs with output */ +#define SEQ_AFTERTOUCH 9 +#define SEQ_CONTROLLER 10 + +/******************************************* + * Midi controller numbers + ******************************************* + * Controllers 0 to 31 (0x00 to 0x1f) and + * 32 to 63 (0x20 to 0x3f) are continuous + * controllers. + * In the MIDI 1.0 these controllers are sent using + * two messages. Controller numbers 0 to 31 are used + * to send the MSB and the controller numbers 32 to 63 + * are for the LSB. Note that just 7 bits are used in MIDI bytes. + */ + +#define CTL_BANK_SELECT 0x00 +#define CTL_MODWHEEL 0x01 +#define CTL_BREATH 0x02 +/* undefined 0x03 */ +#define CTL_FOOT 0x04 +#define CTL_PORTAMENTO_TIME 0x05 +#define CTL_DATA_ENTRY 0x06 +#define CTL_MAIN_VOLUME 0x07 +#define CTL_BALANCE 0x08 +/* undefined 0x09 */ +#define CTL_PAN 0x0a +#define CTL_EXPRESSION 0x0b +/* undefined 0x0c */ +/* undefined 0x0d */ +/* undefined 0x0e */ +/* undefined 0x0f */ +#define CTL_GENERAL_PURPOSE1 0x10 +#define CTL_GENERAL_PURPOSE2 0x11 +#define CTL_GENERAL_PURPOSE3 0x12 +#define CTL_GENERAL_PURPOSE4 0x13 +/* undefined 0x14 - 0x1f */ + +/* undefined 0x20 */ +/* The controller numbers 0x21 to 0x3f are reserved for the */ +/* least significant bytes of the controllers 0x00 to 0x1f. */ +/* These controllers are not recognised by the driver. */ + +/* Controllers 64 to 69 (0x40 to 0x45) are on/off switches. */ +/* 0=OFF and 127=ON (intermediate values are possible) */ +#define CTL_DAMPER_PEDAL 0x40 +#define CTL_SUSTAIN 0x40 /* Alias */ +#define CTL_HOLD 0x40 /* Alias */ +#define CTL_PORTAMENTO 0x41 +#define CTL_SOSTENUTO 0x42 +#define CTL_SOFT_PEDAL 0x43 +/* undefined 0x44 */ +#define CTL_HOLD2 0x45 +/* undefined 0x46 - 0x4f */ + +#define CTL_GENERAL_PURPOSE5 0x50 +#define CTL_GENERAL_PURPOSE6 0x51 +#define CTL_GENERAL_PURPOSE7 0x52 +#define CTL_GENERAL_PURPOSE8 0x53 +/* undefined 0x54 - 0x5a */ +#define CTL_EXT_EFF_DEPTH 0x5b +#define CTL_TREMOLO_DEPTH 0x5c +#define CTL_CHORUS_DEPTH 0x5d +#define CTL_DETUNE_DEPTH 0x5e +#define CTL_CELESTE_DEPTH 0x5e /* Alias for the above one */ +#define CTL_PHASER_DEPTH 0x5f +#define CTL_DATA_INCREMENT 0x60 +#define CTL_DATA_DECREMENT 0x61 +#define CTL_NONREG_PARM_NUM_LSB 0x62 +#define CTL_NONREG_PARM_NUM_MSB 0x63 +#define CTL_REGIST_PARM_NUM_LSB 0x64 +#define CTL_REGIST_PARM_NUM_MSB 0x65 +/* undefined 0x66 - 0x78 */ +/* reserved 0x79 - 0x7f */ + +/* Pseudo controllers (not midi compatible) */ +#define CTRL_PITCH_BENDER 255 +#define CTRL_PITCH_BENDER_RANGE 254 +#define CTRL_EXPRESSION 253 /* Obsolete */ +#define CTRL_MAIN_VOLUME 252 /* Obsolete */ +#define SEQ_BALANCE 11 +#define SEQ_VOLMODE 12 + +/* + * Volume mode decides how volumes are used + */ + +#define VOL_METHOD_ADAGIO 1 +#define VOL_METHOD_LINEAR 2 + +/* + * Note! SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO are used also as + * input events. + */ + +/* + * Event codes 0xf0 to 0xfc are reserved for future extensions. + */ + +#define SEQ_FULLSIZE 0xfd /* Long events */ +/* + * SEQ_FULLSIZE events are used for loading patches/samples to the + * synthesizer devices. These events are passed directly to the driver + * of the associated synthesizer device. There is no limit to the size + * of the extended events. These events are not queued but executed + * immediately when the write() is called (execution can take several + * seconds of time). + * + * When a SEQ_FULLSIZE message is written to the device, it must + * be written using exactly one write() call. Other events cannot + * be mixed to the same write. + * + * For FM synths (YM3812/OPL3) use struct sbi_instrument and write it to the + * /dev/sequencer. Don't write other data together with the instrument structure + * Set the key field of the structure to FM_PATCH. The device field is used to + * route the patch to the corresponding device. + * + * For wave table use struct patch_info. Initialize the key field + * to WAVE_PATCH. + */ +#define SEQ_PRIVATE 0xfe /* Low level HW dependent events (8 bytes) */ +#define SEQ_EXTENDED 0xff /* Extended events (8 bytes) OBSOLETE */ + +/* + * Record for FM patches + */ + +typedef unsigned char sbi_instr_data[32]; + +struct sbi_instrument { + unsigned short key; /* FM_PATCH or OPL3_PATCH */ +#define FM_PATCH _PATCHKEY(0x01) +#define OPL3_PATCH _PATCHKEY(0x03) + short device; /* Synth# (0-4) */ + int channel; /* Program# to be initialized */ + sbi_instr_data operators; /* Register settings for operator cells (.SBI format) */ + }; + +/* XXX */ +#define _IOT_sbi_instrument _IOT (_IOTS (short), 2, _IOTS (int), 1, _IOTS(char), 3) + +struct synth_info { /* Read only */ + char name[30]; + int device; /* 0-N. INITIALIZE BEFORE CALLING */ + int synth_type; +#define SYNTH_TYPE_FM 0 +#define SYNTH_TYPE_SAMPLE 1 +#define SYNTH_TYPE_MIDI 2 /* Midi interface */ + + int synth_subtype; +#define FM_TYPE_ADLIB 0x00 +#define FM_TYPE_OPL3 0x01 +#define MIDI_TYPE_MPU401 0x401 + +#define SAMPLE_TYPE_BASIC 0x10 +#define SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC +#define SAMPLE_TYPE_WAVEFRONT 0x11 + + int perc_mode; /* No longer supported */ + int nr_voices; + int nr_drums; /* Obsolete field */ + int instr_bank_size; + unsigned int capabilities; +#define SYNTH_CAP_PERCMODE 0x00000001 /* No longer used */ +#define SYNTH_CAP_OPL3 0x00000002 /* Set if OPL3 supported */ +#define SYNTH_CAP_INPUT 0x00000004 /* Input (MIDI) device */ + int dummies[19]; /* Reserve space */ + }; +#define _IOT_synth_info _IOT (_IOTS (char), 30, _IOTS (int), 27, 0, 0) + +struct sound_timer_info { + char name[32]; + int caps; + }; + +#define MIDI_CAP_MPU401 1 /* MPU-401 intelligent mode */ + +struct midi_info { + char name[30]; + int device; /* 0-N. INITIALIZE BEFORE CALLING */ + unsigned int capabilities; /* To be defined later */ + int dev_type; + int dummies[18]; /* Reserve space */ + }; +#define _IOT_midi_info _IOT (_IOTS (char), 30, _IOTS (int), 21, 0, 0) + +/******************************************** + * ioctl commands for the /dev/midi## + */ +typedef struct { + unsigned char cmd; + char nr_args, nr_returns; + unsigned char data[30]; + } mpu_command_rec; +#define _IOT__IOTBASE_mpu_command_rec _IOT (_IOTS (char), 3, _IOTS (char), 30, 0, 0) + +#define SNDCTL_MIDI_PRETIME _SIOWR('m', 0, int) +#define SNDCTL_MIDI_MPUMODE _SIOWR('m', 1, int) +#define SNDCTL_MIDI_MPUCMD _SIOWR('m', 2, mpu_command_rec) + +/******************************************** + * IOCTL commands for /dev/dsp and /dev/audio + */ + +#define SNDCTL_DSP_RESET _SIO ('p', 0) +#define SNDCTL_DSP_SYNC _SIO ('p', 1) +#define SNDCTL_DSP_SPEED _SIOWR('p', 2, int) +#define SNDCTL_DSP_STEREO _SIOWR('p', 3, int) +#define SNDCTL_DSP_GETBLKSIZE _SIOWR('p', 4, int) +#define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT +#define SNDCTL_DSP_CHANNELS _SIOWR('p', 6, int) +#define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS +#define SOUND_PCM_WRITE_FILTER _SIOWR('p', 7, int) +#define SNDCTL_DSP_POST _SIO ('p', 8) +#define SNDCTL_DSP_SUBDIVIDE _SIOWR('p', 9, int) +#define SNDCTL_DSP_SETFRAGMENT _SIOWR('p',10, int) + +/* Audio data formats (Note! U8=8 and S16_LE=16 for compatibility) */ +#define SNDCTL_DSP_GETFMTS _SIOR ('p',11, int) /* Returns a mask */ +#define SNDCTL_DSP_SETFMT _SIOWR('p',5, int) /* Selects ONE fmt*/ +# define AFMT_QUERY 0x00000000 /* Return current fmt */ +# define AFMT_MU_LAW 0x00000001 +# define AFMT_A_LAW 0x00000002 +# define AFMT_IMA_ADPCM 0x00000004 +# define AFMT_U8 0x00000008 +# define AFMT_S16_LE 0x00000010 /* Little endian signed 16*/ +# define AFMT_S16_BE 0x00000020 /* Big endian signed 16 */ +# define AFMT_S8 0x00000040 +# define AFMT_U16_LE 0x00000080 /* Little endian U16 */ +# define AFMT_U16_BE 0x00000100 /* Big endian U16 */ +# define AFMT_MPEG 0x00000200 /* MPEG (2) audio */ +# define AFMT_AC3 0x00000400 /* Dolby Digital AC3 */ + +/* + * Buffer status queries. + */ +typedef struct audio_buf_info { + int fragments; /* # of available fragments (partially usend ones not counted) */ + int fragstotal; /* Total # of fragments allocated */ + int fragsize; /* Size of a fragment in bytes */ + + int bytes; /* Available space in bytes (includes partially used fragments) */ + /* Note! 'bytes' could be more than fragments*fragsize */ + } audio_buf_info; +#define _IOT__IOTBASE_audio_buf_info _IOT (_IOTS (int), 4, 0, 0, 0, 0) + +#define SNDCTL_DSP_GETOSPACE _SIOR ('p',12, audio_buf_info) +#define SNDCTL_DSP_GETISPACE _SIOR ('p',13, audio_buf_info) +#define SNDCTL_DSP_NONBLOCK _SIO ('p',14) +#define SNDCTL_DSP_GETCAPS _SIOR ('p',15, int) +# define DSP_CAP_REVISION 0x000000ff /* Bits for revision level (0 to 255) */ +# define DSP_CAP_DUPLEX 0x00000100 /* Full duplex record/playback */ +# define DSP_CAP_REALTIME 0x00000200 /* Real time capability */ +# define DSP_CAP_BATCH 0x00000400 /* Device has some kind of */ + /* internal buffers which may */ + /* cause some delays and */ + /* decrease precision of timing */ +# define DSP_CAP_COPROC 0x00000800 /* Has a coprocessor */ + /* Sometimes it's a DSP */ + /* but usually not */ +# define DSP_CAP_TRIGGER 0x00001000 /* Supports SETTRIGGER */ +# define DSP_CAP_MMAP 0x00002000 /* Supports mmap() */ +# define DSP_CAP_MULTI 0x00004000 /* support multiple open */ +# define DSP_CAP_BIND 0x00008000 /* channel binding to front/rear/cneter/lfe */ + + +#define SNDCTL_DSP_GETTRIGGER _SIOR ('p',16, int) +#define SNDCTL_DSP_SETTRIGGER _SIOW ('p',16, int) +# define PCM_ENABLE_INPUT 0x00000001 +# define PCM_ENABLE_OUTPUT 0x00000002 + +typedef struct count_info { + int bytes; /* Total # of bytes processed */ + int blocks; /* # of fragment transitions since last time */ + int ptr; /* Current DMA pointer value */ + } count_info; +#define _IOT__IOTBASE_count_info _IOT (_IOTS (int), 3, 0, 0, 0, 0) + +#define SNDCTL_DSP_GETIPTR _SIOR ('p',17, count_info) +#define SNDCTL_DSP_GETOPTR _SIOR ('p',18, count_info) + +typedef struct buffmem_desc { + unsigned *buffer; + int size; + } buffmem_desc; +/* XXX */ +/* #define SNDCTL_DSP_MAPINBUF _SIOR ('p', 19, buffmem_desc) */ +/* #define SNDCTL_DSP_MAPOUTBUF _SIOR ('p', 20, buffmem_desc) */ +#define SNDCTL_DSP_SETSYNCRO _SIO ('p', 21) +#define SNDCTL_DSP_SETDUPLEX _SIO ('p', 22) +#define SNDCTL_DSP_GETODELAY _SIOR ('p', 23, int) + +#define SNDCTL_DSP_GETCHANNELMASK _SIOWR('p', 64, int) +#define SNDCTL_DSP_BIND_CHANNEL _SIOWR('p', 65, int) +# define DSP_BIND_QUERY 0x00000000 +# define DSP_BIND_FRONT 0x00000001 +# define DSP_BIND_SURR 0x00000002 +# define DSP_BIND_CENTER_LFE 0x00000004 +# define DSP_BIND_HANDSET 0x00000008 +# define DSP_BIND_MIC 0x00000010 +# define DSP_BIND_MODEM1 0x00000020 +# define DSP_BIND_MODEM2 0x00000040 +# define DSP_BIND_I2S 0x00000080 +# define DSP_BIND_SPDIF 0x00000100 + +#define SNDCTL_DSP_SETSPDIF _SIOW ('p', 66, int) +#define SNDCTL_DSP_GETSPDIF _SIOR ('p', 67, int) +# define SPDIF_PRO 0x0001 +# define SPDIF_N_AUD 0x0002 +# define SPDIF_COPY 0x0004 +# define SPDIF_PRE 0x0008 +# define SPDIF_CC 0x07f0 +# define SPDIF_L 0x0800 +# define SPDIF_DRS 0x4000 +# define SPDIF_V 0x8000 + +/* + * Application's profile defines the way how playback underrun situations should be handled. + * + * APF_NORMAL (the default) and APF_NETWORK make the driver to cleanup the + * playback buffer whenever an underrun occurs. This consumes some time + * prevents looping the existing buffer. + * APF_CPUINTENS is intended to be set by CPU intensive applications which + * are likely to run out of time occasionally. In this mode the buffer cleanup is + * disabled which saves CPU time but also let's the previous buffer content to + * be played during the "pause" after the underrun. + */ +#define SNDCTL_DSP_PROFILE _SIOW ('p', 23, int) +#define APF_NORMAL 0 /* Normal applications */ +#define APF_NETWORK 1 /* Underruns probably caused by an "external" delay */ +#define APF_CPUINTENS 2 /* Underruns probably caused by "overheating" the CPU */ + +#define SOUND_PCM_READ_RATE _SIOR ('p', 2, int) +#define SOUND_PCM_READ_CHANNELS _SIOR ('p', 6, int) +#define SOUND_PCM_READ_BITS _SIOR ('p', 5, int) +#define SOUND_PCM_READ_FILTER _SIOR ('p', 7, int) + +/* Some alias names */ +#define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT +#define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED +#define SOUND_PCM_POST SNDCTL_DSP_POST +#define SOUND_PCM_RESET SNDCTL_DSP_RESET +#define SOUND_PCM_SYNC SNDCTL_DSP_SYNC +#define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE +#define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT +#define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS +#define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT +#define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE +#define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE +#define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK +#define SOUND_PCM_GETCAPS SNDCTL_DSP_GETCAPS +#define SOUND_PCM_GETTRIGGER SNDCTL_DSP_GETTRIGGER +#define SOUND_PCM_SETTRIGGER SNDCTL_DSP_SETTRIGGER +#define SOUND_PCM_SETSYNCRO SNDCTL_DSP_SETSYNCRO +#define SOUND_PCM_GETIPTR SNDCTL_DSP_GETIPTR +#define SOUND_PCM_GETOPTR SNDCTL_DSP_GETOPTR +#define SOUND_PCM_MAPINBUF SNDCTL_DSP_MAPINBUF +#define SOUND_PCM_MAPOUTBUF SNDCTL_DSP_MAPOUTBUF + +/* + * ioctl calls to be used in communication with coprocessors and + * DSP chips. + */ + +typedef struct copr_buffer { + int command; /* Set to 0 if not used */ + int flags; +#define CPF_NONE 0x0000 +#define CPF_FIRST 0x0001 /* First block */ +#define CPF_LAST 0x0002 /* Last block */ + int len; + int offs; /* If required by the device (0 if not used) */ + + unsigned char data[4000]; /* NOTE! 4000 is not 4k */ + } copr_buffer; +/* XXX */ +#define _IOT__IOTBASE_copr_buffer _IOT (_IOTS (int), 4, _IOTS (char), 31, _IOTS (char), 3) + +typedef struct copr_debug_buf { + int command; /* Used internally. Set to 0 */ + int parm1; + int parm2; + int flags; + int len; /* Length of data in bytes */ + } copr_debug_buf; +#define _IOT__IOTBASE_copr_debug_buf _IOT (_IOTS (int), 5, 0, 0, 0, 0) + +typedef struct copr_msg { + int len; + unsigned char data[4000]; + } copr_msg; +/* XXX */ +#define _IOT__IOTBASE_copr_msg _IOT (_IOTS (int), 1, _IOTS (char), 31, _IOTS (char), 3) + +#define SNDCTL_COPR_RESET _SIO ('o', 0) +#define SNDCTL_COPR_LOAD _SIOWR('o', 1, copr_buffer) +#define SNDCTL_COPR_RDATA _SIOWR('o', 2, copr_debug_buf) +#define SNDCTL_COPR_RCODE _SIOWR('o', 3, copr_debug_buf) +#define SNDCTL_COPR_WDATA _SIOW ('o', 4, copr_debug_buf) +#define SNDCTL_COPR_WCODE _SIOW ('o', 5, copr_debug_buf) +#define SNDCTL_COPR_RUN _SIOWR('o', 6, copr_debug_buf) +#define SNDCTL_COPR_HALT _SIOWR('o', 7, copr_debug_buf) +#define SNDCTL_COPR_SENDMSG _SIOWR('o', 8, copr_msg) +#define SNDCTL_COPR_RCVMSG _SIOR ('o', 9, copr_msg) + +/********************************************* + * IOCTL commands for /dev/mixer + */ + +/* + * Mixer devices + * + * There can be up to 20 different analog mixer channels. The + * SOUND_MIXER_NRDEVICES gives the currently supported maximum. + * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells + * the devices supported by the particular mixer. + */ + +#define SOUND_MIXER_NRDEVICES 25 +#define SOUND_MIXER_VOLUME 0 +#define SOUND_MIXER_BASS 1 +#define SOUND_MIXER_TREBLE 2 +#define SOUND_MIXER_SYNTH 3 +#define SOUND_MIXER_PCM 4 +#define SOUND_MIXER_SPEAKER 5 +#define SOUND_MIXER_LINE 6 +#define SOUND_MIXER_MIC 7 +#define SOUND_MIXER_CD 8 +#define SOUND_MIXER_IMIX 9 /* Recording monitor */ +#define SOUND_MIXER_ALTPCM 10 +#define SOUND_MIXER_RECLEV 11 /* Recording level */ +#define SOUND_MIXER_IGAIN 12 /* Input gain */ +#define SOUND_MIXER_OGAIN 13 /* Output gain */ +/* + * The AD1848 codec and compatibles have three line level inputs + * (line, aux1 and aux2). Since each card manufacturer have assigned + * different meanings to these inputs, it's inpractical to assign + * specific meanings (line, cd, synth etc.) to them. + */ +#define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */ +#define SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */ +#define SOUND_MIXER_LINE3 16 /* Input source 3 (line) */ +#define SOUND_MIXER_DIGITAL1 17 /* Digital (input) 1 */ +#define SOUND_MIXER_DIGITAL2 18 /* Digital (input) 2 */ +#define SOUND_MIXER_DIGITAL3 19 /* Digital (input) 3 */ +#define SOUND_MIXER_PHONEIN 20 /* Phone input */ +#define SOUND_MIXER_PHONEOUT 21 /* Phone output */ +#define SOUND_MIXER_VIDEO 22 /* Video/TV (audio) in */ +#define SOUND_MIXER_RADIO 23 /* Radio in */ +#define SOUND_MIXER_MONITOR 24 /* Monitor (usually mic) volume */ + +/* Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX) */ +/* Not counted to SOUND_MIXER_NRDEVICES, but use the same number space */ +#define SOUND_ONOFF_MIN 28 +#define SOUND_ONOFF_MAX 30 + +/* Note! Number 31 cannot be used since the sign bit is reserved */ +#define SOUND_MIXER_NONE 31 + +/* + * The following unsupported macros are no longer functional. + * Use SOUND_MIXER_PRIVATE# macros in future. + */ +#define SOUND_MIXER_ENHANCE SOUND_MIXER_NONE +#define SOUND_MIXER_MUTE SOUND_MIXER_NONE +#define SOUND_MIXER_LOUD SOUND_MIXER_NONE + + +#define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \ + "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \ + "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \ + "PhoneIn", "PhoneOut", "Video", "Radio", "Monitor"} + +#define SOUND_DEVICE_NAMES {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \ + "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \ + "line1", "line2", "line3", "dig1", "dig2", "dig3", \ + "phin", "phout", "video", "radio", "monitor"} + +/* Device bitmask identifiers */ + +#define SOUND_MIXER_RECSRC 0xff /* Arg contains a bit for each recording source */ +#define SOUND_MIXER_DEVMASK 0xfe /* Arg contains a bit for each supported device */ +#define SOUND_MIXER_RECMASK 0xfd /* Arg contains a bit for each supported recording source */ +#define SOUND_MIXER_CAPS 0xfc +# define SOUND_CAP_EXCL_INPUT 0x00000001 /* Only one recording source at a time */ +#define SOUND_MIXER_STEREODEVS 0xfb /* Mixer channels supporting stereo */ +#define SOUND_MIXER_OUTSRC 0xfa /* Arg contains a bit for each input source to output */ +#define SOUND_MIXER_OUTMASK 0xf9 /* Arg contains a bit for each supported input source to output */ + +/* Device mask bits */ + +#define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME) +#define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS) +#define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE) +#define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH) +#define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM) +#define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER) +#define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE) +#define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC) +#define SOUND_MASK_CD (1 << SOUND_MIXER_CD) +#define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX) +#define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM) +#define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV) +#define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN) +#define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN) +#define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1) +#define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2) +#define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3) +#define SOUND_MASK_DIGITAL1 (1 << SOUND_MIXER_DIGITAL1) +#define SOUND_MASK_DIGITAL2 (1 << SOUND_MIXER_DIGITAL2) +#define SOUND_MASK_DIGITAL3 (1 << SOUND_MIXER_DIGITAL3) +#define SOUND_MASK_PHONEIN (1 << SOUND_MIXER_PHONEIN) +#define SOUND_MASK_PHONEOUT (1 << SOUND_MIXER_PHONEOUT) +#define SOUND_MASK_RADIO (1 << SOUND_MIXER_RADIO) +#define SOUND_MASK_VIDEO (1 << SOUND_MIXER_VIDEO) +#define SOUND_MASK_MONITOR (1 << SOUND_MIXER_MONITOR) + +/* Obsolete macros */ +#define SOUND_MASK_MUTE (1 << SOUND_MIXER_MUTE) +#define SOUND_MASK_ENHANCE (1 << SOUND_MIXER_ENHANCE) +#define SOUND_MASK_LOUD (1 << SOUND_MIXER_LOUD) + +#define MIXER_READ(dev) _SIOR('r', dev, int) +#define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME) +#define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS) +#define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE) +#define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH) +#define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM) +#define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER) +#define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE) +#define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC) +#define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD) +#define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX) +#define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM) +#define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV) +#define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN) +#define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN) +#define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1) +#define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2) +#define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3) + +/* Obsolete macros */ +#define SOUND_MIXER_READ_MUTE MIXER_READ(SOUND_MIXER_MUTE) +#define SOUND_MIXER_READ_ENHANCE MIXER_READ(SOUND_MIXER_ENHANCE) +#define SOUND_MIXER_READ_LOUD MIXER_READ(SOUND_MIXER_LOUD) + +#define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC) +#define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK) +#define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK) +#define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS) +#define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS) + +#define MIXER_WRITE(dev) _SIOWR('r', dev, int) +#define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME) +#define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS) +#define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE) +#define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH) +#define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM) +#define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER) +#define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE) +#define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC) +#define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD) +#define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX) +#define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM) +#define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV) +#define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN) +#define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN) +#define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1) +#define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2) +#define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3) + +/* Obsolete macros */ +#define SOUND_MIXER_WRITE_MUTE MIXER_WRITE(SOUND_MIXER_MUTE) +#define SOUND_MIXER_WRITE_ENHANCE MIXER_WRITE(SOUND_MIXER_ENHANCE) +#define SOUND_MIXER_WRITE_LOUD MIXER_WRITE(SOUND_MIXER_LOUD) + +#define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC) + +typedef struct mixer_info +{ + char id[16]; +/* XXX */ + char name[15]; + int modify_counter; + int fillers[10]; +} mixer_info; +#define _IOT__IOTBASE_mixer_info _IOT (_IOTS (char), 31, _IOTS (int), 11, 0, 0) + +typedef struct _old_mixer_info /* Obsolete */ +{ + char id[16]; + char name[32]; +} _old_mixer_info; +#define _IOT__IOTBASE__old_mixer_info _IOT (_IOTS (char), 17, _IOTS (char), 31, 0, 0) + +#define SOUND_MIXER_INFO _SIOR ('r', 101, mixer_info) +#define SOUND_OLD_MIXER_INFO _SIOR ('r', 101, _old_mixer_info) + +/* + * A mechanism for accessing "proprietary" mixer features. This method + * permits passing 128 bytes of arbitrary data between a mixer application + * and the mixer driver. Interpretation of the record is defined by + * the particular mixer driver. + */ +typedef unsigned char mixer_record[128]; +/* XXX */ +#define _IOT__IOTBASE_mixer_record _IOT (_IOTS (char), 31, _IOTS (char), 31, _IOTS (char), 3) + +#define SOUND_MIXER_ACCESS _SIOWR('r', 102, mixer_record) + +/* + * Two ioctls for special souncard function + */ +#define SOUND_MIXER_AGC _SIOWR('r', 103, int) +#define SOUND_MIXER_3DSE _SIOWR('r', 104, int) + +/* + * The SOUND_MIXER_PRIVATE# commands can be redefined by low level drivers. + * These features can be used when accessing device specific features. + */ +#define SOUND_MIXER_PRIVATE1 _SIOWR('r', 111, int) +#define SOUND_MIXER_PRIVATE2 _SIOWR('r', 112, int) +#define SOUND_MIXER_PRIVATE3 _SIOWR('r', 113, int) +#define SOUND_MIXER_PRIVATE4 _SIOWR('r', 114, int) +#define SOUND_MIXER_PRIVATE5 _SIOWR('r', 115, int) + +/* + * SOUND_MIXER_GETLEVELS and SOUND_MIXER_SETLEVELS calls can be used + * for querying current mixer settings from the driver and for loading + * default volume settings _prior_ activating the mixer (loading + * doesn't affect current state of the mixer hardware). These calls + * are for internal use only. + */ + +typedef struct mixer_vol_table { + char name[31]; + int num; /* Index to volume table */ + int levels[32]; +} mixer_vol_table; +#define _IOT__IOTBASE_mixer_vol_table _IOT (_IOTS (char), 31, _IOTS (int), 31, _IOTS (int), 2) + +#define SOUND_MIXER_GETLEVELS _SIOWR('r', 116, mixer_vol_table) +#define SOUND_MIXER_SETLEVELS _SIOWR('r', 117, mixer_vol_table) + +/* + * An ioctl for identifying the driver version. It will return value + * of the SOUND_VERSION macro used when compiling the driver. + * This call was introduced in OSS version 3.6 and it will not work + * with earlier versions (returns EINVAL). + */ +#define OSS_GETVERSION _SIOR ('r', 118, int) + +/* + * Level 2 event types for /dev/sequencer + */ + +/* + * The 4 most significant bits of byte 0 specify the class of + * the event: + * + * 0x8X = system level events, + * 0x9X = device/port specific events, event[1] = device/port, + * The last 4 bits give the subtype: + * 0x02 = Channel event (event[3] = chn). + * 0x01 = note event (event[4] = note). + * (0x01 is not used alone but always with bit 0x02). + * event[2] = MIDI message code (0x80=note off etc.) + * + */ + +#define EV_SEQ_LOCAL 0x80 +#define EV_TIMING 0x81 +#define EV_CHN_COMMON 0x92 +#define EV_CHN_VOICE 0x93 +#define EV_SYSEX 0x94 +/* + * Event types 200 to 220 are reserved for application use. + * These numbers will not be used by the driver. + */ + +/* + * Events for event type EV_CHN_VOICE + */ + +#define MIDI_NOTEOFF 0x80 +#define MIDI_NOTEON 0x90 +#define MIDI_KEY_PRESSURE 0xA0 + +/* + * Events for event type EV_CHN_COMMON + */ + +#define MIDI_CTL_CHANGE 0xB0 +#define MIDI_PGM_CHANGE 0xC0 +#define MIDI_CHN_PRESSURE 0xD0 +#define MIDI_PITCH_BEND 0xE0 + +#define MIDI_SYSTEM_PREFIX 0xF0 + +/* + * Timer event types + */ +#define TMR_WAIT_REL 1 /* Time relative to the prev time */ +#define TMR_WAIT_ABS 2 /* Absolute time since TMR_START */ +#define TMR_STOP 3 +#define TMR_START 4 +#define TMR_CONTINUE 5 +#define TMR_TEMPO 6 +#define TMR_ECHO 8 +#define TMR_CLOCK 9 /* MIDI clock */ +#define TMR_SPP 10 /* Song position pointer */ +#define TMR_TIMESIG 11 /* Time signature */ + +/* + * Local event types + */ +#define LOCL_STARTAUDIO 1 + +#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) +/* + * Some convenience macros to simplify programming of the + * /dev/sequencer interface + * + * These macros define the API which should be used when possible. + */ +#define SEQ_DECLAREBUF() SEQ_USE_EXTBUF() + +void seqbuf_dump(void); /* This function must be provided by programs */ + +extern int OSS_init(int seqfd, int buflen); +extern void OSS_seqbuf_dump(int fd, unsigned char *buf, int buflen); +extern void OSS_seq_advbuf(int len, int fd, unsigned char *buf, int buflen); +extern void OSS_seq_needbuf(int len, int fd, unsigned char *buf, int buflen); +extern void OSS_patch_caching(int dev, int chn, int patch, + int fd, unsigned char *buf, int buflen); +extern void OSS_drum_caching(int dev, int chn, int patch, + int fd, unsigned char *buf, int buflen); +extern void OSS_write_patch(int fd, unsigned char *buf, int len); +extern int OSS_write_patch2(int fd, unsigned char *buf, int len); + +#define SEQ_PM_DEFINES int __foo_bar___ +#ifdef OSSLIB +# define SEQ_USE_EXTBUF() \ + extern unsigned char *_seqbuf; \ + extern int _seqbuflen;extern int _seqbufptr +# define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len +# define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen) +# define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen) +# define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen) + +# define SEQ_LOAD_GMINSTR(dev, instr) \ + OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen) +# define SEQ_LOAD_GMDRUM(dev, drum) \ + OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen) +#else /* !OSSLIB */ + +# define SEQ_LOAD_GMINSTR(dev, instr) +# define SEQ_LOAD_GMDRUM(dev, drum) + +# define SEQ_USE_EXTBUF() \ + extern unsigned char _seqbuf[]; \ + extern int _seqbuflen;extern int _seqbufptr + +#ifndef USE_SIMPLE_MACROS +/* Sample seqbuf_dump() implementation: + * + * SEQ_DEFINEBUF (2048); -- Defines a buffer for 2048 bytes + * + * int seqfd; -- The file descriptor for /dev/sequencer. + * + * void + * seqbuf_dump () + * { + * if (_seqbufptr) + * if (write (seqfd, _seqbuf, _seqbufptr) == -1) + * { + * perror ("write /dev/sequencer"); + * exit (-1); + * } + * _seqbufptr = 0; + * } + */ + +#define SEQ_DEFINEBUF(len) unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0 +#define _SEQ_NEEDBUF(len) if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump() +#define _SEQ_ADVBUF(len) _seqbufptr += len +#define SEQ_DUMPBUF seqbuf_dump +#else +/* + * This variation of the sequencer macros is used just to format one event + * using fixed buffer. + * + * The program using the macro library must define the following macros before + * using this library. + * + * #define _seqbuf name of the buffer (unsigned char[]) + * #define _SEQ_ADVBUF(len) If the applic needs to know the exact + * size of the event, this macro can be used. + * Otherwise this must be defined as empty. + * #define _seqbufptr Define the name of index variable or 0 if + * not required. + */ +#define _SEQ_NEEDBUF(len) /* empty */ +#endif +#endif /* !OSSLIB */ + +#define SEQ_VOLUME_MODE(dev, mode) {_SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr] = SEQ_EXTENDED;\ + _seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\ + _seqbuf[_seqbufptr+2] = (dev);\ + _seqbuf[_seqbufptr+3] = (mode);\ + _seqbuf[_seqbufptr+4] = 0;\ + _seqbuf[_seqbufptr+5] = 0;\ + _seqbuf[_seqbufptr+6] = 0;\ + _seqbuf[_seqbufptr+7] = 0;\ + _SEQ_ADVBUF(8);} + +/* + * Midi voice messages + */ + +#define _CHN_VOICE(dev, event, chn, note, parm) \ + {_SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr] = EV_CHN_VOICE;\ + _seqbuf[_seqbufptr+1] = (dev);\ + _seqbuf[_seqbufptr+2] = (event);\ + _seqbuf[_seqbufptr+3] = (chn);\ + _seqbuf[_seqbufptr+4] = (note);\ + _seqbuf[_seqbufptr+5] = (parm);\ + _seqbuf[_seqbufptr+6] = (0);\ + _seqbuf[_seqbufptr+7] = 0;\ + _SEQ_ADVBUF(8);} + +#define SEQ_START_NOTE(dev, chn, note, vol) \ + _CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol) + +#define SEQ_STOP_NOTE(dev, chn, note, vol) \ + _CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol) + +#define SEQ_KEY_PRESSURE(dev, chn, note, pressure) \ + _CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure) + +/* + * Midi channel messages + */ + +#define _CHN_COMMON(dev, event, chn, p1, p2, w14) \ + {_SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr] = EV_CHN_COMMON;\ + _seqbuf[_seqbufptr+1] = (dev);\ + _seqbuf[_seqbufptr+2] = (event);\ + _seqbuf[_seqbufptr+3] = (chn);\ + _seqbuf[_seqbufptr+4] = (p1);\ + _seqbuf[_seqbufptr+5] = (p2);\ + *(short *)&_seqbuf[_seqbufptr+6] = (w14);\ + _SEQ_ADVBUF(8);} +/* + * SEQ_SYSEX permits sending of sysex messages. (It may look that it permits + * sending any MIDI bytes but it's absolutely not possible. Trying to do + * so _will_ cause problems with MPU401 intelligent mode). + * + * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be + * sent by calling SEQ_SYSEX() several times (there must be no other events + * between them). First sysex fragment must have 0xf0 in the first byte + * and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte + * between these sysex start and end markers cannot be larger than 0x7f. Also + * lengths of each fragments (except the last one) must be 6. + * + * Breaking the above rules may work with some MIDI ports but is likely to + * cause fatal problems with some other devices (such as MPU401). + */ +#define SEQ_SYSEX(dev, buf, len) \ + {int ii, ll=(len); \ + unsigned char *bufp=buf;\ + if (ll>6)ll=6;\ + _SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr] = EV_SYSEX;\ + _seqbuf[_seqbufptr+1] = (dev);\ + for(ii=0;ii<ll;ii++)\ + _seqbuf[_seqbufptr+ii+2] = bufp[ii];\ + for(ii=ll;ii<6;ii++)\ + _seqbuf[_seqbufptr+ii+2] = 0xff;\ + _SEQ_ADVBUF(8);} + +#define SEQ_CHN_PRESSURE(dev, chn, pressure) \ + _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0) + +#define SEQ_SET_PATCH SEQ_PGM_CHANGE +#ifdef OSSLIB +# define SEQ_PGM_CHANGE(dev, chn, patch) \ + {OSS_patch_caching(dev, chn, patch, seqfd, _seqbuf, _seqbuflen); \ + _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0);} +#else +# define SEQ_PGM_CHANGE(dev, chn, patch) \ + _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0) +#endif + +#define SEQ_CONTROL(dev, chn, controller, value) \ + _CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value) + +#define SEQ_BENDER(dev, chn, value) \ + _CHN_COMMON(dev, MIDI_PITCH_BEND, chn, 0, 0, value) + + +#define SEQ_V2_X_CONTROL(dev, voice, controller, value) {_SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr] = SEQ_EXTENDED;\ + _seqbuf[_seqbufptr+1] = SEQ_CONTROLLER;\ + _seqbuf[_seqbufptr+2] = (dev);\ + _seqbuf[_seqbufptr+3] = (voice);\ + _seqbuf[_seqbufptr+4] = (controller);\ + _seqbuf[_seqbufptr+5] = ((value)&0xff);\ + _seqbuf[_seqbufptr+6] = ((value>>8)&0xff);\ + _seqbuf[_seqbufptr+7] = 0;\ + _SEQ_ADVBUF(8);} +/* + * The following 5 macros are incorrectly implemented and obsolete. + * Use SEQ_BENDER and SEQ_CONTROL (with proper controller) instead. + */ +#define SEQ_PITCHBEND(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value) +#define SEQ_BENDER_RANGE(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value) +#define SEQ_EXPRESSION(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128) +#define SEQ_MAIN_VOLUME(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100) +#define SEQ_PANNING(dev, voice, pos) SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2) + +/* + * Timing and syncronization macros + */ + +#define _TIMER_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr+0] = EV_TIMING; \ + _seqbuf[_seqbufptr+1] = (ev); \ + _seqbuf[_seqbufptr+2] = 0;\ + _seqbuf[_seqbufptr+3] = 0;\ + *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \ + _SEQ_ADVBUF(8);} + +#define SEQ_START_TIMER() _TIMER_EVENT(TMR_START, 0) +#define SEQ_STOP_TIMER() _TIMER_EVENT(TMR_STOP, 0) +#define SEQ_CONTINUE_TIMER() _TIMER_EVENT(TMR_CONTINUE, 0) +#define SEQ_WAIT_TIME(ticks) _TIMER_EVENT(TMR_WAIT_ABS, ticks) +#define SEQ_DELTA_TIME(ticks) _TIMER_EVENT(TMR_WAIT_REL, ticks) +#define SEQ_ECHO_BACK(key) _TIMER_EVENT(TMR_ECHO, key) +#define SEQ_SET_TEMPO(value) _TIMER_EVENT(TMR_TEMPO, value) +#define SEQ_SONGPOS(pos) _TIMER_EVENT(TMR_SPP, pos) +#define SEQ_TIME_SIGNATURE(sig) _TIMER_EVENT(TMR_TIMESIG, sig) + +/* + * Local control events + */ + +#define _LOCAL_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\ + _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \ + _seqbuf[_seqbufptr+1] = (ev); \ + _seqbuf[_seqbufptr+2] = 0;\ + _seqbuf[_seqbufptr+3] = 0;\ + *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \ + _SEQ_ADVBUF(8);} + +#define SEQ_PLAYAUDIO(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO, devmask) +/* + * Events for the level 1 interface only + */ + +#define SEQ_MIDIOUT(device, byte) {_SEQ_NEEDBUF(4);\ + _seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\ + _seqbuf[_seqbufptr+1] = (byte);\ + _seqbuf[_seqbufptr+2] = (device);\ + _seqbuf[_seqbufptr+3] = 0;\ + _SEQ_ADVBUF(4);} + +/* + * Patch loading. + */ +#ifdef OSSLIB +# define SEQ_WRPATCH(patchx, len) \ + OSS_write_patch(seqfd, (char*)(patchx), len) +# define SEQ_WRPATCH2(patchx, len) \ + OSS_write_patch2(seqfd, (char*)(patchx), len) +#else +# define SEQ_WRPATCH(patchx, len) \ + {if (_seqbufptr) SEQ_DUMPBUF();\ + if (write(seqfd, (char*)(patchx), len)==-1) \ + perror("Write patch: /dev/sequencer");} +# define SEQ_WRPATCH2(patchx, len) \ + (SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len)) +#endif + +#endif +#endif /* sys/soundcard.h */ diff --git a/debian/local/urandom-hurd.sh b/debian/local/urandom-hurd.sh new file mode 100755 index 00000000..1205e8b4 --- /dev/null +++ b/debian/local/urandom-hurd.sh @@ -0,0 +1,2 @@ +#!/bin/sh +exec /hurd/random --seed-file /var/spool/random-seed --fast diff --git a/debian/make-new-orig.sh b/debian/make-new-orig.sh new file mode 100755 index 00000000..8f427623 --- /dev/null +++ b/debian/make-new-orig.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +if [ -z $1 ]; then + echo "Please provide the directory to tar up as an argument" + exit 1 +fi + +TARBALL=$(echo $1 | tr - _).orig.tar.gz + +tar -czvf $TARBALL --exclude=debian $1 + diff --git a/debian/make-new-tarball.sh b/debian/make-new-tarball.sh new file mode 100755 index 00000000..5af64b97 --- /dev/null +++ b/debian/make-new-tarball.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +if [ -z $1 ]; then + echo "Please provide the directory to tar up as an argument" + exit 1 +fi + +BASENAME=$(basename $1) +DIRNAME=$(dirname $1) + +tar -czvf hurd.tgz \ + --exclude=.git --exclude=.gitignore --exclude=debian \ + -C $DIRNAME $BASENAME + diff --git a/debian/patches/console_ignore_bdf_err.patch b/debian/patches/console_ignore_bdf_err.patch new file mode 100644 index 00000000..c3ea30cb --- /dev/null +++ b/debian/patches/console_ignore_bdf_err.patch @@ -0,0 +1,17 @@ +reduce-font overestimates the number of characters in the font. + +diff --git a/console-client/bdf.c b/console-client/bdf.c +index 30501f4..ee8aa30 100644 +--- a/console-client/bdf.c ++++ b/console-client/bdf.c +@@ -415,8 +415,10 @@ bdf_read (FILE *filep, bdf_font_t *font, int *linecount) + glyphs. */ + if (!strcmp (line, "ENDFONT")) + { ++ /* + if (parser.glyphs != bdf->glyphs_count) + err = BDF_COUNT_MISMATCH; ++ */ + done = 1; + } + else diff --git a/debian/patches/diskfs_no_inherit_dir_group.patch b/debian/patches/diskfs_no_inherit_dir_group.patch new file mode 100644 index 00000000..8d17f3e0 --- /dev/null +++ b/debian/patches/diskfs_no_inherit_dir_group.patch @@ -0,0 +1,29 @@ +Follow POSIX rules for gid of new nodes. +--- + opts-common.c | 2 +- + libdiskfs/init-init.c | 3 +++ + 2 file changed, 4 insertion(+), 1 deletion(-) + +--- a/libdiskfs/init-init.c ++++ b/libdiskfs/init-init.c +@@ -57,6 +57,9 @@ diskfs_init_diskfs (void) + { + error_t err; + ++ /* See `node-create.c'. */ ++ _diskfs_no_inherit_dir_group = 1; ++ + if (diskfs_boot_filesystem ()) + /* This is a boot filesystem, we have to do some things specially. */ + { +--- a/libdiskfs/opts-common.c ++++ b/libdiskfs/opts-common.c +@@ -52,7 +52,7 @@ const struct argp_option diskfs_common_options[] = + {"nogrpid", 0, 0, OPTION_ALIAS | OPTION_HIDDEN}, + {"sysvgroups", 0, 0, OPTION_ALIAS | OPTION_HIDDEN}, + {"inherit-dir-group", OPT_INHERIT_DIR_GROUP, 0, 0, +- "Create new nodes with gid of parent dir (default)"}, ++ "Create new nodes with gid of parent dir"}, + {"grpid", 0, 0, OPTION_ALIAS | OPTION_HIDDEN}, + {"bsdgroups", 0, 0, OPTION_ALIAS | OPTION_HIDDEN}, + {0, 0} diff --git a/debian/patches/exec_filename_exec.patch b/debian/patches/exec_filename_exec.patch new file mode 100644 index 00000000..41b66a82 --- /dev/null +++ b/debian/patches/exec_filename_exec.patch @@ -0,0 +1,338 @@ +From 011df9d35eb68132cdb14a0f55e2435375e2cfce Mon Sep 17 00:00:00 2001 +From: Emilio Pozuelo Monfort <pochu27@gmail.com> +Date: Wed, 26 May 2010 00:15:37 +0200 +Subject: [PATCH 1/3] Add a new exec_exec_file_name RPC + +* hurd/exec.defs (exec_exec_file_name): New RPC. +(exec_exec): Label as deprecated. +* doc/hurd.texi: Updated. +* exec/exec.c (S_exec_exec_file_name): New function. +(S_exec_exec): Label as deprecated. +(do_exec): Add argument. +* exec/hashexec.c (check_hashbang): Add argument. +Don't guess the file name if file_name_exec is set. +* exec/priv.h (check_hashbang): Add argument. +--- + doc/hurd.texi | 8 ++++---- + exec/exec.c | 50 +++++++++++++++++++++++++++++++++++++++++++++----- + exec/hashexec.c | 18 ++++++++++++------ + exec/priv.h | 4 +++- + hurd/exec.defs | 19 +++++++++++++++++-- + 5 files changed, 81 insertions(+), 18 deletions(-) + +Index: hurd-debian/doc/hurd.texi +=================================================================== +--- hurd-debian.orig/doc/hurd.texi 2012-06-03 20:17:54.000000000 +0000 ++++ hurd-debian/doc/hurd.texi 2012-06-05 04:32:07.000000000 +0000 +@@ -102,7 +102,7 @@ + documentation was last updated for version @value{VERSION} of the Hurd. + + Copyright @copyright{} 1994, 1996, 1998, 1999, 2000, 2001, 2002, 2003, +-2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. ++2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + + @quotation + Permission is granted to make and distribute verbatim copies of +@@ -2770,14 +2770,14 @@ + authentication handle that was not previously present (as opposed to + merely reordering them), then the @code{EXEC_SECURE} and + @code{EXEC_NEWTASK} flags should both be added in the call to +-@code{exec_exec}. ++@code{exec_exec_file_name}. + + The server then needs to open a new port onto the executed file which + will not share any file pointers with the port the user passed in, + opened with @code{O_READ}. Finally, all the information (mutated + appropriately for setuid/setgid) should be sent to the execserver with +-@code{exec_exec}. Whatever error code @code{exec_exec} returns should +-returned to the caller of @code{file_exec}. ++@code{exec_exec_file_name}. Whatever error code @code{exec_exec_file_name} ++returns should be returned to the caller of @code{file_exec}. + + @node File Locking + @subsection File Locking +Index: hurd-debian/exec/exec.c +=================================================================== +--- hurd-debian.orig/exec/exec.c 2012-06-03 17:08:36.000000000 +0000 ++++ hurd-debian/exec/exec.c 2012-06-05 04:19:51.000000000 +0000 +@@ -1,6 +1,6 @@ + /* GNU Hurd standard exec server. +- Copyright (C) 1992,93,94,95,96,98,99,2000,01,02,04 +- Free Software Foundation, Inc. ++ Copyright (C) 1992 ,1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, ++ 2002, 2004, 2010 Free Software Foundation, Inc. + Written by Roland McGrath. + + Can exec ELF format directly. +@@ -1357,6 +1357,7 @@ + do_exec (file_t file, + task_t oldtask, + int flags, ++ char *filename, + char *argv, mach_msg_type_number_t argvlen, boolean_t argv_copy, + char *envp, mach_msg_type_number_t envplen, boolean_t envp_copy, + mach_port_t *dtable, mach_msg_type_number_t dtablesize, +@@ -1452,7 +1453,7 @@ + { + /* Check for a #! executable file. */ + check_hashbang (&e, +- file, oldtask, flags, ++ file, oldtask, flags, filename, + argv, argvlen, argv_copy, + envp, envplen, envp_copy, + dtable, dtablesize, dtable_copy, +@@ -2055,6 +2056,7 @@ + return e.error; + } + ++/* Deprecated. */ + kern_return_t + S_exec_exec (struct trivfs_protid *protid, + file_t file, +@@ -2071,6 +2073,44 @@ + mach_port_t *deallocnames, mach_msg_type_number_t ndeallocnames, + mach_port_t *destroynames, mach_msg_type_number_t ndestroynames) + { ++ return S_exec_exec_file_name (protid, ++ file, ++ oldtask, ++ flags, ++ "", ++ argv, argvlen, argv_copy, ++ envp, envplen, envp_copy, ++ dtable, dtablesize, ++ dtable_copy, ++ portarray, nports, ++ portarray_copy, ++ intarray, nints, ++ intarray_copy, ++ deallocnames, ndeallocnames, ++ destroynames, ndestroynames); ++} ++ ++kern_return_t ++S_exec_exec_file_name (struct trivfs_protid *protid, ++ file_t file, ++ task_t oldtask, ++ int flags, ++ char *filename, ++ char *argv, mach_msg_type_number_t argvlen, ++ boolean_t argv_copy, ++ char *envp, mach_msg_type_number_t envplen, ++ boolean_t envp_copy, ++ mach_port_t *dtable, mach_msg_type_number_t dtablesize, ++ boolean_t dtable_copy, ++ mach_port_t *portarray, mach_msg_type_number_t nports, ++ boolean_t portarray_copy, ++ int *intarray, mach_msg_type_number_t nints, ++ boolean_t intarray_copy, ++ mach_port_t *deallocnames, ++ mach_msg_type_number_t ndeallocnames, ++ mach_port_t *destroynames, ++ mach_msg_type_number_t ndestroynames) ++{ + if (! protid) + return EOPNOTSUPP; + +@@ -2111,7 +2151,7 @@ + trivfs_protid_portclasses[0]); + if (protid) + { +- err = do_exec (file, oldtask, 0, ++ err = do_exec (file, oldtask, 0, filename, + argv, argvlen, argv_copy, + envp, envplen, envp_copy, + dtable, dtablesize, dtable_copy, +@@ -2158,7 +2198,7 @@ + /* There were no user-specified exec servers, + or none of them could be found. */ + +- return do_exec (file, oldtask, flags, ++ return do_exec (file, oldtask, flags, filename, + argv, argvlen, argv_copy, + envp, envplen, envp_copy, + dtable, dtablesize, dtable_copy, +Index: hurd-debian/exec/hashexec.c +=================================================================== +--- hurd-debian.orig/exec/hashexec.c 2012-06-03 17:08:36.000000000 +0000 ++++ hurd-debian/exec/hashexec.c 2012-06-05 04:32:38.000000000 +0000 +@@ -1,5 +1,6 @@ + /* GNU Hurd standard exec server, #! script execution support. +- Copyright (C) 1995,96,97,98,99,2000,02 Free Software Foundation, Inc. ++ Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2010 ++ Free Software Foundation, Inc. + Written by Roland McGrath. + + This file is part of the GNU Hurd. +@@ -35,6 +36,7 @@ + file_t file, + task_t oldtask, + int flags, ++ char *file_name_exec, + char *argv, u_int argvlen, boolean_t argv_copy, + char *envp, u_int envplen, boolean_t envp_copy, + mach_port_t *dtable, u_int dtablesize, boolean_t dtable_copy, +@@ -225,10 +227,12 @@ + file_name = NULL; + else if (! (flags & EXEC_SECURE)) + { +- /* Try to figure out the file's name. We guess that if ARGV[0] +- contains a slash, it might be the name of the file; and that +- if it contains no slash, looking for files named by ARGV[0] in +- the `PATH' environment variable might find it. */ ++ /* Try to figure out the file's name. If FILE_NAME_EXEC ++ is not NULL, then it's the file's name. Otherwise we ++ guess that if ARGV[0] contains a slash, it might be ++ the name of the file; and that if it contains no slash, ++ looking for files named by ARGV[0] in the `PATH' ++ environment variable might find it. */ + + error_t error; + char *name; +@@ -278,7 +282,9 @@ + else + name = argv; + +- if (strchr (name, '/') != NULL) ++ if (file_name_exec && file_name_exec[0] != '\0') ++ error = lookup (name = file_name_exec, 0, &name_file); ++ else if (strchr (name, '/') != NULL) + error = lookup (name, 0, &name_file); + else if ((error = hurd_catch_signal + (sigmask (SIGBUS) | sigmask (SIGSEGV), +Index: hurd-debian/exec/priv.h +=================================================================== +--- hurd-debian.orig/exec/priv.h 2012-06-03 17:08:36.000000000 +0000 ++++ hurd-debian/exec/priv.h 2012-06-05 03:36:44.000000000 +0000 +@@ -1,5 +1,6 @@ + /* GNU Hurd standard exec server, private declarations. +- Copyright (C) 1992,93,94,95,96,99,2000,02, 04 Free Software Foundation, Inc. ++ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2002, 2004, ++ 2010 Free Software Foundation, Inc. + Written by Roland McGrath. + + This file is part of the GNU Hurd. +@@ -36,6 +37,7 @@ + #include <link.h> /* This gives us the ElfW macro. */ + #include <fcntl.h> + #include "exec_S.h" ++#include "exec_experimental_S.h" + + + #ifndef exec_priv_h +@@ -171,6 +173,7 @@ + file_t file, + task_t oldtask, + int flags, ++ char *filename, + char *argv, u_int argvlen, boolean_t argv_copy, + char *envp, u_int envplen, boolean_t envp_copy, + mach_port_t *dtable, u_int dtablesize, +Index: hurd-debian/hurd/exec.defs +=================================================================== +--- hurd-debian.orig/hurd/exec.defs 2012-06-03 17:08:36.000000000 +0000 ++++ hurd-debian/hurd/exec.defs 2012-06-03 20:17:55.000000000 +0000 +@@ -1,5 +1,6 @@ + /* Interface definitions for the exec servers. +- Copyright (C) 1991,92,93,94,95,2001 Free Software Foundation, Inc. ++ Copyright (C) 1991, 1992, 1993, 1994, 1995, 2001, 2010 ++ Free Software Foundation, Inc. + + This file is part of the GNU Hurd. + +@@ -29,6 +30,7 @@ + + INTR_INTERFACE + ++/* Deprecated: use exec_exec_file_name instead. */ + routine exec_exec ( + execserver: file_t; + file: mach_port_send_t; +Index: hurd-debian/hurd/exec_experimental.defs +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ hurd-debian/hurd/exec_experimental.defs 2012-06-03 20:17:55.000000000 +0000 +@@ -0,0 +1,46 @@ ++/* Interface definitions for the exec servers. ++ Copyright (C) 1991, 1992, 1993, 1994, 1995, 2001, 2010, 2012 ++ Free Software Foundation, Inc. ++ ++This file is part of the GNU Hurd. ++ ++The GNU Hurd 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. ++ ++The GNU Hurd 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 the GNU Hurd; see the file COPYING. If not, write to ++the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ++ ++/* Written by Michael I. Bushnell and Roland McGrath. */ ++ ++subsystem exec_experimental 434242; ++ ++#include <hurd/hurd_types.defs> ++ ++#ifdef EXEC_IMPORTS ++EXEC_IMPORTS ++#endif ++ ++INTR_INTERFACE ++ ++routine exec_exec_file_name ( ++ execserver: file_t; ++ file: mach_port_send_t; ++ oldtask: task_t; ++ flags: int; ++ filename: string_t; ++ argv: data_t SCP; ++ envp: data_t SCP; ++ dtable: portarray_t SCP; ++ portarray: portarray_t SCP; ++ intarray: intarray_t SCP; ++ deallocnames: mach_port_name_array_t; ++ destroynames: mach_port_name_array_t); ++ +Index: hurd-debian/exec/Makefile +=================================================================== +--- hurd-debian.orig/exec/Makefile 2012-06-03 17:08:36.000000000 +0000 ++++ hurd-debian/exec/Makefile 2012-06-05 03:39:06.000000000 +0000 +@@ -23,7 +23,7 @@ + SRCS = exec.c main.c hashexec.c hostarch.c \ + $(gzip-sources) $(bzip2-sources) + OBJS = main.o hostarch.o exec.o hashexec.o \ +- execServer.o exec_startupServer.o \ ++ execServer.o exec_startupServer.o exec_experimentalServer.o \ + $(gzip-objects) $(bzip2-objects) + gzip-sources = unzip.c util.c inflate.c + gzip-objects = $(gzip-sources:%.c=%.o) +@@ -37,6 +37,7 @@ + OTHERLIBS = -lpthread + + exec-MIGSFLAGS = -imacros $(srcdir)/execmutations.h ++exec_experimental-MIGSFLAGS = -imacros $(srcdir)/execmutations.h + + include ../Makeconf + +Index: hurd-debian/exec/main.c +=================================================================== +--- hurd-debian.orig/exec/main.c 2012-06-03 17:08:36.000000000 +0000 ++++ hurd-debian/exec/main.c 2012-06-05 01:28:09.000000000 +0000 +@@ -58,9 +58,11 @@ + exec_demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp) + { + extern int exec_server (mach_msg_header_t *inp, mach_msg_header_t *outp); ++ extern int exec_experimental_server (mach_msg_header_t *inp, mach_msg_header_t *outp); + extern int exec_startup_server (mach_msg_header_t *, mach_msg_header_t *); + return (exec_startup_server (inp, outp) || + exec_server (inp, outp) || ++ exec_experimental_server (inp, outp) || + trivfs_demuxer (inp, outp)); + } + diff --git a/debian/patches/exec_filename_fs.patch b/debian/patches/exec_filename_fs.patch new file mode 100644 index 00000000..a4b5589a --- /dev/null +++ b/debian/patches/exec_filename_fs.patch @@ -0,0 +1,1035 @@ +From ba528e4a9db131112aa09edfdbb3449b55618578 Mon Sep 17 00:00:00 2001 +From: Emilio Pozuelo Monfort <pochu27@gmail.com> +Date: Wed, 26 May 2010 01:27:40 +0200 +Subject: [PATCH 2/3] Add a file_exec_file_name RPC + +* hurd/fs.defs (file_exec): Deprecate in favor of... +(file_exec_file_name): ...this new RPC. +Change all implementations and forward old implementations to +the new version. Change all callers but fallback to old version. +Change comments and documentation. +--- + TODO | 2 +- + doc/hurd.texi | 16 ++++---- + exec/hashexec.c | 32 ++++++++++---- + hurd/fs.defs | 28 +++++++++++-- + hurd/hurd_types.h | 9 ++-- + init/init.c | 81 ++++++++++++++++++++++++++---------- + libdiskfs/boot-start.c | 2 +- + libdiskfs/file-exec.c | 75 ++++++++++++++++++++++++++++------ + libfshelp/start-translator-long.c | 21 +++++++--- + libnetfs/file-exec.c | 67 ++++++++++++++++++++++++++---- + libtrivfs/file-exec.c | 27 ++++++++++++- + trans/fakeroot.c | 59 ++++++++++++++++++++++++--- + utils/login.c | 23 +++++++--- + 13 files changed, 350 insertions(+), 92 deletions(-) + +Index: hurd-debian/TODO +=================================================================== +--- hurd-debian.orig/TODO 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/TODO 2013-06-19 23:32:37.000000000 +0000 +@@ -136,7 +136,7 @@ + + ** libtrivfs + *** Allow for read/write/exec to be passed down. +-*** Implement file_exec when appropriate. !! ++*** Implement file_exec_file_name when appropriate. !! + *** Provide for the visible owner, etc., to be held in command-line args + instead of the underlying node, when it's important. !! + +Index: hurd-debian/doc/hurd.texi +=================================================================== +--- hurd-debian.orig/doc/hurd.texi 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/doc/hurd.texi 2013-06-19 23:32:37.000000000 +0000 +@@ -2738,10 +2738,10 @@ + @node Program Execution + @subsection Program Execution + +-@findex file_exec ++@findex file_exec_file_name + Execution of programs on the Hurd is done through fileservers with the +-@code{file_exec} RPC. The fileserver is expected to verify that the +-user is allowed to execute the file, make whatever modifications to the ++@code{file_exec_file_name} RPC. The fileserver is expected to verify that ++the user is allowed to execute the file, make whatever modifications to the + ports are necessary for setuid execution, and then invoke the standard + execserver found on @file{/servers/exec}. + +@@ -2753,13 +2753,13 @@ + be returned. In addition, at least one of the execute bits must be on. A + failure of this check should result in @code{EACCES}---not + @code{ENOEXEC}. It is not proper for the fileserver ever to respond to +-the @code{file_exec} RPC with @code{ENOEXEC}. ++the @code{file_exec_file_name} RPC with @code{ENOEXEC}. + + If either the setuid or setgid bits are set, the server needs to + construct a new authentication handle with the additional new ID's. +-Then all the ports passed to @code{file_exec} need to be reauthenticated +-with the new handle. If the fileserver is unable to make the new +-authentication handle (for example, because it is not running as root) ++Then all the ports passed to @code{file_exec_file_name} need to be ++reauthenticated with the new handle. If the fileserver is unable to make the ++new authentication handle (for example, because it is not running as root) + it is not acceptable to return an error; in such a case the server + should simply silently fail to implement the setuid/setgid semantics. + +@@ -2774,7 +2774,7 @@ + opened with @code{O_READ}. Finally, all the information (mutated + appropriately for setuid/setgid) should be sent to the execserver with + @code{exec_exec_file_name}. Whatever error code @code{exec_exec_file_name} +-returns should be returned to the caller of @code{file_exec}. ++returns should be returned to the caller of @code{file_exec_file_name}. + + @node File Locking + @subsection File Locking +Index: hurd-debian/exec/hashexec.c +=================================================================== +--- hurd-debian.orig/exec/hashexec.c 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/exec/hashexec.c 2013-06-19 23:32:37.000000000 +0000 +@@ -24,6 +24,9 @@ + #include <unistd.h> + #include <envz.h> + #include <sys/param.h> ++#ifdef HAVE_FILE_EXEC_FILE_NAME ++#include <hurd/fs_experimental.h> ++#endif + + /* This is called to check E for a #! interpreter specification. E has + already been prepared (successfully) and checked (unsuccessfully). If +@@ -421,16 +424,32 @@ + /* We cannot open the interpreter file to execute it. Lose! */ + return; + ++#ifdef HAVE_FILE_EXEC_FILE_NAME + /* Execute the interpreter program. */ +- e->error = file_exec (interp_file, +- oldtask, flags, +- new_argv, new_argvlen, envp, envplen, +- new_dtable ?: dtable, MACH_MSG_TYPE_COPY_SEND, +- new_dtable ? new_dtablesize : dtablesize, +- portarray, MACH_MSG_TYPE_COPY_SEND, nports, +- intarray, nints, +- deallocnames, ndeallocnames, +- destroynames, ndestroynames); ++ e->error = file_exec_file_name (interp_file, ++ oldtask, flags, interp, ++ new_argv, new_argvlen, envp, envplen, ++ new_dtable ?: dtable, ++ MACH_MSG_TYPE_COPY_SEND, ++ new_dtable ? new_dtablesize : dtablesize, ++ portarray, MACH_MSG_TYPE_COPY_SEND, nports, ++ intarray, nints, ++ deallocnames, ndeallocnames, ++ destroynames, ndestroynames); ++ /* For backwards compatibility. Just drop it when we kill file_exec. */ ++ if (e->error == MIG_BAD_ID) ++#endif ++ e->error = file_exec (interp_file, ++ oldtask, flags, ++ new_argv, new_argvlen, envp, envplen, ++ new_dtable ?: dtable, MACH_MSG_TYPE_COPY_SEND, ++ new_dtable ? new_dtablesize : dtablesize, ++ portarray, MACH_MSG_TYPE_COPY_SEND, nports, ++ intarray, nints, ++ deallocnames, ndeallocnames, ++ destroynames, ndestroynames); ++ ++ + mach_port_deallocate (mach_task_self (), interp_file); + + if (! e->error) +Index: hurd-debian/hurd/fs.defs +=================================================================== +--- hurd-debian.orig/hurd/fs.defs 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/hurd/fs.defs 2013-06-19 23:32:37.000000000 +0000 +@@ -1,5 +1,6 @@ + /* Definitions for the filesystem interface. +- Copyright (C) 1994,95,96,97,98,99,2002 Free Software Foundation, Inc. ++ Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2002, 2010 ++ Free Software Foundation, Inc. + + This file is part of the GNU Hurd. + +@@ -35,7 +36,8 @@ + /* Overlay a task with a file. Necessary initialization, including + authentication changes associated with set[ug]id execution must be + handled by the filesystem. Filesystems normally implement this by +- using exec_newtask or exec_loadtask as appropriate. */ ++ using exec_newtask or exec_loadtask as appropriate. ++ Deprecated: use file_exec_file_name instead. */ + routine file_exec ( + exec_file: file_t; + RPT +@@ -129,8 +131,8 @@ + (regardless of the current open modes for this port). ALLOWED is a + bitwise OR of O_READ, O_WRITE, and O_EXEC. This is not necessarily the + same as what an open or exec would allow; O_EXEC is set for root even if +- no executable bits are on (in which case file_exec should fail) and +- O_WRITE is set a directory can be modified, even though it can't be ++ no executable bits are on (in which case file_exec_file_name should fail) ++ and O_WRITE is set a directory can be modified, even though it can't be + written directly. */ + routine file_check_access ( + file: file_t; +Index: hurd-debian/hurd/hurd_types.h +=================================================================== +--- hurd-debian.orig/hurd/hurd_types.h 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/hurd/hurd_types.h 2013-06-19 23:32:37.000000000 +0000 +@@ -1,5 +1,6 @@ + /* C declarations for Hurd server interfaces +- Copyright (C) 1993,94,95,96,98,99,2001,02 Free Software Foundation, Inc. ++ Copyright (C) 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, ++ 2010 Free Software Foundation, Inc. + + This file is part of the GNU Hurd. + +@@ -78,7 +79,7 @@ + /* Many such parameters and flags are also defined in various libc + headers. */ + +-/* Bits for flags in fs.defs:file_exec and exec.defs:exec_* calls: */ ++/* Bits for flags in fs.defs:file_exec_file_name and exec.defs:exec_* calls: */ + #define EXEC_NEWTASK 0x00000001 /* Create new task; kill old one. */ + #define EXEC_SECURE 0x00000002 /* Use secure values of portarray, etc. */ + #define EXEC_DEFAULTS 0x00000004 /* Use defaults for unspecified ports. */ +@@ -344,7 +345,7 @@ + #define FSTYPE_MEMFS 0x00000019 /* In-core filesystem */ + #define FSTYPE_ISO9660 0x0000001a /* ISO9660 */ + +-/* Standard port assignments for file_exec and exec_* */ ++/* Standard port assignments for file_exec_file_name and exec_* */ + enum + { + INIT_PORT_CWDIR, +@@ -358,7 +359,7 @@ + INIT_PORT_MAX + }; + +-/* Standard ints for file_exec and exec_* */ ++/* Standard ints for file_exec_file_name and exec_* */ + enum + { + INIT_UMASK, +Index: hurd-debian/init/init.c +=================================================================== +--- hurd-debian.orig/init/init.c 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/init/init.c 2013-06-19 23:32:37.000000000 +0000 +@@ -1,7 +1,7 @@ + /* Start and maintain hurd core servers and system run state + + Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +- 2005, 2008 Free Software Foundation, Inc. ++ 2005, 2008, 2010 Free Software Foundation, Inc. + This file is part of the GNU Hurd. + + The GNU Hurd is free software; you can redistribute it and/or modify +@@ -24,6 +24,9 @@ + one file. */ + #include <hurd.h> + #include <hurd/fs.h> ++#ifdef HAVE_FILE_EXEC_FILE_NAME ++#include <hurd/fs_experimental.h> ++#endif + #include <hurd/fsys.h> + #include <device/device.h> + #include <stdio.h> +@@ -375,13 +378,28 @@ + printf ("Pausing for %s\n", prog); + getchar (); + } +- err = file_exec (file, *task, 0, +- (char *)prog, strlen (prog) + 1, /* Args. */ +- startup_envz, startup_envz_len, +- default_dtable, MACH_MSG_TYPE_COPY_SEND, 3, +- ports, MACH_MSG_TYPE_COPY_SEND, INIT_PORT_MAX, +- default_ints, INIT_INT_MAX, +- NULL, 0, NULL, 0); ++#ifdef HAVE_FILE_EXEC_FILE_NAME ++ err = file_exec_file_name (file, *task, 0, (char *)prog, ++ (char *)prog, ++ strlen (prog) + 1, /* Args. */ ++ startup_envz, startup_envz_len, ++ default_dtable, ++ MACH_MSG_TYPE_COPY_SEND, 3, ++ ports, MACH_MSG_TYPE_COPY_SEND, ++ INIT_PORT_MAX, ++ default_ints, INIT_INT_MAX, ++ NULL, 0, NULL, 0); ++ /* For backwards compatibility. Just drop it when we kill ++ file_exec. */ ++ if (err == MIG_BAD_ID) ++#endif ++ err = file_exec (file, *task, 0, ++ (char *)prog, strlen (prog) + 1, /* Args. */ ++ startup_envz, startup_envz_len, ++ default_dtable, MACH_MSG_TYPE_COPY_SEND, 3, ++ ports, MACH_MSG_TYPE_COPY_SEND, INIT_PORT_MAX, ++ default_ints, INIT_INT_MAX, ++ NULL, 0, NULL, 0); + if (!err) + break; + +@@ -468,14 +486,27 @@ + ++progname; + else + progname = filename; +- err = file_exec (file, task, 0, +- args, arglen, +- startup_envz, startup_envz_len, +- default_dtable, MACH_MSG_TYPE_COPY_SEND, 3, +- default_ports, MACH_MSG_TYPE_COPY_SEND, +- INIT_PORT_MAX, +- default_ints, INIT_INT_MAX, +- NULL, 0, NULL, 0); ++#ifdef HAVE_FILE_EXEC_FILE_NAME ++ err = file_exec_file_name (file, task, 0, filename, ++ args, arglen, ++ startup_envz, startup_envz_len, ++ default_dtable, MACH_MSG_TYPE_COPY_SEND, 3, ++ default_ports, MACH_MSG_TYPE_COPY_SEND, ++ INIT_PORT_MAX, ++ default_ints, INIT_INT_MAX, ++ NULL, 0, NULL, 0); ++ /* For backwards compatibility. Just drop it when we kill file_exec. */ ++ if (err == MIG_BAD_ID) ++#endif ++ err = file_exec (file, task, 0, ++ args, arglen, ++ startup_envz, startup_envz_len, ++ default_dtable, MACH_MSG_TYPE_COPY_SEND, 3, ++ default_ports, MACH_MSG_TYPE_COPY_SEND, ++ INIT_PORT_MAX, ++ default_ints, INIT_INT_MAX, ++ NULL, 0, NULL, 0); ++ + mach_port_deallocate (mach_task_self (), default_ports[INIT_PORT_PROC]); + mach_port_deallocate (mach_task_self (), task); + if (ctty != MACH_PORT_NULL) +@@ -1059,13 +1090,26 @@ + getchar (); + } + +- err = file_exec (file, child_task, 0, +- args, arglen, +- startup_envz, startup_envz_len, +- NULL, MACH_MSG_TYPE_COPY_SEND, 0, /* No fds. */ +- default_ports, MACH_MSG_TYPE_COPY_SEND, INIT_PORT_MAX, +- default_ints, INIT_INT_MAX, +- NULL, 0, NULL, 0); ++#ifdef HAVE_FILE_EXEC_FILE_NAME ++ err = file_exec_file_name (file, child_task, 0, args, ++ args, arglen, ++ startup_envz, startup_envz_len, ++ NULL, MACH_MSG_TYPE_COPY_SEND, 0, /* No fds. */ ++ default_ports, MACH_MSG_TYPE_COPY_SEND, ++ INIT_PORT_MAX, ++ default_ints, INIT_INT_MAX, ++ NULL, 0, NULL, 0); ++ /* For backwards compatibility. Just drop it when we kill file_exec. */ ++ if (err == MIG_BAD_ID) ++#endif ++ err = file_exec (file, child_task, 0, ++ args, arglen, ++ startup_envz, startup_envz_len, ++ NULL, MACH_MSG_TYPE_COPY_SEND, 0, /* No fds. */ ++ default_ports, MACH_MSG_TYPE_COPY_SEND, INIT_PORT_MAX, ++ default_ints, INIT_INT_MAX, ++ NULL, 0, NULL, 0); ++ + mach_port_deallocate (mach_task_self (), default_ports[INIT_PORT_PROC]); + mach_port_deallocate (mach_task_self (), file); + if (err) +Index: hurd-debian/libdiskfs/boot-start.c +=================================================================== +--- hurd-debian.orig/libdiskfs/boot-start.c 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/libdiskfs/boot-start.c 2013-06-19 23:32:37.000000000 +0000 +@@ -207,7 +207,7 @@ + diskfs_exec_ctl = MACH_PORT_NULL; /* Not used after this. */ + } + +- /* Cache the exec server port for file_exec to use. */ ++ /* Cache the exec server port for file_exec_file_name to use. */ + _hurd_port_set (&_diskfs_exec_portcell, diskfs_exec); + + if (_diskfs_boot_command) +Index: hurd-debian/libdiskfs/file-exec.c +=================================================================== +--- hurd-debian.orig/libdiskfs/file-exec.c 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/libdiskfs/file-exec.c 2013-06-19 23:32:37.000000000 +0000 +@@ -1,5 +1,6 @@ +-/* File execution (file_exec RPC) for diskfs servers, using exec server. +- Copyright (C) 1993,94,95,96,97,98,2000,02 Free Software Foundation, Inc. ++/* File execution (file_exec_file_name RPC) for diskfs servers, using exec server. ++ Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2002, ++ 2010 Free Software Foundation, Inc. + + This file is part of the GNU Hurd. + +@@ -21,10 +22,14 @@ + + #include "priv.h" + #include "fs_S.h" ++#include "fs_experimental_S.h" + #include <sys/stat.h> + #include <fcntl.h> + #include <hurd/exec.h> + #include <hurd/paths.h> ++#ifdef HAVE_EXEC_EXEC_FILE_NAME ++#include <hurd/exec_experimental.h> ++#endif + #include <string.h> + #include <idvec.h> + +@@ -47,6 +52,39 @@ + mach_port_t *destroynames, + size_t destroynameslen) + { ++ return diskfs_S_file_exec_file_name (cred, ++ task, ++ flags, ++ "", ++ argv, argvlen, ++ envp, envplen, ++ fds, fdslen, ++ portarray, portarraylen, ++ intarray, intarraylen, ++ deallocnames, deallocnameslen, ++ destroynames, destroynameslen); ++} ++ ++kern_return_t ++diskfs_S_file_exec_file_name (struct protid *cred, ++ task_t task, ++ int flags, ++ char *filename, ++ char *argv, ++ size_t argvlen, ++ char *envp, ++ size_t envplen, ++ mach_port_t *fds, ++ size_t fdslen, ++ mach_port_t *portarray, ++ size_t portarraylen, ++ int *intarray, ++ size_t intarraylen, ++ mach_port_t *deallocnames, ++ size_t deallocnameslen, ++ mach_port_t *destroynames, ++ size_t destroynameslen) ++{ + struct node *np; + uid_t uid; + gid_t gid; +@@ -136,9 +174,9 @@ + + if (! err) + /* Make a new peropen for the exec server to access the file, since any +- seeking the exec server might want to do should not affect the +- original peropen on which file_exec was called. (The new protid for +- this peropen clones the caller's iouser to preserve the caller's ++ seeking the exec server might want to do should not affect the original ++ peropen on which file_exec_file_name was called. (The new protid ++ for this peropen clones the caller's iouser to preserve the caller's + authentication credentials.) The new peropen's openmodes must have + O_READ even if the caller had only O_EXEC privilege, so the exec + server can read the executable file. We also include O_EXEC so that +@@ -159,14 +197,31 @@ + do + { + right = ports_get_send_right (newpi); +- err = exec_exec (execserver, +- right, MACH_MSG_TYPE_COPY_SEND, +- task, flags, argv, argvlen, envp, envplen, +- fds, MACH_MSG_TYPE_COPY_SEND, fdslen, +- portarray, MACH_MSG_TYPE_COPY_SEND, portarraylen, +- intarray, intarraylen, +- deallocnames, deallocnameslen, +- destroynames, destroynameslen); ++#ifdef HAVE_EXEC_EXEC_FILE_NAME ++ err = exec_exec_file_name (execserver, ++ right, MACH_MSG_TYPE_COPY_SEND, ++ task, flags, filename, ++ argv, argvlen, envp, envplen, ++ fds, MACH_MSG_TYPE_COPY_SEND, fdslen, ++ portarray, MACH_MSG_TYPE_COPY_SEND, ++ portarraylen, ++ intarray, intarraylen, ++ deallocnames, deallocnameslen, ++ destroynames, destroynameslen); ++ /* For backwards compatibility. Just drop it when we kill ++ exec_exec. */ ++ if (err == MIG_BAD_ID) ++#endif ++ err = exec_exec (execserver, ++ right, MACH_MSG_TYPE_COPY_SEND, ++ task, flags, argv, argvlen, envp, envplen, ++ fds, MACH_MSG_TYPE_COPY_SEND, fdslen, ++ portarray, MACH_MSG_TYPE_COPY_SEND, portarraylen, ++ intarray, intarraylen, ++ deallocnames, deallocnameslen, ++ destroynames, destroynameslen); ++ ++ + mach_port_deallocate (mach_task_self (), right); + if (err == MACH_SEND_INVALID_DEST) + { +Index: hurd-debian/libfshelp/start-translator-long.c +=================================================================== +--- hurd-debian.orig/libfshelp/start-translator-long.c 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/libfshelp/start-translator-long.c 2013-06-19 23:32:37.000000000 +0000 +@@ -1,5 +1,6 @@ + /* +- Copyright (C) 1995,96,99,2000,02, 04 Free Software Foundation, Inc. ++ Copyright (C) 1995, 1996, 1999, 2000, 2002, 2004, 2010 ++ Free Software Foundation, Inc. + Written by Miles Bader and Michael I. Bushnell. + + This file is part of the GNU Hurd. +@@ -27,6 +28,9 @@ + #include <string.h> + #include <assert.h> + #include "fshelp.h" ++#ifdef HAVE_FILE_EXEC_FILE_NAME ++#include <hurd/fs_experimental.h> ++#endif + + + /* The data passed in the various messages we're interested in. */ +@@ -272,12 +276,22 @@ + saveport = ports[INIT_PORT_BOOTSTRAP]; + ports[INIT_PORT_BOOTSTRAP] = bootstrap; + ++#ifdef HAVE_FILE_EXEC_FILE_NAME + /* Try and exec the translator in TASK... */ +- err = file_exec (executable, task, EXEC_DEFAULTS, +- argz, argz_len, 0, 0, +- fds, fds_type, fds_len, +- ports, ports_type, ports_len, +- ints, ints_len, 0, 0, 0, 0); ++ err = file_exec_file_name (executable, task, EXEC_DEFAULTS, name, ++ argz, argz_len, 0, 0, ++ fds, fds_type, fds_len, ++ ports, ports_type, ports_len, ++ ints, ints_len, 0, 0, 0, 0); ++ /* For backwards compatibility. Just drop it when we kill file_exec. */ ++ if (err == MIG_BAD_ID) ++#endif ++ err = file_exec (executable, task, EXEC_DEFAULTS, ++ argz, argz_len, 0, 0, ++ fds, fds_type, fds_len, ++ ports, ports_type, ports_len, ++ ints, ints_len, 0, 0, 0, 0); ++ + ports_moved = 1; + + if (ports_type == MACH_MSG_TYPE_COPY_SEND) +Index: hurd-debian/libnetfs/file-exec.c +=================================================================== +--- hurd-debian.orig/libnetfs/file-exec.c 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/libnetfs/file-exec.c 2013-06-19 23:32:37.000000000 +0000 +@@ -1,5 +1,6 @@ + /* +- Copyright (C) 1996,97,2000,01,02 Free Software Foundation, Inc. ++ Copyright (C) 1996, 1997, 2000, 2001, 2002, 2010 ++ Free Software Foundation, Inc. + Written by Michael I. Bushnell, p/BSG. + + This file is part of the GNU Hurd. +@@ -23,10 +24,14 @@ + #include "netfs.h" + #include "execserver.h" + #include "fs_S.h" ++#include "fs_experimental_S.h" + #include <sys/stat.h> + #include <fcntl.h> + #include <hurd/exec.h> + #include <hurd/paths.h> ++#ifdef HAVE_EXEC_EXEC_FILE_NAME ++#include <hurd/exec_experimental.h> ++#endif + #include <string.h> + #include <idvec.h> + +@@ -49,6 +54,39 @@ + mach_port_t *destroynames, + size_t destroynameslen) + { ++ return netfs_S_file_exec_file_name (cred, ++ task, ++ flags, ++ "", ++ argv, argvlen, ++ envp, envplen, ++ fds, fdslen, ++ portarray, portarraylen, ++ intarray, intarraylen, ++ deallocnames, deallocnameslen, ++ destroynames, destroynameslen); ++} ++ ++kern_return_t ++netfs_S_file_exec_file_name (struct protid *cred, ++ task_t task, ++ int flags, ++ char *filename, ++ char *argv, ++ size_t argvlen, ++ char *envp, ++ size_t envplen, ++ mach_port_t *fds, ++ size_t fdslen, ++ mach_port_t *portarray, ++ size_t portarraylen, ++ int *intarray, ++ size_t intarraylen, ++ mach_port_t *deallocnames, ++ size_t deallocnameslen, ++ mach_port_t *destroynames, ++ size_t destroynameslen) ++{ + struct node *np; + error_t err; + uid_t uid; +@@ -133,14 +171,31 @@ + if (newpi) + { + right = ports_get_send_right (newpi); +- err = exec_exec (_netfs_exec, +- right, MACH_MSG_TYPE_COPY_SEND, +- task, flags, argv, argvlen, envp, envplen, +- fds, MACH_MSG_TYPE_COPY_SEND, fdslen, +- portarray, MACH_MSG_TYPE_COPY_SEND, portarraylen, +- intarray, intarraylen, +- deallocnames, deallocnameslen, +- destroynames, destroynameslen); ++#ifdef HAVE_EXEC_EXEC_FILE_NAME ++ err = exec_exec_file_name (_netfs_exec, ++ right, MACH_MSG_TYPE_COPY_SEND, ++ task, flags, filename, ++ argv, argvlen, envp, envplen, ++ fds, MACH_MSG_TYPE_COPY_SEND, fdslen, ++ portarray, MACH_MSG_TYPE_COPY_SEND, ++ portarraylen, ++ intarray, intarraylen, ++ deallocnames, deallocnameslen, ++ destroynames, destroynameslen); ++ /* For backwards compatibility. Just drop it when we kill ++ exec_exec. */ ++ if (err == MIG_BAD_ID) ++#endif ++ err = exec_exec (_netfs_exec, ++ right, MACH_MSG_TYPE_COPY_SEND, ++ task, flags, argv, argvlen, envp, envplen, ++ fds, MACH_MSG_TYPE_COPY_SEND, fdslen, ++ portarray, MACH_MSG_TYPE_COPY_SEND, ++ portarraylen, ++ intarray, intarraylen, ++ deallocnames, deallocnameslen, ++ destroynames, destroynameslen); ++ + mach_port_deallocate (mach_task_self (), right); + ports_port_deref (newpi); + } +Index: hurd-debian/libtrivfs/file-exec.c +=================================================================== +--- hurd-debian.orig/libtrivfs/file-exec.c 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/libtrivfs/file-exec.c 2013-06-19 23:32:37.000000000 +0000 +@@ -1,5 +1,5 @@ + /* +- Copyright (C) 1994,2002 Free Software Foundation, Inc. ++ Copyright (C) 1994, 2002, 2010 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as +@@ -40,3 +40,28 @@ + { + return EOPNOTSUPP; + } ++ ++kern_return_t ++trivfs_S_file_exec_file_name (trivfs_protid_t exec_file, ++ mach_port_t reply, ++ mach_msg_type_name_t replyPoly, ++ mach_port_t exec_task, ++ int flags, ++ string_t filename, ++ data_t argv, ++ mach_msg_type_number_t argvCnt, ++ data_t envp, ++ mach_msg_type_number_t envpCnt, ++ portarray_t fdarray, ++ mach_msg_type_number_t fdarrayCnt, ++ portarray_t portarray, ++ mach_msg_type_number_t portarrayCnt, ++ intarray_t intarray, ++ mach_msg_type_number_t intarrayCnt, ++ mach_port_array_t deallocnames, ++ mach_msg_type_number_t deallocnamesCnt, ++ mach_port_array_t destroynames, ++ mach_msg_type_number_t destroynamesCnt) ++{ ++ return EOPNOTSUPP; ++} +Index: hurd-debian/trans/fakeroot.c +=================================================================== +--- hurd-debian.orig/trans/fakeroot.c 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/trans/fakeroot.c 2013-06-19 23:32:37.000000000 +0000 +@@ -1,5 +1,5 @@ + /* fakeroot -- a translator for faking actions that aren't really permitted +- Copyright (C) 2002, 2003, 2008 Free Software Foundation, Inc. ++ Copyright (C) 2002, 2003, 2008, 2010 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as +@@ -28,6 +28,9 @@ + #include <pthread.h> + #include <hurd/ihash.h> + #include <hurd/paths.h> ++#ifdef HAVE_FILE_EXEC_FILE_NAME ++#include <hurd/fs_experimental.h> ++#endif + + #include <version.h> + +@@ -705,6 +708,39 @@ + mach_port_t *destroynames, + size_t destroynameslen) + { ++ return netfs_S_file_exec_file_name (user, ++ task, ++ flags, ++ "", ++ argv, argvlen, ++ envp, envplen, ++ fds, fdslen, ++ portarray, portarraylen, ++ intarray, intarraylen, ++ deallocnames, deallocnameslen, ++ destroynames, destroynameslen); ++} ++ ++kern_return_t ++netfs_S_file_exec_file_name (struct protid *user, ++ task_t task, ++ int flags, ++ char *filename, ++ char *argv, ++ size_t argvlen, ++ char *envp, ++ size_t envplen, ++ mach_port_t *fds, ++ size_t fdslen, ++ mach_port_t *portarray, ++ size_t portarraylen, ++ int *intarray, ++ size_t intarraylen, ++ mach_port_t *deallocnames, ++ size_t deallocnameslen, ++ mach_port_t *destroynames, ++ size_t destroynameslen) ++{ + error_t err; + file_t file; + +@@ -721,13 +757,29 @@ + + if (!err) + { ++#ifdef HAVE_FILE_EXEC_FILE_NAME + /* We cannot use MACH_MSG_TYPE_MOVE_SEND because we might need to + retry an interrupted call that would have consumed the rights. */ +- err = file_exec (user->po->np->nn->file, task, flags, argv, argvlen, +- envp, envplen, fds, MACH_MSG_TYPE_COPY_SEND, fdslen, +- portarray, MACH_MSG_TYPE_COPY_SEND, portarraylen, +- intarray, intarraylen, deallocnames, deallocnameslen, +- destroynames, destroynameslen); ++ err = file_exec_file_name (user->po->np->nn->file, task, flags, ++ filename, ++ argv, argvlen, ++ envp, envplen, ++ fds, MACH_MSG_TYPE_COPY_SEND, fdslen, ++ portarray, MACH_MSG_TYPE_COPY_SEND, ++ portarraylen, ++ intarray, intarraylen, ++ deallocnames, deallocnameslen, ++ destroynames, destroynameslen); ++ /* For backwards compatibility. Just drop it when we kill ++ file_exec. */ ++ if (err == MIG_BAD_ID) ++#endif ++ err = file_exec (user->po->np->nn->file, task, flags, argv, argvlen, ++ envp, envplen, fds, MACH_MSG_TYPE_COPY_SEND, fdslen, ++ portarray, MACH_MSG_TYPE_COPY_SEND, portarraylen, ++ intarray, intarraylen, deallocnames, deallocnameslen, ++ destroynames, destroynameslen); ++ + mach_port_deallocate (mach_task_self (), file); + } + +@@ -835,12 +887,14 @@ + mach_msg_header_t *outp) + { + int netfs_fs_server (mach_msg_header_t *, mach_msg_header_t *); ++ int netfs_fs_experimental_server (mach_msg_header_t *, mach_msg_header_t *); + int netfs_io_server (mach_msg_header_t *, mach_msg_header_t *); + int netfs_fsys_server (mach_msg_header_t *, mach_msg_header_t *); + int netfs_ifsock_server (mach_msg_header_t *, mach_msg_header_t *); + + if (netfs_io_server (inp, outp) + || netfs_fs_server (inp, outp) ++ || netfs_fs_experimental_server (inp, outp) + || ports_notify_server (inp, outp) + || netfs_fsys_server (inp, outp) + /* XXX we should intercept interrupt_operation and do +Index: hurd-debian/utils/login.c +=================================================================== +--- hurd-debian.orig/utils/login.c 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/utils/login.c 2013-06-19 23:32:37.000000000 +0000 +@@ -1,6 +1,7 @@ + /* Hurdish login + +- Copyright (C) 1995,96,97,98,99,2002 Free Software Foundation, Inc. ++ Copyright (C) 1995, 1996, 1997, 1998, 1999, 2002, 2010 ++ Free Software Foundation, Inc. + + Written by Miles Bader <miles@gnu.org> + +@@ -46,6 +47,9 @@ + #include <error.h> + #include <timefmt.h> + #include <hurd/lookup.h> ++#ifdef HAVE_FILE_EXEC_FILE_NAME ++#include <hurd/fs_experimental.h> ++#endif + #include <ugids.h> + + const char *argp_program_version = STANDARD_HURD_VERSION (login); +@@ -882,12 +886,22 @@ + } + } + +- err = file_exec (exec, mach_task_self (), EXEC_DEFAULTS, +- sh_args, sh_args_len, env, env_len, +- fds, MACH_MSG_TYPE_COPY_SEND, 3, +- ports, MACH_MSG_TYPE_COPY_SEND, INIT_PORT_MAX, +- ints, INIT_INT_MAX, +- 0, 0, 0, 0); ++#ifdef HAVE_FILE_EXEC_FILE_NAME ++ err = file_exec_file_name (exec, mach_task_self (), EXEC_DEFAULTS, shell, ++ sh_args, sh_args_len, env, env_len, ++ fds, MACH_MSG_TYPE_COPY_SEND, 3, ++ ports, MACH_MSG_TYPE_COPY_SEND, INIT_PORT_MAX, ++ ints, INIT_INT_MAX, ++ 0, 0, 0, 0); ++ /* Fallback in case the file server hasn't been restarted. */ ++ if (err == MIG_BAD_ID) ++#endif ++ err = file_exec (exec, mach_task_self (), EXEC_DEFAULTS, ++ sh_args, sh_args_len, env, env_len, ++ fds, MACH_MSG_TYPE_COPY_SEND, 3, ++ ports, MACH_MSG_TYPE_COPY_SEND, INIT_PORT_MAX, ++ ints, INIT_INT_MAX, ++ 0, 0, 0, 0); + if (err) + error(5, err, "%s", shell); + +Index: hurd-debian/hurd/fs_experimental.defs +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ hurd-debian/hurd/fs_experimental.defs 2013-06-19 23:32:37.000000000 +0000 +@@ -0,0 +1,51 @@ ++/* Definitions for the filesystem interface. ++ Copyright (C) 1994,95,96,97,98,99,2002 Free Software Foundation, Inc. ++ ++This file is part of the GNU Hurd. ++ ++The GNU Hurd 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. ++ ++The GNU Hurd 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 the GNU Hurd; see the file COPYING. If not, write to ++the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ ++ ++ ++/* All these objects also implement the generic IO facilities. */ ++ ++subsystem fs_experimental 444242; ++ ++#include <hurd/hurd_types.defs> ++ ++#ifdef FILE_IMPORTS ++FILE_IMPORTS ++#endif ++ ++/* Operations supported on all files */ ++ ++INTR_INTERFACE ++ ++/* Overlay a task with a file. Necessary initialization, including ++ authentication changes associated with set[ug]id execution must be ++ handled by the filesystem. Filesystems normally implement this by ++ using exec_newtask or exec_loadtask as appropriate. */ ++routine file_exec_file_name ( ++ exec_file: file_t; ++ RPT ++ exec_task: task_t; ++ flags: int; ++ filename: string_t; ++ argv: data_t SCP; ++ envp: data_t SCP; ++ fdarray: portarray_t SCP; ++ portarray: portarray_t SCP; ++ intarray: intarray_t SCP; ++ deallocnames: mach_port_name_array_t SCP; ++ destroynames: mach_port_name_array_t SCP); +Index: hurd-debian/libdiskfs/Makefile +=================================================================== +--- hurd-debian.orig/libdiskfs/Makefile 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/libdiskfs/Makefile 2013-06-19 23:32:37.000000000 +0000 +@@ -55,7 +55,7 @@ + SRCS = $(OTHERSRCS) $(FSSRCS) $(IOSRCS) $(FSYSSRCS) $(IFSOCKSRCS) + installhdrs = diskfs.h diskfs-pager.h + +-MIGSTUBS = fsServer.o ioServer.o fsysServer.o exec_startupServer.o \ ++MIGSTUBS = fsServer.o fs_experimentalServer.o ioServer.o fsysServer.o exec_startupServer.o \ + fsys_replyUser.o fs_notifyUser.o ifsockServer.o \ + startup_notifyServer.o + OBJS = $(sort $(SRCS:.c=.o) $(MIGSTUBS)) +@@ -65,6 +65,7 @@ + + fsys-MIGSFLAGS = -imacros $(srcdir)/fsmutations.h -DREPLY_PORTS + fs-MIGSFLAGS = -imacros $(srcdir)/fsmutations.h ++fs_experimental-MIGSFLAGS = -imacros $(srcdir)/fsmutations.h + io-MIGSFLAGS = -imacros $(srcdir)/fsmutations.h + ifsock-MIGSFLAGS = -imacros $(srcdir)/fsmutations.h + MIGCOMSFLAGS = -prefix diskfs_ +Index: hurd-debian/libdiskfs/demuxer.c +=================================================================== +--- hurd-debian.orig/libdiskfs/demuxer.c 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/libdiskfs/demuxer.c 2013-06-19 23:32:37.000000000 +0000 +@@ -22,6 +22,7 @@ + mach_msg_header_t *outp) + { + int diskfs_fs_server (mach_msg_header_t *, mach_msg_header_t *); ++ int diskfs_fs_experimental_server (mach_msg_header_t *, mach_msg_header_t *); + int diskfs_io_server (mach_msg_header_t *, mach_msg_header_t *); + int diskfs_fsys_server (mach_msg_header_t *, mach_msg_header_t *); + int diskfs_exec_startup_server (mach_msg_header_t *, mach_msg_header_t *); +@@ -31,6 +32,7 @@ + + return (diskfs_io_server (inp, outp) + || diskfs_fs_server (inp, outp) ++ || diskfs_fs_experimental_server (inp, outp) + || ports_notify_server (inp, outp) + || diskfs_fsys_server (inp, outp) + || diskfs_exec_startup_server (inp, outp) +Index: hurd-debian/libnetfs/Makefile +=================================================================== +--- hurd-debian.orig/libnetfs/Makefile 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/libnetfs/Makefile 2013-06-19 23:32:37.000000000 +0000 +@@ -58,12 +58,13 @@ + + installhdrs=netfs.h + +-MIGSTUBS= ioServer.o fsServer.o fsysServer.o fsys_replyUser.o ifsockServer.o ++MIGSTUBS= ioServer.o fsServer.o fs_experimentalServer.o fsysServer.o fsys_replyUser.o ifsockServer.o + + OBJS=$(sort $(SRCS:.c=.o) $(MIGSTUBS)) + + fsys-MIGSFLAGS = -imacros $(srcdir)/mutations.h -DREPLY_PORTS + fs-MIGSFLAGS = -imacros $(srcdir)/mutations.h ++fs_experimental-MIGSFLAGS = -imacros $(srcdir)/mutations.h + io-MIGSFLAGS = -imacros $(srcdir)/mutations.h + ifsock-MIGSFLAGS = -imacros $(srcdir)/mutations.h + MIGCOMSFLAGS = -prefix netfs_ +Index: hurd-debian/libnetfs/demuxer.c +=================================================================== +--- hurd-debian.orig/libnetfs/demuxer.c 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/libnetfs/demuxer.c 2013-06-19 23:32:37.000000000 +0000 +@@ -25,12 +25,14 @@ + mach_msg_header_t *outp) + { + int netfs_fs_server (mach_msg_header_t *, mach_msg_header_t *); ++ int netfs_fs_experimental_server (mach_msg_header_t *, mach_msg_header_t *); + int netfs_io_server (mach_msg_header_t *, mach_msg_header_t *); + int netfs_fsys_server (mach_msg_header_t *, mach_msg_header_t *); + int netfs_ifsock_server (mach_msg_header_t *, mach_msg_header_t *); + + return (netfs_io_server (inp, outp) + || netfs_fs_server (inp, outp) ++ || netfs_fs_experimental_server (inp, outp) + || ports_notify_server (inp, outp) + || netfs_fsys_server (inp, outp) + || ports_interrupt_server (inp, outp) +Index: hurd-debian/libtrivfs/Makefile +=================================================================== +--- hurd-debian.orig/libtrivfs/Makefile 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/libtrivfs/Makefile 2013-06-19 23:32:37.000000000 +0000 +@@ -43,7 +43,7 @@ + + SRCS=$(FSSRCS) $(IOSRCS) $(FSYSSRCS) $(OTHERSRCS) + +-MIGSTUBS=fsServer.o ioServer.o fsysServer.o fsys_replyUser.o ++MIGSTUBS=fsServer.o fs_experimentalServer.o ioServer.o fsysServer.o fsys_replyUser.o + + libname = libtrivfs + HURDLIBS = fshelp iohelp ports shouldbeinlibc +@@ -53,7 +53,7 @@ + installhdrs := trivfs.h + mig-sheader-prefix = trivfs_ + ifndef no_deps +-installhdrs += $(patsubst %,trivfs_%_S.h,fs io fsys) ++installhdrs += $(patsubst %,trivfs_%_S.h,fs fs_experimental io fsys) + endif + + include ../Makeconf +Index: hurd-debian/libtrivfs/demuxer.c +=================================================================== +--- hurd-debian.orig/libtrivfs/demuxer.c 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/libtrivfs/demuxer.c 2013-06-19 23:32:37.000000000 +0000 +@@ -26,11 +26,13 @@ + mach_msg_header_t *outp) + { + int trivfs_fs_server (mach_msg_header_t *, mach_msg_header_t *); ++ int trivfs_fs_experimental_server (mach_msg_header_t *, mach_msg_header_t *); + int trivfs_io_server (mach_msg_header_t *, mach_msg_header_t *); + int trivfs_fsys_server (mach_msg_header_t *, mach_msg_header_t *); + + return (trivfs_io_server (inp, outp) + || trivfs_fs_server (inp, outp) ++ || trivfs_fs_experimental_server (inp, outp) + || ports_notify_server (inp, outp) + || trivfs_fsys_server (inp, outp) + || ports_interrupt_server (inp, outp)); +Index: hurd-debian/configure.ac +=================================================================== +--- hurd-debian.orig/configure.ac 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/configure.ac 2013-06-19 23:32:37.000000000 +0000 +@@ -162,7 +162,7 @@ + AC_SUBST(VERSIONING) + + # Check if libc contains getgrouplist and/or uselocale. +-AC_CHECK_FUNCS(getgrouplist uselocale) ++AC_CHECK_FUNCS(getgrouplist uselocale file_exec_file_name exec_exec_file_name) + + + # From glibc HEAD, 2007-11-07. +Index: hurd-debian/libtrivfs/trivfs.h +=================================================================== +--- hurd-debian.orig/libtrivfs/trivfs.h 2013-06-19 23:32:37.000000000 +0000 ++++ hurd-debian/libtrivfs/trivfs.h 2013-06-19 23:32:37.000000000 +0000 +@@ -293,6 +293,7 @@ + /* These are the MiG-generated headers that declare prototypes + for the server functions. */ + #include <hurd/trivfs_fs_S.h> ++#include <hurd/trivfs_fs_experimental_S.h> + #include <hurd/trivfs_io_S.h> + #include <hurd/trivfs_fsys_S.h> + diff --git a/debian/patches/exec_filename_use.patch b/debian/patches/exec_filename_use.patch new file mode 100644 index 00000000..c806aea2 --- /dev/null +++ b/debian/patches/exec_filename_use.patch @@ -0,0 +1,113 @@ +From bbce8439190738efc9260490fa52f9dfe9600306 Mon Sep 17 00:00:00 2001 +From: Emilio Pozuelo Monfort <pochu27@gmail.com> +Date: Wed, 26 May 2010 23:32:16 +0200 +Subject: [PATCH 3/3] Use the new _hurd_exec_file_name function + +* configure.in: Check for _hurd_exec_file_name. +* utils/fakeauth.c: Call _hurd_exec_file_name instead of +_hurd_exec if it's available. +* utils/rpctrace.c: Likewise. +* utils/shd.c: Likewise. +--- + configure.in | 4 ++-- + utils/fakeauth.c | 9 +++++++-- + utils/rpctrace.c | 6 +++++- + utils/shd.c | 9 ++++++--- + 4 files changed, 20 insertions(+), 8 deletions(-) + +Index: hurd-debian/configure.ac +=================================================================== +--- hurd-debian.orig/configure.ac 2012-06-05 00:38:18.000000000 +0000 ++++ hurd-debian/configure.ac 2012-06-05 00:38:18.000000000 +0000 +@@ -160,8 +160,8 @@ + fi + AC_SUBST(VERSIONING) + +-# Check if libc contains getgrouplist and/or uselocale. +-AC_CHECK_FUNCS(getgrouplist uselocale file_exec_file_name exec_exec_file_name) ++# Check if libc contains these functions. ++AC_CHECK_FUNCS(getgrouplist uselocale file_exec_file_name exec_exec_file_name _hurd_exec_file_name) + + + # From glibc HEAD, 2007-11-07. +Index: hurd-debian/utils/fakeauth.c +=================================================================== +--- hurd-debian.orig/utils/fakeauth.c 2012-06-05 00:35:35.000000000 +0000 ++++ hurd-debian/utils/fakeauth.c 2012-06-05 01:48:00.000000000 +0000 +@@ -1,5 +1,5 @@ + /* fakeauth -- proxy auth server to lie to users about what their IDs are +- Copyright (C) 2002 Free Software Foundation, Inc. ++ Copyright (C) 2002, 2010 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as +@@ -388,7 +388,7 @@ + /* We cannot use fork because it doesn't do the right thing with our send + rights that point to our own receive rights, i.e. the new auth port. + Since posix_spawn might be implemented with fork (prior to glibc 2.3), +- we cannot use that simple interface either. We use _hurd_exec ++ we cannot use that simple interface either. We use _hurd_exec_file_name + directly to effect what posix_spawn does in the simple case. */ + { + task_t newtask; +@@ -413,7 +413,12 @@ + if (err) + error (3, err, "proc_child"); + ++#ifdef HAVE__HURD_EXEC_FILE_NAME ++ err = _hurd_exec_file_name (newtask, execfile, argv[argi], ++ &argv[argi], environ); ++#else + err = _hurd_exec (newtask, execfile, &argv[argi], environ); ++#endif + mach_port_deallocate (mach_task_self (), newtask); + mach_port_deallocate (mach_task_self (), execfile); + if (err) +Index: hurd-debian/utils/rpctrace.c +=================================================================== +--- hurd-debian.orig/utils/rpctrace.c 2012-06-05 00:35:35.000000000 +0000 ++++ hurd-debian/utils/rpctrace.c 2012-06-05 01:48:00.000000000 +0000 +@@ -1069,7 +1069,11 @@ + /* Now actually run the command they told us to trace. We do the exec on + the actual task, so the RPCs to map in the program itself do not get + traced. Could have an option to use TASK_WRAPPER here instead. */ ++#ifdef HAVE__HURD_EXEC_FILE_NAME ++ err = _hurd_exec_file_name (traced_task, file, *argv, argv, envp); ++#else + err = _hurd_exec (traced_task, file, argv, envp); ++#endif + if (err) + error (2, err, "cannot exec `%s'", argv[0]); + +Index: hurd-debian/utils/shd.c +=================================================================== +--- hurd-debian.orig/utils/shd.c 2012-06-05 00:35:35.000000000 +0000 ++++ hurd-debian/utils/shd.c 2012-06-05 01:48:00.000000000 +0000 +@@ -1,5 +1,5 @@ + /* +- Copyright (C) 1994,95,99,2002 Free Software Foundation ++ Copyright (C) 1994, 1995, 1999, 2002, 2010 Free Software Foundation + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as +@@ -159,15 +159,18 @@ + movefd (fd1, 1, &save1)) + return -1; + ++#ifdef HAVE__HURD_EXEC_FILE_NAME ++ err = _hurd_exec_file_name (task, file, program, argv, environ); ++#else + err = _hurd_exec (task, file, argv, environ); +- ++#endif + if (restorefd (fd0, 0, &save0) || + restorefd (fd1, 1, &save1)) + return -1; + + if (err) + { +- error (0, err, "_hurd_exec"); ++ error (0, err, "_hurd_exec_file_name"); + err = task_terminate (task); + if (err) + error (0, err, "task_terminate"); diff --git a/debian/patches/ext2fs_large_stores.patch b/debian/patches/ext2fs_large_stores.patch new file mode 100644 index 00000000..f65ec760 --- /dev/null +++ b/debian/patches/ext2fs_large_stores.patch @@ -0,0 +1,2274 @@ +Support for >2GB volumes + +XXX: this adds a parameter to pager_create and diskfs_start_disk_pager +--- + console/pager.c | 10 + ext2fs/balloc.c | 57 +++-- + ext2fs/ext2_fs.h | 3 + ext2fs/ext2fs.c | 8 + ext2fs/ext2fs.h | 145 +++++++++++-- + ext2fs/getblk.c | 31 +- + ext2fs/hyper.c | 34 ++- + ext2fs/ialloc.c | 41 +++ + ext2fs/inode.c | 58 +++-- + ext2fs/pager.c | 497 +++++++++++++++++++++++++++++++++++++++++++---- + ext2fs/pokel.c | 41 +++ + ext2fs/truncate.c | 11 - + fatfs/pager.c | 11 - + isofs/pager.c | 12 - + libdiskfs/disk-pager.c | 6 + libdiskfs/diskfs-pager.h | 3 + libpager/data-request.c | 17 - + libpager/data-return.c | 78 +++++-- + libpager/pager-create.c | 4 + libpager/pager.h | 29 ++ + libpager/priv.h | 1 + storeio/pager.c | 9 + tmpfs/pager-stubs.c | 8 + ufs/pager.c | 11 - + 24 files changed, 940 insertions(+), 185 deletions(-) + +Index: hurd-debian/console/pager.c +=================================================================== +--- hurd-debian.orig/console/pager.c 2012-07-10 01:33:10.000000000 +0000 ++++ hurd-debian/console/pager.c 2012-07-10 01:39:22.000000000 +0000 +@@ -94,6 +94,14 @@ + } + + ++void ++pager_notify_evict (struct user_pager_info *pager, ++ vm_offset_t page) ++{ ++ assert (!"unrequested notification on eviction"); ++} ++ ++ + /* Tell how big the file is. */ + error_t + pager_report_extent (struct user_pager_info *upi, +@@ -159,7 +167,7 @@ + + /* XXX Are the values 1 and MEMORY_OBJECT_COPY_DELAY correct? */ + user_pager->pager = pager_create (upi, pager_bucket, +- 1, MEMORY_OBJECT_COPY_DELAY); ++ 1, MEMORY_OBJECT_COPY_DELAY, 0); + if (!user_pager->pager) + { + free (upi); +Index: hurd-debian/ext2fs/balloc.c +=================================================================== +--- hurd-debian.orig/ext2fs/balloc.c 2012-07-10 01:36:36.000000000 +0000 ++++ hurd-debian/ext2fs/balloc.c 2012-07-10 01:39:22.000000000 +0000 +@@ -92,7 +92,7 @@ + block, count); + } + gdp = group_desc (block_group); +- bh = bptr (gdp->bg_block_bitmap); ++ bh = disk_cache_block_ref (gdp->bg_block_bitmap); + + if (in_range (gdp->bg_block_bitmap, block, gcount) || + in_range (gdp->bg_inode_bitmap, block, gcount) || +@@ -114,6 +114,7 @@ + } + + record_global_poke (bh); ++ disk_cache_block_ref_ptr (gdp); + record_global_poke (gdp); + + block += gcount; +@@ -139,7 +140,7 @@ + block_t prealloc_goal, + block_t *prealloc_count, block_t *prealloc_block) + { +- char *bh; ++ char *bh = 0; + char *p, *r; + int i, j, k, tmp; + unsigned long lmap; +@@ -164,9 +165,10 @@ + + ext2_debug ("goal=%u", goal); + +-repeat: ++ repeat: ++ assert (! bh); + /* +- * First, test whether the goal block is free. ++ * First, test whether the goal block is free. + */ + if (goal < sblock->s_first_data_block || goal >= sblock->s_blocks_count) + goal = sblock->s_first_data_block; +@@ -179,7 +181,7 @@ + if (j) + goal_attempts++; + #endif +- bh = bptr (gdp->bg_block_bitmap); ++ bh = disk_cache_block_ref (gdp->bg_block_bitmap); + + ext2_debug ("goal is at %d:%d", i, j); + +@@ -194,8 +196,8 @@ + if (j) + { + /* +- * The goal was occupied; search forward for a free +- * block within the next 32 blocks ++ * The goal was occupied; search forward for a free ++ * block within the next 32 blocks + */ + if ((j & 31) == 31) + lmap = 0; +@@ -245,13 +247,16 @@ + j = k; + goto got_block; + } ++ ++ disk_cache_block_deref (bh); ++ bh = 0; + } + + ext2_debug ("bit not found in block group %d", i); + + /* +- * Now search the rest of the groups. We assume that +- * i and gdp correctly point to the last group visited. ++ * Now search the rest of the groups. We assume that ++ * i and gdp correctly point to the last group visited. + */ + for (k = 0; k < groups_count; k++) + { +@@ -267,7 +272,8 @@ + pthread_spin_unlock (&global_lock); + return 0; + } +- bh = bptr (gdp->bg_block_bitmap); ++ assert (! bh); ++ bh = disk_cache_block_ref (gdp->bg_block_bitmap); + r = memscan (bh, 0, sblock->s_blocks_per_group >> 3); + j = (r - bh) << 3; + if (j < sblock->s_blocks_per_group) +@@ -277,21 +283,25 @@ + sblock->s_blocks_per_group); + if (j >= sblock->s_blocks_per_group) + { ++ disk_cache_block_deref (bh); ++ bh = 0; + ext2_error ("free blocks count corrupted for block group %d", i); + pthread_spin_unlock (&global_lock); + return 0; + } + +-search_back: ++ search_back: ++ assert (bh); + /* +- * We have succeeded in finding a free byte in the block +- * bitmap. Now search backwards up to 7 bits to find the +- * start of this group of free blocks. ++ * We have succeeded in finding a free byte in the block ++ * bitmap. Now search backwards up to 7 bits to find the ++ * start of this group of free blocks. + */ + for (k = 0; k < 7 && j > 0 && !test_bit (j - 1, bh); k++, j--); + +-got_block: +- ++ got_block: ++ assert (bh); ++ + ext2_debug ("using block group %d (%d)", i, gdp->bg_free_blocks_count); + + tmp = j + i * sblock->s_blocks_per_group + sblock->s_first_data_block; +@@ -304,6 +314,8 @@ + if (set_bit (j, bh)) + { + ext2_warning ("bit already set for block %d", j); ++ disk_cache_block_deref (bh); ++ bh = 0; + goto repeat; + } + +@@ -320,7 +332,7 @@ + ext2_debug ("found bit %d", j); + + /* +- * Do block preallocation now if required. ++ * Do block preallocation now if required. + */ + #ifdef EXT2_PREALLOCATE + if (prealloc_goal) +@@ -351,6 +363,7 @@ + j = tmp; + + record_global_poke (bh); ++ bh = 0; + + if (j >= sblock->s_blocks_count) + { +@@ -363,12 +376,14 @@ + j, goal_hits, goal_attempts); + + gdp->bg_free_blocks_count--; ++ disk_cache_block_ref_ptr (gdp); + record_global_poke (gdp); + + sblock->s_free_blocks_count--; + sblock_dirty = 1; + + sync_out: ++ assert (! bh); + pthread_spin_unlock (&global_lock); + alloc_sync (0); + +@@ -390,9 +405,12 @@ + gdp = NULL; + for (i = 0; i < groups_count; i++) + { ++ void *bh; + gdp = group_desc (i); + desc_count += gdp->bg_free_blocks_count; +- x = count_free (bptr (gdp->bg_block_bitmap), block_size); ++ bh = disk_cache_block_ref (gdp->bg_block_bitmap); ++ x = count_free (bh, block_size); ++ disk_cache_block_deref (bh); + printf ("group %d: stored = %d, counted = %lu", + i, gdp->bg_free_blocks_count, x); + bitmap_count += x; +@@ -453,7 +471,7 @@ + + gdp = group_desc (i); + desc_count += gdp->bg_free_blocks_count; +- bh = bptr (gdp->bg_block_bitmap); ++ bh = disk_cache_block_ref (gdp->bg_block_bitmap); + + if (!EXT2_HAS_RO_COMPAT_FEATURE (sblock, + EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER) +@@ -479,6 +497,7 @@ + ext2_error ("block #%d of the inode table in group %d is marked free", j, i); + + x = count_free (bh, block_size); ++ disk_cache_block_deref (bh); + if (gdp->bg_free_blocks_count != x) + ext2_error ("wrong free blocks count for group %d," + " stored = %d, counted = %lu", +Index: hurd-debian/ext2fs/ext2_fs.h +=================================================================== +--- hurd-debian.orig/ext2fs/ext2_fs.h 2012-07-10 01:33:10.000000000 +0000 ++++ hurd-debian/ext2fs/ext2_fs.h 2012-07-10 01:39:22.000000000 +0000 +@@ -25,7 +25,8 @@ + /* + * Define EXT2FS_DEBUG to produce debug messages + */ +-#undef EXT2FS_DEBUG ++/* #undef EXT2FS_DEBUG */ ++#define EXT2FS_DEBUG + + /* + * Define EXT2_PREALLOCATE to preallocate data blocks for expanding files +Index: hurd-debian/ext2fs/ext2fs.c +=================================================================== +--- hurd-debian.orig/ext2fs/ext2fs.c 2012-07-10 01:33:10.000000000 +0000 ++++ hurd-debian/ext2fs/ext2fs.c 2012-07-10 01:39:22.000000000 +0000 +@@ -106,7 +106,7 @@ + if (values == 0) + return ENOMEM; + state->hook = values; +- bzero (values, sizeof *values); ++ memset (values, 0, sizeof *values); + values->sb_block = SBLOCK_BLOCK; + break; + +@@ -181,9 +181,9 @@ + /* Map the entire disk. */ + create_disk_pager (); + +- pokel_init (&global_pokel, diskfs_disk_pager, disk_image); ++ pokel_init (&global_pokel, diskfs_disk_pager, disk_cache); + +- get_hypermetadata(); ++ map_hypermetadata (); + + inode_init (); + +@@ -211,6 +211,8 @@ + { + pokel_flush (&global_pokel); + pager_flush (diskfs_disk_pager, 1); ++ sblock = 0; + get_hypermetadata (); ++ map_hypermetadata (); + return 0; + } +Index: hurd-debian/ext2fs/ext2fs.h +=================================================================== +--- hurd-debian.orig/ext2fs/ext2fs.h 2012-07-10 01:33:10.000000000 +0000 ++++ hurd-debian/ext2fs/ext2fs.h 2012-07-10 01:39:22.000000000 +0000 +@@ -23,7 +23,9 @@ + #include <hurd/pager.h> + #include <hurd/fshelp.h> + #include <hurd/iohelp.h> ++#include <hurd/store.h> + #include <hurd/diskfs.h> ++#include <hurd/ihash.h> + #include <assert.h> + #include <pthread.h> + #include <sys/mman.h> +@@ -195,6 +197,8 @@ + /* ---------------------------------------------------------------- */ + /* pager.c */ + ++#define DISK_CACHE_BLOCKS 65536 ++ + #include <hurd/diskfs-pager.h> + + /* Set up the disk pager. */ +@@ -218,10 +222,54 @@ + /* What the user specified. */ + extern struct store_parsed *store_parsed; + +-/* Mapped image of the disk. */ +-extern void *disk_image; ++/* Mapped image of cached blocks of the disk. */ ++extern void *disk_cache; ++extern store_offset_t disk_cache_size; ++extern int disk_cache_blocks; ++ ++#define DC_INCORE 0x01 /* Not in core. */ ++#define DC_UNTOUCHED 0x02 /* Not touched by disk_pager_read_paged ++ or disk_cache_block_ref. */ ++#define DC_FIXED 0x04 /* Must not be re-associated. */ ++ ++/* Flags that forbid re-association of page. DC_UNTOUCHED is included ++ because this flag is used only when page is already to be ++ re-associated, so it's not good candidate for another ++ remapping. */ ++#define DC_DONT_REUSE (DC_INCORE | DC_UNTOUCHED | DC_FIXED) ++ ++#define DC_NO_BLOCK ((block_t) -1L) ++ ++#ifndef NDEBUG ++#define DISK_CACHE_LAST_READ_XOR 0xDEADBEEF ++#endif + +-/* Our in-core copy of the super-block (pointer into the disk_image). */ ++/* Disk cache blocks' meta info. */ ++struct disk_cache_info ++{ ++ block_t block; ++ uint16_t flags; ++ uint16_t ref_count; ++#ifndef NDEBUG ++ block_t last_read, last_read_xor; ++#endif ++}; ++ ++/* block num --> pointer to in-memory block */ ++extern hurd_ihash_t disk_cache_bptr; ++/* Metadata about cached block. */ ++extern struct disk_cache_info *disk_cache_info; ++/* Lock for these mappings */ ++extern struct mutex disk_cache_lock; ++/* Fired when a re-association is done. */ ++extern struct condition disk_cache_reassociation; ++ ++void *disk_cache_block_ref (block_t block); ++void disk_cache_block_ref_ptr (void *ptr); ++void disk_cache_block_deref (void *ptr); ++int disk_cache_block_is_ref (block_t block); ++ ++/* Our in-core copy of the super-block (pointer into the disk_cache). */ + struct ext2_super_block *sblock; + /* True if sblock has been modified. */ + int sblock_dirty; +@@ -251,6 +299,9 @@ + + /* Get the superblock from the disk, & setup various global info from it. */ + void get_hypermetadata (); ++ ++/* Map `sblock' and `group_desc_image' pointers to disk cache. */ ++void map_hypermetadata (); + + /* ---------------------------------------------------------------- */ + /* Random stuff calculated from the super block. */ +@@ -274,21 +325,51 @@ + unsigned long next_generation; + + /* ---------------------------------------------------------------- */ +-/* Functions for looking inside disk_image */ ++/* Functions for looking inside disk_cache */ + +-#define trunc_block(offs) (((offs) >> log2_block_size) << log2_block_size) ++#define trunc_block(offs) \ ++ ((off_t) ((offs) >> log2_block_size) << log2_block_size) + #define round_block(offs) \ +- ((((offs) + block_size - 1) >> log2_block_size) << log2_block_size) ++ ((off_t) (((offs) + block_size - 1) >> log2_block_size) << log2_block_size) + + /* block num --> byte offset on disk */ +-#define boffs(block) ((block) << log2_block_size) ++#define boffs(block) ((off_t) (block) << log2_block_size) + /* byte offset on disk --> block num */ + #define boffs_block(offs) ((offs) >> log2_block_size) + ++/* pointer to in-memory block -> index in disk_cache_info */ ++#define bptr_index(ptr) (((char *)ptr - (char *)disk_cache) >> log2_block_size) ++ + /* byte offset on disk --> pointer to in-memory block */ +-#define boffs_ptr(offs) (((char *)disk_image) + (offs)) ++EXT2FS_EI char * ++boffs_ptr (off_t offset) ++{ ++ block_t block = boffs_block (offset); ++ mutex_lock (&disk_cache_lock); ++ char *ptr = hurd_ihash_find (disk_cache_bptr, block); ++ mutex_unlock (&disk_cache_lock); ++ assert (ptr); ++ ptr += offset % block_size; ++ ext2_debug ("(%Ld) = %p", offset, ptr); ++ return ptr; ++} ++ + /* pointer to in-memory block --> byte offset on disk */ +-#define bptr_offs(ptr) ((char *)(ptr) - ((char *)disk_image)) ++EXT2FS_EI off_t ++bptr_offs (void *ptr) ++{ ++ vm_offset_t mem_offset = (char *)ptr - (char *)disk_cache; ++ off_t offset; ++ assert (mem_offset < disk_cache_size); ++ mutex_lock (&disk_cache_lock); ++ offset = (off_t) disk_cache_info[boffs_block (mem_offset)].block ++ << log2_block_size; ++ assert (offset || mem_offset < block_size); ++ offset += mem_offset % block_size; ++ mutex_unlock (&disk_cache_lock); ++ ext2_debug ("(%p) = %Ld", ptr, offset); ++ return offset; ++} + + /* block num --> pointer to in-memory block */ + #define bptr(block) boffs_ptr(boffs(block)) +@@ -308,14 +389,24 @@ + #if defined(__USE_EXTERN_INLINES) || defined(EXT2FS_DEFINE_EI) + /* Convert an inode number to the dinode on disk. */ + EXT2FS_EI struct ext2_inode * +-dino (ino_t inum) ++dino_ref (ino_t inum) + { + unsigned long inodes_per_group = sblock->s_inodes_per_group; + unsigned long bg_num = (inum - 1) / inodes_per_group; + unsigned long group_inum = (inum - 1) % inodes_per_group; +- struct ext2_group_desc *bg = group_desc(bg_num); ++ struct ext2_group_desc *bg = group_desc (bg_num); + block_t block = bg->bg_inode_table + (group_inum / inodes_per_block); +- return ((struct ext2_inode *)bptr(block)) + group_inum % inodes_per_block; ++ struct ext2_inode *inode = disk_cache_block_ref (block); ++ inode += group_inum % inodes_per_block; ++ ext2_debug ("(%qd) = %p", inum, inode); ++ return inode; ++} ++ ++EXT2FS_EI void ++dino_deref (struct ext2_inode *inode) ++{ ++ ext2_debug ("(%p)", inode); ++ disk_cache_block_deref (inode); + } + #endif /* Use extern inlines. */ + +@@ -377,27 +468,38 @@ + EXT2FS_EI void + record_global_poke (void *ptr) + { +- int boffs = trunc_block (bptr_offs (ptr)); +- global_block_modified (boffs_block (boffs)); +- pokel_add (&global_pokel, boffs_ptr(boffs), block_size); ++ block_t block = boffs_block (bptr_offs (ptr)); ++ void *block_ptr = bptr (block); ++ ext2_debug ("(%p = %p)", ptr, block_ptr); ++ assert (disk_cache_block_is_ref (block)); ++ global_block_modified (block); ++ pokel_add (&global_pokel, block_ptr, block_size); + } + + /* This syncs a modification to a non-file block. */ + EXT2FS_EI void + sync_global_ptr (void *bptr, int wait) + { +- vm_offset_t boffs = trunc_block (bptr_offs (bptr)); +- global_block_modified (boffs_block (boffs)); +- pager_sync_some (diskfs_disk_pager, trunc_page (boffs), vm_page_size, wait); ++ block_t block = boffs_block (bptr_offs (bptr)); ++ void *block_ptr = bptr (block); ++ ext2_debug ("(%p -> %u)", bptr, (block_t)block); ++ global_block_modified (block); ++ disk_cache_block_deref (block_ptr); ++ pager_sync_some (diskfs_disk_pager, ++ block_ptr - disk_cache, block_size, wait); ++ + } + + /* This records a modification to one of a file's indirect blocks. */ + EXT2FS_EI void + record_indir_poke (struct node *node, void *ptr) + { +- int boffs = trunc_block (bptr_offs (ptr)); +- global_block_modified (boffs_block (boffs)); +- pokel_add (&node->dn->indir_pokel, boffs_ptr(boffs), block_size); ++ block_t block = boffs_block (bptr_offs (ptr)); ++ void *block_ptr = bptr (block); ++ ext2_debug ("(%d, %p)", (int)node->cache_id, ptr); ++ assert (disk_cache_block_is_ref (block)); ++ global_block_modified (block); ++ pokel_add (&node->dn->indir_pokel, block_ptr, block_size); + } + + /* ---------------------------------------------------------------- */ +@@ -405,6 +507,7 @@ + EXT2FS_EI void + sync_global (int wait) + { ++ ext2_debug ("%d", wait); + pokel_sync (&global_pokel, wait); + } + +Index: hurd-debian/ext2fs/getblk.c +=================================================================== +--- hurd-debian.orig/ext2fs/getblk.c 2012-07-10 01:33:10.000000000 +0000 ++++ hurd-debian/ext2fs/getblk.c 2012-07-10 01:39:22.000000000 +0000 +@@ -52,7 +52,7 @@ + if (node->dn->info.i_prealloc_count) + { + int i = node->dn->info.i_prealloc_count; +- ext2_debug ("discarding %d prealloced blocks for inode %d", ++ ext2_debug ("discarding %d prealloced blocks for inode %Ld", + i, node->cache_id); + node->dn->info.i_prealloc_count = 0; + ext2_free_blocks (node->dn->info.i_prealloc_block, i); +@@ -104,8 +104,8 @@ + + if (result && zero) + { +- char *bh = bptr (result); +- bzero (bh, block_size); ++ char *bh = disk_cache_block_ref (result); ++ memset (bh, 0, block_size); + record_indir_poke (node, bh); + } + +@@ -122,6 +122,8 @@ + block_t hint; + #endif + ++ assert (0 <= nr && nr < EXT2_N_BLOCKS); ++ + *result = node->dn->info.i_data[nr]; + if (*result) + return 0; +@@ -180,14 +182,20 @@ + { + int i; + block_t goal = 0; +- block_t *bh = (block_t *)bptr (block); ++ block_t *bh = (block_t *)disk_cache_block_ref (block); + + *result = bh[nr]; + if (*result) +- return 0; ++ { ++ disk_cache_block_deref (bh); ++ return 0; ++ } + + if (!create) +- return EINVAL; ++ { ++ disk_cache_block_deref (bh); ++ return EINVAL; ++ } + + if (node->dn->info.i_next_alloc_block == new_block) + goal = node->dn->info.i_next_alloc_goal; +@@ -207,7 +215,10 @@ + + *result = ext2_alloc_block (node, goal, zero); + if (!*result) +- return ENOSPC; ++ { ++ disk_cache_block_deref (bh); ++ return ENOSPC; ++ } + + bh[nr] = *result; + +@@ -243,9 +254,9 @@ + return EIO; + } + /* +- * If this is a sequential block allocation, set the next_alloc_block +- * to this block now so that all the indblock and data block +- * allocations use the same goal zone ++ * If this is a sequential block allocation, set the next_alloc_block ++ * to this block now so that all the indblock and data block ++ * allocations use the same goal zone + */ + + ext2_debug ("block = %u, next = %u, goal = %u", block, +Index: hurd-debian/ext2fs/hyper.c +=================================================================== +--- hurd-debian.orig/ext2fs/hyper.c 2012-07-10 01:33:10.000000000 +0000 ++++ hurd-debian/ext2fs/hyper.c 2012-07-10 01:39:22.000000000 +0000 +@@ -58,12 +58,15 @@ + void + get_hypermetadata (void) + { +- error_t err = diskfs_catch_exception (); +- if (err) +- ext2_panic ("can't read superblock: %s", strerror (err)); +- +- sblock = (struct ext2_super_block *) boffs_ptr (SBLOCK_OFFS); ++ error_t err; ++ size_t read = 0; + ++ assert (! sblock); ++ err = store_read (store, SBLOCK_OFFS >> store->log2_block_size, ++ SBLOCK_SIZE, (void **)&sblock, &read); ++ if (err || read != SBLOCK_SIZE) ++ ext2_panic ("Cannot read hypermetadata"); ++ + if (sblock->s_magic != EXT2_SUPER_MAGIC + #ifdef EXT2FS_PRE_02B_COMPAT + && sblock->s_magic != EXT2_PRE_02B_MAGIC +@@ -152,15 +155,22 @@ + + allocate_mod_map (); + +- diskfs_end_catch_exception (); ++ /* A handy source of page-aligned zeros. */ ++ if (zeroblock == 0) ++ zeroblock = (vm_address_t) mmap (0, block_size, PROT_READ, MAP_ANON, 0, 0); ++ ++ munmap (sblock, SBLOCK_SIZE); ++ sblock = NULL; ++} ++ ++void ++map_hypermetadata (void) ++{ ++ sblock = (struct ext2_super_block *) boffs_ptr (SBLOCK_OFFS); + + /* Cache a convenient pointer to the block group descriptors for allocation. + These are stored in the filesystem blocks following the superblock. */ + group_desc_image = (struct ext2_group_desc *) bptr (bptr_block (sblock) + 1); +- +- /* A handy source of page-aligned zeros. */ +- if (zeroblock == 0) +- zeroblock = (vm_address_t) mmap (0, block_size, PROT_READ, MAP_ANON, 0, 0); + } + + error_t +@@ -183,6 +193,7 @@ + if (sblock_dirty) + { + sblock_dirty = 0; ++ disk_cache_block_ref_ptr (sblock); + record_global_poke (sblock); + } + +@@ -199,7 +210,8 @@ + + (*(readonly ? store_set_flags : store_clear_flags)) (store, STORE_READONLY); + +- mprotect (disk_image, store->size, PROT_READ | (readonly ? 0 : PROT_WRITE)); ++ mprotect (disk_cache, disk_cache_size, ++ PROT_READ | (readonly ? 0 : PROT_WRITE)); + + if (!readonly && !(sblock->s_state & EXT2_VALID_FS)) + ext2_warning ("UNCLEANED FILESYSTEM NOW WRITABLE"); +Index: hurd-debian/ext2fs/ialloc.c +=================================================================== +--- hurd-debian.orig/ext2fs/ialloc.c 2012-07-10 01:33:10.000000000 +0000 ++++ hurd-debian/ext2fs/ialloc.c 2012-07-10 01:39:22.000000000 +0000 +@@ -60,7 +60,7 @@ + + assert (!diskfs_readonly); + +- ext2_debug ("freeing inode %u", inum); ++ ext2_debug ("freeing inode %Lu", inum); + + pthread_spin_lock (&global_lock); + +@@ -75,22 +75,25 @@ + bit = (inum - 1) % sblock->s_inodes_per_group; + + gdp = group_desc (block_group); +- bh = bptr (gdp->bg_inode_bitmap); ++ bh = disk_cache_block_ref (gdp->bg_inode_bitmap); + + if (!clear_bit (bit, bh)) + ext2_warning ("bit already cleared for inode %Ld", inum); + else + { ++ disk_cache_block_ref_ptr (bh); + record_global_poke (bh); + + gdp->bg_free_inodes_count++; + if (S_ISDIR (old_mode)) + gdp->bg_used_dirs_count--; ++ disk_cache_block_ref_ptr (gdp); + record_global_poke (gdp); + + sblock->s_free_inodes_count++; + } + ++ disk_cache_block_deref (bh); + sblock_dirty = 1; + pthread_spin_unlock (&global_lock); + alloc_sync(0); +@@ -111,14 +114,15 @@ + ino_t + ext2_alloc_inode (ino_t dir_inum, mode_t mode) + { +- char *bh; ++ char *bh = 0; + int i, j, inum, avefreei; + struct ext2_group_desc *gdp; + struct ext2_group_desc *tmp; + + pthread_spin_lock (&global_lock); + +-repeat: ++ repeat: ++ assert (! bh); + gdp = NULL; + i = 0; + +@@ -213,7 +217,7 @@ + return 0; + } + +- bh = bptr (gdp->bg_inode_bitmap); ++ bh = disk_cache_block_ref (gdp->bg_inode_bitmap); + if ((inum = + find_first_zero_bit ((unsigned long *) bh, sblock->s_inodes_per_group)) + < sblock->s_inodes_per_group) +@@ -221,12 +225,17 @@ + if (set_bit (inum, bh)) + { + ext2_warning ("bit already set for inode %d", inum); ++ disk_cache_block_deref (bh); ++ bh = 0; + goto repeat; + } + record_global_poke (bh); ++ bh = 0; + } + else + { ++ disk_cache_block_deref (bh); ++ bh = 0; + if (gdp->bg_free_inodes_count != 0) + { + ext2_error ("free inodes count corrupted in group %d", i); +@@ -248,15 +257,25 @@ + gdp->bg_free_inodes_count--; + if (S_ISDIR (mode)) + gdp->bg_used_dirs_count++; ++ disk_cache_block_ref_ptr (gdp); + record_global_poke (gdp); + + sblock->s_free_inodes_count--; + sblock_dirty = 1; + + sync_out: ++ assert (! bh); + pthread_spin_unlock (&global_lock); + alloc_sync (0); + ++ /* Make sure the coming read_node won't complain about bad ++ fields. */ ++ { ++ struct ext2_inode *di = dino_ref (inum); ++ memset (di, 0, sizeof *di); ++ dino_deref (di); ++ } ++ + return inum; + } + +@@ -353,10 +372,12 @@ + gdp = NULL; + for (i = 0; i < groups_count; i++) + { ++ void *bh; + gdp = group_desc (i); + desc_count += gdp->bg_free_inodes_count; +- x = count_free (bptr (gdp->bg_inode_bitmap), +- sblock->s_inodes_per_group / 8); ++ bh = disk_cache_block_ref (gdp->bg_inode_bitmap); ++ x = count_free (bh, sblock->s_inodes_per_group / 8); ++ disk_cache_block_deref (bh); + ext2_debug ("group %d: stored = %d, counted = %lu", + i, gdp->bg_free_inodes_count, x); + bitmap_count += x; +@@ -386,10 +407,12 @@ + gdp = NULL; + for (i = 0; i < groups_count; i++) + { ++ void *bh; + gdp = group_desc (i); + desc_count += gdp->bg_free_inodes_count; +- x = count_free (bptr (gdp->bg_inode_bitmap), +- sblock->s_inodes_per_group / 8); ++ bh = disk_cache_block_ref (gdp->bg_inode_bitmap); ++ x = count_free (bh, sblock->s_inodes_per_group / 8); ++ disk_cache_block_deref (bh); + if (gdp->bg_free_inodes_count != x) + ext2_error ("wrong free inodes count in group %d, " + "stored = %d, counted = %lu", +Index: hurd-debian/ext2fs/inode.c +=================================================================== +--- hurd-debian.orig/ext2fs/inode.c 2012-11-26 00:23:28.000000000 +0000 ++++ hurd-debian/ext2fs/inode.c 2012-11-26 00:24:49.000000000 +0000 +@@ -92,7 +92,7 @@ + dn->dir_idx = 0; + dn->pager = 0; + pthread_rwlock_init (&dn->alloc_lock, NULL); +- pokel_init (&dn->indir_pokel, diskfs_disk_pager, disk_image); ++ pokel_init (&dn->indir_pokel, diskfs_disk_pager, disk_cache); + + /* Create the new node. */ + np = diskfs_make_node (dn); +@@ -201,13 +201,17 @@ + error_t err; + struct stat *st = &np->dn_stat; + struct disknode *dn = np->dn; +- struct ext2_inode *di = dino (np->cache_id); ++ struct ext2_inode *di; + struct ext2_inode_info *info = &dn->info; + ++ ext2_debug ("(%d)", np->cache_id); ++ + err = diskfs_catch_exception (); + if (err) + return err; + ++ di = dino_ref (np->cache_id); ++ + st->st_fstype = FSTYPE_EXT2FS; + st->st_fsid = getpid (); /* This call is very cheap. */ + st->st_ino = np->cache_id; +@@ -285,7 +289,9 @@ + info->i_high_size = di->i_size_high; + if (info->i_high_size) /* XXX */ + { ++ dino_deref (di); + ext2_warning ("cannot handle large file inode %Ld", np->cache_id); ++ diskfs_end_catch_exception (); + return EFBIG; + } + } +@@ -307,20 +313,12 @@ + } + dn->info_i_translator = di->i_translator; + ++ dino_deref (di); + diskfs_end_catch_exception (); + + if (S_ISREG (st->st_mode) || S_ISDIR (st->st_mode) + || (S_ISLNK (st->st_mode) && st->st_blocks)) +- { +- unsigned offset; +- +- np->allocsize = np->dn_stat.st_size; +- +- /* Round up to a block multiple. */ +- offset = np->allocsize & ((1 << log2_block_size) - 1); +- if (offset > 0) +- np->allocsize += block_size - offset; +- } ++ np->allocsize = round_block (np->dn_stat.st_size); + else + /* Allocsize should be zero for anything except directories, files, and + long symlinks. These are the only things allowed to have any blocks +@@ -408,7 +406,9 @@ + { + error_t err; + struct stat *st = &np->dn_stat; +- struct ext2_inode *di = dino (np->cache_id); ++ struct ext2_inode *di; ++ ++ ext2_debug ("(%d)", np->cache_id); + + if (np->dn->info.i_prealloc_count) + ext2_discard_prealloc (np); +@@ -419,12 +419,14 @@ + + assert (!diskfs_readonly); + +- ext2_debug ("writing inode %d to disk", np->cache_id); ++ ext2_debug ("writing inode %Ld to disk", np->cache_id); + + err = diskfs_catch_exception (); + if (err) + return NULL; + ++ di = dino_ref (np->cache_id); ++ + di->i_generation = st->st_gen; + + /* We happen to know that the stat mode bits are the same +@@ -505,6 +507,7 @@ + diskfs_end_catch_exception (); + np->dn_stat_dirty = 0; + ++ /* Leave invoking dino_deref (di) to the caller. */ + return di; + } + else +@@ -674,7 +677,7 @@ + if (err) + return err; + +- di = dino (np->cache_id); ++ di = dino_ref (np->cache_id); + blkno = di->i_translator; + + if (namelen && !blkno) +@@ -687,6 +690,7 @@ + 0, 0, 0); + if (blkno == 0) + { ++ dino_deref (di); + diskfs_end_catch_exception (); + return ENOSPC; + } +@@ -710,15 +714,20 @@ + np->dn_stat.st_mode &= ~S_IPTRANS; + np->dn_set_ctime = 1; + } ++ else ++ dino_deref (di); + + if (namelen) + { ++ void *blkptr; ++ + buf[0] = namelen & 0xFF; + buf[1] = (namelen >> 8) & 0xFF; +- bcopy (name, buf + 2, namelen); ++ memcpy (buf + 2, name, namelen); + +- bcopy (buf, bptr (blkno), block_size); +- record_global_poke (bptr (blkno)); ++ blkptr = disk_cache_block_ref (blkno); ++ memcpy (blkptr, buf, block_size); ++ record_global_poke (blkptr); + + np->dn_stat.st_mode |= S_IPTRANS; + np->dn_set_ctime = 1; +@@ -736,7 +745,7 @@ + error_t err = 0; + daddr_t blkno; + unsigned datalen; +- const void *transloc; ++ void *transloc; + + assert (sblock->s_creator_os == EXT2_OS_HURD); + +@@ -744,9 +753,11 @@ + if (err) + return err; + +- blkno = (dino (np->cache_id))->i_translator; ++ struct ext2_inode *di = dino_ref (np->cache_id); ++ blkno = di->i_translator; ++ dino_deref (di); + assert (blkno); +- transloc = bptr (blkno); ++ transloc = disk_cache_block_ref (blkno); + + datalen = + ((unsigned char *)transloc)[0] + (((unsigned char *)transloc)[1] << 8); +@@ -761,6 +772,7 @@ + memcpy (*namep, transloc + 2, datalen); + } + ++ disk_cache_block_deref (transloc); + diskfs_end_catch_exception (); + + *namelen = datalen; +@@ -782,7 +794,7 @@ + + assert (node->dn_stat.st_blocks == 0); + +- bcopy (target, node->dn->info.i_data, len); ++ memcpy (node->dn->info.i_data, target, len); + node->dn_stat.st_size = len - 1; + node->dn_set_ctime = 1; + node->dn_set_mtime = 1; +@@ -799,7 +811,7 @@ + + assert (node->dn_stat.st_size < MAX_INODE_SYMLINK); + +- bcopy (node->dn->info.i_data, target, node->dn_stat.st_size); ++ memcpy (target, node->dn->info.i_data, node->dn_stat.st_size); + return 0; + } + +Index: hurd-debian/ext2fs/pager.c +=================================================================== +--- hurd-debian.orig/ext2fs/pager.c 2012-07-10 01:33:10.000000000 +0000 ++++ hurd-debian/ext2fs/pager.c 2012-07-10 01:39:22.000000000 +0000 +@@ -18,17 +18,18 @@ + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + ++#include <unistd.h> + #include <string.h> + #include <errno.h> + #include <hurd/store.h> + #include "ext2fs.h" + ++/* XXX */ ++#include "../libpager/priv.h" ++ + /* A ports bucket to hold pager ports. */ + struct port_bucket *pager_bucket; + +-/* Mapped image of the disk. */ +-void *disk_image; +- + pthread_spinlock_t node_to_page_lock = PTHREAD_SPINLOCK_INITIALIZER; + + +@@ -165,6 +166,9 @@ + block_t pending_blocks = 0; + int num_pending_blocks = 0; + ++ ext2_debug ("reading inode %Ld page %u[%d]", ++ node->cache_id, page, vm_page_size); ++ + /* Read the NUM_PENDING_BLOCKS blocks in PENDING_BLOCKS, into the buffer + pointed to by BUF (allocating it if necessary) at offset OFFS. OFFS in + adjusted by the amount read, and NUM_PENDING_BLOCKS is zeroed. Any read +@@ -171,7 +175,8 @@ + { + if (num_pending_blocks > 0) + { +- block_t dev_block = pending_blocks << log2_dev_blocks_per_fs_block; ++ store_offset_t dev_block = (store_offset_t) pending_blocks ++ << log2_dev_blocks_per_fs_block; + size_t amount = num_pending_blocks << log2_block_size; + /* The buffer we try to read into; on the first read, we pass in a + size of zero, so that the read is guaranteed to allocate a new +@@ -198,7 +203,7 @@ + else + /* We've already got some buffer, so copy into it. */ + { +- bcopy (new_buf, *buf + offs, new_len); ++ memcpy (*buf + offs, new_buf, new_len); + free_page_buf (new_buf); /* Return NEW_BUF to our pool. */ + STAT_INC (file_pagein_freed_bufs); + } +@@ -254,7 +259,7 @@ + break; + STAT_INC (file_pagein_alloced_bufs); + } +- bzero (*buf + offs, block_size); ++ memset (*buf + offs, 0, block_size); + offs += block_size; + } + else +@@ -295,16 +300,17 @@ + if (pb->num > 0) + { + error_t err; +- block_t dev_block = pb->block << log2_dev_blocks_per_fs_block; ++ store_offset_t dev_block = (store_offset_t) pb->block ++ << log2_dev_blocks_per_fs_block; + size_t length = pb->num << log2_block_size, amount; + +- ext2_debug ("writing block %u[%ld]", pb->block, pb->num); ++ ext2_debug ("writing block %u[%Ld]", pb->block, pb->num); + + if (pb->offs > 0) + /* Put what we're going to write into a page-aligned buffer. */ + { + void *page_buf = get_page_buf (); +- bcopy (pb->buf + pb->offs, (void *)page_buf, length); ++ memcpy ((void *)page_buf, pb->buf + pb->offs, length); + err = store_write (store, dev_block, page_buf, length, &amount); + free_page_buf (page_buf); + } +@@ -357,7 +363,7 @@ + return 0; + } + +-/* Write one page for the pager backing NODE, at offset PAGE, into BUF. This ++/* Write one page for the pager backing NODE, at OFFSET, into BUF. This + may need to write several filesystem blocks to satisfy one page, and tries + to consolidate the i/o if possible. */ + static error_t +@@ -381,7 +387,7 @@ + else if (offset + left > node->allocsize) + left = node->allocsize - offset; + +- ext2_debug ("writing inode %d page %d[%d]", node->cache_id, offset, left); ++ ext2_debug ("writing inode %Ld page %u[%d]", node->cache_id, offset, left); + + STAT_INC (file_pageouts); + +@@ -409,16 +415,31 @@ + { + error_t err; + size_t length = vm_page_size, read = 0; +- vm_size_t dev_end = store->size; ++ store_offset_t offset = page, dev_end = store->size; + +- if (page + vm_page_size > dev_end) +- length = dev_end - page; ++ mutex_lock (&disk_cache_lock); ++ int index = offset >> log2_block_size; ++ offset = ((store_offset_t) disk_cache_info[index].block << log2_block_size) ++ + offset % block_size; ++ disk_cache_info[index].flags |= DC_INCORE; ++ disk_cache_info[index].flags &=~ DC_UNTOUCHED; ++#ifndef NDEBUG ++ disk_cache_info[index].last_read = disk_cache_info[index].block; ++ disk_cache_info[index].last_read_xor ++ = disk_cache_info[index].block ^ DISK_CACHE_LAST_READ_XOR; ++#endif ++ ext2_debug ("(%Ld)", offset >> log2_block_size); ++ mutex_unlock (&disk_cache_lock); ++ ++ if (offset + vm_page_size > dev_end) ++ length = dev_end - offset; + +- err = store_read (store, page >> store->log2_block_size, length, buf, &read); ++ err = store_read (store, offset >> store->log2_block_size, length, ++ buf, &read); + if (read != length) + return EIO; + if (!err && length != vm_page_size) +- bzero ((void *)(*buf + length), vm_page_size - length); ++ memset ((void *)(*buf + length), 0, vm_page_size - length); + + *writelock = 0; + +@@ -430,26 +451,38 @@ + { + error_t err = 0; + size_t length = vm_page_size, amount; +- vm_size_t dev_end = store->size; ++ store_offset_t offset = page, dev_end = store->size; ++ ++ mutex_lock (&disk_cache_lock); ++ int index = offset >> log2_block_size; ++ assert (disk_cache_info[index].block != DC_NO_BLOCK); ++ offset = ((store_offset_t) disk_cache_info[index].block << log2_block_size) ++ + offset % block_size; ++#ifndef NDEBUG /* Not strictly needed. */ ++ assert ((disk_cache_info[index].last_read ^ DISK_CACHE_LAST_READ_XOR) ++ == disk_cache_info[index].last_read_xor); ++ assert (disk_cache_info[index].last_read ++ == disk_cache_info[index].block); ++#endif ++ mutex_unlock (&disk_cache_lock); + +- if (page + vm_page_size > dev_end) +- length = dev_end - page; ++ if (offset + vm_page_size > dev_end) ++ length = dev_end - offset; + +- ext2_debug ("writing disk page %d[%d]", page, length); ++ ext2_debug ("writing disk page %Ld[%d]", offset, length); + + STAT_INC (disk_pageouts); + + if (modified_global_blocks) + /* Be picky about which blocks in a page that we write. */ + { +- vm_offset_t offs = page; + struct pending_blocks pb; + + pending_blocks_init (&pb, buf); + + while (length > 0 && !err) + { +- block_t block = boffs_block (offs); ++ block_t block = boffs_block (offset); + + /* We don't clear the block modified bit here because this paging + write request may not be the same one that actually set the bit, +@@ -467,7 +500,7 @@ + /* Otherwise just skip it. */ + err = pending_blocks_skip (&pb); + +- offs += block_size; ++ offset += block_size; + length -= block_size; + } + +@@ -476,7 +509,7 @@ + } + else + { +- err = store_write (store, page >> store->log2_block_size, ++ err = store_write (store, offset >> store->log2_block_size, + buf, length, &amount); + if (!err && length != amount) + err = EIO; +@@ -484,6 +517,18 @@ + + return err; + } ++ ++static void ++disk_pager_notify_evict (vm_offset_t page) ++{ ++ int index = page >> log2_block_size; ++ ++ ext2_debug ("(block %u)", index); ++ ++ mutex_lock (&disk_cache_lock); ++ disk_cache_info[index].flags &= ~DC_INCORE; ++ mutex_unlock (&disk_cache_lock); ++} + + /* Satisfy a pager read request for either the disk pager or file pager + PAGER, to the page at offset PAGE into BUF. WRITELOCK should be set if +@@ -493,9 +538,11 @@ + vm_address_t *buf, int *writelock) + { + if (pager->type == DISK) +- return disk_pager_read_page (page, (void **)buf, writelock); ++ return disk_pager_read_page (page, (void **)buf, ++ writelock); + else +- return file_pager_read_page (pager->node, page, (void **)buf, writelock); ++ return file_pager_read_page (pager->node, page, (void **)buf, ++ writelock); + } + + /* Satisfy a pager write request for either the disk pager or file pager +@@ -509,6 +556,14 @@ + else + return file_pager_write_page (pager->node, page, (void *)buf); + } ++ ++void ++pager_notify_evict (struct user_pager_info *pager, vm_offset_t page) ++{ ++ if (pager->type == DISK) ++ disk_pager_notify_evict (page); ++} ++ + + /* Make page PAGE writable, at least up to ALLOCSIZE. This function and + diskfs_grow are the only places that blocks are actually added to the +@@ -558,10 +613,10 @@ + + #ifdef EXT2FS_DEBUG + if (dn->last_page_partially_writable) +- ext2_debug ("made page %u[%lu] in inode %d partially writable", ++ ext2_debug ("made page %u[%Lu] in inode %Ld partially writable", + page, node->allocsize - page, node->cache_id); + else +- ext2_debug ("made page %u[%u] in inode %d writable", ++ ext2_debug ("made page %u[%u] in inode %Ld writable", + page, vm_page_size, node->cache_id); + #endif + +@@ -619,8 +674,8 @@ + block_t old_page_end_block = + round_page (old_size) >> log2_block_size; + +- ext2_debug ("growing inode %d to %lu bytes (from %lu)", node->cache_id, +- new_size, old_size); ++ ext2_debug ("growing inode %Ld to %Lu bytes (from %Lu)", ++ node->cache_id, new_size, old_size); + + if (dn->last_page_partially_writable + && old_page_end_block > end_block) +@@ -656,11 +711,11 @@ + + STAT_INC (file_grows); + +- ext2_debug ("new size: %ld%s.", new_size, ++ ext2_debug ("new size: %Lu%s.", new_size, + dn->last_page_partially_writable + ? " (last page writable)": ""); + if (err) +- ext2_warning ("inode=%Ld, target=%Ld: %s", ++ ext2_warning ("inode=%Ld, target=%Lu: %s", + node->cache_id, new_size, strerror (err)); + + node->allocsize = new_size; +@@ -765,6 +820,374 @@ + { + } + ++/* Cached blocks from disk. */ ++void *disk_cache; ++ ++/* DISK_CACHE size in bytes and blocks. */ ++store_offset_t disk_cache_size; ++int disk_cache_blocks; ++ ++/* block num --> pointer to in-memory block */ ++hurd_ihash_t disk_cache_bptr; ++/* Cached blocks' info. */ ++struct disk_cache_info *disk_cache_info; ++/* Hint index for which cache block to reuse next. */ ++int disk_cache_hint; ++/* Lock for these structures. */ ++struct mutex disk_cache_lock; ++/* Fired when a re-association is done. */ ++struct condition disk_cache_reassociation; ++ ++/* Finish mapping initialization. */ ++static void ++disk_cache_init (void) ++{ ++ if (block_size != vm_page_size) ++ ext2_panic ("Block size %d != vm_page_size %d", ++ block_size, vm_page_size); ++ ++ mutex_init (&disk_cache_lock); ++ condition_init (&disk_cache_reassociation); ++ ++ /* Allocate space for block num -> in-memory pointer mapping. */ ++ if (hurd_ihash_create (&disk_cache_bptr, HURD_IHASH_NO_LOCP)) ++ ext2_panic ("Can't allocate memory for disk_pager_bptr"); ++ ++ /* Allocate space for disk cache blocks' info. */ ++ disk_cache_info = malloc ((sizeof *disk_cache_info) * disk_cache_blocks); ++ if (!disk_cache_info) ++ ext2_panic ("Cannot allocate space for disk cache info"); ++ ++ /* Initialize disk_cache_info. */ ++ for (int i = 0; i < disk_cache_blocks; i++) ++ { ++ disk_cache_info[i].block = DC_NO_BLOCK; ++ disk_cache_info[i].flags = 0; ++ disk_cache_info[i].ref_count = 0; ++#ifndef NDEBUG ++ disk_cache_info[i].last_read = DC_NO_BLOCK; ++ disk_cache_info[i].last_read_xor ++ = DC_NO_BLOCK ^ DISK_CACHE_LAST_READ_XOR; ++#endif ++ } ++ disk_cache_hint = 0; ++ ++ /* Map the superblock and the block group descriptors. */ ++ block_t fixed_first = boffs_block (SBLOCK_OFFS); ++ block_t fixed_last = fixed_first ++ + (round_block ((sizeof *group_desc_image) * groups_count) ++ >> log2_block_size); ++ ext2_debug ("%d-%d\n", fixed_first, fixed_last); ++ assert (fixed_last - fixed_first + 1 <= (block_t)disk_cache_blocks + 3); ++ for (block_t i = fixed_first; i <= fixed_last; i++) ++ { ++ disk_cache_block_ref (i); ++ assert (disk_cache_info[i-fixed_first].block == i); ++ disk_cache_info[i-fixed_first].flags |= DC_FIXED; ++ } ++} ++ ++static void ++disk_cache_return_unused (void) ++{ ++ int index; ++ ++ /* XXX: Touch all pages. It seems that sometimes GNU Mach "forgets" ++ to notify us about evicted pages. Disk cache must be ++ unlocked. */ ++ for (vm_offset_t i = 0; i < disk_cache_size; i += vm_page_size) ++ *(volatile char *)(disk_cache + i); ++ ++ /* Release some references to cached blocks. */ ++ pokel_sync (&global_pokel, 1); ++ ++ /* Return unused pages that are in core. */ ++ int pending_begin = -1, pending_end = -1; ++ mutex_lock (&disk_cache_lock); ++ for (index = 0; index < disk_cache_blocks; index++) ++ if (! (disk_cache_info[index].flags & (DC_DONT_REUSE & ~DC_INCORE)) ++ && ! disk_cache_info[index].ref_count) ++ { ++ ext2_debug ("return %u -> %d", ++ disk_cache_info[index].block, index); ++ if (index != pending_end) ++ { ++ /* Return previous region, if there is such, ... */ ++ if (pending_end >= 0) ++ { ++ mutex_unlock (&disk_cache_lock); ++ pager_return_some (diskfs_disk_pager, ++ pending_begin * vm_page_size, ++ (pending_end - pending_begin) ++ * vm_page_size, ++ 1); ++ mutex_lock (&disk_cache_lock); ++ } ++ /* ... and start new region. */ ++ pending_begin = index; ++ } ++ pending_end = index + 1; ++ } ++ ++ mutex_unlock (&disk_cache_lock); ++ ++ /* Return last region, if there is such. */ ++ if (pending_end >= 0) ++ pager_return_some (diskfs_disk_pager, ++ pending_begin * vm_page_size, ++ (pending_end - pending_begin) * vm_page_size, ++ 1); ++ else ++ { ++ printf ("ext2fs: disk cache is starving\n"); ++ ++ /* Give it some time. This should happen rarely. */ ++ sleep (1); ++ } ++} ++ ++/* Map block and return pointer to it. */ ++void * ++disk_cache_block_ref (block_t block) ++{ ++ int index; ++ void *bptr; ++ ++ assert (0 <= block && block < store->size >> log2_block_size); ++ ++ ext2_debug ("(%u)", block); ++ ++ mutex_lock (&disk_cache_lock); ++ ++ bptr = hurd_ihash_find (disk_cache_bptr, block); ++ if (bptr) ++ /* Already mapped. */ ++ { ++ index = bptr_index (bptr); ++ ++ /* In process of re-associating? */ ++ if (disk_cache_info[index].flags & DC_UNTOUCHED) ++ { ++ /* Wait re-association to finish. */ ++ condition_wait (&disk_cache_reassociation, &disk_cache_lock); ++ mutex_unlock (&disk_cache_lock); ++ ++#if 0 ++ printf ("Re-association -- wait finished.\n"); ++#endif ++ ++ /* Try again. */ ++ return disk_cache_block_ref (block); /* tail recursion */ ++ } ++ ++ /* Just increment reference and return. */ ++ assert (disk_cache_info[index].ref_count + 1 ++ > disk_cache_info[index].ref_count); ++ disk_cache_info[index].ref_count++; ++ ++ ext2_debug ("cached %u -> %d (ref_count = %d, flags = 0x%x, ptr = %p)", ++ disk_cache_info[index].block, index, ++ disk_cache_info[index].ref_count, ++ disk_cache_info[index].flags, bptr); ++ ++ mutex_unlock (&disk_cache_lock); ++ ++ return bptr; ++ } ++ ++ /* Search for a block that is not in core and is not referenced. */ ++ index = disk_cache_hint; ++ while ((disk_cache_info[index].flags & DC_DONT_REUSE) ++ || (disk_cache_info[index].ref_count)) ++ { ++ ext2_debug ("reject %u -> %d (ref_count = %d, flags = 0x%x)", ++ disk_cache_info[index].block, index, ++ disk_cache_info[index].ref_count, ++ disk_cache_info[index].flags); ++ ++ /* Just move to next block. */ ++ index++; ++ if (index >= disk_cache_blocks) ++ index -= disk_cache_blocks; ++ ++ /* If we return to where we started, than there is no suitable ++ block. */ ++ if (index == disk_cache_hint) ++ break; ++ } ++ ++ /* The next place in the disk cache becomes the current hint. */ ++ disk_cache_hint = index + 1; ++ if (disk_cache_hint >= disk_cache_blocks) ++ disk_cache_hint -= disk_cache_blocks; ++ ++ /* Is suitable place found? */ ++ if ((disk_cache_info[index].flags & DC_DONT_REUSE) ++ || disk_cache_info[index].ref_count) ++ /* No place is found. Try to release some blocks and try ++ again. */ ++ { ++ ext2_debug ("flush %u -> %d", disk_cache_info[index].block, index); ++ ++ mutex_unlock (&disk_cache_lock); ++ ++ disk_cache_return_unused (); ++ ++ return disk_cache_block_ref (block); /* tail recursion */ ++ } ++ ++ /* Suitable place is found. */ ++ ++ /* Calculate pointer to data. */ ++ bptr = (char *)disk_cache + (index << log2_block_size); ++ ext2_debug ("map %u -> %d (%p)", block, index, bptr); ++ ++ /* This pager_return_some is used only to set PM_FORCEREAD for the ++ page. DC_UNTOUCHED is set so that we catch if someone has ++ referenced the block while we didn't hold disk_cache_lock. */ ++ disk_cache_info[index].flags |= DC_UNTOUCHED; ++ ++#if 0 /* XXX: Let's see if this is needed at all. */ ++ ++ mutex_unlock (&disk_cache_lock); ++ pager_return_some (diskfs_disk_pager, bptr - disk_cache, vm_page_size, 1); ++ mutex_lock (&disk_cache_lock); ++ ++ /* Has someone used our bptr? Has someone mapped requested block ++ while we have unlocked disk_cache_lock? If so, environment has ++ changed and we have to restart operation. */ ++ if ((! (disk_cache_info[index].flags & DC_UNTOUCHED)) ++ || hurd_ihash_find (disk_cache_bptr, block)) ++ { ++ mutex_unlock (&disk_cache_lock); ++ return disk_cache_block_ref (block); /* tail recursion */ ++ } ++ ++#elif 0 ++ ++ /* XXX: Use libpager internals. */ ++ ++ mutex_lock (&diskfs_disk_pager->interlock); ++ int page = (bptr - disk_cache) / vm_page_size; ++ assert (page >= 0); ++ int is_incore = (page < diskfs_disk_pager->pagemapsize ++ && (diskfs_disk_pager->pagemap[page] & PM_INCORE)); ++ mutex_unlock (&diskfs_disk_pager->interlock); ++ if (is_incore) ++ { ++ mutex_unlock (&disk_cache_lock); ++ printf ("INCORE\n"); ++ return disk_cache_block_ref (block); /* tail recursion */ ++ } ++ ++#endif ++ ++ /* Re-associate. */ ++ if (disk_cache_info[index].block != DC_NO_BLOCK) ++ /* Remove old association. */ ++ hurd_ihash_remove (disk_cache_bptr, disk_cache_info[index].block); ++ /* New association. */ ++ if (hurd_ihash_add (disk_cache_bptr, block, bptr)) ++ ext2_panic ("Couldn't hurd_ihash_add new disk block"); ++ assert (! (disk_cache_info[index].flags & DC_DONT_REUSE & ~DC_UNTOUCHED)); ++ disk_cache_info[index].block = block; ++ assert (! disk_cache_info[index].ref_count); ++ disk_cache_info[index].ref_count = 1; ++ ++ /* All data structures are set up. */ ++ mutex_unlock (&disk_cache_lock); ++ ++ /* Try to read page. */ ++ *(volatile char *) bptr; ++ ++ /* Check if it's actually read. */ ++ mutex_lock (&disk_cache_lock); ++ if (disk_cache_info[index].flags & DC_UNTOUCHED) ++ /* It's not read. */ ++ { ++ /* Remove newly created association. */ ++ hurd_ihash_remove (disk_cache_bptr, block); ++ disk_cache_info[index].block = DC_NO_BLOCK; ++ disk_cache_info[index].flags &=~ DC_UNTOUCHED; ++ disk_cache_info[index].ref_count = 0; ++ mutex_unlock (&disk_cache_lock); ++ ++ /* Prepare next time association of this page to succeed. */ ++ pager_flush_some (diskfs_disk_pager, bptr - disk_cache, ++ vm_page_size, 0); ++ ++#if 0 ++ printf ("Re-association failed.\n"); ++#endif ++ ++ /* Try again. */ ++ return disk_cache_block_ref (block); /* tail recursion */ ++ } ++ mutex_unlock (&disk_cache_lock); ++ ++ /* Re-association was successful. */ ++ condition_broadcast (&disk_cache_reassociation); ++ ++ ext2_debug ("(%u) = %p", block, bptr); ++ return bptr; ++} ++ ++void ++disk_cache_block_ref_ptr (void *ptr) ++{ ++ int index; ++ ++ mutex_lock (&disk_cache_lock); ++ index = bptr_index (ptr); ++ assert (disk_cache_info[index].ref_count >= 1); ++ assert (disk_cache_info[index].ref_count + 1 ++ > disk_cache_info[index].ref_count); ++ disk_cache_info[index].ref_count++; ++ assert (! (disk_cache_info[index].flags & DC_UNTOUCHED)); ++ ext2_debug ("(%p) (ref_count = %d, flags = 0x%x)", ++ ptr, ++ disk_cache_info[index].ref_count, ++ disk_cache_info[index].flags); ++ mutex_unlock (&disk_cache_lock); ++} ++ ++void ++disk_cache_block_deref (void *ptr) ++{ ++ int index; ++ ++ assert (disk_cache <= ptr && ptr <= disk_cache + disk_cache_size); ++ ++ mutex_lock (&disk_cache_lock); ++ index = bptr_index (ptr); ++ ext2_debug ("(%p) (ref_count = %d, flags = 0x%x)", ++ ptr, ++ disk_cache_info[index].ref_count - 1, ++ disk_cache_info[index].flags); ++ assert (! (disk_cache_info[index].flags & DC_UNTOUCHED)); ++ assert (disk_cache_info[index].ref_count >= 1); ++ disk_cache_info[index].ref_count--; ++ mutex_unlock (&disk_cache_lock); ++} ++ ++/* Not used. */ ++int ++disk_cache_block_is_ref (block_t block) ++{ ++ int ref; ++ void *ptr; ++ ++ mutex_lock (&disk_cache_lock); ++ ptr = hurd_ihash_find (disk_cache_bptr, block); ++ if (! ptr) ++ ref = 0; ++ else /* XXX: Should check for DC_UNTOUCHED too. */ ++ ref = disk_cache_info[bptr_index (ptr)].ref_count; ++ mutex_unlock (&disk_cache_lock); ++ ++ return ref; ++} ++ + /* Create the DISK pager. */ + void + create_disk_pager (void) +@@ -774,8 +1197,12 @@ + ext2_panic ("can't create disk pager: %s", strerror (errno)); + upi->type = DISK; + pager_bucket = ports_create_bucket (); +- diskfs_start_disk_pager (upi, pager_bucket, MAY_CACHE, store->size, +- &disk_image); ++ get_hypermetadata (); ++ disk_cache_blocks = DISK_CACHE_BLOCKS; ++ disk_cache_size = disk_cache_blocks << log2_block_size; ++ diskfs_start_disk_pager (upi, pager_bucket, MAY_CACHE, 1, ++ disk_cache_size, &disk_cache); ++ disk_cache_init (); + } + + /* Call this to create a FILE_DATA pager and return a send right. +@@ -815,7 +1242,7 @@ + diskfs_nref_light (node); + node->dn->pager = + pager_create (upi, pager_bucket, MAY_CACHE, +- MEMORY_OBJECT_COPY_DELAY); ++ MEMORY_OBJECT_COPY_DELAY, 0); + if (node->dn->pager == 0) + { + diskfs_nrele_light (node); +Index: hurd-debian/ext2fs/pokel.c +=================================================================== +--- hurd-debian.orig/ext2fs/pokel.c 2012-07-10 01:33:10.000000000 +0000 ++++ hurd-debian/ext2fs/pokel.c 2012-07-10 01:39:22.000000000 +0000 +@@ -67,12 +67,27 @@ + vm_offset_t p_offs = pl->offset; + vm_size_t p_end = p_offs + pl->length; + +- if (p_offs == offset && p_end == end) +- break; ++ if (p_offs <= offset && end <= p_end) ++ { ++ if (pokel->image == disk_cache) ++ for (vm_offset_t i = offset; i < end; i += block_size) ++ disk_cache_block_deref (disk_cache + i); ++ ++ break; ++ } + else if (p_end >= offset && end >= p_offs) + { + pl->offset = offset < p_offs ? offset : p_offs; + pl->length = (end > p_end ? end : p_end) - pl->offset; ++ ++ if (pokel->image == disk_cache) ++ { ++ vm_offset_t i_begin = p_offs > offset ? p_offs : offset; ++ vm_offset_t i_end = p_end < end ? p_end : end; ++ for (vm_offset_t i = i_begin; i < i_end; i += block_size) ++ disk_cache_block_deref (disk_cache + i); ++ } ++ + ext2_debug ("extended 0x%x[%ul] to 0x%x[%ul]", + p_offs, p_end - p_offs, pl->offset, pl->length); + break; +@@ -106,18 +121,28 @@ + _pokel_exec (struct pokel *pokel, int sync, int wait) + { + struct poke *pl, *pokes, *last = NULL; +- ++ + pthread_spin_lock (&pokel->lock); + pokes = pokel->pokes; + pokel->pokes = NULL; + pthread_spin_unlock (&pokel->lock); + + for (pl = pokes; pl; last = pl, pl = pl->next) +- if (sync) +- { +- ext2_debug ("syncing 0x%x[%ul]", pl->offset, pl->length); +- pager_sync_some (pokel->pager, pl->offset, pl->length, wait); +- } ++ { ++ if (sync) ++ { ++ ext2_debug ("syncing 0x%x[%ul]", pl->offset, pl->length); ++ pager_sync_some (pokel->pager, pl->offset, pl->length, wait); ++ } ++ ++ if (pokel->image == disk_cache) ++ { ++ vm_offset_t begin = trunc_block (pl->offset); ++ vm_offset_t end = round_block (pl->offset + pl->length); ++ for (vm_offset_t i = begin; i != end; i += block_size) ++ disk_cache_block_deref (pokel->image + i); ++ } ++ } + + if (last) + { +Index: hurd-debian/ext2fs/truncate.c +=================================================================== +--- hurd-debian.orig/ext2fs/truncate.c 2012-07-10 01:33:10.000000000 +0000 ++++ hurd-debian/ext2fs/truncate.c 2012-07-10 01:39:22.000000000 +0000 +@@ -124,7 +124,7 @@ + { + unsigned index; + int modified = 0, all_freed = 1; +- block_t *ind_bh = (block_t *)bptr (*p); ++ block_t *ind_bh = (block_t *)disk_cache_block_ref (*p); + unsigned first = end < offset ? 0 : end - offset; + + for (index = first; index < addr_per_block; index++) +@@ -139,11 +139,16 @@ + + if (first == 0 && all_freed) + { +- pager_flush_some (diskfs_disk_pager, boffs (*p), block_size, 1); ++ pager_flush_some (diskfs_disk_pager, ++ bptr_index (ind_bh) << log2_block_size, ++ block_size, 1); + free_block_run_free_ptr (fbr, p); ++ disk_cache_block_deref (ind_bh); + } + else if (modified) + record_indir_poke (node, ind_bh); ++ else ++ disk_cache_block_deref (ind_bh); + } + } + +@@ -218,7 +223,7 @@ + /* Flush all the data past the new size from the kernel. Also force any + delayed copies of this data to take place immediately. (We are implicitly + changing the data to zeros and doing it without the kernel's immediate +- knowledge; accordingl we must help out the kernel thusly.) */ ++ knowledge; accordingly we must help out the kernel thusly.) */ + static void + force_delayed_copies (struct node *node, off_t length) + { +Index: hurd-debian/fatfs/pager.c +=================================================================== +--- hurd-debian.orig/fatfs/pager.c 2012-07-10 01:33:10.000000000 +0000 ++++ hurd-debian/fatfs/pager.c 2012-07-10 01:39:22.000000000 +0000 +@@ -596,6 +596,13 @@ + return 0; + } + ++void ++pager_notify_evict (struct user_pager_info *pager, ++ vm_offset_t page) ++{ ++ assert (!"unrequested notification on eviction"); ++} ++ + /* Grow the disk allocated to locked node NODE to be at least SIZE + bytes, and set NODE->allocsize to the actual allocated size. (If + the allocated size is already SIZE bytes, do nothing.) CRED +@@ -752,7 +759,7 @@ + struct user_pager_info *upi = malloc (sizeof (struct user_pager_info)); + upi->type = FAT; + pager_bucket = ports_create_bucket (); +- diskfs_start_disk_pager (upi, pager_bucket, MAY_CACHE, ++ diskfs_start_disk_pager (upi, pager_bucket, MAY_CACHE, 0, + bytes_per_sector * sectors_per_fat, + &fat_image); + } +@@ -794,7 +801,7 @@ + diskfs_nref_light (node); + node->dn->pager = + pager_create (upi, pager_bucket, MAY_CACHE, +- MEMORY_OBJECT_COPY_DELAY); ++ MEMORY_OBJECT_COPY_DELAY, 0); + if (node->dn->pager == 0) + { + diskfs_nrele_light (node); +Index: hurd-debian/isofs/pager.c +=================================================================== +--- hurd-debian.orig/isofs/pager.c 2012-07-10 01:33:10.000000000 +0000 ++++ hurd-debian/isofs/pager.c 2012-07-10 01:39:22.000000000 +0000 +@@ -94,6 +94,13 @@ + return EROFS; + } + ++void ++pager_notify_evict (struct user_pager_info *pager, ++ vm_offset_t page) ++{ ++ assert (!"unrequested notification on eviction"); ++} ++ + /* Tell how big the file is. */ + error_t + pager_report_extent (struct user_pager_info *pager, +@@ -137,7 +144,7 @@ + upi->type = DISK; + upi->np = 0; + pager_bucket = ports_create_bucket (); +- diskfs_start_disk_pager (upi, pager_bucket, 1, store->size, &disk_image); ++ diskfs_start_disk_pager (upi, pager_bucket, 1, 0, store->size, &disk_image); + upi->p = diskfs_disk_pager; + } + +@@ -168,7 +175,8 @@ + upi->type = FILE_DATA; + upi->np = np; + diskfs_nref_light (np); +- upi->p = pager_create (upi, pager_bucket, 1, MEMORY_OBJECT_COPY_DELAY); ++ upi->p = pager_create (upi, pager_bucket, 1, ++ MEMORY_OBJECT_COPY_DELAY, 0); + if (upi->p == 0) + { + diskfs_nrele_light (np); +Index: hurd-debian/libdiskfs/disk-pager.c +=================================================================== +--- hurd-debian.orig/libdiskfs/disk-pager.c 2012-07-10 01:33:11.000000000 +0000 ++++ hurd-debian/libdiskfs/disk-pager.c 2012-07-10 01:39:22.000000000 +0000 +@@ -46,7 +46,8 @@ + + void + diskfs_start_disk_pager (struct user_pager_info *upi, +- struct port_bucket *pager_bucket, int may_cache, ++ struct port_bucket *pager_bucket, ++ int may_cache, int notify_on_evict, + size_t size, void **image) + { + pthread_t thread; +@@ -68,7 +69,8 @@ + + /* Create the pager. */ + diskfs_disk_pager = pager_create (upi, pager_bucket, +- may_cache, MEMORY_OBJECT_COPY_NONE); ++ may_cache, MEMORY_OBJECT_COPY_NONE, ++ notify_on_evict); + assert (diskfs_disk_pager); + + /* Get a port to the disk pager. */ +Index: hurd-debian/libdiskfs/diskfs-pager.h +=================================================================== +--- hurd-debian.orig/libdiskfs/diskfs-pager.h 2012-07-10 01:33:11.000000000 +0000 ++++ hurd-debian/libdiskfs/diskfs-pager.h 2012-07-10 01:39:22.000000000 +0000 +@@ -33,7 +33,8 @@ + mapped is returned in IMAGE. INFO, PAGER_BUCKET, & MAY_CACHE are passed + to `pager_create'. */ + extern void diskfs_start_disk_pager (struct user_pager_info *info, +- struct port_bucket *pager_bucket, int may_cache, ++ struct port_bucket *pager_bucket, ++ int may_cache, int notify_on_evict, + size_t size, void **image); + + extern struct pager *diskfs_disk_pager; +Index: hurd-debian/libpager/data-request.c +=================================================================== +--- hurd-debian.orig/libpager/data-request.c 2012-11-26 00:23:28.000000000 +0000 ++++ hurd-debian/libpager/data-request.c 2012-11-26 00:24:49.000000000 +0000 +@@ -40,11 +40,11 @@ + if (!p) + return EOPNOTSUPP; + +- /* Acquire the right to meddle with the pagemap */ ++ /* Acquire the right to meddle with the pagemap. */ + pthread_mutex_lock (&p->interlock); + _pager_wait_for_seqno (p, seqno); + +- /* sanity checks -- we don't do multi-page requests yet. */ ++ /* Sanity checks -- we don't do multi-page requests yet. */ + if (control != p->memobjcntl) + { + printf ("incg data request: wrong control port\n"); +@@ -119,7 +119,8 @@ + goto error_read; + + memory_object_data_supply (p->memobjcntl, offset, page, length, 1, +- write_lock ? VM_PROT_WRITE : VM_PROT_NONE, 0, ++ write_lock ? VM_PROT_WRITE : VM_PROT_NONE, ++ p->notify_on_evict ? 1 : 0, + MACH_PORT_NULL); + pthread_mutex_lock (&p->interlock); + _pager_mark_object_error (p, offset, length, 0); +Index: hurd-debian/libpager/data-return.c +=================================================================== +--- hurd-debian.orig/libpager/data-return.c 2012-11-26 00:23:28.000000000 +0000 ++++ hurd-debian/libpager/data-return.c 2012-11-26 00:24:49.000000000 +0000 +@@ -39,6 +39,7 @@ + struct pager *p; + short *pm_entries; + int npages, i; ++ char *notified; + error_t *pagerrs; + struct lock_request *lr; + struct lock_list {struct lock_request *lr; +@@ -71,9 +72,6 @@ + goto release_out; + } + +- if (! dirty) +- goto release_out; +- + if (p->pager_state != NORMAL) + { + printf ("pager in wrong state for write\n"); +@@ -83,6 +81,11 @@ + npages = length / __vm_page_size; + pagerrs = alloca (npages * sizeof (error_t)); + ++ notified = alloca (npages * (sizeof *notified)); ++#ifndef NDEBUG ++ memset (notified, -1, npages * (sizeof *notified)); ++#endif ++ + _pager_block_termination (p); /* until we are done with the pagemap + when the write completes. */ + +@@ -90,6 +93,24 @@ + + pm_entries = &p->pagemap[offset / __vm_page_size]; + ++ if (! dirty) ++ { ++ munmap ((caddr_t) data, length); ++ if (!kcopy) { ++ /* Prepare notified array. */ ++ for (i = 0; i < npages; i++) ++ notified[i] = (p->notify_on_evict ++ && ! (pm_entries[i] & PM_PAGEINWAIT)); ++ ++ _pager_release_seqno (p, seqno); ++ goto notify; ++ } ++ else { ++ _pager_allow_termination (p); ++ goto release_out; ++ } ++ } ++ + /* Make sure there are no other in-progress writes for any of these + pages before we begin. This imposes a little more serialization + than we really have to require (because *all* future writes on +@@ -120,10 +141,6 @@ + for (i = 0; i < npages; i++) + pm_entries[i] |= PM_PAGINGOUT | PM_INIT; + +- if (!kcopy) +- for (i = 0; i < npages; i++) +- pm_entries[i] &= ~PM_INCORE; +- + /* If this write occurs while a lock is pending, record + it. We have to keep this list because a lock request + might come in while we do the I/O; in that case there +@@ -163,7 +180,10 @@ + for (i = 0; i < npages; i++) + { + if (omitdata & (1 << i)) +- continue; ++ { ++ notified[i] = 0; ++ continue; ++ } + + if (pm_entries[i] & PM_WRITEWAIT) + wakeup = 1; +@@ -179,14 +199,22 @@ + pm_entries[i] |= PM_INVALID; + + if (pm_entries[i] & PM_PAGEINWAIT) +- memory_object_data_supply (p->memobjcntl, +- offset + (vm_page_size * i), +- data + (vm_page_size * i), +- vm_page_size, 1, +- VM_PROT_NONE, 0, MACH_PORT_NULL); ++ { ++ memory_object_data_supply (p->memobjcntl, ++ offset + (vm_page_size * i), ++ data + (vm_page_size * i), ++ vm_page_size, 1, ++ VM_PROT_NONE, 0, MACH_PORT_NULL); ++ notified[i] = 0; ++ } + else +- munmap ((caddr_t) (data + (vm_page_size * i)), +- vm_page_size); ++ { ++ munmap ((caddr_t) (data + (vm_page_size * i)), ++ vm_page_size); ++ notified[i] = (! kcopy && p->notify_on_evict); ++ if (! kcopy) ++ pm_entries[i] &= ~PM_INCORE; ++ } + + pm_entries[i] &= ~(PM_PAGINGOUT | PM_PAGEINWAIT | PM_WRITEWAIT); + } +@@ -198,10 +226,29 @@ + if (wakeup) + pthread_cond_broadcast (&p->wakeup); + ++ notify: + _pager_allow_termination (p); +- + pthread_mutex_unlock (&p->interlock); + ++ for (i = 0; i < npages; i++) ++ { ++ assert (notified[i] == 0 || notified[i] == 1); ++ if (notified[i]) ++ { ++ short *pm_entry = &pm_entries[i]; ++ ++ /* Do notify user. */ ++ pager_notify_evict (p->upi, offset + (i * vm_page_size)); ++ ++ /* Clear any error that is left. Notification on eviction ++ is used only to change association of page, so any ++ error may no longer be valid. */ ++ mutex_lock (&p->interlock); ++ *pm_entry = SET_PM_ERROR (SET_PM_NEXTERROR (*pm_entry, 0), 0); ++ mutex_unlock (&p->interlock); ++ } ++ } ++ + ports_port_deref (p); + return 0; + +Index: hurd-debian/libpager/pager-create.c +=================================================================== +--- hurd-debian.orig/libpager/pager-create.c 2012-07-10 01:33:11.000000000 +0000 ++++ hurd-debian/libpager/pager-create.c 2012-07-10 01:39:22.000000000 +0000 +@@ -22,7 +22,8 @@ + pager_create (struct user_pager_info *upi, + struct port_bucket *bucket, + boolean_t may_cache, +- memory_object_copy_strategy_t copy_strategy) ++ memory_object_copy_strategy_t copy_strategy, ++ boolean_t notify_on_evict) + { + struct pager *p; + +@@ -38,6 +39,7 @@ + p->attribute_requests = 0; + p->may_cache = may_cache; + p->copy_strategy = copy_strategy; ++ p->notify_on_evict = notify_on_evict; + p->memobjcntl = MACH_PORT_NULL; + p->memobjname = MACH_PORT_NULL; + p->seqno = -1; +Index: hurd-debian/libpager/pager.h +=================================================================== +--- hurd-debian.orig/libpager/pager.h 2012-07-10 01:33:11.000000000 +0000 ++++ hurd-debian/libpager/pager.h 2012-07-10 01:39:22.000000000 +0000 +@@ -32,18 +32,21 @@ + mach_msg_header_t *outp); + + /* Create a new pager. The pager will have a port created for it +- (using libports, in BUCKET) and will be immediately ready +- to receive requests. U_PAGER will be provided to later calls to ++ (using libports, in BUCKET) and will be immediately ready to ++ receive requests. U_PAGER will be provided to later calls to + pager_find_address. The pager will have one user reference + created. MAY_CACHE and COPY_STRATEGY are the original values of +- those attributes as for memory_object_ready. Users may create +- references to pagers by use of the relevant ports library +- functions. On errors, return null and set errno. */ ++ those attributes as for memory_object_ready. If NOTIFY_ON_EVICT is ++ non-zero, pager_notify_evict user callback will be called when page ++ is evicted. Users may create references to pagers by use of the ++ relevant ports library functions. On errors, return null and set ++ errno. */ + struct pager * + pager_create (struct user_pager_info *u_pager, + struct port_bucket *bucket, + boolean_t may_cache, +- memory_object_copy_strategy_t copy_strategy); ++ memory_object_copy_strategy_t copy_strategy, ++ boolean_t notify_on_evict); + + /* Return the user_pager_info struct associated with a pager. */ + struct user_pager_info * +@@ -110,7 +113,7 @@ + /* Change the attributes of the memory object underlying pager PAGER. + Args MAY_CACHE and COPY_STRATEGY are as for + memory_object_change_atributes. Wait for the kernel to report completion +- off WAIT is set.*/ ++ iff WAIT is set. */ + void + pager_change_attributes (struct pager *pager, + boolean_t may_cache, +@@ -172,6 +175,18 @@ + pager_unlock_page (struct user_pager_info *pager, + vm_offset_t address); + ++/* The user must define this function. It is used when you want be ++ able to change association of pages to backing store. To use it, ++ pass non-zero value in NOTIFY_ON_EVICT when pager is created with ++ pager_create. You can change association of page only when ++ pager_notify_evict has been called and you haven't touched page ++ content after that. Note there is a possibility that a page is ++ evicted, but user is not notified about that. The user should be ++ able to handle this case. */ ++void ++pager_notify_evict (struct user_pager_info *pager, ++ vm_offset_t page); ++ + /* The user must define this function. It should report back (in + *OFFSET and *SIZE the minimum valid address the pager will accept + and the size of the object. */ +Index: hurd-debian/libpager/priv.h +=================================================================== +--- hurd-debian.orig/libpager/priv.h 2012-07-10 01:33:11.000000000 +0000 ++++ hurd-debian/libpager/priv.h 2012-07-10 01:39:22.000000000 +0000 +@@ -48,6 +48,7 @@ + + boolean_t may_cache; + memory_object_copy_strategy_t copy_strategy; ++ boolean_t notify_on_evict; + + /* Interface ports */ + memory_object_control_t memobjcntl; +Index: hurd-debian/storeio/pager.c +=================================================================== +--- hurd-debian.orig/storeio/pager.c 2012-07-10 01:33:12.000000000 +0000 ++++ hurd-debian/storeio/pager.c 2012-07-10 01:39:22.000000000 +0000 +@@ -109,6 +109,13 @@ + return 0; + } + ++void ++pager_notify_evict (struct user_pager_info *pager, ++ vm_offset_t page) ++{ ++ assert (!"unrequested notification on eviction"); ++} ++ + /* The user must define this function. It should report back (in + *OFFSET and *SIZE the minimum valid address the pager will accept + and the size of the object. */ +@@ -232,7 +239,7 @@ + { + dev->pager = + pager_create ((struct user_pager_info *)dev, pager_port_bucket, +- 1, MEMORY_OBJECT_COPY_DELAY); ++ 1, MEMORY_OBJECT_COPY_DELAY, 0); + if (dev->pager == NULL) + { + pthread_mutex_unlock (&dev->pager_lock); +Index: hurd-debian/tmpfs/pager-stubs.c +=================================================================== +--- hurd-debian.orig/tmpfs/pager-stubs.c 2012-11-26 00:23:28.000000000 +0000 ++++ hurd-debian/tmpfs/pager-stubs.c 2012-11-26 00:24:49.000000000 +0000 +@@ -57,6 +57,14 @@ + return EIEIO; + } + ++void ++pager_notify_evict (struct user_pager_info *pager, ++ vm_offset_t page) ++{ ++ abort(); ++} ++ ++ + /* The user must define this function. It should report back (in + *OFFSET and *SIZE the minimum valid address the pager will accept + and the size of the object. */ +Index: hurd-debian/ufs/pager.c +=================================================================== +--- hurd-debian.orig/ufs/pager.c 2012-07-10 01:33:12.000000000 +0000 ++++ hurd-debian/ufs/pager.c 2012-07-10 01:39:22.000000000 +0000 +@@ -425,6 +425,13 @@ + return err; + } + ++void ++pager_notify_evict (struct user_pager_info *pager, ++ vm_offset_t page) ++{ ++ assert (!"unrequested notification on eviction"); ++} ++ + /* Implement the pager_report_extent callback from the pager library. See + <hurd/pager.h> for the interface description. */ + inline error_t +@@ -477,7 +484,7 @@ + upi->type = DISK; + upi->np = 0; + pager_bucket = ports_create_bucket (); +- diskfs_start_disk_pager (upi, pager_bucket, MAY_CACHE, store->size, ++ diskfs_start_disk_pager (upi, pager_bucket, MAY_CACHE, 0, store->size, + &disk_image); + upi->p = diskfs_disk_pager; + } +@@ -570,7 +577,7 @@ + upi->unlocked_pagein_length = 0; + diskfs_nref_light (np); + upi->p = pager_create (upi, pager_bucket, +- MAY_CACHE, MEMORY_OBJECT_COPY_DELAY); ++ MAY_CACHE, MEMORY_OBJECT_COPY_DELAY, 0); + if (upi->p == 0) + { + diskfs_nrele_light (np); diff --git a/debian/patches/ext2fs_large_stores_pthread.patch b/debian/patches/ext2fs_large_stores_pthread.patch new file mode 100644 index 00000000..71f76a34 --- /dev/null +++ b/debian/patches/ext2fs_large_stores_pthread.patch @@ -0,0 +1,344 @@ +commit 93691ae1ae88c2d66d240b50e3ea5827f8a96c22 +Author: Richard Braun <rbraun@sceen.net> +Date: Mon Sep 3 22:19:16 2012 +0200 + + Move large storage patch to pthreads + +TODO: merge into ext2fs_large_stores.patch. + +Index: hurd-debian/ext2fs/ext2fs.h +=================================================================== +--- hurd-debian.orig/ext2fs/ext2fs.h 2012-11-26 00:24:49.000000000 +0000 ++++ hurd-debian/ext2fs/ext2fs.h 2012-11-26 00:24:58.000000000 +0000 +@@ -260,9 +260,9 @@ + /* Metadata about cached block. */ + extern struct disk_cache_info *disk_cache_info; + /* Lock for these mappings */ +-extern struct mutex disk_cache_lock; ++extern pthread_mutex_t disk_cache_lock; + /* Fired when a re-association is done. */ +-extern struct condition disk_cache_reassociation; ++extern pthread_cond_t disk_cache_reassociation; + + void *disk_cache_block_ref (block_t block); + void disk_cache_block_ref_ptr (void *ptr); +@@ -345,9 +345,9 @@ + boffs_ptr (off_t offset) + { + block_t block = boffs_block (offset); +- mutex_lock (&disk_cache_lock); ++ pthread_mutex_lock (&disk_cache_lock); + char *ptr = hurd_ihash_find (disk_cache_bptr, block); +- mutex_unlock (&disk_cache_lock); ++ pthread_mutex_unlock (&disk_cache_lock); + assert (ptr); + ptr += offset % block_size; + ext2_debug ("(%Ld) = %p", offset, ptr); +@@ -361,12 +361,12 @@ bptr_offs (void *ptr) + vm_offset_t mem_offset = (char *)ptr - (char *)disk_cache; + off_t offset; + assert (mem_offset < disk_cache_size); +- mutex_lock (&disk_cache_lock); ++ pthread_mutex_lock (&disk_cache_lock); + offset = (off_t) disk_cache_info[boffs_block (mem_offset)].block + << log2_block_size; + assert (offset || mem_offset < block_size); + offset += mem_offset % block_size; +- mutex_unlock (&disk_cache_lock); ++ pthread_mutex_unlock (&disk_cache_lock); + ext2_debug ("(%p) = %Ld", ptr, offset); + return offset; + } +diff --git a/ext2fs/pager.c b/ext2fs/pager.c +index 2bec88d..67c9922 100644 +--- a/ext2fs/pager.c ++++ b/ext2fs/pager.c +@@ -418,7 +418,7 @@ disk_pager_read_page (vm_offset_t page, void **buf, int *writelock) + size_t length = vm_page_size, read = 0; + store_offset_t offset = page, dev_end = store->size; + +- mutex_lock (&disk_cache_lock); ++ pthread_mutex_lock (&disk_cache_lock); + int index = offset >> log2_block_size; + offset = ((store_offset_t) disk_cache_info[index].block << log2_block_size) + + offset % block_size; +@@ -430,7 +430,7 @@ disk_pager_read_page (vm_offset_t page, void **buf, int *writelock) + = disk_cache_info[index].block ^ DISK_CACHE_LAST_READ_XOR; + #endif + ext2_debug ("(%Ld)", offset >> log2_block_size); +- mutex_unlock (&disk_cache_lock); ++ pthread_mutex_unlock (&disk_cache_lock); + + if (offset + vm_page_size > dev_end) + length = dev_end - offset; +@@ -454,7 +454,7 @@ disk_pager_write_page (vm_offset_t page, void *buf) + size_t length = vm_page_size, amount; + store_offset_t offset = page, dev_end = store->size; + +- mutex_lock (&disk_cache_lock); ++ pthread_mutex_lock (&disk_cache_lock); + int index = offset >> log2_block_size; + assert (disk_cache_info[index].block != DC_NO_BLOCK); + offset = ((store_offset_t) disk_cache_info[index].block << log2_block_size) +@@ -465,7 +465,7 @@ disk_pager_write_page (vm_offset_t page, void *buf) + assert (disk_cache_info[index].last_read + == disk_cache_info[index].block); + #endif +- mutex_unlock (&disk_cache_lock); ++ pthread_mutex_unlock (&disk_cache_lock); + + if (offset + vm_page_size > dev_end) + length = dev_end - offset; +@@ -526,9 +526,9 @@ disk_pager_notify_evict (vm_offset_t page) + + ext2_debug ("(block %u)", index); + +- mutex_lock (&disk_cache_lock); ++ pthread_mutex_lock (&disk_cache_lock); + disk_cache_info[index].flags &= ~DC_INCORE; +- mutex_unlock (&disk_cache_lock); ++ pthread_mutex_unlock (&disk_cache_lock); + } + + /* Satisfy a pager read request for either the disk pager or file pager +@@ -836,9 +836,9 @@ + /* Hint index for which cache block to reuse next. */ + int disk_cache_hint; + /* Lock for these structures. */ +-struct mutex disk_cache_lock; ++pthread_mutex_t disk_cache_lock; + /* Fired when a re-association is done. */ +-struct condition disk_cache_reassociation; ++pthread_cond_t disk_cache_reassociation; + + /* Finish mapping initialization. */ + static void +@@ -848,8 +848,8 @@ + ext2_panic ("Block size %d != vm_page_size %d", + block_size, vm_page_size); + +- mutex_init (&disk_cache_lock); +- condition_init (&disk_cache_reassociation); ++ pthread_mutex_init (&disk_cache_lock, NULL); ++ pthread_cond_init (&disk_cache_reassociation, NULL); + + /* Allocate space for block num -> in-memory pointer mapping. */ + if (hurd_ihash_create (&disk_cache_bptr, HURD_IHASH_NO_LOCP)) +@@ -905,7 +905,7 @@ + + /* Return unused pages that are in core. */ + int pending_begin = -1, pending_end = -1; +- mutex_lock (&disk_cache_lock); ++ pthread_mutex_lock (&disk_cache_lock); + for (index = 0; index < disk_cache_blocks; index++) + if (! (disk_cache_info[index].flags & (DC_DONT_REUSE & ~DC_INCORE)) + && ! disk_cache_info[index].ref_count) +@@ -916,13 +916,13 @@ disk_cache_return_unused (void) + /* Return previous region, if there is such, ... */ + if (pending_end >= 0) + { +- mutex_unlock (&disk_cache_lock); ++ pthread_mutex_unlock (&disk_cache_lock); + pager_return_some (diskfs_disk_pager, + pending_begin * vm_page_size, + (pending_end - pending_begin) + * vm_page_size, + 1); +- mutex_lock (&disk_cache_lock); ++ pthread_mutex_lock (&disk_cache_lock); + } + /* ... and start new region. */ + pending_begin = index; +@@ -930,7 +930,7 @@ disk_cache_return_unused (void) + pending_end = index + 1; + } + +- mutex_unlock (&disk_cache_lock); ++ pthread_mutex_unlock (&disk_cache_lock); + + /* Return last region, if there is such. */ + if (pending_end >= 0) +@@ -958,7 +958,7 @@ disk_cache_block_ref (block_t block) + + ext2_debug ("(%u)", block); + +- mutex_lock (&disk_cache_lock); ++ pthread_mutex_lock (&disk_cache_lock); + + bptr = hurd_ihash_find (disk_cache_bptr, block); + if (bptr) +@@ -971,8 +971,8 @@ + if (disk_cache_info[index].flags & DC_UNTOUCHED) + { + /* Wait re-association to finish. */ +- condition_wait (&disk_cache_reassociation, &disk_cache_lock); +- mutex_unlock (&disk_cache_lock); ++ pthread_cond_wait (&disk_cache_reassociation, &disk_cache_lock); ++ pthread_mutex_unlock (&disk_cache_lock); + + #if 0 + printf ("Re-association -- wait finished.\n"); +@@ -992,7 +992,7 @@ + disk_cache_info[index].ref_count, + disk_cache_info[index].flags, bptr); + +- mutex_unlock (&disk_cache_lock); ++ pthread_mutex_unlock (&disk_cache_lock); + + return bptr; + } +@@ -1030,7 +1030,7 @@ disk_cache_block_ref (block_t block) + { + ext2_debug ("flush %u -> %d", disk_cache_info[index].block, index); + +- mutex_unlock (&disk_cache_lock); ++ pthread_mutex_unlock (&disk_cache_lock); + + disk_cache_return_unused (); + +@@ -1050,9 +1050,9 @@ disk_cache_block_ref (block_t block) + + #if 0 /* XXX: Let's see if this is needed at all. */ + +- mutex_unlock (&disk_cache_lock); ++ pthread_mutex_unlock (&disk_cache_lock); + pager_return_some (diskfs_disk_pager, bptr - disk_cache, vm_page_size, 1); +- mutex_lock (&disk_cache_lock); ++ pthread_mutex_lock (&disk_cache_lock); + + /* Has someone used our bptr? Has someone mapped requested block + while we have unlocked disk_cache_lock? If so, environment has +@@ -1060,7 +1060,7 @@ disk_cache_block_ref (block_t block) + if ((! (disk_cache_info[index].flags & DC_UNTOUCHED)) + || hurd_ihash_find (disk_cache_bptr, block)) + { +- mutex_unlock (&disk_cache_lock); ++ pthread_mutex_unlock (&disk_cache_lock); + return disk_cache_block_ref (block); /* tail recursion */ + } + +@@ -1068,15 +1068,15 @@ disk_cache_block_ref (block_t block) + + /* XXX: Use libpager internals. */ + +- mutex_lock (&diskfs_disk_pager->interlock); ++ pthread_mutex_lock (&diskfs_disk_pager->interlock); + int page = (bptr - disk_cache) / vm_page_size; + assert (page >= 0); + int is_incore = (page < diskfs_disk_pager->pagemapsize + && (diskfs_disk_pager->pagemap[page] & PM_INCORE)); +- mutex_unlock (&diskfs_disk_pager->interlock); ++ pthread_mutex_unlock (&diskfs_disk_pager->interlock); + if (is_incore) + { +- mutex_unlock (&disk_cache_lock); ++ pthread_mutex_unlock (&disk_cache_lock); + printf ("INCORE\n"); + return disk_cache_block_ref (block); /* tail recursion */ + } +@@ -1096,13 +1096,13 @@ disk_cache_block_ref (block_t block) + disk_cache_info[index].ref_count = 1; + + /* All data structures are set up. */ +- mutex_unlock (&disk_cache_lock); ++ pthread_mutex_unlock (&disk_cache_lock); + + /* Try to read page. */ + *(volatile char *) bptr; + + /* Check if it's actually read. */ +- mutex_lock (&disk_cache_lock); ++ pthread_mutex_lock (&disk_cache_lock); + if (disk_cache_info[index].flags & DC_UNTOUCHED) + /* It's not read. */ + { +@@ -1111,7 +1111,7 @@ disk_cache_block_ref (block_t block) + disk_cache_info[index].block = DC_NO_BLOCK; + disk_cache_info[index].flags &=~ DC_UNTOUCHED; + disk_cache_info[index].ref_count = 0; +- mutex_unlock (&disk_cache_lock); ++ pthread_mutex_unlock (&disk_cache_lock); + + /* Prepare next time association of this page to succeed. */ + pager_flush_some (diskfs_disk_pager, bptr - disk_cache, +@@ -1124,10 +1124,10 @@ disk_cache_block_ref (block_t block) + /* Try again. */ + return disk_cache_block_ref (block); /* tail recursion */ + } +- mutex_unlock (&disk_cache_lock); ++ pthread_mutex_unlock (&disk_cache_lock); + + /* Re-association was successful. */ +- condition_broadcast (&disk_cache_reassociation); ++ pthread_cond_broadcast (&disk_cache_reassociation); + + ext2_debug ("(%u) = %p", block, bptr); + return bptr; +@@ -1139,7 +1139,7 @@ + { + int index; + +- mutex_lock (&disk_cache_lock); ++ pthread_mutex_lock (&disk_cache_lock); + index = bptr_index (ptr); + assert (disk_cache_info[index].ref_count >= 1); + assert (disk_cache_info[index].ref_count + 1 +@@ -1149,7 +1149,7 @@ disk_cache_block_ref_ptr (void *ptr) + ptr, + disk_cache_info[index].ref_count, + disk_cache_info[index].flags); +- mutex_unlock (&disk_cache_lock); ++ pthread_mutex_unlock (&disk_cache_lock); + } + + void +@@ -1159,7 +1159,7 @@ disk_cache_block_deref (void *ptr) + + assert (disk_cache <= ptr && ptr <= disk_cache + disk_cache_size); + +- mutex_lock (&disk_cache_lock); ++ pthread_mutex_lock (&disk_cache_lock); + index = bptr_index (ptr); + ext2_debug ("(%p) (ref_count = %d, flags = 0x%x)", + ptr, +@@ -1168,7 +1168,7 @@ disk_cache_block_deref (void *ptr) + assert (! (disk_cache_info[index].flags & DC_UNTOUCHED)); + assert (disk_cache_info[index].ref_count >= 1); + disk_cache_info[index].ref_count--; +- mutex_unlock (&disk_cache_lock); ++ pthread_mutex_unlock (&disk_cache_lock); + } + + /* Not used. */ +@@ -1179,13 +1179,13 @@ disk_cache_block_is_ref (block_t block) + int ref; + void *ptr; + +- mutex_lock (&disk_cache_lock); ++ pthread_mutex_lock (&disk_cache_lock); + ptr = hurd_ihash_find (disk_cache_bptr, block); + if (! ptr) + ref = 0; + else /* XXX: Should check for DC_UNTOUCHED too. */ + ref = disk_cache_info[bptr_index (ptr)].ref_count; +- mutex_unlock (&disk_cache_lock); ++ pthread_mutex_unlock (&disk_cache_lock); + + return ref; + } +diff --git a/libpager/data-return.c b/libpager/data-return.c +index 24533e7..0d71db7 100644 +--- a/libpager/data-return.c ++++ b/libpager/data-return.c +@@ -243,9 +243,9 @@ _pager_do_write_request (mach_port_t object, + /* Clear any error that is left. Notification on eviction + is used only to change association of page, so any + error may no longer be valid. */ +- mutex_lock (&p->interlock); ++ pthread_mutex_lock (&p->interlock); + *pm_entry = SET_PM_ERROR (SET_PM_NEXTERROR (*pm_entry, 0), 0); +- mutex_unlock (&p->interlock); ++ pthread_mutex_unlock (&p->interlock); + } + } + diff --git a/debian/patches/external.patch b/debian/patches/external.patch new file mode 100644 index 00000000..0b933712 --- /dev/null +++ b/debian/patches/external.patch @@ -0,0 +1,114 @@ +Include procfs, random, and DDE in the build + +Index: hurd-debian/Makefile +=================================================================== +--- hurd-debian.orig/Makefile 2010-09-27 19:42:53.000000000 +0000 ++++ hurd-debian/Makefile 2010-09-27 19:45:57.000000000 +0000 +@@ -31,7 +31,8 @@ + # Hurd libraries + lib-subdirs = libshouldbeinlibc libihash libiohelp libports libthreads \ + libpager libfshelp libdiskfs libtrivfs libps \ +- libnetfs libpipe libstore libhurdbugaddr libftpconn libcons ++ libnetfs libpipe libstore libhurdbugaddr libftpconn libcons \ ++ libmachdev libbpf libddekit libhurd-slab + + # Hurd programs + prog-subdirs = auth proc exec init term \ +@@ -40,7 +41,7 @@ + login daemons boot console \ + hostmux usermux ftpfs trans \ + console-client utils sutils ufs-fsck ufs-utils \ +- benchmarks fstests ++ benchmarks fstests procfs random devnode + + ifeq ($(HAVE_SUN_RPC),yes) + prog-subdirs += nfs nfsd +--- hurd-debian.orig/Makeconf ++++ hurd-debian/Makeconf +@@ -548,7 +548,7 @@ vpath %.defs $(top_srcdir)/hurd + # These we want to find in the libc include directory... + mach_defs_names = bootstrap exc mach mach4 \ + mach_host mach_port mach_timer_reply memory_object \ +- memory_object_default notify ++ memory_object_default notify experimental + device_defs_names = dev_forward device device_reply device_request + + mach_defs = $(addsuffix .defs,$(mach_defs_names)) +diff --git a/configure.ac b/configure.ac +index 05b959b..68ec159 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -227,6 +227,12 @@ AC_SUBST(boot_store_types)dnl + AC_MSG_CHECKING(boot store types) + AC_MSG_RESULT($boot_store_types) + ++AC_CHECK_LIB(pciaccess, pci_system_init, LIBPCIACCESS=-lpciaccess, LIBPCIACCESS=no) ++AC_SUBST(LIBPCIACCESS) ++if test "$LIBPCIACCESS" = "no"; then ++ AC_MSG_ERROR([libpciaccess must be install in order to use libddekit]) ++fi ++ + # Check for ncursesw, which is needed for the console-curses client. + hurd_LIB_NCURSESW + +Index: hurd-debian/procfs/Makefile +=================================================================== +--- hurd-debian.orig/procfs/Makefile 2012-11-26 00:23:22.000000000 +0000 ++++ hurd-debian/procfs/Makefile 2012-11-26 00:25:35.000000000 +0000 +@@ -1,26 +1,31 @@ +-TARGET = procfs +-OBJS = procfs.o netfs.o procfs_dir.o \ +- process.o proclist.o rootdir.o dircat.o main.o +-LIBS = -lnetfs -lps -lfshelp -lpthread ++# Makefile - for procfs ++# ++# Copyright (C) 2008 Free Software Foundation, Inc. ++# ++# This program is free software; you can redistribute it and/or ++# modify it under the terms of the GNU General Public License as ++# published by the Free Software Foundation; either version 2, 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. ++ ++dir := procfs ++makemode := server ++ ++target = procfs ++ ++SRCS = procfs.c netfs.c procfs_dir.c process.c proclist.c rootdir.c dircat.c main.c ++LCLHDRS = dircat.h main.h process.h procfs.h procfs_dir.h proclist.h rootdir.h ++ ++OBJS = $(SRCS:.c=.o) ++HURDLIBS = netfs fshelp iohelp ps ports ihash shouldbeinlibc ++OTHERLIBS = -lpthread + +-CC = gcc +-CFLAGS = -Wall -g +-CPPFLAGS = +-LDFLAGS = +- +-ifdef PROFILE +-CFLAGS= -g -pg +-CPPFLAGS= -DPROFILE +-LDFLAGS= -static +-LIBS= -lnetfs -lfshelp -liohelp -lps -lports -lpthread -lihash -lshouldbeinlibc +-endif +- +-CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 +- +-all: $(TARGET) +- +-$(TARGET): $(OBJS) +- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) +- +-clean: +- $(RM) $(TARGET) $(OBJS) ++include ../Makeconf diff --git a/debian/patches/hurd_console_startup.patch b/debian/patches/hurd_console_startup.patch new file mode 100644 index 00000000..8e9301c8 --- /dev/null +++ b/debian/patches/hurd_console_startup.patch @@ -0,0 +1,32 @@ +Automatically startup the hurd console when enabled. +--- + daemons/runsystem.sh | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/daemons/runsystem.sh ++++ b/daemons/runsystem.sh +@@ -127,10 +127,24 @@ while : ; do + trap "kill -$sig \${runttys_pid}" $sig + done + ++ # Touch the first tty so that the Hurd console is certain to pick it ++ # and not some random other tty. ++ touch /dev/tty1 ++ + # This program reads /etc/ttys and starts the programs it says to. + ${RUNTTYS} & + runttys_pid=$! + ++ # Startup the Hurd console if configured. ++ if [ -e /etc/default/hurd-console ]; then ++ unset DISPLAY KBD KBD_REPEAT MOUSE MOUSE_REPEAT SPEAKER ++ . /etc/default/hurd-console ++ fi ++ if [ "$ENABLE" = "true" ]; then ++ console ${DISPLAY} ${KBD} ${KBD_REPEAT} \ ++ ${SPEAKER} ${MOUSE} ${MOUSE_REPEAT} -d current_vcs -c /dev/vcs ++ fi ++ + # Wait for runttys to die, meanwhile handling trapped signals. + wait + diff --git a/debian/patches/init_try_runsystem.gnu.patch b/debian/patches/init_try_runsystem.gnu.patch new file mode 100644 index 00000000..a8389b23 --- /dev/null +++ b/debian/patches/init_try_runsystem.gnu.patch @@ -0,0 +1,19 @@ +Also try runsystem.gnu + +--- + daemons/console-run.c | 7 +++++++ + init/init.c | 24 ++++++++++++++++++++---- + 2 files changed, 27 insertions(+), 4 deletions(-) + +Index: hurd-debian/init/init.c +=================================================================== +--- hurd-debian.orig/init/init.c 2012-11-26 00:23:25.000000000 +0000 ++++ hurd-debian/init/init.c 2012-11-26 00:25:06.000000000 +0000 +@@ -1087,6 +1087,7 @@ + static const char *const tries[] = + { + "/libexec/runsystem", ++ "/libexec/runsystem.gnu", + _PATH_BSHELL, + "/bin/shd", /* XXX */ + }; diff --git a/debian/patches/libdde_addr_fix.patch b/debian/patches/libdde_addr_fix.patch new file mode 100644 index 00000000..7d6af794 --- /dev/null +++ b/debian/patches/libdde_addr_fix.patch @@ -0,0 +1,37 @@ +commit 0c27922e4933ceb86644f4a9b1af212ffe5aad75 +Author: Eric Dumazet <eric.dumazet@gmail.com> +Date: Mon Jun 8 03:49:24 2009 +0000 + + net: dev_addr_init() fix + + commit f001fde5eadd915f4858d22ed70d7040f48767cf + (net: introduce a list of device addresses dev_addr_list (v6)) + added one regression Vegard Nossum found in its testings. + + With kmemcheck help, Vegard found some uninitialized memory + was read and reported to user, potentialy leaking kernel data. + ( thread can be found on http://lkml.org/lkml/2009/5/30/177 ) + + dev_addr_init() incorrectly uses sizeof() operator. We were + initializing one byte instead of MAX_ADDR_LEN bytes. + + Reported-by: Vegard Nossum <vegard.nossum@gmail.com> + Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> + Acked-by: Jiri Pirko <jpirko@redhat.com> + Signed-off-by: David S. Miller <davem@davemloft.net> + +diff --git a/net/core/dev.c b/net/core/dev.c +index 4913089..81b392e 100644 +--- a/libdde_linux26/lib/src/net/core/dev.c ++++ b/libdde_linux26/lib/src/net/core/dev.c +@@ -3577,8 +3577,8 @@ static int dev_addr_init(struct net_device *dev) + /* rtnl_mutex must be held here */ + + INIT_LIST_HEAD(&dev->dev_addr_list); +- memset(addr, 0, sizeof(*addr)); +- err = __hw_addr_add(&dev->dev_addr_list, NULL, addr, sizeof(*addr), ++ memset(addr, 0, sizeof(addr)); ++ err = __hw_addr_add(&dev->dev_addr_list, NULL, addr, sizeof(addr), + NETDEV_HW_ADDR_T_LAN); + if (!err) { + /* diff --git a/debian/patches/libdde_addr_list.patch b/debian/patches/libdde_addr_list.patch new file mode 100644 index 00000000..c1b4d96d --- /dev/null +++ b/debian/patches/libdde_addr_list.patch @@ -0,0 +1,423 @@ +commit f001fde5eadd915f4858d22ed70d7040f48767cf +Author: Jiri Pirko <jpirko@redhat.com> +Date: Tue May 5 02:48:28 2009 +0000 + + net: introduce a list of device addresses dev_addr_list (v6) + + v5 -> v6 (current): + -removed so far unused static functions + -corrected dev_addr_del_multiple to call del instead of add + + v4 -> v5: + -added device address type (suggested by davem) + -removed refcounting (better to have simplier code then safe potentially few + bytes) + + v3 -> v4: + -changed kzalloc to kmalloc in __hw_addr_add_ii() + -ASSERT_RTNL() avoided in dev_addr_flush() and dev_addr_init() + + v2 -> v3: + -removed unnecessary rcu read locking + -moved dev_addr_flush() calling to ensure no null dereference of dev_addr + + v1 -> v2: + -added forgotten ASSERT_RTNL to dev_addr_init and dev_addr_flush + -removed unnecessary rcu_read locking in dev_addr_init + -use compare_ether_addr_64bits instead of compare_ether_addr + -use L1_CACHE_BYTES as size for allocating struct netdev_hw_addr + -use call_rcu instead of rcu_synchronize + -moved is_etherdev_addr into __KERNEL__ ifdef + + This patch introduces a new list in struct net_device and brings a set of + functions to handle the work with device address list. The list is a replacement + for the original dev_addr field and because in some situations there is need to + carry several device addresses with the net device. To be backward compatible, + dev_addr is made to point to the first member of the list so original drivers + sees no difference. + + Signed-off-by: Jiri Pirko <jpirko@redhat.com> + Signed-off-by: David S. Miller <davem@davemloft.net> + +Index: hurd-debian/libdde_linux26/contrib/include/linux/etherdevice.h +=================================================================== +--- hurd-debian.orig/libdde_linux26/contrib/include/linux/etherdevice.h 2012-04-16 00:26:43.000000000 +0000 ++++ hurd-debian/libdde_linux26/contrib/include/linux/etherdevice.h 2012-04-16 00:34:43.000000000 +0000 +@@ -182,6 +182,33 @@ + return compare_ether_addr(addr1, addr2); + #endif + } ++ ++/** ++ * is_etherdev_addr - Tell if given Ethernet address belongs to the device. ++ * @dev: Pointer to a device structure ++ * @addr: Pointer to a six-byte array containing the Ethernet address ++ * ++ * Compare passed address with all addresses of the device. Return true if the ++ * address if one of the device addresses. ++ * ++ * Note that this function calls compare_ether_addr_64bits() so take care of ++ * the right padding. ++ */ ++static inline bool is_etherdev_addr(const struct net_device *dev, ++ const u8 addr[6 + 2]) ++{ ++ struct netdev_hw_addr *ha; ++ int res = 1; ++ ++ rcu_read_lock(); ++ for_each_dev_addr(dev, ha) { ++ res = compare_ether_addr_64bits(addr, ha->addr); ++ if (!res) ++ break; ++ } ++ rcu_read_unlock(); ++ return !res; ++} + #endif /* __KERNEL__ */ + + #endif /* _LINUX_ETHERDEVICE_H */ +Index: hurd-debian/libdde_linux26/contrib/include/linux/netdevice.h +=================================================================== +--- hurd-debian.orig/libdde_linux26/contrib/include/linux/netdevice.h 2012-04-16 00:33:34.000000000 +0000 ++++ hurd-debian/libdde_linux26/contrib/include/linux/netdevice.h 2012-04-16 00:34:43.000000000 +0000 +@@ -211,6 +211,16 @@ + #define dmi_users da_users + #define dmi_gusers da_gusers + ++struct netdev_hw_addr { ++ struct list_head list; ++ unsigned char addr[MAX_ADDR_LEN]; ++ unsigned char type; ++#define NETDEV_HW_ADDR_T_LAN 1 ++#define NETDEV_HW_ADDR_T_SAN 2 ++#define NETDEV_HW_ADDR_T_SLAVE 3 ++ struct rcu_head rcu_head; ++}; ++ + struct hh_cache + { + struct hh_cache *hh_next; /* Next entry */ +@@ -757,8 +767,11 @@ + */ + unsigned long last_rx; /* Time of last Rx */ + /* Interface address info used in eth_type_trans() */ +- unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast +- because most packets are unicast) */ ++ unsigned char *dev_addr; /* hw address, (before bcast ++ because most packets are ++ unicast) */ ++ ++ struct list_head dev_addr_list; /* list of device hw addresses */ + + unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ + +@@ -1768,6 +1781,13 @@ + spin_unlock_bh(&dev->addr_list_lock); + } + ++/* ++ * dev_addr_list walker. Should be used only for read access. Call with ++ * rcu_read_lock held. ++ */ ++#define for_each_dev_addr(dev, ha) \ ++ list_for_each_entry_rcu(ha, &dev->dev_addr_list, list) ++ + /* These functions live elsewhere (drivers/net/net_init.c, but related) */ + + extern void ether_setup(struct net_device *dev); +@@ -1780,6 +1800,19 @@ + alloc_netdev_mq(sizeof_priv, name, setup, 1) + extern int register_netdev(struct net_device *dev); + extern void unregister_netdev(struct net_device *dev); ++ ++/* Functions used for device addresses handling */ ++extern int dev_addr_add(struct net_device *dev, unsigned char *addr, ++ unsigned char addr_type); ++extern int dev_addr_del(struct net_device *dev, unsigned char *addr, ++ unsigned char addr_type); ++extern int dev_addr_add_multiple(struct net_device *to_dev, ++ struct net_device *from_dev, ++ unsigned char addr_type); ++extern int dev_addr_del_multiple(struct net_device *to_dev, ++ struct net_device *from_dev, ++ unsigned char addr_type); ++ + /* Functions used for secondary unicast and multicast support */ + extern void dev_set_rx_mode(struct net_device *dev); + extern void __dev_set_rx_mode(struct net_device *dev); +Index: hurd-debian/libdde_linux26/lib/src/net/core/dev.c +=================================================================== +--- hurd-debian.orig/libdde_linux26/lib/src/net/core/dev.c 2012-04-16 00:26:43.000000000 +0000 ++++ hurd-debian/libdde_linux26/lib/src/net/core/dev.c 2012-04-16 00:34:43.000000000 +0000 +@@ -3397,6 +3397,252 @@ + netif_addr_unlock_bh(dev); + } + ++/* hw addresses list handling functions */ ++ ++static int __hw_addr_add(struct list_head *list, unsigned char *addr, ++ int addr_len, unsigned char addr_type) ++{ ++ struct netdev_hw_addr *ha; ++ int alloc_size; ++ ++ if (addr_len > MAX_ADDR_LEN) ++ return -EINVAL; ++ ++ alloc_size = sizeof(*ha); ++ if (alloc_size < L1_CACHE_BYTES) ++ alloc_size = L1_CACHE_BYTES; ++ ha = kmalloc(alloc_size, GFP_ATOMIC); ++ if (!ha) ++ return -ENOMEM; ++ memcpy(ha->addr, addr, addr_len); ++ ha->type = addr_type; ++ list_add_tail_rcu(&ha->list, list); ++ return 0; ++} ++ ++static void ha_rcu_free(struct rcu_head *head) ++{ ++ struct netdev_hw_addr *ha; ++ ++ ha = container_of(head, struct netdev_hw_addr, rcu_head); ++ kfree(ha); ++} ++ ++static int __hw_addr_del_ii(struct list_head *list, unsigned char *addr, ++ int addr_len, unsigned char addr_type, ++ int ignore_index) ++{ ++ struct netdev_hw_addr *ha; ++ int i = 0; ++ ++ list_for_each_entry(ha, list, list) { ++ if (i++ != ignore_index && ++ !memcmp(ha->addr, addr, addr_len) && ++ (ha->type == addr_type || !addr_type)) { ++ list_del_rcu(&ha->list); ++ call_rcu(&ha->rcu_head, ha_rcu_free); ++ return 0; ++ } ++ } ++ return -ENOENT; ++} ++ ++static int __hw_addr_add_multiple_ii(struct list_head *to_list, ++ struct list_head *from_list, ++ int addr_len, unsigned char addr_type, ++ int ignore_index) ++{ ++ int err; ++ struct netdev_hw_addr *ha, *ha2; ++ unsigned char type; ++ ++ list_for_each_entry(ha, from_list, list) { ++ type = addr_type ? addr_type : ha->type; ++ err = __hw_addr_add(to_list, ha->addr, addr_len, type); ++ if (err) ++ goto unroll; ++ } ++ return 0; ++ ++unroll: ++ list_for_each_entry(ha2, from_list, list) { ++ if (ha2 == ha) ++ break; ++ type = addr_type ? addr_type : ha2->type; ++ __hw_addr_del_ii(to_list, ha2->addr, addr_len, type, ++ ignore_index); ++ } ++ return err; ++} ++ ++static void __hw_addr_del_multiple_ii(struct list_head *to_list, ++ struct list_head *from_list, ++ int addr_len, unsigned char addr_type, ++ int ignore_index) ++{ ++ struct netdev_hw_addr *ha; ++ unsigned char type; ++ ++ list_for_each_entry(ha, from_list, list) { ++ type = addr_type ? addr_type : ha->type; ++ __hw_addr_del_ii(to_list, ha->addr, addr_len, addr_type, ++ ignore_index); ++ } ++} ++ ++static void __hw_addr_flush(struct list_head *list) ++{ ++ struct netdev_hw_addr *ha, *tmp; ++ ++ list_for_each_entry_safe(ha, tmp, list, list) { ++ list_del_rcu(&ha->list); ++ call_rcu(&ha->rcu_head, ha_rcu_free); ++ } ++} ++ ++/* Device addresses handling functions */ ++ ++static void dev_addr_flush(struct net_device *dev) ++{ ++ /* rtnl_mutex must be held here */ ++ ++ __hw_addr_flush(&dev->dev_addr_list); ++ dev->dev_addr = NULL; ++} ++ ++static int dev_addr_init(struct net_device *dev) ++{ ++ unsigned char addr[MAX_ADDR_LEN]; ++ struct netdev_hw_addr *ha; ++ int err; ++ ++ /* rtnl_mutex must be held here */ ++ ++ INIT_LIST_HEAD(&dev->dev_addr_list); ++ memset(addr, 0, sizeof(*addr)); ++ err = __hw_addr_add(&dev->dev_addr_list, addr, sizeof(*addr), ++ NETDEV_HW_ADDR_T_LAN); ++ if (!err) { ++ /* ++ * Get the first (previously created) address from the list ++ * and set dev_addr pointer to this location. ++ */ ++ ha = list_first_entry(&dev->dev_addr_list, ++ struct netdev_hw_addr, list); ++ dev->dev_addr = ha->addr; ++ } ++ return err; ++} ++ ++/** ++ * dev_addr_add - Add a device address ++ * @dev: device ++ * @addr: address to add ++ * @addr_type: address type ++ * ++ * Add a device address to the device or increase the reference count if ++ * it already exists. ++ * ++ * The caller must hold the rtnl_mutex. ++ */ ++int dev_addr_add(struct net_device *dev, unsigned char *addr, ++ unsigned char addr_type) ++{ ++ int err; ++ ++ ASSERT_RTNL(); ++ ++ err = __hw_addr_add(&dev->dev_addr_list, addr, dev->addr_len, ++ addr_type); ++ if (!err) ++ call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); ++ return err; ++} ++EXPORT_SYMBOL(dev_addr_add); ++ ++/** ++ * dev_addr_del - Release a device address. ++ * @dev: device ++ * @addr: address to delete ++ * @addr_type: address type ++ * ++ * Release reference to a device address and remove it from the device ++ * if the reference count drops to zero. ++ * ++ * The caller must hold the rtnl_mutex. ++ */ ++int dev_addr_del(struct net_device *dev, unsigned char *addr, ++ unsigned char addr_type) ++{ ++ int err; ++ ++ ASSERT_RTNL(); ++ ++ err = __hw_addr_del_ii(&dev->dev_addr_list, addr, dev->addr_len, ++ addr_type, 0); ++ if (!err) ++ call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); ++ return err; ++} ++EXPORT_SYMBOL(dev_addr_del); ++ ++/** ++ * dev_addr_add_multiple - Add device addresses from another device ++ * @to_dev: device to which addresses will be added ++ * @from_dev: device from which addresses will be added ++ * @addr_type: address type - 0 means type will be used from from_dev ++ * ++ * Add device addresses of the one device to another. ++ ** ++ * The caller must hold the rtnl_mutex. ++ */ ++int dev_addr_add_multiple(struct net_device *to_dev, ++ struct net_device *from_dev, ++ unsigned char addr_type) ++{ ++ int err; ++ ++ ASSERT_RTNL(); ++ ++ if (from_dev->addr_len != to_dev->addr_len) ++ return -EINVAL; ++ err = __hw_addr_add_multiple_ii(&to_dev->dev_addr_list, ++ &from_dev->dev_addr_list, ++ to_dev->addr_len, addr_type, 0); ++ if (!err) ++ call_netdevice_notifiers(NETDEV_CHANGEADDR, to_dev); ++ return err; ++} ++EXPORT_SYMBOL(dev_addr_add_multiple); ++ ++/** ++ * dev_addr_del_multiple - Delete device addresses by another device ++ * @to_dev: device where the addresses will be deleted ++ * @from_dev: device by which addresses the addresses will be deleted ++ * @addr_type: address type - 0 means type will used from from_dev ++ * ++ * Deletes addresses in to device by the list of addresses in from device. ++ * ++ * The caller must hold the rtnl_mutex. ++ */ ++int dev_addr_del_multiple(struct net_device *to_dev, ++ struct net_device *from_dev, ++ unsigned char addr_type) ++{ ++ ASSERT_RTNL(); ++ ++ if (from_dev->addr_len != to_dev->addr_len) ++ return -EINVAL; ++ __hw_addr_del_multiple_ii(&to_dev->dev_addr_list, ++ &from_dev->dev_addr_list, ++ to_dev->addr_len, addr_type, 0); ++ call_netdevice_notifiers(NETDEV_CHANGEADDR, to_dev); ++ return 0; ++} ++EXPORT_SYMBOL(dev_addr_del_multiple); ++ ++/* unicast and multicast addresses handling functions */ ++ + int __dev_addr_delete(struct dev_addr_list **list, int *count, + void *addr, int alen, int glbl) + { +@@ -4737,6 +4983,7 @@ + + dev->gso_max_size = GSO_MAX_SIZE; + ++ dev_addr_init(dev); + netdev_init_queues(dev); + + INIT_LIST_HEAD(&dev->napi_list); +@@ -4762,6 +5009,9 @@ + + kfree(dev->_tx); + ++ /* Flush device addresses */ ++ dev_addr_flush(dev); ++ + list_for_each_entry_safe(p, n, &dev->napi_list, dev_list) + netif_napi_del(p); + diff --git a/debian/patches/libdde_devres.patch b/debian/patches/libdde_devres.patch new file mode 100644 index 00000000..6c41cea1 --- /dev/null +++ b/debian/patches/libdde_devres.patch @@ -0,0 +1,366 @@ +--- /dev/null 2011-08-03 18:03:30.000000000 +0000 ++++ b/libdde_linux26/contrib/lib/devres.c 2012-04-15 23:14:01.000000000 +0000 +@@ -0,0 +1,351 @@ ++#include <linux/pci.h> ++#include <linux/io.h> ++#include <linux/module.h> ++ ++void devm_ioremap_release(struct device *dev, void *res) ++{ ++ iounmap(*(void __iomem **)res); ++} ++ ++static int devm_ioremap_match(struct device *dev, void *res, void *match_data) ++{ ++ return *(void **)res == match_data; ++} ++ ++/** ++ * devm_ioremap - Managed ioremap() ++ * @dev: Generic device to remap IO address for ++ * @offset: BUS offset to map ++ * @size: Size of map ++ * ++ * Managed ioremap(). Map is automatically unmapped on driver detach. ++ */ ++void __iomem *devm_ioremap(struct device *dev, resource_size_t offset, ++ unsigned long size) ++{ ++ void __iomem **ptr, *addr; ++ ++ ptr = devres_alloc(devm_ioremap_release, sizeof(*ptr), GFP_KERNEL); ++ if (!ptr) ++ return NULL; ++ ++ addr = ioremap(offset, size); ++ if (addr) { ++ *ptr = addr; ++ devres_add(dev, ptr); ++ } else ++ devres_free(ptr); ++ ++ return addr; ++} ++EXPORT_SYMBOL(devm_ioremap); ++ ++/** ++ * devm_ioremap_nocache - Managed ioremap_nocache() ++ * @dev: Generic device to remap IO address for ++ * @offset: BUS offset to map ++ * @size: Size of map ++ * ++ * Managed ioremap_nocache(). Map is automatically unmapped on driver ++ * detach. ++ */ ++void __iomem *devm_ioremap_nocache(struct device *dev, resource_size_t offset, ++ unsigned long size) ++{ ++ void __iomem **ptr, *addr; ++ ++ ptr = devres_alloc(devm_ioremap_release, sizeof(*ptr), GFP_KERNEL); ++ if (!ptr) ++ return NULL; ++ ++ addr = ioremap_nocache(offset, size); ++ if (addr) { ++ *ptr = addr; ++ devres_add(dev, ptr); ++ } else ++ devres_free(ptr); ++ ++ return addr; ++} ++EXPORT_SYMBOL(devm_ioremap_nocache); ++ ++/** ++ * devm_iounmap - Managed iounmap() ++ * @dev: Generic device to unmap for ++ * @addr: Address to unmap ++ * ++ * Managed iounmap(). @addr must have been mapped using devm_ioremap*(). ++ */ ++void devm_iounmap(struct device *dev, void __iomem *addr) ++{ ++ iounmap(addr); ++ WARN_ON(devres_destroy(dev, devm_ioremap_release, devm_ioremap_match, ++ (void *)addr)); ++} ++EXPORT_SYMBOL(devm_iounmap); ++ ++#ifdef CONFIG_HAS_IOPORT ++/* ++ * Generic iomap devres ++ */ ++static void devm_ioport_map_release(struct device *dev, void *res) ++{ ++ ioport_unmap(*(void __iomem **)res); ++} ++ ++static int devm_ioport_map_match(struct device *dev, void *res, ++ void *match_data) ++{ ++ return *(void **)res == match_data; ++} ++ ++/** ++ * devm_ioport_map - Managed ioport_map() ++ * @dev: Generic device to map ioport for ++ * @port: Port to map ++ * @nr: Number of ports to map ++ * ++ * Managed ioport_map(). Map is automatically unmapped on driver ++ * detach. ++ */ ++void __iomem * devm_ioport_map(struct device *dev, unsigned long port, ++ unsigned int nr) ++{ ++ void __iomem **ptr, *addr; ++ ++ ptr = devres_alloc(devm_ioport_map_release, sizeof(*ptr), GFP_KERNEL); ++ if (!ptr) ++ return NULL; ++ ++ addr = ioport_map(port, nr); ++ if (addr) { ++ *ptr = addr; ++ devres_add(dev, ptr); ++ } else ++ devres_free(ptr); ++ ++ return addr; ++} ++EXPORT_SYMBOL(devm_ioport_map); ++ ++/** ++ * devm_ioport_unmap - Managed ioport_unmap() ++ * @dev: Generic device to unmap for ++ * @addr: Address to unmap ++ * ++ * Managed ioport_unmap(). @addr must have been mapped using ++ * devm_ioport_map(). ++ */ ++void devm_ioport_unmap(struct device *dev, void __iomem *addr) ++{ ++ ioport_unmap(addr); ++ WARN_ON(devres_destroy(dev, devm_ioport_map_release, ++ devm_ioport_map_match, (void *)addr)); ++} ++EXPORT_SYMBOL(devm_ioport_unmap); ++ ++#ifdef CONFIG_PCI ++/* ++ * PCI iomap devres ++ */ ++#define PCIM_IOMAP_MAX PCI_ROM_RESOURCE ++ ++struct pcim_iomap_devres { ++ void __iomem *table[PCIM_IOMAP_MAX]; ++}; ++ ++static void pcim_iomap_release(struct device *gendev, void *res) ++{ ++ struct pci_dev *dev = container_of(gendev, struct pci_dev, dev); ++ struct pcim_iomap_devres *this = res; ++ int i; ++ ++ for (i = 0; i < PCIM_IOMAP_MAX; i++) ++ if (this->table[i]) ++ pci_iounmap(dev, this->table[i]); ++} ++ ++/** ++ * pcim_iomap_table - access iomap allocation table ++ * @pdev: PCI device to access iomap table for ++ * ++ * Access iomap allocation table for @dev. If iomap table doesn't ++ * exist and @pdev is managed, it will be allocated. All iomaps ++ * recorded in the iomap table are automatically unmapped on driver ++ * detach. ++ * ++ * This function might sleep when the table is first allocated but can ++ * be safely called without context and guaranteed to succed once ++ * allocated. ++ */ ++void __iomem * const * pcim_iomap_table(struct pci_dev *pdev) ++{ ++ struct pcim_iomap_devres *dr, *new_dr; ++ ++ dr = devres_find(&pdev->dev, pcim_iomap_release, NULL, NULL); ++ if (dr) ++ return dr->table; ++ ++ new_dr = devres_alloc(pcim_iomap_release, sizeof(*new_dr), GFP_KERNEL); ++ if (!new_dr) ++ return NULL; ++ dr = devres_get(&pdev->dev, new_dr, NULL, NULL); ++ return dr->table; ++} ++EXPORT_SYMBOL(pcim_iomap_table); ++ ++/** ++ * pcim_iomap - Managed pcim_iomap() ++ * @pdev: PCI device to iomap for ++ * @bar: BAR to iomap ++ * @maxlen: Maximum length of iomap ++ * ++ * Managed pci_iomap(). Map is automatically unmapped on driver ++ * detach. ++ */ ++void __iomem * pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen) ++{ ++ void __iomem **tbl; ++ ++ BUG_ON(bar >= PCIM_IOMAP_MAX); ++ ++ tbl = (void __iomem **)pcim_iomap_table(pdev); ++ if (!tbl || tbl[bar]) /* duplicate mappings not allowed */ ++ return NULL; ++ ++ tbl[bar] = pci_iomap(pdev, bar, maxlen); ++ return tbl[bar]; ++} ++EXPORT_SYMBOL(pcim_iomap); ++ ++/** ++ * pcim_iounmap - Managed pci_iounmap() ++ * @pdev: PCI device to iounmap for ++ * @addr: Address to unmap ++ * ++ * Managed pci_iounmap(). @addr must have been mapped using pcim_iomap(). ++ */ ++void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr) ++{ ++ void __iomem **tbl; ++ int i; ++ ++ pci_iounmap(pdev, addr); ++ ++ tbl = (void __iomem **)pcim_iomap_table(pdev); ++ BUG_ON(!tbl); ++ ++ for (i = 0; i < PCIM_IOMAP_MAX; i++) ++ if (tbl[i] == addr) { ++ tbl[i] = NULL; ++ return; ++ } ++ WARN_ON(1); ++} ++EXPORT_SYMBOL(pcim_iounmap); ++ ++/** ++ * pcim_iomap_regions - Request and iomap PCI BARs ++ * @pdev: PCI device to map IO resources for ++ * @mask: Mask of BARs to request and iomap ++ * @name: Name used when requesting regions ++ * ++ * Request and iomap regions specified by @mask. ++ */ ++int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name) ++{ ++ void __iomem * const *iomap; ++ int i, rc; ++ ++ iomap = pcim_iomap_table(pdev); ++ if (!iomap) ++ return -ENOMEM; ++ ++ for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { ++ unsigned long len; ++ ++ if (!(mask & (1 << i))) ++ continue; ++ ++ rc = -EINVAL; ++ len = pci_resource_len(pdev, i); ++ if (!len) ++ goto err_inval; ++ ++ rc = pci_request_region(pdev, i, name); ++ if (rc) ++ goto err_inval; ++ ++ rc = -ENOMEM; ++ if (!pcim_iomap(pdev, i, 0)) ++ goto err_region; ++ } ++ ++ return 0; ++ ++ err_region: ++ pci_release_region(pdev, i); ++ err_inval: ++ while (--i >= 0) { ++ if (!(mask & (1 << i))) ++ continue; ++ pcim_iounmap(pdev, iomap[i]); ++ pci_release_region(pdev, i); ++ } ++ ++ return rc; ++} ++EXPORT_SYMBOL(pcim_iomap_regions); ++ ++/** ++ * pcim_iomap_regions_request_all - Request all BARs and iomap specified ones ++ * @pdev: PCI device to map IO resources for ++ * @mask: Mask of BARs to iomap ++ * @name: Name used when requesting regions ++ * ++ * Request all PCI BARs and iomap regions specified by @mask. ++ */ ++int pcim_iomap_regions_request_all(struct pci_dev *pdev, u16 mask, ++ const char *name) ++{ ++ int request_mask = ((1 << 6) - 1) & ~mask; ++ int rc; ++ ++ rc = pci_request_selected_regions(pdev, request_mask, name); ++ if (rc) ++ return rc; ++ ++ rc = pcim_iomap_regions(pdev, mask, name); ++ if (rc) ++ pci_release_selected_regions(pdev, request_mask); ++ return rc; ++} ++EXPORT_SYMBOL(pcim_iomap_regions_request_all); ++ ++/** ++ * pcim_iounmap_regions - Unmap and release PCI BARs ++ * @pdev: PCI device to map IO resources for ++ * @mask: Mask of BARs to unmap and release ++ * ++ * Unamp and release regions specified by @mask. ++ */ ++void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask) ++{ ++ void __iomem * const *iomap; ++ int i; ++ ++ iomap = pcim_iomap_table(pdev); ++ if (!iomap) ++ return; ++ ++ for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { ++ if (!(mask & (1 << i))) ++ continue; ++ ++ pcim_iounmap(pdev, iomap[i]); ++ pci_release_region(pdev, i); ++ } ++} ++EXPORT_SYMBOL(pcim_iounmap_regions); ++#endif ++#endif +diff --git a/libdde_linux26/lib/src/Makefile b/libdde_linux26/lib/src/Makefile +index 358196b..f7a64da 100644 +--- a/libdde_linux26/lib/src/Makefile ++++ b/libdde_linux26/lib/src/Makefile +@@ -103,6 +103,7 @@ SRC_C_libdde_linux26.o.a += \ + lib/crc32.c \ + lib/ctype.c \ + lib/cpumask.c \ ++ lib/devres.c \ + lib/find_next_bit.c \ + lib/hexdump.c \ + lib/idr.c \ diff --git a/debian/patches/libdde_dma_head.patch b/debian/patches/libdde_dma_head.patch new file mode 100644 index 00000000..1a1c75fd --- /dev/null +++ b/debian/patches/libdde_dma_head.patch @@ -0,0 +1,93 @@ +commit 042a53a9e437feaf2230dd2cadcecfae9c7bfe05 +Author: Eric Dumazet <eric.dumazet@gmail.com> +Date: Fri Jun 5 04:04:16 2009 +0000 + + net: skb_shared_info optimization + + skb_dma_unmap() is quite expensive for small packets, + because we use two different cache lines from skb_shared_info. + + One to access nr_frags, one to access dma_maps[0] + + Instead of dma_maps being an array of MAX_SKB_FRAGS + 1 elements, + let dma_head alone in a new dma_head field, close to nr_frags, + to reduce cache lines misses. + + Tested on my dev machine (bnx2 & tg3 adapters), nice speedup ! + + Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> + Signed-off-by: David S. Miller <davem@davemloft.net> + +Index: hurd-debian/libdde_linux26/contrib/include/linux/skbuff.h +=================================================================== +--- hurd-debian.orig/libdde_linux26/contrib/include/linux/skbuff.h 2012-04-16 00:26:40.000000000 +0000 ++++ hurd-debian/libdde_linux26/contrib/include/linux/skbuff.h 2012-04-16 00:34:56.000000000 +0000 +@@ -142,6 +142,9 @@ + atomic_t dataref; + unsigned short nr_frags; + unsigned short gso_size; ++#ifdef CONFIG_HAS_DMA ++ dma_addr_t dma_head; ++#endif + /* Warning: this field is not always filled in (UFO)! */ + unsigned short gso_segs; + unsigned short gso_type; +@@ -152,7 +155,7 @@ + struct sk_buff *frag_list; + skb_frag_t frags[MAX_SKB_FRAGS]; + #ifdef CONFIG_HAS_DMA +- dma_addr_t dma_maps[MAX_SKB_FRAGS + 1]; ++ dma_addr_t dma_maps[MAX_SKB_FRAGS]; + #endif + }; + +Index: hurd-debian/libdde_linux26/contrib/net/core/skb_dma_map.c +=================================================================== +--- hurd-debian.orig/libdde_linux26/contrib/net/core/skb_dma_map.c 2012-04-16 00:26:40.000000000 +0000 ++++ hurd-debian/libdde_linux26/contrib/net/core/skb_dma_map.c 2012-04-16 00:34:56.000000000 +0000 +@@ -20,7 +20,7 @@ + if (dma_mapping_error(dev, map)) + goto out_err; + +- sp->dma_maps[0] = map; ++ sp->dma_head = map; + for (i = 0; i < sp->nr_frags; i++) { + skb_frag_t *fp = &sp->frags[i]; + +@@ -28,7 +28,7 @@ + fp->size, dir); + if (dma_mapping_error(dev, map)) + goto unwind; +- sp->dma_maps[i + 1] = map; ++ sp->dma_maps[i] = map; + } + sp->num_dma_maps = i + 1; + +@@ -38,10 +38,10 @@ + while (--i >= 0) { + skb_frag_t *fp = &sp->frags[i]; + +- dma_unmap_page(dev, sp->dma_maps[i + 1], ++ dma_unmap_page(dev, sp->dma_maps[i], + fp->size, dir); + } +- dma_unmap_single(dev, sp->dma_maps[0], ++ dma_unmap_single(dev, sp->dma_head, + skb_headlen(skb), dir); + out_err: + return -ENOMEM; +@@ -54,12 +54,12 @@ + struct skb_shared_info *sp = skb_shinfo(skb); + int i; + +- dma_unmap_single(dev, sp->dma_maps[0], ++ dma_unmap_single(dev, sp->dma_head, + skb_headlen(skb), dir); + for (i = 0; i < sp->nr_frags; i++) { + skb_frag_t *fp = &sp->frags[i]; + +- dma_unmap_page(dev, sp->dma_maps[i + 1], ++ dma_unmap_page(dev, sp->dma_maps[i], + fp->size, dir); + } + } diff --git a/debian/patches/libdde_ethoc.patch b/debian/patches/libdde_ethoc.patch new file mode 100644 index 00000000..eba5cdf5 --- /dev/null +++ b/debian/patches/libdde_ethoc.patch @@ -0,0 +1,25 @@ +--- /dev/null 2011-08-03 18:03:30.000000000 +0000 ++++ b/libdde_linux26/contrib/include/net/ethoc.h 2012-04-15 22:19:57.000000000 +0000 +@@ -0,0 +1,22 @@ ++/* ++ * linux/include/net/ethoc.h ++ * ++ * Copyright (C) 2008-2009 Avionic Design GmbH ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * Written by Thierry Reding <thierry.reding@avionic-design.de> ++ */ ++ ++#ifndef LINUX_NET_ETHOC_H ++#define LINUX_NET_ETHOC_H 1 ++ ++struct ethoc_platform_data { ++ u8 hwaddr[IFHWADDRLEN]; ++ s8 phy_id; ++}; ++ ++#endif /* !LINUX_NET_ETHOC_H */ ++ diff --git a/debian/patches/libdde_ethtool.patch b/debian/patches/libdde_ethtool.patch new file mode 100644 index 00000000..9e52d1b5 --- /dev/null +++ b/debian/patches/libdde_ethtool.patch @@ -0,0 +1,98 @@ +diff --git a/libdde_linux26/contrib/include/linux/ethtool.h b/libdde_linux26/contrib/include/linux/ethtool.h +index 27c67a5..45f34dc 100644 +--- a/libdde_linux26/contrib/include/linux/ethtool.h ++++ b/libdde_linux26/contrib/include/linux/ethtool.h +@@ -25,11 +25,14 @@ struct ethtool_cmd { + __u8 phy_address; + __u8 transceiver; /* Which transceiver to use */ + __u8 autoneg; /* Enable or disable autonegotiation */ ++ __u8 mdio_support; + __u32 maxtxpkt; /* Tx pkts before generating tx int */ + __u32 maxrxpkt; /* Rx pkts before generating rx int */ + __u16 speed_hi; +- __u16 reserved2; +- __u32 reserved[3]; ++ __u8 eth_tp_mdix; ++ __u8 reserved2; ++ __u32 lp_advertising; /* Features the link partner advertises */ ++ __u32 reserved[2]; + }; + + static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep, +@@ -469,6 +472,13 @@ struct ethtool_ops { + #define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ + #define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */ + #define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */ ++#define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */ ++#define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */ ++#define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */ ++#define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */ ++#define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */ ++#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */ ++#define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */ + + /* compatibility with older code */ + #define SPARC_ETH_GSET ETHTOOL_GSET +@@ -491,6 +501,11 @@ struct ethtool_ops { + #define SUPPORTED_Pause (1 << 13) + #define SUPPORTED_Asym_Pause (1 << 14) + #define SUPPORTED_2500baseX_Full (1 << 15) ++#define SUPPORTED_Backplane (1 << 16) ++#define SUPPORTED_1000baseKX_Full (1 << 17) ++#define SUPPORTED_10000baseKX4_Full (1 << 18) ++#define SUPPORTED_10000baseKR_Full (1 << 19) ++#define SUPPORTED_10000baseR_FEC (1 << 20) + + /* Indicates what features are advertised by the interface. */ + #define ADVERTISED_10baseT_Half (1 << 0) +@@ -509,6 +524,11 @@ struct ethtool_ops { + #define ADVERTISED_Pause (1 << 13) + #define ADVERTISED_Asym_Pause (1 << 14) + #define ADVERTISED_2500baseX_Full (1 << 15) ++#define ADVERTISED_Backplane (1 << 16) ++#define ADVERTISED_1000baseKX_Full (1 << 17) ++#define ADVERTISED_10000baseKX4_Full (1 << 18) ++#define ADVERTISED_10000baseKR_Full (1 << 19) ++#define ADVERTISED_10000baseR_FEC (1 << 20) + + /* The following are all involved in forcing a particular link + * mode for the device for setting things. When getting the +@@ -533,6 +553,7 @@ struct ethtool_ops { + #define PORT_MII 0x02 + #define PORT_FIBRE 0x03 + #define PORT_BNC 0x04 ++#define PORT_OTHER 0xff + + /* Which transceiver to use. */ + #define XCVR_INTERNAL 0x00 +@@ -547,6 +568,11 @@ struct ethtool_ops { + #define AUTONEG_DISABLE 0x00 + #define AUTONEG_ENABLE 0x01 + ++/* Mode MDI or MDI-X */ ++#define ETH_TP_MDI_INVALID 0x00 ++#define ETH_TP_MDI 0x01 ++#define ETH_TP_MDI_X 0x02 ++ + /* Wake-On-Lan options. */ + #define WAKE_PHY (1 << 0) + #define WAKE_UCAST (1 << 1) +@@ -565,6 +591,11 @@ struct ethtool_ops { + #define UDP_V6_FLOW 0x06 + #define SCTP_V6_FLOW 0x07 + #define AH_ESP_V6_FLOW 0x08 ++#define AH_V4_FLOW 0x09 ++#define ESP_V4_FLOW 0x0a ++#define AH_V6_FLOW 0x0b ++#define ESP_V6_FLOW 0x0c ++#define IP_USER_FLOW 0x0d + + /* L3-L4 network traffic flow hash options */ + #define RXH_DEV_PORT (1 << 0) +@@ -577,5 +608,6 @@ struct ethtool_ops { + #define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */ + #define RXH_DISCARD (1 << 31) + ++#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL + + #endif /* _LINUX_ETHTOOL_H */ diff --git a/debian/patches/libdde_group_addr.patch b/debian/patches/libdde_group_addr.patch new file mode 100644 index 00000000..2ea72715 --- /dev/null +++ b/debian/patches/libdde_group_addr.patch @@ -0,0 +1,429 @@ +commit 31278e71471399beaff9280737e52b47db4dc345 +Author: Jiri Pirko <jpirko@redhat.com> +Date: Wed Jun 17 01:12:19 2009 +0000 + + net: group address list and its count + + This patch is inspired by patch recently posted by Johannes Berg. Basically what + my patch does is to group list and a count of addresses into newly introduced + structure netdev_hw_addr_list. This brings us two benefits: + 1) struct net_device becames a bit nicer. + 2) in the future there will be a possibility to operate with lists independently + on netdevices (with exporting right functions). + I wanted to introduce this patch before I'll post a multicast lists conversion. + + Signed-off-by: Jiri Pirko <jpirko@redhat.com> + + drivers/net/bnx2.c | 4 +- + drivers/net/e1000/e1000_main.c | 4 +- + drivers/net/ixgbe/ixgbe_main.c | 6 +- + drivers/net/mv643xx_eth.c | 2 +- + drivers/net/niu.c | 4 +- + drivers/net/virtio_net.c | 10 ++-- + drivers/s390/net/qeth_l2_main.c | 2 +- + include/linux/netdevice.h | 17 +++-- + net/core/dev.c | 130 ++++++++++++++++++-------------------- + 9 files changed, 89 insertions(+), 90 deletions(-) + Signed-off-by: David S. Miller <davem@davemloft.net> + +Index: hurd-debian/libdde_linux26/contrib/include/linux/netdevice.h +=================================================================== +--- hurd-debian.orig/libdde_linux26/contrib/include/linux/netdevice.h 2012-04-16 00:34:46.000000000 +0000 ++++ hurd-debian/libdde_linux26/contrib/include/linux/netdevice.h 2012-04-16 00:34:51.000000000 +0000 +@@ -224,6 +224,11 @@ + struct rcu_head rcu_head; + }; + ++struct netdev_hw_addr_list { ++ struct list_head list; ++ int count; ++}; ++ + struct hh_cache + { + struct hh_cache *hh_next; /* Next entry */ +@@ -741,9 +746,8 @@ + unsigned char addr_len; /* hardware address length */ + unsigned short dev_id; /* for shared network cards */ + +- struct list_head uc_list; /* Secondary unicast mac +- addresses */ +- int uc_count; /* Number of installed ucasts */ ++ struct netdev_hw_addr_list uc; /* Secondary unicast ++ mac addresses */ + int uc_promisc; + spinlock_t addr_list_lock; + struct dev_addr_list *mc_list; /* Multicast mac addresses */ +@@ -775,7 +779,8 @@ + because most packets are + unicast) */ + +- struct list_head dev_addr_list; /* list of device hw addresses */ ++ struct netdev_hw_addr_list dev_addrs; /* list of device ++ hw addresses */ + + unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ + +@@ -1786,11 +1791,11 @@ + } + + /* +- * dev_addr_list walker. Should be used only for read access. Call with ++ * dev_addrs walker. Should be used only for read access. Call with + * rcu_read_lock held. + */ + #define for_each_dev_addr(dev, ha) \ +- list_for_each_entry_rcu(ha, &dev->dev_addr_list, list) ++ list_for_each_entry_rcu(ha, &dev->dev_addrs.list, list) + + /* These functions live elsewhere (drivers/net/net_init.c, but related) */ + +Index: hurd-debian/libdde_linux26/lib/src/net/core/dev.c +=================================================================== +--- hurd-debian.orig/libdde_linux26/lib/src/net/core/dev.c 2012-04-16 00:34:49.000000000 +0000 ++++ hurd-debian/libdde_linux26/lib/src/net/core/dev.c 2012-04-16 00:34:51.000000000 +0000 +@@ -3377,10 +3377,10 @@ + /* Unicast addresses changes may only happen under the rtnl, + * therefore calling __dev_set_promiscuity here is safe. + */ +- if (dev->uc_count > 0 && !dev->uc_promisc) { ++ if (dev->uc.count > 0 && !dev->uc_promisc) { + __dev_set_promiscuity(dev, 1); + dev->uc_promisc = 1; +- } else if (dev->uc_count == 0 && dev->uc_promisc) { ++ } else if (dev->uc.count == 0 && dev->uc_promisc) { + __dev_set_promiscuity(dev, -1); + dev->uc_promisc = 0; + } +@@ -3399,9 +3399,8 @@ + + /* hw addresses list handling functions */ + +-static int __hw_addr_add(struct list_head *list, int *delta, +- unsigned char *addr, int addr_len, +- unsigned char addr_type) ++static int __hw_addr_add(struct netdev_hw_addr_list *list, unsigned char *addr, ++ int addr_len, unsigned char addr_type) + { + struct netdev_hw_addr *ha; + int alloc_size; +@@ -3409,7 +3408,7 @@ + if (addr_len > MAX_ADDR_LEN) + return -EINVAL; + +- list_for_each_entry(ha, list, list) { ++ list_for_each_entry(ha, &list->list, list) { + if (!memcmp(ha->addr, addr, addr_len) && + ha->type == addr_type) { + ha->refcount++; +@@ -3428,9 +3427,8 @@ + ha->type = addr_type; + ha->refcount = 1; + ha->synced = false; +- list_add_tail_rcu(&ha->list, list); +- if (delta) +- (*delta)++; ++ list_add_tail_rcu(&ha->list, &list->list); ++ list->count++; + return 0; + } + +@@ -3442,120 +3440,121 @@ + kfree(ha); + } + +-static int __hw_addr_del(struct list_head *list, int *delta, +- unsigned char *addr, int addr_len, +- unsigned char addr_type) ++static int __hw_addr_del(struct netdev_hw_addr_list *list, unsigned char *addr, ++ int addr_len, unsigned char addr_type) + { + struct netdev_hw_addr *ha; + +- list_for_each_entry(ha, list, list) { ++ list_for_each_entry(ha, &list->list, list) { + if (!memcmp(ha->addr, addr, addr_len) && + (ha->type == addr_type || !addr_type)) { + if (--ha->refcount) + return 0; + list_del_rcu(&ha->list); + call_rcu(&ha->rcu_head, ha_rcu_free); +- if (delta) +- (*delta)--; ++ list->count--; + return 0; + } + } + return -ENOENT; + } + +-static int __hw_addr_add_multiple(struct list_head *to_list, int *to_delta, +- struct list_head *from_list, int addr_len, ++static int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list, ++ struct netdev_hw_addr_list *from_list, ++ int addr_len, + unsigned char addr_type) + { + int err; + struct netdev_hw_addr *ha, *ha2; + unsigned char type; + +- list_for_each_entry(ha, from_list, list) { ++ list_for_each_entry(ha, &from_list->list, list) { + type = addr_type ? addr_type : ha->type; +- err = __hw_addr_add(to_list, to_delta, ha->addr, +- addr_len, type); ++ err = __hw_addr_add(to_list, ha->addr, addr_len, type); + if (err) + goto unroll; + } + return 0; + + unroll: +- list_for_each_entry(ha2, from_list, list) { ++ list_for_each_entry(ha2, &from_list->list, list) { + if (ha2 == ha) + break; + type = addr_type ? addr_type : ha2->type; +- __hw_addr_del(to_list, to_delta, ha2->addr, +- addr_len, type); ++ __hw_addr_del(to_list, ha2->addr, addr_len, type); + } + return err; + } + +-static void __hw_addr_del_multiple(struct list_head *to_list, int *to_delta, +- struct list_head *from_list, int addr_len, ++static void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list, ++ struct netdev_hw_addr_list *from_list, ++ int addr_len, + unsigned char addr_type) + { + struct netdev_hw_addr *ha; + unsigned char type; + +- list_for_each_entry(ha, from_list, list) { ++ list_for_each_entry(ha, &from_list->list, list) { + type = addr_type ? addr_type : ha->type; +- __hw_addr_del(to_list, to_delta, ha->addr, +- addr_len, addr_type); ++ __hw_addr_del(to_list, ha->addr, addr_len, addr_type); + } + } + +-static int __hw_addr_sync(struct list_head *to_list, int *to_delta, +- struct list_head *from_list, int *from_delta, ++static int __hw_addr_sync(struct netdev_hw_addr_list *to_list, ++ struct netdev_hw_addr_list *from_list, + int addr_len) + { + int err = 0; + struct netdev_hw_addr *ha, *tmp; + +- list_for_each_entry_safe(ha, tmp, from_list, list) { ++ list_for_each_entry_safe(ha, tmp, &from_list->list, list) { + if (!ha->synced) { +- err = __hw_addr_add(to_list, to_delta, ha->addr, ++ err = __hw_addr_add(to_list, ha->addr, + addr_len, ha->type); + if (err) + break; + ha->synced = true; + ha->refcount++; + } else if (ha->refcount == 1) { +- __hw_addr_del(to_list, to_delta, ha->addr, +- addr_len, ha->type); +- __hw_addr_del(from_list, from_delta, ha->addr, +- addr_len, ha->type); ++ __hw_addr_del(to_list, ha->addr, addr_len, ha->type); ++ __hw_addr_del(from_list, ha->addr, addr_len, ha->type); + } + } + return err; + } + +-static void __hw_addr_unsync(struct list_head *to_list, int *to_delta, +- struct list_head *from_list, int *from_delta, ++static void __hw_addr_unsync(struct netdev_hw_addr_list *to_list, ++ struct netdev_hw_addr_list *from_list, + int addr_len) + { + struct netdev_hw_addr *ha, *tmp; + +- list_for_each_entry_safe(ha, tmp, from_list, list) { ++ list_for_each_entry_safe(ha, tmp, &from_list->list, list) { + if (ha->synced) { +- __hw_addr_del(to_list, to_delta, ha->addr, ++ __hw_addr_del(to_list, ha->addr, + addr_len, ha->type); + ha->synced = false; +- __hw_addr_del(from_list, from_delta, ha->addr, ++ __hw_addr_del(from_list, ha->addr, + addr_len, ha->type); + } + } + } + +- +-static void __hw_addr_flush(struct list_head *list) ++static void __hw_addr_flush(struct netdev_hw_addr_list *list) + { + struct netdev_hw_addr *ha, *tmp; + +- list_for_each_entry_safe(ha, tmp, list, list) { ++ list_for_each_entry_safe(ha, tmp, &list->list, list) { + list_del_rcu(&ha->list); + call_rcu(&ha->rcu_head, ha_rcu_free); + } ++ list->count = 0; ++} ++ ++static void __hw_addr_init(struct netdev_hw_addr_list *list) ++{ ++ INIT_LIST_HEAD(&list->list); ++ list->count = 0; + } + + /* Device addresses handling functions */ +@@ -3564,7 +3563,7 @@ + { + /* rtnl_mutex must be held here */ + +- __hw_addr_flush(&dev->dev_addr_list); ++ __hw_addr_flush(&dev->dev_addrs); + dev->dev_addr = NULL; + } + +@@ -3576,16 +3575,16 @@ + + /* rtnl_mutex must be held here */ + +- INIT_LIST_HEAD(&dev->dev_addr_list); ++ __hw_addr_init(&dev->dev_addrs); + memset(addr, 0, sizeof(addr)); +- err = __hw_addr_add(&dev->dev_addr_list, NULL, addr, sizeof(addr), ++ err = __hw_addr_add(&dev->dev_addrs, addr, sizeof(addr), + NETDEV_HW_ADDR_T_LAN); + if (!err) { + /* + * Get the first (previously created) address from the list + * and set dev_addr pointer to this location. + */ +- ha = list_first_entry(&dev->dev_addr_list, ++ ha = list_first_entry(&dev->dev_addrs.list, + struct netdev_hw_addr, list); + dev->dev_addr = ha->addr; + } +@@ -3610,8 +3609,7 @@ + + ASSERT_RTNL(); + +- err = __hw_addr_add(&dev->dev_addr_list, NULL, addr, dev->addr_len, +- addr_type); ++ err = __hw_addr_add(&dev->dev_addrs, addr, dev->addr_len, addr_type); + if (!err) + call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); + return err; +@@ -3641,11 +3639,12 @@ + * We can not remove the first address from the list because + * dev->dev_addr points to that. + */ +- ha = list_first_entry(&dev->dev_addr_list, struct netdev_hw_addr, list); ++ ha = list_first_entry(&dev->dev_addrs.list, ++ struct netdev_hw_addr, list); + if (ha->addr == dev->dev_addr && ha->refcount == 1) + return -ENOENT; + +- err = __hw_addr_del(&dev->dev_addr_list, NULL, addr, dev->addr_len, ++ err = __hw_addr_del(&dev->dev_addrs, addr, dev->addr_len, + addr_type); + if (!err) + call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); +@@ -3673,8 +3672,7 @@ + + if (from_dev->addr_len != to_dev->addr_len) + return -EINVAL; +- err = __hw_addr_add_multiple(&to_dev->dev_addr_list, NULL, +- &from_dev->dev_addr_list, ++ err = __hw_addr_add_multiple(&to_dev->dev_addrs, &from_dev->dev_addrs, + to_dev->addr_len, addr_type); + if (!err) + call_netdevice_notifiers(NETDEV_CHANGEADDR, to_dev); +@@ -3700,15 +3698,14 @@ + + if (from_dev->addr_len != to_dev->addr_len) + return -EINVAL; +- __hw_addr_del_multiple(&to_dev->dev_addr_list, NULL, +- &from_dev->dev_addr_list, ++ __hw_addr_del_multiple(&to_dev->dev_addrs, &from_dev->dev_addrs, + to_dev->addr_len, addr_type); + call_netdevice_notifiers(NETDEV_CHANGEADDR, to_dev); + return 0; + } + EXPORT_SYMBOL(dev_addr_del_multiple); + +-/* unicast and multicast addresses handling functions */ ++/* multicast addresses handling functions */ + + int __dev_addr_delete(struct dev_addr_list **list, int *count, + void *addr, int alen, int glbl) +@@ -3784,8 +3781,8 @@ + + ASSERT_RTNL(); + +- err = __hw_addr_del(&dev->uc_list, &dev->uc_count, addr, +- dev->addr_len, NETDEV_HW_ADDR_T_UNICAST); ++ err = __hw_addr_del(&dev->uc, addr, dev->addr_len, ++ NETDEV_HW_ADDR_T_UNICAST); + if (!err) + __dev_set_rx_mode(dev); + return err; +@@ -3808,8 +3805,8 @@ + + ASSERT_RTNL(); + +- err = __hw_addr_add(&dev->uc_list, &dev->uc_count, addr, +- dev->addr_len, NETDEV_HW_ADDR_T_UNICAST); ++ err = __hw_addr_add(&dev->uc, addr, dev->addr_len, ++ NETDEV_HW_ADDR_T_UNICAST); + if (!err) + __dev_set_rx_mode(dev); + return err; +@@ -3882,8 +3879,7 @@ + if (to->addr_len != from->addr_len) + return -EINVAL; + +- err = __hw_addr_sync(&to->uc_list, &to->uc_count, +- &from->uc_list, &from->uc_count, to->addr_len); ++ err = __hw_addr_sync(&to->uc, &from->uc, to->addr_len); + if (!err) + __dev_set_rx_mode(to); + return err; +@@ -3906,8 +3902,7 @@ + if (to->addr_len != from->addr_len) + return; + +- __hw_addr_unsync(&to->uc_list, &to->uc_count, +- &from->uc_list, &from->uc_count, to->addr_len); ++ __hw_addr_unsync(&to->uc, &from->uc, to->addr_len); + __dev_set_rx_mode(to); + } + EXPORT_SYMBOL(dev_unicast_unsync); +@@ -3916,15 +3911,14 @@ + { + /* rtnl_mutex must be held here */ + +- __hw_addr_flush(&dev->uc_list); +- dev->uc_count = 0; ++ __hw_addr_flush(&dev->uc); + } + + static void dev_unicast_init(struct net_device *dev) + { + /* rtnl_mutex must be held here */ + +- INIT_LIST_HEAD(&dev->uc_list); ++ __hw_addr_init(&dev->uc); + } + + diff --git a/debian/patches/libdde_mdio.patch b/debian/patches/libdde_mdio.patch new file mode 100644 index 00000000..6c9b0c29 --- /dev/null +++ b/debian/patches/libdde_mdio.patch @@ -0,0 +1,359 @@ +--- /dev/null 2011-08-03 18:03:30.000000000 +0000 ++++ b/libdde_linux26/contrib/include/linux/mdio.h 2012-04-15 22:16:31.000000000 +0000 +@@ -0,0 +1,356 @@ ++/* ++ * linux/mdio.h: definitions for MDIO (clause 45) transceivers ++ * Copyright 2006-2009 Solarflare Communications Inc. ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 as published ++ * by the Free Software Foundation, incorporated herein by reference. ++ */ ++ ++#ifndef __LINUX_MDIO_H__ ++#define __LINUX_MDIO_H__ ++ ++#include <linux/mii.h> ++ ++/* MDIO Manageable Devices (MMDs). */ ++#define MDIO_MMD_PMAPMD 1 /* Physical Medium Attachment/ ++ * Physical Medium Dependent */ ++#define MDIO_MMD_WIS 2 /* WAN Interface Sublayer */ ++#define MDIO_MMD_PCS 3 /* Physical Coding Sublayer */ ++#define MDIO_MMD_PHYXS 4 /* PHY Extender Sublayer */ ++#define MDIO_MMD_DTEXS 5 /* DTE Extender Sublayer */ ++#define MDIO_MMD_TC 6 /* Transmission Convergence */ ++#define MDIO_MMD_AN 7 /* Auto-Negotiation */ ++#define MDIO_MMD_C22EXT 29 /* Clause 22 extension */ ++#define MDIO_MMD_VEND1 30 /* Vendor specific 1 */ ++#define MDIO_MMD_VEND2 31 /* Vendor specific 2 */ ++ ++/* Generic MDIO registers. */ ++#define MDIO_CTRL1 MII_BMCR ++#define MDIO_STAT1 MII_BMSR ++#define MDIO_DEVID1 MII_PHYSID1 ++#define MDIO_DEVID2 MII_PHYSID2 ++#define MDIO_SPEED 4 /* Speed ability */ ++#define MDIO_DEVS1 5 /* Devices in package */ ++#define MDIO_DEVS2 6 ++#define MDIO_CTRL2 7 /* 10G control 2 */ ++#define MDIO_STAT2 8 /* 10G status 2 */ ++#define MDIO_PMA_TXDIS 9 /* 10G PMA/PMD transmit disable */ ++#define MDIO_PMA_RXDET 10 /* 10G PMA/PMD receive signal detect */ ++#define MDIO_PMA_EXTABLE 11 /* 10G PMA/PMD extended ability */ ++#define MDIO_PKGID1 14 /* Package identifier */ ++#define MDIO_PKGID2 15 ++#define MDIO_AN_ADVERTISE 16 /* AN advertising (base page) */ ++#define MDIO_AN_LPA 19 /* AN LP abilities (base page) */ ++#define MDIO_PHYXS_LNSTAT 24 /* PHY XGXS lane state */ ++ ++/* Media-dependent registers. */ ++#define MDIO_PMA_10GBT_SWAPPOL 130 /* 10GBASE-T pair swap & polarity */ ++#define MDIO_PMA_10GBT_TXPWR 131 /* 10GBASE-T TX power control */ ++#define MDIO_PMA_10GBT_SNR 133 /* 10GBASE-T SNR margin, lane A. ++ * Lanes B-D are numbered 134-136. */ ++#define MDIO_PMA_10GBR_FECABLE 170 /* 10GBASE-R FEC ability */ ++#define MDIO_PCS_10GBX_STAT1 24 /* 10GBASE-X PCS status 1 */ ++#define MDIO_PCS_10GBRT_STAT1 32 /* 10GBASE-R/-T PCS status 1 */ ++#define MDIO_PCS_10GBRT_STAT2 33 /* 10GBASE-R/-T PCS status 2 */ ++#define MDIO_AN_10GBT_CTRL 32 /* 10GBASE-T auto-negotiation control */ ++#define MDIO_AN_10GBT_STAT 33 /* 10GBASE-T auto-negotiation status */ ++ ++/* LASI (Link Alarm Status Interrupt) registers, defined by XENPAK MSA. */ ++#define MDIO_PMA_LASI_RXCTRL 0x9000 /* RX_ALARM control */ ++#define MDIO_PMA_LASI_TXCTRL 0x9001 /* TX_ALARM control */ ++#define MDIO_PMA_LASI_CTRL 0x9002 /* LASI control */ ++#define MDIO_PMA_LASI_RXSTAT 0x9003 /* RX_ALARM status */ ++#define MDIO_PMA_LASI_TXSTAT 0x9004 /* TX_ALARM status */ ++#define MDIO_PMA_LASI_STAT 0x9005 /* LASI status */ ++ ++/* Control register 1. */ ++/* Enable extended speed selection */ ++#define MDIO_CTRL1_SPEEDSELEXT (BMCR_SPEED1000 | BMCR_SPEED100) ++/* All speed selection bits */ ++#define MDIO_CTRL1_SPEEDSEL (MDIO_CTRL1_SPEEDSELEXT | 0x003c) ++#define MDIO_CTRL1_FULLDPLX BMCR_FULLDPLX ++#define MDIO_CTRL1_LPOWER BMCR_PDOWN ++#define MDIO_CTRL1_RESET BMCR_RESET ++#define MDIO_PMA_CTRL1_LOOPBACK 0x0001 ++#define MDIO_PMA_CTRL1_SPEED1000 BMCR_SPEED1000 ++#define MDIO_PMA_CTRL1_SPEED100 BMCR_SPEED100 ++#define MDIO_PCS_CTRL1_LOOPBACK BMCR_LOOPBACK ++#define MDIO_PHYXS_CTRL1_LOOPBACK BMCR_LOOPBACK ++#define MDIO_AN_CTRL1_RESTART BMCR_ANRESTART ++#define MDIO_AN_CTRL1_ENABLE BMCR_ANENABLE ++#define MDIO_AN_CTRL1_XNP 0x2000 /* Enable extended next page */ ++ ++/* 10 Gb/s */ ++#define MDIO_CTRL1_SPEED10G (MDIO_CTRL1_SPEEDSELEXT | 0x00) ++/* 10PASS-TS/2BASE-TL */ ++#define MDIO_CTRL1_SPEED10P2B (MDIO_CTRL1_SPEEDSELEXT | 0x04) ++ ++/* Status register 1. */ ++#define MDIO_STAT1_LPOWERABLE 0x0002 /* Low-power ability */ ++#define MDIO_STAT1_LSTATUS BMSR_LSTATUS ++#define MDIO_STAT1_FAULT 0x0080 /* Fault */ ++#define MDIO_AN_STAT1_LPABLE 0x0001 /* Link partner AN ability */ ++#define MDIO_AN_STAT1_ABLE BMSR_ANEGCAPABLE ++#define MDIO_AN_STAT1_RFAULT BMSR_RFAULT ++#define MDIO_AN_STAT1_COMPLETE BMSR_ANEGCOMPLETE ++#define MDIO_AN_STAT1_PAGE 0x0040 /* Page received */ ++#define MDIO_AN_STAT1_XNP 0x0080 /* Extended next page status */ ++ ++/* Speed register. */ ++#define MDIO_SPEED_10G 0x0001 /* 10G capable */ ++#define MDIO_PMA_SPEED_2B 0x0002 /* 2BASE-TL capable */ ++#define MDIO_PMA_SPEED_10P 0x0004 /* 10PASS-TS capable */ ++#define MDIO_PMA_SPEED_1000 0x0010 /* 1000M capable */ ++#define MDIO_PMA_SPEED_100 0x0020 /* 100M capable */ ++#define MDIO_PMA_SPEED_10 0x0040 /* 10M capable */ ++#define MDIO_PCS_SPEED_10P2B 0x0002 /* 10PASS-TS/2BASE-TL capable */ ++ ++/* Device present registers. */ ++#define MDIO_DEVS_PRESENT(devad) (1 << (devad)) ++#define MDIO_DEVS_PMAPMD MDIO_DEVS_PRESENT(MDIO_MMD_PMAPMD) ++#define MDIO_DEVS_WIS MDIO_DEVS_PRESENT(MDIO_MMD_WIS) ++#define MDIO_DEVS_PCS MDIO_DEVS_PRESENT(MDIO_MMD_PCS) ++#define MDIO_DEVS_PHYXS MDIO_DEVS_PRESENT(MDIO_MMD_PHYXS) ++#define MDIO_DEVS_DTEXS MDIO_DEVS_PRESENT(MDIO_MMD_DTEXS) ++#define MDIO_DEVS_TC MDIO_DEVS_PRESENT(MDIO_MMD_TC) ++#define MDIO_DEVS_AN MDIO_DEVS_PRESENT(MDIO_MMD_AN) ++#define MDIO_DEVS_C22EXT MDIO_DEVS_PRESENT(MDIO_MMD_C22EXT) ++ ++/* Control register 2. */ ++#define MDIO_PMA_CTRL2_TYPE 0x000f /* PMA/PMD type selection */ ++#define MDIO_PMA_CTRL2_10GBCX4 0x0000 /* 10GBASE-CX4 type */ ++#define MDIO_PMA_CTRL2_10GBEW 0x0001 /* 10GBASE-EW type */ ++#define MDIO_PMA_CTRL2_10GBLW 0x0002 /* 10GBASE-LW type */ ++#define MDIO_PMA_CTRL2_10GBSW 0x0003 /* 10GBASE-SW type */ ++#define MDIO_PMA_CTRL2_10GBLX4 0x0004 /* 10GBASE-LX4 type */ ++#define MDIO_PMA_CTRL2_10GBER 0x0005 /* 10GBASE-ER type */ ++#define MDIO_PMA_CTRL2_10GBLR 0x0006 /* 10GBASE-LR type */ ++#define MDIO_PMA_CTRL2_10GBSR 0x0007 /* 10GBASE-SR type */ ++#define MDIO_PMA_CTRL2_10GBLRM 0x0008 /* 10GBASE-LRM type */ ++#define MDIO_PMA_CTRL2_10GBT 0x0009 /* 10GBASE-T type */ ++#define MDIO_PMA_CTRL2_10GBKX4 0x000a /* 10GBASE-KX4 type */ ++#define MDIO_PMA_CTRL2_10GBKR 0x000b /* 10GBASE-KR type */ ++#define MDIO_PMA_CTRL2_1000BT 0x000c /* 1000BASE-T type */ ++#define MDIO_PMA_CTRL2_1000BKX 0x000d /* 1000BASE-KX type */ ++#define MDIO_PMA_CTRL2_100BTX 0x000e /* 100BASE-TX type */ ++#define MDIO_PMA_CTRL2_10BT 0x000f /* 10BASE-T type */ ++#define MDIO_PCS_CTRL2_TYPE 0x0003 /* PCS type selection */ ++#define MDIO_PCS_CTRL2_10GBR 0x0000 /* 10GBASE-R type */ ++#define MDIO_PCS_CTRL2_10GBX 0x0001 /* 10GBASE-X type */ ++#define MDIO_PCS_CTRL2_10GBW 0x0002 /* 10GBASE-W type */ ++#define MDIO_PCS_CTRL2_10GBT 0x0003 /* 10GBASE-T type */ ++ ++/* Status register 2. */ ++#define MDIO_STAT2_RXFAULT 0x0400 /* Receive fault */ ++#define MDIO_STAT2_TXFAULT 0x0800 /* Transmit fault */ ++#define MDIO_STAT2_DEVPRST 0xc000 /* Device present */ ++#define MDIO_STAT2_DEVPRST_VAL 0x8000 /* Device present value */ ++#define MDIO_PMA_STAT2_LBABLE 0x0001 /* PMA loopback ability */ ++#define MDIO_PMA_STAT2_10GBEW 0x0002 /* 10GBASE-EW ability */ ++#define MDIO_PMA_STAT2_10GBLW 0x0004 /* 10GBASE-LW ability */ ++#define MDIO_PMA_STAT2_10GBSW 0x0008 /* 10GBASE-SW ability */ ++#define MDIO_PMA_STAT2_10GBLX4 0x0010 /* 10GBASE-LX4 ability */ ++#define MDIO_PMA_STAT2_10GBER 0x0020 /* 10GBASE-ER ability */ ++#define MDIO_PMA_STAT2_10GBLR 0x0040 /* 10GBASE-LR ability */ ++#define MDIO_PMA_STAT2_10GBSR 0x0080 /* 10GBASE-SR ability */ ++#define MDIO_PMD_STAT2_TXDISAB 0x0100 /* PMD TX disable ability */ ++#define MDIO_PMA_STAT2_EXTABLE 0x0200 /* Extended abilities */ ++#define MDIO_PMA_STAT2_RXFLTABLE 0x1000 /* Receive fault ability */ ++#define MDIO_PMA_STAT2_TXFLTABLE 0x2000 /* Transmit fault ability */ ++#define MDIO_PCS_STAT2_10GBR 0x0001 /* 10GBASE-R capable */ ++#define MDIO_PCS_STAT2_10GBX 0x0002 /* 10GBASE-X capable */ ++#define MDIO_PCS_STAT2_10GBW 0x0004 /* 10GBASE-W capable */ ++#define MDIO_PCS_STAT2_RXFLTABLE 0x1000 /* Receive fault ability */ ++#define MDIO_PCS_STAT2_TXFLTABLE 0x2000 /* Transmit fault ability */ ++ ++/* Transmit disable register. */ ++#define MDIO_PMD_TXDIS_GLOBAL 0x0001 /* Global PMD TX disable */ ++#define MDIO_PMD_TXDIS_0 0x0002 /* PMD TX disable 0 */ ++#define MDIO_PMD_TXDIS_1 0x0004 /* PMD TX disable 1 */ ++#define MDIO_PMD_TXDIS_2 0x0008 /* PMD TX disable 2 */ ++#define MDIO_PMD_TXDIS_3 0x0010 /* PMD TX disable 3 */ ++ ++/* Receive signal detect register. */ ++#define MDIO_PMD_RXDET_GLOBAL 0x0001 /* Global PMD RX signal detect */ ++#define MDIO_PMD_RXDET_0 0x0002 /* PMD RX signal detect 0 */ ++#define MDIO_PMD_RXDET_1 0x0004 /* PMD RX signal detect 1 */ ++#define MDIO_PMD_RXDET_2 0x0008 /* PMD RX signal detect 2 */ ++#define MDIO_PMD_RXDET_3 0x0010 /* PMD RX signal detect 3 */ ++ ++/* Extended abilities register. */ ++#define MDIO_PMA_EXTABLE_10GCX4 0x0001 /* 10GBASE-CX4 ability */ ++#define MDIO_PMA_EXTABLE_10GBLRM 0x0002 /* 10GBASE-LRM ability */ ++#define MDIO_PMA_EXTABLE_10GBT 0x0004 /* 10GBASE-T ability */ ++#define MDIO_PMA_EXTABLE_10GBKX4 0x0008 /* 10GBASE-KX4 ability */ ++#define MDIO_PMA_EXTABLE_10GBKR 0x0010 /* 10GBASE-KR ability */ ++#define MDIO_PMA_EXTABLE_1000BT 0x0020 /* 1000BASE-T ability */ ++#define MDIO_PMA_EXTABLE_1000BKX 0x0040 /* 1000BASE-KX ability */ ++#define MDIO_PMA_EXTABLE_100BTX 0x0080 /* 100BASE-TX ability */ ++#define MDIO_PMA_EXTABLE_10BT 0x0100 /* 10BASE-T ability */ ++ ++/* PHY XGXS lane state register. */ ++#define MDIO_PHYXS_LNSTAT_SYNC0 0x0001 ++#define MDIO_PHYXS_LNSTAT_SYNC1 0x0002 ++#define MDIO_PHYXS_LNSTAT_SYNC2 0x0004 ++#define MDIO_PHYXS_LNSTAT_SYNC3 0x0008 ++#define MDIO_PHYXS_LNSTAT_ALIGN 0x1000 ++ ++/* PMA 10GBASE-T pair swap & polarity */ ++#define MDIO_PMA_10GBT_SWAPPOL_ABNX 0x0001 /* Pair A/B uncrossed */ ++#define MDIO_PMA_10GBT_SWAPPOL_CDNX 0x0002 /* Pair C/D uncrossed */ ++#define MDIO_PMA_10GBT_SWAPPOL_AREV 0x0100 /* Pair A polarity reversed */ ++#define MDIO_PMA_10GBT_SWAPPOL_BREV 0x0200 /* Pair B polarity reversed */ ++#define MDIO_PMA_10GBT_SWAPPOL_CREV 0x0400 /* Pair C polarity reversed */ ++#define MDIO_PMA_10GBT_SWAPPOL_DREV 0x0800 /* Pair D polarity reversed */ ++ ++/* PMA 10GBASE-T TX power register. */ ++#define MDIO_PMA_10GBT_TXPWR_SHORT 0x0001 /* Short-reach mode */ ++ ++/* PMA 10GBASE-T SNR registers. */ ++/* Value is SNR margin in dB, clamped to range [-127, 127], plus 0x8000. */ ++#define MDIO_PMA_10GBT_SNR_BIAS 0x8000 ++#define MDIO_PMA_10GBT_SNR_MAX 127 ++ ++/* PMA 10GBASE-R FEC ability register. */ ++#define MDIO_PMA_10GBR_FECABLE_ABLE 0x0001 /* FEC ability */ ++#define MDIO_PMA_10GBR_FECABLE_ERRABLE 0x0002 /* FEC error indic. ability */ ++ ++/* PCS 10GBASE-R/-T status register 1. */ ++#define MDIO_PCS_10GBRT_STAT1_BLKLK 0x0001 /* Block lock attained */ ++ ++/* PCS 10GBASE-R/-T status register 2. */ ++#define MDIO_PCS_10GBRT_STAT2_ERR 0x00ff ++#define MDIO_PCS_10GBRT_STAT2_BER 0x3f00 ++ ++/* AN 10GBASE-T control register. */ ++#define MDIO_AN_10GBT_CTRL_ADV10G 0x1000 /* Advertise 10GBASE-T */ ++ ++/* AN 10GBASE-T status register. */ ++#define MDIO_AN_10GBT_STAT_LPTRR 0x0200 /* LP training reset req. */ ++#define MDIO_AN_10GBT_STAT_LPLTABLE 0x0400 /* LP loop timing ability */ ++#define MDIO_AN_10GBT_STAT_LP10G 0x0800 /* LP is 10GBT capable */ ++#define MDIO_AN_10GBT_STAT_REMOK 0x1000 /* Remote OK */ ++#define MDIO_AN_10GBT_STAT_LOCOK 0x2000 /* Local OK */ ++#define MDIO_AN_10GBT_STAT_MS 0x4000 /* Master/slave config */ ++#define MDIO_AN_10GBT_STAT_MSFLT 0x8000 /* Master/slave config fault */ ++ ++/* LASI RX_ALARM control/status registers. */ ++#define MDIO_PMA_LASI_RX_PHYXSLFLT 0x0001 /* PHY XS RX local fault */ ++#define MDIO_PMA_LASI_RX_PCSLFLT 0x0008 /* PCS RX local fault */ ++#define MDIO_PMA_LASI_RX_PMALFLT 0x0010 /* PMA/PMD RX local fault */ ++#define MDIO_PMA_LASI_RX_OPTICPOWERFLT 0x0020 /* RX optical power fault */ ++#define MDIO_PMA_LASI_RX_WISLFLT 0x0200 /* WIS local fault */ ++ ++/* LASI TX_ALARM control/status registers. */ ++#define MDIO_PMA_LASI_TX_PHYXSLFLT 0x0001 /* PHY XS TX local fault */ ++#define MDIO_PMA_LASI_TX_PCSLFLT 0x0008 /* PCS TX local fault */ ++#define MDIO_PMA_LASI_TX_PMALFLT 0x0010 /* PMA/PMD TX local fault */ ++#define MDIO_PMA_LASI_TX_LASERPOWERFLT 0x0080 /* Laser output power fault */ ++#define MDIO_PMA_LASI_TX_LASERTEMPFLT 0x0100 /* Laser temperature fault */ ++#define MDIO_PMA_LASI_TX_LASERBICURRFLT 0x0200 /* Laser bias current fault */ ++ ++/* LASI control/status registers. */ ++#define MDIO_PMA_LASI_LSALARM 0x0001 /* LS_ALARM enable/status */ ++#define MDIO_PMA_LASI_TXALARM 0x0002 /* TX_ALARM enable/status */ ++#define MDIO_PMA_LASI_RXALARM 0x0004 /* RX_ALARM enable/status */ ++ ++/* Mapping between MDIO PRTAD/DEVAD and mii_ioctl_data::phy_id */ ++ ++#define MDIO_PHY_ID_C45 0x8000 ++#define MDIO_PHY_ID_PRTAD 0x03e0 ++#define MDIO_PHY_ID_DEVAD 0x001f ++#define MDIO_PHY_ID_C45_MASK \ ++ (MDIO_PHY_ID_C45 | MDIO_PHY_ID_PRTAD | MDIO_PHY_ID_DEVAD) ++ ++static inline __u16 mdio_phy_id_c45(int prtad, int devad) ++{ ++ return MDIO_PHY_ID_C45 | (prtad << 5) | devad; ++} ++ ++static inline bool mdio_phy_id_is_c45(int phy_id) ++{ ++ return (phy_id & MDIO_PHY_ID_C45) && !(phy_id & ~MDIO_PHY_ID_C45_MASK); ++} ++ ++static inline __u16 mdio_phy_id_prtad(int phy_id) ++{ ++ return (phy_id & MDIO_PHY_ID_PRTAD) >> 5; ++} ++ ++static inline __u16 mdio_phy_id_devad(int phy_id) ++{ ++ return phy_id & MDIO_PHY_ID_DEVAD; ++} ++ ++#define MDIO_SUPPORTS_C22 1 ++#define MDIO_SUPPORTS_C45 2 ++ ++#ifdef __KERNEL__ ++ ++/** ++ * struct mdio_if_info - Ethernet controller MDIO interface ++ * @prtad: PRTAD of the PHY (%MDIO_PRTAD_NONE if not present/unknown) ++ * @mmds: Mask of MMDs expected to be present in the PHY. This must be ++ * non-zero unless @prtad = %MDIO_PRTAD_NONE. ++ * @mode_support: MDIO modes supported. If %MDIO_SUPPORTS_C22 is set then ++ * MII register access will be passed through with @devad = ++ * %MDIO_DEVAD_NONE. If %MDIO_EMULATE_C22 is set then access to ++ * commonly used clause 22 registers will be translated into ++ * clause 45 registers. ++ * @dev: Net device structure ++ * @mdio_read: Register read function; returns value or negative error code ++ * @mdio_write: Register write function; returns 0 or negative error code ++ */ ++struct mdio_if_info { ++ int prtad; ++ u32 mmds; ++ unsigned mode_support; ++ ++ struct net_device *dev; ++ int (*mdio_read)(struct net_device *dev, int prtad, int devad, ++ u16 addr); ++ int (*mdio_write)(struct net_device *dev, int prtad, int devad, ++ u16 addr, u16 val); ++}; ++ ++#define MDIO_PRTAD_NONE (-1) ++#define MDIO_DEVAD_NONE (-1) ++#define MDIO_EMULATE_C22 4 ++ ++struct ethtool_cmd; ++struct ethtool_pauseparam; ++extern int mdio45_probe(struct mdio_if_info *mdio, int prtad); ++extern int mdio_set_flag(const struct mdio_if_info *mdio, ++ int prtad, int devad, u16 addr, int mask, ++ bool sense); ++extern int mdio45_links_ok(const struct mdio_if_info *mdio, u32 mmds); ++extern int mdio45_nway_restart(const struct mdio_if_info *mdio); ++extern void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio, ++ struct ethtool_cmd *ecmd, ++ u32 npage_adv, u32 npage_lpa); ++extern void ++mdio45_ethtool_spauseparam_an(const struct mdio_if_info *mdio, ++ const struct ethtool_pauseparam *ecmd); ++ ++/** ++ * mdio45_ethtool_gset - get settings for ETHTOOL_GSET ++ * @mdio: MDIO interface ++ * @ecmd: Ethtool request structure ++ * ++ * Since the CSRs for auto-negotiation using next pages are not fully ++ * standardised, this function does not attempt to decode them. Use ++ * mdio45_ethtool_gset_npage() to specify advertisement bits from next ++ * pages. ++ */ ++static inline void mdio45_ethtool_gset(const struct mdio_if_info *mdio, ++ struct ethtool_cmd *ecmd) ++{ ++ mdio45_ethtool_gset_npage(mdio, ecmd, 0, 0); ++} ++ ++extern int mdio_mii_ioctl(const struct mdio_if_info *mdio, ++ struct mii_ioctl_data *mii_data, int cmd); ++ ++#endif /* __KERNEL__ */ ++#endif /* __LINUX_MDIO_H__ */ diff --git a/debian/patches/libdde_netdev_tx_t.patch b/debian/patches/libdde_netdev_tx_t.patch new file mode 100644 index 00000000..73ff710c --- /dev/null +++ b/debian/patches/libdde_netdev_tx_t.patch @@ -0,0 +1,66 @@ +commit dc1f8bf68b311b1537cb65893430b6796118498a +Author: Stephen Hemminger <shemminger@vyatta.com> +Date: Mon Aug 31 19:50:40 2009 +0000 + + netdev: change transmit to limited range type + + The transmit function should only return one of three possible values, + some drivers got confused and returned errno's or other values. + This changes the definition so that this can be caught at compile time. + + Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> + Signed-off-by: David S. Miller <davem@davemloft.net> + +diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h +index 60d3aac..376a2e1 100644 +--- a/libdde_linux26/contrib/include/linux/netdevice.h ++++ b/libdde_linux26/contrib/include/linux/netdevice.h +@@ -79,17 +79,19 @@ struct wireless_dev; + #define net_xmit_eval(e) ((e) == NET_XMIT_CN? 0 : (e)) + #define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0) + ++/* Driver transmit return codes */ ++enum netdev_tx { ++ NETDEV_TX_OK = 0, /* driver took care of packet */ ++ NETDEV_TX_BUSY, /* driver tx path was busy*/ ++ NETDEV_TX_LOCKED = -1, /* driver tx lock was already taken */ ++}; ++typedef enum netdev_tx netdev_tx_t; ++ + #endif + + #define MAX_ADDR_LEN 32 /* Largest hardware address length */ + +-/* Driver transmit return codes */ +-#define NETDEV_TX_OK 0 /* driver took care of packet */ +-#define NETDEV_TX_BUSY 1 /* driver tx path was busy*/ +-#define NETDEV_TX_LOCKED -1 /* driver tx lock was already taken */ +- + #ifdef __KERNEL__ +- + /* + * Compute the worst case header length according to the protocols + * used. +@@ -507,9 +509,11 @@ struct netdev_queue { + * This function is called when network device transistions to the down + * state. + * +- * int (*ndo_start_xmit)(struct sk_buff *skb, struct net_device *dev); ++ * netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb, ++ * struct net_device *dev); + * Called when a packet needs to be transmitted. +- * Must return NETDEV_TX_OK , NETDEV_TX_BUSY, or NETDEV_TX_LOCKED, ++ * Must return NETDEV_TX_OK , NETDEV_TX_BUSY. ++ * (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX) + * Required can not be NULL. + * + * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb); +@@ -580,7 +584,7 @@ struct net_device_ops { + void (*ndo_uninit)(struct net_device *dev); + int (*ndo_open)(struct net_device *dev); + int (*ndo_stop)(struct net_device *dev); +- int (*ndo_start_xmit) (struct sk_buff *skb, ++ netdev_tx_t (*ndo_start_xmit) (struct sk_buff *skb, + struct net_device *dev); + u16 (*ndo_select_queue)(struct net_device *dev, + struct sk_buff *skb); diff --git a/debian/patches/libdde_pci-needs_freset.patch b/debian/patches/libdde_pci-needs_freset.patch new file mode 100644 index 00000000..cc1f6aed --- /dev/null +++ b/debian/patches/libdde_pci-needs_freset.patch @@ -0,0 +1,39 @@ +commit 260d703adc5f275e3ba7ddff6e2e0217bc613b35 +Author: Mike Mason <mmlnx@us.ibm.com> +Date: Thu Jul 30 15:33:21 2009 -0700 + + PCI: support for PCI Express fundamental reset + + This is the first of three patches that implement a bit field that PCI + Express device drivers can use to indicate they need a fundamental reset + during error recovery. + + By default, the EEH framework on powerpc does what's known as a "hot + reset" during recovery of a PCI Express device. We've found a case + where the device needs a "fundamental reset" to recover properly. The + current PCI error recovery and EEH frameworks do not support this + distinction. + + The attached patch (courtesy of Richard Lary) adds a bit field to + pci_dev that indicates whether the device requires a fundamental reset + during recovery. + + These patches supersede the previously submitted patch that implemented + a fundamental reset bit field. + + Signed-off-by: Mike Mason <mmlnx@us.ibm.com> + Signed-off-by: Richard Lary <rlary@us.ibm.com> + Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> + +Index: hurd-debian/libdde_linux26/contrib/include/linux/pci.h +=================================================================== +--- hurd-debian.orig/libdde_linux26/contrib/include/linux/pci.h 2012-04-16 00:26:44.000000000 +0000 ++++ hurd-debian/libdde_linux26/contrib/include/linux/pci.h 2012-04-16 00:34:37.000000000 +0000 +@@ -256,6 +256,7 @@ + unsigned int ari_enabled:1; /* ARI forwarding */ + unsigned int is_managed:1; + unsigned int is_pcie:1; ++ unsigned int needs_freset:1; /* Dev requires fundamental reset */ + unsigned int state_saved:1; + pci_dev_flags_t dev_flags; + atomic_t enable_cnt; /* pci_enable_device has been called */ diff --git a/debian/patches/libdde_pci_ids.h.patch b/debian/patches/libdde_pci_ids.h.patch new file mode 100644 index 00000000..df63d98d --- /dev/null +++ b/debian/patches/libdde_pci_ids.h.patch @@ -0,0 +1,515 @@ +--- a/libdde_linux26/contrib/include/linux/pci_ids.h 2012-04-15 20:31:32.000000000 +0000 ++++ b/libdde_linux26/contrib/include/linux/pci_ids.h 2012-03-17 10:14:52.000000000 +0000 +@@ -2,6 +2,9 @@ + * PCI Class, Vendor and Device IDs + * + * Please keep sorted. ++ * ++ * Do not add new entries to this file unless the definitions ++ * are shared between multiple drivers. + */ + + /* Device classes and subclasses */ +@@ -104,6 +107,7 @@ + #define PCI_CLASS_SERIAL_USB_UHCI 0x0c0300 + #define PCI_CLASS_SERIAL_USB_OHCI 0x0c0310 + #define PCI_CLASS_SERIAL_USB_EHCI 0x0c0320 ++#define PCI_CLASS_SERIAL_USB_XHCI 0x0c0330 + #define PCI_CLASS_SERIAL_FIBER 0x0c04 + #define PCI_CLASS_SERIAL_SMBUS 0x0c05 + +@@ -389,6 +393,9 @@ + #define PCI_DEVICE_ID_VLSI_82C147 0x0105 + #define PCI_DEVICE_ID_VLSI_VAS96011 0x0702 + ++/* AMD RD890 Chipset */ ++#define PCI_DEVICE_ID_RD890_IOMMU 0x5a23 ++ + #define PCI_VENDOR_ID_ADL 0x1005 + #define PCI_DEVICE_ID_ADL_2301 0x2301 + +@@ -478,6 +485,9 @@ + #define PCI_DEVICE_ID_IBM_ICOM_V2_ONE_PORT_RVX_ONE_PORT_MDM_PCIE 0x0361 + #define PCI_DEVICE_ID_IBM_ICOM_FOUR_PORT_MODEL 0x252 + ++#define PCI_SUBVENDOR_ID_IBM 0x1014 ++#define PCI_SUBDEVICE_ID_IBM_SATURN_SERIAL_ONE_PORT 0x03d4 ++ + #define PCI_VENDOR_ID_UNISYS 0x1018 + #define PCI_DEVICE_ID_UNISYS_DMA_DIRECTOR 0x001C + +@@ -526,6 +536,7 @@ + #define PCI_DEVICE_ID_AMD_OPUS_7443 0x7443 + #define PCI_DEVICE_ID_AMD_VIPER_7443 0x7443 + #define PCI_DEVICE_ID_AMD_OPUS_7445 0x7445 ++#define PCI_DEVICE_ID_AMD_8111_PCI 0x7460 + #define PCI_DEVICE_ID_AMD_8111_LPC 0x7468 + #define PCI_DEVICE_ID_AMD_8111_IDE 0x7469 + #define PCI_DEVICE_ID_AMD_8111_SMBUS2 0x746a +@@ -535,6 +546,8 @@ + #define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450 + #define PCI_DEVICE_ID_AMD_8131_APIC 0x7451 + #define PCI_DEVICE_ID_AMD_8132_BRIDGE 0x7458 ++#define PCI_DEVICE_ID_AMD_HUDSON2_SMBUS 0x780b ++#define PCI_DEVICE_ID_AMD_CS5535_IDE 0x208F + #define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090 + #define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091 + #define PCI_DEVICE_ID_AMD_CS5536_AUDIO 0x2093 +@@ -543,9 +556,10 @@ + #define PCI_DEVICE_ID_AMD_CS5536_UDC 0x2096 + #define PCI_DEVICE_ID_AMD_CS5536_UOC 0x2097 + #define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A +- + #define PCI_DEVICE_ID_AMD_LX_VIDEO 0x2081 + #define PCI_DEVICE_ID_AMD_LX_AES 0x2082 ++#define PCI_DEVICE_ID_AMD_HUDSON2_IDE 0x780c ++#define PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE 0x7800 + + #define PCI_VENDOR_ID_TRIDENT 0x1023 + #define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000 +@@ -591,6 +605,8 @@ + #define PCI_DEVICE_ID_MATROX_G550 0x2527 + #define PCI_DEVICE_ID_MATROX_VIA 0x4536 + ++#define PCI_VENDOR_ID_MOBILITY_ELECTRONICS 0x14f2 ++ + #define PCI_VENDOR_ID_CT 0x102c + #define PCI_DEVICE_ID_CT_69000 0x00c0 + #define PCI_DEVICE_ID_CT_65545 0x00d8 +@@ -766,6 +782,7 @@ + #define PCI_DEVICE_ID_TI_X515 0x8036 + #define PCI_DEVICE_ID_TI_XX12 0x8039 + #define PCI_DEVICE_ID_TI_XX12_FM 0x803b ++#define PCI_DEVICE_ID_TI_XIO2000A 0x8231 + #define PCI_DEVICE_ID_TI_1130 0xac12 + #define PCI_DEVICE_ID_TI_1031 0xac13 + #define PCI_DEVICE_ID_TI_1131 0xac15 +@@ -834,6 +851,8 @@ + #define PCI_DEVICE_ID_PROMISE_20276 0x5275 + #define PCI_DEVICE_ID_PROMISE_20277 0x7275 + ++#define PCI_VENDOR_ID_FOXCONN 0x105b ++ + #define PCI_VENDOR_ID_UMC 0x1060 + #define PCI_DEVICE_ID_UMC_UM8673F 0x0101 + #define PCI_DEVICE_ID_UMC_UM8886BF 0x673a +@@ -873,6 +892,7 @@ + #define PCI_DEVICE_ID_APPLE_SH_SUNGEM 0x0051 + #define PCI_DEVICE_ID_APPLE_U3L_AGP 0x0058 + #define PCI_DEVICE_ID_APPLE_U3H_AGP 0x0059 ++#define PCI_DEVICE_ID_APPLE_U4_PCIE 0x005b + #define PCI_DEVICE_ID_APPLE_IPID2_AGP 0x0066 + #define PCI_DEVICE_ID_APPLE_IPID2_ATA 0x0069 + #define PCI_DEVICE_ID_APPLE_IPID2_FW 0x006a +@@ -941,6 +961,32 @@ + #define PCI_DEVICE_ID_SUN_TOMATILLO 0xa801 + #define PCI_DEVICE_ID_SUN_CASSINI 0xabba + ++#define PCI_VENDOR_ID_NI 0x1093 ++#define PCI_DEVICE_ID_NI_PCI2322 0xd130 ++#define PCI_DEVICE_ID_NI_PCI2324 0xd140 ++#define PCI_DEVICE_ID_NI_PCI2328 0xd150 ++#define PCI_DEVICE_ID_NI_PXI8422_2322 0xd190 ++#define PCI_DEVICE_ID_NI_PXI8422_2324 0xd1a0 ++#define PCI_DEVICE_ID_NI_PXI8420_2322 0xd1d0 ++#define PCI_DEVICE_ID_NI_PXI8420_2324 0xd1e0 ++#define PCI_DEVICE_ID_NI_PXI8420_2328 0xd1f0 ++#define PCI_DEVICE_ID_NI_PXI8420_23216 0xd1f1 ++#define PCI_DEVICE_ID_NI_PCI2322I 0xd250 ++#define PCI_DEVICE_ID_NI_PCI2324I 0xd270 ++#define PCI_DEVICE_ID_NI_PCI23216 0xd2b0 ++#define PCI_DEVICE_ID_NI_PXI8430_2322 0x7080 ++#define PCI_DEVICE_ID_NI_PCI8430_2322 0x70db ++#define PCI_DEVICE_ID_NI_PXI8430_2324 0x70dd ++#define PCI_DEVICE_ID_NI_PCI8430_2324 0x70df ++#define PCI_DEVICE_ID_NI_PXI8430_2328 0x70e2 ++#define PCI_DEVICE_ID_NI_PCI8430_2328 0x70e4 ++#define PCI_DEVICE_ID_NI_PXI8430_23216 0x70e6 ++#define PCI_DEVICE_ID_NI_PCI8430_23216 0x70e7 ++#define PCI_DEVICE_ID_NI_PXI8432_2322 0x70e8 ++#define PCI_DEVICE_ID_NI_PCI8432_2322 0x70ea ++#define PCI_DEVICE_ID_NI_PXI8432_2324 0x70ec ++#define PCI_DEVICE_ID_NI_PCI8432_2324 0x70ee ++ + #define PCI_VENDOR_ID_CMD 0x1095 + #define PCI_DEVICE_ID_CMD_643 0x0643 + #define PCI_DEVICE_ID_CMD_646 0x0646 +@@ -976,6 +1022,7 @@ + #define PCI_DEVICE_ID_PLX_PCI200SYN 0x3196 + #define PCI_DEVICE_ID_PLX_9030 0x9030 + #define PCI_DEVICE_ID_PLX_9050 0x9050 ++#define PCI_DEVICE_ID_PLX_9056 0x9056 + #define PCI_DEVICE_ID_PLX_9080 0x9080 + #define PCI_DEVICE_ID_PLX_GTEK_SERIAL2 0xa001 + +@@ -1037,8 +1084,6 @@ + #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS 0x0034 + #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE 0x0035 + #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA 0x0036 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_10 0x0037 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_11 0x0038 + #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2 0x003e + #define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800_ULTRA 0x0040 + #define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800 0x0041 +@@ -1049,21 +1094,16 @@ + #define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE 0x0053 + #define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA 0x0054 + #define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2 0x0055 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_8 0x0056 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_9 0x0057 + #define PCI_DEVICE_ID_NVIDIA_CK804_AUDIO 0x0059 + #define PCI_DEVICE_ID_NVIDIA_CK804_PCIE 0x005d + #define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS 0x0064 + #define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE 0x0065 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_2 0x0066 + #define PCI_DEVICE_ID_NVIDIA_MCP2_MODEM 0x0069 + #define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a + #define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS 0x0084 + #define PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE 0x0085 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_4 0x0086 + #define PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM 0x0089 + #define PCI_DEVICE_ID_NVIDIA_CK8_AUDIO 0x008a +-#define PCI_DEVICE_ID_NVIDIA_NVENET_5 0x008c + #define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA 0x008e + #define PCI_DEVICE_ID_NVIDIA_GEFORCE_7800_GT 0x0090 + #define PCI_DEVICE_ID_NVIDIA_GEFORCE_7800_GTX 0x0091 +@@ -1079,15 +1119,12 @@ + #define PCI_DEVICE_ID_NVIDIA_NFORCE3 0x00d1 + #define PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS 0x00d4 + #define PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE 0x00d5 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_3 0x00d6 + #define PCI_DEVICE_ID_NVIDIA_MCP3_MODEM 0x00d9 + #define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da +-#define PCI_DEVICE_ID_NVIDIA_NVENET_7 0x00df + #define PCI_DEVICE_ID_NVIDIA_NFORCE3S 0x00e1 + #define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA 0x00e3 + #define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS 0x00e4 + #define PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE 0x00e5 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_6 0x00e6 + #define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea + #define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2 0x00ee + #define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_ALT1 0x00f0 +@@ -1147,7 +1184,6 @@ + #define PCI_DEVICE_ID_NVIDIA_NFORCE_SMBUS 0x01b4 + #define PCI_DEVICE_ID_NVIDIA_NFORCE_IDE 0x01bc + #define PCI_DEVICE_ID_NVIDIA_MCP1_MODEM 0x01c1 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_1 0x01c3 + #define PCI_DEVICE_ID_NVIDIA_NFORCE2 0x01e0 + #define PCI_DEVICE_ID_NVIDIA_GEFORCE3 0x0200 + #define PCI_DEVICE_ID_NVIDIA_GEFORCE3_1 0x0201 +@@ -1170,8 +1206,6 @@ + #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E + #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA 0x037E + #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2 0x037F +-#define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269 + #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800 0x0280 + #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800_8X 0x0281 + #define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800SE 0x0282 +@@ -1218,42 +1252,22 @@ + #define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_2 0x0348 + #define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO1000 0x034C + #define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1100 0x034E +-#define PCI_DEVICE_ID_NVIDIA_NVENET_14 0x0372 + #define PCI_DEVICE_ID_NVIDIA_NVENET_15 0x0373 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_16 0x03E5 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_17 0x03E6 + #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA 0x03E7 + #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SMBUS 0x03EB + #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE 0x03EC +-#define PCI_DEVICE_ID_NVIDIA_NVENET_18 0x03EE +-#define PCI_DEVICE_ID_NVIDIA_NVENET_19 0x03EF + #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2 0x03F6 + #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3 0x03F7 + #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_SMBUS 0x0446 + #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE 0x0448 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_20 0x0450 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_23 0x0453 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_24 0x054C +-#define PCI_DEVICE_ID_NVIDIA_NVENET_25 0x054D +-#define PCI_DEVICE_ID_NVIDIA_NVENET_26 0x054E +-#define PCI_DEVICE_ID_NVIDIA_NVENET_27 0x054F +-#define PCI_DEVICE_ID_NVIDIA_NVENET_28 0x07DC +-#define PCI_DEVICE_ID_NVIDIA_NVENET_29 0x07DD +-#define PCI_DEVICE_ID_NVIDIA_NVENET_30 0x07DE +-#define PCI_DEVICE_ID_NVIDIA_NVENET_31 0x07DF ++#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_SMBUS 0x0542 + #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560 + #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE 0x056C ++#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP78S_SMBUS 0x0752 + #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_32 0x0760 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_33 0x0761 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_34 0x0762 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_35 0x0763 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_36 0x0AB0 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_37 0x0AB1 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_38 0x0AB2 +-#define PCI_DEVICE_ID_NVIDIA_NVENET_39 0x0AB3 ++#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_SMBUS 0x07D8 ++#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP79_SMBUS 0x0AA2 ++#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA 0x0D85 + + #define PCI_VENDOR_ID_IMS 0x10e0 + #define PCI_DEVICE_ID_IMS_TT128 0x9128 +@@ -1281,6 +1295,13 @@ + + #define PCI_VENDOR_ID_CREATIVE 0x1102 /* duplicate: ECTIVA */ + #define PCI_DEVICE_ID_CREATIVE_EMU10K1 0x0002 ++#define PCI_DEVICE_ID_CREATIVE_20K1 0x0005 ++#define PCI_DEVICE_ID_CREATIVE_20K2 0x000b ++#define PCI_SUBDEVICE_ID_CREATIVE_SB0760 0x0024 ++#define PCI_SUBDEVICE_ID_CREATIVE_SB08801 0x0041 ++#define PCI_SUBDEVICE_ID_CREATIVE_SB08802 0x0042 ++#define PCI_SUBDEVICE_ID_CREATIVE_SB08803 0x0043 ++#define PCI_SUBDEVICE_ID_CREATIVE_HENDRIX 0x6000 + + #define PCI_VENDOR_ID_ECTIVA 0x1102 /* duplicate: CREATIVE */ + #define PCI_DEVICE_ID_ECTIVA_EV1938 0x8938 +@@ -1373,7 +1394,7 @@ + #define PCI_DEVICE_ID_VIA_82C598_1 0x8598 + #define PCI_DEVICE_ID_VIA_838X_1 0xB188 + #define PCI_DEVICE_ID_VIA_83_87XX_1 0xB198 +-#define PCI_DEVICE_ID_VIA_C409_IDE 0XC409 ++#define PCI_DEVICE_ID_VIA_VX855_IDE 0xC409 + #define PCI_DEVICE_ID_VIA_ANON 0xFFFF + + #define PCI_VENDOR_ID_SIEMENS 0x110A +@@ -1473,6 +1494,7 @@ + #define PCI_DEVICE_ID_SERVERWORKS_HT1000IDE 0x0214 + #define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 0x0217 + #define PCI_DEVICE_ID_SERVERWORKS_CSB6LPC 0x0227 ++#define PCI_DEVICE_ID_SERVERWORKS_HT1100LD 0x0408 + + #define PCI_VENDOR_ID_SBE 0x1176 + #define PCI_DEVICE_ID_SBE_WANXL100 0x0301 +@@ -1516,6 +1538,8 @@ + #define PCI_DEVICE_ID_ARTOP_ATP860R 0x0007 + #define PCI_DEVICE_ID_ARTOP_ATP865 0x0008 + #define PCI_DEVICE_ID_ARTOP_ATP865R 0x0009 ++#define PCI_DEVICE_ID_ARTOP_ATP867A 0x000A ++#define PCI_DEVICE_ID_ARTOP_ATP867B 0x000B + #define PCI_DEVICE_ID_ARTOP_AEC7610 0x8002 + #define PCI_DEVICE_ID_ARTOP_AEC7612UW 0x8010 + #define PCI_DEVICE_ID_ARTOP_AEC7612U 0x8020 +@@ -1813,6 +1837,10 @@ + #define PCI_SUBDEVICE_ID_HYPERCOPE_METRO 0x0107 + #define PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2 0x0108 + ++#define PCI_VENDOR_ID_DIGIGRAM 0x1369 ++#define PCI_SUBDEVICE_ID_DIGIGRAM_LX6464ES_SERIAL_SUBSYSTEM 0xc001 ++#define PCI_SUBDEVICE_ID_DIGIGRAM_LX6464ES_CAE_SERIAL_SUBSYSTEM 0xc002 ++ + #define PCI_VENDOR_ID_KAWASAKI 0x136b + #define PCI_DEVICE_ID_MCHIP_KL5A72002 0xff01 + +@@ -1880,6 +1908,8 @@ + #define PCI_SUBDEVICE_ID_CCD_SWYX4S 0xB540 + #define PCI_SUBDEVICE_ID_CCD_JH4S20 0xB550 + #define PCI_SUBDEVICE_ID_CCD_IOB8ST_1 0xB552 ++#define PCI_SUBDEVICE_ID_CCD_JHSE1 0xB553 ++#define PCI_SUBDEVICE_ID_CCD_JH8S 0xB55B + #define PCI_SUBDEVICE_ID_CCD_BN4S 0xB560 + #define PCI_SUBDEVICE_ID_CCD_BN8S 0xB562 + #define PCI_SUBDEVICE_ID_CCD_BNE1 0xB563 +@@ -1932,6 +1962,8 @@ + #define PCI_DEVICE_ID_LAVA_DSERIAL 0x0100 /* 2x 16550 */ + #define PCI_DEVICE_ID_LAVA_QUATRO_A 0x0101 /* 2x 16550, half of 4 port */ + #define PCI_DEVICE_ID_LAVA_QUATRO_B 0x0102 /* 2x 16550, half of 4 port */ ++#define PCI_DEVICE_ID_LAVA_QUATTRO_A 0x0120 /* 2x 16550A, half of 4 port */ ++#define PCI_DEVICE_ID_LAVA_QUATTRO_B 0x0121 /* 2x 16550A, half of 4 port */ + #define PCI_DEVICE_ID_LAVA_OCTO_A 0x0180 /* 4x 16550A, half of 8 port */ + #define PCI_DEVICE_ID_LAVA_OCTO_B 0x0181 /* 4x 16550A, half of 8 port */ + #define PCI_DEVICE_ID_LAVA_PORT_PLUS 0x0200 /* 2x 16650 */ +@@ -1962,15 +1994,21 @@ + #define PCI_DEVICE_ID_OXSEMI_PCIe952_1_U 0xC118 + #define PCI_DEVICE_ID_OXSEMI_PCIe952_1_GU 0xC11C + #define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501 ++#define PCI_DEVICE_ID_OXSEMI_C950 0x950B + #define PCI_DEVICE_ID_OXSEMI_16PCI95N 0x9511 + #define PCI_DEVICE_ID_OXSEMI_16PCI954PP 0x9513 + #define PCI_DEVICE_ID_OXSEMI_16PCI952 0x9521 + #define PCI_DEVICE_ID_OXSEMI_16PCI952PP 0x9523 ++#define PCI_SUBDEVICE_ID_OXSEMI_C950 0x0001 + + #define PCI_VENDOR_ID_CHELSIO 0x1425 + + #define PCI_VENDOR_ID_SAMSUNG 0x144d + ++#define PCI_VENDOR_ID_GIGABYTE 0x1458 ++ ++#define PCI_VENDOR_ID_AMBIT 0x1468 ++ + #define PCI_VENDOR_ID_MYRICOM 0x14c1 + + #define PCI_VENDOR_ID_TITAN 0x14D2 +@@ -1998,6 +2036,7 @@ + #define PCI_DEVICE_ID_AFAVLAB_P030 0x2182 + #define PCI_SUBDEVICE_ID_AFAVLAB_P061 0x2150 + ++#define PCI_VENDOR_ID_BCM_GVC 0x14a4 + #define PCI_VENDOR_ID_BROADCOM 0x14e4 + #define PCI_DEVICE_ID_TIGON3_5752 0x1600 + #define PCI_DEVICE_ID_TIGON3_5752M 0x1601 +@@ -2047,7 +2086,6 @@ + #define PCI_DEVICE_ID_TIGON3_5787M 0x1693 + #define PCI_DEVICE_ID_TIGON3_5782 0x1696 + #define PCI_DEVICE_ID_TIGON3_5784 0x1698 +-#define PCI_DEVICE_ID_TIGON3_5785 0x1699 + #define PCI_DEVICE_ID_TIGON3_5786 0x169a + #define PCI_DEVICE_ID_TIGON3_5787 0x169b + #define PCI_DEVICE_ID_TIGON3_5788 0x169c +@@ -2077,6 +2115,7 @@ + #define PCI_VENDOR_ID_MAINPINE 0x1522 + #define PCI_DEVICE_ID_MAINPINE_PBRIDGE 0x0100 + #define PCI_VENDOR_ID_ENE 0x1524 ++#define PCI_DEVICE_ID_ENE_CB710_FLASH 0x0510 + #define PCI_DEVICE_ID_ENE_CB712_SD 0x0550 + #define PCI_DEVICE_ID_ENE_CB712_SD_2 0x0551 + #define PCI_DEVICE_ID_ENE_CB714_SD 0x0750 +@@ -2112,6 +2151,8 @@ + #define PCI_DEVICE_ID_MELLANOX_SINAI_OLD 0x5e8c + #define PCI_DEVICE_ID_MELLANOX_SINAI 0x6274 + ++#define PCI_VENDOR_ID_DFI 0x15bd ++ + #define PCI_VENDOR_ID_QUICKNET 0x15e2 + #define PCI_DEVICE_ID_QUICKNET_XJ 0x0500 + +@@ -2131,6 +2172,10 @@ + #define PCI_DEVICE_ID_ADDIDATA_APCI7420_3 0x700D + #define PCI_DEVICE_ID_ADDIDATA_APCI7300_3 0x700E + #define PCI_DEVICE_ID_ADDIDATA_APCI7800_3 0x700F ++#define PCI_DEVICE_ID_ADDIDATA_APCIe7300 0x7010 ++#define PCI_DEVICE_ID_ADDIDATA_APCIe7420 0x7011 ++#define PCI_DEVICE_ID_ADDIDATA_APCIe7500 0x7012 ++#define PCI_DEVICE_ID_ADDIDATA_APCIe7800 0x7013 + + #define PCI_VENDOR_ID_PDC 0x15e9 + +@@ -2215,10 +2260,20 @@ + + #define PCI_VENDOR_ID_TOPSPIN 0x1867 + ++#define PCI_VENDOR_ID_SILAN 0x1904 ++ + #define PCI_VENDOR_ID_TDI 0x192E + #define PCI_DEVICE_ID_TDI_EHCI 0x0101 + + #define PCI_VENDOR_ID_FREESCALE 0x1957 ++#define PCI_DEVICE_ID_MPC8315E 0x00b4 ++#define PCI_DEVICE_ID_MPC8315 0x00b5 ++#define PCI_DEVICE_ID_MPC8314E 0x00b6 ++#define PCI_DEVICE_ID_MPC8314 0x00b7 ++#define PCI_DEVICE_ID_MPC8378E 0x00c4 ++#define PCI_DEVICE_ID_MPC8378 0x00c5 ++#define PCI_DEVICE_ID_MPC8377E 0x00c6 ++#define PCI_DEVICE_ID_MPC8377 0x00c7 + #define PCI_DEVICE_ID_MPC8548E 0x0012 + #define PCI_DEVICE_ID_MPC8548 0x0013 + #define PCI_DEVICE_ID_MPC8543E 0x0014 +@@ -2226,6 +2281,8 @@ + #define PCI_DEVICE_ID_MPC8547E 0x0018 + #define PCI_DEVICE_ID_MPC8545E 0x0019 + #define PCI_DEVICE_ID_MPC8545 0x001a ++#define PCI_DEVICE_ID_MPC8569E 0x0061 ++#define PCI_DEVICE_ID_MPC8569 0x0060 + #define PCI_DEVICE_ID_MPC8568E 0x0020 + #define PCI_DEVICE_ID_MPC8568 0x0021 + #define PCI_DEVICE_ID_MPC8567E 0x0022 +@@ -2238,6 +2295,22 @@ + #define PCI_DEVICE_ID_MPC8572 0x0041 + #define PCI_DEVICE_ID_MPC8536E 0x0050 + #define PCI_DEVICE_ID_MPC8536 0x0051 ++#define PCI_DEVICE_ID_P2020E 0x0070 ++#define PCI_DEVICE_ID_P2020 0x0071 ++#define PCI_DEVICE_ID_P2010E 0x0078 ++#define PCI_DEVICE_ID_P2010 0x0079 ++#define PCI_DEVICE_ID_P1020E 0x0100 ++#define PCI_DEVICE_ID_P1020 0x0101 ++#define PCI_DEVICE_ID_P1011E 0x0108 ++#define PCI_DEVICE_ID_P1011 0x0109 ++#define PCI_DEVICE_ID_P1022E 0x0110 ++#define PCI_DEVICE_ID_P1022 0x0111 ++#define PCI_DEVICE_ID_P1013E 0x0118 ++#define PCI_DEVICE_ID_P1013 0x0119 ++#define PCI_DEVICE_ID_P4080E 0x0400 ++#define PCI_DEVICE_ID_P4080 0x0401 ++#define PCI_DEVICE_ID_P4040E 0x0408 ++#define PCI_DEVICE_ID_P4040 0x0409 + #define PCI_DEVICE_ID_MPC8641 0x7010 + #define PCI_DEVICE_ID_MPC8641D 0x7011 + #define PCI_DEVICE_ID_MPC8610 0x7018 +@@ -2251,6 +2324,7 @@ + #define PCI_VENDOR_ID_JMICRON 0x197B + #define PCI_DEVICE_ID_JMICRON_JMB360 0x2360 + #define PCI_DEVICE_ID_JMICRON_JMB361 0x2361 ++#define PCI_DEVICE_ID_JMICRON_JMB362 0x2362 + #define PCI_DEVICE_ID_JMICRON_JMB363 0x2363 + #define PCI_DEVICE_ID_JMICRON_JMB365 0x2365 + #define PCI_DEVICE_ID_JMICRON_JMB366 0x2366 +@@ -2263,6 +2337,10 @@ + #define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600 + #define PCI_DEVICE_ID_KORENIX_JETCARDF1 0x16ff + ++#define PCI_VENDOR_ID_QMI 0x1a32 ++ ++#define PCI_VENDOR_ID_AZWAVE 0x1a3b ++ + #define PCI_VENDOR_ID_TEKRAM 0x1de1 + #define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 + +@@ -2342,6 +2420,9 @@ + #define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21 + #define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30 + #define PCI_DEVICE_ID_INTEL_IOAT 0x1a38 ++#define PCI_DEVICE_ID_INTEL_CPT_SMBUS 0x1c22 ++#define PCI_DEVICE_ID_INTEL_CPT_LPC1 0x1c42 ++#define PCI_DEVICE_ID_INTEL_CPT_LPC2 0x1c43 + #define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 + #define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411 + #define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413 +@@ -2373,6 +2454,7 @@ + #define PCI_DEVICE_ID_INTEL_82801CA_12 0x248c + #define PCI_DEVICE_ID_INTEL_82801DB_0 0x24c0 + #define PCI_DEVICE_ID_INTEL_82801DB_1 0x24c1 ++#define PCI_DEVICE_ID_INTEL_82801DB_2 0x24c2 + #define PCI_DEVICE_ID_INTEL_82801DB_3 0x24c3 + #define PCI_DEVICE_ID_INTEL_82801DB_5 0x24c5 + #define PCI_DEVICE_ID_INTEL_82801DB_6 0x24c6 +@@ -2463,6 +2545,8 @@ + #define PCI_DEVICE_ID_INTEL_IOAT_TBG3 0x3433 + #define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 + #define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577 ++#define PCI_DEVICE_ID_INTEL_82854_HB 0x358c ++#define PCI_DEVICE_ID_INTEL_82854_IG 0x358e + #define PCI_DEVICE_ID_INTEL_82855GM_HB 0x3580 + #define PCI_DEVICE_ID_INTEL_82855GM_IG 0x3582 + #define PCI_DEVICE_ID_INTEL_E7520_MCH 0x3590 +@@ -2476,6 +2560,16 @@ + #define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e + #define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b + #define PCI_DEVICE_ID_INTEL_FBD_CNB 0x360c ++#define PCI_DEVICE_ID_INTEL_IOAT_JSF0 0x3710 ++#define PCI_DEVICE_ID_INTEL_IOAT_JSF1 0x3711 ++#define PCI_DEVICE_ID_INTEL_IOAT_JSF2 0x3712 ++#define PCI_DEVICE_ID_INTEL_IOAT_JSF3 0x3713 ++#define PCI_DEVICE_ID_INTEL_IOAT_JSF4 0x3714 ++#define PCI_DEVICE_ID_INTEL_IOAT_JSF5 0x3715 ++#define PCI_DEVICE_ID_INTEL_IOAT_JSF6 0x3716 ++#define PCI_DEVICE_ID_INTEL_IOAT_JSF7 0x3717 ++#define PCI_DEVICE_ID_INTEL_IOAT_JSF8 0x3718 ++#define PCI_DEVICE_ID_INTEL_IOAT_JSF9 0x3719 + #define PCI_DEVICE_ID_INTEL_ICH10_0 0x3a14 + #define PCI_DEVICE_ID_INTEL_ICH10_1 0x3a16 + #define PCI_DEVICE_ID_INTEL_ICH10_2 0x3a18 +@@ -2606,6 +2700,7 @@ + #define PCI_DEVICE_ID_NETMOS_9835 0x9835 + #define PCI_DEVICE_ID_NETMOS_9845 0x9845 + #define PCI_DEVICE_ID_NETMOS_9855 0x9855 ++#define PCI_DEVICE_ID_NETMOS_9901 0x9901 + + #define PCI_VENDOR_ID_3COM_2 0xa727 + diff --git a/debian/patches/libdde_phy.patch b/debian/patches/libdde_phy.patch new file mode 100644 index 00000000..b7385122 --- /dev/null +++ b/debian/patches/libdde_phy.patch @@ -0,0 +1,60 @@ +--- a/libdde_linux26/contrib/include/linux/phy.h 2012-04-15 20:31:32.000000000 +0000 ++++ b/libdde_linux26/contrib/include/linux/phy.h 2012-03-17 10:14:52.000000000 +0000 +@@ -79,7 +79,7 @@ + * Need to be a little smaller than phydev->dev.bus_id to leave room + * for the ":%02x" + */ +-#define MII_BUS_ID_SIZE (BUS_ID_SIZE - 3) ++#define MII_BUS_ID_SIZE (20 - 3) + + /* + * The Bus class for PHYs. Devices which provide access to +@@ -315,8 +315,7 @@ + + /* Interrupt and Polling infrastructure */ + struct work_struct phy_queue; +- struct work_struct state_queue; +- struct timer_list phy_timer; ++ struct delayed_work state_queue; + atomic_t irq_disable; + + struct mutex lock; +@@ -389,6 +388,12 @@ + /* Enables or disables interrupts */ + int (*config_intr)(struct phy_device *phydev); + ++ /* ++ * Checks if the PHY generated an interrupt. ++ * For multi-PHY devices with shared PHY interrupt pin ++ */ ++ int (*did_interrupt)(struct phy_device *phydev); ++ + /* Clears up any memory if needed */ + void (*remove)(struct phy_device *phydev); + +@@ -402,7 +407,7 @@ + /* A Structure for boards to register fixups with the PHY Lib */ + struct phy_fixup { + struct list_head list; +- char bus_id[BUS_ID_SIZE]; ++ char bus_id[20]; + u32 phy_uid; + u32 phy_uid_mask; + int (*run)(struct phy_device *phydev); +@@ -439,10 +444,16 @@ + + int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id); + struct phy_device* get_phy_device(struct mii_bus *bus, int addr); ++int phy_device_register(struct phy_device *phy); + int phy_clear_interrupt(struct phy_device *phydev); + int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); ++int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, ++ u32 flags, phy_interface_t interface); + struct phy_device * phy_attach(struct net_device *dev, + const char *bus_id, u32 flags, phy_interface_t interface); ++int phy_connect_direct(struct net_device *dev, struct phy_device *phydev, ++ void (*handler)(struct net_device *), u32 flags, ++ phy_interface_t interface); + struct phy_device * phy_connect(struct net_device *dev, const char *bus_id, + void (*handler)(struct net_device *), u32 flags, + phy_interface_t interface); diff --git a/debian/patches/libdde_pr_cont.patch b/debian/patches/libdde_pr_cont.patch new file mode 100644 index 00000000..74b88a2a --- /dev/null +++ b/debian/patches/libdde_pr_cont.patch @@ -0,0 +1,26 @@ +diff --git a/libdde_linux26/include/linux/kernel.h b/libdde_linux26/include/linux/kernel.h +index 573ed07..6354939 100644 +--- a/libdde_linux26/include/linux/kernel.h ++++ b/libdde_linux26/include/linux/kernel.h +@@ -363,6 +363,8 @@ static inline char *pack_hex_byte(char *buf, u8 byte) + printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) + #define pr_info(fmt, ...) \ + printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) ++#define pr_cont(fmt, ...) \ ++ printk(KERN_CONT fmt, ##__VA_ARGS__) + + #if defined(DEBUG) + #ifndef DDE_LINUX +diff --git a/libdde_linux26/contrib/include/linux/kernel.h b/libdde_linux26/contrib/include/linux/kernel.h +index 7fa3718..0bded10 100644 +--- a/libdde_linux26/contrib/include/linux/kernel.h ++++ b/libdde_linux26/contrib/include/linux/kernel.h +@@ -353,6 +353,8 @@ static inline char *pack_hex_byte(char *buf, u8 byte) + printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) + #define pr_info(fmt, ...) \ + printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) ++#define pr_cont(fmt, ...) \ ++ printk(KERN_CONT fmt, ##__VA_ARGS__) + + /* If you are writing a driver, please use dev_dbg instead */ + #if defined(DEBUG) diff --git a/debian/patches/libdde_rcu.patch b/debian/patches/libdde_rcu.patch new file mode 100644 index 00000000..25f8a395 --- /dev/null +++ b/debian/patches/libdde_rcu.patch @@ -0,0 +1,816 @@ +--- /dev/null 2011-08-03 18:03:30.000000000 +0000 ++++ b/libdde_linux26/contrib/kernel/rcuclassic.c 2012-04-15 23:40:54.000000000 +0000 +@@ -0,0 +1,788 @@ ++/* ++ * Read-Copy Update mechanism for mutual exclusion ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * Copyright IBM Corporation, 2001 ++ * ++ * Authors: Dipankar Sarma <dipankar@in.ibm.com> ++ * Manfred Spraul <manfred@colorfullife.com> ++ * ++ * Based on the original work by Paul McKenney <paulmck@us.ibm.com> ++ * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen. ++ * Papers: ++ * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf ++ * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001) ++ * ++ * For detailed explanation of Read-Copy Update mechanism see - ++ * Documentation/RCU ++ * ++ */ ++#include <linux/types.h> ++#include <linux/kernel.h> ++#include <linux/init.h> ++#include <linux/spinlock.h> ++#include <linux/smp.h> ++#include <linux/rcupdate.h> ++#include <linux/interrupt.h> ++#include <linux/sched.h> ++#include <asm/atomic.h> ++#include <linux/bitops.h> ++#include <linux/module.h> ++#include <linux/completion.h> ++#include <linux/moduleparam.h> ++#include <linux/percpu.h> ++#include <linux/notifier.h> ++#include <linux/cpu.h> ++#include <linux/mutex.h> ++#include <linux/time.h> ++ ++#ifdef CONFIG_DEBUG_LOCK_ALLOC ++static struct lock_class_key rcu_lock_key; ++struct lockdep_map rcu_lock_map = ++ STATIC_LOCKDEP_MAP_INIT("rcu_read_lock", &rcu_lock_key); ++EXPORT_SYMBOL_GPL(rcu_lock_map); ++#endif ++ ++ ++/* Definition for rcupdate control block. */ ++static struct rcu_ctrlblk rcu_ctrlblk = { ++ .cur = -300, ++ .completed = -300, ++ .pending = -300, ++ .lock = __SPIN_LOCK_UNLOCKED(&rcu_ctrlblk.lock), ++ .cpumask = CPU_BITS_NONE, ++}; ++static struct rcu_ctrlblk rcu_bh_ctrlblk = { ++ .cur = -300, ++ .completed = -300, ++ .pending = -300, ++ .lock = __SPIN_LOCK_UNLOCKED(&rcu_bh_ctrlblk.lock), ++ .cpumask = CPU_BITS_NONE, ++}; ++ ++DEFINE_PER_CPU(struct rcu_data, rcu_data) = { 0L }; ++DEFINE_PER_CPU(struct rcu_data, rcu_bh_data) = { 0L }; ++ ++static int blimit = 10; ++static int qhimark = 10000; ++static int qlowmark = 100; ++ ++#ifdef CONFIG_SMP ++static void force_quiescent_state(struct rcu_data *rdp, ++ struct rcu_ctrlblk *rcp) ++{ ++ int cpu; ++ unsigned long flags; ++ ++ set_need_resched(); ++ spin_lock_irqsave(&rcp->lock, flags); ++ if (unlikely(!rcp->signaled)) { ++ rcp->signaled = 1; ++ /* ++ * Don't send IPI to itself. With irqs disabled, ++ * rdp->cpu is the current cpu. ++ * ++ * cpu_online_mask is updated by the _cpu_down() ++ * using __stop_machine(). Since we're in irqs disabled ++ * section, __stop_machine() is not exectuting, hence ++ * the cpu_online_mask is stable. ++ * ++ * However, a cpu might have been offlined _just_ before ++ * we disabled irqs while entering here. ++ * And rcu subsystem might not yet have handled the CPU_DEAD ++ * notification, leading to the offlined cpu's bit ++ * being set in the rcp->cpumask. ++ * ++ * Hence cpumask = (rcp->cpumask & cpu_online_mask) to prevent ++ * sending smp_reschedule() to an offlined CPU. ++ */ ++ for_each_cpu_and(cpu, ++ to_cpumask(rcp->cpumask), cpu_online_mask) { ++ if (cpu != rdp->cpu) ++ smp_send_reschedule(cpu); ++ } ++ } ++ spin_unlock_irqrestore(&rcp->lock, flags); ++} ++#else ++static inline void force_quiescent_state(struct rcu_data *rdp, ++ struct rcu_ctrlblk *rcp) ++{ ++ set_need_resched(); ++} ++#endif ++ ++static void __call_rcu(struct rcu_head *head, struct rcu_ctrlblk *rcp, ++ struct rcu_data *rdp) ++{ ++ long batch; ++ ++ head->next = NULL; ++ smp_mb(); /* Read of rcu->cur must happen after any change by caller. */ ++ ++ /* ++ * Determine the batch number of this callback. ++ * ++ * Using ACCESS_ONCE to avoid the following error when gcc eliminates ++ * local variable "batch" and emits codes like this: ++ * 1) rdp->batch = rcp->cur + 1 # gets old value ++ * ...... ++ * 2)rcu_batch_after(rcp->cur + 1, rdp->batch) # gets new value ++ * then [*nxttail[0], *nxttail[1]) may contain callbacks ++ * that batch# = rdp->batch, see the comment of struct rcu_data. ++ */ ++ batch = ACCESS_ONCE(rcp->cur) + 1; ++ ++ if (rdp->nxtlist && rcu_batch_after(batch, rdp->batch)) { ++ /* process callbacks */ ++ rdp->nxttail[0] = rdp->nxttail[1]; ++ rdp->nxttail[1] = rdp->nxttail[2]; ++ if (rcu_batch_after(batch - 1, rdp->batch)) ++ rdp->nxttail[0] = rdp->nxttail[2]; ++ } ++ ++ rdp->batch = batch; ++ *rdp->nxttail[2] = head; ++ rdp->nxttail[2] = &head->next; ++ ++ if (unlikely(++rdp->qlen > qhimark)) { ++ rdp->blimit = INT_MAX; ++ force_quiescent_state(rdp, &rcu_ctrlblk); ++ } ++} ++ ++#ifdef CONFIG_RCU_CPU_STALL_DETECTOR ++ ++static void record_gp_stall_check_time(struct rcu_ctrlblk *rcp) ++{ ++ rcp->gp_start = jiffies; ++ rcp->jiffies_stall = jiffies + RCU_SECONDS_TILL_STALL_CHECK; ++} ++ ++static void print_other_cpu_stall(struct rcu_ctrlblk *rcp) ++{ ++ int cpu; ++ long delta; ++ unsigned long flags; ++ ++ /* Only let one CPU complain about others per time interval. */ ++ ++ spin_lock_irqsave(&rcp->lock, flags); ++ delta = jiffies - rcp->jiffies_stall; ++ if (delta < 2 || rcp->cur != rcp->completed) { ++ spin_unlock_irqrestore(&rcp->lock, flags); ++ return; ++ } ++ rcp->jiffies_stall = jiffies + RCU_SECONDS_TILL_STALL_RECHECK; ++ spin_unlock_irqrestore(&rcp->lock, flags); ++ ++ /* OK, time to rat on our buddy... */ ++ ++ printk(KERN_ERR "INFO: RCU detected CPU stalls:"); ++ for_each_possible_cpu(cpu) { ++ if (cpumask_test_cpu(cpu, to_cpumask(rcp->cpumask))) ++ printk(" %d", cpu); ++ } ++ printk(" (detected by %d, t=%ld jiffies)\n", ++ smp_processor_id(), (long)(jiffies - rcp->gp_start)); ++} ++ ++static void print_cpu_stall(struct rcu_ctrlblk *rcp) ++{ ++ unsigned long flags; ++ ++ printk(KERN_ERR "INFO: RCU detected CPU %d stall (t=%lu/%lu jiffies)\n", ++ smp_processor_id(), jiffies, ++ jiffies - rcp->gp_start); ++ dump_stack(); ++ spin_lock_irqsave(&rcp->lock, flags); ++ if ((long)(jiffies - rcp->jiffies_stall) >= 0) ++ rcp->jiffies_stall = ++ jiffies + RCU_SECONDS_TILL_STALL_RECHECK; ++ spin_unlock_irqrestore(&rcp->lock, flags); ++ set_need_resched(); /* kick ourselves to get things going. */ ++} ++ ++static void check_cpu_stall(struct rcu_ctrlblk *rcp) ++{ ++ long delta; ++ ++ delta = jiffies - rcp->jiffies_stall; ++ if (cpumask_test_cpu(smp_processor_id(), to_cpumask(rcp->cpumask)) && ++ delta >= 0) { ++ ++ /* We haven't checked in, so go dump stack. */ ++ print_cpu_stall(rcp); ++ ++ } else if (rcp->cur != rcp->completed && delta >= 2) { ++ ++ /* They had two seconds to dump stack, so complain. */ ++ print_other_cpu_stall(rcp); ++ } ++} ++ ++#else /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ ++ ++static void record_gp_stall_check_time(struct rcu_ctrlblk *rcp) ++{ ++} ++ ++static inline void check_cpu_stall(struct rcu_ctrlblk *rcp) ++{ ++} ++ ++#endif /* #else #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ ++ ++/** ++ * call_rcu - Queue an RCU callback for invocation after a grace period. ++ * @head: structure to be used for queueing the RCU updates. ++ * @func: actual update function to be invoked after the grace period ++ * ++ * The update function will be invoked some time after a full grace ++ * period elapses, in other words after all currently executing RCU ++ * read-side critical sections have completed. RCU read-side critical ++ * sections are delimited by rcu_read_lock() and rcu_read_unlock(), ++ * and may be nested. ++ */ ++void call_rcu(struct rcu_head *head, ++ void (*func)(struct rcu_head *rcu)) ++{ ++ unsigned long flags; ++ ++ head->func = func; ++ local_irq_save(flags); ++ __call_rcu(head, &rcu_ctrlblk, &__get_cpu_var(rcu_data)); ++ local_irq_restore(flags); ++} ++EXPORT_SYMBOL_GPL(call_rcu); ++ ++/** ++ * call_rcu_bh - Queue an RCU for invocation after a quicker grace period. ++ * @head: structure to be used for queueing the RCU updates. ++ * @func: actual update function to be invoked after the grace period ++ * ++ * The update function will be invoked some time after a full grace ++ * period elapses, in other words after all currently executing RCU ++ * read-side critical sections have completed. call_rcu_bh() assumes ++ * that the read-side critical sections end on completion of a softirq ++ * handler. This means that read-side critical sections in process ++ * context must not be interrupted by softirqs. This interface is to be ++ * used when most of the read-side critical sections are in softirq context. ++ * RCU read-side critical sections are delimited by rcu_read_lock() and ++ * rcu_read_unlock(), * if in interrupt context or rcu_read_lock_bh() ++ * and rcu_read_unlock_bh(), if in process context. These may be nested. ++ */ ++void call_rcu_bh(struct rcu_head *head, ++ void (*func)(struct rcu_head *rcu)) ++{ ++ unsigned long flags; ++ ++ head->func = func; ++ local_irq_save(flags); ++ __call_rcu(head, &rcu_bh_ctrlblk, &__get_cpu_var(rcu_bh_data)); ++ local_irq_restore(flags); ++} ++EXPORT_SYMBOL_GPL(call_rcu_bh); ++ ++/* ++ * Return the number of RCU batches processed thus far. Useful ++ * for debug and statistics. ++ */ ++long rcu_batches_completed(void) ++{ ++ return rcu_ctrlblk.completed; ++} ++EXPORT_SYMBOL_GPL(rcu_batches_completed); ++ ++/* ++ * Return the number of RCU batches processed thus far. Useful ++ * for debug and statistics. ++ */ ++long rcu_batches_completed_bh(void) ++{ ++ return rcu_bh_ctrlblk.completed; ++} ++EXPORT_SYMBOL_GPL(rcu_batches_completed_bh); ++ ++/* Raises the softirq for processing rcu_callbacks. */ ++static inline void raise_rcu_softirq(void) ++{ ++ raise_softirq(RCU_SOFTIRQ); ++} ++ ++/* ++ * Invoke the completed RCU callbacks. They are expected to be in ++ * a per-cpu list. ++ */ ++static void rcu_do_batch(struct rcu_data *rdp) ++{ ++ unsigned long flags; ++ struct rcu_head *next, *list; ++ int count = 0; ++ ++ list = rdp->donelist; ++ while (list) { ++ next = list->next; ++ prefetch(next); ++ list->func(list); ++ list = next; ++ if (++count >= rdp->blimit) ++ break; ++ } ++ rdp->donelist = list; ++ ++ local_irq_save(flags); ++ rdp->qlen -= count; ++ local_irq_restore(flags); ++ if (rdp->blimit == INT_MAX && rdp->qlen <= qlowmark) ++ rdp->blimit = blimit; ++ ++ if (!rdp->donelist) ++ rdp->donetail = &rdp->donelist; ++ else ++ raise_rcu_softirq(); ++} ++ ++/* ++ * Grace period handling: ++ * The grace period handling consists out of two steps: ++ * - A new grace period is started. ++ * This is done by rcu_start_batch. The start is not broadcasted to ++ * all cpus, they must pick this up by comparing rcp->cur with ++ * rdp->quiescbatch. All cpus are recorded in the ++ * rcu_ctrlblk.cpumask bitmap. ++ * - All cpus must go through a quiescent state. ++ * Since the start of the grace period is not broadcasted, at least two ++ * calls to rcu_check_quiescent_state are required: ++ * The first call just notices that a new grace period is running. The ++ * following calls check if there was a quiescent state since the beginning ++ * of the grace period. If so, it updates rcu_ctrlblk.cpumask. If ++ * the bitmap is empty, then the grace period is completed. ++ * rcu_check_quiescent_state calls rcu_start_batch(0) to start the next grace ++ * period (if necessary). ++ */ ++ ++/* ++ * Register a new batch of callbacks, and start it up if there is currently no ++ * active batch and the batch to be registered has not already occurred. ++ * Caller must hold rcu_ctrlblk.lock. ++ */ ++static void rcu_start_batch(struct rcu_ctrlblk *rcp) ++{ ++ if (rcp->cur != rcp->pending && ++ rcp->completed == rcp->cur) { ++ rcp->cur++; ++ record_gp_stall_check_time(rcp); ++ ++ /* ++ * Accessing nohz_cpu_mask before incrementing rcp->cur needs a ++ * Barrier Otherwise it can cause tickless idle CPUs to be ++ * included in rcp->cpumask, which will extend graceperiods ++ * unnecessarily. ++ */ ++ smp_mb(); ++ cpumask_andnot(to_cpumask(rcp->cpumask), ++ cpu_online_mask, nohz_cpu_mask); ++ ++ rcp->signaled = 0; ++ } ++} ++ ++/* ++ * cpu went through a quiescent state since the beginning of the grace period. ++ * Clear it from the cpu mask and complete the grace period if it was the last ++ * cpu. Start another grace period if someone has further entries pending ++ */ ++static void cpu_quiet(int cpu, struct rcu_ctrlblk *rcp) ++{ ++ cpumask_clear_cpu(cpu, to_cpumask(rcp->cpumask)); ++ if (cpumask_empty(to_cpumask(rcp->cpumask))) { ++ /* batch completed ! */ ++ rcp->completed = rcp->cur; ++ rcu_start_batch(rcp); ++ } ++} ++ ++/* ++ * Check if the cpu has gone through a quiescent state (say context ++ * switch). If so and if it already hasn't done so in this RCU ++ * quiescent cycle, then indicate that it has done so. ++ */ ++static void rcu_check_quiescent_state(struct rcu_ctrlblk *rcp, ++ struct rcu_data *rdp) ++{ ++ unsigned long flags; ++ ++ if (rdp->quiescbatch != rcp->cur) { ++ /* start new grace period: */ ++ rdp->qs_pending = 1; ++ rdp->passed_quiesc = 0; ++ rdp->quiescbatch = rcp->cur; ++ return; ++ } ++ ++ /* Grace period already completed for this cpu? ++ * qs_pending is checked instead of the actual bitmap to avoid ++ * cacheline trashing. ++ */ ++ if (!rdp->qs_pending) ++ return; ++ ++ /* ++ * Was there a quiescent state since the beginning of the grace ++ * period? If no, then exit and wait for the next call. ++ */ ++ if (!rdp->passed_quiesc) ++ return; ++ rdp->qs_pending = 0; ++ ++ spin_lock_irqsave(&rcp->lock, flags); ++ /* ++ * rdp->quiescbatch/rcp->cur and the cpu bitmap can come out of sync ++ * during cpu startup. Ignore the quiescent state. ++ */ ++ if (likely(rdp->quiescbatch == rcp->cur)) ++ cpu_quiet(rdp->cpu, rcp); ++ ++ spin_unlock_irqrestore(&rcp->lock, flags); ++} ++ ++ ++#ifdef CONFIG_HOTPLUG_CPU ++ ++/* warning! helper for rcu_offline_cpu. do not use elsewhere without reviewing ++ * locking requirements, the list it's pulling from has to belong to a cpu ++ * which is dead and hence not processing interrupts. ++ */ ++static void rcu_move_batch(struct rcu_data *this_rdp, struct rcu_head *list, ++ struct rcu_head **tail, long batch) ++{ ++ unsigned long flags; ++ ++ if (list) { ++ local_irq_save(flags); ++ this_rdp->batch = batch; ++ *this_rdp->nxttail[2] = list; ++ this_rdp->nxttail[2] = tail; ++ local_irq_restore(flags); ++ } ++} ++ ++static void __rcu_offline_cpu(struct rcu_data *this_rdp, ++ struct rcu_ctrlblk *rcp, struct rcu_data *rdp) ++{ ++ unsigned long flags; ++ ++ /* ++ * if the cpu going offline owns the grace period ++ * we can block indefinitely waiting for it, so flush ++ * it here ++ */ ++ spin_lock_irqsave(&rcp->lock, flags); ++ if (rcp->cur != rcp->completed) ++ cpu_quiet(rdp->cpu, rcp); ++ rcu_move_batch(this_rdp, rdp->donelist, rdp->donetail, rcp->cur + 1); ++ rcu_move_batch(this_rdp, rdp->nxtlist, rdp->nxttail[2], rcp->cur + 1); ++ spin_unlock(&rcp->lock); ++ ++ this_rdp->qlen += rdp->qlen; ++ local_irq_restore(flags); ++} ++ ++static void rcu_offline_cpu(int cpu) ++{ ++ struct rcu_data *this_rdp = &get_cpu_var(rcu_data); ++ struct rcu_data *this_bh_rdp = &get_cpu_var(rcu_bh_data); ++ ++ __rcu_offline_cpu(this_rdp, &rcu_ctrlblk, ++ &per_cpu(rcu_data, cpu)); ++ __rcu_offline_cpu(this_bh_rdp, &rcu_bh_ctrlblk, ++ &per_cpu(rcu_bh_data, cpu)); ++ put_cpu_var(rcu_data); ++ put_cpu_var(rcu_bh_data); ++} ++ ++#else ++ ++static void rcu_offline_cpu(int cpu) ++{ ++} ++ ++#endif ++ ++/* ++ * This does the RCU processing work from softirq context. ++ */ ++static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp, ++ struct rcu_data *rdp) ++{ ++ unsigned long flags; ++ long completed_snap; ++ ++ if (rdp->nxtlist) { ++ local_irq_save(flags); ++ completed_snap = ACCESS_ONCE(rcp->completed); ++ ++ /* ++ * move the other grace-period-completed entries to ++ * [rdp->nxtlist, *rdp->nxttail[0]) temporarily ++ */ ++ if (!rcu_batch_before(completed_snap, rdp->batch)) ++ rdp->nxttail[0] = rdp->nxttail[1] = rdp->nxttail[2]; ++ else if (!rcu_batch_before(completed_snap, rdp->batch - 1)) ++ rdp->nxttail[0] = rdp->nxttail[1]; ++ ++ /* ++ * the grace period for entries in ++ * [rdp->nxtlist, *rdp->nxttail[0]) has completed and ++ * move these entries to donelist ++ */ ++ if (rdp->nxttail[0] != &rdp->nxtlist) { ++ *rdp->donetail = rdp->nxtlist; ++ rdp->donetail = rdp->nxttail[0]; ++ rdp->nxtlist = *rdp->nxttail[0]; ++ *rdp->donetail = NULL; ++ ++ if (rdp->nxttail[1] == rdp->nxttail[0]) ++ rdp->nxttail[1] = &rdp->nxtlist; ++ if (rdp->nxttail[2] == rdp->nxttail[0]) ++ rdp->nxttail[2] = &rdp->nxtlist; ++ rdp->nxttail[0] = &rdp->nxtlist; ++ } ++ ++ local_irq_restore(flags); ++ ++ if (rcu_batch_after(rdp->batch, rcp->pending)) { ++ unsigned long flags2; ++ ++ /* and start it/schedule start if it's a new batch */ ++ spin_lock_irqsave(&rcp->lock, flags2); ++ if (rcu_batch_after(rdp->batch, rcp->pending)) { ++ rcp->pending = rdp->batch; ++ rcu_start_batch(rcp); ++ } ++ spin_unlock_irqrestore(&rcp->lock, flags2); ++ } ++ } ++ ++ rcu_check_quiescent_state(rcp, rdp); ++ if (rdp->donelist) ++ rcu_do_batch(rdp); ++} ++ ++static void rcu_process_callbacks(struct softirq_action *unused) ++{ ++ /* ++ * Memory references from any prior RCU read-side critical sections ++ * executed by the interrupted code must be see before any RCU ++ * grace-period manupulations below. ++ */ ++ ++ smp_mb(); /* See above block comment. */ ++ ++ __rcu_process_callbacks(&rcu_ctrlblk, &__get_cpu_var(rcu_data)); ++ __rcu_process_callbacks(&rcu_bh_ctrlblk, &__get_cpu_var(rcu_bh_data)); ++ ++ /* ++ * Memory references from any later RCU read-side critical sections ++ * executed by the interrupted code must be see after any RCU ++ * grace-period manupulations above. ++ */ ++ ++ smp_mb(); /* See above block comment. */ ++} ++ ++static int __rcu_pending(struct rcu_ctrlblk *rcp, struct rcu_data *rdp) ++{ ++ /* Check for CPU stalls, if enabled. */ ++ check_cpu_stall(rcp); ++ ++ if (rdp->nxtlist) { ++ long completed_snap = ACCESS_ONCE(rcp->completed); ++ ++ /* ++ * This cpu has pending rcu entries and the grace period ++ * for them has completed. ++ */ ++ if (!rcu_batch_before(completed_snap, rdp->batch)) ++ return 1; ++ if (!rcu_batch_before(completed_snap, rdp->batch - 1) && ++ rdp->nxttail[0] != rdp->nxttail[1]) ++ return 1; ++ if (rdp->nxttail[0] != &rdp->nxtlist) ++ return 1; ++ ++ /* ++ * This cpu has pending rcu entries and the new batch ++ * for then hasn't been started nor scheduled start ++ */ ++ if (rcu_batch_after(rdp->batch, rcp->pending)) ++ return 1; ++ } ++ ++ /* This cpu has finished callbacks to invoke */ ++ if (rdp->donelist) ++ return 1; ++ ++ /* The rcu core waits for a quiescent state from the cpu */ ++ if (rdp->quiescbatch != rcp->cur || rdp->qs_pending) ++ return 1; ++ ++ /* nothing to do */ ++ return 0; ++} ++ ++/* ++ * Check to see if there is any immediate RCU-related work to be done ++ * by the current CPU, returning 1 if so. This function is part of the ++ * RCU implementation; it is -not- an exported member of the RCU API. ++ */ ++int rcu_pending(int cpu) ++{ ++ return __rcu_pending(&rcu_ctrlblk, &per_cpu(rcu_data, cpu)) || ++ __rcu_pending(&rcu_bh_ctrlblk, &per_cpu(rcu_bh_data, cpu)); ++} ++ ++/* ++ * Check to see if any future RCU-related work will need to be done ++ * by the current CPU, even if none need be done immediately, returning ++ * 1 if so. This function is part of the RCU implementation; it is -not- ++ * an exported member of the RCU API. ++ */ ++int rcu_needs_cpu(int cpu) ++{ ++ struct rcu_data *rdp = &per_cpu(rcu_data, cpu); ++ struct rcu_data *rdp_bh = &per_cpu(rcu_bh_data, cpu); ++ ++ return !!rdp->nxtlist || !!rdp_bh->nxtlist || rcu_pending(cpu); ++} ++ ++/* ++ * Top-level function driving RCU grace-period detection, normally ++ * invoked from the scheduler-clock interrupt. This function simply ++ * increments counters that are read only from softirq by this same ++ * CPU, so there are no memory barriers required. ++ */ ++void rcu_check_callbacks(int cpu, int user) ++{ ++ if (user || ++ (idle_cpu(cpu) && rcu_scheduler_active && ++ !in_softirq() && hardirq_count() <= (1 << HARDIRQ_SHIFT))) { ++ ++ /* ++ * Get here if this CPU took its interrupt from user ++ * mode or from the idle loop, and if this is not a ++ * nested interrupt. In this case, the CPU is in ++ * a quiescent state, so count it. ++ * ++ * Also do a memory barrier. This is needed to handle ++ * the case where writes from a preempt-disable section ++ * of code get reordered into schedule() by this CPU's ++ * write buffer. The memory barrier makes sure that ++ * the rcu_qsctr_inc() and rcu_bh_qsctr_inc() are see ++ * by other CPUs to happen after any such write. ++ */ ++ ++ smp_mb(); /* See above block comment. */ ++ rcu_qsctr_inc(cpu); ++ rcu_bh_qsctr_inc(cpu); ++ ++ } else if (!in_softirq()) { ++ ++ /* ++ * Get here if this CPU did not take its interrupt from ++ * softirq, in other words, if it is not interrupting ++ * a rcu_bh read-side critical section. This is an _bh ++ * critical section, so count it. The memory barrier ++ * is needed for the same reason as is the above one. ++ */ ++ ++ smp_mb(); /* See above block comment. */ ++ rcu_bh_qsctr_inc(cpu); ++ } ++ raise_rcu_softirq(); ++} ++ ++static void __cpuinit rcu_init_percpu_data(int cpu, struct rcu_ctrlblk *rcp, ++ struct rcu_data *rdp) ++{ ++ unsigned long flags; ++ ++ spin_lock_irqsave(&rcp->lock, flags); ++ memset(rdp, 0, sizeof(*rdp)); ++ rdp->nxttail[0] = rdp->nxttail[1] = rdp->nxttail[2] = &rdp->nxtlist; ++ rdp->donetail = &rdp->donelist; ++ rdp->quiescbatch = rcp->completed; ++ rdp->qs_pending = 0; ++ rdp->cpu = cpu; ++ rdp->blimit = blimit; ++ spin_unlock_irqrestore(&rcp->lock, flags); ++} ++ ++static void __cpuinit rcu_online_cpu(int cpu) ++{ ++ struct rcu_data *rdp = &per_cpu(rcu_data, cpu); ++ struct rcu_data *bh_rdp = &per_cpu(rcu_bh_data, cpu); ++ ++ rcu_init_percpu_data(cpu, &rcu_ctrlblk, rdp); ++ rcu_init_percpu_data(cpu, &rcu_bh_ctrlblk, bh_rdp); ++ open_softirq(RCU_SOFTIRQ, rcu_process_callbacks); ++} ++ ++static int __cpuinit rcu_cpu_notify(struct notifier_block *self, ++ unsigned long action, void *hcpu) ++{ ++ long cpu = (long)hcpu; ++ ++ switch (action) { ++ case CPU_UP_PREPARE: ++ case CPU_UP_PREPARE_FROZEN: ++ rcu_online_cpu(cpu); ++ break; ++ case CPU_DEAD: ++ case CPU_DEAD_FROZEN: ++ rcu_offline_cpu(cpu); ++ break; ++ default: ++ break; ++ } ++ return NOTIFY_OK; ++} ++ ++static struct notifier_block __cpuinitdata rcu_nb = { ++ .notifier_call = rcu_cpu_notify, ++}; ++ ++/* ++ * Initializes rcu mechanism. Assumed to be called early. ++ * That is before local timer(SMP) or jiffie timer (uniproc) is setup. ++ * Note that rcu_qsctr and friends are implicitly ++ * initialized due to the choice of ``0'' for RCU_CTR_INVALID. ++ */ ++void __init __rcu_init(void) ++{ ++#ifdef CONFIG_RCU_CPU_STALL_DETECTOR ++ printk(KERN_INFO "RCU-based detection of stalled CPUs is enabled.\n"); ++#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ ++ rcu_cpu_notify(&rcu_nb, CPU_UP_PREPARE, ++ (void *)(long)smp_processor_id()); ++ /* Register notifier for non-boot CPUs */ ++ register_cpu_notifier(&rcu_nb); ++} ++ ++module_param(blimit, int, 0); ++module_param(qhimark, int, 0); ++module_param(qlowmark, int, 0); +diff --git a/libdde_linux26/contrib/kernel/rcupdate.c b/libdde_linux26/contrib/kernel/rcupdate.c +index cae8a05..c6bfa1a 100644 +--- a/libdde_linux26/contrib/kernel/rcupdate.c ++++ b/libdde_linux26/contrib/kernel/rcupdate.c +@@ -180,6 +180,7 @@ void __init rcu_init(void) + { + __rcu_init(); + } ++core_initcall(rcu_init); + + void rcu_scheduler_starting(void) + { +diff --git a/libdde_linux26/lib/src/Makefile b/libdde_linux26/lib/src/Makefile +index 358196b..450c4e6 100644 +--- a/libdde_linux26/lib/src/Makefile ++++ b/libdde_linux26/lib/src/Makefile +@@ -89,6 +89,8 @@ SRC_C_libdde_linux26.o.a += \ + kernel/kthread.c \ + kernel/mutex.c \ + kernel/notifier.c \ ++ kernel/rcupdate.c \ ++ kernel/rcuclassic.c \ + kernel/resource.c \ + kernel/rwsem.c \ + kernel/sched.c \ diff --git a/debian/patches/libdde_rculist.patch b/debian/patches/libdde_rculist.patch new file mode 100644 index 00000000..19e512a6 --- /dev/null +++ b/debian/patches/libdde_rculist.patch @@ -0,0 +1,12 @@ +diff --git a/libdde_linux26/contrib/include/linux/netdevice.h b/libdde_linux26/contrib/include/linux/netdevice.h +index 6593667..bb4fca1 100644 +--- a/libdde_linux26/contrib/include/linux/netdevice.h ++++ b/libdde_linux26/contrib/include/linux/netdevice.h +@@ -37,6 +37,7 @@ + #include <asm/byteorder.h> + + #include <linux/device.h> ++#include <linux/rculist.h> + #include <linux/percpu.h> + #include <linux/dmaengine.h> + #include <linux/workqueue.h> diff --git a/debian/patches/libdde_rx_queue.patch b/debian/patches/libdde_rx_queue.patch new file mode 100644 index 00000000..0d962647 --- /dev/null +++ b/debian/patches/libdde_rx_queue.patch @@ -0,0 +1,70 @@ +commit d5a9e24afb4ab38110ebb777588ea0bd0eacbd0a +Author: David S. Miller <davem@davemloft.net> +Date: Tue Jan 27 16:22:11 2009 -0800 + + net: Allow RX queue selection to seed TX queue hashing. + + The idea is that drivers which implement multiqueue RX + pre-seed the SKB by recording the RX queue selected by + the hardware. + + If such a seed is found on TX, we'll use that to select + the outgoing TX queue. + + This helps get more consistent load balancing on router + and firewall loads. + + Signed-off-by: David S. Miller <davem@davemloft.net> + +Index: hurd-debian/libdde_linux26/contrib/include/linux/skbuff.h +=================================================================== +--- hurd-debian.orig/libdde_linux26/contrib/include/linux/skbuff.h 2012-04-16 00:34:56.000000000 +0000 ++++ hurd-debian/libdde_linux26/contrib/include/linux/skbuff.h 2012-04-16 00:35:11.000000000 +0000 +@@ -1903,6 +1903,21 @@ + to->queue_mapping = from->queue_mapping; + } + ++static inline void skb_record_rx_queue(struct sk_buff *skb, u16 rx_queue) ++{ ++ skb->queue_mapping = rx_queue + 1; ++} ++ ++static inline u16 skb_get_rx_queue(struct sk_buff *skb) ++{ ++ return skb->queue_mapping - 1; ++} ++ ++static inline bool skb_rx_queue_recorded(struct sk_buff *skb) ++{ ++ return (skb->queue_mapping != 0); ++} ++ + #ifdef CONFIG_XFRM + static inline struct sec_path *skb_sec_path(struct sk_buff *skb) + { +Index: hurd-debian/libdde_linux26/lib/src/net/core/dev.c +=================================================================== +--- hurd-debian.orig/libdde_linux26/lib/src/net/core/dev.c 2012-04-16 00:34:51.000000000 +0000 ++++ hurd-debian/libdde_linux26/lib/src/net/core/dev.c 2012-04-16 00:35:11.000000000 +0000 +@@ -1731,6 +1731,13 @@ + simple_tx_hashrnd_initialized = 1; + } + ++ if (skb_rx_queue_recorded(skb)) { ++ u32 val = skb_get_rx_queue(skb); ++ ++ hash = jhash_1word(val, simple_tx_hashrnd); ++ goto out; ++ } ++ + switch (skb->protocol) { + case htons(ETH_P_IP): + if (!(ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET))) +@@ -1768,6 +1775,7 @@ + + hash = jhash_3words(addr1, addr2, ports, simple_tx_hashrnd); + ++out: + return (u16) (((u64) hash * dev->real_num_tx_queues) >> 32); + } + diff --git a/debian/patches/libdde_trans_start.patch b/debian/patches/libdde_trans_start.patch new file mode 100644 index 00000000..07acc6dd --- /dev/null +++ b/debian/patches/libdde_trans_start.patch @@ -0,0 +1,138 @@ +commit 9d21493b4beb8f918ba248032fefa393074a5e2b +Author: Eric Dumazet <dada1@cosmosbay.com> +Date: Sun May 17 20:55:16 2009 -0700 + + net: tx scalability works : trans_start + + struct net_device trans_start field is a hot spot on SMP and high performance + devices, particularly multi queues ones, because every transmitter dirties + it. Is main use is tx watchdog and bonding alive checks. + + But as most devices dont use NETIF_F_LLTX, we have to lock + a netdev_queue before calling their ndo_start_xmit(). So it makes + sense to move trans_start from net_device to netdev_queue. Its update + will occur on a already present (and in exclusive state) cache line, for + free. + + We can do this transition smoothly. An old driver continue to + update dev->trans_start, while an updated one updates txq->trans_start. + + Further patches could also put tx_bytes/tx_packets counters in + netdev_queue to avoid dirtying dev->stats (vlan device comes to mind) + + Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> + Signed-off-by: David S. Miller <davem@davemloft.net> + +Index: hurd-debian/libdde_linux26/contrib/include/linux/netdevice.h +=================================================================== +--- hurd-debian.orig/libdde_linux26/contrib/include/linux/netdevice.h 2012-04-16 00:34:54.000000000 +0000 ++++ hurd-debian/libdde_linux26/contrib/include/linux/netdevice.h 2012-04-16 00:35:04.000000000 +0000 +@@ -462,6 +462,10 @@ + spinlock_t _xmit_lock; + int xmit_lock_owner; + struct Qdisc *qdisc_sleeping; ++ /* ++ * please use this field instead of dev->trans_start ++ */ ++ unsigned long trans_start; + } ____cacheline_aligned_in_smp; + + +@@ -801,6 +805,11 @@ + * One part is mostly used on xmit path (device) + */ + /* These may be needed for future network-power-down code. */ ++ ++ /* ++ * trans_start here is expensive for high speed devices on SMP, ++ * please use netdev_queue->trans_start instead. ++ */ + unsigned long trans_start; /* Time (in jiffies) of last Tx */ + + int watchdog_timeo; /* used by dev_watchdog() */ +@@ -1477,6 +1486,8 @@ + return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); + } + ++extern unsigned long dev_trans_start(struct net_device *dev); ++ + extern void __netdev_watchdog_up(struct net_device *dev); + + extern void netif_carrier_on(struct net_device *dev); +Index: hurd-debian/libdde_linux26/lib/src/net/sched/sch_generic.c +=================================================================== +--- hurd-debian.orig/libdde_linux26/lib/src/net/sched/sch_generic.c 2012-04-16 00:26:38.000000000 +0000 ++++ hurd-debian/libdde_linux26/lib/src/net/sched/sch_generic.c 2012-04-16 00:35:04.000000000 +0000 +@@ -200,6 +200,21 @@ + clear_bit(__QDISC_STATE_RUNNING, &q->state); + } + ++unsigned long dev_trans_start(struct net_device *dev) ++{ ++ unsigned long val, res = dev->trans_start; ++ unsigned int i; ++ ++ for (i = 0; i < dev->num_tx_queues; i++) { ++ val = netdev_get_tx_queue(dev, i)->trans_start; ++ if (val && time_after(val, res)) ++ res = val; ++ } ++ dev->trans_start = res; ++ return res; ++} ++EXPORT_SYMBOL(dev_trans_start); ++ + static void dev_watchdog(unsigned long arg) + { + struct net_device *dev = (struct net_device *)arg; +@@ -209,25 +224,30 @@ + if (netif_device_present(dev) && + netif_running(dev) && + netif_carrier_ok(dev)) { +- int some_queue_stopped = 0; ++ int some_queue_timedout = 0; + unsigned int i; ++ unsigned long trans_start; + + for (i = 0; i < dev->num_tx_queues; i++) { + struct netdev_queue *txq; + + txq = netdev_get_tx_queue(dev, i); +- if (netif_tx_queue_stopped(txq)) { +- some_queue_stopped = 1; ++ /* ++ * old device drivers set dev->trans_start ++ */ ++ trans_start = txq->trans_start ? : dev->trans_start; ++ if (netif_tx_queue_stopped(txq) && ++ time_after(jiffies, (trans_start + ++ dev->watchdog_timeo))) { ++ some_queue_timedout = 1; + break; + } + } + +- if (some_queue_stopped && +- time_after(jiffies, (dev->trans_start + +- dev->watchdog_timeo))) { ++ if (some_queue_timedout) { + char drivername[64]; +- WARN_ONCE(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit timed out\n", +- dev->name, netdev_drivername(dev, drivername, 64)); ++ WARN_ONCE(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit queue %u timed out\n", ++ dev->name, netdev_drivername(dev, drivername, 64), i); + dev->netdev_ops->ndo_tx_timeout(dev); + } + if (!mod_timer(&dev->watchdog_timer, +@@ -612,8 +632,10 @@ + clear_bit(__QDISC_STATE_DEACTIVATED, &new_qdisc->state); + + rcu_assign_pointer(dev_queue->qdisc, new_qdisc); +- if (need_watchdog_p && new_qdisc != &noqueue_qdisc) ++ if (need_watchdog_p && new_qdisc != &noqueue_qdisc) { ++ dev_queue->trans_start = 0; + *need_watchdog_p = 1; ++ } + } + + void dev_activate(struct net_device *dev) diff --git a/debian/patches/libdde_ucast_list.patch b/debian/patches/libdde_ucast_list.patch new file mode 100644 index 00000000..5abd3443 --- /dev/null +++ b/debian/patches/libdde_ucast_list.patch @@ -0,0 +1,488 @@ +commit ccffad25b5136958d4769ed6de5e87992dd9c65c +Author: Jiri Pirko <jpirko@redhat.com> +Date: Fri May 22 23:22:17 2009 +0000 + + net: convert unicast addr list + + This patch converts unicast address list to standard list_head using + previously introduced struct netdev_hw_addr. It also relaxes the + locking. Original spinlock (still used for multicast addresses) is not + needed and is no longer used for a protection of this list. All + reading and writing takes place under rtnl (with no changes). + + I also removed a possibility to specify the length of the address + while adding or deleting unicast address. It's always dev->addr_len. + + The convertion touched especially e1000 and ixgbe codes when the + change is not so trivial. + + Signed-off-by: Jiri Pirko <jpirko@redhat.com> + + drivers/net/bnx2.c | 13 +-- + drivers/net/e1000/e1000_main.c | 24 +++-- + drivers/net/ixgbe/ixgbe_common.c | 14 ++-- + drivers/net/ixgbe/ixgbe_common.h | 4 +- + drivers/net/ixgbe/ixgbe_main.c | 6 +- + drivers/net/ixgbe/ixgbe_type.h | 4 +- + drivers/net/macvlan.c | 11 +- + drivers/net/mv643xx_eth.c | 11 +- + drivers/net/niu.c | 7 +- + drivers/net/virtio_net.c | 7 +- + drivers/s390/net/qeth_l2_main.c | 6 +- + drivers/scsi/fcoe/fcoe.c | 16 ++-- + include/linux/netdevice.h | 18 ++-- + net/8021q/vlan.c | 4 +- + net/8021q/vlan_dev.c | 10 +- + net/core/dev.c | 195 +++++++++++++++++++++++++++----------- + net/dsa/slave.c | 10 +- + net/packet/af_packet.c | 4 +- + 18 files changed, 227 insertions(+), 137 deletions(-) + Signed-off-by: David S. Miller <davem@davemloft.net> + +Index: hurd-debian/libdde_linux26/contrib/include/linux/netdevice.h +=================================================================== +--- hurd-debian.orig/libdde_linux26/contrib/include/linux/netdevice.h 2012-04-16 00:34:43.000000000 +0000 ++++ hurd-debian/libdde_linux26/contrib/include/linux/netdevice.h 2012-04-16 00:34:46.000000000 +0000 +@@ -215,9 +215,12 @@ + struct list_head list; + unsigned char addr[MAX_ADDR_LEN]; + unsigned char type; +-#define NETDEV_HW_ADDR_T_LAN 1 +-#define NETDEV_HW_ADDR_T_SAN 2 +-#define NETDEV_HW_ADDR_T_SLAVE 3 ++#define NETDEV_HW_ADDR_T_LAN 1 ++#define NETDEV_HW_ADDR_T_SAN 2 ++#define NETDEV_HW_ADDR_T_SLAVE 3 ++#define NETDEV_HW_ADDR_T_UNICAST 4 ++ int refcount; ++ bool synced; + struct rcu_head rcu_head; + }; + +@@ -738,10 +741,11 @@ + unsigned char addr_len; /* hardware address length */ + unsigned short dev_id; /* for shared network cards */ + +- spinlock_t addr_list_lock; +- struct dev_addr_list *uc_list; /* Secondary unicast mac addresses */ ++ struct list_head uc_list; /* Secondary unicast mac ++ addresses */ + int uc_count; /* Number of installed ucasts */ + int uc_promisc; ++ spinlock_t addr_list_lock; + struct dev_addr_list *mc_list; /* Multicast mac addresses */ + int mc_count; /* Number of installed mcasts */ + unsigned int promiscuity; +@@ -1816,8 +1820,8 @@ + /* Functions used for secondary unicast and multicast support */ + extern void dev_set_rx_mode(struct net_device *dev); + extern void __dev_set_rx_mode(struct net_device *dev); +-extern int dev_unicast_delete(struct net_device *dev, void *addr, int alen); +-extern int dev_unicast_add(struct net_device *dev, void *addr, int alen); ++extern int dev_unicast_delete(struct net_device *dev, void *addr); ++extern int dev_unicast_add(struct net_device *dev, void *addr); + extern int dev_unicast_sync(struct net_device *to, struct net_device *from); + extern void dev_unicast_unsync(struct net_device *to, struct net_device *from); + extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all); +Index: hurd-debian/libdde_linux26/lib/src/net/core/dev.c +=================================================================== +--- hurd-debian.orig/libdde_linux26/lib/src/net/core/dev.c 2012-04-16 00:34:43.000000000 +0000 ++++ hurd-debian/libdde_linux26/lib/src/net/core/dev.c 2012-04-16 00:34:46.000000000 +0000 +@@ -3399,8 +3399,9 @@ + + /* hw addresses list handling functions */ + +-static int __hw_addr_add(struct list_head *list, unsigned char *addr, +- int addr_len, unsigned char addr_type) ++static int __hw_addr_add(struct list_head *list, int *delta, ++ unsigned char *addr, int addr_len, ++ unsigned char addr_type) + { + struct netdev_hw_addr *ha; + int alloc_size; +@@ -3408,6 +3409,15 @@ + if (addr_len > MAX_ADDR_LEN) + return -EINVAL; + ++ list_for_each_entry(ha, list, list) { ++ if (!memcmp(ha->addr, addr, addr_len) && ++ ha->type == addr_type) { ++ ha->refcount++; ++ return 0; ++ } ++ } ++ ++ + alloc_size = sizeof(*ha); + if (alloc_size < L1_CACHE_BYTES) + alloc_size = L1_CACHE_BYTES; +@@ -3416,7 +3426,11 @@ + return -ENOMEM; + memcpy(ha->addr, addr, addr_len); + ha->type = addr_type; ++ ha->refcount = 1; ++ ha->synced = false; + list_add_tail_rcu(&ha->list, list); ++ if (delta) ++ (*delta)++; + return 0; + } + +@@ -3428,29 +3442,30 @@ + kfree(ha); + } + +-static int __hw_addr_del_ii(struct list_head *list, unsigned char *addr, +- int addr_len, unsigned char addr_type, +- int ignore_index) ++static int __hw_addr_del(struct list_head *list, int *delta, ++ unsigned char *addr, int addr_len, ++ unsigned char addr_type) + { + struct netdev_hw_addr *ha; +- int i = 0; + + list_for_each_entry(ha, list, list) { +- if (i++ != ignore_index && +- !memcmp(ha->addr, addr, addr_len) && ++ if (!memcmp(ha->addr, addr, addr_len) && + (ha->type == addr_type || !addr_type)) { ++ if (--ha->refcount) ++ return 0; + list_del_rcu(&ha->list); + call_rcu(&ha->rcu_head, ha_rcu_free); ++ if (delta) ++ (*delta)--; + return 0; + } + } + return -ENOENT; + } + +-static int __hw_addr_add_multiple_ii(struct list_head *to_list, +- struct list_head *from_list, +- int addr_len, unsigned char addr_type, +- int ignore_index) ++static int __hw_addr_add_multiple(struct list_head *to_list, int *to_delta, ++ struct list_head *from_list, int addr_len, ++ unsigned char addr_type) + { + int err; + struct netdev_hw_addr *ha, *ha2; +@@ -3458,7 +3473,8 @@ + + list_for_each_entry(ha, from_list, list) { + type = addr_type ? addr_type : ha->type; +- err = __hw_addr_add(to_list, ha->addr, addr_len, type); ++ err = __hw_addr_add(to_list, to_delta, ha->addr, ++ addr_len, type); + if (err) + goto unroll; + } +@@ -3469,27 +3485,69 @@ + if (ha2 == ha) + break; + type = addr_type ? addr_type : ha2->type; +- __hw_addr_del_ii(to_list, ha2->addr, addr_len, type, +- ignore_index); ++ __hw_addr_del(to_list, to_delta, ha2->addr, ++ addr_len, type); + } + return err; + } + +-static void __hw_addr_del_multiple_ii(struct list_head *to_list, +- struct list_head *from_list, +- int addr_len, unsigned char addr_type, +- int ignore_index) ++static void __hw_addr_del_multiple(struct list_head *to_list, int *to_delta, ++ struct list_head *from_list, int addr_len, ++ unsigned char addr_type) + { + struct netdev_hw_addr *ha; + unsigned char type; + + list_for_each_entry(ha, from_list, list) { + type = addr_type ? addr_type : ha->type; +- __hw_addr_del_ii(to_list, ha->addr, addr_len, addr_type, +- ignore_index); ++ __hw_addr_del(to_list, to_delta, ha->addr, ++ addr_len, addr_type); + } + } + ++static int __hw_addr_sync(struct list_head *to_list, int *to_delta, ++ struct list_head *from_list, int *from_delta, ++ int addr_len) ++{ ++ int err = 0; ++ struct netdev_hw_addr *ha, *tmp; ++ ++ list_for_each_entry_safe(ha, tmp, from_list, list) { ++ if (!ha->synced) { ++ err = __hw_addr_add(to_list, to_delta, ha->addr, ++ addr_len, ha->type); ++ if (err) ++ break; ++ ha->synced = true; ++ ha->refcount++; ++ } else if (ha->refcount == 1) { ++ __hw_addr_del(to_list, to_delta, ha->addr, ++ addr_len, ha->type); ++ __hw_addr_del(from_list, from_delta, ha->addr, ++ addr_len, ha->type); ++ } ++ } ++ return err; ++} ++ ++static void __hw_addr_unsync(struct list_head *to_list, int *to_delta, ++ struct list_head *from_list, int *from_delta, ++ int addr_len) ++{ ++ struct netdev_hw_addr *ha, *tmp; ++ ++ list_for_each_entry_safe(ha, tmp, from_list, list) { ++ if (ha->synced) { ++ __hw_addr_del(to_list, to_delta, ha->addr, ++ addr_len, ha->type); ++ ha->synced = false; ++ __hw_addr_del(from_list, from_delta, ha->addr, ++ addr_len, ha->type); ++ } ++ } ++} ++ ++ + static void __hw_addr_flush(struct list_head *list) + { + struct netdev_hw_addr *ha, *tmp; +@@ -3520,7 +3578,7 @@ + + INIT_LIST_HEAD(&dev->dev_addr_list); + memset(addr, 0, sizeof(*addr)); +- err = __hw_addr_add(&dev->dev_addr_list, addr, sizeof(*addr), ++ err = __hw_addr_add(&dev->dev_addr_list, NULL, addr, sizeof(*addr), + NETDEV_HW_ADDR_T_LAN); + if (!err) { + /* +@@ -3552,7 +3610,7 @@ + + ASSERT_RTNL(); + +- err = __hw_addr_add(&dev->dev_addr_list, addr, dev->addr_len, ++ err = __hw_addr_add(&dev->dev_addr_list, NULL, addr, dev->addr_len, + addr_type); + if (!err) + call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); +@@ -3575,11 +3633,20 @@ + unsigned char addr_type) + { + int err; ++ struct netdev_hw_addr *ha; + + ASSERT_RTNL(); + +- err = __hw_addr_del_ii(&dev->dev_addr_list, addr, dev->addr_len, +- addr_type, 0); ++ /* ++ * We can not remove the first address from the list because ++ * dev->dev_addr points to that. ++ */ ++ ha = list_first_entry(&dev->dev_addr_list, struct netdev_hw_addr, list); ++ if (ha->addr == dev->dev_addr && ha->refcount == 1) ++ return -ENOENT; ++ ++ err = __hw_addr_del(&dev->dev_addr_list, NULL, addr, dev->addr_len, ++ addr_type); + if (!err) + call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); + return err; +@@ -3606,9 +3673,9 @@ + + if (from_dev->addr_len != to_dev->addr_len) + return -EINVAL; +- err = __hw_addr_add_multiple_ii(&to_dev->dev_addr_list, +- &from_dev->dev_addr_list, +- to_dev->addr_len, addr_type, 0); ++ err = __hw_addr_add_multiple(&to_dev->dev_addr_list, NULL, ++ &from_dev->dev_addr_list, ++ to_dev->addr_len, addr_type); + if (!err) + call_netdevice_notifiers(NETDEV_CHANGEADDR, to_dev); + return err; +@@ -3633,9 +3700,9 @@ + + if (from_dev->addr_len != to_dev->addr_len) + return -EINVAL; +- __hw_addr_del_multiple_ii(&to_dev->dev_addr_list, +- &from_dev->dev_addr_list, +- to_dev->addr_len, addr_type, 0); ++ __hw_addr_del_multiple(&to_dev->dev_addr_list, NULL, ++ &from_dev->dev_addr_list, ++ to_dev->addr_len, addr_type); + call_netdevice_notifiers(NETDEV_CHANGEADDR, to_dev); + return 0; + } +@@ -3705,24 +3772,22 @@ + * dev_unicast_delete - Release secondary unicast address. + * @dev: device + * @addr: address to delete +- * @alen: length of @addr + * + * Release reference to a secondary unicast address and remove it + * from the device if the reference count drops to zero. + * + * The caller must hold the rtnl_mutex. + */ +-int dev_unicast_delete(struct net_device *dev, void *addr, int alen) ++int dev_unicast_delete(struct net_device *dev, void *addr) + { + int err; + + ASSERT_RTNL(); + +- netif_addr_lock_bh(dev); +- err = __dev_addr_delete(&dev->uc_list, &dev->uc_count, addr, alen, 0); ++ err = __hw_addr_del(&dev->uc_list, &dev->uc_count, addr, ++ dev->addr_len, NETDEV_HW_ADDR_T_UNICAST); + if (!err) + __dev_set_rx_mode(dev); +- netif_addr_unlock_bh(dev); + return err; + } + EXPORT_SYMBOL(dev_unicast_delete); +@@ -3731,24 +3796,22 @@ + * dev_unicast_add - add a secondary unicast address + * @dev: device + * @addr: address to add +- * @alen: length of @addr + * + * Add a secondary unicast address to the device or increase + * the reference count if it already exists. + * + * The caller must hold the rtnl_mutex. + */ +-int dev_unicast_add(struct net_device *dev, void *addr, int alen) ++int dev_unicast_add(struct net_device *dev, void *addr) + { + int err; + + ASSERT_RTNL(); + +- netif_addr_lock_bh(dev); +- err = __dev_addr_add(&dev->uc_list, &dev->uc_count, addr, alen, 0); ++ err = __hw_addr_add(&dev->uc_list, &dev->uc_count, addr, ++ dev->addr_len, NETDEV_HW_ADDR_T_UNICAST); + if (!err) + __dev_set_rx_mode(dev); +- netif_addr_unlock_bh(dev); + return err; + } + EXPORT_SYMBOL(dev_unicast_add); +@@ -3805,8 +3868,7 @@ + * @from: source device + * + * Add newly added addresses to the destination device and release +- * addresses that have no users left. The source device must be +- * locked by netif_addr_lock_bh. ++ * addresses that have no users left. + * + * This function is intended to be called from the dev->set_rx_mode + * function of layered software devices. +@@ -3815,12 +3877,15 @@ + { + int err = 0; + +- netif_addr_lock_bh(to); +- err = __dev_addr_sync(&to->uc_list, &to->uc_count, +- &from->uc_list, &from->uc_count); ++ ASSERT_RTNL(); ++ ++ if (to->addr_len != from->addr_len) ++ return -EINVAL; ++ ++ err = __hw_addr_sync(&to->uc_list, &to->uc_count, ++ &from->uc_list, &from->uc_count, to->addr_len); + if (!err) + __dev_set_rx_mode(to); +- netif_addr_unlock_bh(to); + return err; + } + EXPORT_SYMBOL(dev_unicast_sync); +@@ -3836,18 +3901,33 @@ + */ + void dev_unicast_unsync(struct net_device *to, struct net_device *from) + { +- netif_addr_lock_bh(from); +- netif_addr_lock(to); ++ ASSERT_RTNL(); + +- __dev_addr_unsync(&to->uc_list, &to->uc_count, +- &from->uc_list, &from->uc_count); +- __dev_set_rx_mode(to); ++ if (to->addr_len != from->addr_len) ++ return; + +- netif_addr_unlock(to); +- netif_addr_unlock_bh(from); ++ __hw_addr_unsync(&to->uc_list, &to->uc_count, ++ &from->uc_list, &from->uc_count, to->addr_len); ++ __dev_set_rx_mode(to); + } + EXPORT_SYMBOL(dev_unicast_unsync); + ++static void dev_unicast_flush(struct net_device *dev) ++{ ++ /* rtnl_mutex must be held here */ ++ ++ __hw_addr_flush(&dev->uc_list); ++ dev->uc_count = 0; ++} ++ ++static void dev_unicast_init(struct net_device *dev) ++{ ++ /* rtnl_mutex must be held here */ ++ ++ INIT_LIST_HEAD(&dev->uc_list); ++} ++ ++ + static void __dev_addr_discard(struct dev_addr_list **list) + { + struct dev_addr_list *tmp; +@@ -3866,9 +3946,6 @@ + { + netif_addr_lock_bh(dev); + +- __dev_addr_discard(&dev->uc_list); +- dev->uc_count = 0; +- + __dev_addr_discard(&dev->mc_list); + dev->mc_count = 0; + +@@ -4459,6 +4536,7 @@ + /* + * Flush the unicast and multicast chains + */ ++ dev_unicast_flush(dev); + dev_addr_discard(dev); + + if (dev->netdev_ops->ndo_uninit) +@@ -4975,6 +5053,8 @@ + dev = (struct net_device *) + (((long)p + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST); + dev->padded = (char *)dev - (char *)p; ++ dev_unicast_init(dev); ++ + dev_net_set(dev, &init_net); + + dev->_tx = tx; +@@ -5173,6 +5253,7 @@ + /* + * Flush the unicast and multicast chains + */ ++ dev_unicast_flush(dev); + dev_addr_discard(dev); + + netdev_unregister_kobject(dev); diff --git a/debian/patches/libdde_workqueue.patch b/debian/patches/libdde_workqueue.patch new file mode 100644 index 00000000..5ea9b612 --- /dev/null +++ b/debian/patches/libdde_workqueue.patch @@ -0,0 +1,55 @@ +diff --git a/libdde_linux26/contrib/include/linux/workqueue.h b/libdde_linux26/contrib/include/linux/workqueue.h +index 3cd51e5..cf24c20 100644 +--- a/libdde_linux26/contrib/include/linux/workqueue.h ++++ b/libdde_linux26/contrib/include/linux/workqueue.h +@@ -41,6 +41,11 @@ struct delayed_work { + struct timer_list timer; + }; + ++static inline struct delayed_work *to_delayed_work(struct work_struct *work) ++{ ++ return container_of(work, struct delayed_work, work); ++} ++ + struct execute_work { + struct work_struct work; + }; +@@ -89,7 +94,7 @@ struct execute_work { + /* + * initialize all of a work item in one go + * +- * NOTE! No point in using "atomic_long_set()": useing a direct ++ * NOTE! No point in using "atomic_long_set()": using a direct + * assignment of the work data initializer allows the compiler + * to generate better code. + */ +@@ -202,6 +207,7 @@ + + extern void flush_workqueue(struct workqueue_struct *wq); + extern void flush_scheduled_work(void); ++extern void flush_delayed_work(struct delayed_work *work); + + extern int schedule_work(struct work_struct *work); + extern int schedule_work_on(int cpu, struct work_struct *work); +@@ -233,6 +239,21 @@ + if (ret) + work_clear_pending(&work->work); + return ret; ++} ++ ++/* ++ * Like above, but uses del_timer() instead of del_timer_sync(). This means, ++ * if it returns 0 the timer function may be running and the queueing is in ++ * progress. ++ */ ++static inline int __cancel_delayed_work(struct delayed_work *work) ++{ ++ int ret; ++ ++ ret = del_timer(&work->timer); ++ if (ret) ++ work_clear_pending(&work->work); ++ return ret; + } + + extern int cancel_delayed_work_sync(struct delayed_work *work); diff --git a/debian/patches/libexec.patch b/debian/patches/libexec.patch new file mode 100644 index 00000000..12b5a01d --- /dev/null +++ b/debian/patches/libexec.patch @@ -0,0 +1,103 @@ +diff --git a/config/ttys b/config/ttys +index 6a548d5..d10bfcc 100644 +--- a/config/ttys ++++ b/config/ttys +@@ -4,11 +4,11 @@ + + # name program type status comments + +-console "/libexec/getty 9600" mach-gnu-color on secure trusted console +-tty1 "/libexec/getty 38400" hurd on secure trusted console +-tty2 "/libexec/getty 38400" hurd on secure trusted console +-tty3 "/libexec/getty 38400" hurd on secure trusted console +-tty4 "/libexec/getty 38400" hurd on secure trusted console +-tty5 "/libexec/getty 38400" hurd on secure trusted console +-tty6 "/libexec/getty 38400" hurd on secure trusted console +-#com0 "/libexec/getty 9600" dialup on secure ++console "/sbin/getty 9600" mach-gnu-color on secure trusted console ++tty1 "/sbin/getty 38400" hurd on secure trusted console ++tty2 "/sbin/getty 38400" hurd on secure trusted console ++tty3 "/sbin/getty 38400" hurd on secure trusted console ++tty4 "/sbin/getty 38400" hurd on secure trusted console ++tty5 "/sbin/getty 38400" hurd on secure trusted console ++tty6 "/sbin/getty 38400" hurd on secure trusted console ++#com0 "/sbin/getty 9600" dialup on secure +diff --git a/daemons/runsystem.sh b/daemons/runsystem.sh +index c3cb2d6..0ce4f59 100644 +--- a/daemons/runsystem.sh ++++ b/daemons/runsystem.sh +@@ -23,8 +23,8 @@ fallback_shells='/bin/sh /bin/bash /bin/csh /bin/ash /bin/shd' + SHELL=/bin/sh + + # Programs that do multi-user startup. +-RUNCOM=/libexec/rc +-RUNTTYS=/libexec/runttys ++RUNCOM=/etc/hurd/rc ++RUNTTYS=/sbin/runttys + # Signals that we should pass down to runttys. + runttys_sigs='TERM INT HUP TSTP' + +diff --git a/doc/hurd.texi b/doc/hurd.texi +index ea73a4c..7d7af39 100644 +--- a/doc/hurd.texi ++++ b/doc/hurd.texi +@@ -570,7 +570,7 @@ The @option{--multiboot-command-line} option tells the file system server that + it is a root filesystem, which triggers it to run @command{/hurd/init} as PID + 1. @command{/hurd/init} starts the @command{/hurd/proc} and + @command{/hurd/auth} servers. After the servers are launched +-@command{/hurd/init} starts the @command{/libexec/runsystem.sh} script to ++@command{/hurd/init} starts the @command{/etc/hurd/runsystem.sh} script to + finish booting. + + After the Hurd has been booted, other sets of core Hurd servers can be +diff --git a/init/init.c b/init/init.c +index d66bee0..14d822e 100644 +--- a/init/init.c ++++ b/init/init.c +@@ -888,7 +888,7 @@ frob_kernel_process (void) + /** Running userland. **/ + + /* In the "split-init" setup, we just run a single program (usually +- /libexec/runsystem) that is not expected to ever exit (or stop). ++ /etc/hurd/runsystem) that is not expected to ever exit (or stop). + If it does exit (or can't be started), we go to an emergency single-user + shell as a fallback. */ + +@@ -1004,7 +1004,7 @@ process_signal (int signo) + } + } + +-/* Start the child program PROG. It is run via /libexec/console-run ++/* Start the child program PROG. It is run via /sbin/console-run + with the given additional arguments. */ + static int + start_child (const char *prog, char **progargs) +@@ -1016,7 +1016,7 @@ start_child (const char *prog, char **progargs) + + if (progargs == 0) + { +- const char *argv[] = { "/libexec/console-run", prog, 0 }; ++ const char *argv[] = { "/sbin/console-run", prog, 0 }; + err = argz_create ((char **) argv, &args, &arglen); + } + else +@@ -1026,7 +1026,7 @@ start_child (const char *prog, char **progargs) + ++argc; + { + const char *argv[2 + argc + 1]; +- argv[0] = "/libexec/console-run"; ++ argv[0] = "/sbin/console-run"; + argv[1] = prog; + argv[2 + argc] = 0; + while (argc-- > 0) +@@ -1086,8 +1086,8 @@ launch_something (const char *why) + static unsigned int try; + static const char *const tries[] = + { +- "/libexec/runsystem", +- "/libexec/runsystem.gnu", ++ "/etc/hurd/runsystem", ++ "/etc/hurd/runsystem.gnu", + _PATH_BSHELL, + "/bin/shd", /* XXX */ + }; diff --git a/debian/patches/libmachdev.patch b/debian/patches/libmachdev.patch new file mode 100644 index 00000000..3bca9ff3 --- /dev/null +++ b/debian/patches/libmachdev.patch @@ -0,0 +1,35 @@ +diff --git a/libmachdev/net.c b/libmachdev/net.c +index 606765f..766d9b4 100644 +--- a/libmachdev/net.c ++++ b/libmachdev/net.c +@@ -212,7 +212,7 @@ deliver_msg(struct net_rcv_msg *msg, if_filter_list_t *ifp) + MACH_SEND_MSG|MACH_SEND_TIMEOUT, + msg->msg_hdr.msgh_size, 0, MACH_PORT_NULL, + 0, MACH_PORT_NULL); +- if (err != MACH_MSG_SUCCESS) ++ if (0 && err != MACH_MSG_SUCCESS) + { + /* TODO: remove from filter */ + } +@@ -377,7 +377,7 @@ device_open (mach_port_t reply_port, mach_msg_type_name_t reply_port_type, + } + + *devp = ports_get_right (nd); +- *devicePoly = MACH_MSG_TYPE_COPY_SEND; ++ *devicePoly = MACH_MSG_TYPE_MAKE_SEND; + return D_SUCCESS; + } + +diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c +index 6b8d1d4..f0c034f 100644 +--- a/libmachdev/ds_routines.c ++++ b/libmachdev/ds_routines.c +@@ -206,7 +206,7 @@ ds_device_close (device_t dev) + ret = (device->emul_ops->close + ? (*device->emul_ops->close) (device->emul_data) + : D_SUCCESS); +- mach_device_deallocate (device_to_pi (device)); ++ //mach_device_deallocate (device_to_pi (device)); + + ports_port_deref (device_to_pi (device)); + return ret; diff --git a/debian/patches/libports_stability.patch b/debian/patches/libports_stability.patch new file mode 100644 index 00000000..4452807c --- /dev/null +++ b/debian/patches/libports_stability.patch @@ -0,0 +1,20 @@ +Ideally we should be able to time out and see translators go away automatically, +however it makes all threads often wake at the same time and overload Mach. + +--- + libports/manage-multithread.c | 2 ++ + 1 file changed, 2 insertions(+) + +Index: hurd-debian/libports/manage-multithread.c +=================================================================== +--- hurd-debian.orig/libports/manage-multithread.c 2012-11-26 00:23:22.000000000 +0000 ++++ hurd-debian/libports/manage-multithread.c 2012-11-26 00:25:28.000000000 +0000 +@@ -243,6 +243,8 @@ + return NULL; + } + ++ thread_timeout = global_timeout = 0; /* XXX */ ++ + nreqthreads = 1; + totalthreads = 1; + thread_function ((void *) 1); diff --git a/debian/patches/makedev.diff b/debian/patches/makedev.diff new file mode 100644 index 00000000..f53320c5 --- /dev/null +++ b/debian/patches/makedev.diff @@ -0,0 +1,17 @@ +Do not create the shm node since Marcus' SHM implementation uses a directory +there. +--- + sutils/MAKEDEV.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/sutils/MAKEDEV.sh ++++ b/sutils/MAKEDEV.sh +@@ -86,7 +86,7 @@ function mkdev { + ;; + + std) +- mkdev console tty null zero full fd time mem klog shm ++ mkdev console tty null zero full fd time mem klog + ;; + console|com[0-9]) + st $I root 600 /hurd/term ${DEVDIR}/$I device $I;; diff --git a/debian/patches/mount-f.patch b/debian/patches/mount-f.patch new file mode 100644 index 00000000..aabc47b7 --- /dev/null +++ b/debian/patches/mount-f.patch @@ -0,0 +1,88 @@ +Add -f and --fake arguments. This makes our mount more compatible with +Linux mount. + +* utils/mount.c (argp_opts): Add -f and --fake. +(do_mount): Fake the translator startup if --fake is given. +--- + utils/mount.c | 29 ++++++++++++++++++++++++++++- + 1 file changed, 28 insertions(+), 1 deletion(-) + +diff --git a/utils/mount.c b/utils/mount.c +index f1d5750..f8928f1 100644 +--- a/utils/mount.c ++++ b/utils/mount.c +@@ -24,6 +24,7 @@ + #include <error.h> + #include <stdlib.h> + #include <fcntl.h> ++#include <unistd.h> + #include <hurd/fsys.h> + #include <hurd/fshelp.h> + #include <hurd/paths.h> +@@ -34,6 +35,7 @@ + static char *fstype = DEFAULT_FSTYPE; + static char *device, *mountpoint; + static int verbose; ++static int fake; + static char *options; + static size_t options_len; + static mach_msg_timeout_t timeout; +@@ -55,6 +57,7 @@ static const struct argp_option argp_opts[] = + {"remount", 0, 0, OPTION_ALIAS}, + {"verbose", 'v', 0, 0, "Give more detailed information"}, + {"no-mtab", 'n', 0, 0, "Do not update /etc/mtab"}, ++ {"fake", 'f', 0, 0, "Do not actually mount, just pretend"}, + {0, 0} + }; + +@@ -115,6 +118,10 @@ parse_opt (int key, char *arg, struct argp_state *state) + /* do nothing */ + break; + ++ case 'f': ++ fake = 1; ++ break; ++ + case ARGP_KEY_ARG: + if (mountpoint == 0) /* One arg: mountpoint */ + mountpoint = arg; +@@ -312,7 +319,10 @@ do_mount (struct fs *fs, int remount) + return 0; + } + +- if (mounted != MACH_PORT_NULL) ++ /* Do not fail if there is an active translator if --fake is ++ given. This mimics Linux mount utility more closely which ++ just looks into the mtab file. */ ++ if (mounted != MACH_PORT_NULL && !fake) + { + error (0, 0, "%s already mounted", fs->mntent.mnt_fsname); + return EBUSY; +@@ -342,6 +352,23 @@ do_mount (struct fs *fs, int remount) + + /* Now we have a translator command line argz in FSOPTS. */ + ++ if (fake) { ++ /* Fake the translator startup. */ ++ mach_port_t underlying; ++ mach_msg_type_name_t underlying_type; ++ err = open_node (O_READ, &underlying, &underlying_type, 0, NULL); ++ if (err) ++ error (1, errno, "cannot mount on %s", fs->mntent.mnt_dir); ++ ++ mach_port_deallocate (mach_task_self (), underlying); ++ ++ /* See if the translator is at least executable. */ ++ if (access(type->program, X_OK) == -1) ++ error (1, errno, "can not execute %s", type->program); ++ ++ return 0; ++ } ++ + explain ("settrans -a"); + err = fshelp_start_translator (open_node, NULL, fsopts, + fsopts, fsopts_len, timeout, +-- +1.7.10.4 + + diff --git a/debian/patches/mount-ignore-mounted-all.patch b/debian/patches/mount-ignore-mounted-all.patch new file mode 100644 index 00000000..b3890d4a --- /dev/null +++ b/debian/patches/mount-ignore-mounted-all.patch @@ -0,0 +1,32 @@ +Linux' mount utility ignores mounted filesystems if mount --all is +invoked. This patch makes our mount do the same. + +utils/mount.c (main): Ignore mounted filesystems if --all is given. +--- + utils/mount.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/utils/mount.c b/utils/mount.c +index 73a7539..77b2138 100644 +--- a/utils/mount.c ++++ b/utils/mount.c +@@ -631,6 +631,15 @@ main (int argc, char **argv) + + if (! match_options (&fs->mntent)) + continue; ++ ++ fsys_t mounted; ++ err = fs_fsys (fs, &mounted); ++ if (err) ++ error (0, err, "cannot determine if %s is already mounted", ++ fs->mntent.mnt_fsname); ++ ++ if (mounted != MACH_PORT_NULL) ++ continue; + } + err |= do_mount (fs, remount); + } +-- +1.7.10.4 + + diff --git a/debian/patches/mount-loop.patch b/debian/patches/mount-loop.patch new file mode 100644 index 00000000..07f572be --- /dev/null +++ b/debian/patches/mount-loop.patch @@ -0,0 +1,20 @@ +mount: Ignore `loop' option + +* utils/mount.c (do_mount): Ignore `loop' option. +--- + mount.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) +diff --git a/utils/mount.c b/utils/mount.c +index 8b059c2..8af055e 100644 +--- a/utils/mount.c ++++ b/utils/mount.c +@@ -248,7 +248,8 @@ do_mount (struct fs *fs, int remount) + { + ARGZ (add (&fsopts, &fsopts_len, o)); + } +- else if (strcmp (o, "defaults") != 0) ++ else if (strcmp (o, "defaults") != 0 && ++ strcmp (o, "loop") != 0) + { + /* Prepend `--' to the option to make a long option switch, + e.g. `--ro' or `--rsize=1024'. */ diff --git a/debian/patches/mount-n.patch b/debian/patches/mount-n.patch new file mode 100644 index 00000000..9b860877 --- /dev/null +++ b/debian/patches/mount-n.patch @@ -0,0 +1,37 @@ +Add -n and --no-mtab arguments. As we do not write an mtab file, this +is a trivial patch that just ignores this argument to be more +compatible with Linux mount. + +* utils/mount.c (argp_opts): Add -n and --no-mtab. +(parse_opt): Do nothing on 'n'. +--- + utils/mount.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/utils/mount.c b/utils/mount.c +index 8b059c2..ea30f7a 100644 +--- a/utils/mount.c ++++ b/utils/mount.c +@@ -54,6 +54,7 @@ static const struct argp_option argp_opts[] = + {"update", 'u', 0, 0, "Flush any meta-data cached in core"}, + {"remount", 0, 0, OPTION_ALIAS}, + {"verbose", 'v', 0, 0, "Give more detailed information"}, ++ {"no-mtab", 'n', 0, 0, "Do not update /etc/mtab"}, + {0, 0} + }; + +@@ -110,6 +111,10 @@ parse_opt (int key, char *arg, struct argp_state *state) + } + break; + ++ case 'n': ++ /* do nothing */ ++ break; ++ + case ARGP_KEY_ARG: + if (mountpoint == 0) /* One arg: mountpoint */ + mountpoint = arg; +-- +1.7.10.4 + + diff --git a/debian/patches/mount-remount.patch b/debian/patches/mount-remount.patch new file mode 100644 index 00000000..53eccb2b --- /dev/null +++ b/debian/patches/mount-remount.patch @@ -0,0 +1,67 @@ +This fixes mount -oremount when just given the mountpoint, e. g.: + + % mount -oremount,ro /tmp + +* util/mount.c (main): Add a one-argument form for remount. +--- + utils/mount.c | 29 +++++++++++++++++++++++------ + 1 file changed, 23 insertions(+), 6 deletions(-) + +diff --git a/utils/mount.c b/utils/mount.c +index ea30f7a..f1d5750 100644 +--- a/utils/mount.c ++++ b/utils/mount.c +@@ -526,6 +526,12 @@ main (int argc, char **argv) + + fstab = fstab_argp_create (&fstab_params, SEARCH_FMTS, sizeof SEARCH_FMTS); + ++ /* This is a convenient way of checking for any `remount' options. */ ++ remount = 0; ++ err = argz_replace (&options, &options_len, "remount", "update", &remount); ++ if (err) ++ error (3, ENOMEM, "collecting mount options"); ++ + if (device) /* two-argument form */ + { + struct mntent m = +@@ -548,6 +554,23 @@ main (int argc, char **argv) + if (err) + error (2, err, "%s", mountpoint); + } ++ else if (mountpoint && remount) /* one-argument remount */ ++ { ++ struct mntent m = ++ { ++ mnt_fsname: mountpoint, /* since we cannot know the device, ++ using mountpoint here leads to more ++ helpful error messages */ ++ mnt_dir: mountpoint, ++ mnt_type: fstype, ++ mnt_opts: 0, ++ mnt_freq: 0, mnt_passno: 0 ++ }; ++ ++ err = fstab_add_mntent (fstab, &m, &fs); ++ if (err) ++ error (2, err, "%s", mountpoint); ++ } + else if (mountpoint) /* one-argument form */ + { + fs = fstab_find (fstab, mountpoint); +@@ -557,12 +580,6 @@ main (int argc, char **argv) + else + fs = 0; + +- /* This is a convenient way of checking for any `remount' options. */ +- remount = 0; +- err = argz_replace (&options, &options_len, "remount", "update", &remount); +- if (err) +- error (3, ENOMEM, "collecting mount options"); +- + if (fs != 0) + err = do_mount (fs, remount); + else +-- +1.7.10.4 + + diff --git a/debian/patches/mount-t-auto.patch b/debian/patches/mount-t-auto.patch new file mode 100644 index 00000000..5f800f41 --- /dev/null +++ b/debian/patches/mount-t-auto.patch @@ -0,0 +1,86 @@ +Use libblkid to detect the filesystem type if "auto" is given as +type. Remove the translator localization from main, this is also done +in do_mount and any errors are propagated properly. This way "auto" is +handled correctly if given on the command line or used as filesystem +type in the fstab. + +* utils/mount.c (DEFAULT_FSTYPE): Use "auto" as default type. +(do_mount): Detect type using libblkid. +(main): Drop translator localization. +--- + utils/Makefile | 1 + + utils/mount.c | 27 +++++++++++++++++++-------- + 2 files changed, 20 insertions(+), 8 deletions(-) + +diff --git a/utils/Makefile b/utils/Makefile +index 6975fb5..207c904 100644 +--- a/utils/Makefile ++++ b/utils/Makefile +@@ -37,6 +37,7 @@ LDLIBS += -lpthread + login-LDLIBS = -lutil $(LIBCRYPT) + addauth-LDLIBS = $(LIBCRYPT) + setauth-LDLIBS = $(LIBCRYPT) ++mount-LDLIBS = -lblkid + + INSTALL-login-ops = -o root -m 4755 + INSTALL-ids-ops = -o root -m 4755 +diff --git a/utils/mount.c b/utils/mount.c +index 77b2138..5863f96 100644 +--- a/utils/mount.c ++++ b/utils/mount.c +@@ -28,11 +28,12 @@ + #include <hurd/fsys.h> + #include <hurd/fshelp.h> + #include <hurd/paths.h> ++#include <blkid/blkid.h> + + #include "match-options.h" + + #define SEARCH_FMTS _HURD "%sfs\0" _HURD "%s" +-#define DEFAULT_FSTYPE "ext2" ++#define DEFAULT_FSTYPE "auto" + + static char *fstype = DEFAULT_FSTYPE; + static char *device, *mountpoint; +@@ -338,6 +339,23 @@ do_mount (struct fs *fs, int remount) + return EBUSY; + } + ++ if (strcmp (fs->mntent.mnt_type, "auto") == 0) ++ { ++ char *type = ++ blkid_get_tag_value (NULL, "TYPE", fs->mntent.mnt_fsname); ++ if (! type) ++ { ++ error (0, 0, "failed to detect file system type"); ++ return EFTYPE; ++ } ++ else ++ { ++ fs->mntent.mnt_type = strdup (type); ++ if (! fs->mntent.mnt_type) ++ error (3, ENOMEM, "failed to allocate memory"); ++ } ++ } ++ + err = fs_type (fs, &type); + if (err) + { +@@ -579,13 +597,6 @@ main (int argc, char **argv) + mnt_opts: 0, + mnt_freq: 0, mnt_passno: 0 + }; +- struct fstype *fst; +- +- err = fstypes_get (fstab->types, fstype, &fst); +- if (err) +- error (106, err, "cannot initialize type %s", fstype); +- if (fst->program == 0) +- error (2, 0, "filesystem type %s not recognized", fstype); + + err = fstab_add_mntent (fstab, &m, &fs); + if (err) +-- +1.7.10.4 + + diff --git a/debian/patches/mount-test-opts.patch b/debian/patches/mount-test-opts.patch new file mode 100644 index 00000000..e694b69f --- /dev/null +++ b/debian/patches/mount-test-opts.patch @@ -0,0 +1,214 @@ +--test-opts in combination with --all mounts only those filesystems +with options matching the given set of options. + +Note that the semantic of the inverting "no" prefix differs from +--types: While --types=nonfs,ufs means neither nfs nor ufs, +--test-opts=nofoo,bar means not foo, but bar. + +* utils/match-options.h: New file. +* utils/match-options.c: Likewise. +(test_opts): New variable. +(test_opts_len): Likewise. +(match_options): New function. +* utils/mount.c (parse_opt): Handle -O, --test-opts. +(main): Use match_options as filter. +--- + utils/Makefile | 5 ++-- + utils/match-options.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ + utils/match-options.h | 33 ++++++++++++++++++++++++ + utils/mount.c | 19 ++++++++++++-- + 4 files changed, 121 insertions(+), 4 deletions(-) + create mode 100644 utils/match-options.c + create mode 100644 utils/match-options.h + +diff --git a/utils/Makefile b/utils/Makefile +index e3bed0b..6975fb5 100644 +--- a/utils/Makefile ++++ b/utils/Makefile +@@ -28,7 +28,8 @@ SRCS = shd.c ps.c settrans.c syncfs.c showtrans.c addauth.c rmauth.c \ + uptime.sh psout.c ids.c vmstat.c portinfo.c devprobe.c vminfo.c \ + parse.c frobauth.c frobauth-mod.c setauth.c pids.c nonsugid.c \ + unsu.c ftpcp.c ftpdir.c storeread.c storecat.c msgport.c \ +- rpctrace.c mount.c gcore.c fakeauth.c fakeroot.sh remap.sh ++ rpctrace.c mount.c gcore.c fakeauth.c fakeroot.sh remap.sh \ ++ match-options.c + + OBJS = $(filter-out %.sh,$(SRCS:.c=.o)) + HURDLIBS = ps ihash store fshelp ports ftpconn shouldbeinlibc +@@ -72,7 +73,7 @@ fakeauth-CPPFLAGS = -I$(srcdir)/../auth + authServer-CPPFLAGS = -I$(srcdir)/../auth + auth_requestUser-CPPFLAGS = -I$(srcdir)/../auth + +-mount: ../sutils/fstab.o ../sutils/clookup.o \ ++mount: ../sutils/fstab.o ../sutils/clookup.o match-options.o \ + $(foreach L,fshelp ports,../lib$L/lib$L.a) + ../sutils/fstab.o ../sutils/clookup.o: FORCE + $(MAKE) -C $(@D) $(@F) +diff --git a/utils/match-options.c b/utils/match-options.c +new file mode 100644 +index 0000000..11fc9dc +--- /dev/null ++++ b/utils/match-options.c +@@ -0,0 +1,68 @@ ++/* Common functionality for the --test-opts flag of mount and umount. ++ ++ Copyright (C) 2013 Free Software Foundation, Inc. ++ Written by Justus Winter <4winter@informatik.uni-hamburg.de> ++ ++ This file is part of the GNU Hurd. ++ ++ The GNU Hurd 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. ++ ++ The GNU Hurd is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ ++ ++#include <argz.h> ++#include <error.h> ++#include <stdlib.h> ++#include <string.h> ++ ++#include "match-options.h" ++ ++char *test_opts; ++size_t test_opts_len; ++ ++int ++match_options (struct mntent *mntent) ++{ ++ char *opts; ++ size_t opts_len; ++ ++ error_t err = argz_create_sep (mntent->mnt_opts, ',', &opts, &opts_len); ++ if (err) ++ error (3, err, "parsing mount options failed"); ++ ++ for (char *test = test_opts; ++ test; test = argz_next (test_opts, test_opts_len, test)) ++ { ++ char *needle = test; ++ int inverse = strncmp("no", needle, 2) == 0; ++ if (inverse) ++ needle += 2; ++ ++ int match = 0; ++ for (char *opt = opts; opt; opt = argz_next (opts, opts_len, opt)) ++ { ++ if (strcmp (opt, needle) == 0) { ++ if (inverse) ++ return 0; /* foo in opts, nofoo in test_opts. */ ++ ++ /* foo in opts, foo in test_opts, record match. */ ++ match = 1; ++ } ++ } ++ ++ if (! inverse && ! match) ++ return 0; /* No foo in opts, but foo in test_opts. */ ++ } ++ ++ /* If no conflicting test_opt was encountered, return success. */ ++ return 1; ++} +diff --git a/utils/match-options.h b/utils/match-options.h +new file mode 100644 +index 0000000..ea7ae70 +--- /dev/null ++++ b/utils/match-options.h +@@ -0,0 +1,33 @@ ++/* Common functionality for the --test-opts flag of mount and umount. ++ ++ Copyright (C) 2013 Free Software Foundation, Inc. ++ Written by Justus Winter <4winter@informatik.uni-hamburg.de> ++ ++ This file is part of the GNU Hurd. ++ ++ The GNU Hurd 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. ++ ++ The GNU Hurd is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ ++ ++#include <mntent.h> ++ ++extern char *test_opts; ++extern size_t test_opts_len; ++ ++/* Check whether the given mount entry matches the given set of ++ options. ++ ++ Returns 0 if foo is in the options vector but nofoo is in test_opts. ++ Returns 0 if foo is in test_opts but foo is not in the options vector. */ ++int ++match_options (struct mntent *mntent); +diff --git a/utils/mount.c b/utils/mount.c +index f8928f1..73a7539 100644 +--- a/utils/mount.c ++++ b/utils/mount.c +@@ -29,6 +29,8 @@ + #include <hurd/fshelp.h> + #include <hurd/paths.h> + ++#include "match-options.h" ++ + #define SEARCH_FMTS _HURD "%sfs\0" _HURD "%s" + #define DEFAULT_FSTYPE "ext2" + +@@ -57,6 +59,8 @@ static const struct argp_option argp_opts[] = + {"remount", 0, 0, OPTION_ALIAS}, + {"verbose", 'v', 0, 0, "Give more detailed information"}, + {"no-mtab", 'n', 0, 0, "Do not update /etc/mtab"}, ++ {"test-opts", 'O', "OPTIONS", 0, ++ "Only mount fstab entries matching the given set of options"}, + {"fake", 'f', 0, 0, "Do not actually mount, just pretend"}, + {0, 0} + }; +@@ -122,6 +126,12 @@ parse_opt (int key, char *arg, struct argp_state *state) + fake = 1; + break; + ++ case 'O': ++ err = argz_create_sep (arg, ',', &test_opts, &test_opts_len); ++ if (err) ++ argp_failure (state, 100, ENOMEM, "%s", arg); ++ break; ++ + case ARGP_KEY_ARG: + if (mountpoint == 0) /* One arg: mountpoint */ + mountpoint = arg; +@@ -615,8 +625,13 @@ main (int argc, char **argv) + case mount: + for (fs = fstab->entries; fs; fs = fs->next) + { +- if (fstab_params.do_all && hasmntopt (&fs->mntent, MNTOPT_NOAUTO)) +- continue; ++ if (fstab_params.do_all) { ++ if (hasmntopt (&fs->mntent, MNTOPT_NOAUTO)) ++ continue; ++ ++ if (! match_options (&fs->mntent)) ++ continue; ++ } + err |= do_mount (fs, remount); + } + break; +-- +1.7.10.4 + + diff --git a/debian/patches/pfinet_dhcp.patch b/debian/patches/pfinet_dhcp.patch new file mode 100644 index 00000000..92446267 --- /dev/null +++ b/debian/patches/pfinet_dhcp.patch @@ -0,0 +1,560 @@ +2007-10-14 Christian Dietrich <stettberger@dokucode.de> + + * options.c (options): Marked -a, -g -m, -p, -A, -G + OPTION_ARG_OPTIONAL. Adding -d option. + (parse_interface_copy_device): New function. + (parse_opt): When selecting another interface with -i + set the options from e.g. a prior fsysopts call as default + values. For -a, -g, -p, -g, -A, -G set the optional + argument as value. When there is no argument, delete the + value (e.g. unset default gateway). Delete delete default gateways + only if the set gateway is on an interface modified in this call. + Add always an route for dhcp packages on all devices. By doing + this we can send dhcp renew packages. + (trivfs_append_args): Add --gateway only once. + +2007-10-14 Marco Gerards <metgerards@student.han.nl> + + * options.c (options): Add the option `dhcp'. + (parse_hook_add_interface): Initialize the `dhcp' member for the + parse hook. + (parse_opt): In case pfinet is started with the argument `--dhcp', + set the address to `0.0.0.0', the netmask to `255.0.0.0' and add + the route for `0.0.0.0' so broadcasting works. + + * linux-src/net/ipv4/devinet.c (inet_insert_ifa) [_HURD_]: Don't + fail when the address is `0.0.0.0'. + +--- + pfinet/linux-src/net/ipv4/devinet.c | 2 + pfinet/options.c | 381 ++++++++++++++++++++++++++---------- + 2 files changed, 278 insertions(+), 105 deletions(-) + +--- a/pfinet/options.c ++++ b/pfinet/options.c +@@ -60,23 +60,26 @@ extern struct inet6_dev *ipv6_find_idev + extern int inet6_addr_add (int ifindex, struct in6_addr *pfx, int plen); + extern int inet6_addr_del (int ifindex, struct in6_addr *pfx, int plen); + ++#ifdef CONFIG_IPV6 ++static struct rt6_info * ipv6_get_dflt_router (void); ++#endif ++ + + /* Pfinet options. Used for both startup and runtime. */ + static const struct argp_option options[] = + { +- {"interface", 'i', "DEVICE", 0, "Network interface to use", 1}, ++ {"interface", 'i', "DEVICE", 0, "Network interface to use", 1}, + {0,0,0,0,"These apply to a given interface:", 2}, +- {"address", 'a', "ADDRESS", 0, "Set the network address"}, +- {"netmask", 'm', "MASK", 0, "Set the netmask"}, +- {"peer", 'p', "ADDRESS", 0, "Set the peer address"}, +- {"gateway", 'g', "ADDRESS", 0, "Set the default gateway"}, +- {"ipv4", '4', "NAME", 0, "Put active IPv4 translator on NAME"}, ++ {"address", 'a', "ADDRESS", OPTION_ARG_OPTIONAL, "Set the network address"}, ++ {"netmask", 'm', "MASK", OPTION_ARG_OPTIONAL, "Set the netmask"}, ++ {"peer", 'p', "ADDRESS", OPTION_ARG_OPTIONAL, "Set the peer address"}, ++ {"gateway", 'g', "ADDRESS", OPTION_ARG_OPTIONAL, "Set the default gateway"}, ++ {"ipv4", '4', "NAME", 0, "Put active IPv4 translator on NAME"}, + #ifdef CONFIG_IPV6 +- {"ipv6", '6', "NAME", 0, "Put active IPv6 translator on NAME"}, +- {"address6", 'A', "ADDR/LEN",0, "Set the global IPv6 address"}, +- {"gateway6", 'G', "ADDRESS", 0, "Set the IPv6 default gateway"}, ++ {"ipv6", '6', "NAME", 0, "Put active IPv6 translator on NAME"}, ++ {"address6", 'A', "ADDR/LEN", OPTION_ARG_OPTIONAL, "Set the global IPv6 address"}, ++ {"gateway6", 'G', "ADDRESS", OPTION_ARG_OPTIONAL, "Set the IPv6 default gateway"}, + #endif +- {"shutdown", 's', 0, 0, "Shut it down"}, + {0} + }; + +@@ -112,6 +115,50 @@ struct parse_hook + struct parse_interface *curint; + }; + ++static void ++parse_interface_copy_device(struct device *src, ++ struct parse_interface *dst) ++{ ++ uint32_t broad; ++ struct rt_key key = { 0 }; ++ struct inet6_dev *idev = NULL; ++ struct fib_result res; ++ ++ inquire_device (src, &dst->address, &dst->netmask, ++ &dst->peer, &broad); ++ /* Get gateway */ ++ dst->gateway = INADDR_NONE; ++ key.oif = src->ifindex; ++ if (! main_table->tb_lookup (main_table, &key, &res) ++ && FIB_RES_GW(res) != INADDR_ANY) ++ dst->gateway = FIB_RES_GW (res); ++#ifdef CONFIG_IPV6 ++ if (trivfs_protid_portclasses[PORTCLASS_INET6] != MACH_PORT_NULL) ++ idev = ipv6_find_idev(src); ++ ++ if (idev) ++ { ++ struct inet6_ifaddr *ifa = idev->addr_list; ++ ++ /* Look for IPv6 default router and add it to the interface, ++ * if it belongs to it. ++ */ ++ struct rt6_info *rt6i = ipv6_get_dflt_router(); ++ if (rt6i->rt6i_dev == src) ++ memcpy (&dst->gateway6, &rt6i->rt6i_gateway, sizeof (struct in6_addr)); ++ /* Search for global address and set it in dst */ ++ do ++ { ++ if (!IN6_IS_ADDR_LINKLOCAL (&ifa->addr)) { ++ memcpy (&dst->address6, ifa, sizeof (struct inet6_ifaddr)); ++ break; ++ } ++ } ++ while ((ifa = ifa->if_next)); ++ } ++#endif ++} ++ + /* Adds an empty interface slot to H, and sets H's current interface to it, or + returns an error. */ + static error_t +@@ -122,6 +169,7 @@ parse_hook_add_interface (struct parse_h + (h->num_interfaces + 1) * sizeof (struct parse_interface)); + if (! new) + return ENOMEM; ++ + h->interfaces = new; + h->num_interfaces++; + h->curint = new + h->num_interfaces - 1; +@@ -183,10 +231,16 @@ parse_opt (int opt, char *arg, struct ar + if (addr == INADDR_NONE) PERR (EINVAL, "Malformed %s", type); \ + addr; }) + ++ if (!arg && state->next < state->argc ++ && (*state->argv[state->next] != '-')) ++ { ++ arg = state->argv[state->next]; ++ state->next ++; ++ } ++ + switch (opt) + { +- struct parse_interface *in; +- uint32_t gateway; ++ struct parse_interface *in, *gw4_in; + #ifdef CONFIG_IPV6 + struct parse_interface *gw6_in; + char *ptr; +@@ -217,29 +271,59 @@ parse_opt (int opt, char *arg, struct ar + if (err) + FAIL (err, 10, err, "%s", arg); + ++ /* Set old interface values */ ++ parse_interface_copy_device (in->device, in); + break; + + case 'a': +- h->curint->address = ADDR (arg, "address"); +- if (!IN_CLASSA (ntohl (h->curint->address)) +- && !IN_CLASSB (ntohl (h->curint->address)) +- && !IN_CLASSC (ntohl (h->curint->address))) +- { +- if (IN_MULTICAST (ntohl (h->curint->address))) +- FAIL (EINVAL, 1, 0, +- "%s: Cannot set interface address to multicast address", +- arg); +- else +- FAIL (EINVAL, 1, 0, +- "%s: Illegal or undefined network address", arg); +- } ++ if (arg) ++ { ++ h->curint->address = ADDR (arg, "address"); ++ if (!IN_CLASSA (ntohl (h->curint->address)) ++ && !IN_CLASSB (ntohl (h->curint->address)) ++ && !IN_CLASSC (ntohl (h->curint->address))) ++ { ++ if (IN_MULTICAST (ntohl (h->curint->address))) ++ FAIL (EINVAL, 1, 0, ++ "%s: Cannot set interface address to multicast address", ++ arg); ++ else ++ FAIL (EINVAL, 1, 0, ++ "%s: Illegal or undefined network address", arg); ++ } ++ } else { ++ h->curint->address = ADDR ("0.0.0.0", "address"); ++ h->curint->netmask = ADDR ("255.0.0.0", "netmask"); ++ h->curint->gateway = INADDR_NONE; ++ } + break; ++ + case 'm': +- h->curint->netmask = ADDR (arg, "netmask"); break; ++ if (arg) ++ h->curint->netmask = ADDR (arg, "netmask"); ++ else ++ h->curint->netmask = INADDR_NONE; ++ break; ++ + case 'p': +- h->curint->peer = ADDR (arg, "peer"); break; ++ if (arg) ++ h->curint->peer = ADDR (arg, "peer"); ++ else ++ h->curint->peer = INADDR_NONE; ++ break; ++ + case 'g': +- h->curint->gateway = ADDR (arg, "gateway"); break; ++ if (arg) ++ { ++ /* Remove an possible other default gateway */ ++ for (in = h->interfaces; in < h->interfaces + h->num_interfaces; ++ in++) ++ in->gateway = INADDR_NONE; ++ h->curint->gateway = ADDR (arg, "gateway"); ++ } ++ else ++ h->curint->gateway = INADDR_NONE; ++ break; + + case '4': + pfinet_bind (PORTCLASS_INET, arg); +@@ -254,36 +338,46 @@ parse_opt (int opt, char *arg, struct ar + break; + + case 'A': +- if ((ptr = strchr (arg, '/'))) ++ if (arg) + { +- h->curint->address6.prefix_len = atoi (ptr + 1); +- if (h->curint->address6.prefix_len > 128) +- FAIL (EINVAL, 1, 0, "%s: The prefix-length is invalid", arg); ++ if ((ptr = strchr (arg, '/'))) ++ { ++ h->curint->address6.prefix_len = atoi (ptr + 1); ++ if (h->curint->address6.prefix_len > 128) ++ FAIL (EINVAL, 1, 0, "%s: The prefix-length is invalid", arg); ++ ++ *ptr = 0; ++ } ++ else ++ { ++ h->curint->address6.prefix_len = 64; ++ fprintf (stderr, "No prefix-length given, " ++ "defaulting to %s/64.\n", arg); ++ } ++ ++ if (inet_pton (AF_INET6, arg, &h->curint->address6.addr) <= 0) ++ PERR (EINVAL, "Malformed address"); + +- *ptr = 0; ++ if (IN6_IS_ADDR_MULTICAST (&h->curint->address6.addr)) ++ FAIL (EINVAL, 1, 0, "%s: Cannot set interface address to " ++ "multicast address", arg); + } + else +- { +- h->curint->address6.prefix_len = 64; +- fprintf (stderr, "No prefix-length given, defaulting to %s/64.\n", +- arg); +- } +- +- if (inet_pton (AF_INET6, arg, &h->curint->address6.addr) <= 0) +- PERR (EINVAL, "Malformed address"); +- +- if (IN6_IS_ADDR_MULTICAST (&h->curint->address6.addr)) +- FAIL (EINVAL, 1, 0, "%s: Cannot set interface address to " +- "multicast address", arg); ++ memset (&h->curint->address6, 0, sizeof (struct inet6_ifaddr)); + break; + + case 'G': +- if (inet_pton (AF_INET6, arg, &h->curint->gateway6) <= 0) +- PERR (EINVAL, "Malformed gateway"); ++ if (arg) ++ { ++ if (inet_pton (AF_INET6, arg, &h->curint->gateway6) <= 0) ++ PERR (EINVAL, "Malformed gateway"); + +- if (IN6_IS_ADDR_MULTICAST (&h->curint->gateway6)) +- FAIL (EINVAL, 1, 0, "%s: Cannot set gateway to " +- "multicast address", arg); ++ if (IN6_IS_ADDR_MULTICAST (&h->curint->gateway6)) ++ FAIL (EINVAL, 1, 0, "%s: Cannot set gateway to " ++ "multicast address", arg); ++ } ++ else ++ memset (&h->curint->gateway6, 0, sizeof (struct in6_addr)); + break; + #endif /* CONFIG_IPV6 */ + +@@ -323,20 +417,19 @@ parse_opt (int opt, char *arg, struct ar + /* Specifying a netmask for an address-less interface is a no-no. */ + FAIL (EDESTADDRREQ, 14, 0, "Cannot set netmask"); + #endif +- +- gateway = INADDR_NONE; + #ifdef CONFIG_IPV6 + gw6_in = NULL; + #endif ++ gw4_in = NULL; + for (in = h->interfaces; in < h->interfaces + h->num_interfaces; in++) + { ++ /* delete interface if it doesn't match the actual netmask */ ++ if (! ( (h->curint->address & h->curint->netmask) ++ == (h->curint->gateway & h->curint->netmask))) ++ h->curint->gateway = INADDR_NONE; ++ + if (in->gateway != INADDR_NONE) +- { +- if (gateway != INADDR_NONE) +- FAIL (err, 15, 0, "Cannot have multiple default gateways"); +- gateway = in->gateway; +- in->gateway = INADDR_NONE; +- } ++ gw4_in = in; + + #ifdef CONFIG_IPV6 + if (!IN6_IS_ADDR_UNSPECIFIED (&in->gateway6)) +@@ -361,15 +454,20 @@ + idev = ipv6_find_idev(in->device); + #endif + +- if (in->address != INADDR_NONE || in->netmask != INADDR_NONE) ++ if (in->address == INADDR_NONE && in->netmask == INADDR_NONE) + { +- err = configure_device (in->device, in->address, in->netmask, +- in->peer, INADDR_NONE); +- if (err) +- { +- pthread_mutex_unlock (&global_lock); +- FAIL (err, 16, 0, "cannot configure interface"); +- } ++ h->curint->address = ADDR ("0.0.0.0", "address"); ++ h->curint->netmask = ADDR ("255.0.0.0", "netmask"); ++ } ++ ++ if (in->device) ++ err = configure_device (in->device, in->address, in->netmask, ++ in->peer, INADDR_NONE); ++ ++ if (err) ++ { ++ pthread_mutex_unlock (&global_lock); ++ FAIL (err, 16, 0, "cannot configure interface"); + } + + #ifdef CONFIG_IPV6 +@@ -377,24 +475,25 @@ + continue; + + /* First let's remove all non-local addresses. */ +- struct inet6_ifaddr *ifa = idev->addr_list; +- +- while (ifa) +- { +- struct inet6_ifaddr *c_ifa = ifa; +- ifa = ifa->if_next; +- +- if (IN6_ARE_ADDR_EQUAL (&c_ifa->addr, &in->address6.addr)) +- memset (&in->address6, 0, sizeof (struct inet6_ifaddr)); +- +- else if (!IN6_IS_ADDR_LINKLOCAL (&c_ifa->addr) +- && !IN6_IS_ADDR_SITELOCAL (&c_ifa->addr)) +- inet6_addr_del (in->device->ifindex, &c_ifa->addr, +- c_ifa->prefix_len); +- } +- +- if (!IN6_IS_ADDR_UNSPECIFIED (&in->address6.addr)) +- { ++ struct inet6_ifaddr *ifa = idev->addr_list; ++ ++ while (ifa) ++ { ++ struct inet6_ifaddr *c_ifa = ifa; ++ ifa = ifa->if_next; ++ ++ if (!IN6_IS_ADDR_UNSPECIFIED (&in->address6.addr) ++ && IN6_ARE_ADDR_EQUAL (&c_ifa->addr, &in->address6.addr)) ++ memset (&in->address6, 0, sizeof (struct inet6_ifaddr)); ++ ++ else if (!IN6_IS_ADDR_LINKLOCAL (&c_ifa->addr) ++ && !IN6_IS_ADDR_SITELOCAL (&c_ifa->addr)) ++ inet6_addr_del (in->device->ifindex, &c_ifa->addr, ++ c_ifa->prefix_len); ++ } ++ ++ if (!IN6_IS_ADDR_UNSPECIFIED (&in->address6.addr)) ++ { + /* Now assign the new address */ + inet6_addr_add (in->device->ifindex, &in->address6.addr, + in->address6.prefix_len); +@@ -418,33 +517,40 @@ + req.nlh.nlmsg_seq = 0; + req.nlh.nlmsg_len = NLMSG_LENGTH (sizeof req.rtm); + +- bzero (&req.rtm, sizeof req.rtm); +- bzero (&rta, sizeof rta); ++ memset (&req.rtm, 0, sizeof req.rtm); ++ memset (&rta, 0, sizeof rta); + req.rtm.rtm_scope = RT_SCOPE_UNIVERSE; + req.rtm.rtm_type = RTN_UNICAST; + req.rtm.rtm_protocol = RTPROT_STATIC; +- rta.rta_gw = &gateway; + +- if (gateway == INADDR_NONE) ++ if (!gw4_in) + { +- /* Delete any existing default route. */ +- req.nlh.nlmsg_type = RTM_DELROUTE; +- req.nlh.nlmsg_flags = 0; +- tb = fib_get_table (req.rtm.rtm_table); +- if (tb) +- { +- err = - (*tb->tb_delete) (tb, &req.rtm, &rta, &req.nlh, 0); +- if (err && err != ESRCH) +- { +- pthread_mutex_unlock (&global_lock); +- FAIL (err, 17, 0, "cannot remove old default gateway"); +- } +- err = 0; +- } ++ /* Delete any existing default route on configured devices */ ++ for (in = h->interfaces; in < h->interfaces + h->num_interfaces; ++ in++) { ++ req.nlh.nlmsg_type = RTM_DELROUTE; ++ req.nlh.nlmsg_flags = 0; ++ rta.rta_oif = &in->device->ifindex; ++ tb = fib_get_table (req.rtm.rtm_table); ++ if (tb) ++ { ++ err = - (*tb->tb_delete) ++ (tb, &req.rtm, &rta, &req.nlh, 0); ++ if (err && err != ESRCH) ++ { ++ pthread_mutex_unlock (&global_lock); ++ FAIL (err, 17, 0, ++ "cannot remove old default gateway"); ++ } ++ err = 0; ++ } ++ } + } + else + { + /* Add a default route, replacing any existing one. */ ++ rta.rta_oif = &gw4_in->device->ifindex; ++ rta.rta_gw = &gw4_in->gateway; + req.nlh.nlmsg_type = RTM_NEWROUTE; + req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_CREATE | NLM_F_REPLACE; + tb = fib_new_table (req.rtm.rtm_table); +@@ -467,13 +573,77 @@ + if (!gw6_in || rt6i->rt6i_dev != gw6_in->device + || !IN6_ARE_ADDR_EQUAL (&rt6i->rt6i_gateway, &gw6_in->gateway6)) + { +- rt6_purge_dflt_routers (0); ++ /* Delete any existing default route on configured devices */ ++ for (in = h->interfaces; in < h->interfaces ++ + h->num_interfaces; in++) ++ if (rt6i->rt6i_dev == in->device || gw6_in ) ++ rt6_purge_dflt_routers (0); ++ + if (gw6_in) + rt6_add_dflt_router (&gw6_in->gateway6, gw6_in->device); + } + } + #endif + ++ /* Setup the routing required for DHCP. */ ++ for (in = h->interfaces; in < h->interfaces + h->num_interfaces; in++) ++ { ++ struct kern_rta rta; ++ struct ++ { ++ struct nlmsghdr nlh; ++ struct rtmsg rtm; ++ } req; ++ struct fib_table *tb; ++ struct rtentry route; ++ struct sockaddr_in *dst; ++ struct device *dev; ++ ++ if (!in->device) ++ continue; ++ ++ dst = (struct sockaddr_in *) &route.rt_dst; ++ if (!in->device->name) ++ { ++ pthread_mutex_unlock (&global_lock); ++ FAIL (ENODEV, 17, 0, "unknown device"); ++ } ++ dev = dev_get (in->device->name); ++ if (!dev) ++ { ++ pthread_mutex_unlock (&global_lock); ++ FAIL (ENODEV, 17, 0, "unknown device"); ++ } ++ ++ /* Simulate the SIOCADDRT behavior. */ ++ memset (&route, 0, sizeof (struct rtentry)); ++ memset (&req.rtm, 0, sizeof req.rtm); ++ memset (&rta, 0, sizeof rta); ++ req.nlh.nlmsg_type = RTM_NEWROUTE; ++ ++ /* Append this routing for 0.0.0.0. By this way we can send always ++ dhcp messages (e.g dhcp renew). */ ++ req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_CREATE ++ | NLM_F_APPEND; ++ req.rtm.rtm_protocol = RTPROT_BOOT; ++ req.rtm.rtm_scope = RT_SCOPE_LINK; ++ req.rtm.rtm_type = RTN_UNICAST; ++ rta.rta_dst = &dst->sin_addr.s_addr; ++ rta.rta_oif = &dev->ifindex; ++ ++ tb = fib_new_table (req.rtm.rtm_table); ++ if (tb) ++ err = tb->tb_insert (tb, &req.rtm, &rta, &req.nlh, NULL); ++ else ++ err = ENOBUFS; ++ ++ if (err) ++ { ++ pthread_mutex_unlock (&global_lock); ++ FAIL (err, 17, 0, "cannot add route"); ++ } ++ } ++ + pthread_mutex_unlock (&global_lock); + + /* Fall through to free hook. */ +@@ -526,8 +696,9 @@ + ADD_ADDR_OPT ("netmask", mask); + if (peer != addr) + ADD_ADDR_OPT ("peer", peer); +- key.iif = dev->ifindex; +- if (! main_table->tb_lookup (main_table, &key, &res)) ++ key.oif = dev->ifindex; ++ if (! main_table->tb_lookup (main_table, &key, &res) ++ && FIB_RES_GW(res) != INADDR_ANY) + ADD_ADDR_OPT ("gateway", FIB_RES_GW (res)); + + #undef ADD_ADDR_OPT +--- a/pfinet/linux-src/net/ipv4/devinet.c ++++ b/pfinet/linux-src/net/ipv4/devinet.c +@@ -214,10 +214,12 @@ inet_insert_ifa(struct in_device *in_dev + { + struct in_ifaddr *ifa1, **ifap, **last_primary; + ++#ifndef _HURD_ + if (ifa->ifa_local == 0) { + inet_free_ifa(ifa); + return 0; + } ++#endif + + ifa->ifa_flags &= ~IFA_F_SECONDARY; + last_primary = &in_dev->ifa_list; diff --git a/debian/patches/posix-sigcodes.patch b/debian/patches/posix-sigcodes.patch new file mode 100644 index 00000000..8efb886a --- /dev/null +++ b/debian/patches/posix-sigcodes.patch @@ -0,0 +1,270 @@ +commit 2a54ebafd46a26d537ac38d46dc82568f751cc42 +Author: Jeremie Koenig <jk@jk.fr.eu.org> +Date: Wed Jun 8 03:00:37 2011 +0000 + + proc: send signals with POSIX sigcodes + + * proc/stubs.c (send_signal): Add a sigcode argument. + * proc/proc.h (send_signal): Declare the sigcode argument. + * proc/pgrp.c (leave_pgrp): Specify a null sigcode. + * proc/wait.c (alert_parent): Use CLD_EXITED for SIGCHLD on exit. + (S_proc_mark_stop): Use CLD_STOPPED for SIGCHLD on stop. + +diff --git a/proc/pgrp.c b/proc/pgrp.c +index 2d6ca93..72c09ba 100644 +--- a/proc/pgrp.c ++++ b/proc/pgrp.c +@@ -399,42 +399,42 @@ leave_pgrp (struct proc *p) + else if (p->p_parent->p_pgrp != pg + && p->p_parent->p_pgrp->pg_session == pg->pg_session + && !--pg->pg_orphcnt) + { + /* We were the last process keeping this from being + an orphaned process group -- do the orphaning gook */ + struct proc *ip; + int dosignal = 0; + + for (ip = pg->pg_plist; ip; ip = ip->p_gnext) + { + if (ip->p_stopped) + dosignal = 1; + if (ip->p_msgport != MACH_PORT_NULL) + nowait_msg_proc_newids (ip->p_msgport, ip->p_task, ip->p_parent->p_pid, + ip->p_pid, 1); + } + if (dosignal) + for (ip = pg->pg_plist; ip; ip = ip->p_gnext) + { +- send_signal (ip->p_msgport, SIGHUP, ip->p_task); +- send_signal (ip->p_msgport, SIGCONT, ip->p_task); ++ send_signal (ip->p_msgport, SIGHUP, 0, ip->p_task); ++ send_signal (ip->p_msgport, SIGCONT, 0, ip->p_task); + } + } + } + + /* Cause process P to join its process group. */ + void + join_pgrp (struct proc *p) + { + struct pgrp *pg = p->p_pgrp; + struct proc *tp; + int origorphcnt; + + p->p_gnext = pg->pg_plist; + p->p_gprevp = &pg->pg_plist; + if (pg->pg_plist) + pg->pg_plist->p_gprevp = &p->p_gnext; + pg->pg_plist = p; + + origorphcnt = !!pg->pg_orphcnt; + if (p->p_parent->p_pgrp != pg +diff --git a/proc/proc.h b/proc/proc.h +index 7943e0b..b52ca1d 100644 +--- a/proc/proc.h ++++ b/proc/proc.h +@@ -192,24 +192,24 @@ void exc_clean (void *); + + struct proc *add_tasks (task_t); + int pidfree (pid_t); + + struct proc *create_startup_proc (void); + struct proc *allocate_proc (task_t); + void proc_death_notify (struct proc *); + void complete_proc (struct proc *, pid_t); + + void leave_pgrp (struct proc *); + void join_pgrp (struct proc *); + void boot_setsid (struct proc *); + + void process_has_exited (struct proc *); + void alert_parent (struct proc *); + void reparent_zombies (struct proc *); + void complete_exit (struct proc *); + + void initialize_version_info (void); + +-void send_signal (mach_port_t, int, mach_port_t); ++void send_signal (mach_port_t, int, int, mach_port_t); + + + #endif +diff --git a/proc/stubs.c b/proc/stubs.c +index de3a9b1..ee8e578 100644 +--- a/proc/stubs.c ++++ b/proc/stubs.c +@@ -59,40 +59,41 @@ blocking_message_send (any_t arg) + case MACH_SEND_INTERRUPTED: + case MACH_SEND_INVALID_NOTIFY: + case MACH_SEND_NO_NOTIFY: + case MACH_SEND_NOTIFY_IN_PROGRESS: + assert_perror (err); + break; + + default: /* Other errors are safe to ignore. */ + break; + } + + + return 0; + } + + /* Send signal SIGNO to MSGPORT with REFPORT as reference. Don't + block in any fashion. */ + void + send_signal (mach_port_t msgport, + int signal, ++ int sigcode, + mach_port_t refport) + { + error_t err; + + /* This message buffer might be modified by mach_msg in some error cases, + so we cannot safely use a shared static buffer. */ + struct msg_sig_post_request message = + { + { + /* Message header: */ + (MACH_MSGH_BITS_COMPLEX + | MACH_MSGH_BITS (MACH_MSG_TYPE_COPY_SEND, + MACH_MSG_TYPE_MAKE_SEND_ONCE)), /* msgh_bits */ + sizeof message, /* msgh_size */ + msgport, /* msgh_remote_port */ + MACH_PORT_NULL, /* msgh_local_port */ + 0, /* msgh_seqno */ + RPCID_SIG_POST, /* msgh_id */ + }, + { +@@ -101,41 +102,41 @@ send_signal (mach_port_t msgport, + 32, /* msgt_size */ + 1, /* msgt_number */ + 1, /* msgt_inline */ + 0, /* msgt_longform */ + 0, /* msgt_deallocate */ + 0, /* msgt_unused */ + }, + /* Signal number */ + signal, + /* Type descriptor for sigcode */ + { + MACH_MSG_TYPE_INTEGER_32, /* msgt_name */ + 32, /* msgt_size */ + 1, /* msgt_number */ + 1, /* msgt_inline */ + 0, /* msgt_longform */ + 0, /* msgt_deallocate */ + 0, /* msgt_unused */ + }, + /* Sigcode */ +- 0, ++ sigcode, + { + /* Type descriptor for refport */ + MACH_MSG_TYPE_COPY_SEND, /* msgt_name */ + 32, /* msgt_size */ + 1, /* msgt_number */ + 1, /* msgt_inline */ + 0, /* msgt_longform */ + 0, /* msgt_deallocate */ + 0, /* msgt_unused */ + }, + refport + }; + + err = mach_msg ((mach_msg_header_t *)&message, + MACH_SEND_MSG|MACH_SEND_TIMEOUT, sizeof message, 0, + MACH_PORT_NULL, 0, MACH_PORT_NULL); + switch (err) + { + case MACH_SEND_TIMED_OUT: + /* The send could not complete immediately, and we do not want to +diff --git a/proc/wait.c b/proc/wait.c +index 6fc94e8..332aaf6 100644 +--- a/proc/wait.c ++++ b/proc/wait.c +@@ -127,41 +127,41 @@ sample_rusage (struct proc *p) + /* Return nonzero if a `waitpid' on WAIT_PID by a process + in MYPGRP cares about the death of PID/PGRP. */ + static inline int + waiter_cares (pid_t wait_pid, pid_t mypgrp, + pid_t pid, pid_t pgrp) + { + return (wait_pid == pid || + wait_pid == -pgrp || + wait_pid == WAIT_ANY || + (wait_pid == WAIT_MYPGRP && pgrp == mypgrp)); + } + + /* A process is dying. Send SIGCHLD to the parent. + Wake the parent if it is waiting for us to exit. */ + void + alert_parent (struct proc *p) + { + /* We accumulate the aggregate usage stats of all our dead children. */ + rusage_add (&p->p_parent->p_child_rusage, &p->p_rusage); + +- send_signal (p->p_parent->p_msgport, SIGCHLD, p->p_parent->p_task); ++ send_signal (p->p_parent->p_msgport, SIGCHLD, CLD_EXITED, p->p_parent->p_task); + + if (!p->p_exiting) + { + p->p_status = W_EXITCODE (0, SIGKILL); + p->p_sigcode = -1; + } + + if (p->p_parent->p_waiting) + { + pthread_cond_broadcast (&p->p_parent->p_wakeup); + p->p_parent->p_waiting = 0; + } + } + + kern_return_t + S_proc_wait (struct proc *p, + mach_port_t reply_port, + mach_msg_type_name_t reply_port_type, + pid_t pid, + int options, +@@ -240,41 +240,41 @@ S_proc_wait (struct proc *p, + kern_return_t + S_proc_mark_stop (struct proc *p, + int signo, + int sigcode) + { + if (!p) + return EOPNOTSUPP; + + p->p_stopped = 1; + p->p_status = W_STOPCODE (signo); + p->p_sigcode = sigcode; + p->p_waited = 0; + + if (p->p_parent->p_waiting) + { + pthread_cond_broadcast (&p->p_parent->p_wakeup); + p->p_parent->p_waiting = 0; + } + + if (!p->p_parent->p_nostopcld) +- send_signal (p->p_parent->p_msgport, SIGCHLD, p->p_parent->p_task); ++ send_signal (p->p_parent->p_msgport, SIGCHLD, CLD_STOPPED, p->p_parent->p_task); + + return 0; + } + + /* Implement proc_mark_exit as described in <hurd/process.defs>. */ + kern_return_t + S_proc_mark_exit (struct proc *p, + int status, + int sigcode) + { + if (!p) + return EOPNOTSUPP; + + if (WIFSTOPPED (status)) + return EINVAL; + + sample_rusage (p); /* See comments above sample_rusage. */ + + if (p->p_exiting) + return EBUSY; diff --git a/debian/patches/procfs-default.patch b/debian/patches/procfs-default.patch new file mode 100644 index 00000000..023ab9d5 --- /dev/null +++ b/debian/patches/procfs-default.patch @@ -0,0 +1,48 @@ +Define a macro for the default value of each command line +parameter. This allows one to generate a minimal response to +fsys_get_options requests. + +* procfs/main.c: New macro definitions for default values. +--- + procfs/main.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +diff --git a/procfs/main.c b/procfs/main.c +index ba74e87..3e53307 100644 +--- a/procfs/main.c ++++ b/procfs/main.c +@@ -37,6 +37,13 @@ pid_t opt_fake_self; + #define NOEXEC_KEY -2 /* Likewise. */ + #define NOSUID_KEY -3 /* Likewise. */ + ++/* Default values */ ++#define OPT_CLK_TCK sysconf(_SC_CLK_TCK) ++#define OPT_STAT_MODE 0400 ++#define OPT_FAKE_SELF -1 ++#define OPT_KERNEL_PID 2 ++#define OPT_ANON_OWNER 0 ++ + static error_t + argp_parser (int key, char *arg, struct argp_state *state) + { +@@ -211,11 +218,11 @@ int main (int argc, char **argv) + mach_port_t bootstrap; + error_t err; + +- opt_clk_tck = sysconf(_SC_CLK_TCK); +- opt_stat_mode = 0400; +- opt_fake_self = -1; +- opt_kernel_pid = 2; +- opt_anon_owner = 0; ++ opt_clk_tck = OPT_CLK_TCK; ++ opt_stat_mode = OPT_STAT_MODE; ++ opt_fake_self = OPT_FAKE_SELF; ++ opt_kernel_pid = OPT_KERNEL_PID; ++ opt_anon_owner = OPT_ANON_OWNER; + err = argp_parse (&argp, argc, argv, 0, 0, 0); + if (err) + error (1, err, "Could not parse command line"); +-- +1.7.10.4 + + diff --git a/debian/patches/procfs-get-options.patch b/debian/patches/procfs-get-options.patch new file mode 100644 index 00000000..99104177 --- /dev/null +++ b/debian/patches/procfs-get-options.patch @@ -0,0 +1,73 @@ +Implement our own netfs_append_args function that provides the +appropriate command line flags if the current values differ from the +default values. + +* procfs/main.c (netfs_append_args): New function. +--- + procfs/main.c | 42 ++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 42 insertions(+) + +diff --git a/procfs/main.c b/procfs/main.c +index 3e53307..bcf9590 100644 +--- a/procfs/main.c ++++ b/procfs/main.c +@@ -22,6 +22,7 @@ + #include <unistd.h> + #include <error.h> + #include <argp.h> ++#include <argz.h> + #include <hurd/netfs.h> + #include <ps.h> + #include "procfs.h" +@@ -193,6 +194,47 @@ struct argp netfs_runtime_argp_ = { + /* Used by netfs_set_options to handle runtime option parsing. */ + struct argp *netfs_runtime_argp = &netfs_runtime_argp_; + ++/* Return an argz string describing the current options. Fill *ARGZ ++ with a pointer to newly malloced storage holding the list and *LEN ++ to the length of that storage. */ ++error_t ++netfs_append_args (char **argz, size_t *argz_len) ++{ ++ char buf[80]; ++ error_t err = 0; ++ ++#define FOPT(opt, default, fmt, args...) \ ++ do { \ ++ if (! err && opt != default) \ ++ { \ ++ snprintf (buf, sizeof buf, fmt, ## args); \ ++ err = argz_add (argz, argz_len, buf); \ ++ } \ ++ } while (0) ++ ++ FOPT (opt_clk_tck, OPT_CLK_TCK, ++ "--clk-tck=%d", opt_clk_tck); ++ ++ FOPT (opt_stat_mode, OPT_STAT_MODE, ++ "--stat-mode=%o", opt_stat_mode); ++ ++ FOPT (opt_fake_self, OPT_FAKE_SELF, ++ "--fake-self=%d", opt_fake_self); ++ ++ FOPT (opt_anon_owner, OPT_ANON_OWNER, ++ "--anonymous-owner=%d", opt_anon_owner); ++ ++ FOPT (opt_kernel_pid, OPT_KERNEL_PID, ++ "--kernel-process=%d", opt_kernel_pid); ++ ++#undef FOPT ++ ++ if (! err) ++ err = netfs_append_std_options (argz, argz_len); ++ ++ return err; ++} ++ + error_t + root_make_node (struct ps_context *pc, struct node **np) + { +-- +1.7.10.4 + + diff --git a/debian/patches/procfs-update.patch b/debian/patches/procfs-update.patch new file mode 100644 index 00000000..67b415ca --- /dev/null +++ b/debian/patches/procfs-update.patch @@ -0,0 +1,143 @@ +Split the argument handling into a common part and one for +fsys_update_options. Handle the --update parameter; for procfs this is +a no-op. + +* procfs/main.c (common_options): New variable. +(runtime_argp_parser): Handle --update. +(startup_argp): New variable. +(netfs_runtime_argp_): New variable. +--- + procfs/main.c | 93 ++++++++++++++++++++++++++++++++++++++++----------------- + 1 file changed, 65 insertions(+), 28 deletions(-) + +diff --git a/procfs/main.c b/procfs/main.c +index 1b19c01..ba74e87 100644 +--- a/procfs/main.c ++++ b/procfs/main.c +@@ -109,51 +109,88 @@ argp_parser (int key, char *arg, struct argp_state *state) + return 0; + } + ++struct argp_option common_options[] = { ++ { "clk-tck", 'h', "HZ", 0, ++ "Unit used for the values expressed in system clock ticks " ++ "(default: sysconf(_SC_CLK_TCK))" }, ++ { "stat-mode", 's', "MODE", 0, ++ "The [pid]/stat file publishes information which on Hurd is only " ++ "available to the process owner. " ++ "You can use this option to override its mode to be more permissive " ++ "for compatibility purposes. " ++ "(default: 0400)" }, ++ { "fake-self", 'S', "PID", OPTION_ARG_OPTIONAL, ++ "Provide a fake \"self\" symlink to the given PID, for compatibility " ++ "purposes. If PID is omitted, \"self\" will point to init. " ++ "(default: no self link)" }, ++ { "kernel-process", 'k', "PID", 0, ++ "Process identifier for the kernel, used to retreive its command " ++ "line, as well as the global up and idle times. " ++ "(default: 2)" }, ++ { "compatible", 'c', NULL, 0, ++ "Try to be compatible with the Linux procps utilities. " ++ "Currently equivalent to -h 100 -s 0444 -S 1." }, ++ { "anonymous-owner", 'a', "USER", 0, ++ "Make USER the owner of files related to processes without one. " ++ "Be aware that USER will be granted access to the environment and " ++ "other sensitive information about the processes in question. " ++ "(default: use uid 0)" }, ++ { "nodev", NODEV_KEY, NULL, 0, ++ "Ignored for compatibility with Linux' procfs." }, ++ { "noexec", NOEXEC_KEY, NULL, 0, ++ "Ignored for compatibility with Linux' procfs." }, ++ { "nosuid", NOSUID_KEY, NULL, 0, ++ "Ignored for compatibility with Linux' procfs." }, ++ {} ++}; ++ + struct argp argp = { +- .options = (struct argp_option []) { +- { "clk-tck", 'h', "HZ", 0, +- "Unit used for the values expressed in system clock ticks " +- "(default: sysconf(_SC_CLK_TCK))" }, +- { "stat-mode", 's', "MODE", 0, +- "The [pid]/stat file publishes information which on Hurd is only " +- "available to the process owner. " +- "You can use this option to override its mode to be more permissive " +- "for compatibility purposes. " +- "(default: 0400)" }, +- { "fake-self", 'S', "PID", OPTION_ARG_OPTIONAL, +- "Provide a fake \"self\" symlink to the given PID, for compatibility " +- "purposes. If PID is omitted, \"self\" will point to init. " +- "(default: no self link)" }, +- { "kernel-process", 'k', "PID", 0, +- "Process identifier for the kernel, used to retreive its command " +- "line, as well as the global up and idle times. " +- "(default: 2)" }, +- { "compatible", 'c', NULL, 0, +- "Try to be compatible with the Linux procps utilities. " +- "Currently equivalent to -h 100 -s 0444 -S 1." }, +- { "anonymous-owner", 'a', "USER", 0, +- "Make USER the owner of files related to processes without one. " +- "Be aware that USER will be granted access to the environment and " +- "other sensitive information about the processes in question. " +- "(default: use uid 0)" }, +- { "nodev", NODEV_KEY, NULL, 0, +- "Ignored for compatibility with Linux' procfs." }, +- { "noexec", NOEXEC_KEY, NULL, 0, +- "Ignored for compatibility with Linux' procfs." }, +- { "nosuid", NOSUID_KEY, NULL, 0, +- "Ignored for compatibility with Linux' procfs." }, ++ .options = common_options, ++ .parser = argp_parser, ++ .doc = "A virtual filesystem emulating the Linux procfs.", ++ .children = (struct argp_child []) { ++ { &netfs_std_startup_argp, }, + {} + }, ++}; ++ ++static error_t ++runtime_argp_parser (int key, char *arg, struct argp_state *state) ++{ ++ switch (key) ++ { ++ case 'u': ++ /* do nothing */ ++ break; ++ ++ default: ++ return ARGP_ERR_UNKNOWN; ++ } ++ ++ return 0; ++} ++ ++struct argp runtime_argp = { ++ .options = (struct argp_option []) { ++ { "update", 'u', NULL, 0, "remount; for procfs this does nothing" }, ++ {}, ++ }, ++ .parser = runtime_argp_parser, ++}; ++ ++struct argp netfs_runtime_argp_ = { ++ .options = common_options, + .parser = argp_parser, + .doc = "A virtual filesystem emulating the Linux procfs.", + .children = (struct argp_child []) { +- { &netfs_std_startup_argp, }, ++ { &runtime_argp, }, ++ { &netfs_std_runtime_argp, }, + {} + }, + }; + + /* Used by netfs_set_options to handle runtime option parsing. */ +-struct argp *netfs_runtime_argp = &argp; ++struct argp *netfs_runtime_argp = &netfs_runtime_argp_; + + error_t + root_make_node (struct ps_context *pc, struct node **np) +-- +1.7.10.4 + + diff --git a/debian/patches/proxy-defpager.diff b/debian/patches/proxy-defpager.diff new file mode 100644 index 00000000..db9604ad --- /dev/null +++ b/debian/patches/proxy-defpager.diff @@ -0,0 +1,62 @@ +https://savannah.gnu.org/bugs/?26751 + +2009-06-07 Zheng Da <zhengda1936@gmail.com> + + * Makefile: Use customized default_pager.defs. + + * proxy-defpager.c: Include customized default_pager header. + +--- + Makefile | 7 +++++-- + proxy-defpager.c | 5 +++-- + 2 files changed, 8 insertions(+), 4 deletions(-) + +Index: hurd-debian/trans/Makefile +=================================================================== +--- hurd-debian.orig/trans/Makefile 2012-11-26 00:23:22.000000000 +0000 ++++ hurd-debian/trans/Makefile 2012-11-26 00:25:32.000000000 +0000 +@@ -26,7 +26,7 @@ + fakeroot.c proxy-defpager.c remap.c + OBJS = $(SRCS:.c=.o) fsysServer.o ifsockServer.o passwordServer.o \ + crashServer.o crash_replyUser.o msgServer.o \ +- default_pagerServer.o default_pagerUser.o \ ++ ourdefault_pagerServer.o ourdefault_pagerUser.o \ + device_replyServer.o elfcore.o + HURDLIBS = ports netfs trivfs iohelp fshelp pipe ihash shouldbeinlibc + LDLIBS += -lpthread +@@ -34,6 +34,9 @@ + + include ../Makeconf + ++ourdefault_pager.defs: default_pager.defs ++ $(CPP) $(CPPFLAGS) -x c $< | sed -e '/MACH_MSG_TYPE_MAKE_SEND;/s/MAKE/COPY/' | sed -e '/subsystem/iserverprefix S_;' > $@ ++ + vpath elfcore.c $(top_srcdir)/exec + + symlink: fsysServer.o +@@ -41,7 +44,7 @@ + crash: crashServer.o crash_replyUser.o msgServer.o elfcore.o + password: passwordServer.o + streamio: device_replyServer.o +-proxy-defpager: default_pagerServer.o default_pagerUser.o ++proxy-defpager: ourdefault_pagerServer.o ourdefault_pagerUser.o + + proxy-defpager crash password streamio: ../libports/libports.a ../libtrivfs/libtrivfs.a ../libfshelp/libfshelp.a + fifo new-fifo: ../libpipe/libpipe.a +Index: hurd-debian/trans/proxy-defpager.c +=================================================================== +--- hurd-debian.orig/trans/proxy-defpager.c 2012-11-26 00:23:22.000000000 +0000 ++++ hurd-debian/trans/proxy-defpager.c 2012-11-26 00:25:32.000000000 +0000 +@@ -23,9 +23,10 @@ + #include <error.h> + #include <version.h> + #include <hurd/paths.h> ++#include <string.h> + +-#include "default_pager_S.h" +-#include "default_pager_U.h" ++#include "ourdefault_pager_S.h" ++#include "ourdefault_pager_U.h" + + static mach_port_t real_defpager, dev_master; + diff --git a/debian/patches/random-default-fast.patch b/debian/patches/random-default-fast.patch new file mode 100644 index 00000000..555b3045 --- /dev/null +++ b/debian/patches/random-default-fast.patch @@ -0,0 +1,13 @@ +diff --git a/random/random.c b/random/random.c +index 0ae31f5..c732356 100644 +--- a/random/random.c ++++ b/random/random.c +@@ -50,7 +50,7 @@ struct condition select_alert; /* For read and select. */ + numbers. + 2: Strong random numbers with a somewhat guaranteed entropy. + */ +-#define DEFAULT_LEVEL 2 ++#define DEFAULT_LEVEL 1 + static int level = DEFAULT_LEVEL; + + /* Name of file to use as seed. */ diff --git a/debian/patches/rc.patch b/debian/patches/rc.patch new file mode 100644 index 00000000..228bb349 --- /dev/null +++ b/debian/patches/rc.patch @@ -0,0 +1,78 @@ +More debianish rc scripts +--- + daemons/rc.sh | 43 ++++++++++++++++++++++++++++++++----------- + 1 file changed, 32 insertions(+), 11 deletions(-) + +--- a/daemons/rc.sh ++++ b/daemons/rc.sh +@@ -19,14 +19,17 @@ then + echo Automatic boot in progress... + date + +- /sbin/fsck --preen --writable ++ fsysopts / --update --readonly ++ /sbin/fsck -p -A + + case $? in + # Successful completion + 0) ++ fsysopts / --update --writable + ;; + # Filesystem modified (but ok now) + 1 | 2) ++ fsysopts / --update --writable + ;; + # Fsck couldn't fix it. + 4 | 8) +@@ -85,7 +88,15 @@ if test -d /tmp; then + + fi + if test -d /var/run; then +- (cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; }) ++ (cd /var/run && { ++ find . ! -type d ! -name utmp ! -name innd.pid \ ++ -exec rm -f -- {} \; ++ cp /dev/null utmp ++ if grep -q ^utmp: /etc/group ++ then ++ chmod 664 utmp ++ chgrp utmp utmp ++ fi; }) + fi + echo done + +@@ -104,15 +115,25 @@ touch /var/run/mtab + + chmod 664 /etc/motd + +-echo -n starting daemons: ++( ++ trap ":" INT QUIT TSTP + +-/sbin/syslogd && echo -n ' syslogd' +-/sbin/inetd && echo -n ' inetd' +- +-if test -x /sbin/sendmail -a -r /etc/sendmail.cf; then +- /sbin/sendmail -bd -q30m && echo -n ' sendmail' +-fi +- +-echo . ++ if [ -d /etc/rc.boot ] ++ then ++ for i in /etc/rc.boot/S* ++ do ++ [ ! -f $i ] && continue ++ $i start ++ done ++ fi ++ if [ -d /etc/rc2.d ] ++ then ++ for i in /etc/rc2.d/S* ++ do ++ [ ! -f $i ] && continue ++ $i start ++ done ++ fi ++) + + date diff --git a/debian/patches/run.patch b/debian/patches/run.patch new file mode 100644 index 00000000..50f584fb --- /dev/null +++ b/debian/patches/run.patch @@ -0,0 +1,18 @@ +Index: hurd/daemons/rc.sh +=================================================================== +--- hurd.orig/daemons/rc.sh 2011-12-06 02:51:32.000000000 +0100 ++++ hurd/daemons/rc.sh 2011-12-06 02:52:16.000000000 +0100 +@@ -98,6 +98,13 @@ + chgrp utmp utmp + fi; }) + fi ++ ++# until we properly start /etc/rcS.d ++rm -fr /run/* ++mkdir -p /run/lock /run/shm ++chmod 1777 /run/lock /run/shm ++: > /run/utmp ++ + echo done + + # This file must exist for e2fsck to work. XXX diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 00000000..2e80be7b --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,58 @@ +diskfs_no_inherit_dir_group.patch +ext2fs_large_stores.patch +ext2fs_large_stores_pthread.patch +hurd_console_startup.patch +init_try_runsystem.gnu.patch +makedev.diff +pfinet_dhcp.patch +rc.patch +startup-usr-support.patch +tmp_exec_startup.patch +uptime_w_path_fix.patch +stat_round.patch +libports_stability.patch +proxy-defpager.diff +external.patch +console_ignore_bdf_err.patch +posix-sigcodes.patch +random-default-fast.patch +libexec.patch +run.patch +libdde_netdev_tx_t.patch +libdde_pci-needs_freset.patch +libdde_addr_list.patch +libdde_ucast_list.patch +libdde_addr_fix.patch +libdde_group_addr.patch +libdde_rculist.patch +libdde_dma_head.patch +libdde_mdio.patch +libdde_ethoc.patch +libdde_phy.patch +libdde_pci_ids.h.patch +libdde_ethtool.patch +libdde_workqueue.patch +libdde_trans_start.patch +libdde_devres.patch +libdde_pr_cont.patch +libdde_rx_queue.patch +libdde_rcu.patch +libmachdev.patch +exec_filename_exec.patch +exec_filename_fs.patch +exec_filename_use.patch + +# Justus Winter's work, to be pushed +mount-n.patch +mount-f.patch +mount-remount.patch +mount-loop.patch +procfs-update.patch +procfs-default.patch +procfs-get-options.patch +sutils-types.patch +mount-test-opts.patch +mount-ignore-mounted-all.patch +mount-t-auto.patch +sutils-multiple-none.patch +umount.patch diff --git a/debian/patches/startup-usr-support.patch b/debian/patches/startup-usr-support.patch new file mode 100644 index 00000000..1d705fc9 --- /dev/null +++ b/debian/patches/startup-usr-support.patch @@ -0,0 +1,27 @@ +Debian GNU/Hurd has a real /usr +--- + daemons/rc.sh | 2 +- + daemons/runsystem.sh | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/daemons/rc.sh ++++ b/daemons/rc.sh +@@ -1,6 +1,6 @@ + #!/bin/bash + +-PATH=/bin:/sbin ++PATH=/bin:/sbin:/usr/bin:/usr/sbin + + # Start the default pager. It will bail if there is already one running. + /hurd/mach-defpager +--- a/daemons/runsystem.sh ++++ b/daemons/runsystem.sh +@@ -11,7 +11,7 @@ + ### Where to find programs, etc. + ### + +-PATH=/bin:/sbin ++PATH=/bin:/sbin:/usr/bin:/usr/sbin + export PATH + + umask 022 diff --git a/debian/patches/stat_round.patch b/debian/patches/stat_round.patch new file mode 100644 index 00000000..9c821865 --- /dev/null +++ b/debian/patches/stat_round.patch @@ -0,0 +1,57 @@ +This is not a proper fix, discussed on +http://lists.gnu.org/archive/html/bug-hurd/2009-02/msg00002.html +but not finished, last mail on +http://lists.gnu.org/archive/html/bug-hurd/2009-04/msg00006.html + +--- + libdiskfs/file-utimes.c | 4 ++-- + libdiskfs/node-times.c | 6 +++--- + 2 files changed, 5 insertions(+), 5 deletions(-) + +--- a/libdiskfs/file-utimes.c ++++ b/libdiskfs/file-utimes.c +@@ -33,7 +33,7 @@ diskfs_S_file_utimes (struct protid *cre + else + { + np->dn_stat.st_atim.tv_sec = atime.seconds; +- np->dn_stat.st_atim.tv_nsec = atime.microseconds * 1000; ++ np->dn_stat.st_atim.tv_nsec = 0; + np->dn_set_atime = 0; + } + +@@ -42,7 +42,7 @@ diskfs_S_file_utimes (struct protid *cre + else + { + np->dn_stat.st_mtim.tv_sec = mtime.seconds; +- np->dn_stat.st_mtim.tv_nsec = mtime.microseconds * 1000; ++ np->dn_stat.st_mtim.tv_nsec = 0; + np->dn_set_mtime = 0; + } + +--- a/libdiskfs/node-times.c ++++ b/libdiskfs/node-times.c +@@ -53,21 +53,21 @@ diskfs_set_node_times (struct node *np) + if (np->dn_set_mtime) + { + np->dn_stat.st_mtim.tv_sec = t.tv_sec; +- np->dn_stat.st_mtim.tv_nsec = t.tv_usec * 1000; ++ np->dn_stat.st_mtim.tv_nsec = 0; + np->dn_stat_dirty = 1; + np->dn_set_mtime = 0; + } + if (np->dn_set_atime) + { + np->dn_stat.st_atim.tv_sec = t.tv_sec; +- np->dn_stat.st_atim.tv_nsec = t.tv_usec * 1000; ++ np->dn_stat.st_atim.tv_nsec = 0; + np->dn_stat_dirty = 1; + np->dn_set_atime = 0; + } + if (np->dn_set_ctime) + { + np->dn_stat.st_ctim.tv_sec = t.tv_sec; +- np->dn_stat.st_ctim.tv_nsec = t.tv_usec * 1000; ++ np->dn_stat.st_ctim.tv_nsec = 0; + np->dn_stat_dirty = 1; + np->dn_set_ctime = 0; + } diff --git a/debian/patches/sutils-multiple-none.patch b/debian/patches/sutils-multiple-none.patch new file mode 100644 index 00000000..c787b5a7 --- /dev/null +++ b/debian/patches/sutils-multiple-none.patch @@ -0,0 +1,40 @@ +Previously it was not possible to add two mount entries with the same +device information to an fstab structure. This is easily fixed by +breaking the assumption, that there is only one possible mount entry +for the "none" device as used by many purely virtual file systems. + +* utils/fstab.c (fstab_find_device): Return NULL if name is "none". +--- + sutils/fstab.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/sutils/fstab.c b/sutils/fstab.c +index e241de6..d3b8b6f 100644 +--- a/sutils/fstab.c ++++ b/sutils/fstab.c +@@ -457,11 +457,19 @@ fs_remount (struct fs *fs) + return err; + } + +-/* Returns the FS entry in FSTAB with the device field NAME (there can only +- be one such entry). */ ++/* Returns the FS entry in FSTAB with the device field NAME. ++ ++ In general there can only be one such entry. This holds not true ++ for virtual file systems that use "none" as device name. ++ ++ If name is "none", NULL is returned. This also makes it possible to ++ add more than one entry for the device "none". */ + inline struct fs * + fstab_find_device (const struct fstab *fstab, const char *name) + { ++ if (strcmp (name, "none") == 0) ++ return NULL; ++ + struct fs *fs; + for (fs = fstab->entries; fs; fs = fs->next) + if (strcmp (fs->mntent.mnt_fsname, name) == 0) +-- +1.7.10.4 + + diff --git a/debian/patches/sutils-types.patch b/debian/patches/sutils-types.patch new file mode 100644 index 00000000..d2a21e94 --- /dev/null +++ b/debian/patches/sutils-types.patch @@ -0,0 +1,150 @@ +The mount utility on both Linux and FreeBSD allows one to either +specify a whitelist or a blacklist of filesystem types to consider for +--all. Prefixing the list with "no" indicates that the list is a +blacklist. Furthermore, Linux' mount utility ignores a "no" prefix on +any entry in the given list. + +Previously the Hurd variant first applied whitelist containing all +positive values given and then filtered the resulting list using all +negative values. But this makes little sense because each entry only +has one value for the filesystem type (mnt_type) and all values are +mutually exclusive. + +This patch adjusts the fstab handling code so that our mount utility +behaves like the Linux mount utility. This code is used by both mount +and fsck. The same argumentation applies to fsck as well. + +Like implemented in Linux mount, any "no" prefix is ignored to retain +compatibility with the old behavior. + +* sutils/fstab.c (fstab_argp_create): Fix semantic of --types. +--- + sutils/fstab.c | 103 +++++++++++++++----------------------------------------- + 1 file changed, 27 insertions(+), 76 deletions(-) + +diff --git a/sutils/fstab.c b/sutils/fstab.c +index b66e519..e241de6 100644 +--- a/sutils/fstab.c ++++ b/sutils/fstab.c +@@ -880,90 +880,41 @@ fstab_argp_create (struct fstab_argp_params *params, + check = fstab; + else + { +- struct fs *fs; +- const char *tn; +- unsigned int nonexclude_types; +- + err = fstab_create (types, &check); + if (err) + error (105, err, "fstab_create"); + +- /* For each excluded type (i.e. `-t notype'), clobber the +- fstype entry's program with an empty string to mark it. */ +- nonexclude_types = 0; +- for (tn = params->types; tn; +- tn = argz_next (params->types, params->types_len, tn)) +- { +- if (!strncasecmp (tn, "no", 2)) +- { +- struct fstype *type; +- err = fstypes_get (types, &tn[2], &type); +- if (err) +- error (106, err, "fstypes_get"); +- free (type->program); +- type->program = strdup (""); +- } +- else +- ++nonexclude_types; +- } +- +- if (nonexclude_types != 0) +- { +- const char *tn; +- struct fstypes *wanttypes; +- +- /* We will copy the types we want to include into a fresh +- list in WANTTYPES. Since we specify no search formats, +- `fstypes_get' applied to WANTTYPES can only create +- elements with a null `program' field. */ +- err = fstypes_create (0, 0, &wanttypes); +- if (err) +- error (102, err, "fstypes_create"); +- +- for (tn = params->types; tn; +- tn = argz_next (params->types, params->types_len, tn)) +- if (strncasecmp (tn, "no", 2)) +- { +- struct fstype *type; +- err = fstypes_get (types, tn, &type); +- if (err) +- error (106, err, "fstypes_get"); +- if (type->program == 0) +- error (0, 0, +- "requested filesystem type `%s' unknown", tn); +- else +- { +- struct fstype *newtype = malloc (sizeof *newtype); +- newtype->name = strdup (type->name); +- newtype->program = strdup (type->program); +- newtype->next = wanttypes->entries; +- wanttypes->entries = newtype; +- } +- } +- +- /* fstypes_free (types); */ +- types = wanttypes; +- } ++ int blacklist = strncasecmp (params->types, "no", 2) == 0; ++ if (blacklist) ++ params->types += 2; /* Skip no. */ + ++ struct fs *fs; + for (fs = fstab->entries; fs; fs = fs->next) + { +- const char *ptn; +- struct fstype *type; +- +- err = fs_type (fs, &type); +- if (err || nonexclude_types) +- { +- err = fstypes_get (types, fs->mntent.mnt_type, &type); +- if (err) +- error (106, err, "fstypes_get"); +- if (params->types != 0) +- continue; +- } +- if (nonexclude_types && type->program == 0) +- continue; /* Freshly created, was not in WANTTYPES. */ +- if (type->program != 0 && type->program[0] == '\0') +- continue; /* This type is marked as excluded. */ ++ if (strcmp (fs->mntent.mnt_type, MNTTYPE_SWAP) == 0) ++ continue; /* Ignore swap entries. */ ++ ++ const char *tn; ++ int matched = 0; ++ for (tn = params->types; tn; ++ tn = argz_next (params->types, params->types_len, tn)) ++ { ++ const char *type = fs->mntent.mnt_type; ++ if (strcmp (type, tn) == 0 ++ /* Skip no for compatibility. */ ++ || ((strncasecmp (type, "no", 2) == 0) ++ && strcmp (type, tn) == 0)) ++ { ++ matched = 1; ++ break; ++ } ++ } ++ ++ if (matched == blacklist) ++ continue; /* Either matched and types is a blacklist ++ or not matched and types is a whitelist */ + ++ const char *ptn; + for (ptn = params->exclude; ptn; + ptn = argz_next (params->exclude, params->exclude_len, ptn)) + if (fnmatch (ptn, fs->mntent.mnt_dir, 0) == 0) +-- +1.7.10.4 + + diff --git a/debian/patches/tmp_exec_startup.patch b/debian/patches/tmp_exec_startup.patch new file mode 100644 index 00000000..bd605718 --- /dev/null +++ b/debian/patches/tmp_exec_startup.patch @@ -0,0 +1,54 @@ +Also try /tmp/exec as it's used for installation. + +TODO: not used by d-i. Is it used by crosshurd? +--- + libdiskfs/boot-start.c | 24 ++++++++++++++++++++---- + 1 file changed, 20 insertions(+), 4 deletions(-) + +--- a/libdiskfs/boot-start.c ++++ b/libdiskfs/boot-start.c +@@ -126,8 +126,13 @@ diskfs_start_bootstrap () + assert (_hurd_ports); + assert (_hurd_ports[INIT_PORT_CRDIR].port != MACH_PORT_NULL); + diskfs_exec = file_name_lookup (_SERVERS_EXEC, 0, 0); +- if (diskfs_exec == MACH_PORT_NULL) +- error (1, errno, "%s", _SERVERS_EXEC); ++ if (diskfs_exec == MACH_PORT_NULL) ++ { ++ /* Debian specifc work-around for install bootstrapping. */ ++ diskfs_exec = file_name_lookup ("/tmp/exec", 0, 0); ++ if (diskfs_exec == MACH_PORT_NULL) ++ error (1, errno, "%s", _SERVERS_EXEC); ++ } + else + { + #ifndef NDEBUG +@@ -177,8 +182,15 @@ diskfs_start_bootstrap () + &retry, pathbuf, &execnode); + if (err) + { +- error (0, err, "cannot set translator on %s", _SERVERS_EXEC); +- mach_port_deallocate (mach_task_self (), diskfs_exec_ctl); ++ /* If /servers/exec is not available (which is the case during ++ installation, try /tmp/exec as well. */ ++ err = dir_lookup (root_pt, "/tmp/exec", O_NOTRANS, 0, ++ &retry, pathbuf, &execnode); ++ if (err) ++ { ++ error (0, err, "cannot set translator on %s", _SERVERS_EXEC); ++ mach_port_deallocate (mach_task_self (), diskfs_exec_ctl); ++ } + } + else + { +@@ -393,6 +405,10 @@ diskfs_execboot_fsys_startup (mach_port_ + + err = dir_lookup (rootport, _SERVERS_EXEC, flags|O_NOTRANS, 0, + &retry, pathbuf, real); ++ if (err) ++ /* Try /tmp/exec as well, in case we're installing. */ ++ err = dir_lookup (rootport, "/tmp/exec", flags|O_NOTRANS|O_CREAT, 0, ++ &retry, pathbuf, real); + assert_perror (err); + assert (retry == FS_RETRY_NORMAL); + assert (pathbuf[0] == '\0'); diff --git a/debian/patches/umount.patch b/debian/patches/umount.patch new file mode 100644 index 00000000..b2f1cafa --- /dev/null +++ b/debian/patches/umount.patch @@ -0,0 +1,382 @@ +This adds a umount utility that implements most of the functions that +the Linux umount utility provides, especially that subset that is used +by the Debian package initscripts. + +* utils/umount.c: New file. +--- + utils/Makefile | 10 +- + utils/umount.c | 319 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 325 insertions(+), 4 deletions(-) + create mode 100644 utils/umount.c + +diff --git a/utils/Makefile b/utils/Makefile +index 207c904..4fe2dc2 100644 +--- a/utils/Makefile ++++ b/utils/Makefile +@@ -21,7 +21,9 @@ makemode := utilities + targets = shd ps settrans showtrans syncfs fsysopts \ + storeinfo login w uptime ids loginpr sush vmstat portinfo \ + devprobe vminfo addauth rmauth unsu setauth ftpcp ftpdir storecat \ +- storeread msgport rpctrace mount gcore fakeauth fakeroot remap ++ storeread msgport rpctrace mount gcore fakeauth fakeroot remap \ ++ umount ++ + special-targets = loginpr sush uptime fakeroot remap + SRCS = shd.c ps.c settrans.c syncfs.c showtrans.c addauth.c rmauth.c \ + fsysopts.c storeinfo.c login.c loginpr.sh sush.sh w.c \ +@@ -29,7 +31,7 @@ SRCS = shd.c ps.c settrans.c syncfs.c showtrans.c addauth.c rmauth.c \ + parse.c frobauth.c frobauth-mod.c setauth.c pids.c nonsugid.c \ + unsu.c ftpcp.c ftpdir.c storeread.c storecat.c msgport.c \ + rpctrace.c mount.c gcore.c fakeauth.c fakeroot.sh remap.sh \ +- match-options.c ++ match-options.c umount.c + + OBJS = $(filter-out %.sh,$(SRCS:.c=.o)) + HURDLIBS = ps ihash store fshelp ports ftpconn shouldbeinlibc +@@ -58,7 +60,7 @@ ftpcp ftpdir: ../libftpconn/libftpconn.a + settrans: ../libfshelp/libfshelp.a ../libports/libports.a + ps w ids settrans syncfs showtrans fsysopts storeinfo login vmstat portinfo \ + devprobe vminfo addauth rmauth setauth unsu ftpcp ftpdir storeread \ +- storecat msgport mount: \ ++ storecat msgport mount umount: \ + ../libshouldbeinlibc/libshouldbeinlibc.a + + $(filter-out $(special-targets), $(targets)): %: %.o +@@ -74,7 +76,7 @@ fakeauth-CPPFLAGS = -I$(srcdir)/../auth + authServer-CPPFLAGS = -I$(srcdir)/../auth + auth_requestUser-CPPFLAGS = -I$(srcdir)/../auth + +-mount: ../sutils/fstab.o ../sutils/clookup.o match-options.o \ ++mount umount: ../sutils/fstab.o ../sutils/clookup.o match-options.o \ + $(foreach L,fshelp ports,../lib$L/lib$L.a) + ../sutils/fstab.o ../sutils/clookup.o: FORCE + $(MAKE) -C $(@D) $(@F) +diff --git a/utils/umount.c b/utils/umount.c +new file mode 100644 +index 0000000..64e6ee2 +--- /dev/null ++++ b/utils/umount.c +@@ -0,0 +1,319 @@ ++/* Roughly Unix/Linux-compatible `umount' frontend for Hurd translators. ++ ++ Copyright (C) 2013 Free Software Foundation, Inc. ++ Written by Justus Winter <4winter@informatik.uni-hamburg.de> ++ ++ This file is part of the GNU Hurd. ++ ++ The GNU Hurd 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. ++ ++ The GNU Hurd is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ ++ ++#include "../sutils/fstab.h" ++#include <argp.h> ++#include <argz.h> ++#include <blkid/blkid.h> ++#include <error.h> ++#include <fcntl.h> ++#include <hurd/fshelp.h> ++#include <hurd/fsys.h> ++#include <hurd/paths.h> ++#include <hurd/process.h> ++#include <stdlib.h> ++#include <unistd.h> ++ ++#include "match-options.h" ++ ++/* XXX fix libc */ ++#undef _PATH_MOUNTED ++#define _PATH_MOUNTED "/etc/mtab" ++ ++static char *targets; ++static size_t targets_len; ++static int readonly; ++static int verbose; ++static int passive_flags = FS_TRANS_SET; ++static int active_flags = FS_TRANS_SET; ++static int goaway_flags; ++static int fake; ++ ++static struct fstab_argp_params fstab_params; ++ ++#define FAKE_KEY 0x80 /* !isascii (FAKE_KEY), so no short option. */ ++ ++static const struct argp_option argp_opts[] = ++{ ++ {"fake", FAKE_KEY, 0, 0, "Do not actually umount, just pretend"}, ++ {"force", 'f', 0, 0, "Force umount by killing the translator"}, ++ {"no-mtab", 'n', 0, 0, "Do not update /etc/mtab"}, ++ {"read-only", 'r', 0, 0, "If unmounting fails, try to remount read-only"}, ++ {"nosync", 'S', 0, 0, "Don't sync a translator before killing it"}, ++ {"test-opts", 'O', "OPTIONS", 0, ++ "Only mount fstab entries matching the given set of options"}, ++ {"verbose", 'v', 0, 0, "Give more detailed information"}, ++ {}, ++}; ++ ++static error_t ++parse_opt (int key, char *arg, struct argp_state *state) ++{ ++ struct fstab_argp_params *params = state->input; ++ error_t err; ++ switch (key) ++ { ++ case ARGP_KEY_INIT: ++ state->child_inputs[0] = params; /* pass down to fstab_argp parser */ ++ break; ++ ++ case FAKE_KEY: ++ fake = 1; ++ break; ++ ++ case 'f': ++ goaway_flags |= FSYS_GOAWAY_FORCE; ++ break; ++ ++ case 'n': ++ /* do nothing */ ++ break; ++ ++ case 'r': ++ readonly = 1; ++ break; ++ ++ case 'S': ++ goaway_flags |= FSYS_GOAWAY_NOSYNC; ++ break; ++ ++ case 'O': ++ err = argz_create_sep (arg, ',', &test_opts, &test_opts_len); ++ if (err) ++ argp_failure (state, 100, ENOMEM, "%s", arg); ++ break; ++ ++ case 'v': ++ verbose += 1; ++ break; ++ ++ case ARGP_KEY_ARG: ++ err = argz_add (&targets, &targets_len, arg); ++ if (err) ++ argp_failure (state, 100, ENOMEM, "%s", arg); ++ break; ++ ++ case ARGP_KEY_NO_ARGS: ++ if (! params->do_all) ++ { ++ argp_error (state, ++ "filesystem argument required if --all is not given"); ++ return EINVAL; ++ } ++ break; ++ ++ case ARGP_KEY_END: ++ if (params->do_all && targets) ++ { ++ argp_error (state, "filesystem argument not allowed with --all"); ++ return EINVAL; ++ } ++ break; ++ ++ default: ++ return ARGP_ERR_UNKNOWN; ++ } ++ ++ return 0; ++} ++ ++static const char doc[] = "Stop active and remove passive translators"; ++static const char args_doc[] = "DEVICE|DIRECTORY [DEVICE|DIRECTORY ...]"; ++ ++static struct argp fstab_argp_mtab; /* Slightly modified version. */ ++ ++static const struct argp_child argp_kids[] = ++{ ++ {&fstab_argp_mtab, 0, ++ "Filesystem selection (if no explicit filesystem arguments given):", 2}, ++ {}, ++}; ++static struct argp argp = ++{ ++ options: argp_opts, ++ parser: parse_opt, ++ args_doc: args_doc, ++ doc: doc, ++ children: argp_kids, ++}; ++ ++/* This is a trimmed and slightly modified version of ++ fstab_argp.options which uses _PATH_MOUNTED instead of _PATH_MNTTAB ++ in the doc strings. */ ++static const struct argp_option fstab_argp_mtab_opts[] = ++{ ++ {"all", 'a', 0, 0, "Do all filesystems in " _PATH_MOUNTED}, ++ {0, 'A', 0, OPTION_ALIAS }, ++ {"fstab", 'F', "FILE", 0, "File to use instead of " _PATH_MOUNTED}, ++ {"fstype", 't', "TYPE", 0, "Do only filesystems of given type(s)"}, ++ {"exclude-root",'R',0, 0, ++ "Exclude root (/) filesystem from " _PATH_MOUNTED " list"}, ++ {"exclude", 'X', "PATTERN", 0, "Exclude directories matching PATTERN"}, ++ {} ++}; ++ ++static error_t ++fstab_argp_mtab_parse_opt (int key, char *arg, struct argp_state *state) ++{ ++ return fstab_argp.parser (key, arg, state); ++} ++ ++static struct argp fstab_argp_mtab = ++{ ++ options: fstab_argp_mtab_opts, ++ parser: fstab_argp_mtab_parse_opt, ++}; ++ ++/* Unmount one filesystem. */ ++static error_t ++do_umount (struct fs *fs) ++{ ++ error_t err = 0; ++ ++ file_t node = file_name_lookup(fs->mntent.mnt_dir, O_NOTRANS, 0666); ++ if (node == MACH_PORT_NULL) ++ { ++ error(0, errno, "%s", fs->mntent.mnt_dir); ++ return errno; ++ } ++ ++ if (verbose) ++ printf ("settrans -pg%s%s %s\n", ++ goaway_flags & FSYS_GOAWAY_NOSYNC? "S": "", ++ goaway_flags & FSYS_GOAWAY_FORCE? "f": "", ++ fs->mntent.mnt_dir); ++ ++ if (! fake) ++ { ++ err = file_set_translator (node, ++ passive_flags, active_flags, goaway_flags, ++ NULL, 0, ++ MACH_PORT_NULL, MACH_MSG_TYPE_COPY_SEND); ++ if (err) ++ { ++ error (0, err, "%s", fs->mntent.mnt_dir); ++ ++ /* Try remounting readonly instead if requested. */ ++ if (readonly) ++ { ++ if (verbose) ++ printf ("fsysopts %s --readonly\n", fs->mntent.mnt_dir); ++ ++ error_t e = fs_set_readonly (fs, TRUE); ++ if (e) ++ error (0, e, "%s", fs->mntent.mnt_dir); ++ } ++ } ++ } ++ ++ /* Deallocate the reference so that unmounting nested translators ++ works properly. */ ++ mach_port_deallocate (mach_task_self (), node); ++ return err; ++} ++ ++int ++main (int argc, char **argv) ++{ ++ error_t err; ++ ++ err = argp_parse (&argp, argc, argv, 0, 0, &fstab_params); ++ if (err) ++ error (3, err, "parsing arguments"); ++ ++ /* Read the mtab file by default. */ ++ if (! fstab_params.fstab_path) ++ fstab_params.fstab_path = _PATH_MOUNTED; ++ ++ struct fstab *fstab = fstab_argp_create (&fstab_params, NULL, 0); ++ if (! fstab) ++ error (3, ENOMEM, "fstab creation"); ++ ++ if (targets) ++ for (char *t = targets; t; t = argz_next (targets, targets_len, t)) ++ { ++ /* Figure out if t is the device or the mountpoint. */ ++ struct fs *fs = fstab_find_mount (fstab, t); ++ if (! fs) ++ { ++ fs = fstab_find_device (fstab, t); ++ if (! fs) ++ { ++ error (0, 0, "could not find entry for: %s", t); ++ ++ /* As last resort, just assume it is the mountpoint. */ ++ struct mntent m = ++ { ++ mnt_fsname: "", ++ mnt_dir: t, ++ mnt_type: "", ++ mnt_opts: 0, ++ mnt_freq: 0, ++ mnt_passno: 0, ++ }; ++ ++ err = fstab_add_mntent (fstab, &m, &fs); ++ if (err) ++ error (2, err, "%s", t); ++ } ++ } ++ ++ if (fs) ++ err |= do_umount (fs); ++ } ++ else ++ { ++ /* Sort entries. */ ++ size_t count = 0; ++ for (struct fs *fs = fstab->entries; fs; fs = fs->next) ++ count += 1; ++ ++ char **entries = malloc (count * sizeof (char *)); ++ if (! entries) ++ error (3, ENOMEM, "allocating entries array"); ++ ++ char **p = entries; ++ for (struct fs *fs = fstab->entries; fs; fs = fs->next) ++ *p++ = fs->mntent.mnt_dir; ++ ++ /* Reverse lexicographical order. */ ++ int compare_entries (const void *a, const void *b) ++ { ++ return -strcmp ((char *) a, (char *) b); ++ } ++ ++ qsort (entries, count, sizeof (char *), compare_entries); ++ ++ for (int i = 0; i < count; i++) ++ { ++ struct fs *fs = fstab_find_mount (fstab, entries[i]); ++ if (! fs) ++ error (4, 0, "could not find entry for: %s", entries[i]); ++ ++ if (! match_options (&fs->mntent)) ++ continue; ++ ++ err |= do_umount (fs); ++ } ++ } ++ ++ return err? EXIT_FAILURE: EXIT_SUCCESS; ++} +-- +1.7.10.4 + + diff --git a/debian/patches/uptime_w_path_fix.patch b/debian/patches/uptime_w_path_fix.patch new file mode 100644 index 00000000..a2e595ef --- /dev/null +++ b/debian/patches/uptime_w_path_fix.patch @@ -0,0 +1,16 @@ +Debian has a real /usr and uses w-hurd file name +--- + utils/uptime.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/utils/uptime.sh ++++ b/utils/uptime.sh +@@ -25,7 +25,7 @@ + USAGE="Usage: $0 [OPTION...]" + DOC="Show system uptime, number of users, and load" + +-W=${W-/bin/w} ++W=${W-/usr/bin/w-hurd} + + while :; do + case "$1" in diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..342ea4d1 --- /dev/null +++ b/debian/rules @@ -0,0 +1,100 @@ +#!/usr/bin/make -f +# -*- mode: makefile; coding: utf-8 -*- +# Copyright © 2003 Jeff Bailey <jbailey@debian.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 this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA. + +DEB_DESTDIR = $(CURDIR)/debian/tmp + +CONFIGURE_ARGS = --disable-profile --enable-static-progs='ext2fs,ufs,iso9660fs' +SUID_PROGRAMS = /bin/ids /bin/login /bin/ps-hurd /usr/bin/w-hurd + +CC=gcc-4.7 + +DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) + +INSTALL_in := $(wildcard debian/*.install.in) +INSTALL_generated := $(patsubst %.in,%,$(INSTALL_in)) + +%: + dh $@ -Bbuild --with autotools_dev + +override_dh_auto_configure: + dh_auto_configure -Bbuild -- $(CONFIGURE_ARGS) $(shell dpkg-buildflags --export=configure) + +override_dh_auto_build: + dh_auto_build -Bbuild + cd build/doc && texi2html -split chapter ../../doc/hurd.texi + $(MAKE) -C libdde_linux26 BUILDDIR=$(CURDIR)/build + +override_dh_auto_clean: + dh_auto_clean + $(MAKE) -C libdde_linux26 cleanall + rm -f $$(find libdde_linux26 -name \*.d) + rm -fr libdde_linux26/build + rm -fr libdde_linux26/lib/src/gen_crc32table libdde_linux26/lib/src/crc32table.h libdde_linux26/lib/src/timeconst.h + rm -f $(INSTALL_generated) + +override_dh_auto_install: + dh_auto_install -Bbuild --destdir= -- prefix=$(DEB_DESTDIR) libdir=$(DEB_DESTDIR)/lib/$(DEB_HOST_MULTIARCH) sysconfdir=$(DEB_DESTDIR)/etc localstatedir=$(DEB_DESTDIR)/var XKB_BASE=$(DEB_DESTDIR)/usr/share/X11/xkb + $(MAKE) -C libdde_linux26 INSTALLDIR=$(CURDIR)/debian/tmp/usr/share/libdde_linux26/build/include install + + # runsystem is managed by update-alternatives + mv debian/tmp/lib/hurd/runsystem debian/tmp/lib/hurd/runsystem.gnu + + # move away fakeroot, ps, uptime, vmstat and w to not conflict with the + # ones from other packages + mkdir -p debian/tmp/usr/bin + mv debian/tmp/bin/fakeroot debian/tmp/usr/bin/fakeroot-hurd + mv debian/tmp/bin/ps debian/tmp/bin/ps-hurd + mv debian/tmp/bin/uptime debian/tmp/usr/bin/uptime-hurd + mv debian/tmp/bin/vmstat debian/tmp/usr/bin/vmstat-hurd + mv debian/tmp/bin/w debian/tmp/usr/bin/w-hurd + + # move away halt and reboot to not conflict with sysvinit + # (they will be handled as alternatives) + mv debian/tmp/sbin/halt debian/tmp/sbin/halt-hurd + mv debian/tmp/sbin/reboot debian/tmp/sbin/reboot-hurd + + # remove PIC static libraries + rm -f debian/tmp/lib/$(DEB_HOST_MULTIARCH)/*_pic.a + +override_dh_install: $(INSTALL_generated) + dh_install --list-missing + +override_dh_installinit: + dh_installinit -phurd --name=hurd-console + dh_installinit --remaining-packages + +override_dh_installchangelogs: + dh_installchangelogs -XChangeLog + +override_dh_strip: + dh_strip -phurd-libs0.3 -phurd --dbg-package=hurd-dbg + dh_strip --remaining-packages + +override_dh_fixperms: + dh_fixperms + chmod u+s $(patsubst %,$(CURDIR)/debian/hurd%,$(SUID_PROGRAMS)) + +override_dh_makeshlibs: + dh_makeshlibs -phurd-libs0.3 --add-udeb=hurd-libs0.3-udeb + dh_makeshlibs -phurd --add-udeb=hurd-udeb + dh_makeshlibs --remaining-packages + +debian/%.install: debian/%.install.in + cat $^ | sed -e 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' > $@ + diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 00000000..163aaf8d --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/source/options b/debian/source/options new file mode 100644 index 00000000..8f04d6dd --- /dev/null +++ b/debian/source/options @@ -0,0 +1 @@ +compression = "bzip2" |