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

[dm-devel] [PATCH] Use structure assignments instead of memcpy's



Use structure assignments instead of memcpy's.
[Suggested by akpm during kcopyd review.]

--- diff/drivers/md/dm-raid1.c	2004-06-11 10:19:45.206234296 +0000
+++ source/drivers/md/dm-raid1.c	2004-06-11 10:23:34.147429944 +0000
@@ -850,9 +850,9 @@
 	struct bio_list reads, writes;
 
 	spin_lock(&ms->lock);
-	memcpy(&reads, &ms->reads, sizeof(reads));
+	reads = ms->reads;
+	writes = ms->writes;
 	bio_list_init(&ms->reads);
-	memcpy(&writes, &ms->writes, sizeof(writes));
 	bio_list_init(&ms->writes);
 	spin_unlock(&ms->lock);
 
--- diff/drivers/md/dm-snap.c	2004-06-11 10:19:45.222231864 +0000
+++ source/drivers/md/dm-snap.c	2004-06-11 10:23:42.504159528 +0000
@@ -612,7 +612,7 @@
 			error_bios(bio_list_get(&pe->snapshot_bios));
 			goto out;
 		}
-		memcpy(e, &pe->e, sizeof(*e));
+		*e = pe->e;
 
 		/*
 		 * Add a proper exception, and remove the
--- diff/drivers/md/dm-table.c	2004-06-11 10:19:39.470106320 +0000
+++ source/drivers/md/dm-table.c	2004-06-11 10:23:47.893340248 +0000
@@ -400,7 +400,7 @@
 	struct dm_dev dd_copy;
 	dev_t dev = dd->bdev->bd_dev;
 
-	memcpy(&dd_copy, dd, sizeof(dd_copy));
+	dd_copy = *dd;
 
 	dd->mode |= new_mode;
 	dd->bdev = NULL;
@@ -408,7 +408,7 @@
 	if (!r)
 		close_dev(&dd_copy);
 	else
-		memcpy(dd, &dd_copy, sizeof(dd_copy));
+		*dd = dd_copy;
 
 	return r;
 }
--- diff/drivers/md/dm.c	2004-06-11 10:19:39.472106016 +0000
+++ source/drivers/md/dm.c	2004-06-11 10:23:52.756600920 +0000
@@ -395,7 +395,7 @@
 	struct bio_vec *bv = bio->bi_io_vec + idx;
 
 	clone = bio_alloc(GFP_NOIO, 1);
-	memcpy(clone->bi_io_vec, bv, sizeof(*bv));
+	*clone->bi_io_vec = *bv;
 
 	clone->bi_sector = sector;
 	clone->bi_bdev = bio->bi_bdev;
--- diff/drivers/md/kcopyd.c	2004-06-11 10:28:34.926704544 +0000
+++ source/drivers/md/kcopyd.c	2004-06-11 10:28:32.292105064 +0000
@@ -474,7 +474,7 @@
 		int i;
 		struct kcopyd_job *sub_job = mempool_alloc(_job_pool, GFP_NOIO);
 
-		memcpy(sub_job, job, sizeof(*job));
+		*sub_job = *job;
 		sub_job->source.sector += progress;
 		sub_job->source.count = count;
 
@@ -534,7 +534,7 @@
 	job->write_err = 0;
 	job->rw = READ;
 
-	memcpy(&job->source, from, sizeof(*from));
+	job->source = *from;
 
 	job->num_dests = num_dests;
 	memcpy(&job->dests, dests, sizeof(*dests) * num_dests);

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