⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 base.c

📁 《嵌入式系统设计与实例开发实验教材二源码》Linux内核移植与编译实验
💻 C
📖 第 1 页 / 共 5 页
字号:
/*  devfs (Device FileSystem) driver.    Copyright (C) 1998-2002  Richard Gooch    This library is free software; you can redistribute it and/or    modify it under the terms of the GNU Library General Public    License as published by the Free Software Foundation; either    version 2 of the License, or (at your option) any later version.    This library is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU    Library General Public License for more details.    You should have received a copy of the GNU Library General Public    License along with this library; if not, write to the Free    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.    Richard Gooch may be reached by email at  rgooch@atnf.csiro.au    The postal address is:      Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia.    ChangeLog    19980110   Richard Gooch <rgooch@atnf.csiro.au>               Original version.  v0.1    19980111   Richard Gooch <rgooch@atnf.csiro.au>               Created per-fs inode table rather than using inode->u.generic_ip  v0.2    19980111   Richard Gooch <rgooch@atnf.csiro.au>               Created .epoch inode which has a ctime of 0.	       Fixed loss of named pipes when dentries lost.	       Fixed loss of inode data when devfs_register() follows mknod().  v0.3    19980111   Richard Gooch <rgooch@atnf.csiro.au>               Fix for when compiling with CONFIG_KERNELD.    19980112   Richard Gooch <rgooch@atnf.csiro.au>               Fix for readdir() which sometimes didn't show entries.	       Added <<tolerant>> option to <devfs_register>.  v0.4    19980113   Richard Gooch <rgooch@atnf.csiro.au>               Created <devfs_fill_file> function.  v0.5    19980115   Richard Gooch <rgooch@atnf.csiro.au>               Added subdirectory support. Major restructuring.    19980116   Richard Gooch <rgooch@atnf.csiro.au>               Fixed <find_by_dev> to not search major=0,minor=0.	       Added symlink support.  v0.6    19980120   Richard Gooch <rgooch@atnf.csiro.au>               Created <devfs_mk_dir> function and support directory unregister    19980120   Richard Gooch <rgooch@atnf.csiro.au>               Auto-ownership uses real uid/gid rather than effective uid/gid.  v0.7    19980121   Richard Gooch <rgooch@atnf.csiro.au>               Supported creation of sockets.  v0.8    19980122   Richard Gooch <rgooch@atnf.csiro.au>               Added DEVFS_FL_HIDE_UNREG flag.	       Interface change to <devfs_mk_symlink>.               Created <devfs_symlink> to support symlink(2).  v0.9    19980123   Richard Gooch <rgooch@atnf.csiro.au>               Added check to <devfs_fill_file> to check inode is in devfs.	       Added optional traversal of symlinks.  v0.10    19980124   Richard Gooch <rgooch@atnf.csiro.au>               Created <devfs_get_flags> and <devfs_set_flags>.  v0.11    19980125   C. Scott Ananian <cananian@alumni.princeton.edu>               Created <devfs_find_handle>.    19980125   Richard Gooch <rgooch@atnf.csiro.au>               Allow removal of symlinks.  v0.12    19980125   Richard Gooch <rgooch@atnf.csiro.au>               Created <devfs_set_symlink_destination>.    19980126   Richard Gooch <rgooch@atnf.csiro.au>               Moved DEVFS_SUPER_MAGIC into header file.	       Added DEVFS_FL_HIDE flag.	       Created <devfs_get_maj_min>.	       Created <devfs_get_handle_from_inode>.	       Fixed minor bug in <find_by_dev>.    19980127   Richard Gooch <rgooch@atnf.csiro.au>	       Changed interface to <find_by_dev>, <find_entry>,	       <devfs_unregister>, <devfs_fill_file> and <devfs_find_handle>.	       Fixed inode times when symlink created with symlink(2).  v0.13    19980129   C. Scott Ananian <cananian@alumni.princeton.edu>               Exported <devfs_set_symlink_destination>, <devfs_get_maj_min>	       and <devfs_get_handle_from_inode>.    19980129   Richard Gooch <rgooch@atnf.csiro.au>	       Created <devfs_unlink> to support unlink(2).  v0.14    19980129   Richard Gooch <rgooch@atnf.csiro.au>	       Fixed kerneld support for entries in devfs subdirectories.    19980130   Richard Gooch <rgooch@atnf.csiro.au>	       Bugfixes in <call_kerneld>.  v0.15    19980207   Richard Gooch <rgooch@atnf.csiro.au>	       Call kerneld when looking up unregistered entries.  v0.16    19980326   Richard Gooch <rgooch@atnf.csiro.au>	       Modified interface to <devfs_find_handle> for symlink traversal.  v0.17    19980331   Richard Gooch <rgooch@atnf.csiro.au>	       Fixed persistence bug with device numbers for manually created	       device files.	       Fixed problem with recreating symlinks with different content.  v0.18    19980401   Richard Gooch <rgooch@atnf.csiro.au>	       Changed to CONFIG_KMOD.	       Hide entries which are manually unlinked.	       Always invalidate devfs dentry cache when registering entries.	       Created <devfs_rmdir> to support rmdir(2).	       Ensure directories created by <devfs_mk_dir> are visible.  v0.19    19980402   Richard Gooch <rgooch@atnf.csiro.au>	       Invalidate devfs dentry cache when making directories.	       Invalidate devfs dentry cache when removing entries.	       Fixed persistence bug with fifos.  v0.20    19980421   Richard Gooch <rgooch@atnf.csiro.au>	       Print process command when debugging kerneld/kmod.	       Added debugging for register/unregister/change operations.    19980422   Richard Gooch <rgooch@atnf.csiro.au>	       Added "devfs=" boot options.  v0.21    19980426   Richard Gooch <rgooch@atnf.csiro.au>	       No longer lock/unlock superblock in <devfs_put_super>.	       Drop negative dentries when they are released.	       Manage dcache more efficiently.  v0.22    19980427   Richard Gooch <rgooch@atnf.csiro.au>	       Added DEVFS_FL_AUTO_DEVNUM flag.  v0.23    19980430   Richard Gooch <rgooch@atnf.csiro.au>	       No longer set unnecessary methods.  v0.24    19980504   Richard Gooch <rgooch@atnf.csiro.au>	       Added PID display to <call_kerneld> debugging message.	       Added "after" debugging message to <call_kerneld>.    19980519   Richard Gooch <rgooch@atnf.csiro.au>	       Added "diread" and "diwrite" boot options.    19980520   Richard Gooch <rgooch@atnf.csiro.au>	       Fixed persistence problem with permissions.  v0.25    19980602   Richard Gooch <rgooch@atnf.csiro.au>	       Support legacy device nodes.	       Fixed bug where recreated inodes were hidden.  v0.26    19980602   Richard Gooch <rgooch@atnf.csiro.au>	       Improved debugging in <get_vfs_inode>.    19980607   Richard Gooch <rgooch@atnf.csiro.au>	       No longer free old dentries in <devfs_mk_dir>.	       Free all dentries for a given entry when deleting inodes.  v0.27    19980627   Richard Gooch <rgooch@atnf.csiro.au>	       Limit auto-device numbering to majors 128 to 239.  v0.28    19980629   Richard Gooch <rgooch@atnf.csiro.au>	       Fixed inode times persistence problem.  v0.29    19980704   Richard Gooch <rgooch@atnf.csiro.au>	       Fixed spelling in <devfs_readlink> debug.	       Fixed bug in <devfs_setup> parsing "dilookup".  v0.30    19980705   Richard Gooch <rgooch@atnf.csiro.au>	       Fixed devfs inode leak when manually recreating inodes.	       Fixed permission persistence problem when recreating inodes.  v0.31    19980727   Richard Gooch <rgooch@atnf.csiro.au>	       Removed harmless "unused variable" compiler warning.	       Fixed modes for manually recreated device nodes.  v0.32    19980728   Richard Gooch <rgooch@atnf.csiro.au>	       Added NULL devfs inode warning in <devfs_read_inode>.	       Force all inode nlink values to 1.  v0.33    19980730   Richard Gooch <rgooch@atnf.csiro.au>	       Added "dimknod" boot option.	       Set inode nlink to 0 when freeing dentries.	       Fixed modes for manually recreated symlinks.  v0.34    19980802   Richard Gooch <rgooch@atnf.csiro.au>	       Fixed bugs in recreated directories and symlinks.  v0.35    19980806   Richard Gooch <rgooch@atnf.csiro.au>	       Fixed bugs in recreated device nodes.    19980807   Richard Gooch <rgooch@atnf.csiro.au>	       Fixed bug in currently unused <devfs_get_handle_from_inode>.	       Defined new <devfs_handle_t> type.	       Improved debugging when getting entries.	       Fixed bug where directories could be emptied.  v0.36    19980809   Richard Gooch <rgooch@atnf.csiro.au>	       Replaced dummy .epoch inode with .devfsd character device.    19980810   Richard Gooch <rgooch@atnf.csiro.au>	       Implemented devfsd protocol revision 0.  v0.37    19980819   Richard Gooch <rgooch@atnf.csiro.au>	       Added soothing message to warning in <devfs_d_iput>.  v0.38    19980829   Richard Gooch <rgooch@atnf.csiro.au>	       Use GCC extensions for structure initialisations.	       Implemented async open notification.	       Incremented devfsd protocol revision to 1.  v0.39    19980908   Richard Gooch <rgooch@atnf.csiro.au>	       Moved async open notification to end of <devfs_open>.  v0.40    19980910   Richard Gooch <rgooch@atnf.csiro.au>	       Prepended "/dev/" to module load request.	       Renamed <call_kerneld> to <call_kmod>.  v0.41    19980910   Richard Gooch <rgooch@atnf.csiro.au>	       Fixed typo "AYSNC" -> "ASYNC".  v0.42    19980910   Richard Gooch <rgooch@atnf.csiro.au>	       Added open flag for files.  v0.43    19980927   Richard Gooch <rgooch@atnf.csiro.au>	       Set i_blocks=0 and i_blksize=1024 in <devfs_read_inode>.  v0.44    19981005   Richard Gooch <rgooch@atnf.csiro.au>	       Added test for empty <<name>> in <devfs_find_handle>.	       Renamed <generate_path> to <devfs_generate_path> and published.  v0.45    19981006   Richard Gooch <rgooch@atnf.csiro.au>	       Created <devfs_get_fops>.  v0.46    19981007   Richard Gooch <rgooch@atnf.csiro.au>	       Limit auto-device numbering to majors 144 to 239.  v0.47    19981010   Richard Gooch <rgooch@atnf.csiro.au>	       Updated <devfs_follow_link> for VFS change in 2.1.125.  v0.48    19981022   Richard Gooch <rgooch@atnf.csiro.au>	       Created DEVFS_ FL_COMPAT flag.  v0.49    19981023   Richard Gooch <rgooch@atnf.csiro.au>	       Created "nocompat" boot option.  v0.50    19981025   Richard Gooch <rgooch@atnf.csiro.au>	       Replaced "mount" boot option with "nomount".  v0.51    19981110   Richard Gooch <rgooch@atnf.csiro.au>	       Created "only" boot option.  v0.52    19981112   Richard Gooch <rgooch@atnf.csiro.au>	       Added DEVFS_FL_REMOVABLE flag.  v0.53    19981114   Richard Gooch <rgooch@atnf.csiro.au>	       Only call <scan_dir_for_removable> on first call to	       <devfs_readdir>.  v0.54    19981205   Richard Gooch <rgooch@atnf.csiro.au>	       Updated <devfs_rmdir> for VFS change in 2.1.131.  v0.55    19981218   Richard Gooch <rgooch@atnf.csiro.au>	       Created <devfs_mk_compat>.    19981220   Richard Gooch <rgooch@atnf.csiro.au>	       Check for partitions on removable media in <devfs_lookup>.  v0.56    19990118   Richard Gooch <rgooch@atnf.csiro.au>	       Added support for registering regular files.	       Created <devfs_set_file_size>.	       Update devfs inodes from entries if not changed through FS.  v0.57    19990124   Richard Gooch <rgooch@atnf.csiro.au>	       Fixed <devfs_fill_file> to only initialise temporary inodes.	       Trap for NULL fops in <devfs_register>.	       Return -ENODEV in <devfs_fill_file> for non-driver inodes.  v0.58    19990126   Richard Gooch <rgooch@atnf.csiro.au>	       Switched from PATH_MAX to DEVFS_PATHLEN.  v0.59    19990127   Richard Gooch <rgooch@atnf.csiro.au>	       Created "nottycompat" boot option.  v0.60    19990318   Richard Gooch <rgooch@atnf.csiro.au>	       Fixed <devfsd_read> to not overrun event buffer.  v0.61    19990329   Richard Gooch <rgooch@atnf.csiro.au>	       Created <devfs_auto_unregister>.  v0.62    19990330   Richard Gooch <rgooch@atnf.csiro.au>	       Don't return unregistred entries in <devfs_find_handle>.	       Panic in <devfs_unregister> if entry unregistered.    19990401   Richard Gooch <rgooch@atnf.csiro.au>	       Don't panic in <devfs_auto_unregister> for duplicates.  v0.63    19990402   Richard Gooch <rgooch@atnf.csiro.au>	       Don't unregister already unregistered entries in <unregister>.  v0.64    19990510   Richard Gooch <rgooch@atnf.csiro.au>	       Disable warning messages when unable to read partition table for	       removable media.  v0.65    19990512   Richard Gooch <rgooch@atnf.csiro.au>	       Updated <devfs_lookup> for VFS change in 2.3.1-pre1.	       Created "oops-on-panic" boot option.	       Improved debugging in <devfs_register> and <devfs_unregister>.  v0.66    19990519   Richard Gooch <rgooch@atnf.csiro.au>	       Added documentation for some functions.    19990525   Richard Gooch <rgooch@atnf.csiro.au>	       Removed "oops-on-panic" boot option: now always Oops.  v0.67    19990531   Richard Gooch <rgooch@atnf.csiro.au>	       Improved debugging in <devfs_register>.  v0.68    19990604   Richard Gooch <rgooch@atnf.csiro.au>	       Added "diunlink" and "nokmod" boot options.	       Removed superfluous warning message in <devfs_d_iput>.  v0.69    19990611   Richard Gooch <rgooch@atnf.csiro.au>	       Took account of change to <d_alloc_root>.  v0.70    19990614   Richard Gooch <rgooch@atnf.csiro.au>	       Created separate event queue for each mounted devfs.	       Removed <devfs_invalidate_dcache>.	       Created new ioctl()s.	       Incremented devfsd protocol revision to 3.	       Fixed bug when re-creating directories: contents were lost.	       Block access to inodes until devfsd updates permissions.    19990615   Richard Gooch <rgooch@atnf.csiro.au>	       Support 2.2.x kernels.  v0.71    19990623   Richard Gooch <rgooch@atnf.csiro.au>	       Switched to sending process uid/gid to devfsd.	       Renamed <call_kmod> to <try_modload>.	       Added DEVFSD_NOTIFY_LOOKUP event.    19990624   Richard Gooch <rgooch@atnf.csiro.au>	       Added DEVFSD_NOTIFY_CHANGE event.	       Incremented devfsd protocol revision to 4.  v0.72    19990713   Richard Gooch <rgooch@atnf.csiro.au>	       Return EISDIR rather than EINVAL for read(2) on directories.  v0.73    19990809   Richard Gooch <rgooch@atnf.csiro.au>	       Changed <devfs_setup> to new __init scheme.  v0.74    19990901   Richard Gooch <rgooch@atnf.csiro.au>	       Changed remaining function declarations to new __init scheme.  v0.75    19991013   Richard Gooch <rgooch@atnf.csiro.au>	       Created <devfs_get_info>, <devfs_set_info>,	       <devfs_get_first_child> and <devfs_get_next_sibling>.	       Added <<dir>> parameter to <devfs_register>, <devfs_mk_compat>,	       <devfs_mk_dir> and <devfs_find_handle>.	       Work sponsored by SGI.  v0.76    19991017   Richard Gooch <rgooch@atnf.csiro.au>	       Allow multiple unregistrations.	       Work sponsored by SGI.  v0.77    19991026   Richard Gooch <rgooch@atnf.csiro.au>	       Added major and minor number to devfsd protocol.	       Incremented devfsd protocol revision to 5.	       Work sponsored by SGI.  v0.78    19991030   Richard Gooch <rgooch@atnf.csiro.au>	       Support info pointer for all devfs entry types.	       Added <<info>> parameter to <devfs_mk_dir> and	       <devfs_mk_symlink>.	       Work sponsored by SGI.  v0.79    19991031   Richard Gooch <rgooch@atnf.csiro.au>	       Support "../" when searching devfs namespace.	       Work sponsored by SGI.  v0.80    19991101   Richard Gooch <rgooch@atnf.csiro.au>	       Created <devfs_get_unregister_slave>.	       Work sponsored by SGI.  v0.81    19991103   Richard Gooch <rgooch@atnf.csiro.au>	       Exported <devfs_get_parent>.	       Work sponsored by SGI.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -