Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Jun 2019 20:19:03 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r349341 - head/sbin/camcontrol
Message-ID:  <201906242019.x5OKJ3Rl048672@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Mon Jun 24 20:19:03 2019
New Revision: 349341
URL: https://svnweb.freebsd.org/changeset/base/349341

Log:
  Use ata_param_fixup instead of a custom copy here

Modified:
  head/sbin/camcontrol/camcontrol.c

Modified: head/sbin/camcontrol/camcontrol.c
==============================================================================
--- head/sbin/camcontrol/camcontrol.c	Mon Jun 24 20:18:58 2019	(r349340)
+++ head/sbin/camcontrol/camcontrol.c	Mon Jun 24 20:19:03 2019	(r349341)
@@ -2326,9 +2326,11 @@ ata_do_identify(struct cam_device *device, int retry_c
 		}
 	}
 
+	ident_buf = (struct ata_params *)ptr;
+	ata_param_fixup(ident_buf);
+
 	error = 1;
 	for (i = 0; i < sizeof(struct ata_params) / 2; i++) {
-		ptr[i] = le16toh(ptr[i]);
 		if (ptr[i] != 0)
 			error = 0;
 	}
@@ -2345,26 +2347,6 @@ ata_do_identify(struct cam_device *device, int retry_c
 		free(ptr);
 		return (error);
 	}
-
-	ident_buf = (struct ata_params *)ptr;
-	if (strncmp(ident_buf->model, "FX", 2) &&
-	    strncmp(ident_buf->model, "NEC", 3) &&
-	    strncmp(ident_buf->model, "Pioneer", 7) &&
-	    strncmp(ident_buf->model, "SHARP", 5)) {
-		ata_bswap(ident_buf->model, sizeof(ident_buf->model));
-		ata_bswap(ident_buf->revision, sizeof(ident_buf->revision));
-		ata_bswap(ident_buf->serial, sizeof(ident_buf->serial));
-		ata_bswap(ident_buf->media_serial, sizeof(ident_buf->media_serial));
-	}
-	ata_btrim(ident_buf->model, sizeof(ident_buf->model));
-	ata_bpack(ident_buf->model, ident_buf->model, sizeof(ident_buf->model));
-	ata_btrim(ident_buf->revision, sizeof(ident_buf->revision));
-	ata_bpack(ident_buf->revision, ident_buf->revision, sizeof(ident_buf->revision));
-	ata_btrim(ident_buf->serial, sizeof(ident_buf->serial));
-	ata_bpack(ident_buf->serial, ident_buf->serial, sizeof(ident_buf->serial));
-	ata_btrim(ident_buf->media_serial, sizeof(ident_buf->media_serial));
-	ata_bpack(ident_buf->media_serial, ident_buf->media_serial,
-	    sizeof(ident_buf->media_serial));
 
 	*ident_bufp = ident_buf;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906242019.x5OKJ3Rl048672>