inode.c (01b944fe1cd4e21a2a9ed51adbdbafe2d5e905ba) inode.c (5955102c9984fa081b2d570cfac75c97eecf8f3b)
1/*
2 * inode.c - securityfs
3 *
4 * Copyright (C) 2005 Greg Kroah-Hartman <gregkh@suse.de>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version
8 * 2 as published by the Free Software Foundation.

--- 85 unchanged lines hidden (view full) ---

94 if (error)
95 return ERR_PTR(error);
96
97 if (!parent)
98 parent = mount->mnt_root;
99
100 dir = d_inode(parent);
101
1/*
2 * inode.c - securityfs
3 *
4 * Copyright (C) 2005 Greg Kroah-Hartman <gregkh@suse.de>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version
8 * 2 as published by the Free Software Foundation.

--- 85 unchanged lines hidden (view full) ---

94 if (error)
95 return ERR_PTR(error);
96
97 if (!parent)
98 parent = mount->mnt_root;
99
100 dir = d_inode(parent);
101
102 mutex_lock(&dir->i_mutex);
102 inode_lock(dir);
103 dentry = lookup_one_len(name, parent, strlen(name));
104 if (IS_ERR(dentry))
105 goto out;
106
107 if (d_really_is_positive(dentry)) {
108 error = -EEXIST;
109 goto out1;
110 }

--- 13 unchanged lines hidden (view full) ---

124 inode->i_fop = &simple_dir_operations;
125 inc_nlink(inode);
126 inc_nlink(dir);
127 } else {
128 inode->i_fop = fops;
129 }
130 d_instantiate(dentry, inode);
131 dget(dentry);
103 dentry = lookup_one_len(name, parent, strlen(name));
104 if (IS_ERR(dentry))
105 goto out;
106
107 if (d_really_is_positive(dentry)) {
108 error = -EEXIST;
109 goto out1;
110 }

--- 13 unchanged lines hidden (view full) ---

124 inode->i_fop = &simple_dir_operations;
125 inc_nlink(inode);
126 inc_nlink(dir);
127 } else {
128 inode->i_fop = fops;
129 }
130 d_instantiate(dentry, inode);
131 dget(dentry);
132 mutex_unlock(&dir->i_mutex);
132 inode_unlock(dir);
133 return dentry;
134
135out1:
136 dput(dentry);
137 dentry = ERR_PTR(error);
138out:
133 return dentry;
134
135out1:
136 dput(dentry);
137 dentry = ERR_PTR(error);
138out:
139 mutex_unlock(&dir->i_mutex);
139 inode_unlock(dir);
140 simple_release_fs(&mount, &mount_count);
141 return dentry;
142}
143EXPORT_SYMBOL_GPL(securityfs_create_file);
144
145/**
146 * securityfs_create_dir - create a directory in the securityfs filesystem
147 *

--- 42 unchanged lines hidden (view full) ---

190
191 if (!dentry || IS_ERR(dentry))
192 return;
193
194 parent = dentry->d_parent;
195 if (!parent || d_really_is_negative(parent))
196 return;
197
140 simple_release_fs(&mount, &mount_count);
141 return dentry;
142}
143EXPORT_SYMBOL_GPL(securityfs_create_file);
144
145/**
146 * securityfs_create_dir - create a directory in the securityfs filesystem
147 *

--- 42 unchanged lines hidden (view full) ---

190
191 if (!dentry || IS_ERR(dentry))
192 return;
193
194 parent = dentry->d_parent;
195 if (!parent || d_really_is_negative(parent))
196 return;
197
198 mutex_lock(&d_inode(parent)->i_mutex);
198 inode_lock(d_inode(parent));
199 if (simple_positive(dentry)) {
200 if (d_is_dir(dentry))
201 simple_rmdir(d_inode(parent), dentry);
202 else
203 simple_unlink(d_inode(parent), dentry);
204 dput(dentry);
205 }
199 if (simple_positive(dentry)) {
200 if (d_is_dir(dentry))
201 simple_rmdir(d_inode(parent), dentry);
202 else
203 simple_unlink(d_inode(parent), dentry);
204 dput(dentry);
205 }
206 mutex_unlock(&d_inode(parent)->i_mutex);
206 inode_unlock(d_inode(parent));
207 simple_release_fs(&mount, &mount_count);
208}
209EXPORT_SYMBOL_GPL(securityfs_remove);
210
211static int __init securityfs_init(void)
212{
213 int retval;
214

--- 13 unchanged lines hidden ---
207 simple_release_fs(&mount, &mount_count);
208}
209EXPORT_SYMBOL_GPL(securityfs_remove);
210
211static int __init securityfs_init(void)
212{
213 int retval;
214

--- 13 unchanged lines hidden ---