[PATCH 3/3] staging: lustre: Convert remaining uses of "= seq_printf(...)"

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

 



The seq_printf return value will eventually be converted to void.

Convert the remaining uses by hand.

Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
---
 drivers/staging/lustre/lustre/llite/lproc_llite.c  | 34 +++++---
 .../lustre/lustre/obdclass/lprocfs_status.c        | 94 +++++++++++-----------
 2 files changed, 70 insertions(+), 58 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c
index 70a42e4..35b2473 100644
--- a/drivers/staging/lustre/lustre/llite/lproc_llite.c
+++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c
@@ -58,8 +58,10 @@ static int ll_blksize_seq_show(struct seq_file *m, void *v)
 	rc = ll_statfs_internal(sb, &osfs,
 				cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
 				OBD_STATFS_NODELAY);
-	if (!rc)
-	      rc = seq_printf(m, "%u\n", osfs.os_bsize);
+	if (!rc) {
+		seq_printf(m, "%u\n", osfs.os_bsize);
+		rc = seq_has_overflowed(m);
+	}
 
 	return rc;
 }
@@ -82,7 +84,8 @@ static int ll_kbytestotal_seq_show(struct seq_file *m, void *v)
 		while (blk_size >>= 1)
 			result <<= 1;
 
-		rc = seq_printf(m, "%llu\n", result);
+		seq_printf(m, "%llu\n", result);
+		rc = seq_has_overflowed(m);
 	}
 	return rc;
 }
@@ -105,7 +108,8 @@ static int ll_kbytesfree_seq_show(struct seq_file *m, void *v)
 		while (blk_size >>= 1)
 			result <<= 1;
 
-		rc = seq_printf(m, "%llu\n", result);
+		seq_printf(m, "%llu\n", result);
+		rc = seq_has_overflowed(m);
 	}
 	return rc;
 }
@@ -128,7 +132,8 @@ static int ll_kbytesavail_seq_show(struct seq_file *m, void *v)
 		while (blk_size >>= 1)
 			result <<= 1;
 
-		rc = seq_printf(m, "%llu\n", result);
+		seq_printf(m, "%llu\n", result);
+		rc = seq_has_overflowed(m);
 	}
 	return rc;
 }
@@ -144,8 +149,10 @@ static int ll_filestotal_seq_show(struct seq_file *m, void *v)
 	rc = ll_statfs_internal(sb, &osfs,
 				cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
 				OBD_STATFS_NODELAY);
-	if (!rc)
-		 rc = seq_printf(m, "%llu\n", osfs.os_files);
+	if (!rc) {
+		seq_printf(m, "%llu\n", osfs.os_files);
+		rc = seq_has_overflowed(m);
+	}
 	return rc;
 }
 LPROC_SEQ_FOPS_RO(ll_filestotal);
@@ -160,8 +167,10 @@ static int ll_filesfree_seq_show(struct seq_file *m, void *v)
 	rc = ll_statfs_internal(sb, &osfs,
 				cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
 				OBD_STATFS_NODELAY);
-	if (!rc)
-		 rc = seq_printf(m, "%llu\n", osfs.os_ffree);
+	if (!rc) {
+		seq_printf(m, "%llu\n", osfs.os_ffree);
+		rc = seq_has_overflowed(m);
+	}
 	return rc;
 }
 LPROC_SEQ_FOPS_RO(ll_filesfree);
@@ -169,16 +178,15 @@ LPROC_SEQ_FOPS_RO(ll_filesfree);
 static int ll_client_type_seq_show(struct seq_file *m, void *v)
 {
 	struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
-	int rc;
 
 	LASSERT(sbi != NULL);
 
 	if (sbi->ll_flags & LL_SBI_RMT_CLIENT)
-		rc = seq_printf(m, "remote client\n");
+		seq_puts(m, "remote client\n");
 	else
-		rc = seq_printf(m, "local client\n");
+		seq_puts(m, "local client\n");
 
-	return rc;
+	return seq_has_overflowed(m);
 }
 LPROC_SEQ_FOPS_RO(ll_client_type);
 
diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 9ac5faf..922fe83 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -464,8 +464,11 @@ int lprocfs_rd_blksize(struct seq_file *m, void *data)
 	int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
 			    cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
 			    OBD_STATFS_NODELAY);
-	if (!rc)
-		rc = seq_printf(m, "%u\n", osfs.os_bsize);
+	if (!rc) {
+		seq_printf(m, "%u\n", osfs.os_bsize);
+		rc = seq_has_overflowed(m);
+	}
+
 	return rc;
 }
 EXPORT_SYMBOL(lprocfs_rd_blksize);
@@ -484,7 +487,8 @@ int lprocfs_rd_kbytestotal(struct seq_file *m, void *data)
 		while (blk_size >>= 1)
 			result <<= 1;
 
-		rc = seq_printf(m, "%llu\n", result);
+		seq_printf(m, "%llu\n", result);
+		rc = seq_has_overflowed(m);
 	}
 	return rc;
 }
@@ -504,7 +508,8 @@ int lprocfs_rd_kbytesfree(struct seq_file *m, void *data)
 		while (blk_size >>= 1)
 			result <<= 1;
 
-		rc = seq_printf(m, "%llu\n", result);
+		seq_printf(m, "%llu\n", result);
+		rc = seq_has_overflowed(m);
 	}
 	return rc;
 }
@@ -524,7 +529,8 @@ int lprocfs_rd_kbytesavail(struct seq_file *m, void *data)
 		while (blk_size >>= 1)
 			result <<= 1;
 
-		rc = seq_printf(m, "%llu\n", result);
+		seq_printf(m, "%llu\n", result);
+		rc = seq_has_overflowed(m);
 	}
 	return rc;
 }
@@ -537,8 +543,10 @@ int lprocfs_rd_filestotal(struct seq_file *m, void *data)
 	int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
 			    cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
 			    OBD_STATFS_NODELAY);
-	if (!rc)
-		rc = seq_printf(m, "%llu\n", osfs.os_files);
+	if (!rc) {
+		seq_printf(m, "%llu\n", osfs.os_files);
+		rc = seq_has_overflowed(m);
+	}
 
 	return rc;
 }
@@ -551,8 +559,11 @@ int lprocfs_rd_filesfree(struct seq_file *m, void *data)
 	int rc = obd_statfs(NULL, obd->obd_self_export, &osfs,
 			    cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
 			    OBD_STATFS_NODELAY);
-	if (!rc)
-		rc = seq_printf(m, "%llu\n", osfs.os_ffree);
+	if (!rc) {
+		seq_printf(m, "%llu\n", osfs.os_ffree);
+		rc = seq_has_overflowed(m);
+	}
+
 	return rc;
 }
 EXPORT_SYMBOL(lprocfs_rd_filesfree);
@@ -562,17 +573,18 @@ int lprocfs_rd_server_uuid(struct seq_file *m, void *data)
 	struct obd_device *obd = data;
 	struct obd_import *imp;
 	char *imp_state_name = NULL;
-	int rc = 0;
 
 	LASSERT(obd != NULL);
 	LPROCFS_CLIMP_CHECK(obd);
 	imp = obd->u.cli.cl_import;
 	imp_state_name = ptlrpc_import_state_name(imp->imp_state);
-	rc = seq_printf(m, "%s\t%s%s\n", obd2cli_tgt(obd), imp_state_name,
-			imp->imp_deactive ? "\tDEACTIVATED" : "");
+	seq_printf(m, "%s\t%s%s\n",
+		   obd2cli_tgt(obd), imp_state_name,
+		   imp->imp_deactive ? "\tDEACTIVATED" : "");
 
 	LPROCFS_CLIMP_EXIT(obd);
-	return rc;
+
+	return seq_has_overflowed(m);
 }
 EXPORT_SYMBOL(lprocfs_rd_server_uuid);
 
@@ -580,19 +592,19 @@ int lprocfs_rd_conn_uuid(struct seq_file *m, void *data)
 {
 	struct obd_device *obd = data;
 	struct ptlrpc_connection *conn;
-	int rc = 0;
 
 	LASSERT(obd != NULL);
 
 	LPROCFS_CLIMP_CHECK(obd);
 	conn = obd->u.cli.cl_import->imp_connection;
 	if (conn && obd->u.cli.cl_import)
-		rc = seq_printf(m, "%s\n", conn->c_remote_uuid.uuid);
+		seq_printf(m, "%s\n", conn->c_remote_uuid.uuid);
 	else
-		rc = seq_printf(m, "%s\n", "<none>");
+		seq_printf(m, "%s\n", "<none>");
 
 	LPROCFS_CLIMP_EXIT(obd);
-	return rc;
+
+	return seq_has_overflowed(m);
 }
 EXPORT_SYMBOL(lprocfs_rd_conn_uuid);
 
@@ -1207,41 +1219,33 @@ static int lprocfs_stats_seq_show(struct seq_file *p, void *v)
 	struct lprocfs_counter_header   *hdr;
 	struct lprocfs_counter           ctr;
 	int                              idx    = *(loff_t *)v;
-	int                              rc     = 0;
 
 	if (idx == 0) {
 		struct timeval now;
 		do_gettimeofday(&now);
-		rc = seq_printf(p, "%-25s %lu.%lu secs.usecs\n",
-				"snapshot_time", now.tv_sec, (unsigned long)now.tv_usec);
-		if (rc < 0)
-			return rc;
+		seq_printf(p, "%-25s %lu.%lu secs.usecs\n",
+			   "snapshot_time",
+			   now.tv_sec, (unsigned long)now.tv_usec);
 	}
+
 	hdr = &stats->ls_cnt_header[idx];
 	lprocfs_stats_collect(stats, idx, &ctr);
 
-	if (ctr.lc_count == 0)
-		goto out;
-
-	rc = seq_printf(p, "%-25s %lld samples [%s]", hdr->lc_name,
-			ctr.lc_count, hdr->lc_units);
-
-	if (rc < 0)
-		goto out;
+	if (ctr.lc_count != 0) {
+		seq_printf(p, "%-25s %lld samples [%s]",
+			   hdr->lc_name, ctr.lc_count, hdr->lc_units);
 
-	if ((hdr->lc_config & LPROCFS_CNTR_AVGMINMAX) && (ctr.lc_count > 0)) {
-		rc = seq_printf(p, " %lld %lld %lld",
-				ctr.lc_min, ctr.lc_max, ctr.lc_sum);
-		if (rc < 0)
-			goto out;
-		if (hdr->lc_config & LPROCFS_CNTR_STDDEV)
-			rc = seq_printf(p, " %lld", ctr.lc_sumsquare);
-		if (rc < 0)
-			goto out;
+		if ((hdr->lc_config & LPROCFS_CNTR_AVGMINMAX) &&
+		    (ctr.lc_count > 0)) {
+			seq_printf(p, " %lld %lld %lld",
+				   ctr.lc_min, ctr.lc_max, ctr.lc_sum);
+			if (hdr->lc_config & LPROCFS_CNTR_STDDEV)
+				seq_printf(p, " %lld", ctr.lc_sumsquare);
+		}
+		seq_putc(p, '\n');
 	}
-	rc = seq_printf(p, "\n");
-out:
-	return (rc < 0) ? rc : 0;
+
+	return seq_has_overflowed(p);
 }
 
 static const struct seq_operations lprocfs_stats_seq_sops = {
@@ -2049,12 +2053,12 @@ int lprocfs_obd_rd_max_pages_per_rpc(struct seq_file *m, void *data)
 {
 	struct obd_device *dev = data;
 	struct client_obd *cli = &dev->u.cli;
-	int rc;
 
 	client_obd_list_lock(&cli->cl_loi_list_lock);
-	rc = seq_printf(m, "%d\n", cli->cl_max_pages_per_rpc);
+	seq_printf(m, "%d\n", cli->cl_max_pages_per_rpc);
 	client_obd_list_unlock(&cli->cl_loi_list_lock);
-	return rc;
+
+	return seq_has_overflowed(m);
 }
 EXPORT_SYMBOL(lprocfs_obd_rd_max_pages_per_rpc);
 
-- 
2.1.2

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux