hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/configfs/inode.c
....@@ -1,29 +1,15 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /* -*- mode: c; c-basic-offset: 8; -*-
23 * vim: noexpandtab sw=8 ts=8 sts=0:
34 *
45 * inode.c - basic inode and dentry operations.
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2 of the License, or (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public
17
- * License along with this program; if not, write to the
18
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
- * Boston, MA 021110-1307, USA.
206 *
217 * Based on sysfs:
228 * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel
239 *
2410 * configfs Copyright (C) 2005 Oracle. All rights reserved.
2511 *
26
- * Please see Documentation/filesystems/configfs/configfs.txt for more
12
+ * Please see Documentation/filesystems/configfs.rst for more
2713 * information.
2814 */
2915
....@@ -90,14 +76,11 @@
9076 if (ia_valid & ATTR_GID)
9177 sd_iattr->ia_gid = iattr->ia_gid;
9278 if (ia_valid & ATTR_ATIME)
93
- sd_iattr->ia_atime = timespec64_trunc(iattr->ia_atime,
94
- inode->i_sb->s_time_gran);
79
+ sd_iattr->ia_atime = iattr->ia_atime;
9580 if (ia_valid & ATTR_MTIME)
96
- sd_iattr->ia_mtime = timespec64_trunc(iattr->ia_mtime,
97
- inode->i_sb->s_time_gran);
81
+ sd_iattr->ia_mtime = iattr->ia_mtime;
9882 if (ia_valid & ATTR_CTIME)
99
- sd_iattr->ia_ctime = timespec64_trunc(iattr->ia_ctime,
100
- inode->i_sb->s_time_gran);
83
+ sd_iattr->ia_ctime = iattr->ia_ctime;
10184 if (ia_valid & ATTR_MODE) {
10285 umode_t mode = iattr->ia_mode;
10386
....@@ -178,41 +161,27 @@
178161
179162 #endif /* CONFIG_LOCKDEP */
180163
181
-int configfs_create(struct dentry * dentry, umode_t mode, void (*init)(struct inode *))
164
+struct inode *configfs_create(struct dentry *dentry, umode_t mode)
182165 {
183
- int error = 0;
184166 struct inode *inode = NULL;
185167 struct configfs_dirent *sd;
186168 struct inode *p_inode;
187169
188170 if (!dentry)
189
- return -ENOENT;
171
+ return ERR_PTR(-ENOENT);
190172
191173 if (d_really_is_positive(dentry))
192
- return -EEXIST;
174
+ return ERR_PTR(-EEXIST);
193175
194176 sd = dentry->d_fsdata;
195177 inode = configfs_new_inode(mode, sd, dentry->d_sb);
196178 if (!inode)
197
- return -ENOMEM;
179
+ return ERR_PTR(-ENOMEM);
198180
199181 p_inode = d_inode(dentry->d_parent);
200182 p_inode->i_mtime = p_inode->i_ctime = current_time(p_inode);
201183 configfs_set_inode_lock_class(sd, inode);
202
-
203
- init(inode);
204
- if (S_ISDIR(mode) || S_ISLNK(mode)) {
205
- /*
206
- * ->symlink(), ->mkdir(), configfs_register_subsystem() or
207
- * create_default_group() - already hashed.
208
- */
209
- d_instantiate(dentry, inode);
210
- dget(dentry); /* pin link and directory dentries in core */
211
- } else {
212
- /* ->lookup() */
213
- d_add(dentry, inode);
214
- }
215
- return error;
184
+ return inode;
216185 }
217186
218187 /*