From 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sat, 16 Apr 2005 15:20:36 -0700 Subject: Linux-2.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! --- fs/devfs/util.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 fs/devfs/util.c (limited to 'fs/devfs/util.c') 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 @@ +/* devfs (Device FileSystem) utilities. + + Copyright (C) 1999-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 + + 19991031 Richard Gooch + Created. + 19991103 Richard Gooch + Created <_devfs_convert_name> and supported SCSI and IDE CD-ROMs + 20000203 Richard Gooch + Changed operations pointer type to void *. + 20000621 Richard Gooch + Changed interface to . + 20000622 Richard Gooch + Took account of interface change to . + Took account of interface change to . + 20010519 Richard Gooch + Documentation cleanup. + 20010709 Richard Gooch + Created and . + 20010710 Richard Gooch + Created . + 20010730 Richard Gooch + Documentation typo fix. + 20010806 Richard Gooch + Made and private. + 20010813 Richard Gooch + Fixed bug in : limited to 128 numbers + 20010818 Richard Gooch + Updated major masks up to Linus' "no new majors" proclamation. + Block: were 126 now 122 free, char: were 26 now 19 free. + 20020324 Richard Gooch + Fixed bug in : was clearing beyond + bitfield. + 20020326 Richard Gooch + Fixed bitfield data type for . + Made major bitfield type and initialiser 64 bit safe. + 20020413 Richard Gooch + Fixed shift warning on 64 bit machines. + 20020428 Richard Gooch + Copied and used macro for error messages from fs/devfs/base.c + 20021013 Richard Gooch + Documentation fix. + 20030101 Adam J. Richter + Eliminate DEVFS_SPECIAL_{CHR,BLK}. Use mode_t instead. + 20030106 Christoph Hellwig + Rewrite devfs_{,de}alloc_devnum to look like C code. +*/ +#include +#include +#include +#include +#include +#include +#include + +int devfs_register_tape(const char *name) +{ + char tname[32], dest[64]; + static unsigned int tape_counter; + unsigned int n = tape_counter++; + + sprintf(dest, "../%s", name); + sprintf(tname, "tapes/tape%u", n); + devfs_mk_symlink(tname, dest); + + return n; +} + +EXPORT_SYMBOL(devfs_register_tape); + +void devfs_unregister_tape(int num) +{ + if (num >= 0) + devfs_remove("tapes/tape%u", num); +} + +EXPORT_SYMBOL(devfs_unregister_tape); -- cgit v1.2.3-70-g09d2