root/morphix/trunk/cloop/cloop.devfs.diff

Revision 2, 2.1 kB (checked in by nextime, 2 years ago)

Initial import, branching from morphix svn

  • compressed_loop.c

    old new  
    1414 * Redistribution of this file is permitted under the GNU Public License. 
    1515 * 
    1616 * CHANGES: 
     17 *          * Wed Jan  8 2003 Eduard Bloch 
     18 *          - added minimalistic hooks for devfs support, target file is 
     19 *            /dev/cloop/0 
    1720 *          * Sat Aug 17 2002 Klaus Knopper 
    1821 *          - Removed ll_rw_blk() in favor of do_generic_file_read for 
    1922 *            better NFS support 
     
    7780#include <linux/major.h> 
    7881#include <linux/vmalloc.h> 
    7982#include <linux/slab.h> 
     83#include <linux/devfs_fs_kernel.h> 
    8084#include <asm/semaphore.h> 
    8185#include <asm/uaccess.h> 
    8286#include "compressed_loop.h" 
     
    158162 
    159163static struct cloop_device cloop_dev; 
    160164static char *cloop_name=CLOOP_NAME; 
     165static int max_cloop = 1; 
     166static devfs_handle_t devfs_handle;      /*  For the directory */ 
    161167 
    162168#ifndef CONFIG_ZLIB_INFLATE 
    163169/* Use zlib uncompress */ 
     
    846852 cloop_dev.backing_file=NULL; 
    847853 if(!init_loopback()) return -EINVAL; 
    848854 
    849  if(register_blkdev(MAJOR_NR, cloop_name, &clo_fops)) 
     855 if(devfs_register_blkdev(MAJOR_NR, cloop_name, &clo_fops)) 
    850856  { 
    851857   printk(KERN_WARNING "%s: Unable to get major %d for cloop\n", 
    852858          cloop_name, MAJOR_NR); 
     
    857863    } 
    858864   return -EIO; 
    859865  } 
     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     
    860876 
    861877#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) 
    862878 blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST); 
     
    871887 
    872888void cleanup_module(void)  
    873889{ 
    874  if(unregister_blkdev(MAJOR_NR, cloop_name) != 0) 
     890 if(devfs_unregister_blkdev(MAJOR_NR, cloop_name) != 0) 
    875891   printk(KERN_WARNING "%s: cannot unregister block device\n", cloop_name); 
    876892#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) 
    877893 blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR)); 
Note: See TracBrowser for help on using the browser.