From: Artem Bityutskiy <dedekind1@gmail.com>
To: linux-mtd@lists.infradead.org
Cc: "Artem Bityutskiy" <artem.bityutskiy@linux.intel.com>,
"Jörn Engel" <joern@logfs.org>,
"Mike Dunn" <mikedunn@newsguy.com>
Subject: [PATCH 01/28] logfs: rename functions starting with mtd_
Date: Fri, 23 Dec 2011 20:10:53 +0200 [thread overview]
Message-ID: <1324663880-22477-2-git-send-email-dedekind1@gmail.com> (raw)
In-Reply-To: <1324663880-22477-1-git-send-email-dedekind1@gmail.com>
From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
We are going to re-work the MTD interface and change 'mtd->write()' to
'mtd_write()', 'mtd->read()' to 'mtd_read()' and so forth for all functions
in the 'struct mtd_info' structure.
However, logfs has its own 'mtd_read()', 'mtd_write()', etc functions
which collide with our changes. This patch renames these logfs functions
to 'logfs_mtd_read()', 'logfs_mtd_write()', etc.
Additionally, to make the 'fs/logfs/dev_mtd.c' file look consistent, rename
similarly all the other functions starting with 'mtd_'.
Cc: Jörn Engel <joern@logfs.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
fs/logfs/dev_mtd.c | 61 +++++++++++++++++++++++++++------------------------
1 files changed, 32 insertions(+), 29 deletions(-)
diff --git a/fs/logfs/dev_mtd.c b/fs/logfs/dev_mtd.c
index 339e17e..eb423eb 100644
--- a/fs/logfs/dev_mtd.c
+++ b/fs/logfs/dev_mtd.c
@@ -13,7 +13,8 @@
#define PAGE_OFS(ofs) ((ofs) & (PAGE_SIZE-1))
-static int mtd_read(struct super_block *sb, loff_t ofs, size_t len, void *buf)
+static int logfs_mtd_read(struct super_block *sb, loff_t ofs, size_t len,
+ void *buf)
{
struct mtd_info *mtd = logfs_super(sb)->s_mtd;
size_t retlen;
@@ -31,7 +32,8 @@ static int mtd_read(struct super_block *sb, loff_t ofs, size_t len, void *buf)
return 0;
}
-static int mtd_write(struct super_block *sb, loff_t ofs, size_t len, void *buf)
+static int loffs_mtd_write(struct super_block *sb, loff_t ofs, size_t len,
+ void *buf)
{
struct logfs_super *super = logfs_super(sb);
struct mtd_info *mtd = super->s_mtd;
@@ -60,14 +62,15 @@ static int mtd_write(struct super_block *sb, loff_t ofs, size_t len, void *buf)
* asynchronous properties. So just to prevent the first implementor of such
* a thing from breaking logfs in 2350, we do the usual pointless dance to
* declare a completion variable and wait for completion before returning
- * from mtd_erase(). What an exercise in futility!
+ * from logfs_mtd_erase(). What an exercise in futility!
*/
static void logfs_erase_callback(struct erase_info *ei)
{
complete((struct completion *)ei->priv);
}
-static int mtd_erase_mapping(struct super_block *sb, loff_t ofs, size_t len)
+static int logfs_mtd_erase_mapping(struct super_block *sb, loff_t ofs,
+ size_t len)
{
struct logfs_super *super = logfs_super(sb);
struct address_space *mapping = super->s_mapping_inode->i_mapping;
@@ -84,7 +87,7 @@ static int mtd_erase_mapping(struct super_block *sb, loff_t ofs, size_t len)
return 0;
}
-static int mtd_erase(struct super_block *sb, loff_t ofs, size_t len,
+static int logfs_mtd_erase(struct super_block *sb, loff_t ofs, size_t len,
int ensure_write)
{
struct mtd_info *mtd = logfs_super(sb)->s_mtd;
@@ -109,10 +112,10 @@ static int mtd_erase(struct super_block *sb, loff_t ofs, size_t len,
wait_for_completion(&complete);
if (ei.state != MTD_ERASE_DONE)
return -EIO;
- return mtd_erase_mapping(sb, ofs, len);
+ return logfs_mtd_erase_mapping(sb, ofs, len);
}
-static void mtd_sync(struct super_block *sb)
+static void logfs_mtd_sync(struct super_block *sb)
{
struct mtd_info *mtd = logfs_super(sb)->s_mtd;
@@ -120,12 +123,12 @@ static void mtd_sync(struct super_block *sb)
mtd->sync(mtd);
}
-static int mtd_readpage(void *_sb, struct page *page)
+static int logfs_mtd_readpage(void *_sb, struct page *page)
{
struct super_block *sb = _sb;
int err;
- err = mtd_read(sb, page->index << PAGE_SHIFT, PAGE_SIZE,
+ err = logfs_mtd_read(sb, page->index << PAGE_SHIFT, PAGE_SIZE,
page_address(page));
if (err == -EUCLEAN || err == -EBADMSG) {
/* -EBADMSG happens regularly on power failures */
@@ -143,11 +146,11 @@ static int mtd_readpage(void *_sb, struct page *page)
return err;
}
-static struct page *mtd_find_first_sb(struct super_block *sb, u64 *ofs)
+static struct page *logfs_mtd_find_first_sb(struct super_block *sb, u64 *ofs)
{
struct logfs_super *super = logfs_super(sb);
struct address_space *mapping = super->s_mapping_inode->i_mapping;
- filler_t *filler = mtd_readpage;
+ filler_t *filler = logfs_mtd_readpage;
struct mtd_info *mtd = super->s_mtd;
if (!mtd->block_isbad)
@@ -163,11 +166,11 @@ static struct page *mtd_find_first_sb(struct super_block *sb, u64 *ofs)
return read_cache_page(mapping, *ofs >> PAGE_SHIFT, filler, sb);
}
-static struct page *mtd_find_last_sb(struct super_block *sb, u64 *ofs)
+static struct page *logfs_mtd_find_last_sb(struct super_block *sb, u64 *ofs)
{
struct logfs_super *super = logfs_super(sb);
struct address_space *mapping = super->s_mapping_inode->i_mapping;
- filler_t *filler = mtd_readpage;
+ filler_t *filler = logfs_mtd_readpage;
struct mtd_info *mtd = super->s_mtd;
if (!mtd->block_isbad)
@@ -184,7 +187,7 @@ static struct page *mtd_find_last_sb(struct super_block *sb, u64 *ofs)
return read_cache_page(mapping, *ofs >> PAGE_SHIFT, filler, sb);
}
-static int __mtd_writeseg(struct super_block *sb, u64 ofs, pgoff_t index,
+static int __logfs_mtd_writeseg(struct super_block *sb, u64 ofs, pgoff_t index,
size_t nr_pages)
{
struct logfs_super *super = logfs_super(sb);
@@ -196,8 +199,8 @@ static int __mtd_writeseg(struct super_block *sb, u64 ofs, pgoff_t index,
page = find_lock_page(mapping, index + i);
BUG_ON(!page);
- err = mtd_write(sb, page->index << PAGE_SHIFT, PAGE_SIZE,
- page_address(page));
+ err = loffs_mtd_write(sb, page->index << PAGE_SHIFT, PAGE_SIZE,
+ page_address(page));
unlock_page(page);
page_cache_release(page);
if (err)
@@ -206,7 +209,7 @@ static int __mtd_writeseg(struct super_block *sb, u64 ofs, pgoff_t index,
return 0;
}
-static void mtd_writeseg(struct super_block *sb, u64 ofs, size_t len)
+static void logfs_mtd_writeseg(struct super_block *sb, u64 ofs, size_t len)
{
struct logfs_super *super = logfs_super(sb);
int head;
@@ -227,15 +230,15 @@ static void mtd_writeseg(struct super_block *sb, u64 ofs, size_t len)
len += head;
}
len = PAGE_ALIGN(len);
- __mtd_writeseg(sb, ofs, ofs >> PAGE_SHIFT, len >> PAGE_SHIFT);
+ __logfs_mtd_writeseg(sb, ofs, ofs >> PAGE_SHIFT, len >> PAGE_SHIFT);
}
-static void mtd_put_device(struct logfs_super *s)
+static void logfs_mtd_put_device(struct logfs_super *s)
{
put_mtd_device(s->s_mtd);
}
-static int mtd_can_write_buf(struct super_block *sb, u64 ofs)
+static int logfs_mtd_can_write_buf(struct super_block *sb, u64 ofs)
{
struct logfs_super *super = logfs_super(sb);
void *buf;
@@ -244,7 +247,7 @@ static int mtd_can_write_buf(struct super_block *sb, u64 ofs)
buf = kmalloc(super->s_writesize, GFP_KERNEL);
if (!buf)
return -ENOMEM;
- err = mtd_read(sb, ofs, super->s_writesize, buf);
+ err = logfs_mtd_read(sb, ofs, super->s_writesize, buf);
if (err)
goto out;
if (memchr_inv(buf, 0xff, super->s_writesize))
@@ -255,14 +258,14 @@ out:
}
static const struct logfs_device_ops mtd_devops = {
- .find_first_sb = mtd_find_first_sb,
- .find_last_sb = mtd_find_last_sb,
- .readpage = mtd_readpage,
- .writeseg = mtd_writeseg,
- .erase = mtd_erase,
- .can_write_buf = mtd_can_write_buf,
- .sync = mtd_sync,
- .put_device = mtd_put_device,
+ .find_first_sb = logfs_mtd_find_first_sb,
+ .find_last_sb = logfs_mtd_find_last_sb,
+ .readpage = logfs_mtd_readpage,
+ .writeseg = logfs_mtd_writeseg,
+ .erase = logfs_mtd_erase,
+ .can_write_buf = logfs_mtd_can_write_buf,
+ .sync = logfs_mtd_sync,
+ .put_device = logfs_mtd_put_device,
};
int logfs_get_sb_mtd(struct logfs_super *s, int mtdnr)
--
1.7.7.3
next prev parent reply other threads:[~2011-12-23 18:10 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-23 18:10 [PATCH 00/28] introduce wrappers for mtd interfaces Artem Bityutskiy
2011-12-23 18:10 ` Artem Bityutskiy [this message]
2011-12-23 18:10 ` [PATCH 02/28] mtd: mtdchar: rename functions Artem Bityutskiy
2011-12-23 18:10 ` [PATCH 03/28] mtd: introduce mtd_erase interface Artem Bityutskiy
2011-12-27 9:22 ` Mike Frysinger
2011-12-27 9:37 ` Artem Bityutskiy
2011-12-27 9:47 ` Artem Bityutskiy
2011-12-27 9:50 ` Mike Frysinger
2011-12-23 18:10 ` [PATCH 04/28] mtd: introduce mtd_point interface Artem Bityutskiy
2011-12-23 18:10 ` [PATCH 05/28] mtd: introduce mtd_unpoint interface Artem Bityutskiy
2011-12-23 18:10 ` [PATCH 06/28] mtd: introduce mtd_get_unmapped_area interface Artem Bityutskiy
2011-12-23 18:10 ` [PATCH 07/28] mtd: introduce mtd_read interface Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 08/28] mtd: introduce mtd_write interface Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 09/28] mtd: introduce mtd_panic_write interface Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 10/28] mtd: introduce mtd_read_oob interface Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 11/28] mtd: introduce mtd_write_oob interface Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 12/28] mtd: introduce mtd_get_fact_prot_info interface Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 13/28] mtd: introduce mtd_read_fact_prot_reg interface Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 14/28] mtd: introduce mtd_get_user_prot_info interface Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 15/28] mtd: introduce mtd_read_user_prot_reg interface Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 16/28] mtd: introduce mtd_write_user_prot_reg interface Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 17/28] mtd: introduce mtd_lock_user_prot_reg interface Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 18/28] mtd: introduce mtd_writev interface Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 19/28] mtd: introduce mtd_sync interface Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 20/28] mtd: introduce mtd_lock interface Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 21/28] mtd: introduce mtd_unlock interface Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 22/28] mtd: introduce mtd_is_locked interface Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 23/28] mtd: introduce mtd_suspend interface Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 24/28] mtd: introduce mtd_resume interface Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 25/28] " Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 26/28] mtd: introduce mtd_block_markbad interface Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 27/28] mtd: introduce mtd_get_device interface Artem Bityutskiy
2011-12-23 18:11 ` [PATCH 28/28] mtd: introduce mtd_put_device interface Artem Bityutskiy
2011-12-25 14:50 ` [PATCH 00/28] introduce wrappers for mtd interfaces Mike Dunn
2011-12-25 18:51 ` Artem Bityutskiy
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=1324663880-22477-2-git-send-email-dedekind1@gmail.com \
--to=dedekind1@gmail.com \
--cc=artem.bityutskiy@linux.intel.com \
--cc=joern@logfs.org \
--cc=linux-mtd@lists.infradead.org \
--cc=mikedunn@newsguy.com \
/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