OpenVZ Forum


Home » Mailing lists » Devel » [PATCH 0/6][NET-2.6.24] Consolidate private allocations in seq files
[PATCH 6/6][NET-2.6.24] Make the sunrpc use the seq_open_private() [message #21468 is a reply to message #21462] Tue, 09 October 2007 16:04 Go to previous messageGo to previous message
Pavel Emelianov is currently offline  Pavel Emelianov
Messages: 1149
Registered: September 2006
Senior Member
Just switch to the consolidated code.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Cc: Neil Brown <neilb@cse.unsw.edu.au>

---

diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index ebe344f..8e05557 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1218,23 +1218,15 @@ static const struct seq_operations cache
 
 static int content_open(struct inode *inode, struct file *file)
 {
-	int res;
 	struct handle *han;
 	struct cache_detail *cd = PDE(inode)->data;
 
-	han = kmalloc(sizeof(*han), GFP_KERNEL);
+	han = __seq_open_private(file, &cache_content_op, sizeof(*han));
 	if (han == NULL)
 		return -ENOMEM;
 
 	han->cd = cd;
-
-	res = seq_open(file, &cache_content_op);
-	if (res)
-		kfree(han);
-	else
-		((struct seq_file *)file->private_data)->private = han;
-
-	return res;
+	return 0;
 }
 
 static const struct file_operations content_file_operations = {
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [RFC] [PATCH] memory controller statistics
Next Topic: [PATCH][NET-2.6.24] Remove double dev->flags checking when calling dev_close()
Goto Forum:
  


Current Time: Sat Sep 13 15:14:50 GMT 2025

Total time taken to generate the page: 0.10089 seconds