.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* -*- mode: c; c-basic-offset: 8; -*- |
---|
2 | 3 | * vim: noexpandtab sw=8 ts=8 sts=0: |
---|
3 | 4 | * |
---|
4 | 5 | * 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. |
---|
20 | 6 | * |
---|
21 | 7 | * Based on sysfs: |
---|
22 | 8 | * sysfs is Copyright (C) 2001, 2002, 2003 Patrick Mochel |
---|
23 | 9 | * |
---|
24 | 10 | * configfs Copyright (C) 2005 Oracle. All rights reserved. |
---|
25 | 11 | * |
---|
26 | | - * Please see Documentation/filesystems/configfs/configfs.txt for more |
---|
| 12 | + * Please see Documentation/filesystems/configfs.rst for more |
---|
27 | 13 | * information. |
---|
28 | 14 | */ |
---|
29 | 15 | |
---|
.. | .. |
---|
90 | 76 | if (ia_valid & ATTR_GID) |
---|
91 | 77 | sd_iattr->ia_gid = iattr->ia_gid; |
---|
92 | 78 | 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; |
---|
95 | 80 | 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; |
---|
98 | 82 | 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; |
---|
101 | 84 | if (ia_valid & ATTR_MODE) { |
---|
102 | 85 | umode_t mode = iattr->ia_mode; |
---|
103 | 86 | |
---|
.. | .. |
---|
178 | 161 | |
---|
179 | 162 | #endif /* CONFIG_LOCKDEP */ |
---|
180 | 163 | |
---|
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) |
---|
182 | 165 | { |
---|
183 | | - int error = 0; |
---|
184 | 166 | struct inode *inode = NULL; |
---|
185 | 167 | struct configfs_dirent *sd; |
---|
186 | 168 | struct inode *p_inode; |
---|
187 | 169 | |
---|
188 | 170 | if (!dentry) |
---|
189 | | - return -ENOENT; |
---|
| 171 | + return ERR_PTR(-ENOENT); |
---|
190 | 172 | |
---|
191 | 173 | if (d_really_is_positive(dentry)) |
---|
192 | | - return -EEXIST; |
---|
| 174 | + return ERR_PTR(-EEXIST); |
---|
193 | 175 | |
---|
194 | 176 | sd = dentry->d_fsdata; |
---|
195 | 177 | inode = configfs_new_inode(mode, sd, dentry->d_sb); |
---|
196 | 178 | if (!inode) |
---|
197 | | - return -ENOMEM; |
---|
| 179 | + return ERR_PTR(-ENOMEM); |
---|
198 | 180 | |
---|
199 | 181 | p_inode = d_inode(dentry->d_parent); |
---|
200 | 182 | p_inode->i_mtime = p_inode->i_ctime = current_time(p_inode); |
---|
201 | 183 | 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; |
---|
216 | 185 | } |
---|
217 | 186 | |
---|
218 | 187 | /* |
---|