Skip to contentSkip to conversation

proc entry path name

KJ Amol Lad 4 participants 5 messages Sep 15, 2006 – Sep 19, 2006 Kernel janitors

lore
Share & tools
lore
#1 lore raw
Quoted 5 lines · Amol Lad

I'm doing create_proc_entry return code audit. On failure I would like to print "Unable to create /proc/foo/bar".

Is there a function that takes struct proc_dir_entry * and returns fullpathname ?

Me not understand why would you want it.

	entry = create_proc_entry("alexey", 0644, NULL);
	if (!entry) {
		printk(KERN_ERR "foo: create_proc_entry alexey failed\n");
			...
	}

	Alexey #define KERN_ERR "" Dobriyan

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw
In reply to Amol Lad

hi all,
so far i understand the question was how to:

entry = create_proc_entry("alexey", 0644, NULL);

if (!entry) {
		printk(KERN_ERR "foo: create_proc_entry >%s< failed\n",realpath);
	}

KERN_ERR "foo: create_proc_entry >/proc/maintainers/janitor/alexey< failed

in very nested configurations (that you should not have) there may be more than one alexey. and you end up with a knowledge that one of them failed. something like getcwd() would be helpful.

re,
walter

Quoted 17 lines · Alexey Dobriyan
Quoted 5 lines · Amol Lad

I'm doing create_proc_entry return code audit. On failure I would like to print "Unable to create /proc/foo/bar".

Is there a function that takes struct proc_dir_entry * and returns fullpathname ?

Me not understand why would you want it.

	entry = create_proc_entry("alexey", 0644, NULL);
	if (!entry) {
		printk(KERN_ERR "foo: create_proc_entry alexey failed\n");
			...
	}

	Alexey #define KERN_ERR "" Dobriyan
Quoted 7 lines

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw
In reply to Amol Lad

Hi,

Quoted 9 lines · walter harms

hi all,
so far i understand the question was how to:

entry = create_proc_entry("alexey", 0644, NULL);

if (!entry) {
		printk(KERN_ERR "foo: create_proc_entry >%s
	}
Quoted 5 lines

KERN_ERR "foo: create_proc_entry >/proc/maintainers/janitor/alexey

in very nested configurations (that you should not have) there may be more than one alexey. and you end up with a knowledge that one of them failed. something like getcwd() would be helpful.

Correct me if I am wrong but isn't it true that if create_proc_entry() is called with the 3rd parameter as NULL, it implies that the parent directory is '/proc' (or technically the symbol - 'proc_root') ?

Also, isn't it true, if it is not called this way, (ie: if it is called as - create_proc_entry("foobar", 0644, parent)) then parent->name is the full path of the parent ?

Regards
Steve

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

author
#4 lore raw
In reply to Amol Lad
Quoted 4 lines

Also, isn't it true, if it is not called this way, (ie: if it is called as - create_proc_entry("foobar", 0644, parent)) then parent->name is the full path of the parent ?

parent->name does not contains the full path of the parent. I think the only way to generate a full pathname is:

for (ent = leaf; ent != &proc_root; ent = ent->parent) {
	/* Extract ent->name and use it in preparing full pathname */
}
Quoted 9 lines

Regards
Steve

Quoted 6 lines

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors