mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 01:23:56 +02:00
Merge patch series "trivial ->setattr cleanups"
Christoph Hellwig <hch@lst.de> says: I've been looking into changes to ->setattr and noticed that we still have a few instances where the method has the ages old notify_change name. Fix this up and include dusting off outdated comments. * patches from https://patch.msgid.link/20260325063711.3298685-1-hch@lst.de: proc: rename proc_notify_change to proc_setattr proc: rename proc_setattr to proc_nochmod_setattr affs: rename affs_notify_change to affs_setattr adfs: rename adfs_notify_change to adfs_setattr hfs: update comments on hfs_inode_setattr Link: https://patch.msgid.link/20260325063711.3298685-1-hch@lst.de Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
commit
3c1fc671d3
|
|
@ -144,8 +144,8 @@ struct adfs_discmap {
|
|||
/* Inode stuff */
|
||||
struct inode *adfs_iget(struct super_block *sb, struct object_info *obj);
|
||||
int adfs_write_inode(struct inode *inode, struct writeback_control *wbc);
|
||||
int adfs_notify_change(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
struct iattr *attr);
|
||||
int adfs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
struct iattr *attr);
|
||||
|
||||
/* map.c */
|
||||
int adfs_map_lookup(struct super_block *sb, u32 frag_id, unsigned int offset);
|
||||
|
|
|
|||
|
|
@ -454,5 +454,5 @@ adfs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
|
|||
*/
|
||||
const struct inode_operations adfs_dir_inode_operations = {
|
||||
.lookup = adfs_lookup,
|
||||
.setattr = adfs_notify_change,
|
||||
.setattr = adfs_setattr,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -32,5 +32,5 @@ const struct file_operations adfs_file_operations = {
|
|||
};
|
||||
|
||||
const struct inode_operations adfs_file_inode_operations = {
|
||||
.setattr = adfs_notify_change,
|
||||
.setattr = adfs_setattr,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -299,8 +299,7 @@ adfs_iget(struct super_block *sb, struct object_info *obj)
|
|||
* later.
|
||||
*/
|
||||
int
|
||||
adfs_notify_change(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
struct iattr *attr)
|
||||
adfs_setattr(struct mnt_idmap *idmap, struct dentry *dentry, struct iattr *attr)
|
||||
{
|
||||
struct inode *inode = d_inode(dentry);
|
||||
struct super_block *sb = inode->i_sb;
|
||||
|
|
@ -355,8 +354,7 @@ adfs_notify_change(struct mnt_idmap *idmap, struct dentry *dentry,
|
|||
|
||||
/*
|
||||
* write an existing inode back to the directory, and therefore the disk.
|
||||
* The adfs-specific inode data has already been updated by
|
||||
* adfs_notify_change()
|
||||
* The adfs-specific inode data has already been updated by * adfs_setattr().
|
||||
*/
|
||||
int adfs_write_inode(struct inode *inode, struct writeback_control *wbc)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ extern int affs_rename2(struct mnt_idmap *idmap,
|
|||
/* inode.c */
|
||||
|
||||
extern struct inode *affs_new_inode(struct inode *dir);
|
||||
extern int affs_notify_change(struct mnt_idmap *idmap,
|
||||
extern int affs_setattr(struct mnt_idmap *idmap,
|
||||
struct dentry *dentry, struct iattr *attr);
|
||||
extern void affs_evict_inode(struct inode *inode);
|
||||
extern struct inode *affs_iget(struct super_block *sb,
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ const struct inode_operations affs_dir_inode_operations = {
|
|||
.mkdir = affs_mkdir,
|
||||
.rmdir = affs_rmdir,
|
||||
.rename = affs_rename2,
|
||||
.setattr = affs_notify_change,
|
||||
.setattr = affs_setattr,
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -1013,5 +1013,5 @@ const struct file_operations affs_file_operations = {
|
|||
};
|
||||
|
||||
const struct inode_operations affs_file_inode_operations = {
|
||||
.setattr = affs_notify_change,
|
||||
.setattr = affs_setattr,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -213,13 +213,12 @@ affs_write_inode(struct inode *inode, struct writeback_control *wbc)
|
|||
}
|
||||
|
||||
int
|
||||
affs_notify_change(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
struct iattr *attr)
|
||||
affs_setattr(struct mnt_idmap *idmap, struct dentry *dentry, struct iattr *attr)
|
||||
{
|
||||
struct inode *inode = d_inode(dentry);
|
||||
int error;
|
||||
|
||||
pr_debug("notify_change(%lu,0x%x)\n", inode->i_ino, attr->ia_valid);
|
||||
pr_debug("setattr(%lu,0x%x)\n", inode->i_ino, attr->ia_valid);
|
||||
|
||||
error = setattr_prepare(&nop_mnt_idmap, dentry, attr);
|
||||
if (error)
|
||||
|
|
|
|||
|
|
@ -71,5 +71,5 @@ const struct address_space_operations affs_symlink_aops = {
|
|||
|
||||
const struct inode_operations affs_symlink_inode_operations = {
|
||||
.get_link = page_get_link,
|
||||
.setattr = affs_notify_change,
|
||||
.setattr = affs_setattr,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -622,23 +622,6 @@ static int hfs_file_release(struct inode *inode, struct file *file)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* hfs_notify_change()
|
||||
*
|
||||
* Based very closely on fs/msdos/inode.c by Werner Almesberger
|
||||
*
|
||||
* This is the notify_change() field in the super_operations structure
|
||||
* for HFS file systems. The purpose is to take that changes made to
|
||||
* an inode and apply then in a filesystem-dependent manner. In this
|
||||
* case the process has a few of tasks to do:
|
||||
* 1) prevent changes to the i_uid and i_gid fields.
|
||||
* 2) map file permissions to the closest allowable permissions
|
||||
* 3) Since multiple Linux files can share the same on-disk inode under
|
||||
* HFS (for instance the data and resource forks of a file) a change
|
||||
* to permissions must be applied to all other in-core inodes which
|
||||
* correspond to the same HFS file.
|
||||
*/
|
||||
|
||||
int hfs_inode_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
struct iattr *attr)
|
||||
{
|
||||
|
|
@ -646,8 +629,7 @@ int hfs_inode_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
|
|||
struct hfs_sb_info *hsb = HFS_SB(inode->i_sb);
|
||||
int error;
|
||||
|
||||
error = setattr_prepare(&nop_mnt_idmap, dentry,
|
||||
attr); /* basic permission checks */
|
||||
error = setattr_prepare(&nop_mnt_idmap, dentry, attr);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
|
@ -663,6 +645,7 @@ int hfs_inode_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
|
|||
return hsb->s_quiet ? 0 : error;
|
||||
}
|
||||
|
||||
/* map file permissions to the closest allowable permissions in HFS */
|
||||
if (attr->ia_valid & ATTR_MODE) {
|
||||
/* Only the 'w' bits can ever change and only all together. */
|
||||
if (attr->ia_mode & S_IWUSR)
|
||||
|
|
|
|||
|
|
@ -721,7 +721,7 @@ static bool proc_fd_access_allowed(struct inode *inode)
|
|||
return allowed;
|
||||
}
|
||||
|
||||
int proc_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
int proc_nochmod_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
struct iattr *attr)
|
||||
{
|
||||
int error;
|
||||
|
|
@ -794,7 +794,7 @@ static int proc_pid_permission(struct mnt_idmap *idmap,
|
|||
|
||||
|
||||
static const struct inode_operations proc_def_inode_operations = {
|
||||
.setattr = proc_setattr,
|
||||
.setattr = proc_nochmod_setattr,
|
||||
};
|
||||
|
||||
static int proc_single_show(struct seq_file *m, void *v)
|
||||
|
|
@ -1866,7 +1866,7 @@ static int proc_pid_readlink(struct dentry * dentry, char __user * buffer, int b
|
|||
const struct inode_operations proc_pid_link_inode_operations = {
|
||||
.readlink = proc_pid_readlink,
|
||||
.get_link = proc_pid_get_link,
|
||||
.setattr = proc_setattr,
|
||||
.setattr = proc_nochmod_setattr,
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -2316,7 +2316,7 @@ proc_map_files_get_link(struct dentry *dentry,
|
|||
static const struct inode_operations proc_map_files_link_inode_operations = {
|
||||
.readlink = proc_pid_readlink,
|
||||
.get_link = proc_map_files_get_link,
|
||||
.setattr = proc_setattr,
|
||||
.setattr = proc_nochmod_setattr,
|
||||
};
|
||||
|
||||
static struct dentry *
|
||||
|
|
@ -2395,7 +2395,7 @@ static struct dentry *proc_map_files_lookup(struct inode *dir,
|
|||
static const struct inode_operations proc_map_files_inode_operations = {
|
||||
.lookup = proc_map_files_lookup,
|
||||
.permission = proc_fd_permission,
|
||||
.setattr = proc_setattr,
|
||||
.setattr = proc_nochmod_setattr,
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
@ -2882,7 +2882,7 @@ static struct dentry *proc_##LSM##_attr_dir_lookup(struct inode *dir, \
|
|||
static const struct inode_operations proc_##LSM##_attr_dir_inode_ops = { \
|
||||
.lookup = proc_##LSM##_attr_dir_lookup, \
|
||||
.getattr = pid_getattr, \
|
||||
.setattr = proc_setattr, \
|
||||
.setattr = proc_nochmod_setattr, \
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SECURITY_SMACK
|
||||
|
|
@ -2941,7 +2941,7 @@ static struct dentry *proc_attr_dir_lookup(struct inode *dir,
|
|||
static const struct inode_operations proc_attr_dir_inode_operations = {
|
||||
.lookup = proc_attr_dir_lookup,
|
||||
.getattr = pid_getattr,
|
||||
.setattr = proc_setattr,
|
||||
.setattr = proc_nochmod_setattr,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -3450,7 +3450,7 @@ static struct dentry *proc_tgid_base_lookup(struct inode *dir, struct dentry *de
|
|||
static const struct inode_operations proc_tgid_base_inode_operations = {
|
||||
.lookup = proc_tgid_base_lookup,
|
||||
.getattr = pid_getattr,
|
||||
.setattr = proc_setattr,
|
||||
.setattr = proc_nochmod_setattr,
|
||||
.permission = proc_pid_permission,
|
||||
};
|
||||
|
||||
|
|
@ -3647,7 +3647,7 @@ static int proc_tid_comm_permission(struct mnt_idmap *idmap,
|
|||
}
|
||||
|
||||
static const struct inode_operations proc_tid_comm_inode_operations = {
|
||||
.setattr = proc_setattr,
|
||||
.setattr = proc_nochmod_setattr,
|
||||
.permission = proc_tid_comm_permission,
|
||||
};
|
||||
|
||||
|
|
@ -3776,7 +3776,7 @@ static const struct file_operations proc_tid_base_operations = {
|
|||
static const struct inode_operations proc_tid_base_inode_operations = {
|
||||
.lookup = proc_tid_base_lookup,
|
||||
.getattr = pid_getattr,
|
||||
.setattr = proc_setattr,
|
||||
.setattr = proc_nochmod_setattr,
|
||||
};
|
||||
|
||||
static struct dentry *proc_task_instantiate(struct dentry *dentry,
|
||||
|
|
@ -3989,7 +3989,7 @@ static loff_t proc_dir_llseek(struct file *file, loff_t offset, int whence)
|
|||
static const struct inode_operations proc_task_inode_operations = {
|
||||
.lookup = proc_task_lookup,
|
||||
.getattr = proc_task_getattr,
|
||||
.setattr = proc_setattr,
|
||||
.setattr = proc_nochmod_setattr,
|
||||
.permission = proc_pid_permission,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ static int proc_fdinfo_permission(struct mnt_idmap *idmap, struct inode *inode,
|
|||
|
||||
static const struct inode_operations proc_fdinfo_file_inode_operations = {
|
||||
.permission = proc_fdinfo_permission,
|
||||
.setattr = proc_setattr,
|
||||
.setattr = proc_nochmod_setattr,
|
||||
};
|
||||
|
||||
static const struct file_operations proc_fdinfo_file_operations = {
|
||||
|
|
@ -361,7 +361,7 @@ const struct inode_operations proc_fd_inode_operations = {
|
|||
.lookup = proc_lookupfd,
|
||||
.permission = proc_fd_permission,
|
||||
.getattr = proc_fd_getattr,
|
||||
.setattr = proc_setattr,
|
||||
.setattr = proc_nochmod_setattr,
|
||||
};
|
||||
|
||||
static struct dentry *proc_fdinfo_instantiate(struct dentry *dentry,
|
||||
|
|
@ -402,7 +402,7 @@ static int proc_fdinfo_iterate(struct file *file, struct dir_context *ctx)
|
|||
const struct inode_operations proc_fdinfo_inode_operations = {
|
||||
.lookup = proc_lookupfdinfo,
|
||||
.permission = proc_fdinfo_permission,
|
||||
.setattr = proc_setattr,
|
||||
.setattr = proc_nochmod_setattr,
|
||||
};
|
||||
|
||||
const struct file_operations proc_fdinfo_operations = {
|
||||
|
|
|
|||
|
|
@ -115,8 +115,8 @@ static bool pde_subdir_insert(struct proc_dir_entry *dir,
|
|||
return true;
|
||||
}
|
||||
|
||||
static int proc_notify_change(struct mnt_idmap *idmap,
|
||||
struct dentry *dentry, struct iattr *iattr)
|
||||
static int proc_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
struct iattr *iattr)
|
||||
{
|
||||
struct inode *inode = d_inode(dentry);
|
||||
struct proc_dir_entry *de = PDE(inode);
|
||||
|
|
@ -151,7 +151,7 @@ static int proc_getattr(struct mnt_idmap *idmap,
|
|||
}
|
||||
|
||||
static const struct inode_operations proc_file_inode_operations = {
|
||||
.setattr = proc_notify_change,
|
||||
.setattr = proc_setattr,
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -364,7 +364,7 @@ const struct dentry_operations proc_net_dentry_ops = {
|
|||
static const struct inode_operations proc_dir_inode_operations = {
|
||||
.lookup = proc_lookup,
|
||||
.getattr = proc_getattr,
|
||||
.setattr = proc_notify_change,
|
||||
.setattr = proc_setattr,
|
||||
};
|
||||
|
||||
static void pde_set_flags(struct proc_dir_entry *pde)
|
||||
|
|
|
|||
|
|
@ -257,8 +257,8 @@ extern int proc_pid_statm(struct seq_file *, struct pid_namespace *,
|
|||
extern const struct dentry_operations pid_dentry_operations;
|
||||
extern int pid_getattr(struct mnt_idmap *, const struct path *,
|
||||
struct kstat *, u32, unsigned int);
|
||||
extern int proc_setattr(struct mnt_idmap *, struct dentry *,
|
||||
struct iattr *);
|
||||
int proc_nochmod_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
|
||||
struct iattr *attr);
|
||||
extern void proc_pid_evict_inode(struct proc_inode *);
|
||||
extern struct inode *proc_pid_make_inode(struct super_block *, struct task_struct *, umode_t);
|
||||
extern void pid_update_inode(struct task_struct *, struct inode *);
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int bufl
|
|||
static const struct inode_operations proc_ns_link_inode_operations = {
|
||||
.readlink = proc_ns_readlink,
|
||||
.get_link = proc_ns_get_link,
|
||||
.setattr = proc_setattr,
|
||||
.setattr = proc_nochmod_setattr,
|
||||
};
|
||||
|
||||
static struct dentry *proc_ns_instantiate(struct dentry *dentry,
|
||||
|
|
@ -178,5 +178,5 @@ static struct dentry *proc_ns_dir_lookup(struct inode *dir,
|
|||
const struct inode_operations proc_ns_dir_inode_operations = {
|
||||
.lookup = proc_ns_dir_lookup,
|
||||
.getattr = pid_getattr,
|
||||
.setattr = proc_setattr,
|
||||
.setattr = proc_nochmod_setattr,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -322,7 +322,7 @@ static int proc_tgid_net_getattr(struct mnt_idmap *idmap,
|
|||
const struct inode_operations proc_net_inode_operations = {
|
||||
.lookup = proc_tgid_net_lookup,
|
||||
.getattr = proc_tgid_net_getattr,
|
||||
.setattr = proc_setattr,
|
||||
.setattr = proc_nochmod_setattr,
|
||||
};
|
||||
|
||||
static int proc_tgid_net_readdir(struct file *file, struct dir_context *ctx)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user