diff options
| author | James Morris <jmorris@redhat.com> | 2004-10-25 04:14:02 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-10-25 04:14:02 -0700 |
| commit | e7ddba032a9efac9f865b7836e070bea6aec1ecc (patch) | |
| tree | b79c8ede804f3747766863c5f25ca41fe20cd758 /security | |
| parent | e9eef9fed769a1fd5cf91128767b06668dd6cd29 (diff) | |
[PATCH] Add d_alloc_name() to libfs
This patch consolidates several occurrences of duplicated code into a new
libfs function d_alloc_name().
Signed-off-by: James Morris <jmorris@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'security')
| -rw-r--r-- | security/selinux/selinuxfs.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index 57c2c8eaf060..9731ff21e153 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c @@ -818,7 +818,6 @@ static int sel_make_bools(void) struct dentry *dir = bool_dir; struct inode *inode = NULL; struct inode_security_struct *isec; - struct qstr qname; char **names = NULL, *page; int num; int *values = NULL; @@ -838,10 +837,7 @@ static int sel_make_bools(void) goto out; for (i = 0; i < num; i++) { - qname.name = names[i]; - qname.len = strlen(qname.name); - qname.hash = full_name_hash(qname.name, qname.len); - dentry = d_alloc(dir, &qname); + dentry = d_alloc_name(dir, names[i]); if (!dentry) { ret = -ENOMEM; goto err; @@ -896,7 +892,6 @@ static int sel_fill_super(struct super_block * sb, void * data, int silent) int ret; struct dentry *dentry; struct inode *inode; - struct qstr qname; struct inode_security_struct *isec; static struct tree_descr selinux_files[] = { @@ -917,10 +912,7 @@ static int sel_fill_super(struct super_block * sb, void * data, int silent) if (ret) return ret; - qname.name = BOOL_DIR_NAME; - qname.len = strlen(qname.name); - qname.hash = full_name_hash(qname.name, qname.len); - dentry = d_alloc(sb->s_root, &qname); + dentry = d_alloc_name(sb->s_root, BOOL_DIR_NAME); if (!dentry) return -ENOMEM; @@ -935,10 +927,7 @@ static int sel_fill_super(struct super_block * sb, void * data, int silent) if (ret) goto out; - qname.name = NULL_FILE_NAME; - qname.len = strlen(qname.name); - qname.hash = full_name_hash(qname.name, qname.len); - dentry = d_alloc(sb->s_root, &qname); + dentry = d_alloc_name(sb->s_root, NULL_FILE_NAME); if (!dentry) return -ENOMEM; |
