git: 9db2db6bf665 - main - cam/ata: Migrate to modern uintXX_t from u_intXX_t

From: Warner Losh <imp_at_FreeBSD.org>
Date: Tue, 25 Jul 2023 04:26:29 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=9db2db6bf665983cc46ee4f413b1f812f1b6c857

commit 9db2db6bf665983cc46ee4f413b1f812f1b6c857
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2023-07-25 03:17:41 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-07-25 03:32:56 +0000

    cam/ata: Migrate to modern uintXX_t from u_intXX_t
    
    As per https://lists.freebsd.org/archives/freebsd-scsi/2023-July/000257.html
    move to the modern uintXX_t.
    
    MFC After:      3 days
    Sponsored by:   Netflix
---
 sys/cam/ata/ata_all.c | 16 +++++++-------
 sys/cam/ata/ata_all.h | 60 +++++++++++++++++++++++++--------------------------
 sys/cam/ata/ata_da.c  | 46 +++++++++++++++++++--------------------
 sys/cam/ata/ata_pmp.c |  6 +++---
 sys/cam/ata/ata_xpt.c | 20 ++++++++---------
 5 files changed, 74 insertions(+), 74 deletions(-)

diff --git a/sys/cam/ata/ata_all.c b/sys/cam/ata/ata_all.c
index 4e95a8f1568c..b40cebb9e171 100644
--- a/sys/cam/ata/ata_all.c
+++ b/sys/cam/ata/ata_all.c
@@ -587,8 +587,8 @@ ata_logical_sector_size(struct ata_params *ident_data)
 {
 	if ((ident_data->pss & ATA_PSS_VALID_MASK) == ATA_PSS_VALID_VALUE &&
 	    (ident_data->pss & ATA_PSS_LSSABOVE512)) {
-		return (((u_int32_t)ident_data->lss_1 |
-		    ((u_int32_t)ident_data->lss_2 << 16)) * 2);
+		return (((uint32_t)ident_data->lss_1 |
+		    ((uint32_t)ident_data->lss_2 << 16)) * 2);
 	}
 	return (512);
 }
@@ -761,9 +761,9 @@ ata_read_log(struct ccb_ataio *ataio, uint32_t retries,
 void
 ata_bswap(int8_t *buf, int len)
 {
-	u_int16_t *ptr = (u_int16_t*)(buf + len);
+	uint16_t *ptr = (uint16_t*)(buf + len);
 
-	while (--ptr >= (u_int16_t*)buf)
+	while (--ptr >= (uint16_t*)buf)
 		*ptr = be16toh(*ptr);
 }
 
@@ -1037,7 +1037,7 @@ ata_static_identify_match(caddr_t identbuffer, caddr_t table_entry)
 
 void
 semb_receive_diagnostic_results(struct ccb_ataio *ataio,
-    u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*),
+    uint32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*),
     uint8_t tag_action, int pcv, uint8_t page_code,
     uint8_t *data_ptr, uint16_t length, uint32_t timeout)
 {
@@ -1058,7 +1058,7 @@ semb_receive_diagnostic_results(struct ccb_ataio *ataio,
 
 void
 semb_send_diagnostic(struct ccb_ataio *ataio,
-    u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *),
+    uint32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *),
     uint8_t tag_action, uint8_t *data_ptr, uint16_t length, uint32_t timeout)
 {
 
@@ -1078,7 +1078,7 @@ semb_send_diagnostic(struct ccb_ataio *ataio,
 
 void
 semb_read_buffer(struct ccb_ataio *ataio,
-    u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*),
+    uint32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*),
     uint8_t tag_action, uint8_t page_code,
     uint8_t *data_ptr, uint16_t length, uint32_t timeout)
 {
@@ -1099,7 +1099,7 @@ semb_read_buffer(struct ccb_ataio *ataio,
 
 void
 semb_write_buffer(struct ccb_ataio *ataio,
-    u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *),
+    uint32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *),
     uint8_t tag_action, uint8_t *data_ptr, uint16_t length, uint32_t timeout)
 {
 
diff --git a/sys/cam/ata/ata_all.h b/sys/cam/ata/ata_all.h
index a8fab2c2c4c7..c8c427a75d8c 100644
--- a/sys/cam/ata/ata_all.h
+++ b/sys/cam/ata/ata_all.h
@@ -42,49 +42,49 @@ union  ccb;
 #define	SID_DMA		0x10 /* Abuse inq_flags bit to track enabled DMA. */
 
 struct ata_cmd {
-	u_int8_t	flags;		/* ATA command flags */
+	uint8_t	flags;		/* ATA command flags */
 #define		CAM_ATAIO_48BIT		0x01	/* Command has 48-bit format */
 #define		CAM_ATAIO_FPDMA		0x02	/* FPDMA command */
 #define		CAM_ATAIO_CONTROL	0x04	/* Control, not a command */
 #define		CAM_ATAIO_NEEDRESULT	0x08	/* Request requires result. */
 #define		CAM_ATAIO_DMA		0x10	/* DMA command */
 
-	u_int8_t	command;
-	u_int8_t	features;
+	uint8_t	command;
+	uint8_t	features;
 
-	u_int8_t	lba_low;
-	u_int8_t	lba_mid;
-	u_int8_t	lba_high;
-	u_int8_t	device;
+	uint8_t	lba_low;
+	uint8_t	lba_mid;
+	uint8_t	lba_high;
+	uint8_t	device;
 
-	u_int8_t	lba_low_exp;
-	u_int8_t	lba_mid_exp;
-	u_int8_t	lba_high_exp;
-	u_int8_t	features_exp;
+	uint8_t	lba_low_exp;
+	uint8_t	lba_mid_exp;
+	uint8_t	lba_high_exp;
+	uint8_t	features_exp;
 
-	u_int8_t	sector_count;
-	u_int8_t	sector_count_exp;
-	u_int8_t	control;
+	uint8_t	sector_count;
+	uint8_t	sector_count_exp;
+	uint8_t	control;
 };
 
 struct ata_res {
-	u_int8_t	flags;		/* ATA command flags */
+	uint8_t	flags;		/* ATA command flags */
 #define		CAM_ATAIO_48BIT		0x01	/* Command has 48-bit format */
 
-	u_int8_t	status;
-	u_int8_t	error;
+	uint8_t	status;
+	uint8_t	error;
 
-	u_int8_t	lba_low;
-	u_int8_t	lba_mid;
-	u_int8_t	lba_high;
-	u_int8_t	device;
+	uint8_t	lba_low;
+	uint8_t	lba_mid;
+	uint8_t	lba_high;
+	uint8_t	device;
 
-	u_int8_t	lba_low_exp;
-	u_int8_t	lba_mid_exp;
-	u_int8_t	lba_high_exp;
+	uint8_t	lba_low_exp;
+	uint8_t	lba_mid_exp;
+	uint8_t	lba_high_exp;
 
-	u_int8_t	sector_count;
-	u_int8_t	sector_count_exp;
+	uint8_t	sector_count;
+	uint8_t	sector_count_exp;
 };
 
 struct sep_identify_data {
@@ -160,22 +160,22 @@ void	semb_print_ident_short(struct sep_identify_data *ident_data);
 void	semb_print_ident_short_sbuf(struct sep_identify_data *ident_data, struct sbuf *sb);
 
 void semb_receive_diagnostic_results(struct ccb_ataio *ataio,
-	u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*),
+	uint32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*),
 	uint8_t tag_action, int pcv, uint8_t page_code,
 	uint8_t *data_ptr, uint16_t allocation_length, uint32_t timeout);
 
 void semb_send_diagnostic(struct ccb_ataio *ataio,
-	u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *),
+	uint32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *),
 	uint8_t tag_action, uint8_t *data_ptr, uint16_t param_list_length,
 	uint32_t timeout);
 
 void semb_read_buffer(struct ccb_ataio *ataio,
-	u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*),
+	uint32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*),
 	uint8_t tag_action, uint8_t page_code,
 	uint8_t *data_ptr, uint16_t allocation_length, uint32_t timeout);
 
 void semb_write_buffer(struct ccb_ataio *ataio,
-	u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *),
+	uint32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *),
 	uint8_t tag_action, uint8_t *data_ptr, uint16_t param_list_length,
 	uint32_t timeout);
 
diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c
index c5dc239828a5..cd0be88ba3c4 100644
--- a/sys/cam/ata/ata_da.c
+++ b/sys/cam/ata/ata_da.c
@@ -233,11 +233,11 @@ static const char *ada_delete_method_desc[] =
 #endif
 
 struct disk_params {
-	u_int8_t  heads;
-	u_int8_t  secs_per_track;
-	u_int32_t cylinders;
-	u_int32_t secsize;	/* Number of bytes/logical sector */
-	u_int64_t sectors;	/* Total number sectors */
+	uint8_t  heads;
+	uint8_t  secs_per_track;
+	uint32_t cylinders;
+	uint32_t secsize;	/* Number of bytes/logical sector */
+	uint64_t sectors;	/* Total number sectors */
 };
 
 #define TRIM_MAX_BLOCKS	8
@@ -832,7 +832,7 @@ static	periph_init_t	adainit;
 static	void		adadiskgonecb(struct disk *dp);
 static	periph_oninv_t	adaoninvalidate;
 static	periph_dtor_t	adacleanup;
-static	void		adaasync(void *callback_arg, u_int32_t code,
+static	void		adaasync(void *callback_arg, uint32_t code,
 				struct cam_path *path, void *arg);
 static	int		adabitsysctl(SYSCTL_HANDLER_ARGS);
 static	int		adaflagssysctl(SYSCTL_HANDLER_ARGS);
@@ -856,8 +856,8 @@ static	void		adaprobedone(struct cam_periph *periph, union ccb *ccb);
 static	void		adazonedone(struct cam_periph *periph, union ccb *ccb);
 static	void		adadone(struct cam_periph *periph,
 			       union ccb *done_ccb);
-static  int		adaerror(union ccb *ccb, u_int32_t cam_flags,
-				u_int32_t sense_flags);
+static  int		adaerror(union ccb *ccb, uint32_t cam_flags,
+				uint32_t sense_flags);
 static callout_func_t	adasendorderedtag;
 static void		adashutdown(void *arg, int howto);
 static void		adasuspend(void *arg);
@@ -1128,7 +1128,7 @@ adadump(void *arg, void *virtual, off_t offset, size_t length)
 		    NULL,
 		    CAM_DIR_OUT,
 		    0,
-		    (u_int8_t *) virtual,
+		    (uint8_t *) virtual,
 		    length,
 		    ada_default_timeout*1000);
 		if ((softc->flags & ADA_FLAG_CAN_48BIT) &&
@@ -1300,7 +1300,7 @@ adasetdeletemethod(struct ada_softc *softc)
 }
 
 static void
-adaasync(void *callback_arg, u_int32_t code,
+adaasync(void *callback_arg, uint32_t code,
 	struct cam_path *path, void *arg)
 {
 	struct ccb_getdev cgd;
@@ -2321,7 +2321,7 @@ adastart(struct cam_periph *periph, union ccb *start_ccb)
 	case ADA_STATE_NORMAL:
 	{
 		struct bio *bp;
-		u_int8_t tag_code;
+		uint8_t tag_code;
 
 		bp = cam_iosched_next_bio(softc->cam_iosched);
 		if (bp == NULL) {
@@ -3382,7 +3382,7 @@ adadone(struct cam_periph *periph, union ccb *done_ccb)
 }
 
 static int
-adaerror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags)
+adaerror(union ccb *ccb, uint32_t cam_flags, uint32_t sense_flags)
 {
 #ifdef CAM_IO_STATS
 	struct ada_softc *softc;
@@ -3415,8 +3415,8 @@ static void
 adasetgeom(struct ada_softc *softc, struct ccb_getdev *cgd)
 {
 	struct disk_params *dp = &softc->params;
-	u_int64_t lbasize48;
-	u_int32_t lbasize;
+	uint64_t lbasize48;
+	uint32_t lbasize;
 	u_int maxio, d_flags;
 	size_t tmpsize;
 
@@ -3427,27 +3427,27 @@ adasetgeom(struct ada_softc *softc, struct ccb_getdev *cgd)
 		dp->heads = cgd->ident_data.current_heads;
 		dp->secs_per_track = cgd->ident_data.current_sectors;
 		dp->cylinders = cgd->ident_data.cylinders;
-		dp->sectors = (u_int32_t)cgd->ident_data.current_size_1 |
-			  ((u_int32_t)cgd->ident_data.current_size_2 << 16);
+		dp->sectors = (uint32_t)cgd->ident_data.current_size_1 |
+			  ((uint32_t)cgd->ident_data.current_size_2 << 16);
 	} else {
 		dp->heads = cgd->ident_data.heads;
 		dp->secs_per_track = cgd->ident_data.sectors;
 		dp->cylinders = cgd->ident_data.cylinders;
 		dp->sectors = cgd->ident_data.cylinders *
-			      (u_int32_t)(dp->heads * dp->secs_per_track);
+			      (uint32_t)(dp->heads * dp->secs_per_track);
 	}
-	lbasize = (u_int32_t)cgd->ident_data.lba_size_1 |
-		  ((u_int32_t)cgd->ident_data.lba_size_2 << 16);
+	lbasize = (uint32_t)cgd->ident_data.lba_size_1 |
+		  ((uint32_t)cgd->ident_data.lba_size_2 << 16);
 
 	/* use the 28bit LBA size if valid or bigger than the CHS mapping */
 	if (cgd->ident_data.cylinders == 16383 || dp->sectors < lbasize)
 		dp->sectors = lbasize;
 
 	/* use the 48bit LBA size if valid */
-	lbasize48 = ((u_int64_t)cgd->ident_data.lba_size48_1) |
-		    ((u_int64_t)cgd->ident_data.lba_size48_2 << 16) |
-		    ((u_int64_t)cgd->ident_data.lba_size48_3 << 32) |
-		    ((u_int64_t)cgd->ident_data.lba_size48_4 << 48);
+	lbasize48 = ((uint64_t)cgd->ident_data.lba_size48_1) |
+		    ((uint64_t)cgd->ident_data.lba_size48_2 << 16) |
+		    ((uint64_t)cgd->ident_data.lba_size48_3 << 32) |
+		    ((uint64_t)cgd->ident_data.lba_size48_4 << 48);
 	if ((cgd->ident_data.support.command2 & ATA_SUPPORT_ADDRESS48) &&
 	    lbasize48 > ATA_MAX_28BIT_LBA)
 		dp->sectors = lbasize48;
diff --git a/sys/cam/ata/ata_pmp.c b/sys/cam/ata/ata_pmp.c
index 2e6126d5f559..a873af6766bc 100644
--- a/sys/cam/ata/ata_pmp.c
+++ b/sys/cam/ata/ata_pmp.c
@@ -113,7 +113,7 @@ struct pmp_softc {
 };
 
 static	periph_init_t	pmpinit;
-static	void		pmpasync(void *callback_arg, u_int32_t code,
+static	void		pmpasync(void *callback_arg, uint32_t code,
 				struct cam_path *path, void *arg);
 static	void		pmpsysctlinit(void *context, int pending);
 static	periph_ctor_t	pmpregister;
@@ -262,7 +262,7 @@ pmpcleanup(struct cam_periph *periph)
 }
 
 static void
-pmpasync(void *callback_arg, u_int32_t code,
+pmpasync(void *callback_arg, uint32_t code,
 	struct cam_path *path, void *arg)
 {
 	struct cam_periph *periph;
@@ -586,7 +586,7 @@ pmpdone(struct cam_periph *periph, union ccb *done_ccb)
 	struct pmp_softc *softc;
 	struct ccb_ataio *ataio;
 	struct cam_path *dpath;
-	u_int32_t  priority, res;
+	uint32_t  priority, res;
 	int i;
 
 	softc = (struct pmp_softc *)periph->softc;
diff --git a/sys/cam/ata/ata_xpt.c b/sys/cam/ata/ata_xpt.c
index dfd5d4d7cb44..2b2fec06a06a 100644
--- a/sys/cam/ata/ata_xpt.c
+++ b/sys/cam/ata/ata_xpt.c
@@ -65,7 +65,7 @@ __FBSDID("$FreeBSD$");
 
 struct ata_quirk_entry {
 	struct scsi_inquiry_pattern inq_pat;
-	u_int8_t quirks;
+	uint8_t quirks;
 #define	CAM_QUIRK_MAXTAGS	0x01
 	u_int mintags;
 	u_int maxtags;
@@ -182,7 +182,7 @@ static void	 ata_get_transfer_settings(struct ccb_trans_settings *cts);
 static void	 ata_set_transfer_settings(struct ccb_trans_settings *cts,
 					    struct cam_path *path,
 					    int async_update);
-static void	 ata_dev_async(u_int32_t async_code,
+static void	 ata_dev_async(uint32_t async_code,
 				struct cam_eb *bus,
 				struct cam_et *target,
 				struct cam_ed *device,
@@ -380,7 +380,7 @@ aprobestart(struct cam_periph *periph, union ccb *start_ccb)
 		      aprobedone,
 		      /*flags*/CAM_DIR_IN,
 		      0,
-		      /*data_ptr*/(u_int8_t *)&softc->ident_data,
+		      /*data_ptr*/(uint8_t *)&softc->ident_data,
 		      /*dxfer_len*/sizeof(softc->ident_data),
 		      30 * 1000);
 		if (path->device->protocol == PROTO_ATA)
@@ -660,7 +660,7 @@ negotiate:
 			     /*retries*/1,
 			     aprobedone,
 			     MSG_SIMPLE_Q_TAG,
-			     (u_int8_t *)inq_buf,
+			     (uint8_t *)inq_buf,
 			     inquiry_len,
 			     /*evpd*/FALSE,
 			     /*page_code*/0,
@@ -696,7 +696,7 @@ negotiate:
 		      aprobedone,
 		      /*flags*/CAM_DIR_IN,
 		      0,
-		      /*data_ptr*/(u_int8_t *)&softc->ident_data,
+		      /*data_ptr*/(uint8_t *)&softc->ident_data,
 		      /*dxfer_len*/sizeof(softc->ident_data),
 		      30 * 1000);
 		ata_28bit_cmd(ataio, ATA_SEP_ATTN, 0xEC, 0x02,
@@ -708,7 +708,7 @@ negotiate:
 		      aprobedone,
 		      /*flags*/CAM_DIR_IN,
 		      0,
-		      /*data_ptr*/(u_int8_t *)&softc->ident_data,
+		      /*data_ptr*/(uint8_t *)&softc->ident_data,
 		      /*dxfer_len*/sizeof(softc->ident_data),
 		      30 * 1000);
 		ata_28bit_cmd(ataio, ATA_SEP_ATTN, 0xEC, 0x00,
@@ -748,7 +748,7 @@ aprobedone(struct cam_periph *periph, union ccb *done_ccb)
 	aprobe_softc *softc;
 	struct cam_path *path;
 	cam_status status;
-	u_int32_t  priority;
+	uint32_t  priority;
 	u_int caps, oif;
 	int changed, found = 1;
 	static const uint8_t fake_device_id_hdr[8] =
@@ -965,7 +965,7 @@ noerror:
 				path->device->device_id_len = 0;
 			}
 			path->device->serial_num =
-				(u_int8_t *)malloc((sizeof(ident_buf->serial) + 1),
+				(uint8_t *)malloc((sizeof(ident_buf->serial) + 1),
 					   M_CAMXPT, M_NOWAIT);
 			if (path->device->serial_num != NULL) {
 				bcopy(ident_buf->serial,
@@ -1162,7 +1162,7 @@ notsata:
 	case PROBE_INQUIRY:
 	case PROBE_FULL_INQUIRY:
 	{
-		u_int8_t periph_qual, len;
+		uint8_t periph_qual, len;
 
 		path->device->flags |= CAM_DEV_INQUIRY_DATA_VALID;
 
@@ -2036,7 +2036,7 @@ ata_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_path *path,
  * Handle any per-device event notifications that require action by the XPT.
  */
 static void
-ata_dev_async(u_int32_t async_code, struct cam_eb *bus, struct cam_et *target,
+ata_dev_async(uint32_t async_code, struct cam_eb *bus, struct cam_et *target,
 	      struct cam_ed *device, void *async_arg)
 {
 	/*