From: Kevin Corry <kevcorry@us.ibm.com>
To: Andrew Morton <akpm@osdl.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] DM 2/5: Use structure assignments instead of memcpy
Date: Mon, 14 Jun 2004 13:17:36 +0000 [thread overview]
Message-ID: <200406141317.36117.kevcorry@us.ibm.com> (raw)
In-Reply-To: <200406141309.31127.kevcorry@us.ibm.com>
Use structure assignments instead of memcpy's.
[Suggested by akpm during kcopyd review.]
Signed-off-by: Kevin Corry <kevcorry@us.ibm.com>
--- diff/drivers/md/dm-raid1.c 2004-06-14 09:23:21.259282960 +0000
+++ source/drivers/md/dm-raid1.c 2004-06-14 09:29:56.946129416 +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-14 09:23:21.261282656 +0000
+++ source/drivers/md/dm-snap.c 2004-06-14 09:29:56.947129264 +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-14 09:23:21.265282048 +0000
+++ source/drivers/md/dm-table.c 2004-06-14 09:29:56.948129112 +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-14 09:29:23.019287080 +0000
+++ source/drivers/md/dm.c 2004-06-14 09:29:56.949128960 +0000
@@ -394,7 +394,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-14 09:29:23.020286928 +0000
+++ source/drivers/md/kcopyd.c 2004-06-14 09:29:56.950128808 +0000
@@ -476,7 +476,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;
@@ -536,7 +536,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);
next prev parent reply other threads:[~2004-06-14 18:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-14 13:09 [PATCH] DM 0/5: Device-mapper cleanups Kevin Corry
2004-06-14 13:16 ` [PATCH] DM 1/5: Create/destroy kcopyd on demand Kevin Corry
2004-06-14 13:17 ` Kevin Corry [this message]
2004-06-14 13:18 ` [PATCH] DM 3/5: dm-io: Error handling Kevin Corry
2004-06-14 13:18 ` [PATCH] DM 4/5: dm-raid1.c: Make delayed_bios a bio_list Kevin Corry
2004-06-14 13:19 ` [PATCH] DM 5/5: dm-raid1.c: Use list_for_each_entry_safe Kevin Corry
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200406141317.36117.kevcorry@us.ibm.com \
--to=kevcorry@us.ibm.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox