diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /fs/devfs/util.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'fs/devfs/util.c')
-rw-r--r-- | fs/devfs/util.c | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/fs/devfs/util.c b/fs/devfs/util.c new file mode 100644 index 000000000000..db06d388c9ac --- /dev/null +++ b/fs/devfs/util.c | |||
@@ -0,0 +1,97 @@ | |||
1 | /* devfs (Device FileSystem) utilities. | ||
2 | |||
3 | Copyright (C) 1999-2002 Richard Gooch | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Library General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Library General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Library General Public | ||
16 | License along with this library; if not, write to the Free | ||
17 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | |||
19 | Richard Gooch may be reached by email at rgooch@atnf.csiro.au | ||
20 | The postal address is: | ||
21 | Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia. | ||
22 | |||
23 | ChangeLog | ||
24 | |||
25 | 19991031 Richard Gooch <rgooch@atnf.csiro.au> | ||
26 | Created. | ||
27 | 19991103 Richard Gooch <rgooch@atnf.csiro.au> | ||
28 | Created <_devfs_convert_name> and supported SCSI and IDE CD-ROMs | ||
29 | 20000203 Richard Gooch <rgooch@atnf.csiro.au> | ||
30 | Changed operations pointer type to void *. | ||
31 | 20000621 Richard Gooch <rgooch@atnf.csiro.au> | ||
32 | Changed interface to <devfs_register_series>. | ||
33 | 20000622 Richard Gooch <rgooch@atnf.csiro.au> | ||
34 | Took account of interface change to <devfs_mk_symlink>. | ||
35 | Took account of interface change to <devfs_mk_dir>. | ||
36 | 20010519 Richard Gooch <rgooch@atnf.csiro.au> | ||
37 | Documentation cleanup. | ||
38 | 20010709 Richard Gooch <rgooch@atnf.csiro.au> | ||
39 | Created <devfs_*alloc_major> and <devfs_*alloc_devnum>. | ||
40 | 20010710 Richard Gooch <rgooch@atnf.csiro.au> | ||
41 | Created <devfs_*alloc_unique_number>. | ||
42 | 20010730 Richard Gooch <rgooch@atnf.csiro.au> | ||
43 | Documentation typo fix. | ||
44 | 20010806 Richard Gooch <rgooch@atnf.csiro.au> | ||
45 | Made <block_semaphore> and <char_semaphore> private. | ||
46 | 20010813 Richard Gooch <rgooch@atnf.csiro.au> | ||
47 | Fixed bug in <devfs_alloc_unique_number>: limited to 128 numbers | ||
48 | 20010818 Richard Gooch <rgooch@atnf.csiro.au> | ||
49 | Updated major masks up to Linus' "no new majors" proclamation. | ||
50 | Block: were 126 now 122 free, char: were 26 now 19 free. | ||
51 | 20020324 Richard Gooch <rgooch@atnf.csiro.au> | ||
52 | Fixed bug in <devfs_alloc_unique_number>: was clearing beyond | ||
53 | bitfield. | ||
54 | 20020326 Richard Gooch <rgooch@atnf.csiro.au> | ||
55 | Fixed bitfield data type for <devfs_*alloc_devnum>. | ||
56 | Made major bitfield type and initialiser 64 bit safe. | ||
57 | 20020413 Richard Gooch <rgooch@atnf.csiro.au> | ||
58 | Fixed shift warning on 64 bit machines. | ||
59 | 20020428 Richard Gooch <rgooch@atnf.csiro.au> | ||
60 | Copied and used macro for error messages from fs/devfs/base.c | ||
61 | 20021013 Richard Gooch <rgooch@atnf.csiro.au> | ||
62 | Documentation fix. | ||
63 | 20030101 Adam J. Richter <adam@yggdrasil.com> | ||
64 | Eliminate DEVFS_SPECIAL_{CHR,BLK}. Use mode_t instead. | ||
65 | 20030106 Christoph Hellwig <hch@infradead.org> | ||
66 | Rewrite devfs_{,de}alloc_devnum to look like C code. | ||
67 | */ | ||
68 | #include <linux/module.h> | ||
69 | #include <linux/init.h> | ||
70 | #include <linux/devfs_fs_kernel.h> | ||
71 | #include <linux/slab.h> | ||
72 | #include <linux/vmalloc.h> | ||
73 | #include <linux/genhd.h> | ||
74 | #include <linux/bitops.h> | ||
75 | |||
76 | int devfs_register_tape(const char *name) | ||
77 | { | ||
78 | char tname[32], dest[64]; | ||
79 | static unsigned int tape_counter; | ||
80 | unsigned int n = tape_counter++; | ||
81 | |||
82 | sprintf(dest, "../%s", name); | ||
83 | sprintf(tname, "tapes/tape%u", n); | ||
84 | devfs_mk_symlink(tname, dest); | ||
85 | |||
86 | return n; | ||
87 | } | ||
88 | |||
89 | EXPORT_SYMBOL(devfs_register_tape); | ||
90 | |||
91 | void devfs_unregister_tape(int num) | ||
92 | { | ||
93 | if (num >= 0) | ||
94 | devfs_remove("tapes/tape%u", num); | ||
95 | } | ||
96 | |||
97 | EXPORT_SYMBOL(devfs_unregister_tape); | ||