Re: [PATCH] support HDIO_GET_IDENTITY in libata

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alexey Dobriyan wrote:
On Thu, Dec 14, 2006 at 01:26:08PM -0700, Erik Andersen wrote:
On Thu Dec 14, 2006 at 03:05:52PM -0500, Jeff Garzik wrote:
FWIW, libata generally follows a "implement it, if enough people care
about it" policy for the old HDIO_xxx ioctls.
I personally care about HDIO_GET_IDENTITY and find it terribly
useful to quickly find out about a drive.  Perhaps enough other
people care about this ioctl that it might make it into the official
libata tree.  Well tested with a number of months of use.

--- orig/drivers/ata/libata-scsi.c
+++ linux-2.6.18/drivers/ata/libata-scsi.c
@@ -303,6 +303,172 @@
 	return rc;
 }

+static void ide_fixstring (u8 *s, const int bytecount)
+{
+	u8 *p = s, *end = &s[bytecount & ~1]; /* bytecount must be even */
+
+#ifndef __BIG_ENDIAN
+# ifdef __LITTLE_ENDIAN
+	/* convert from big-endian to host byte order */
+	for (p = end ; p != s;) {
+		unsigned short *pp = (unsigned short *) (p -= 2);
+		*pp = ntohs(*pp);
+	}
+# else
+#  error "Please fix <asm/byteorder.h>"
+# endif
+#endif

Ugly. ntohs() will work on BE arches also.

+static void ide_fix_driveid (struct hd_driveid *id)
+{
+#ifndef __LITTLE_ENDIAN
+# ifdef __BIG_ENDIAN

Ditto.

Agreed...

	Jeff



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux