aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/relayfs/buffers.c2
-rw-r--r--fs/relayfs/relay.c30
2 files changed, 29 insertions, 3 deletions
diff --git a/fs/relayfs/buffers.c b/fs/relayfs/buffers.c
index 667b529944c5..10187812771e 100644
--- a/fs/relayfs/buffers.c
+++ b/fs/relayfs/buffers.c
@@ -185,6 +185,6 @@ void relay_destroy_buf(struct rchan_buf *buf)
185void relay_remove_buf(struct kref *kref) 185void relay_remove_buf(struct kref *kref)
186{ 186{
187 struct rchan_buf *buf = container_of(kref, struct rchan_buf, kref); 187 struct rchan_buf *buf = container_of(kref, struct rchan_buf, kref);
188 relayfs_remove(buf->dentry); 188 buf->chan->cb->remove_buf_file(buf->dentry);
189 relay_destroy_buf(buf); 189 relay_destroy_buf(buf);
190} 190}
diff --git a/fs/relayfs/relay.c b/fs/relayfs/relay.c
index a9cd5585c45c..b9bb56903272 100644
--- a/fs/relayfs/relay.c
+++ b/fs/relayfs/relay.c
@@ -80,11 +80,33 @@ static void buf_unmapped_default_callback(struct rchan_buf *buf,
80{ 80{
81} 81}
82 82
83/*
84 * create_buf_file_create() default callback. Creates file to represent buf.
85 */
86static struct dentry *create_buf_file_default_callback(const char *filename,
87 struct dentry *parent,
88 int mode,
89 struct rchan_buf *buf)
90{
91 return relayfs_create_file(filename, parent, mode,
92 &relayfs_file_operations, buf);
93}
94
95/*
96 * remove_buf_file() default callback. Removes file representing relay buffer.
97 */
98static int remove_buf_file_default_callback(struct dentry *dentry)
99{
100 return relayfs_remove(dentry);
101}
102
83/* relay channel default callbacks */ 103/* relay channel default callbacks */
84static struct rchan_callbacks default_channel_callbacks = { 104static struct rchan_callbacks default_channel_callbacks = {
85 .subbuf_start = subbuf_start_default_callback, 105 .subbuf_start = subbuf_start_default_callback,
86 .buf_mapped = buf_mapped_default_callback, 106 .buf_mapped = buf_mapped_default_callback,
87 .buf_unmapped = buf_unmapped_default_callback, 107 .buf_unmapped = buf_unmapped_default_callback,
108 .create_buf_file = create_buf_file_default_callback,
109 .remove_buf_file = remove_buf_file_default_callback,
88}; 110};
89 111
90/** 112/**
@@ -176,8 +198,8 @@ static struct rchan_buf *relay_open_buf(struct rchan *chan,
176 return NULL; 198 return NULL;
177 199
178 /* Create file in fs */ 200 /* Create file in fs */
179 dentry = relayfs_create_file(filename, parent, S_IRUSR, 201 dentry = chan->cb->create_buf_file(filename, parent, S_IRUSR,
180 &relayfs_file_operations, buf); 202 buf);
181 if (!dentry) { 203 if (!dentry) {
182 relay_destroy_buf(buf); 204 relay_destroy_buf(buf);
183 return NULL; 205 return NULL;
@@ -220,6 +242,10 @@ static inline void setup_callbacks(struct rchan *chan,
220 cb->buf_mapped = buf_mapped_default_callback; 242 cb->buf_mapped = buf_mapped_default_callback;
221 if (!cb->buf_unmapped) 243 if (!cb->buf_unmapped)
222 cb->buf_unmapped = buf_unmapped_default_callback; 244 cb->buf_unmapped = buf_unmapped_default_callback;
245 if (!cb->create_buf_file)
246 cb->create_buf_file = create_buf_file_default_callback;
247 if (!cb->remove_buf_file)
248 cb->remove_buf_file = remove_buf_file_default_callback;
223 chan->cb = cb; 249 chan->cb = cb;
224} 250}
225 251