Commit 761da5c8 authored by Tom Zanussi's avatar Tom Zanussi Committed by Linus Torvalds

[PATCH] relayfs: cleanup, change relayfs_file_* to relay_file_*

This patch renames relayfs_file_operations to relay_file_operations, and the
file operations themselves from relayfs_XXX to relay_file_XXX, to make it more
clear that they refer to relay files.
Signed-off-by: default avatarTom Zanussi <zanussi@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent df49af8f
...@@ -247,13 +247,13 @@ int relayfs_remove_dir(struct dentry *dentry) ...@@ -247,13 +247,13 @@ int relayfs_remove_dir(struct dentry *dentry)
} }
/** /**
* relayfs_open - open file op for relayfs files * relay_file_open - open file op for relay files
* @inode: the inode * @inode: the inode
* @filp: the file * @filp: the file
* *
* Increments the channel buffer refcount. * Increments the channel buffer refcount.
*/ */
static int relayfs_open(struct inode *inode, struct file *filp) static int relay_file_open(struct inode *inode, struct file *filp)
{ {
struct rchan_buf *buf = inode->u.generic_ip; struct rchan_buf *buf = inode->u.generic_ip;
kref_get(&buf->kref); kref_get(&buf->kref);
...@@ -263,26 +263,26 @@ static int relayfs_open(struct inode *inode, struct file *filp) ...@@ -263,26 +263,26 @@ static int relayfs_open(struct inode *inode, struct file *filp)
} }
/** /**
* relayfs_mmap - mmap file op for relayfs files * relay_file_mmap - mmap file op for relay files
* @filp: the file * @filp: the file
* @vma: the vma describing what to map * @vma: the vma describing what to map
* *
* Calls upon relay_mmap_buf to map the file into user space. * Calls upon relay_mmap_buf to map the file into user space.
*/ */
static int relayfs_mmap(struct file *filp, struct vm_area_struct *vma) static int relay_file_mmap(struct file *filp, struct vm_area_struct *vma)
{ {
struct rchan_buf *buf = filp->private_data; struct rchan_buf *buf = filp->private_data;
return relay_mmap_buf(buf, vma); return relay_mmap_buf(buf, vma);
} }
/** /**
* relayfs_poll - poll file op for relayfs files * relay_file_poll - poll file op for relay files
* @filp: the file * @filp: the file
* @wait: poll table * @wait: poll table
* *
* Poll implemention. * Poll implemention.
*/ */
static unsigned int relayfs_poll(struct file *filp, poll_table *wait) static unsigned int relay_file_poll(struct file *filp, poll_table *wait)
{ {
unsigned int mask = 0; unsigned int mask = 0;
struct rchan_buf *buf = filp->private_data; struct rchan_buf *buf = filp->private_data;
...@@ -300,14 +300,14 @@ static unsigned int relayfs_poll(struct file *filp, poll_table *wait) ...@@ -300,14 +300,14 @@ static unsigned int relayfs_poll(struct file *filp, poll_table *wait)
} }
/** /**
* relayfs_release - release file op for relayfs files * relay_file_release - release file op for relay files
* @inode: the inode * @inode: the inode
* @filp: the file * @filp: the file
* *
* Decrements the channel refcount, as the filesystem is * Decrements the channel refcount, as the filesystem is
* no longer using it. * no longer using it.
*/ */
static int relayfs_release(struct inode *inode, struct file *filp) static int relay_file_release(struct inode *inode, struct file *filp)
{ {
struct rchan_buf *buf = filp->private_data; struct rchan_buf *buf = filp->private_data;
kref_put(&buf->kref, relay_remove_buf); kref_put(&buf->kref, relay_remove_buf);
...@@ -316,11 +316,11 @@ static int relayfs_release(struct inode *inode, struct file *filp) ...@@ -316,11 +316,11 @@ static int relayfs_release(struct inode *inode, struct file *filp)
} }
/** /**
* relayfs_read_consume - update the consumed count for the buffer * relay_file_read_consume - update the consumed count for the buffer
*/ */
static void relayfs_read_consume(struct rchan_buf *buf, static void relay_file_read_consume(struct rchan_buf *buf,
size_t read_pos, size_t read_pos,
size_t bytes_consumed) size_t bytes_consumed)
{ {
size_t subbuf_size = buf->chan->subbuf_size; size_t subbuf_size = buf->chan->subbuf_size;
size_t n_subbufs = buf->chan->n_subbufs; size_t n_subbufs = buf->chan->n_subbufs;
...@@ -343,9 +343,9 @@ static void relayfs_read_consume(struct rchan_buf *buf, ...@@ -343,9 +343,9 @@ static void relayfs_read_consume(struct rchan_buf *buf,
} }
/** /**
* relayfs_read_avail - boolean, are there unconsumed bytes available? * relay_file_read_avail - boolean, are there unconsumed bytes available?
*/ */
static int relayfs_read_avail(struct rchan_buf *buf, size_t read_pos) static int relay_file_read_avail(struct rchan_buf *buf, size_t read_pos)
{ {
size_t bytes_produced, bytes_consumed, write_offset; size_t bytes_produced, bytes_consumed, write_offset;
size_t subbuf_size = buf->chan->subbuf_size; size_t subbuf_size = buf->chan->subbuf_size;
...@@ -376,16 +376,16 @@ static int relayfs_read_avail(struct rchan_buf *buf, size_t read_pos) ...@@ -376,16 +376,16 @@ static int relayfs_read_avail(struct rchan_buf *buf, size_t read_pos)
if (bytes_produced == bytes_consumed) if (bytes_produced == bytes_consumed)
return 0; return 0;
relayfs_read_consume(buf, read_pos, 0); relay_file_read_consume(buf, read_pos, 0);
return 1; return 1;
} }
/** /**
* relayfs_read_subbuf_avail - return bytes available in sub-buffer * relay_file_read_subbuf_avail - return bytes available in sub-buffer
*/ */
static size_t relayfs_read_subbuf_avail(size_t read_pos, static size_t relay_file_read_subbuf_avail(size_t read_pos,
struct rchan_buf *buf) struct rchan_buf *buf)
{ {
size_t padding, avail = 0; size_t padding, avail = 0;
size_t read_subbuf, read_offset, write_subbuf, write_offset; size_t read_subbuf, read_offset, write_subbuf, write_offset;
...@@ -407,14 +407,14 @@ static size_t relayfs_read_subbuf_avail(size_t read_pos, ...@@ -407,14 +407,14 @@ static size_t relayfs_read_subbuf_avail(size_t read_pos,
} }
/** /**
* relayfs_read_start_pos - find the first available byte to read * relay_file_read_start_pos - find the first available byte to read
* *
* If the read_pos is in the middle of padding, return the * If the read_pos is in the middle of padding, return the
* position of the first actually available byte, otherwise * position of the first actually available byte, otherwise
* return the original value. * return the original value.
*/ */
static size_t relayfs_read_start_pos(size_t read_pos, static size_t relay_file_read_start_pos(size_t read_pos,
struct rchan_buf *buf) struct rchan_buf *buf)
{ {
size_t read_subbuf, padding, padding_start, padding_end; size_t read_subbuf, padding, padding_start, padding_end;
size_t subbuf_size = buf->chan->subbuf_size; size_t subbuf_size = buf->chan->subbuf_size;
...@@ -433,11 +433,11 @@ static size_t relayfs_read_start_pos(size_t read_pos, ...@@ -433,11 +433,11 @@ static size_t relayfs_read_start_pos(size_t read_pos,
} }
/** /**
* relayfs_read_end_pos - return the new read position * relay_file_read_end_pos - return the new read position
*/ */
static size_t relayfs_read_end_pos(struct rchan_buf *buf, static size_t relay_file_read_end_pos(struct rchan_buf *buf,
size_t read_pos, size_t read_pos,
size_t count) size_t count)
{ {
size_t read_subbuf, padding, end_pos; size_t read_subbuf, padding, end_pos;
size_t subbuf_size = buf->chan->subbuf_size; size_t subbuf_size = buf->chan->subbuf_size;
...@@ -456,7 +456,7 @@ static size_t relayfs_read_end_pos(struct rchan_buf *buf, ...@@ -456,7 +456,7 @@ static size_t relayfs_read_end_pos(struct rchan_buf *buf,
} }
/** /**
* relayfs_read - read file op for relayfs files * relay_file_read - read file op for relay files
* @filp: the file * @filp: the file
* @buffer: the userspace buffer * @buffer: the userspace buffer
* @count: number of bytes to read * @count: number of bytes to read
...@@ -465,10 +465,10 @@ static size_t relayfs_read_end_pos(struct rchan_buf *buf, ...@@ -465,10 +465,10 @@ static size_t relayfs_read_end_pos(struct rchan_buf *buf,
* Reads count bytes or the number of bytes available in the * Reads count bytes or the number of bytes available in the
* current sub-buffer being read, whichever is smaller. * current sub-buffer being read, whichever is smaller.
*/ */
static ssize_t relayfs_read(struct file *filp, static ssize_t relay_file_read(struct file *filp,
char __user *buffer, char __user *buffer,
size_t count, size_t count,
loff_t *ppos) loff_t *ppos)
{ {
struct rchan_buf *buf = filp->private_data; struct rchan_buf *buf = filp->private_data;
struct inode *inode = filp->f_dentry->d_inode; struct inode *inode = filp->f_dentry->d_inode;
...@@ -477,11 +477,11 @@ static ssize_t relayfs_read(struct file *filp, ...@@ -477,11 +477,11 @@ static ssize_t relayfs_read(struct file *filp,
void *from; void *from;
down(&inode->i_sem); down(&inode->i_sem);
if(!relayfs_read_avail(buf, *ppos)) if(!relay_file_read_avail(buf, *ppos))
goto out; goto out;
read_start = relayfs_read_start_pos(*ppos, buf); read_start = relay_file_read_start_pos(*ppos, buf);
avail = relayfs_read_subbuf_avail(read_start, buf); avail = relay_file_read_subbuf_avail(read_start, buf);
if (!avail) if (!avail)
goto out; goto out;
...@@ -491,20 +491,20 @@ static ssize_t relayfs_read(struct file *filp, ...@@ -491,20 +491,20 @@ static ssize_t relayfs_read(struct file *filp,
ret = -EFAULT; ret = -EFAULT;
goto out; goto out;
} }
relayfs_read_consume(buf, read_start, count); relay_file_read_consume(buf, read_start, count);
*ppos = relayfs_read_end_pos(buf, read_start, count); *ppos = relay_file_read_end_pos(buf, read_start, count);
out: out:
up(&inode->i_sem); up(&inode->i_sem);
return ret; return ret;
} }
struct file_operations relayfs_file_operations = { struct file_operations relay_file_operations = {
.open = relayfs_open, .open = relay_file_open,
.poll = relayfs_poll, .poll = relay_file_poll,
.mmap = relayfs_mmap, .mmap = relay_file_mmap,
.read = relayfs_read, .read = relay_file_read,
.llseek = no_llseek, .llseek = no_llseek,
.release = relayfs_release, .release = relay_file_release,
}; };
static struct super_operations relayfs_ops = { static struct super_operations relayfs_ops = {
...@@ -558,13 +558,18 @@ static int __init init_relayfs_fs(void) ...@@ -558,13 +558,18 @@ static int __init init_relayfs_fs(void)
static void __exit exit_relayfs_fs(void) static void __exit exit_relayfs_fs(void)
{ {
unregister_filesystem(&relayfs_fs_type); unregister_filesystem(&relayfs_fs_type);
} }
module_init(init_relayfs_fs) module_init(init_relayfs_fs)
module_exit(exit_relayfs_fs) module_exit(exit_relayfs_fs)
EXPORT_SYMBOL_GPL(relayfs_file_operations); EXPORT_SYMBOL_GPL(relay_file_operations);
EXPORT_SYMBOL_GPL(relayfs_create_dir); EXPORT_SYMBOL_GPL(relayfs_create_dir);
EXPORT_SYMBOL_GPL(relayfs_remove_dir); EXPORT_SYMBOL_GPL(relayfs_remove_dir);
EXPORT_SYMBOL_GPL(relayfs_create_file); EXPORT_SYMBOL_GPL(relayfs_create_file);
......
...@@ -90,7 +90,7 @@ static struct dentry *create_buf_file_default_callback(const char *filename, ...@@ -90,7 +90,7 @@ static struct dentry *create_buf_file_default_callback(const char *filename,
int *is_global) int *is_global)
{ {
return relayfs_create_file(filename, parent, mode, return relayfs_create_file(filename, parent, mode,
&relayfs_file_operations, buf); &relay_file_operations, buf);
} }
/* /*
......
...@@ -279,10 +279,9 @@ static inline void subbuf_start_reserve(struct rchan_buf *buf, ...@@ -279,10 +279,9 @@ static inline void subbuf_start_reserve(struct rchan_buf *buf,
} }
/* /*
* exported relayfs file operations, fs/relayfs/inode.c * exported relay file operations, fs/relayfs/inode.c
*/ */
extern struct file_operations relay_file_operations;
extern struct file_operations relayfs_file_operations;
#endif /* _LINUX_RELAYFS_FS_H */ #endif /* _LINUX_RELAYFS_FS_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment