Home » Mailing lists » Devel » [RFC] network namespaces
[PATCH 6/9] allow proc_dir_entries to have destructor [message #5168 is a reply to message #5165] |
Tue, 15 August 2006 14:48   |
Andrey Savochkin
Messages: 47 Registered: December 2005
|
Member |
|
|
Destructor field added proc_dir_entries,
standard destructor kfree'ing data introduced.
Signed-off-by: Andrey Savochkin <saw@swsoft.com>
---
fs/proc/generic.c | 10 ++++++++--
fs/proc/root.c | 1 +
include/linux/proc_fs.h | 4 ++++
3 files changed, 13 insertions(+), 2 deletions(-)
--- ./fs/proc/generic.c.veprocdtor Mon Aug 14 16:43:41 2006
+++ ./fs/proc/generic.c Tue Aug 15 13:45:51 2006
@@ -608,6 +608,11 @@ static struct proc_dir_entry *proc_creat
return ent;
}
+void proc_data_destructor(struct proc_dir_entry *ent)
+{
+ kfree(ent->data);
+}
+
struct proc_dir_entry *proc_symlink(const char *name,
struct proc_dir_entry *parent, const char *dest)
{
@@ -620,6 +625,7 @@ struct proc_dir_entry *proc_symlink(cons
ent->data = kmalloc((ent->size=strlen(dest))+1, GFP_KERNEL);
if (ent->data) {
strcpy((char*)ent->data,dest);
+ ent->destructor = proc_data_destructor;
if (proc_register(parent, ent) < 0) {
kfree(ent->data);
kfree(ent);
@@ -698,8 +704,8 @@ void free_proc_entry(struct proc_dir_ent
release_inode_number(ino);
- if (S_ISLNK(de->mode) && de->data)
- kfree(de->data);
+ if (de->destructor)
+ de->destructor(de);
kfree(de);
}
--- ./fs/proc/root.c.veprocdtor Mon Aug 14 17:02:38 2006
+++ ./fs/proc/root.c Tue Aug 15 13:45:51 2006
@@ -154,6 +154,7 @@ EXPORT_SYMBOL(proc_symlink);
EXPORT_SYMBOL(proc_mkdir);
EXPORT_SYMBOL(create_proc_entry);
EXPORT_SYMBOL(remove_proc_entry);
+EXPORT_SYMBOL(proc_data_destructor);
EXPORT_SYMBOL(proc_root);
EXPORT_SYMBOL(proc_root_fs);
EXPORT_SYMBOL(proc_net);
--- ./include/linux/proc_fs.h.veprocdtor Mon Aug 14 17:02:47 2006
+++ ./include/linux/proc_fs.h Tue Aug 15 13:45:51 2006
@@ -46,6 +46,8 @@ typedef int (read_proc_t)(char *page, ch
typedef int (write_proc_t)(struct file *file, const char __user *buffer,
unsigned long count, void *data);
typedef int (get_info_t)(char *, char **, off_t, int);
+struct proc_dir_entry;
+typedef void (destroy_proc_t)(struct proc_dir_entry *);
struct proc_dir_entry {
unsigned int low_ino;
@@ -65,6 +67,7 @@ struct proc_dir_entry {
read_proc_t *read_proc;
write_proc_t *write_proc;
atomic_t count; /* use count */
+ destroy_proc_t *destructor;
int deleted; /* delete flag */
void *set;
};
@@ -109,6 +112,7 @@ char *task_mem(struct mm_struct *, char
extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
struct proc_dir_entry *parent);
extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent);
+extern void proc_data_destructor(struct proc_dir_entry *);
extern struct vfsmount *proc_mnt;
extern int proc_fill_super(struct super_block *,void *,int);
|
|
|
 |
|
[RFC] network namespaces
|
 |
|
[PATCH 1/9] network namespaces: core and device list
|
 |
|
Re: [PATCH 1/9] network namespaces: core and device list
|
 |
|
Re: [PATCH 1/9] network namespaces: core and device list
|
 |
|
[PATCH 2/9] network namespaces: IPv4 routing
|
 |
|
[PATCH 6/9] allow proc_dir_entries to have destructor
|
 |
|
[PATCH 5/9] network namespaces: async socket operations
|
 |
|
Re: [PATCH 5/9] network namespaces: async socket operations
|
 |
|
Re: [PATCH 5/9] network namespaces: async socket operations
|
 |
|
[PATCH 7/9] net_device seq_file
|
 |
|
[PATCH 8/9] network namespaces: device to pass packets between namespaces
|
 |
|
[PATCH 4/9] network namespaces: socket hashes
|
 |
|
Re: [PATCH 4/9] network namespaces: socket hashes
|
 |
|
Re: [PATCH 4/9] network namespaces: socket hashes
|
 |
|
Re: [PATCH 4/9] network namespaces: socket hashes
|
 |
|
[PATCH 9/9] network namespaces: playing with pass-through device
|
 |
|
Re: [RFC] network namespaces
By: serue on Wed, 16 August 2006 11:53
|
 |
|
Re: [RFC] network namespaces
|
 |
|
Re: [RFC] network namespaces
By: ebiederm on Wed, 16 August 2006 17:35
|
 |
|
Re: [RFC] network namespaces
By: dev on Thu, 17 August 2006 08:28
|
 |
|
Re: [RFC] network namespaces
|
 |
|
Re: [RFC] network namespaces
By: ebiederm on Tue, 05 September 2006 14:45
|
 |
|
Re: [RFC] network namespaces
|
 |
|
Re: [RFC] network namespaces
|
 |
|
Re: [RFC] network namespaces
|
 |
|
Re: Re: [RFC] network namespaces
By: kir on Wed, 06 September 2006 17:36
|
 |
|
Re: [RFC] network namespaces
By: ebiederm on Wed, 06 September 2006 18:34
|
 |
|
Re: [RFC] network namespaces
By: kir on Wed, 06 September 2006 18:56
|
 |
|
Re: [RFC] network namespaces
|
 |
|
RE: [RFC] network namespaces
|
 |
|
Re: [RFC] network namespaces
|
 |
|
Re: [RFC] network namespaces
By: ebiederm on Thu, 07 September 2006 18:29
|
 |
|
Re: [RFC] network namespaces
|
 |
|
Re: Re: [RFC] network namespaces
By: dev on Thu, 07 September 2006 16:20
|
 |
|
Re: Re: [RFC] network namespaces
|
 |
|
Re: Re: [RFC] network namespaces
|
 |
|
Re: Re: [RFC] network namespaces
|
 |
|
Re: Re: [RFC] network namespaces
|
 |
|
Re: Re: [RFC] network namespaces
|
 |
|
Re: Re: [RFC] network namespaces
|
 |
|
Re: Re: [RFC] network namespaces
|
 |
|
Re: [RFC] network namespaces
By: ebiederm on Tue, 12 September 2006 03:26
|
 |
|
Re: Re: [RFC] network namespaces
By: ebiederm on Sun, 10 September 2006 03:41
|
 |
|
Re: Re: [RFC] network namespaces
|
 |
|
Re: Re: [RFC] network namespaces
|
 |
|
Re: Re: [RFC] network namespaces
|
 |
|
Re: Re: [RFC] network namespaces
|
 |
|
Re: Re: [RFC] network namespaces
|
 |
|
Re: Re: [RFC] network namespaces
|
 |
|
Re: [RFC] network namespaces
By: ebiederm on Tue, 12 September 2006 03:28
|
 |
|
Re: [RFC] network namespaces
|
 |
|
Re: Re: [RFC] network namespaces
By: ebiederm on Thu, 07 September 2006 19:50
|
 |
|
Re: Re: [RFC] network namespaces
|
 |
|
Re: [RFC] network namespaces
By: ebiederm on Wed, 06 September 2006 17:58
|
 |
|
Re: [RFC] network namespaces
By: ebiederm on Tue, 05 September 2006 18:27
|
 |
|
Re: [RFC] network namespaces
By: dev on Wed, 06 September 2006 14:52
|
 |
|
Re: [RFC] network namespaces
|
 |
|
Re: [RFC] network namespaces
By: dev on Tue, 05 September 2006 15:44
|
 |
|
Re: [RFC] network namespaces
By: ebiederm on Tue, 05 September 2006 17:09
|
 |
|
Re: [RFC] network namespaces
|
 |
|
Re: Re: [RFC] network namespaces
By: kir on Wed, 06 September 2006 15:09
|
 |
|
Re: [RFC] network namespaces
By: ebiederm on Wed, 06 September 2006 20:40
|
 |
|
Re: [RFC] network namespaces
By: ebiederm on Wed, 06 September 2006 23:25
|
 |
|
Re: [RFC] network namespaces
|
 |
|
Re: [RFC] network namespaces
By: ebiederm on Thu, 07 September 2006 05:11
|
 |
|
Re: [RFC] network namespaces
|
 |
|
Re: [RFC] network namespaces
By: ebiederm on Sun, 10 September 2006 11:48
|
Goto Forum:
Current Time: Mon Sep 08 23:31:04 GMT 2025
Total time taken to generate the page: 0.08243 seconds
|