!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/drivers/char/ftape/lowlevel/   drwxr-xr-x
Free 318.33 GB of 458.09 GB (69.49%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     ftape-buffer.c (3.26 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/*
 *      Copyright (C) 1997 Claus-Justus Heine

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2, or (at your option)
 any later version.

 This program 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 General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; see the file COPYING.  If not, write to
 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

 *
 * $Source: /homes/cvs/ftape-stacked/ftape/lowlevel/ftape-buffer.c,v $
 * $Revision: 1.3 $
 * $Date: 1997/10/16 23:33:11 $
 *
 *  This file contains the allocator/dealloctor for ftape's dynamic dma
 *  buffer.
 */

#include <asm/segment.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/mman.h>
#include <linux/wrapper.h>
#include <asm/dma.h>

#include <linux/ftape.h>
#include "../lowlevel/ftape-rw.h"
#include "../lowlevel/ftape-read.h"
#include "../lowlevel/ftape-tracing.h"

/*  DMA'able memory allocation stuff.
 */

static inline void *dmaalloc(size_t size)
{
    unsigned long addr;

    if (size == 0) {
        return NULL;
    }
    addr = __get_dma_pages(GFP_KERNEL, get_order(size));
    if (addr) {
        struct page *page;

        for (page = virt_to_page(addr); page < virt_to_page(addr+size); page++)
            mem_map_reserve(page);
    }
    return (void *)addr;
}

static inline void dmafree(void *addr, size_t size)
{
    if (size > 0) {
        struct page *page;

        for (page = virt_to_page((unsigned long)addr);
             page < virt_to_page((unsigned long)addr+size); page++)
            mem_map_unreserve(page);
        free_pages((unsigned long) addr, get_order(size));
    }
}

static int add_one_buffer(void)
{
    TRACE_FUN(ft_t_flow);
    
    if (ft_nr_buffers >= FT_MAX_NR_BUFFERS) {
        TRACE_EXIT -ENOMEM;
    }
    ft_buffer[ft_nr_buffers] = kmalloc(sizeof(buffer_struct), GFP_KERNEL);
    if (ft_buffer[ft_nr_buffers] == NULL) {
        TRACE_EXIT -ENOMEM;
    }
    memset(ft_buffer[ft_nr_buffers], 0, sizeof(buffer_struct));
    ft_buffer[ft_nr_buffers]->address = dmaalloc(FT_BUFF_SIZE);
    if (ft_buffer[ft_nr_buffers]->address == NULL) {
        kfree(ft_buffer[ft_nr_buffers]);
        ft_buffer[ft_nr_buffers] = NULL;
        TRACE_EXIT -ENOMEM;
    }
    ft_nr_buffers ++;
    TRACE(ft_t_info, "buffer nr #%d @ %p, dma area @ %p",
          ft_nr_buffers,
          ft_buffer[ft_nr_buffers-1],
          ft_buffer[ft_nr_buffers-1]->address);
    TRACE_EXIT 0;
}

static void del_one_buffer(void)
{
    TRACE_FUN(ft_t_flow);
    if (ft_nr_buffers > 0) {
        TRACE(ft_t_info, "releasing buffer nr #%d @ %p, dma area @ %p",
              ft_nr_buffers,
              ft_buffer[ft_nr_buffers-1],
              ft_buffer[ft_nr_buffers-1]->address);
        ft_nr_buffers --;
        dmafree(ft_buffer[ft_nr_buffers]->address, FT_BUFF_SIZE);
        kfree(ft_buffer[ft_nr_buffers]);
        ft_buffer[ft_nr_buffers] = NULL;
    }
    TRACE_EXIT;
}

int ftape_set_nr_buffers(int cnt)
{
    int delta = cnt - ft_nr_buffers;
    TRACE_FUN(ft_t_flow);

    if (delta > 0) {
        while (delta--) {
            if (add_one_buffer() < 0) {
                TRACE_EXIT -ENOMEM;
            }
        }
    } else if (delta < 0) {
        while (delta++) {
            del_one_buffer();
        }
    }
    ftape_zap_read_buffers();
    TRACE_EXIT 0;
}

:: 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.0218 ]--