Commits

Anonymous committed 912541b

tabs are as useful as a hole in the head

Comments (0)

Files changed (74)

-		    GNU GENERAL PUBLIC LICENSE
-		       Version 2, June 1991
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
 
  Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
-			    Preamble
+                            Preamble
 
   The licenses for most software are designed to take away your
 freedom to share and change it.  By contrast, the GNU General Public
   The precise terms and conditions for copying, distribution and
 modification follow.
 
-		    GNU GENERAL PUBLIC LICENSE
+                    GNU GENERAL PUBLIC LICENSE
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
   0. This License applies to any program or other work which contains
 of preserving the free status of all derivatives of our free software and
 of promoting the sharing and reuse of software generally.
 
-			    NO WARRANTY
+                            NO WARRANTY
 
   11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGES.
 
-		     END OF TERMS AND CONDITIONS
+                     END OF TERMS AND CONDITIONS
 
-	    How to Apply These Terms to Your New Programs
+            How to Apply These Terms to Your New Programs
 
   If you develop a new program, and you want it to be of the greatest
 possible use to the public, the best way to achieve this is to make it
-#!/bin/sh
-
-set -e
+#!/bin/sh -e
 
 if [ -f .git/hooks/pre-commit.sample -a ! -f .git/hooks/pre-commit ] ; then
-    cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit && \
-    chmod +x .git/hooks/pre-commit && \
-    echo "Activated pre-commit hook."
+        cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit && \
+        chmod +x .git/hooks/pre-commit && \
+        echo "Activated pre-commit hook."
 fi
 
 gtkdocize
 autoreconf --install --symlink
 
 libdir() {
-	echo $(cd $1/$(gcc -print-multi-os-directory); pwd)
+        echo $(cd $1/$(gcc -print-multi-os-directory); pwd)
 }
 
 args="\
 AC_PREREQ(2.60)
 AC_INIT([udev],
-	[175],
-	[linux-hotplug@vger.kernel.org],
-	[udev],
-	[http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html])
+       [175],
+       [linux-hotplug@vger.kernel.org],
+       [udev],
+       [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html])
 AC_CONFIG_SRCDIR([src/udevd.c])
 AC_CONFIG_AUX_DIR([build-aux])
 AM_INIT_AUTOMAKE([check-news foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-dist-gzip dist-xz subdir-objects])
 PKG_CHECK_MODULES(KMOD, libkmod >= 3)
 
 if test "x$cross_compiling" = "xno" ; then
-	AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids])
-	AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids])
-	AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids])
+       AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids])
+       AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids])
+       AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids])
 fi
 
 AC_ARG_WITH(usb-ids-path,
-	[AS_HELP_STRING([--with-usb-ids-path=DIR], [Path to usb.ids file])],
-	[USB_DATABASE=${withval}],
-	[if test -n "$usbids" ; then
-		USB_DATABASE="$usbids"
-	else
-		PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82)
-		AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)])
-	fi])
+       [AS_HELP_STRING([--with-usb-ids-path=DIR], [Path to usb.ids file])],
+       [USB_DATABASE=${withval}],
+       [if test -n "$usbids" ; then
+              USB_DATABASE="$usbids"
+       else
+              PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82)
+              AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)])
+       fi])
 AC_MSG_CHECKING([for USB database location])
 AC_MSG_RESULT([$USB_DATABASE])
 AC_SUBST(USB_DATABASE)
 
 AC_ARG_WITH(pci-ids-path,
-	[AS_HELP_STRING([--with-pci-ids-path=DIR], [Path to pci.ids file])],
-	[PCI_DATABASE=${withval}],
-	[if test -n "$pciids" ; then
-		PCI_DATABASE="$pciids"
-	else
-		AC_MSG_ERROR([pci.ids not found, try --with-pci-ids-path=])
-	fi])
+       [AS_HELP_STRING([--with-pci-ids-path=DIR], [Path to pci.ids file])],
+       [PCI_DATABASE=${withval}],
+       [if test -n "$pciids" ; then
+              PCI_DATABASE="$pciids"
+       else
+              AC_MSG_ERROR([pci.ids not found, try --with-pci-ids-path=])
+       fi])
 AC_MSG_CHECKING([for PCI database location])
 AC_MSG_RESULT([$PCI_DATABASE])
 AC_SUBST(PCI_DATABASE)
 
 AC_ARG_WITH([rootprefix],
-	AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]),
-	[], [with_rootprefix=${ac_default_prefix}])
+       AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]),
+       [], [with_rootprefix=${ac_default_prefix}])
 AC_SUBST([rootprefix], [$with_rootprefix])
 
 AC_ARG_WITH([rootlibdir],
-	AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
-	[], [with_rootlibdir=$libdir])
+       AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]),
+       [], [with_rootlibdir=$libdir])
 AC_SUBST([rootlib_execdir], [$with_rootlibdir])
 
 AC_ARG_WITH([selinux],
-	AS_HELP_STRING([--with-selinux], [enable SELinux support]),
-	[], [with_selinux=no])
+       AS_HELP_STRING([--with-selinux], [enable SELinux support]),
+       [], [with_selinux=no])
 AS_IF([test "x$with_selinux" = "xyes"], [
-	LIBS_save=$LIBS
-	AC_CHECK_LIB(selinux, getprevcon,
-		[],
-		AC_MSG_ERROR([SELinux selected but libselinux not found]))
-	LIBS=$LIBS_save
-	SELINUX_LIBS="-lselinux -lsepol"
-	AC_DEFINE(WITH_SELINUX, [1] ,[SELinux support.])
+       LIBS_save=$LIBS
+       AC_CHECK_LIB(selinux, getprevcon,
+              [],
+              AC_MSG_ERROR([SELinux selected but libselinux not found]))
+       LIBS=$LIBS_save
+       SELINUX_LIBS="-lselinux -lsepol"
+       AC_DEFINE(WITH_SELINUX, [1] ,[SELinux support.])
 ])
 AC_SUBST([SELINUX_LIBS])
 AM_CONDITIONAL(WITH_SELINUX, [test "x$with_selinux" = "xyes"])
 
 AC_ARG_ENABLE([debug],
-	AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
-	[], [enable_debug=no])
+       AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]),
+       [], [enable_debug=no])
 AS_IF([test "x$enable_debug" = "xyes"], [ AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.]) ])
 
 AC_ARG_ENABLE([logging],
-	AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
-	[], enable_logging=yes)
+       AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]),
+       [], enable_logging=yes)
 AS_IF([test "x$enable_logging" = "xyes"], [ AC_DEFINE(ENABLE_LOGGING, [1], [System logging.]) ])
 
 AC_ARG_WITH(firmware-path,
-	AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
-	   [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]),
-	[], [with_firmware_path="$rootprefix/lib/firmware/updates:$rootprefix/lib/firmware"])
+       AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
+          [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]),
+       [], [with_firmware_path="$rootprefix/lib/firmware/updates:$rootprefix/lib/firmware"])
 OLD_IFS=$IFS
 IFS=:
 for i in $with_firmware_path; do
-	if test "x${FIRMWARE_PATH}" = "x"; then
-		FIRMWARE_PATH="\\\"${i}/\\\""
-	else
-		FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\""
-	fi
+       if test "x${FIRMWARE_PATH}" = "x"; then
+              FIRMWARE_PATH="\\\"${i}/\\\""
+       else
+              FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\""
+       fi
 done
 IFS=$OLD_IFS
 AC_SUBST([FIRMWARE_PATH], [$FIRMWARE_PATH])
 
 AC_ARG_WITH([systemdsystemunitdir],
-	AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
-	[], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
+       AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
+       [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
 AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) ])
 AM_CONDITIONAL(WITH_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != "xno" ])
 
 # GUdev - libudev gobject interface
 # ------------------------------------------------------------------------------
 AC_ARG_ENABLE([gudev],
-	AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support @<:@default=enabled@:>@]),
-	[], [enable_gudev=yes])
+       AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support @<:@default=enabled@:>@]),
+       [], [enable_gudev=yes])
 AS_IF([test "x$enable_gudev" = "xyes"], [ PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) ])
 
 AC_ARG_ENABLE([introspection],
-	AS_HELP_STRING([--disable-introspection], [disable GObject introspection @<:@default=enabled@:>@]),
-	[], [enable_introspection=yes])
+       AS_HELP_STRING([--disable-introspection], [disable GObject introspection @<:@default=enabled@:>@]),
+       [], [enable_introspection=yes])
 AS_IF([test "x$enable_introspection" = "xyes"], [
-	PKG_CHECK_MODULES([INTROSPECTION], [gobject-introspection-1.0 >= 0.6.2])
-	AC_DEFINE([ENABLE_INTROSPECTION], [1], [enable GObject introspection support])
-	AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)])
-	AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)])
-	AC_SUBST([G_IR_GENERATE], [$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)])
-	AC_SUBST([GIRDIR], [$($PKG_CONFIG --define-variable=datadir=${datadir} --variable=girdir gobject-introspection-1.0)])
-	AC_SUBST([GIRTYPELIBDIR], [$($PKG_CONFIG --define-variable=libdir=${libdir} --variable=typelibdir gobject-introspection-1.0)])
+       PKG_CHECK_MODULES([INTROSPECTION], [gobject-introspection-1.0 >= 0.6.2])
+       AC_DEFINE([ENABLE_INTROSPECTION], [1], [enable GObject introspection support])
+       AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)])
+       AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)])
+       AC_SUBST([G_IR_GENERATE], [$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)])
+       AC_SUBST([GIRDIR], [$($PKG_CONFIG --define-variable=datadir=${datadir} --variable=girdir gobject-introspection-1.0)])
+       AC_SUBST([GIRTYPELIBDIR], [$($PKG_CONFIG --define-variable=libdir=${libdir} --variable=typelibdir gobject-introspection-1.0)])
 ])
 AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = "xyes"])
 AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = "xyes"])
 # keymap - map custom hardware's multimedia keys
 # ------------------------------------------------------------------------------
 AC_ARG_ENABLE([keymap],
-	AS_HELP_STRING([--disable-keymap], [disable keymap fixup support @<:@default=enabled@:>@]),
-	[], [enable_keymap=yes])
+       AS_HELP_STRING([--disable-keymap], [disable keymap fixup support @<:@default=enabled@:>@]),
+       [], [enable_keymap=yes])
 AS_IF([test "x$enable_keymap" = "xyes"], [
-	AC_PATH_PROG([GPERF], [gperf])
-	if test -z "$GPERF"; then
-		AC_MSG_ERROR([gperf is needed])
-	fi
+       AC_PATH_PROG([GPERF], [gperf])
+       if test -z "$GPERF"; then
+              AC_MSG_ERROR([gperf is needed])
+       fi
 
-	AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found]))
-	AC_SUBST([INCLUDE_PREFIX], [$(echo '#include <linux/input.h>' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}')])
+       AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found]))
+       AC_SUBST([INCLUDE_PREFIX], [$(echo '#include <linux/input.h>' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}')])
 ])
 AM_CONDITIONAL([ENABLE_KEYMAP], [test "x$enable_keymap" = "xyes"])
 
 # mtd_probe - autoloads FTL module for mtd devices
 # ------------------------------------------------------------------------------
 AC_ARG_ENABLE([mtd_probe],
-	AS_HELP_STRING([--disable-mtd_probe], [disable MTD support @<:@default=enabled@:>@]),
-	[], [enable_mtd_probe=yes])
+       AS_HELP_STRING([--disable-mtd_probe], [disable MTD support @<:@default=enabled@:>@]),
+       [], [enable_mtd_probe=yes])
 AM_CONDITIONAL([ENABLE_MTD_PROBE], [test "x$enable_mtd_probe" = "xyes"])
 
 # ------------------------------------------------------------------------------
 # rule_generator - persistent network and optical device rule generator
 # ------------------------------------------------------------------------------
 AC_ARG_ENABLE([rule_generator],
-	AS_HELP_STRING([--enable-rule_generator], [enable persistent network + cdrom links support @<:@default=disabled@:>@]),
-	[], [enable_rule_generator=no])
+       AS_HELP_STRING([--enable-rule_generator], [enable persistent network + cdrom links support @<:@default=disabled@:>@]),
+       [], [enable_rule_generator=no])
 AM_CONDITIONAL([ENABLE_RULE_GENERATOR], [test "x$enable_rule_generator" = "xyes"])
 
 # ------------------------------------------------------------------------------
 # udev_acl - apply ACLs for users with local forground sessions
 # ------------------------------------------------------------------------------
 AC_ARG_ENABLE([udev_acl],
-	AS_HELP_STRING([--enable-udev_acl], [enable local user acl permissions support @<:@default=disabled@:>@]),
-	[], [enable_udev_acl=no])
+       AS_HELP_STRING([--enable-udev_acl], [enable local user acl permissions support @<:@default=disabled@:>@]),
+       [], [enable_udev_acl=no])
 AS_IF([test "x$enable_udev_acl" = "xyes"], [
-	AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found]))
-	AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found]))
+       AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found]))
+       AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found]))
 
-	PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0])
+       PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0])
 ])
 AM_CONDITIONAL([ENABLE_UDEV_ACL], [test "x$enable_udev_acl" = "xyes"])
 
 # create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...)
 # ------------------------------------------------------------------------------
 AC_ARG_ENABLE([floppy],
-	AS_HELP_STRING([--enable-floppy], [enable legacy floppy support @<:@default=disabled@:>@]),
-	[], [enable_floppy=no])
+       AS_HELP_STRING([--enable-floppy], [enable legacy floppy support @<:@default=disabled@:>@]),
+       [], [enable_floppy=no])
 AM_CONDITIONAL([ENABLE_FLOPPY], [test "x$enable_floppy" = "xyes"])
 
 # ------------------------------------------------------------------------------
 # edd_id - create /dev/disk/by-id/edd-* links for BIOS EDD data
 # ------------------------------------------------------------------------------
 AC_ARG_ENABLE([edd],
-	AS_HELP_STRING([--enable-edd], [enable disk edd support @<:@default=disabled@:>@]),
-	[], [enable_edd=no])
+       AS_HELP_STRING([--enable-edd], [enable disk edd support @<:@default=disabled@:>@]),
+       [], [enable_edd=no])
 AM_CONDITIONAL([ENABLE_EDD], [test "x$enable_edd" = "xyes"])
 
 my_CFLAGS="-Wall \
 
 AC_CONFIG_HEADERS(config.h)
 AC_CONFIG_FILES([
-	Makefile
-	src/docs/Makefile
-	src/docs/version.xml
-	src/extras/gudev/docs/Makefile
-	src/extras/gudev/docs/version.xml
+       Makefile
+       src/docs/Makefile
+       src/docs/version.xml
+       src/extras/gudev/docs/Makefile
+       src/extras/gudev/docs/version.xml
 ])
 
 AC_OUTPUT
 AC_MSG_RESULT([
-	$PACKAGE $VERSION
-	========
+       $PACKAGE $VERSION
+       ========
 
-	prefix:			${prefix}
-	rootprefix:		${rootprefix}
-	sysconfdir:		${sysconfdir}
-	bindir:			${bindir}
-	libdir:			${libdir}
-	rootlibdir:		${rootlib_execdir}
-	libexecdir:		${libexecdir}
-	datarootdir:		${datarootdir}
-	mandir:			${mandir}
-	includedir:		${includedir}
-	include_prefix:		${INCLUDE_PREFIX}
-	systemdsystemunitdir:	${systemdsystemunitdir}
-	firmware path:		${FIRMWARE_PATH}
-	usb.ids:		${USB_DATABASE}
-	pci.ids:		${PCI_DATABASE}
+       prefix:                  ${prefix}
+       rootprefix:              ${rootprefix}
+       sysconfdir:              ${sysconfdir}
+       bindir:                  ${bindir}
+       libdir:                  ${libdir}
+       rootlibdir:              ${rootlib_execdir}
+       libexecdir:              ${libexecdir}
+       datarootdir:             ${datarootdir}
+       mandir:                  ${mandir}
+       includedir:              ${includedir}
+       include_prefix:          ${INCLUDE_PREFIX}
+       systemdsystemunitdir:    ${systemdsystemunitdir}
+       firmware path:           ${FIRMWARE_PATH}
+       usb.ids:                 ${USB_DATABASE}
+       pci.ids:                 ${PCI_DATABASE}
 
-	compiler:		${CC}
-	cflags:			${CFLAGS}
-	ldflags:		${LDFLAGS}
-	xsltproc:		${XSLTPROC}
-	gperf:			${GPERF}
+       compiler:                ${CC}
+       cflags:                  ${CFLAGS}
+       ldflags:                 ${LDFLAGS}
+       xsltproc:                ${XSLTPROC}
+       gperf:                   ${GPERF}
 
-	logging:		${enable_logging}
-	debug:			${enable_debug}
-	selinux:		${with_selinux}
+       logging:                 ${enable_logging}
+       debug:                   ${enable_debug}
+       selinux:                 ${with_selinux}
 
-	gudev:			${enable_gudev}
-	gintrospection:		${enable_introspection}
-	keymap:			${enable_keymap}
-	mtd_probe:		${enable_mtd_probe}
-	rule_generator:		${enable_rule_generator}
-	udev_acl:		${enable_udev_acl}
-	floppy:			${enable_floppy}
-	edd:			${enable_edd}
+       gudev:                   ${enable_gudev}
+       gintrospection:          ${enable_introspection}
+       keymap:                  ${enable_keymap}
+       mtd_probe:               ${enable_mtd_probe}
+       rule_generator:          ${enable_rule_generator}
+       udev_acl:                ${enable_udev_acl}
+       floppy:                  ${enable_floppy}
+       edd:                     ${enable_edd}
 ])

rules/arch/40-s390.rules

 # do not edit this file, it will be overwritten on update
 
-KERNEL=="z90crypt",		MODE="0666"
+KERNEL=="z90crypt", MODE="0666"
 

rules/rules.d/50-udev-default.rules

 
 KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660"
 KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660"
-KERNEL=="ptmx",			GROUP="tty", MODE="0666"
-KERNEL=="tty",			GROUP="tty", MODE="0666"
-KERNEL=="tty[0-9]*",		GROUP="tty", MODE="0620"
+KERNEL=="ptmx", GROUP="tty", MODE="0666"
+KERNEL=="tty", GROUP="tty", MODE="0666"
+KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620"
 KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty"
 
 # serial
 KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout"
-KERNEL=="mwave",		GROUP="dialout"
-KERNEL=="hvc*|hvsi*",		GROUP="dialout"
+KERNEL=="mwave", GROUP="dialout"
+KERNEL=="hvc*|hvsi*", GROUP="dialout"
 
 # virtio serial / console ports
 KERNEL=="vport*", ATTR{name}=="?*", SYMLINK+="virtio-ports/$attr{name}"
 
 # mem
 KERNEL=="null|zero|full|random|urandom", MODE="0666"
-KERNEL=="mem|kmem|port|nvram",	GROUP="kmem", MODE="0640"
+KERNEL=="mem|kmem|port|nvram", GROUP="kmem", MODE="0640"
 
 # input
 SUBSYSTEM=="input", ENV{ID_INPUT}=="", IMPORT{builtin}="input_id"
-KERNEL=="mouse*|mice|event*",	MODE="0640"
-KERNEL=="ts[0-9]*|uinput",	MODE="0640"
-KERNEL=="js[0-9]*",		MODE="0644"
+KERNEL=="mouse*|mice|event*", MODE="0640"
+KERNEL=="ts[0-9]*|uinput", MODE="0640"
+KERNEL=="js[0-9]*", MODE="0644"
 
 # video4linux
-SUBSYSTEM=="video4linux",	GROUP="video"
-KERNEL=="vttuner*",		GROUP="video"
-KERNEL=="vtx*|vbi*",		GROUP="video"
-KERNEL=="winradio*",		GROUP="video"
+SUBSYSTEM=="video4linux", GROUP="video"
+KERNEL=="vttuner*", GROUP="video"
+KERNEL=="vtx*|vbi*", GROUP="video"
+KERNEL=="winradio*", GROUP="video"
 
 # graphics
-KERNEL=="agpgart",		GROUP="video"
-KERNEL=="pmu",			GROUP="video"
-KERNEL=="nvidia*|nvidiactl*",	GROUP="video"
-SUBSYSTEM=="graphics",		GROUP="video"
-SUBSYSTEM=="drm",		GROUP="video"
+KERNEL=="agpgart", GROUP="video"
+KERNEL=="pmu", GROUP="video"
+KERNEL=="nvidia*|nvidiactl*", GROUP="video"
+SUBSYSTEM=="graphics", GROUP="video"
+SUBSYSTEM=="drm", GROUP="video"
 
 # sound
-SUBSYSTEM=="sound",		GROUP="audio", \
+SUBSYSTEM=="sound", GROUP="audio", \
   OPTIONS+="static_node=snd/seq", OPTIONS+="static_node=snd/timer"
 
 # DVB (video)
 SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="usb_id"
 
 # printer
-KERNEL=="parport[0-9]*",	GROUP="lp"
-SUBSYSTEM=="printer",		KERNEL=="lp*", GROUP="lp"
-SUBSYSTEM=="ppdev",		GROUP="lp"
-KERNEL=="lp[0-9]*",		GROUP="lp"
-KERNEL=="irlpt[0-9]*",		GROUP="lp"
+KERNEL=="parport[0-9]*", GROUP="lp"
+SUBSYSTEM=="printer", KERNEL=="lp*", GROUP="lp"
+SUBSYSTEM=="ppdev", GROUP="lp"
+KERNEL=="lp[0-9]*", GROUP="lp"
+KERNEL=="irlpt[0-9]*", GROUP="lp"
 SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701??:*", GROUP="lp"
 
 # block
 SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440"
 
 # network
-KERNEL=="tun",			MODE="0666", OPTIONS+="static_node=net/tun"
-KERNEL=="rfkill",		MODE="0644"
+KERNEL=="tun", MODE="0666", OPTIONS+="static_node=net/tun"
+KERNEL=="rfkill", MODE="0644"
 
 # CPU
-KERNEL=="cpu[0-9]*",		MODE="0444"
+KERNEL=="cpu[0-9]*", MODE="0444"
 
-KERNEL=="fuse", ACTION=="add",	MODE="0666", OPTIONS+="static_node=fuse"
+KERNEL=="fuse", ACTION=="add", MODE="0666", OPTIONS+="static_node=fuse"
 
 SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc"
-KERNEL=="mmtimer",		MODE="0644"
-KERNEL=="rflash[0-9]*",		MODE="0400"
-KERNEL=="rrom[0-9]*",		MODE="0400"
+KERNEL=="mmtimer", MODE="0644"
+KERNEL=="rflash[0-9]*", MODE="0400"
+KERNEL=="rrom[0-9]*", MODE="0400"
 
 SUBSYSTEM=="firmware", ACTION=="add", IMPORT{builtin}="firmware"
-		  GNU LESSER GENERAL PUBLIC LICENSE
-		       Version 2.1, February 1999
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 2.1, February 1999
 
  Copyright (C) 1991, 1999 Free Software Foundation, Inc.
      51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  as the successor of the GNU Library Public License, version 2, hence
  the version number 2.1.]
 
-			    Preamble
+                            Preamble
 
   The licenses for most software are designed to take away your
 freedom to share and change it.  By contrast, the GNU General Public
 former contains code derived from the library, whereas the latter must
 be combined with the library in order to run.
 
-		  GNU LESSER GENERAL PUBLIC LICENSE
+                  GNU LESSER GENERAL PUBLIC LICENSE
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
   0. This License Agreement applies to any software library or other
 of all derivatives of our free software and of promoting the sharing
 and reuse of software generally.
 
-			    NO WARRANTY
+                            NO WARRANTY
 
   15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
 WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
 DAMAGES.
 
-		     END OF TERMS AND CONDITIONS
+                     END OF TERMS AND CONDITIONS
 
            How to Apply These Terms to Your New Libraries
 

src/extras/accelerometer/accelerometer.c

 static int debug = 0;
 
 static void log_fn(struct udev *udev, int priority,
-		   const char *file, int line, const char *fn,
-		   const char *format, va_list args)
+                   const char *file, int line, const char *fn,
+                   const char *format, va_list args)
 {
-	if (debug) {
-		fprintf(stderr, "%s: ", fn);
-		vfprintf(stderr, format, args);
-	} else {
-		vsyslog(priority, format, args);
-	}
+        if (debug) {
+                fprintf(stderr, "%s: ", fn);
+                vfprintf(stderr, format, args);
+        } else {
+                vsyslog(priority, format, args);
+        }
 }
 
 typedef enum {
-	ORIENTATION_UNDEFINED,
-	ORIENTATION_NORMAL,
-	ORIENTATION_BOTTOM_UP,
-	ORIENTATION_LEFT_UP,
-	ORIENTATION_RIGHT_UP
+        ORIENTATION_UNDEFINED,
+        ORIENTATION_NORMAL,
+        ORIENTATION_BOTTOM_UP,
+        ORIENTATION_LEFT_UP,
+        ORIENTATION_RIGHT_UP
 } OrientationUp;
 
 static const char *orientations[] = {
-	"undefined",
-	"normal",
-	"bottom-up",
-	"left-up",
-	"right-up",
-	NULL
+        "undefined",
+        "normal",
+        "bottom-up",
+        "left-up",
+        "right-up",
+        NULL
 };
 
 #define ORIENTATION_UP_UP ORIENTATION_NORMAL
 static const char *
 orientation_to_string (OrientationUp o)
 {
-	return orientations[o];
+        return orientations[o];
 }
 
 static OrientationUp
 string_to_orientation (const char *orientation)
 {
-	int i;
-
-	if (orientation == NULL)
-		return ORIENTATION_UNDEFINED;
-	for (i = 0; orientations[i] != NULL; i++) {
-		if (strcmp (orientation, orientations[i]) == 0)
-			return i;
-	}
-	return ORIENTATION_UNDEFINED;
+        int i;
+
+        if (orientation == NULL)
+                return ORIENTATION_UNDEFINED;
+        for (i = 0; orientations[i] != NULL; i++) {
+                if (strcmp (orientation, orientations[i]) == 0)
+                        return i;
+        }
+        return ORIENTATION_UNDEFINED;
 }
 
 static OrientationUp
 orientation_calc (OrientationUp prev,
-		  int x, int y, int z)
+                  int x, int y, int z)
 {
-	int rotation;
-	OrientationUp ret = prev;
-
-	/* Portrait check */
-	rotation = round(atan((double) x / sqrt(y * y + z * z)) * RADIANS_TO_DEGREES);
-
-	if (abs(rotation) > THRESHOLD_PORTRAIT) {
-		ret = (rotation < 0) ? ORIENTATION_LEFT_UP : ORIENTATION_RIGHT_UP;
-
-		/* Some threshold to switching between portrait modes */
-		if (prev == ORIENTATION_LEFT_UP || prev == ORIENTATION_RIGHT_UP) {
-			if (abs(rotation) < SAME_AXIS_LIMIT) {
-				ret = prev;
-			}
-		}
-
-	} else {
-		/* Landscape check */
-		rotation = round(atan((double) y / sqrt(x * x + z * z)) * RADIANS_TO_DEGREES);
-
-		if (abs(rotation) > THRESHOLD_LANDSCAPE) {
-			ret = (rotation < 0) ? ORIENTATION_BOTTOM_UP : ORIENTATION_NORMAL;
-
-			/* Some threshold to switching between landscape modes */
-			if (prev == ORIENTATION_BOTTOM_UP || prev == ORIENTATION_NORMAL) {
-				if (abs(rotation) < SAME_AXIS_LIMIT) {
-					ret = prev;
-				}
-			}
-		}
-	}
-
-	return ret;
+        int rotation;
+        OrientationUp ret = prev;
+
+        /* Portrait check */
+        rotation = round(atan((double) x / sqrt(y * y + z * z)) * RADIANS_TO_DEGREES);
+
+        if (abs(rotation) > THRESHOLD_PORTRAIT) {
+                ret = (rotation < 0) ? ORIENTATION_LEFT_UP : ORIENTATION_RIGHT_UP;
+
+                /* Some threshold to switching between portrait modes */
+                if (prev == ORIENTATION_LEFT_UP || prev == ORIENTATION_RIGHT_UP) {
+                        if (abs(rotation) < SAME_AXIS_LIMIT) {
+                                ret = prev;
+                        }
+                }
+
+        } else {
+                /* Landscape check */
+                rotation = round(atan((double) y / sqrt(x * x + z * z)) * RADIANS_TO_DEGREES);
+
+                if (abs(rotation) > THRESHOLD_LANDSCAPE) {
+                        ret = (rotation < 0) ? ORIENTATION_BOTTOM_UP : ORIENTATION_NORMAL;
+
+                        /* Some threshold to switching between landscape modes */
+                        if (prev == ORIENTATION_BOTTOM_UP || prev == ORIENTATION_NORMAL) {
+                                if (abs(rotation) < SAME_AXIS_LIMIT) {
+                                        ret = prev;
+                                }
+                        }
+                }
+        }
+
+        return ret;
 }
 
 static OrientationUp
 get_prev_orientation(struct udev_device *dev)
 {
-	const char *value;
+        const char *value;
 
-	value = udev_device_get_property_value(dev, "ID_INPUT_ACCELEROMETER_ORIENTATION");
-	if (value == NULL)
-		return ORIENTATION_UNDEFINED;
-	return string_to_orientation(value);
+        value = udev_device_get_property_value(dev, "ID_INPUT_ACCELEROMETER_ORIENTATION");
+        if (value == NULL)
+                return ORIENTATION_UNDEFINED;
+        return string_to_orientation(value);
 }
 
 #define SET_AXIS(axis, code_) if (ev[i].code == code_) { if (got_##axis == 0) { axis = ev[i].value; got_##axis = 1; } }
 
 /* accelerometers */
 static void test_orientation(struct udev *udev,
-			     struct udev_device *dev,
-			     const char *devpath)
+                             struct udev_device *dev,
+                             const char *devpath)
 {
-	OrientationUp old, new;
-	int fd, r;
-	struct input_event ev[64];
-	int got_syn = 0;
-	int got_x, got_y, got_z;
-	int x = 0, y = 0, z = 0;
-	char text[64];
-
-	old = get_prev_orientation(dev);
-
-	if ((fd = open(devpath, O_RDONLY)) < 0)
-		return;
-
-	got_x = got_y = got_z = 0;
-
-	while (1) {
-		int i;
-
-		r = read(fd, ev, sizeof(struct input_event) * 64);
-
-		if (r < (int) sizeof(struct input_event))
-			return;
-
-		for (i = 0; i < r / (int) sizeof(struct input_event); i++) {
-			if (got_syn == 1) {
-				if (ev[i].type == EV_ABS) {
-					SET_AXIS(x, ABS_X);
-					SET_AXIS(y, ABS_Y);
-					SET_AXIS(z, ABS_Z);
-				}
-			}
-			if (ev[i].type == EV_SYN && ev[i].code == SYN_REPORT) {
-				got_syn = 1;
-			}
-			if (got_x && got_y && got_z)
-				goto read_dev;
-		}
-	}
+        OrientationUp old, new;
+        int fd, r;
+        struct input_event ev[64];
+        int got_syn = 0;
+        int got_x, got_y, got_z;
+        int x = 0, y = 0, z = 0;
+        char text[64];
+
+        old = get_prev_orientation(dev);
+
+        if ((fd = open(devpath, O_RDONLY)) < 0)
+                return;
+
+        got_x = got_y = got_z = 0;
+
+        while (1) {
+                int i;
+
+                r = read(fd, ev, sizeof(struct input_event) * 64);
+
+                if (r < (int) sizeof(struct input_event))
+                        return;
+
+                for (i = 0; i < r / (int) sizeof(struct input_event); i++) {
+                        if (got_syn == 1) {
+                                if (ev[i].type == EV_ABS) {
+                                        SET_AXIS(x, ABS_X);
+                                        SET_AXIS(y, ABS_Y);
+                                        SET_AXIS(z, ABS_Z);
+                                }
+                        }
+                        if (ev[i].type == EV_SYN && ev[i].code == SYN_REPORT) {
+                                got_syn = 1;
+                        }
+                        if (got_x && got_y && got_z)
+                                goto read_dev;
+                }
+        }
 
 read_dev:
-	close(fd);
+        close(fd);
 
-	if (!got_x || !got_y || !got_z)
-		return;
+        if (!got_x || !got_y || !got_z)
+                return;
 
-	new = orientation_calc(old, x, y, z);
-	snprintf(text, sizeof(text), "ID_INPUT_ACCELEROMETER_ORIENTATION=%s", orientation_to_string(new));
-	puts(text);
+        new = orientation_calc(old, x, y, z);
+        snprintf(text, sizeof(text), "ID_INPUT_ACCELEROMETER_ORIENTATION=%s", orientation_to_string(new));
+        puts(text);
 }
 
 static void help(void)
 {
-	printf("Usage: accelerometer [options] <device path>\n"
-	       "  --debug         debug to stderr\n"
-	       "  --help          print this help text\n\n");
+        printf("Usage: accelerometer [options] <device path>\n"
+               "  --debug         debug to stderr\n"
+               "  --help          print this help text\n\n");
 }
 
 int main (int argc, char** argv)
 {
-	struct udev *udev;
-	struct udev_device *dev;
-
-	static const struct option options[] = {
-		{ "debug", no_argument, NULL, 'd' },
-		{ "help", no_argument, NULL, 'h' },
-		{}
-	};
-
-	char devpath[PATH_MAX];
-	char *devnode;
-	const char *id_path;
-	struct udev_enumerate *enumerate;
-	struct udev_list_entry *list_entry;
-
-	udev = udev_new();
-	if (udev == NULL)
-		return 1;
-
-	udev_log_init("input_id");
-	udev_set_log_fn(udev, log_fn);
-
-	/* CLI argument parsing */
-	while (1) {
-		int option;
-
-		option = getopt_long(argc, argv, "dxh", options, NULL);
-		if (option == -1)
-			break;
-
-		switch (option) {
-		case 'd':
-			debug = 1;
-			if (udev_get_log_priority(udev) < LOG_INFO)
-				udev_set_log_priority(udev, LOG_INFO);
-			break;
-		case 'h':
-			help();
-			exit(0);
-		default:
-			exit(1);
-		}
-	}
-
-	if (argv[optind] == NULL) {
-		help();
-		exit(1);
-	}
-
-	/* get the device */
-	snprintf(devpath, sizeof(devpath), "%s/%s", udev_get_sys_path(udev), argv[optind]);
-	dev = udev_device_new_from_syspath(udev, devpath);
-	if (dev == NULL) {
-		fprintf(stderr, "unable to access '%s'\n", devpath);
-		return 1;
-	}
-
-	id_path = udev_device_get_property_value(dev, "ID_PATH");
-	if (id_path == NULL) {
-		fprintf (stderr, "unable to get property ID_PATH for '%s'", devpath);
-		return 0;
-	}
-
-	/* Get the children devices and find the devnode
-	 * FIXME: use udev_enumerate_add_match_children() instead
-	 * when it's available */
-	devnode = NULL;
-	enumerate = udev_enumerate_new(udev);
-	udev_enumerate_add_match_property(enumerate, "ID_PATH", id_path);
-	udev_enumerate_add_match_subsystem(enumerate, "input");
-	udev_enumerate_scan_devices(enumerate);
-	udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) {
-		struct udev_device *device;
-		const char *node;
-
-		device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate),
-						      udev_list_entry_get_name(list_entry));
-		if (device == NULL)
-			continue;
-		/* Already found it */
-		if (devnode != NULL) {
-			udev_device_unref(device);
-			continue;
-		}
-
-		node = udev_device_get_devnode(device);
-		if (node == NULL) {
-			udev_device_unref(device);
-			continue;
-		}
-		/* Use the event sub-device */
-		if (strstr(node, "/event") == NULL) {
-			udev_device_unref(device);
-			continue;
-		}
-
-		devnode = strdup(node);
-		udev_device_unref(device);
-	}
-
-	if (devnode == NULL) {
-		fprintf(stderr, "unable to get device node for '%s'\n", devpath);
-		return 0;
-	}
-
-	info(udev, "Opening accelerometer device %s\n", devnode);
-	test_orientation(udev, dev, devnode);
-	free(devnode);
-
-	return 0;
+        struct udev *udev;
+        struct udev_device *dev;
+
+        static const struct option options[] = {
+                { "debug", no_argument, NULL, 'd' },
+                { "help", no_argument, NULL, 'h' },
+                {}
+        };
+
+        char devpath[PATH_MAX];
+        char *devnode;
+        const char *id_path;
+        struct udev_enumerate *enumerate;
+        struct udev_list_entry *list_entry;
+
+        udev = udev_new();
+        if (udev == NULL)
+                return 1;
+
+        udev_log_init("input_id");
+        udev_set_log_fn(udev, log_fn);
+
+        /* CLI argument parsing */
+        while (1) {
+                int option;
+
+                option = getopt_long(argc, argv, "dxh", options, NULL);
+                if (option == -1)
+                        break;
+
+                switch (option) {
+                case 'd':
+                        debug = 1;
+                        if (udev_get_log_priority(udev) < LOG_INFO)
+                                udev_set_log_priority(udev, LOG_INFO);
+                        break;
+                case 'h':
+                        help();
+                        exit(0);
+                default:
+                        exit(1);
+                }
+        }
+
+        if (argv[optind] == NULL) {
+                help();
+                exit(1);
+        }
+
+        /* get the device */
+        snprintf(devpath, sizeof(devpath), "%s/%s", udev_get_sys_path(udev), argv[optind]);
+        dev = udev_device_new_from_syspath(udev, devpath);
+        if (dev == NULL) {
+                fprintf(stderr, "unable to access '%s'\n", devpath);
+                return 1;
+        }
+
+        id_path = udev_device_get_property_value(dev, "ID_PATH");
+        if (id_path == NULL) {
+                fprintf (stderr, "unable to get property ID_PATH for '%s'", devpath);
+                return 0;
+        }
+
+        /* Get the children devices and find the devnode
+         * FIXME: use udev_enumerate_add_match_children() instead
+         * when it's available */
+        devnode = NULL;
+        enumerate = udev_enumerate_new(udev);
+        udev_enumerate_add_match_property(enumerate, "ID_PATH", id_path);
+        udev_enumerate_add_match_subsystem(enumerate, "input");
+        udev_enumerate_scan_devices(enumerate);
+        udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) {
+                struct udev_device *device;
+                const char *node;
+
+                device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate),
+                                                      udev_list_entry_get_name(list_entry));
+                if (device == NULL)
+                        continue;
+                /* Already found it */
+                if (devnode != NULL) {
+                        udev_device_unref(device);
+                        continue;
+                }
+
+                node = udev_device_get_devnode(device);
+                if (node == NULL) {
+                        udev_device_unref(device);
+                        continue;
+                }
+                /* Use the event sub-device */
+                if (strstr(node, "/event") == NULL) {
+                        udev_device_unref(device);
+                        continue;
+                }
+
+                devnode = strdup(node);
+                udev_device_unref(device);
+        }
+
+        if (devnode == NULL) {
+                fprintf(stderr, "unable to get device node for '%s'\n", devpath);
+                return 0;
+        }
+
+        info(udev, "Opening accelerometer device %s\n", devnode);
+        test_orientation(udev, dev, devnode);
+        free(devnode);
+
+        return 0;
 }

src/extras/ata_id/ata_id.c

 #define COMMAND_TIMEOUT_MSEC (30 * 1000)
 
 static int disk_scsi_inquiry_command(int      fd,
-				     void    *buf,
-				     size_t   buf_len)
+                                     void    *buf,
+                                     size_t   buf_len)
 {
-	struct sg_io_v4 io_v4;
-	uint8_t cdb[6];
-	uint8_t sense[32];
-	int ret;
-
-	/*
-	 * INQUIRY, see SPC-4 section 6.4
-	 */
-	memset(cdb, 0, sizeof(cdb));
-	cdb[0] = 0x12;			 /* OPERATION CODE: INQUIRY */
-	cdb[3] = (buf_len >> 8);	 /* ALLOCATION LENGTH */
-	cdb[4] = (buf_len & 0xff);
-
-	memset(sense, 0, sizeof(sense));
-
-	memset(&io_v4, 0, sizeof(struct sg_io_v4));
-	io_v4.guard = 'Q';
-	io_v4.protocol = BSG_PROTOCOL_SCSI;
-	io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD;
-	io_v4.request_len = sizeof (cdb);
-	io_v4.request = (uintptr_t) cdb;
-	io_v4.max_response_len = sizeof (sense);
-	io_v4.response = (uintptr_t) sense;
-	io_v4.din_xfer_len = buf_len;
-	io_v4.din_xferp = (uintptr_t) buf;
-	io_v4.timeout = COMMAND_TIMEOUT_MSEC;
-
-	ret = ioctl(fd, SG_IO, &io_v4);
-	if (ret != 0) {
-		/* could be that the driver doesn't do version 4, try version 3 */
-		if (errno == EINVAL) {
-			struct sg_io_hdr io_hdr;
-
-			memset(&io_hdr, 0, sizeof(struct sg_io_hdr));
-			io_hdr.interface_id = 'S';
-			io_hdr.cmdp = (unsigned char*) cdb;
-			io_hdr.cmd_len = sizeof (cdb);
-			io_hdr.dxferp = buf;
-			io_hdr.dxfer_len = buf_len;
-			io_hdr.sbp = sense;
-			io_hdr.mx_sb_len = sizeof (sense);
-			io_hdr.dxfer_direction = SG_DXFER_FROM_DEV;
-			io_hdr.timeout = COMMAND_TIMEOUT_MSEC;
-
-			ret = ioctl(fd, SG_IO, &io_hdr);
-			if (ret != 0)
-				goto out;
-
-			/* even if the ioctl succeeds, we need to check the return value */
-			if (!(io_hdr.status == 0 &&
-			      io_hdr.host_status == 0 &&
-			      io_hdr.driver_status == 0)) {
-				errno = EIO;
-				ret = -1;
-				goto out;
-			}
-		} else {
-			goto out;
-		}
-	}
-
-	/* even if the ioctl succeeds, we need to check the return value */
-	if (!(io_v4.device_status == 0 &&
-	      io_v4.transport_status == 0 &&
-	      io_v4.driver_status == 0)) {
-		errno = EIO;
-		ret = -1;
-		goto out;
-	}
+        struct sg_io_v4 io_v4;
+        uint8_t cdb[6];
+        uint8_t sense[32];
+        int ret;
+
+        /*
+         * INQUIRY, see SPC-4 section 6.4
+         */
+        memset(cdb, 0, sizeof(cdb));
+        cdb[0] = 0x12;                         /* OPERATION CODE: INQUIRY */
+        cdb[3] = (buf_len >> 8);         /* ALLOCATION LENGTH */
+        cdb[4] = (buf_len & 0xff);
+
+        memset(sense, 0, sizeof(sense));
+
+        memset(&io_v4, 0, sizeof(struct sg_io_v4));
+        io_v4.guard = 'Q';
+        io_v4.protocol = BSG_PROTOCOL_SCSI;
+        io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD;
+        io_v4.request_len = sizeof (cdb);
+        io_v4.request = (uintptr_t) cdb;
+        io_v4.max_response_len = sizeof (sense);
+        io_v4.response = (uintptr_t) sense;
+        io_v4.din_xfer_len = buf_len;
+        io_v4.din_xferp = (uintptr_t) buf;
+        io_v4.timeout = COMMAND_TIMEOUT_MSEC;
+
+        ret = ioctl(fd, SG_IO, &io_v4);
+        if (ret != 0) {
+                /* could be that the driver doesn't do version 4, try version 3 */
+                if (errno == EINVAL) {
+                        struct sg_io_hdr io_hdr;
+
+                        memset(&io_hdr, 0, sizeof(struct sg_io_hdr));
+                        io_hdr.interface_id = 'S';
+                        io_hdr.cmdp = (unsigned char*) cdb;
+                        io_hdr.cmd_len = sizeof (cdb);
+                        io_hdr.dxferp = buf;
+                        io_hdr.dxfer_len = buf_len;
+                        io_hdr.sbp = sense;
+                        io_hdr.mx_sb_len = sizeof (sense);
+                        io_hdr.dxfer_direction = SG_DXFER_FROM_DEV;
+                        io_hdr.timeout = COMMAND_TIMEOUT_MSEC;
+
+                        ret = ioctl(fd, SG_IO, &io_hdr);
+                        if (ret != 0)
+                                goto out;
+
+                        /* even if the ioctl succeeds, we need to check the return value */
+                        if (!(io_hdr.status == 0 &&
+                              io_hdr.host_status == 0 &&
+                              io_hdr.driver_status == 0)) {
+                                errno = EIO;
+                                ret = -1;
+                                goto out;
+                        }
+                } else {
+                        goto out;
+                }
+        }
+
+        /* even if the ioctl succeeds, we need to check the return value */
+        if (!(io_v4.device_status == 0 &&
+              io_v4.transport_status == 0 &&
+              io_v4.driver_status == 0)) {
+                errno = EIO;
+                ret = -1;
+                goto out;
+        }
 
  out:
-	return ret;
+        return ret;
 }
 
-static int disk_identify_command(int	  fd,
-				 void	 *buf,
-				 size_t	  buf_len)
+static int disk_identify_command(int          fd,
+                                 void         *buf,
+                                 size_t          buf_len)
 {
-	struct sg_io_v4 io_v4;
-	uint8_t cdb[12];
-	uint8_t sense[32];
-	uint8_t *desc = sense+8;
-	int ret;
-
-	/*
-	 * ATA Pass-Through 12 byte command, as described in
-	 *
-	 *  T10 04-262r8 ATA Command Pass-Through
-	 *
-	 * from http://www.t10.org/ftp/t10/document.04/04-262r8.pdf
-	 */
-	memset(cdb, 0, sizeof(cdb));
-	cdb[0] = 0xa1;			/* OPERATION CODE: 12 byte pass through */
-	cdb[1] = 4 << 1;		/* PROTOCOL: PIO Data-in */
-	cdb[2] = 0x2e;			/* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */
-	cdb[3] = 0;			/* FEATURES */
-	cdb[4] = 1;			/* SECTORS */
-	cdb[5] = 0;			/* LBA LOW */
-	cdb[6] = 0;			/* LBA MID */
-	cdb[7] = 0;			/* LBA HIGH */
-	cdb[8] = 0 & 0x4F;		/* SELECT */
-	cdb[9] = 0xEC;			/* Command: ATA IDENTIFY DEVICE */;
-	memset(sense, 0, sizeof(sense));
-
-	memset(&io_v4, 0, sizeof(struct sg_io_v4));
-	io_v4.guard = 'Q';
-	io_v4.protocol = BSG_PROTOCOL_SCSI;
-	io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD;
-	io_v4.request_len = sizeof (cdb);
-	io_v4.request = (uintptr_t) cdb;
-	io_v4.max_response_len = sizeof (sense);
-	io_v4.response = (uintptr_t) sense;
-	io_v4.din_xfer_len = buf_len;
-	io_v4.din_xferp = (uintptr_t) buf;
-	io_v4.timeout = COMMAND_TIMEOUT_MSEC;
-
-	ret = ioctl(fd, SG_IO, &io_v4);
-	if (ret != 0) {
-		/* could be that the driver doesn't do version 4, try version 3 */
-		if (errno == EINVAL) {
-			struct sg_io_hdr io_hdr;
-
-			memset(&io_hdr, 0, sizeof(struct sg_io_hdr));
-			io_hdr.interface_id = 'S';
-			io_hdr.cmdp = (unsigned char*) cdb;
-			io_hdr.cmd_len = sizeof (cdb);
-			io_hdr.dxferp = buf;
-			io_hdr.dxfer_len = buf_len;
-			io_hdr.sbp = sense;
-			io_hdr.mx_sb_len = sizeof (sense);
-			io_hdr.dxfer_direction = SG_DXFER_FROM_DEV;
-			io_hdr.timeout = COMMAND_TIMEOUT_MSEC;
-
-			ret = ioctl(fd, SG_IO, &io_hdr);
-			if (ret != 0)
-				goto out;
-		} else {
-			goto out;
-		}
-	}
-
-	if (!(sense[0] == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c)) {
-		errno = EIO;
-		ret = -1;
-		goto out;
-	}
+        struct sg_io_v4 io_v4;
+        uint8_t cdb[12];
+        uint8_t sense[32];
+        uint8_t *desc = sense+8;
+        int ret;
+
+        /*
+         * ATA Pass-Through 12 byte command, as described in
+         *
+         *  T10 04-262r8 ATA Command Pass-Through
+         *
+         * from http://www.t10.org/ftp/t10/document.04/04-262r8.pdf
+         */
+        memset(cdb, 0, sizeof(cdb));
+        cdb[0] = 0xa1;                        /* OPERATION CODE: 12 byte pass through */
+        cdb[1] = 4 << 1;                /* PROTOCOL: PIO Data-in */
+        cdb[2] = 0x2e;                        /* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */
+        cdb[3] = 0;                        /* FEATURES */
+        cdb[4] = 1;                        /* SECTORS */
+        cdb[5] = 0;                        /* LBA LOW */
+        cdb[6] = 0;                        /* LBA MID */
+        cdb[7] = 0;                        /* LBA HIGH */
+        cdb[8] = 0 & 0x4F;                /* SELECT */
+        cdb[9] = 0xEC;                        /* Command: ATA IDENTIFY DEVICE */;
+        memset(sense, 0, sizeof(sense));
+
+        memset(&io_v4, 0, sizeof(struct sg_io_v4));
+        io_v4.guard = 'Q';
+        io_v4.protocol = BSG_PROTOCOL_SCSI;
+        io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD;
+        io_v4.request_len = sizeof (cdb);
+        io_v4.request = (uintptr_t) cdb;
+        io_v4.max_response_len = sizeof (sense);
+        io_v4.response = (uintptr_t) sense;
+        io_v4.din_xfer_len = buf_len;
+        io_v4.din_xferp = (uintptr_t) buf;
+        io_v4.timeout = COMMAND_TIMEOUT_MSEC;
+
+        ret = ioctl(fd, SG_IO, &io_v4);
+        if (ret != 0) {
+                /* could be that the driver doesn't do version 4, try version 3 */
+                if (errno == EINVAL) {
+                        struct sg_io_hdr io_hdr;
+
+                        memset(&io_hdr, 0, sizeof(struct sg_io_hdr));
+                        io_hdr.interface_id = 'S';
+                        io_hdr.cmdp = (unsigned char*) cdb;
+                        io_hdr.cmd_len = sizeof (cdb);
+                        io_hdr.dxferp = buf;
+                        io_hdr.dxfer_len = buf_len;
+                        io_hdr.sbp = sense;
+                        io_hdr.mx_sb_len = sizeof (sense);
+                        io_hdr.dxfer_direction = SG_DXFER_FROM_DEV;
+                        io_hdr.timeout = COMMAND_TIMEOUT_MSEC;
+
+                        ret = ioctl(fd, SG_IO, &io_hdr);
+                        if (ret != 0)
+                                goto out;
+                } else {
+                        goto out;
+                }
+        }
+
+        if (!(sense[0] == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c)) {
+                errno = EIO;
+                ret = -1;
+                goto out;
+        }
 
  out:
-	return ret;
+        return ret;
 }
 
-static int disk_identify_packet_device_command(int	  fd,
-					       void	 *buf,
-					       size_t	  buf_len)
+static int disk_identify_packet_device_command(int          fd,
+                                               void         *buf,
+                                               size_t          buf_len)
 {
-	struct sg_io_v4 io_v4;
-	uint8_t cdb[16];
-	uint8_t sense[32];
-	uint8_t *desc = sense+8;
-	int ret;
-
-	/*
-	 * ATA Pass-Through 16 byte command, as described in
-	 *
-	 *  T10 04-262r8 ATA Command Pass-Through
-	 *
-	 * from http://www.t10.org/ftp/t10/document.04/04-262r8.pdf
-	 */
-	memset(cdb, 0, sizeof(cdb));
-	cdb[0] = 0x85;			/* OPERATION CODE: 16 byte pass through */
-	cdb[1] = 4 << 1;		/* PROTOCOL: PIO Data-in */
-	cdb[2] = 0x2e;			/* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */
-	cdb[3] = 0;			/* FEATURES */
-	cdb[4] = 0;			/* FEATURES */
-	cdb[5] = 0;			/* SECTORS */
-	cdb[6] = 1;			/* SECTORS */
-	cdb[7] = 0;			/* LBA LOW */
-	cdb[8] = 0;			/* LBA LOW */
-	cdb[9] = 0;			/* LBA MID */
-	cdb[10] = 0;			/* LBA MID */
-	cdb[11] = 0;			/* LBA HIGH */
-	cdb[12] = 0;			/* LBA HIGH */
-	cdb[13] = 0;			/* DEVICE */
-	cdb[14] = 0xA1;			/* Command: ATA IDENTIFY PACKET DEVICE */;
-	cdb[15] = 0;			/* CONTROL */
-	memset(sense, 0, sizeof(sense));
-
-	memset(&io_v4, 0, sizeof(struct sg_io_v4));
-	io_v4.guard = 'Q';
-	io_v4.protocol = BSG_PROTOCOL_SCSI;
-	io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD;
-	io_v4.request_len = sizeof (cdb);
-	io_v4.request = (uintptr_t) cdb;
-	io_v4.max_response_len = sizeof (sense);
-	io_v4.response = (uintptr_t) sense;
-	io_v4.din_xfer_len = buf_len;
-	io_v4.din_xferp = (uintptr_t) buf;
-	io_v4.timeout = COMMAND_TIMEOUT_MSEC;
-
-	ret = ioctl(fd, SG_IO, &io_v4);
-	if (ret != 0) {
-		/* could be that the driver doesn't do version 4, try version 3 */
-		if (errno == EINVAL) {
-			struct sg_io_hdr io_hdr;
-
-			memset(&io_hdr, 0, sizeof(struct sg_io_hdr));
-			io_hdr.interface_id = 'S';
-			io_hdr.cmdp = (unsigned char*) cdb;
-			io_hdr.cmd_len = sizeof (cdb);
-			io_hdr.dxferp = buf;
-			io_hdr.dxfer_len = buf_len;
-			io_hdr.sbp = sense;
-			io_hdr.mx_sb_len = sizeof (sense);
-			io_hdr.dxfer_direction = SG_DXFER_FROM_DEV;
-			io_hdr.timeout = COMMAND_TIMEOUT_MSEC;
-
-			ret = ioctl(fd, SG_IO, &io_hdr);
-			if (ret != 0)
-				goto out;
-		} else {
-			goto out;
-		}
-	}
-
-	if (!(sense[0] == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c)) {
-		errno = EIO;
-		ret = -1;
-		goto out;
-	}
+        struct sg_io_v4 io_v4;
+        uint8_t cdb[16];
+        uint8_t sense[32];
+        uint8_t *desc = sense+8;
+        int ret;
+
+        /*
+         * ATA Pass-Through 16 byte command, as described in
+         *
+         *  T10 04-262r8 ATA Command Pass-Through
+         *
+         * from http://www.t10.org/ftp/t10/document.04/04-262r8.pdf
+         */
+        memset(cdb, 0, sizeof(cdb));
+        cdb[0] = 0x85;                        /* OPERATION CODE: 16 byte pass through */
+        cdb[1] = 4 << 1;                /* PROTOCOL: PIO Data-in */
+        cdb[2] = 0x2e;                        /* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */
+        cdb[3] = 0;                        /* FEATURES */
+        cdb[4] = 0;                        /* FEATURES */
+        cdb[5] = 0;                        /* SECTORS */
+        cdb[6] = 1;                        /* SECTORS */
+        cdb[7] = 0;                        /* LBA LOW */
+        cdb[8] = 0;                        /* LBA LOW */
+        cdb[9] = 0;                        /* LBA MID */
+        cdb[10] = 0;                        /* LBA MID */
+        cdb[11] = 0;                        /* LBA HIGH */
+        cdb[12] = 0;                        /* LBA HIGH */
+        cdb[13] = 0;                        /* DEVICE */
+        cdb[14] = 0xA1;                        /* Command: ATA IDENTIFY PACKET DEVICE */;
+        cdb[15] = 0;                        /* CONTROL */
+        memset(sense, 0, sizeof(sense));
+
+        memset(&io_v4, 0, sizeof(struct sg_io_v4));
+        io_v4.guard = 'Q';
+        io_v4.protocol = BSG_PROTOCOL_SCSI;
+        io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD;
+        io_v4.request_len = sizeof (cdb);
+        io_v4.request = (uintptr_t) cdb;
+        io_v4.max_response_len = sizeof (sense);
+        io_v4.response = (uintptr_t) sense;
+        io_v4.din_xfer_len = buf_len;
+        io_v4.din_xferp = (uintptr_t) buf;
+        io_v4.timeout = COMMAND_TIMEOUT_MSEC;
+
+        ret = ioctl(fd, SG_IO, &io_v4);
+        if (ret != 0) {
+                /* could be that the driver doesn't do version 4, try version 3 */
+                if (errno == EINVAL) {
+                        struct sg_io_hdr io_hdr;
+
+                        memset(&io_hdr, 0, sizeof(struct sg_io_hdr));
+                        io_hdr.interface_id = 'S';
+                        io_hdr.cmdp = (unsigned char*) cdb;
+                        io_hdr.cmd_len = sizeof (cdb);
+                        io_hdr.dxferp = buf;
+                        io_hdr.dxfer_len = buf_len;
+                        io_hdr.sbp = sense;
+                        io_hdr.mx_sb_len = sizeof (sense);
+                        io_hdr.dxfer_direction = SG_DXFER_FROM_DEV;
+                        io_hdr.timeout = COMMAND_TIMEOUT_MSEC;
+
+                        ret = ioctl(fd, SG_IO, &io_hdr);
+                        if (ret != 0)
+                                goto out;
+                } else {
+                        goto out;
+                }
+        }
+
+        if (!(sense[0] == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c)) {
+                errno = EIO;
+                ret = -1;
+                goto out;
+        }
 
  out:
-	return ret;
+        return ret;
 }
 
 /**
  * Copies the ATA string from @identify located at @offset_words into @dest.
  */
 static void disk_identify_get_string (uint8_t identify[512],
-				      unsigned int offset_words,
-				      char *dest,
-				      size_t dest_len)
+                                      unsigned int offset_words,
+                                      char *dest,
+                                      size_t dest_len)
 {
-	unsigned int c1;
-	unsigned int c2;
-
-	assert (identify != NULL);
-	assert (dest != NULL);
-	assert ((dest_len & 1) == 0);
-
-	while (dest_len > 0) {
-		c1 = ((uint16_t *) identify)[offset_words] >> 8;
-		c2 = ((uint16_t *) identify)[offset_words] & 0xff;
-		*dest = c1;
-		dest++;
-		*dest = c2;
-		dest++;
-		offset_words++;
-		dest_len -= 2;
-	}
+        unsigned int c1;
+        unsigned int c2;
+
+        assert (identify != NULL);
+        assert (dest != NULL);
+        assert ((dest_len & 1) == 0);
+
+        while (dest_len > 0) {
+                c1 = ((uint16_t *) identify)[offset_words] >> 8;
+                c2 = ((uint16_t *) identify)[offset_words] & 0xff;
+                *dest = c1;
+                dest++;
+                *dest = c2;
+                dest++;
+                offset_words++;
+                dest_len -= 2;
+        }
 }
 
 static void disk_identify_fixup_string (uint8_t identify[512],
-					unsigned int offset_words,
-					size_t len)
+                                        unsigned int offset_words,
+                                        size_t len)
 {
-	disk_identify_get_string(identify, offset_words,
-				 (char *) identify + offset_words * 2, len);
+        disk_identify_get_string(identify, offset_words,
+                                 (char *) identify + offset_words * 2, len);
 }
 
 static void disk_identify_fixup_uint16 (uint8_t identify[512], unsigned int offset_words)
 {
-	uint16_t *p;
+        uint16_t *p;
 
-	p = (uint16_t *) identify;
-	p[offset_words] = le16toh (p[offset_words]);
+        p = (uint16_t *) identify;
+        p[offset_words] = le16toh (p[offset_words]);
 }
 
 /**
  * non-zero with errno set.
  */
 static int disk_identify (struct udev *udev,
-			  int	       fd,
-			  uint8_t      out_identify[512],
-			  int	      *out_is_packet_device)
+                          int               fd,
+                          uint8_t      out_identify[512],
+                          int              *out_is_packet_device)
 {
-	int ret;
-	uint8_t inquiry_buf[36];
-	int peripheral_device_type;
-	int all_nul_bytes;
-	int n;
-	int is_packet_device;
-
-	assert (out_identify != NULL);
-
-	/* init results */
-	ret = -1;
-	memset (out_identify, '\0', 512);
-	is_packet_device = 0;
-
-	/* If we were to use ATA PASS_THROUGH (12) on an ATAPI device
-	 * we could accidentally blank media. This is because MMC's BLANK
-	 * command has the same op-code (0x61).
-	 *
-	 * To prevent this from happening we bail out if the device
-	 * isn't a Direct Access Block Device, e.g. SCSI type 0x00
-	 * (CD/DVD devices are type 0x05). So we send a SCSI INQUIRY
-	 * command first... libata is handling this via its SCSI
-	 * emulation layer.
-	 *
-	 * This also ensures that we're actually dealing with a device
-	 * that understands SCSI commands.
-	 *
-	 * (Yes, it is a bit perverse that we're tunneling the ATA
-	 * command through SCSI and relying on the ATA driver
-	 * emulating SCSI well-enough...)
-	 *
-	 * (See commit 160b069c25690bfb0c785994c7c3710289179107 for
-	 * the original bug-fix and see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=556635
-	 * for the original bug-report.)
-	 */
-	ret = disk_scsi_inquiry_command (fd, inquiry_buf, sizeof (inquiry_buf));
-	if (ret != 0)
-		goto out;
-
-	/* SPC-4, section 6.4.2: Standard INQUIRY data */
-	peripheral_device_type = inquiry_buf[0] & 0x1f;
-	if (peripheral_device_type == 0x05)
-	  {
-	    is_packet_device = 1;
-	    ret = disk_identify_packet_device_command(fd, out_identify, 512);
-	    goto check_nul_bytes;
-	  }
-	if (peripheral_device_type != 0x00) {
-		ret = -1;
-		errno = EIO;
-		goto out;
-	}
-
-	/* OK, now issue the IDENTIFY DEVICE command */
-	ret = disk_identify_command(fd, out_identify, 512);
-	if (ret != 0)
-		goto out;
+        int ret;
+        uint8_t inquiry_buf[36];
+        int peripheral_device_type;
+        int all_nul_bytes;
+        int n;
+        int is_packet_device;
+
+        assert (out_identify != NULL);
+
+        /* init results */
+        ret = -1;
+        memset (out_identify, '\0', 512);
+        is_packet_device = 0;
+
+        /* If we were to use ATA PASS_THROUGH (12) on an ATAPI device
+         * we could accidentally blank media. This is because MMC's BLANK
+         * command has the same op-code (0x61).
+         *
+         * To prevent this from happening we bail out if the device
+         * isn't a Direct Access Block Device, e.g. SCSI type 0x00
+         * (CD/DVD devices are type 0x05). So we send a SCSI INQUIRY
+         * command first... libata is handling this via its SCSI
+         * emulation layer.
+         *
+         * This also ensures that we're actually dealing with a device
+         * that understands SCSI commands.
+         *
+         * (Yes, it is a bit perverse that we're tunneling the ATA
+         * command through SCSI and relying on the ATA driver
+         * emulating SCSI well-enough...)
+         *
+         * (See commit 160b069c25690bfb0c785994c7c3710289179107 for
+         * the original bug-fix and see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=556635
+         * for the original bug-report.)
+         */
+        ret = disk_scsi_inquiry_command (fd, inquiry_buf, sizeof (inquiry_buf));
+        if (ret != 0)
+                goto out;
+
+        /* SPC-4, section 6.4.2: Standard INQUIRY data */
+        peripheral_device_type = inquiry_buf[0] & 0x1f;
+        if (peripheral_device_type == 0x05)
+          {
+            is_packet_device = 1;
+            ret = disk_identify_packet_device_command(fd, out_identify, 512);
+            goto check_nul_bytes;
+          }
+        if (peripheral_device_type != 0x00) {
+                ret = -1;
+                errno = EIO;
+                goto out;
+        }
+
+        /* OK, now issue the IDENTIFY DEVICE command */
+        ret = disk_identify_command(fd, out_identify, 512);
+        if (ret != 0)
+                goto out;
 
  check_nul_bytes:
-	 /* Check if IDENTIFY data is all NUL bytes - if so, bail */
-	all_nul_bytes = 1;
-	for (n = 0; n < 512; n++) {
-		if (out_identify[n] != '\0') {
-			all_nul_bytes = 0;
-			break;
-		}
-	}
-
-	if (all_nul_bytes) {
-		ret = -1;
-		errno = EIO;
-		goto out;
-	}
+         /* Check if IDENTIFY data is all NUL bytes - if so, bail */
+        all_nul_bytes = 1;
+        for (n = 0; n < 512; n++) {
+                if (out_identify[n] != '\0') {
+                        all_nul_bytes = 0;
+                        break;
+                }
+        }
+
+        if (all_nul_bytes) {
+                ret = -1;
+                errno = EIO;
+                goto out;
+        }
 
 out:
-	if (out_is_packet_device != NULL)
-	  *out_is_packet_device = is_packet_device;
-	return ret;
+        if (out_is_packet_device != NULL)
+          *out_is_packet_device = is_packet_device;
+        return ret;
 }
 
 static void log_fn(struct udev *udev, int priority,
-		   const char *file, int line, const char *fn,
-		   const char *format, va_list args)
+                   const char *file, int line, const char *fn,
+                   const char *format, va_list args)
 {
-	vsyslog(priority, format, args);
+        vsyslog(priority, format, args);
 }
 
 int main(int argc, char *argv[])
 {
-	struct udev *udev;
-	struct hd_driveid id;
-	uint8_t identify[512];
-	uint16_t *identify_words;
-	char model[41];
-	char model_enc[256];
-	char serial[21];
-	char revision[9];
-	const char *node = NULL;
-	int export = 0;
-	int fd;
-	uint16_t word;
-	int rc = 0;
-	int is_packet_device = 0;
-	static const struct option options[] = {
-		{ "export", no_argument, NULL, 'x' },
-		{ "help", no_argument, NULL, 'h' },
-		{}
-	};
-
-	udev = udev_new();
-	if (udev == NULL)
-		goto exit;
-
-	udev_log_init("ata_id");
-	udev_set_log_fn(udev, log_fn);
-
-	while (1) {
-		int option;
-
-		option = getopt_long(argc, argv, "xh", options, NULL);
-		if (option == -1)
-			break;
-
-		switch (option) {
-		case 'x':
-			export = 1;
-			break;
-		case 'h':
-			printf("Usage: ata_id [--export] [--help] <device>\n"
-			       "  --export    print values as environment keys\n"
-			       "  --help      print this help text\n\n");
-			goto exit;
-		}
-	}
-
-	node = argv[optind];
-	if (node == NULL) {
-		err(udev, "no node specified\n");
-		rc = 1;
-		goto exit;
-	}
-
-	fd = open(node, O_RDONLY|O_NONBLOCK);
-	if (fd < 0) {
-		err(udev, "unable to open '%s'\n", node);
-		rc = 1;
-		goto exit;
-	}
-
-	if (disk_identify(udev, fd, identify, &is_packet_device) == 0) {
-		/*
-		 * fix up only the fields from the IDENTIFY data that we are going to
-		 * use and copy it into the hd_driveid struct for convenience
-		 */
-		disk_identify_fixup_string (identify,  10, 20);	/* serial */
-		disk_identify_fixup_string (identify,  23,  6);	/* fwrev */
-		disk_identify_fixup_string (identify,  27, 40);	/* model */
-		disk_identify_fixup_uint16 (identify,	0);	/* configuration */
-		disk_identify_fixup_uint16 (identify,  75);	/* queue depth */
-		disk_identify_fixup_uint16 (identify,  75);	/* SATA capabilities */
-		disk_identify_fixup_uint16 (identify,  82);	/* command set supported */
-		disk_identify_fixup_uint16 (identify,  83);	/* command set supported */
-		disk_identify_fixup_uint16 (identify,  84);	/* command set supported */
-		disk_identify_fixup_uint16 (identify,  85);	/* command set supported */
-		disk_identify_fixup_uint16 (identify,  86);	/* command set supported */
-		disk_identify_fixup_uint16 (identify,  87);	/* command set supported */
-		disk_identify_fixup_uint16 (identify,  89);	/* time required for SECURITY ERASE UNIT */
-		disk_identify_fixup_uint16 (identify,  90);	/* time required for enhanced SECURITY ERASE UNIT */
-		disk_identify_fixup_uint16 (identify,  91);	/* current APM values */
-		disk_identify_fixup_uint16 (identify,  94);	/* current AAM value */
-		disk_identify_fixup_uint16 (identify, 128);	/* device lock function */
-		disk_identify_fixup_uint16 (identify, 217);	/* nominal media rotation rate */
-		memcpy(&id, identify, sizeof id);
-	} else {
-		/* If this fails, then try HDIO_GET_IDENTITY */
-		if (ioctl(fd, HDIO_GET_IDENTITY, &id) != 0) {
-			if (errno == ENOTTY) {
-				info(udev, "HDIO_GET_IDENTITY unsupported for '%s'\n", node);
-				rc = 2;
-			} else {
-				err(udev, "HDIO_GET_IDENTITY failed for '%s': %m\n", node);
-				rc = 3;
-			}
-			goto close;
-		}
-	}
-	identify_words = (uint16_t *) identify;
-
-	memcpy (model, id.model, 40);
-	model[40] = '\0';
-	udev_util_encode_string(model, model_enc, sizeof(model_enc));
-	util_replace_whitespace((char *) id.model, model, 40);
-	util_replace_chars(model, NULL);
-	util_replace_whitespace((char *) id.serial_no, serial, 20);
-	util_replace_chars(serial, NULL);
-	util_replace_whitespace((char *) id.fw_rev, revision, 8);
-	util_replace_chars(revision, NULL);
-
-	if (export) {
-		/* Set this to convey the disk speaks the ATA protocol */
-		printf("ID_ATA=1\n");
-
-		if ((id.config >> 8) & 0x80) {
-			/* This is an ATAPI device */
-			switch ((id.config >> 8) & 0x1f) {
-			case 0:
-				printf("ID_TYPE=cd\n");
-				break;
-			case 1:
-				printf("ID_TYPE=tape\n");
-				break;
-			case 5:
-				printf("ID_TYPE=cd\n");
-				break;
-			case 7:
-				printf("ID_TYPE=optical\n");
-				break;
-			default:
-				printf("ID_TYPE=generic\n");
-				break;
-			}
-		} else {
-			printf("ID_TYPE=disk\n");
-		}
-		printf("ID_BUS=ata\n");
-		printf("ID_MODEL=%s\n", model);
-		printf("ID_MODEL_ENC=%s\n", model_enc);
-		printf("ID_REVISION=%s\n", revision);
-		if (serial[0] != '\0') {
-			printf("ID_SERIAL=%s_%s\n", model, serial);
-			printf("ID_SERIAL_SHORT=%s\n", serial);
-		} else {
-			printf("ID_SERIAL=%s\n", model);
-		}
-
-		if (id.command_set_1 & (1<<5)) {
-			printf ("ID_ATA_WRITE_CACHE=1\n");
-			printf ("ID_ATA_WRITE_CACHE_ENABLED=%d\n", (id.cfs_enable_1 & (1<<5)) ? 1 : 0);
-		}
-		if (id.command_set_1 & (1<<10)) {
-			printf("ID_ATA_FEATURE_SET_HPA=1\n");
-			printf("ID_ATA_FEATURE_SET_HPA_ENABLED=%d\n", (id.cfs_enable_1 & (1<<10)) ? 1 : 0);
-
-			/*
-			 * TODO: use the READ NATIVE MAX ADDRESS command to get the native max address
-			 * so it is easy to check whether the protected area is in use.
-			 */
-		}
-		if (id.command_set_1 & (1<<3)) {
-			printf("ID_ATA_FEATURE_SET_PM=1\n");
-			printf("ID_ATA_FEATURE_SET_PM_ENABLED=%d\n", (id.cfs_enable_1 & (1<<3)) ? 1 : 0);
-		}
-		if (id.command_set_1 & (1<<1)) {
-			printf("ID_ATA_FEATURE_SET_SECURITY=1\n");
-			printf("ID_ATA_FEATURE_SET_SECURITY_ENABLED=%d\n", (id.cfs_enable_1 & (1<<1)) ? 1 : 0);
-			printf("ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=%d\n", id.trseuc * 2);
-			if ((id.cfs_enable_1 & (1<<1))) /* enabled */ {
-				if (id.dlf & (1<<8))
-					printf("ID_ATA_FEATURE_SET_SECURITY_LEVEL=maximum\n");
-				else
-					printf("ID_ATA_FEATURE_SET_SECURITY_LEVEL=high\n");
-			}
-			if (id.dlf & (1<<5))
-				printf("ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=%d\n", id.trsEuc * 2);
-			if (id.dlf & (1<<4))
-				printf("ID_ATA_FEATURE_SET_SECURITY_EXPIRE=1\n");
-			if (id.dlf & (1<<3))
-				printf("ID_ATA_FEATURE_SET_SECURITY_FROZEN=1\n");
-			if (id.dlf & (1<<2))
-				printf("ID_ATA_FEATURE_SET_SECURITY_LOCKED=1\n");
-		}
-		if (id.command_set_1 & (1<<0)) {
-			printf("ID_ATA_FEATURE_SET_SMART=1\n");
-			printf("ID_ATA_FEATURE_SET_SMART_ENABLED=%d\n", (id.cfs_enable_1 & (1<<0)) ? 1 : 0);
-		}