Lines 380-391
static int proc_revalidate_dentry(struct dentry *dentry, struct nameidata *nd)
Link Here
|
380 |
return 0; |
380 |
return 0; |
381 |
} |
381 |
} |
382 |
|
382 |
|
383 |
static struct dentry_operations proc_dentry_operations = |
383 |
static struct dentry_operations proc_dentry_shadow_operations = |
384 |
{ |
384 |
{ |
385 |
.d_delete = proc_delete_dentry, |
385 |
.d_delete = proc_delete_dentry, |
386 |
.d_revalidate = proc_revalidate_dentry, |
386 |
.d_revalidate = proc_revalidate_dentry, |
387 |
}; |
387 |
}; |
388 |
|
388 |
|
|
|
389 |
static struct dentry_operations proc_dentry_operations = |
390 |
{ |
391 |
.d_delete = proc_delete_dentry, |
392 |
}; |
393 |
|
389 |
/* |
394 |
/* |
390 |
* Don't create negative dentries here, return -ENOENT by hand |
395 |
* Don't create negative dentries here, return -ENOENT by hand |
391 |
* instead. |
396 |
* instead. |
Lines 394-399
struct dentry *proc_lookup(struct inode * dir, struct dentry *dentry, struct nam
Link Here
|
394 |
{ |
399 |
{ |
395 |
struct inode *inode = NULL; |
400 |
struct inode *inode = NULL; |
396 |
struct proc_dir_entry * de; |
401 |
struct proc_dir_entry * de; |
|
|
402 |
int use_shadow = 0; |
397 |
int error = -ENOENT; |
403 |
int error = -ENOENT; |
398 |
|
404 |
|
399 |
lock_kernel(); |
405 |
lock_kernel(); |
Lines 406-413
struct dentry *proc_lookup(struct inode * dir, struct dentry *dentry, struct nam
Link Here
|
406 |
if (!memcmp(dentry->d_name.name, de->name, de->namelen)) { |
412 |
if (!memcmp(dentry->d_name.name, de->name, de->namelen)) { |
407 |
unsigned int ino; |
413 |
unsigned int ino; |
408 |
|
414 |
|
409 |
if (de->shadow_proc) |
415 |
if (de->shadow_proc) { |
410 |
de = de->shadow_proc(current, de); |
416 |
de = de->shadow_proc(current, de); |
|
|
417 |
use_shadow = 1; |
418 |
} |
411 |
ino = de->low_ino; |
419 |
ino = de->low_ino; |
412 |
de_get(de); |
420 |
de_get(de); |
413 |
spin_unlock(&proc_subdir_lock); |
421 |
spin_unlock(&proc_subdir_lock); |
Lines 423-428
struct dentry *proc_lookup(struct inode * dir, struct dentry *dentry, struct nam
Link Here
|
423 |
|
431 |
|
424 |
if (inode) { |
432 |
if (inode) { |
425 |
dentry->d_op = &proc_dentry_operations; |
433 |
dentry->d_op = &proc_dentry_operations; |
|
|
434 |
dentry->d_op = use_shadow ? |
435 |
&proc_dentry_shadow_operations : dentry->d_parent->d_op; |
426 |
d_add(dentry, inode); |
436 |
d_add(dentry, inode); |
427 |
return NULL; |
437 |
return NULL; |
428 |
} |
438 |
} |