type
stringclasses
5 values
content
stringlengths
9
163k
includes
#include <linux/ppp_defs.h>
includes
#include <linux/isdn.h>
includes
#include <linux/isdn_ppp.h>
includes
#include <linux/ip.h>
includes
#include <linux/tcp.h>
includes
#include <linux/if_arp.h>
includes
#include <linux/ppp-comp.h>
defines
#define BSD_VERSION(x) ((x) >> 5)
defines
#define BSD_NBITS(x) ((x) & 0x1F)
defines
#define BSD_CURRENT_VERSION 1
defines
#define DEBUG 1
defines
#define BSD_OVHD 2 /* BSD compress overhead/packet */
defines
#define MIN_BSD_BITS 9
defines
#define BSD_INIT_BITS MIN_BSD_BITS
defines
#define MAX_BSD_BITS 15
defines
#define CLEAR 256 /* table clear output code */
defines
#define FIRST 257 /* first free entry */
defines
#define LAST 255
defines
#define MAXCODE(b) ((1 << (b)) - 1)
defines
#define BADCODEM1 MAXCODE(MAX_BSD_BITS)
defines
#define BSD_HASH(prefix, suffix, hshift) ((((unsigned long)(suffix)) << (hshift)) \
defines
#define BSD_KEY(prefix, suffix) ((((unsigned long)(suffix)) << 16) \
defines
#define CHECK_GAP 10000 /* Ratio check interval */
defines
#define RATIO_SCALE_LOG 8
defines
#define RATIO_SCALE (1 << RATIO_SCALE_LOG)
defines
#define RATIO_MAX (0x7fffffff >> RATIO_SCALE_LOG)
defines
#define dict_ptrx(p, idx) &(p->dict[idx])
defines
#define lens_ptrx(p, idx) &(p->lens[idx])
defines
#define lens_ptr(db, idx) lens_ptrx(db, idx)
defines
#define dict_ptr(db, idx) dict_ptrx(db, idx)
defines
#define OUTPUT(ent) \
structs
struct bsd_dict { u32 fcode; u16 codem1; /* output of hash table -1 */ u16 cptr; /* map code to hash table entry */ };
structs
struct bsd_db { int totlen; /* length of this structure */ unsigned int hsize; /* size of the hash table */ unsigned char hshift; /* used in hash function */ unsigned char n_bits; /* current bits/code */ unsigned char maxbits; /* maximum bits/code */ unsigned char debug; /* non-zero i...
functions
void bsd_clear(struct bsd_db *db) { db->clear_count++; db->max_ent = FIRST - 1; db->n_bits = BSD_INIT_BITS; db->bytes_out = 0; db->in_count = 0; db->incomp_count = 0; db->ratio = 0; db->checkpoint = CHECK_GAP; }
functions
void bsd_stats(void *state, struct compstat *stats) { struct bsd_db *db = (struct bsd_db *) state; stats->unc_bytes = db->uncomp_bytes; stats->unc_packets = db->uncomp_count; stats->comp_bytes = db->comp_bytes; stats->comp_packets = db->comp_count; stats->inc_bytes = db->incomp_bytes; stats->i...
functions
void bsd_reset(void *state, unsigned char code, unsigned char id, unsigned char *data, unsigned len, struct isdn_ppp_resetparams *rsparm) { struct bsd_db *db = (struct bsd_db *) state; bsd_clear(db); db->seqno = 0; db->clear_count = 0; }
functions
void bsd_free(void *state) { struct bsd_db *db = (struct bsd_db *) state; if (db) { /* * Release the dictionary */ vfree(db->dict); db->dict = NULL; /* * Release the string buffer */ vfree(db->lens); db->lens = NULL; /* * Finally release the structure itself. */ ...
functions
int bsd_init(void *state, struct isdn_ppp_comp_data *data, int unit, int debug) { struct bsd_db *db = state; int indx; int decomp; if (!state || !data) { printk(KERN_ERR "isdn_bsd_init: [%d] ERR, state %lx data %lx\n", unit, (long)state, (long)data); return 0; }
functions
int bsd_compress(void *state, struct sk_buff *skb_in, struct sk_buff *skb_out, int proto) { struct bsd_db *db; int hshift; unsigned int max_ent; unsigned int n_bits; unsigned int bitno; unsigned long accm; int ent; unsigned long fcode; struct bsd_dict *dictp; unsigned char c; int hval, disp, ilen...
functions
void bsd_incomp(void *state, struct sk_buff *skb_in, int proto) { bsd_compress(state, skb_in, NULL, proto); }
functions
int bsd_decompress(void *state, struct sk_buff *skb_in, struct sk_buff *skb_out, struct isdn_ppp_resetparams *rsparm) { struct bsd_db *db; unsigned int max_ent; unsigned long accm; unsigned int bitno; /* 1st valid bit in accm */ unsigned int n_bits; unsigned int tgtbitno; /* bitno when we have a cod...
functions
DEBUG if (--codelen <= 0 || dictp->codem1 != finchar - 1) { if (codelen <= 0) { printk(KERN_ERR "bsd_decomp%d: fell off end of chain ", db->unit); printk(KERN_ERR "0x%x at 0x%x by 0x%x, max_ent=0x%x\n", incode, finchar, dictp2->cptr, max_ent); }
functions
__init isdn_bsdcomp_init(void) { int answer = isdn_ppp_register_compressor(&ippp_bsd_compress); if (answer == 0) printk(KERN_INFO "PPP BSD Compression module registered\n"); return answer; }
functions
__exit isdn_bsdcomp_exit(void) { isdn_ppp_unregister_compressor(&ippp_bsd_compress); }
includes
#include <stdio.h>
includes
#include <unistd.h>
includes
#include <stdlib.h>
includes
#include <fcntl.h>
includes
#include <string.h>
includes
#include <sys/types.h>
includes
#include <sys/stat.h>
main
int main(int argc, char **argv) { char *value; blkid_cache cache; blkid_debug_mask = DEBUG_ALL; if (argc != 2 && argc != 3) { fprintf(stderr, "Usage:\t%s tagname=value\n" "\t%s tagname devname\n" "Find which device holds a given token or\n" "Find what the value of a tag is in a device\n", argv[0], ar...
includes
#include <linux/slab.h>
includes
#include <linux/kernel.h>
includes
#include <linux/blkdev.h>
includes
#include <linux/spinlock.h>
includes
#include <scsi/scsi.h>
includes
#include <scsi/scsi_host.h>
includes
#include <scsi/scsi_cmnd.h>
includes
#include <scsi/scsi_eh.h>
includes
#include <scsi/scsi_device.h>
includes
#include <scsi/scsi_tcq.h>
includes
#include <scsi/scsi_transport.h>
includes
#include <linux/libata.h>
includes
#include <linux/hdreg.h>
includes
#include <linux/uaccess.h>
includes
#include <linux/suspend.h>
includes
#include <asm/unaligned.h>
defines
#define SECTOR_SIZE 512
defines
#define ATA_SCSI_RBUF_SIZE 4096
defines
#define RW_RECOVERY_MPAGE 0x1
defines
#define RW_RECOVERY_MPAGE_LEN 12
defines
#define CACHE_MPAGE 0x8
defines
#define CACHE_MPAGE_LEN 20
defines
#define CONTROL_MPAGE 0xa
defines
#define CONTROL_MPAGE_LEN 12
defines
#define ALL_MPAGES 0x3f
defines
#define ALL_SUB_MPAGES 0xff
functions
ssize_t ata_scsi_lpm_put(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct Scsi_Host *shost = class_to_shost(dev); struct ata_port *ap = ata_shost_to_port(shost); enum link_pm policy = 0; int i; /* * we are skipping array location 0 on purpose - this * is becau...
functions
ssize_t ata_scsi_lpm_show(struct device *dev, struct device_attribute *attr, char *buf) { struct Scsi_Host *shost = class_to_shost(dev); struct ata_port *ap = ata_shost_to_port(shost); const char *policy = ata_scsi_lpm_get(ap->pm_policy); if (!policy) return -EINVAL; return snprintf(buf, 23, "%s\n", policy);...
functions
ssize_t ata_scsi_park_show(struct device *device, struct device_attribute *attr, char *buf) { struct scsi_device *sdev = to_scsi_device(device); struct ata_port *ap; struct ata_link *link; struct ata_device *dev; unsigned long flags, now; unsigned int uninitialized_var(msecs); int rc = 0; ap = ata_shost_...
functions
ssize_t ata_scsi_park_store(struct device *device, struct device_attribute *attr, const char *buf, size_t len) { struct scsi_device *sdev = to_scsi_device(device); struct ata_port *ap; struct ata_device *dev; long int input; unsigned long flags; int rc; rc = strict_strtol(buf, 10, &input); if (rc...
functions
void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq) { cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; scsi_build_sense_buffer(0, cmd->sense_buffer, sk, asc, ascq); }
functions
ssize_t ata_scsi_em_message_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct Scsi_Host *shost = class_to_shost(dev); struct ata_port *ap = ata_shost_to_port(shost); if (ap->ops->em_store && (ap->flags & ATA_FLAG_EM)) return ap->ops->em_store(ap, buf, count); re...
functions
ssize_t ata_scsi_em_message_show(struct device *dev, struct device_attribute *attr, char *buf) { struct Scsi_Host *shost = class_to_shost(dev); struct ata_port *ap = ata_shost_to_port(shost); if (ap->ops->em_show && (ap->flags & ATA_FLAG_EM)) return ap->ops->em_show(ap, buf); return -EINVAL; }
functions
ssize_t ata_scsi_em_message_type_show(struct device *dev, struct device_attribute *attr, char *buf) { struct Scsi_Host *shost = class_to_shost(dev); struct ata_port *ap = ata_shost_to_port(shost); return snprintf(buf, 23, "%d\n", ap->em_message_type); }
functions
ssize_t ata_scsi_activity_show(struct device *dev, struct device_attribute *attr, char *buf) { struct scsi_device *sdev = to_scsi_device(dev); struct ata_port *ap = ata_shost_to_port(sdev->host); struct ata_device *atadev = ata_scsi_find_dev(ap, sdev); if (ap->ops->sw_activity_show && (ap->flags & ATA_FLAG_SW_AC...
functions
ssize_t ata_scsi_activity_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct scsi_device *sdev = to_scsi_device(dev); struct ata_port *ap = ata_shost_to_port(sdev->host); struct ata_device *atadev = ata_scsi_find_dev(ap, sdev); enum sw_activity val; int rc; if (ap->...
functions
int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev, sector_t capacity, int geom[]) { geom[0] = 255; geom[1] = 63; sector_div(capacity, 255*63); geom[2] = capacity; return 0; }
functions
void ata_scsi_unlock_native_capacity(struct scsi_device *sdev) { struct ata_port *ap = ata_shost_to_port(sdev->host); struct ata_device *dev; unsigned long flags; spin_lock_irqsave(ap->lock, flags); dev = ata_scsi_find_dev(ap, sdev); if (dev && dev->n_sectors < dev->n_native_sectors) { dev->flags |= ATA_DFLAG...
functions
void ata_scsi_reconfig(struct scsi_device *sdev) { struct ata_port *ap = ata_shost_to_port(sdev->host); struct ata_device *dev; dev = ata_scsi_find_dev(ap, sdev); if (!dev) return; ata_dev_read_id(dev, &dev->class, 0, dev->id); dev->pio_mask = UINT_MAX; dev->mwdma_mask = UINT_MAX; dev->udma_mask = UINT_MAX; ...
functions
int ata_get_identity(struct ata_port *ap, struct scsi_device *sdev, void __user *arg) { struct ata_device *dev = ata_scsi_find_dev(ap, sdev); u16 __user *dst = arg; char buf[40]; if (!dev) return -ENOMSG; if (copy_to_user(dst, dev->id, ATA_ID_WORDS * sizeof(u16))) return -EFAULT; ata_id_string(dev->...
functions
int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg) { int rc = 0; u8 scsi_cmd[MAX_COMMAND_SIZE]; u8 args[4], *argbuf = NULL, *sensebuf = NULL; int argsize = 0; enum dma_data_direction data_dir; int cmd_result; if (arg == NULL) return -EINVAL; if (copy_from_user(args, arg, sizeof(args))) retur...
functions
int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg) { int rc = 0; u8 scsi_cmd[MAX_COMMAND_SIZE]; u8 args[7], *sensebuf = NULL; int cmd_result; if (arg == NULL) return -EINVAL; if (copy_from_user(args, arg, sizeof(args))) return -EFAULT; sensebuf = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_NOIO); i...
functions
int ata_ioc32(struct ata_port *ap) { if (ap->flags & ATA_FLAG_PIO_DMA) return 1; if (ap->pflags & ATA_PFLAG_PIO32) return 1; return 0; }
functions
int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *scsidev, int cmd, void __user *arg) { int val = -EINVAL, rc = -EINVAL; unsigned long flags; switch (cmd) { case ATA_IOC_GET_IO32: spin_lock_irqsave(ap->lock, flags); val = ata_ioc32(ap); spin_unlock_irqrestore(ap->lock, flags); if (copy...
functions
int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg) { return ata_sas_scsi_ioctl(ata_shost_to_port(scsidev->host), scsidev, cmd, arg); }
functions
void ata_qc_set_pc_nbytes(struct ata_queued_cmd *qc) { struct scsi_cmnd *scmd = qc->scsicmd; qc->extrabytes = scmd->request->extra_len; qc->nbytes = scsi_bufflen(scmd) + qc->extrabytes; }
functions
void ata_dump_status(unsigned id, struct ata_taskfile *tf) { u8 stat = tf->command, err = tf->feature; printk(KERN_WARNING "ata%u: status=0x%02x { ", id, stat); if (stat & ATA_BUSY) { printk("Busy }
functions
void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk, u8 *asc, u8 *ascq, int verbose) { int i; /* Based on the 3ware driver translation table */ static const unsigned char sense_table[][4] = { /* BBD|ECC|ID|MAR */ {0xd1, ABORTED_COMMAND, 0x00, 0x00}