Skip to contentSkip to conversation

relayfs: API cleanup

PATCH New Tom Zanussi 1 participant 1 message Aug 5, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 relayfs: API cleanup

This patch does a bit of cleanup of the relayfs API, as discussed previously:

http://marc.theaimsgroup.com/?l=linux-kernel&m=112134773617086&w=2

To recap, it:

- removes the commit counts, relay_commit() and the deliver() callback (the padding counts had to stay, for the read() implementation)
- removes the buffer_full() callback
- changes the subbuf_start() callback
- changes 'unsigned' to 'unsigned int'
- other similar and related changes

The examples have been updated to use the new API (there's also a new example that does commit/deliver in the client):

http://prdownloads.sourceforge.net/relayfs/relay-apps-0.7.tar.gz?download

Andrew, please apply.

Thanks,

Tom

fs/relayfs/buffers.c +3 -9
diff -urpN -X dontdiff linux-2.6.13-rc4-mm1/fs/relayfs/buffers.c linux-2.6.13-rc4-mm1-cur/fs/relayfs/buffers.c
@@ -95,7 +95,7 @@ int relay_mmap_buf(struct rchan_buf *buf
 static void *relay_alloc_buf(struct rchan_buf *buf, unsigned long size)
 {
 	void *mem;
-	int i, j, n_pages;
+	unsigned int i, j, n_pages;
 
 	size = PAGE_ALIGN(size);
 	n_pages = size >> PAGE_SHIFT;
@@ -141,20 +141,15 @@ struct rchan_buf *relay_create_buf(struc
 	if (!buf->padding)
 		goto free_buf;
 
-	buf->commit = kmalloc(chan->n_subbufs * sizeof(unsigned *), GFP_KERNEL);
-	if (!buf->commit)
-		goto free_buf;
-
 	buf->start = relay_alloc_buf(buf, chan->alloc_size);
 	if (!buf->start)
 		goto free_buf;
-
+	
 	buf->chan = chan;
 	kref_get(&buf->chan->kref);
 	return buf;
 
 free_buf:
-	kfree(buf->commit);
 	kfree(buf->padding);
 	kfree(buf);
 	return NULL;
@@ -167,7 +162,7 @@ free_buf:
 void relay_destroy_buf(struct rchan_buf *buf)
 {
 	struct rchan *chan = buf->chan;
-	int i;
+	unsigned int i;
 
 	if (likely(buf->start)) {
 		vunmap(buf->start);
@@ -176,7 +171,6 @@ void relay_destroy_buf(struct rchan_buf 
 		kfree(buf->page_array);
 	}
 	kfree(buf->padding);
-	kfree(buf->commit);
 	kfree(buf);
 	kref_put(&chan->kref, relay_destroy_channel);
 }
fs/relayfs/relay.c +47 -166

367 lines not on this page · raw message

include/linux/relayfs_fs.h +43 -57

180 lines not on this page · raw message