!C99Shell v. 1.0 pre-release build #13!

Software: Apache/2.0.54 (Unix) mod_perl/1.99_09 Perl/v5.8.0 mod_ssl/2.0.54 OpenSSL/0.9.7l DAV/2 FrontPage/5.0.2.2635 PHP/4.4.0 mod_gzip/2.0.26.1a 

uname -a: Linux snow.he.net 4.4.276-v2-mono-1 #1 SMP Wed Jul 21 11:21:17 PDT 2021 i686 

uid=99(nobody) gid=98(nobody) groups=98(nobody) 

Safe-mode: OFF (not secure)

/usr/src/linux-2.4.18-xfs-1.1/fs/   drwxr-xr-x
Free 318.36 GB of 458.09 GB (69.5%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     char_dev.c (2.5 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/*
 *  linux/fs/block_dev.c
 *
 *  Copyright (C) 1991, 1992  Linus Torvalds
 */

#include <linux/config.h>
#include <linux/init.h>
#include <linux/slab.h>

#define HASH_BITS    6
#define HASH_SIZE    (1UL << HASH_BITS)
#define HASH_MASK    (HASH_SIZE-1)
static struct list_head cdev_hashtable[HASH_SIZE];
static spinlock_t cdev_lock = SPIN_LOCK_UNLOCKED;
static kmem_cache_t * cdev_cachep;

#define alloc_cdev() \
     ((struct char_device *) kmem_cache_alloc(cdev_cachep, SLAB_KERNEL))
#define destroy_cdev(cdev) kmem_cache_free(cdev_cachep, (cdev))

static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
{
    struct char_device * cdev = (struct char_device *) foo;

    if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
        SLAB_CTOR_CONSTRUCTOR)
    {
        memset(cdev, 0, sizeof(*cdev));
        sema_init(&cdev->sem, 1);
    }
}

void __init cdev_cache_init(void)
{
    int i;
    struct list_head *head = cdev_hashtable;

    i = HASH_SIZE;
    do {
        INIT_LIST_HEAD(head);
        head++;
        i--;
    } while (i);

    cdev_cachep = kmem_cache_create("cdev_cache",
                     sizeof(struct char_device),
                     0, SLAB_HWCACHE_ALIGN, init_once,
                     NULL);
    if (!cdev_cachep)
        panic("Cannot create cdev_cache SLAB cache");
}

/*
 * Most likely _very_ bad one - but then it's hardly critical for small
 * /dev and can be fixed when somebody will need really large one.
 */
static inline unsigned long hash(dev_t dev)
{
    unsigned long tmp = dev;
    tmp = tmp + (tmp >> HASH_BITS) + (tmp >> HASH_BITS*2);
    return tmp & HASH_MASK;
}

static struct char_device *cdfind(dev_t dev, struct list_head *head)
{
    struct list_head *p;
    struct char_device *cdev;
    for (p=head->next; p!=head; p=p->next) {
        cdev = list_entry(p, struct char_device, hash);
        if (cdev->dev != dev)
            continue;
        atomic_inc(&cdev->count);
        return cdev;
    }
    return NULL;
}

struct char_device *cdget(dev_t dev)
{
    struct list_head * head = cdev_hashtable + hash(dev);
    struct char_device *cdev, *new_cdev;
    spin_lock(&cdev_lock);
    cdev = cdfind(dev, head);
    spin_unlock(&cdev_lock);
    if (cdev)
        return cdev;
    new_cdev = alloc_cdev();
    if (!new_cdev)
        return NULL;
    atomic_set(&new_cdev->count,1);
    new_cdev->dev = dev;
    spin_lock(&cdev_lock);
    cdev = cdfind(dev, head);
    if (!cdev) {
        list_add(&new_cdev->hash, head);
        spin_unlock(&cdev_lock);
        return new_cdev;
    }
    spin_unlock(&cdev_lock);
    destroy_cdev(new_cdev);
    return cdev;
}

void cdput(struct char_device *cdev)
{
    if (atomic_dec_and_lock(&cdev->count, &cdev_lock)) {
        list_del(&cdev->hash);
        spin_unlock(&cdev_lock);
        destroy_cdev(cdev);
    }
}


:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 1.0 pre-release build #13 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0043 ]--