diff options
author | Jan Blunck <jblunck@suse.de> | 2008-02-14 22:34:32 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-15 00:13:33 -0500 |
commit | 4ac9137858e08a19f29feac4e1f4df7c268b0ba5 (patch) | |
tree | f5b5d84fd12fcc2b0ba0e7ce1a79ff381ad8f5dd /kernel | |
parent | c5e725f33b733a77de622e91b6ba5645fcf070be (diff) |
Embed a struct path into struct nameidata instead of nd->{dentry,mnt}
This is the central patch of a cleanup series. In most cases there is no good
reason why someone would want to use a dentry for itself. This series reflects
that fact and embeds a struct path into nameidata.
Together with the other patches of this series
- it enforced the correct order of getting/releasing the reference count on
<dentry,vfsmount> pairs
- it prepares the VFS for stacking support since it is essential to have a
struct path in every place where the stack can be traversed
- it reduces the overall code size:
without patch series:
text data bss dec hex filename
5321639 858418 715768 6895825 6938d1 vmlinux
with patch series:
text data bss dec hex filename
5320026 858418 715768 6894212 693284 vmlinux
This patch:
Switch from nd->{dentry,mnt} to nd->path.{dentry,mnt} everywhere.
[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: fix cifs]
[akpm@linux-foundation.org: fix smack]
Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/audit_tree.c | 16 | ||||
-rw-r--r-- | kernel/auditfilter.c | 11 |
2 files changed, 14 insertions, 13 deletions
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c index f4fcf58f20f8..b898814fe4a0 100644 --- a/kernel/audit_tree.c +++ b/kernel/audit_tree.c | |||
@@ -549,7 +549,7 @@ void audit_trim_trees(void) | |||
549 | if (err) | 549 | if (err) |
550 | goto skip_it; | 550 | goto skip_it; |
551 | 551 | ||
552 | root_mnt = collect_mounts(nd.mnt, nd.dentry); | 552 | root_mnt = collect_mounts(nd.path.mnt, nd.path.dentry); |
553 | path_release(&nd); | 553 | path_release(&nd); |
554 | if (!root_mnt) | 554 | if (!root_mnt) |
555 | goto skip_it; | 555 | goto skip_it; |
@@ -583,17 +583,17 @@ skip_it: | |||
583 | static int is_under(struct vfsmount *mnt, struct dentry *dentry, | 583 | static int is_under(struct vfsmount *mnt, struct dentry *dentry, |
584 | struct nameidata *nd) | 584 | struct nameidata *nd) |
585 | { | 585 | { |
586 | if (mnt != nd->mnt) { | 586 | if (mnt != nd->path.mnt) { |
587 | for (;;) { | 587 | for (;;) { |
588 | if (mnt->mnt_parent == mnt) | 588 | if (mnt->mnt_parent == mnt) |
589 | return 0; | 589 | return 0; |
590 | if (mnt->mnt_parent == nd->mnt) | 590 | if (mnt->mnt_parent == nd->path.mnt) |
591 | break; | 591 | break; |
592 | mnt = mnt->mnt_parent; | 592 | mnt = mnt->mnt_parent; |
593 | } | 593 | } |
594 | dentry = mnt->mnt_mountpoint; | 594 | dentry = mnt->mnt_mountpoint; |
595 | } | 595 | } |
596 | return is_subdir(dentry, nd->dentry); | 596 | return is_subdir(dentry, nd->path.dentry); |
597 | } | 597 | } |
598 | 598 | ||
599 | int audit_make_tree(struct audit_krule *rule, char *pathname, u32 op) | 599 | int audit_make_tree(struct audit_krule *rule, char *pathname, u32 op) |
@@ -641,7 +641,7 @@ int audit_add_tree_rule(struct audit_krule *rule) | |||
641 | err = path_lookup(tree->pathname, 0, &nd); | 641 | err = path_lookup(tree->pathname, 0, &nd); |
642 | if (err) | 642 | if (err) |
643 | goto Err; | 643 | goto Err; |
644 | mnt = collect_mounts(nd.mnt, nd.dentry); | 644 | mnt = collect_mounts(nd.path.mnt, nd.path.dentry); |
645 | path_release(&nd); | 645 | path_release(&nd); |
646 | if (!mnt) { | 646 | if (!mnt) { |
647 | err = -ENOMEM; | 647 | err = -ENOMEM; |
@@ -701,7 +701,7 @@ int audit_tag_tree(char *old, char *new) | |||
701 | err = path_lookup(new, 0, &nd); | 701 | err = path_lookup(new, 0, &nd); |
702 | if (err) | 702 | if (err) |
703 | return err; | 703 | return err; |
704 | tagged = collect_mounts(nd.mnt, nd.dentry); | 704 | tagged = collect_mounts(nd.path.mnt, nd.path.dentry); |
705 | path_release(&nd); | 705 | path_release(&nd); |
706 | if (!tagged) | 706 | if (!tagged) |
707 | return -ENOMEM; | 707 | return -ENOMEM; |
@@ -711,8 +711,8 @@ int audit_tag_tree(char *old, char *new) | |||
711 | drop_collected_mounts(tagged); | 711 | drop_collected_mounts(tagged); |
712 | return err; | 712 | return err; |
713 | } | 713 | } |
714 | mnt = mntget(nd.mnt); | 714 | mnt = mntget(nd.path.mnt); |
715 | dentry = dget(nd.dentry); | 715 | dentry = dget(nd.path.dentry); |
716 | path_release(&nd); | 716 | path_release(&nd); |
717 | 717 | ||
718 | if (dentry == tagged->mnt_root && dentry == mnt->mnt_root) | 718 | if (dentry == tagged->mnt_root && dentry == mnt->mnt_root) |
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c index 6f19fd477aac..a36e66797c3d 100644 --- a/kernel/auditfilter.c +++ b/kernel/auditfilter.c | |||
@@ -169,8 +169,8 @@ static struct audit_parent *audit_init_parent(struct nameidata *ndp) | |||
169 | inotify_init_watch(&parent->wdata); | 169 | inotify_init_watch(&parent->wdata); |
170 | /* grab a ref so inotify watch hangs around until we take audit_filter_mutex */ | 170 | /* grab a ref so inotify watch hangs around until we take audit_filter_mutex */ |
171 | get_inotify_watch(&parent->wdata); | 171 | get_inotify_watch(&parent->wdata); |
172 | wd = inotify_add_watch(audit_ih, &parent->wdata, ndp->dentry->d_inode, | 172 | wd = inotify_add_watch(audit_ih, &parent->wdata, |
173 | AUDIT_IN_WATCH); | 173 | ndp->path.dentry->d_inode, AUDIT_IN_WATCH); |
174 | if (wd < 0) { | 174 | if (wd < 0) { |
175 | audit_free_parent(&parent->wdata); | 175 | audit_free_parent(&parent->wdata); |
176 | return ERR_PTR(wd); | 176 | return ERR_PTR(wd); |
@@ -1214,8 +1214,8 @@ static int audit_add_watch(struct audit_krule *krule, struct nameidata *ndp, | |||
1214 | 1214 | ||
1215 | /* update watch filter fields */ | 1215 | /* update watch filter fields */ |
1216 | if (ndw) { | 1216 | if (ndw) { |
1217 | watch->dev = ndw->dentry->d_inode->i_sb->s_dev; | 1217 | watch->dev = ndw->path.dentry->d_inode->i_sb->s_dev; |
1218 | watch->ino = ndw->dentry->d_inode->i_ino; | 1218 | watch->ino = ndw->path.dentry->d_inode->i_ino; |
1219 | } | 1219 | } |
1220 | 1220 | ||
1221 | /* The audit_filter_mutex must not be held during inotify calls because | 1221 | /* The audit_filter_mutex must not be held during inotify calls because |
@@ -1225,7 +1225,8 @@ static int audit_add_watch(struct audit_krule *krule, struct nameidata *ndp, | |||
1225 | */ | 1225 | */ |
1226 | mutex_unlock(&audit_filter_mutex); | 1226 | mutex_unlock(&audit_filter_mutex); |
1227 | 1227 | ||
1228 | if (inotify_find_watch(audit_ih, ndp->dentry->d_inode, &i_watch) < 0) { | 1228 | if (inotify_find_watch(audit_ih, ndp->path.dentry->d_inode, |
1229 | &i_watch) < 0) { | ||
1229 | parent = audit_init_parent(ndp); | 1230 | parent = audit_init_parent(ndp); |
1230 | if (IS_ERR(parent)) { | 1231 | if (IS_ERR(parent)) { |
1231 | /* caller expects mutex locked */ | 1232 | /* caller expects mutex locked */ |