inode.c (05668381140309088443bf5dc53add4104610fbb) | inode.c (8e18e2941c53416aa219708e7dcad21fb4bd6794) |
---|---|
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. --- 30 unchanged lines hidden (view full) --- 39static ssize_t default_write_file(struct file *file, const char __user *buf, 40 size_t count, loff_t *ppos) 41{ 42 return count; 43} 44 45static int default_open(struct inode *inode, struct file *file) 46{ | 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. --- 30 unchanged lines hidden (view full) --- 39static ssize_t default_write_file(struct file *file, const char __user *buf, 40 size_t count, loff_t *ppos) 41{ 42 return count; 43} 44 45static int default_open(struct inode *inode, struct file *file) 46{ |
47 if (inode->u.generic_ip) 48 file->private_data = inode->u.generic_ip; | 47 if (inode->i_private) 48 file->private_data = inode->i_private; |
49 50 return 0; 51} 52 53static struct file_operations default_file_ops = { 54 .read = default_read_file, 55 .write = default_write_file, 56 .open = default_open, --- 132 unchanged lines hidden (view full) --- 189 * securityfs_create_file - create a file in the securityfs filesystem 190 * 191 * @name: a pointer to a string containing the name of the file to create. 192 * @mode: the permission that the file should have 193 * @parent: a pointer to the parent dentry for this file. This should be a 194 * directory dentry if set. If this paramater is NULL, then the 195 * file will be created in the root of the securityfs filesystem. 196 * @data: a pointer to something that the caller will want to get to later | 49 50 return 0; 51} 52 53static struct file_operations default_file_ops = { 54 .read = default_read_file, 55 .write = default_write_file, 56 .open = default_open, --- 132 unchanged lines hidden (view full) --- 189 * securityfs_create_file - create a file in the securityfs filesystem 190 * 191 * @name: a pointer to a string containing the name of the file to create. 192 * @mode: the permission that the file should have 193 * @parent: a pointer to the parent dentry for this file. This should be a 194 * directory dentry if set. If this paramater is NULL, then the 195 * file will be created in the root of the securityfs filesystem. 196 * @data: a pointer to something that the caller will want to get to later |
197 * on. The inode.u.generic_ip pointer will point to this value on | 197 * on. The inode.i_private pointer will point to this value on |
198 * the open() call. 199 * @fops: a pointer to a struct file_operations that should be used for 200 * this file. 201 * 202 * This is the basic "create a file" function for securityfs. It allows for a 203 * wide range of flexibility in createing a file, or a directory (if you 204 * want to create a directory, the securityfs_create_dir() function is 205 * recommended to be used instead.) --- 29 unchanged lines hidden (view full) --- 235 simple_release_fs(&mount, &mount_count); 236 goto exit; 237 } 238 239 if (dentry->d_inode) { 240 if (fops) 241 dentry->d_inode->i_fop = fops; 242 if (data) | 198 * the open() call. 199 * @fops: a pointer to a struct file_operations that should be used for 200 * this file. 201 * 202 * This is the basic "create a file" function for securityfs. It allows for a 203 * wide range of flexibility in createing a file, or a directory (if you 204 * want to create a directory, the securityfs_create_dir() function is 205 * recommended to be used instead.) --- 29 unchanged lines hidden (view full) --- 235 simple_release_fs(&mount, &mount_count); 236 goto exit; 237 } 238 239 if (dentry->d_inode) { 240 if (fops) 241 dentry->d_inode->i_fop = fops; 242 if (data) |
243 dentry->d_inode->u.generic_ip = data; | 243 dentry->d_inode->i_private = data; |
244 } 245exit: 246 return dentry; 247} 248EXPORT_SYMBOL_GPL(securityfs_create_file); 249 250/** 251 * securityfs_create_dir - create a directory in the securityfs filesystem --- 95 unchanged lines hidden --- | 244 } 245exit: 246 return dentry; 247} 248EXPORT_SYMBOL_GPL(securityfs_create_file); 249 250/** 251 * securityfs_create_dir - create a directory in the securityfs filesystem --- 95 unchanged lines hidden --- |