root/morphix/trunk/cloop/cloop.devfs.diff
| Revision 2, 2.1 kB (checked in by nextime, 2 years ago) |
|---|
-
compressed_loop.c
old new 14 14 * Redistribution of this file is permitted under the GNU Public License. 15 15 * 16 16 * CHANGES: 17 * * Wed Jan 8 2003 Eduard Bloch 18 * - added minimalistic hooks for devfs support, target file is 19 * /dev/cloop/0 17 20 * * Sat Aug 17 2002 Klaus Knopper 18 21 * - Removed ll_rw_blk() in favor of do_generic_file_read for 19 22 * better NFS support … … 77 80 #include <linux/major.h> 78 81 #include <linux/vmalloc.h> 79 82 #include <linux/slab.h> 83 #include <linux/devfs_fs_kernel.h> 80 84 #include <asm/semaphore.h> 81 85 #include <asm/uaccess.h> 82 86 #include "compressed_loop.h" … … 158 162 159 163 static struct cloop_device cloop_dev; 160 164 static char *cloop_name=CLOOP_NAME; 165 static int max_cloop = 1; 166 static devfs_handle_t devfs_handle; /* For the directory */ 161 167 162 168 #ifndef CONFIG_ZLIB_INFLATE 163 169 /* Use zlib uncompress */ … … 846 852 cloop_dev.backing_file=NULL; 847 853 if(!init_loopback()) return -EINVAL; 848 854 849 if( register_blkdev(MAJOR_NR, cloop_name, &clo_fops))855 if(devfs_register_blkdev(MAJOR_NR, cloop_name, &clo_fops)) 850 856 { 851 857 printk(KERN_WARNING "%s: Unable to get major %d for cloop\n", 852 858 cloop_name, MAJOR_NR); … … 857 863 } 858 864 return -EIO; 859 865 } 866 devfs_handle = devfs_mk_dir(NULL, "cloop", NULL); 867 devfs_register_series(devfs_handle, "%u", max_cloop, DEVFS_FL_DEFAULT, 868 MAJOR_NR, 0, 869 S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP, 870 &clo_fops, NULL); 871 872 printk(KERN_INFO "cloop: loaded (max %d devices)\n", max_cloop); 873 874 875 860 876 861 877 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) 862 878 blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST); … … 871 887 872 888 void cleanup_module(void) 873 889 { 874 if( unregister_blkdev(MAJOR_NR, cloop_name) != 0)890 if(devfs_unregister_blkdev(MAJOR_NR, cloop_name) != 0) 875 891 printk(KERN_WARNING "%s: cannot unregister block device\n", cloop_name); 876 892 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) 877 893 blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
Note: See TracBrowser for help on using the browser.
