On Wed, Jun 26, 2019 at 6:07 AM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote: > > On Thu, 20 Jun 2019 18:19:40 -0700 > Matthew Garrett <matthewgarrett@xxxxxxxxxx> wrote: > > +static const struct file_operations tracefs_proxy_file_operations = { > > + .read = default_read_file, > > + .write = default_write_file, > > + .open = default_open_file, > > + .llseek = noop_llseek, > > +}; > > This appears to be unused. Oops, yup - dropped. > > + dentry->d_fsdata = fops ? (void *)fops : > > + (void *)&tracefs_file_operations; > > + memcpy(proxy_fops, dentry->d_fsdata, sizeof(struct file_operations)); > > + proxy_fops->open = default_open_file; > > inode->i_mode = mode; > > - inode->i_fop = fops ? fops : &tracefs_file_operations; > > + inode->i_fop = proxy_fops; > > > I think the above would look cleaner as: > > > if (!fops) > fops = &tracefs_file_operations; > > dentry->d_fsdata = (void *)fops; > memcpy(proxy_fops, fops, sizeof(*proxy_fops); > proxy_fops->open = default_open_file; ACK.