Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!
This commit is contained in:
Linus Torvalds
2005-04-16 15:20:36 -07:00
commit 1da177e4c3
17291 changed files with 6718755 additions and 0 deletions

2
include/linux/8250_pci.h Normal file
View File

@@ -0,0 +1,2 @@
int pci_siig10x_fn(struct pci_dev *dev, int enable);
int pci_siig20x_fn(struct pci_dev *dev, int enable);

268
include/linux/a.out.h Normal file
View File

@@ -0,0 +1,268 @@
#ifndef __A_OUT_GNU_H__
#define __A_OUT_GNU_H__
#define __GNU_EXEC_MACROS__
#ifndef __STRUCT_EXEC_OVERRIDE__
#include <asm/a.out.h>
#endif /* __STRUCT_EXEC_OVERRIDE__ */
/* these go in the N_MACHTYPE field */
enum machine_type {
#if defined (M_OLDSUN2)
M__OLDSUN2 = M_OLDSUN2,
#else
M_OLDSUN2 = 0,
#endif
#if defined (M_68010)
M__68010 = M_68010,
#else
M_68010 = 1,
#endif
#if defined (M_68020)
M__68020 = M_68020,
#else
M_68020 = 2,
#endif
#if defined (M_SPARC)
M__SPARC = M_SPARC,
#else
M_SPARC = 3,
#endif
/* skip a bunch so we don't run into any of sun's numbers */
M_386 = 100,
M_MIPS1 = 151, /* MIPS R3000/R3000 binary */
M_MIPS2 = 152 /* MIPS R6000/R4000 binary */
};
#if !defined (N_MAGIC)
#define N_MAGIC(exec) ((exec).a_info & 0xffff)
#endif
#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
#define N_SET_INFO(exec, magic, type, flags) \
((exec).a_info = ((magic) & 0xffff) \
| (((int)(type) & 0xff) << 16) \
| (((flags) & 0xff) << 24))
#define N_SET_MAGIC(exec, magic) \
((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
#define N_SET_MACHTYPE(exec, machtype) \
((exec).a_info = \
((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
#define N_SET_FLAGS(exec, flags) \
((exec).a_info = \
((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
/* Code indicating object file or impure executable. */
#define OMAGIC 0407
/* Code indicating pure executable. */
#define NMAGIC 0410
/* Code indicating demand-paged executable. */
#define ZMAGIC 0413
/* This indicates a demand-paged executable with the header in the text.
The first page is unmapped to help trap NULL pointer references */
#define QMAGIC 0314
/* Code indicating core file. */
#define CMAGIC 0421
#if !defined (N_BADMAG)
#define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
&& N_MAGIC(x) != NMAGIC \
&& N_MAGIC(x) != ZMAGIC \
&& N_MAGIC(x) != QMAGIC)
#endif
#define _N_HDROFF(x) (1024 - sizeof (struct exec))
#if !defined (N_TXTOFF)
#define N_TXTOFF(x) \
(N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \
(N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
#endif
#if !defined (N_DATOFF)
#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
#endif
#if !defined (N_TRELOFF)
#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
#endif
#if !defined (N_DRELOFF)
#define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x))
#endif
#if !defined (N_SYMOFF)
#define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x))
#endif
#if !defined (N_STROFF)
#define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x))
#endif
/* Address of text segment in memory after it is loaded. */
#if !defined (N_TXTADDR)
#define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0)
#endif
/* Address of data segment in memory after it is loaded.
Note that it is up to you to define SEGMENT_SIZE
on machines not listed here. */
#if defined(vax) || defined(hp300) || defined(pyr)
#define SEGMENT_SIZE page_size
#endif
#ifdef sony
#define SEGMENT_SIZE 0x2000
#endif /* Sony. */
#ifdef is68k
#define SEGMENT_SIZE 0x20000
#endif
#if defined(m68k) && defined(PORTAR)
#define PAGE_SIZE 0x400
#define SEGMENT_SIZE PAGE_SIZE
#endif
#ifdef linux
#include <asm/page.h>
#if defined(__i386__) || defined(__mc68000__)
#define SEGMENT_SIZE 1024
#else
#ifndef SEGMENT_SIZE
#define SEGMENT_SIZE PAGE_SIZE
#endif
#endif
#endif
#define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1))
#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
#ifndef N_DATADDR
#define N_DATADDR(x) \
(N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
: (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
#endif
/* Address of bss segment in memory after it is loaded. */
#if !defined (N_BSSADDR)
#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
#endif
#if !defined (N_NLIST_DECLARED)
struct nlist {
union {
char *n_name;
struct nlist *n_next;
long n_strx;
} n_un;
unsigned char n_type;
char n_other;
short n_desc;
unsigned long n_value;
};
#endif /* no N_NLIST_DECLARED. */
#if !defined (N_UNDF)
#define N_UNDF 0
#endif
#if !defined (N_ABS)
#define N_ABS 2
#endif
#if !defined (N_TEXT)
#define N_TEXT 4
#endif
#if !defined (N_DATA)
#define N_DATA 6
#endif
#if !defined (N_BSS)
#define N_BSS 8
#endif
#if !defined (N_FN)
#define N_FN 15
#endif
#if !defined (N_EXT)
#define N_EXT 1
#endif
#if !defined (N_TYPE)
#define N_TYPE 036
#endif
#if !defined (N_STAB)
#define N_STAB 0340
#endif
/* The following type indicates the definition of a symbol as being
an indirect reference to another symbol. The other symbol
appears as an undefined reference, immediately following this symbol.
Indirection is asymmetrical. The other symbol's value will be used
to satisfy requests for the indirect symbol, but not vice versa.
If the other symbol does not have a definition, libraries will
be searched to find a definition. */
#define N_INDR 0xa
/* The following symbols refer to set elements.
All the N_SET[ATDB] symbols with the same name form one set.
Space is allocated for the set in the text section, and each set
element's value is stored into one word of the space.
The first word of the space is the length of the set (number of elements).
The address of the set is made into an N_SETV symbol
whose name is the same as the name of the set.
This symbol acts like a N_DATA global symbol
in that it can satisfy undefined external references. */
/* These appear as input to LD, in a .o file. */
#define N_SETA 0x14 /* Absolute set element symbol */
#define N_SETT 0x16 /* Text set element symbol */
#define N_SETD 0x18 /* Data set element symbol */
#define N_SETB 0x1A /* Bss set element symbol */
/* This is output from LD. */
#define N_SETV 0x1C /* Pointer to set vector in data area. */
#if !defined (N_RELOCATION_INFO_DECLARED)
/* This structure describes a single relocation to be performed.
The text-relocation section of the file is a vector of these structures,
all of which apply to the text section.
Likewise, the data-relocation section applies to the data section. */
struct relocation_info
{
/* Address (within segment) to be relocated. */
int r_address;
/* The meaning of r_symbolnum depends on r_extern. */
unsigned int r_symbolnum:24;
/* Nonzero means value is a pc-relative offset
and it should be relocated for changes in its own address
as well as for changes in the symbol or section specified. */
unsigned int r_pcrel:1;
/* Length (as exponent of 2) of the field to be relocated.
Thus, a value of 2 indicates 1<<2 bytes. */
unsigned int r_length:2;
/* 1 => relocate with value of symbol.
r_symbolnum is the index of the symbol
in file's the symbol table.
0 => relocate with the address of a segment.
r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
(the N_EXT bit may be set also, but signifies nothing). */
unsigned int r_extern:1;
/* Four bits that aren't used, but when writing an object file
it is desirable to clear them. */
#ifdef NS32K
unsigned r_bsr:1;
unsigned r_disp:1;
unsigned r_pad:2;
#else
unsigned int r_pad:4;
#endif
};
#endif /* no N_RELOCATION_INFO_DECLARED. */
#endif /* __A_OUT_GNU_H__ */

374
include/linux/ac97_codec.h Normal file
View File

@@ -0,0 +1,374 @@
#ifndef _AC97_CODEC_H_
#define _AC97_CODEC_H_
#include <linux/types.h>
#include <linux/soundcard.h>
/* AC97 1.0 */
#define AC97_RESET 0x0000 //
#define AC97_MASTER_VOL_STEREO 0x0002 // Line Out
#define AC97_HEADPHONE_VOL 0x0004 //
#define AC97_MASTER_VOL_MONO 0x0006 // TAD Output
#define AC97_MASTER_TONE 0x0008 //
#define AC97_PCBEEP_VOL 0x000a // none
#define AC97_PHONE_VOL 0x000c // TAD Input (mono)
#define AC97_MIC_VOL 0x000e // MIC Input (mono)
#define AC97_LINEIN_VOL 0x0010 // Line Input (stereo)
#define AC97_CD_VOL 0x0012 // CD Input (stereo)
#define AC97_VIDEO_VOL 0x0014 // none
#define AC97_AUX_VOL 0x0016 // Aux Input (stereo)
#define AC97_PCMOUT_VOL 0x0018 // Wave Output (stereo)
#define AC97_RECORD_SELECT 0x001a //
#define AC97_RECORD_GAIN 0x001c
#define AC97_RECORD_GAIN_MIC 0x001e
#define AC97_GENERAL_PURPOSE 0x0020
#define AC97_3D_CONTROL 0x0022
#define AC97_MODEM_RATE 0x0024
#define AC97_POWER_CONTROL 0x0026
/* AC'97 2.0 */
#define AC97_EXTENDED_ID 0x0028 /* Extended Audio ID */
#define AC97_EXTENDED_STATUS 0x002A /* Extended Audio Status */
#define AC97_PCM_FRONT_DAC_RATE 0x002C /* PCM Front DAC Rate */
#define AC97_PCM_SURR_DAC_RATE 0x002E /* PCM Surround DAC Rate */
#define AC97_PCM_LFE_DAC_RATE 0x0030 /* PCM LFE DAC Rate */
#define AC97_PCM_LR_ADC_RATE 0x0032 /* PCM LR ADC Rate */
#define AC97_PCM_MIC_ADC_RATE 0x0034 /* PCM MIC ADC Rate */
#define AC97_CENTER_LFE_MASTER 0x0036 /* Center + LFE Master Volume */
#define AC97_SURROUND_MASTER 0x0038 /* Surround (Rear) Master Volume */
#define AC97_RESERVED_3A 0x003A /* Reserved in AC '97 < 2.2 */
/* AC'97 2.2 */
#define AC97_SPDIF_CONTROL 0x003A /* S/PDIF Control */
/* range 0x3c-0x58 - MODEM */
#define AC97_EXTENDED_MODEM_ID 0x003C
#define AC97_EXTEND_MODEM_STAT 0x003E
#define AC97_LINE1_RATE 0x0040
#define AC97_LINE2_RATE 0x0042
#define AC97_HANDSET_RATE 0x0044
#define AC97_LINE1_LEVEL 0x0046
#define AC97_LINE2_LEVEL 0x0048
#define AC97_HANDSET_LEVEL 0x004A
#define AC97_GPIO_CONFIG 0x004C
#define AC97_GPIO_POLARITY 0x004E
#define AC97_GPIO_STICKY 0x0050
#define AC97_GPIO_WAKE_UP 0x0052
#define AC97_GPIO_STATUS 0x0054
#define AC97_MISC_MODEM_STAT 0x0056
#define AC97_RESERVED_58 0x0058
/* registers 0x005a - 0x007a are vendor reserved */
#define AC97_VENDOR_ID1 0x007c
#define AC97_VENDOR_ID2 0x007e
/* volume control bit defines */
#define AC97_MUTE 0x8000
#define AC97_MICBOOST 0x0040
#define AC97_LEFTVOL 0x3f00
#define AC97_RIGHTVOL 0x003f
/* record mux defines */
#define AC97_RECMUX_MIC 0x0000
#define AC97_RECMUX_CD 0x0101
#define AC97_RECMUX_VIDEO 0x0202
#define AC97_RECMUX_AUX 0x0303
#define AC97_RECMUX_LINE 0x0404
#define AC97_RECMUX_STEREO_MIX 0x0505
#define AC97_RECMUX_MONO_MIX 0x0606
#define AC97_RECMUX_PHONE 0x0707
/* general purpose register bit defines */
#define AC97_GP_LPBK 0x0080 /* Loopback mode */
#define AC97_GP_MS 0x0100 /* Mic Select 0=Mic1, 1=Mic2 */
#define AC97_GP_MIX 0x0200 /* Mono output select 0=Mix, 1=Mic */
#define AC97_GP_RLBK 0x0400 /* Remote Loopback - Modem line codec */
#define AC97_GP_LLBK 0x0800 /* Local Loopback - Modem Line codec */
#define AC97_GP_LD 0x1000 /* Loudness 1=on */
#define AC97_GP_3D 0x2000 /* 3D Enhancement 1=on */
#define AC97_GP_ST 0x4000 /* Stereo Enhancement 1=on */
#define AC97_GP_POP 0x8000 /* Pcm Out Path, 0=pre 3D, 1=post 3D */
/* extended audio status and control bit defines */
#define AC97_EA_VRA 0x0001 /* Variable bit rate enable bit */
#define AC97_EA_DRA 0x0002 /* Double-rate audio enable bit */
#define AC97_EA_SPDIF 0x0004 /* S/PDIF Enable bit */
#define AC97_EA_VRM 0x0008 /* Variable bit rate for MIC enable bit */
#define AC97_EA_CDAC 0x0040 /* PCM Center DAC is ready (Read only) */
#define AC97_EA_SDAC 0x0040 /* PCM Surround DACs are ready (Read only) */
#define AC97_EA_LDAC 0x0080 /* PCM LFE DAC is ready (Read only) */
#define AC97_EA_MDAC 0x0100 /* MIC ADC is ready (Read only) */
#define AC97_EA_SPCV 0x0400 /* S/PDIF configuration valid (Read only) */
#define AC97_EA_PRI 0x0800 /* Turns the PCM Center DAC off */
#define AC97_EA_PRJ 0x1000 /* Turns the PCM Surround DACs off */
#define AC97_EA_PRK 0x2000 /* Turns the PCM LFE DAC off */
#define AC97_EA_PRL 0x4000 /* Turns the MIC ADC off */
#define AC97_EA_SLOT_MASK 0xffcf /* Mask for slot assignment bits */
#define AC97_EA_SPSA_3_4 0x0000 /* Slot assigned to 3 & 4 */
#define AC97_EA_SPSA_7_8 0x0010 /* Slot assigned to 7 & 8 */
#define AC97_EA_SPSA_6_9 0x0020 /* Slot assigned to 6 & 9 */
#define AC97_EA_SPSA_10_11 0x0030 /* Slot assigned to 10 & 11 */
/* S/PDIF control bit defines */
#define AC97_SC_PRO 0x0001 /* Professional status */
#define AC97_SC_NAUDIO 0x0002 /* Non audio stream */
#define AC97_SC_COPY 0x0004 /* Copyright status */
#define AC97_SC_PRE 0x0008 /* Preemphasis status */
#define AC97_SC_CC_MASK 0x07f0 /* Category Code mask */
#define AC97_SC_L 0x0800 /* Generation Level status */
#define AC97_SC_SPSR_MASK 0xcfff /* S/PDIF Sample Rate bits */
#define AC97_SC_SPSR_44K 0x0000 /* Use 44.1kHz Sample rate */
#define AC97_SC_SPSR_48K 0x2000 /* Use 48kHz Sample rate */
#define AC97_SC_SPSR_32K 0x3000 /* Use 32kHz Sample rate */
#define AC97_SC_DRS 0x4000 /* Double Rate S/PDIF */
#define AC97_SC_V 0x8000 /* Validity status */
/* powerdown control and status bit defines */
/* status */
#define AC97_PWR_MDM 0x0010 /* Modem section ready */
#define AC97_PWR_REF 0x0008 /* Vref nominal */
#define AC97_PWR_ANL 0x0004 /* Analog section ready */
#define AC97_PWR_DAC 0x0002 /* DAC section ready */
#define AC97_PWR_ADC 0x0001 /* ADC section ready */
/* control */
#define AC97_PWR_PR0 0x0100 /* ADC and Mux powerdown */
#define AC97_PWR_PR1 0x0200 /* DAC powerdown */
#define AC97_PWR_PR2 0x0400 /* Output mixer powerdown (Vref on) */
#define AC97_PWR_PR3 0x0800 /* Output mixer powerdown (Vref off) */
#define AC97_PWR_PR4 0x1000 /* AC-link powerdown */
#define AC97_PWR_PR5 0x2000 /* Internal Clk disable */
#define AC97_PWR_PR6 0x4000 /* HP amp powerdown */
#define AC97_PWR_PR7 0x8000 /* Modem off - if supported */
/* extended audio ID register bit defines */
#define AC97_EXTID_VRA 0x0001
#define AC97_EXTID_DRA 0x0002
#define AC97_EXTID_SPDIF 0x0004
#define AC97_EXTID_VRM 0x0008
#define AC97_EXTID_DSA0 0x0010
#define AC97_EXTID_DSA1 0x0020
#define AC97_EXTID_CDAC 0x0040
#define AC97_EXTID_SDAC 0x0080
#define AC97_EXTID_LDAC 0x0100
#define AC97_EXTID_AMAP 0x0200
#define AC97_EXTID_REV0 0x0400
#define AC97_EXTID_REV1 0x0800
#define AC97_EXTID_ID0 0x4000
#define AC97_EXTID_ID1 0x8000
/* extended status register bit defines */
#define AC97_EXTSTAT_VRA 0x0001
#define AC97_EXTSTAT_DRA 0x0002
#define AC97_EXTSTAT_SPDIF 0x0004
#define AC97_EXTSTAT_VRM 0x0008
#define AC97_EXTSTAT_SPSA0 0x0010
#define AC97_EXTSTAT_SPSA1 0x0020
#define AC97_EXTSTAT_CDAC 0x0040
#define AC97_EXTSTAT_SDAC 0x0080
#define AC97_EXTSTAT_LDAC 0x0100
#define AC97_EXTSTAT_MADC 0x0200
#define AC97_EXTSTAT_SPCV 0x0400
#define AC97_EXTSTAT_PRI 0x0800
#define AC97_EXTSTAT_PRJ 0x1000
#define AC97_EXTSTAT_PRK 0x2000
#define AC97_EXTSTAT_PRL 0x4000
/* extended audio ID register bit defines */
#define AC97_EXTID_VRA 0x0001
#define AC97_EXTID_DRA 0x0002
#define AC97_EXTID_SPDIF 0x0004
#define AC97_EXTID_VRM 0x0008
#define AC97_EXTID_DSA0 0x0010
#define AC97_EXTID_DSA1 0x0020
#define AC97_EXTID_CDAC 0x0040
#define AC97_EXTID_SDAC 0x0080
#define AC97_EXTID_LDAC 0x0100
#define AC97_EXTID_AMAP 0x0200
#define AC97_EXTID_REV0 0x0400
#define AC97_EXTID_REV1 0x0800
#define AC97_EXTID_ID0 0x4000
#define AC97_EXTID_ID1 0x8000
/* extended status register bit defines */
#define AC97_EXTSTAT_VRA 0x0001
#define AC97_EXTSTAT_DRA 0x0002
#define AC97_EXTSTAT_SPDIF 0x0004
#define AC97_EXTSTAT_VRM 0x0008
#define AC97_EXTSTAT_SPSA0 0x0010
#define AC97_EXTSTAT_SPSA1 0x0020
#define AC97_EXTSTAT_CDAC 0x0040
#define AC97_EXTSTAT_SDAC 0x0080
#define AC97_EXTSTAT_LDAC 0x0100
#define AC97_EXTSTAT_MADC 0x0200
#define AC97_EXTSTAT_SPCV 0x0400
#define AC97_EXTSTAT_PRI 0x0800
#define AC97_EXTSTAT_PRJ 0x1000
#define AC97_EXTSTAT_PRK 0x2000
#define AC97_EXTSTAT_PRL 0x4000
/* useful power states */
#define AC97_PWR_D0 0x0000 /* everything on */
#define AC97_PWR_D1 AC97_PWR_PR0|AC97_PWR_PR1|AC97_PWR_PR4
#define AC97_PWR_D2 AC97_PWR_PR0|AC97_PWR_PR1|AC97_PWR_PR2|AC97_PWR_PR3|AC97_PWR_PR4
#define AC97_PWR_D3 AC97_PWR_PR0|AC97_PWR_PR1|AC97_PWR_PR2|AC97_PWR_PR3|AC97_PWR_PR4
#define AC97_PWR_ANLOFF AC97_PWR_PR2|AC97_PWR_PR3 /* analog section off */
/* Total number of defined registers. */
#define AC97_REG_CNT 64
/* OSS interface to the ac97s.. */
#define AC97_STEREO_MASK (SOUND_MASK_VOLUME|SOUND_MASK_PCM|\
SOUND_MASK_LINE|SOUND_MASK_CD|\
SOUND_MASK_ALTPCM|SOUND_MASK_IGAIN|\
SOUND_MASK_LINE1|SOUND_MASK_VIDEO)
#define AC97_SUPPORTED_MASK (AC97_STEREO_MASK | \
SOUND_MASK_BASS|SOUND_MASK_TREBLE|\
SOUND_MASK_SPEAKER|SOUND_MASK_MIC|\
SOUND_MASK_PHONEIN|SOUND_MASK_PHONEOUT)
#define AC97_RECORD_MASK (SOUND_MASK_MIC|\
SOUND_MASK_CD|SOUND_MASK_IGAIN|SOUND_MASK_VIDEO|\
SOUND_MASK_LINE1| SOUND_MASK_LINE|\
SOUND_MASK_PHONEIN)
/* original check is not good enough in case FOO is greater than
* SOUND_MIXER_NRDEVICES because the supported_mixers has exactly
* SOUND_MIXER_NRDEVICES elements.
* before matching the given mixer against the bitmask in supported_mixers we
* check if mixer number exceeds maximum allowed size which is as mentioned
* above SOUND_MIXER_NRDEVICES */
#define supported_mixer(CODEC,FOO) ((FOO >= 0) && \
(FOO < SOUND_MIXER_NRDEVICES) && \
(CODEC)->supported_mixers & (1<<FOO) )
struct ac97_codec {
/* Linked list of codecs */
struct list_head list;
/* AC97 controller connected with */
void *private_data;
char *name;
int id;
int dev_mixer;
int type;
u32 model;
int modem:1;
struct ac97_ops *codec_ops;
/* controller specific lower leverl ac97 accessing routines.
must be re-entrant safe */
u16 (*codec_read) (struct ac97_codec *codec, u8 reg);
void (*codec_write) (struct ac97_codec *codec, u8 reg, u16 val);
/* Wait for codec-ready. Ok to sleep here. */
void (*codec_wait) (struct ac97_codec *codec);
/* callback used by helper drivers for interesting ac97 setups */
void (*codec_unregister) (struct ac97_codec *codec);
struct ac97_driver *driver;
void *driver_private; /* Private data for the driver */
spinlock_t lock;
/* OSS mixer masks */
int modcnt;
int supported_mixers;
int stereo_mixers;
int record_sources;
/* Property flags */
int flags;
int bit_resolution;
/* OSS mixer interface */
int (*read_mixer) (struct ac97_codec *codec, int oss_channel);
void (*write_mixer)(struct ac97_codec *codec, int oss_channel,
unsigned int left, unsigned int right);
int (*recmask_io) (struct ac97_codec *codec, int rw, int mask);
int (*mixer_ioctl)(struct ac97_codec *codec, unsigned int cmd, unsigned long arg);
/* saved OSS mixer states */
unsigned int mixer_state[SOUND_MIXER_NRDEVICES];
/* Software Modem interface */
int (*modem_ioctl)(struct ac97_codec *codec, unsigned int cmd, unsigned long arg);
};
/*
* Operation structures for each known AC97 chip
*/
struct ac97_ops
{
/* Initialise */
int (*init)(struct ac97_codec *c);
/* Amplifier control */
int (*amplifier)(struct ac97_codec *codec, int on);
/* Digital mode control */
int (*digital)(struct ac97_codec *codec, int slots, int rate, int mode);
#define AUDIO_DIGITAL 0x8000
#define AUDIO_PRO 0x4000
#define AUDIO_DRS 0x2000
#define AUDIO_CCMASK 0x003F
#define AC97_DELUDED_MODEM 1 /* Audio codec reports its a modem */
#define AC97_NO_PCM_VOLUME 2 /* Volume control is missing */
#define AC97_DEFAULT_POWER_OFF 4 /* Needs warm reset to power up */
};
extern int ac97_read_proc (char *page_out, char **start, off_t off,
int count, int *eof, void *data);
extern int ac97_probe_codec(struct ac97_codec *);
extern unsigned int ac97_set_adc_rate(struct ac97_codec *codec, unsigned int rate);
extern unsigned int ac97_set_dac_rate(struct ac97_codec *codec, unsigned int rate);
extern int ac97_save_state(struct ac97_codec *codec);
extern int ac97_restore_state(struct ac97_codec *codec);
extern struct ac97_codec *ac97_alloc_codec(void);
extern void ac97_release_codec(struct ac97_codec *codec);
struct ac97_driver {
struct list_head list;
char *name;
u32 codec_id;
u32 codec_mask;
int (*probe) (struct ac97_codec *codec, struct ac97_driver *driver);
void (*remove) (struct ac97_codec *codec, struct ac97_driver *driver);
};
extern int ac97_register_driver(struct ac97_driver *driver);
extern void ac97_unregister_driver(struct ac97_driver *driver);
/* quirk types */
enum {
AC97_TUNE_DEFAULT = -1, /* use default from quirk list (not valid in list) */
AC97_TUNE_NONE = 0, /* nothing extra to do */
AC97_TUNE_HP_ONLY, /* headphone (true line-out) control as master only */
AC97_TUNE_SWAP_HP, /* swap headphone and master controls */
AC97_TUNE_SWAP_SURROUND, /* swap master and surround controls */
AC97_TUNE_AD_SHARING, /* for AD1985, turn on OMS bit and use headphone */
AC97_TUNE_ALC_JACK, /* for Realtek, enable JACK detection */
};
struct ac97_quirk {
unsigned short vendor; /* PCI vendor id */
unsigned short device; /* PCI device id */
unsigned short mask; /* device id bit mask, 0 = accept all */
const char *name; /* name shown as info */
int type; /* quirk type above */
};
struct pci_dev;
extern int ac97_tune_hardware(struct pci_dev *pdev, struct ac97_quirk *quirk, int override);
#endif /* _AC97_CODEC_H_ */

201
include/linux/acct.h Normal file
View File

@@ -0,0 +1,201 @@
/*
* BSD Process Accounting for Linux - Definitions
*
* Author: Marco van Wieringen (mvw@planets.elm.net)
*
* This header file contains the definitions needed to implement
* BSD-style process accounting. The kernel accounting code and all
* user-level programs that try to do something useful with the
* process accounting log must include this file.
*
* Copyright (C) 1995 - 1997 Marco van Wieringen - ELM Consultancy B.V.
*
*/
#ifndef _LINUX_ACCT_H
#define _LINUX_ACCT_H
#include <linux/types.h>
#include <asm/param.h>
#include <asm/byteorder.h>
/*
* comp_t is a 16-bit "floating" point number with a 3-bit base 8
* exponent and a 13-bit fraction.
* comp2_t is 24-bit with 5-bit base 2 exponent and 20 bit fraction
* (leading 1 not stored).
* See linux/kernel/acct.c for the specific encoding systems used.
*/
typedef __u16 comp_t;
typedef __u32 comp2_t;
/*
* accounting file record
*
* This structure contains all of the information written out to the
* process accounting file whenever a process exits.
*/
#define ACCT_COMM 16
struct acct
{
char ac_flag; /* Flags */
char ac_version; /* Always set to ACCT_VERSION */
/* for binary compatibility back until 2.0 */
__u16 ac_uid16; /* LSB of Real User ID */
__u16 ac_gid16; /* LSB of Real Group ID */
__u16 ac_tty; /* Control Terminal */
__u32 ac_btime; /* Process Creation Time */
comp_t ac_utime; /* User Time */
comp_t ac_stime; /* System Time */
comp_t ac_etime; /* Elapsed Time */
comp_t ac_mem; /* Average Memory Usage */
comp_t ac_io; /* Chars Transferred */
comp_t ac_rw; /* Blocks Read or Written */
comp_t ac_minflt; /* Minor Pagefaults */
comp_t ac_majflt; /* Major Pagefaults */
comp_t ac_swaps; /* Number of Swaps */
/* m68k had no padding here. */
#if !defined(CONFIG_M68K) || !defined(__KERNEL__)
__u16 ac_ahz; /* AHZ */
#endif
__u32 ac_exitcode; /* Exitcode */
char ac_comm[ACCT_COMM + 1]; /* Command Name */
__u8 ac_etime_hi; /* Elapsed Time MSB */
__u16 ac_etime_lo; /* Elapsed Time LSB */
__u32 ac_uid; /* Real User ID */
__u32 ac_gid; /* Real Group ID */
};
struct acct_v3
{
char ac_flag; /* Flags */
char ac_version; /* Always set to ACCT_VERSION */
__u16 ac_tty; /* Control Terminal */
__u32 ac_exitcode; /* Exitcode */
__u32 ac_uid; /* Real User ID */
__u32 ac_gid; /* Real Group ID */
__u32 ac_pid; /* Process ID */
__u32 ac_ppid; /* Parent Process ID */
__u32 ac_btime; /* Process Creation Time */
#ifdef __KERNEL__
__u32 ac_etime; /* Elapsed Time */
#else
float ac_etime; /* Elapsed Time */
#endif
comp_t ac_utime; /* User Time */
comp_t ac_stime; /* System Time */
comp_t ac_mem; /* Average Memory Usage */
comp_t ac_io; /* Chars Transferred */
comp_t ac_rw; /* Blocks Read or Written */
comp_t ac_minflt; /* Minor Pagefaults */
comp_t ac_majflt; /* Major Pagefaults */
comp_t ac_swaps; /* Number of Swaps */
char ac_comm[ACCT_COMM]; /* Command Name */
};
/*
* accounting flags
*/
/* bit set when the process ... */
#define AFORK 0x01 /* ... executed fork, but did not exec */
#define ASU 0x02 /* ... used super-user privileges */
#define ACOMPAT 0x04 /* ... used compatibility mode (VAX only not used) */
#define ACORE 0x08 /* ... dumped core */
#define AXSIG 0x10 /* ... was killed by a signal */
#ifdef __BIG_ENDIAN
#define ACCT_BYTEORDER 0x80 /* accounting file is big endian */
#else
#define ACCT_BYTEORDER 0x00 /* accounting file is little endian */
#endif
#ifdef __KERNEL__
#include <linux/config.h>
#ifdef CONFIG_BSD_PROCESS_ACCT
struct super_block;
extern void acct_auto_close(struct super_block *sb);
extern void acct_process(long exitcode);
extern void acct_update_integrals(struct task_struct *tsk);
extern void acct_clear_integrals(struct task_struct *tsk);
#else
#define acct_auto_close(x) do { } while (0)
#define acct_process(x) do { } while (0)
#define acct_update_integrals(x) do { } while (0)
#define acct_clear_integrals(task) do { } while (0)
#endif
/*
* ACCT_VERSION numbers as yet defined:
* 0: old format (until 2.6.7) with 16 bit uid/gid
* 1: extended variant (binary compatible on M68K)
* 2: extended variant (binary compatible on everything except M68K)
* 3: new binary incompatible format (64 bytes)
* 4: new binary incompatible format (128 bytes)
* 5: new binary incompatible format (128 bytes, second half)
*
*/
#ifdef CONFIG_BSD_PROCESS_ACCT_V3
#define ACCT_VERSION 3
#define AHZ 100
typedef struct acct_v3 acct_t;
#else
#ifdef CONFIG_M68K
#define ACCT_VERSION 1
#else
#define ACCT_VERSION 2
#endif
#define AHZ (USER_HZ)
typedef struct acct acct_t;
#endif
#else
#define ACCT_VERSION 2
#define AHZ (HZ)
#endif /* __KERNEL */
#ifdef __KERNEL__
/*
* Yet another set of HZ to *HZ helper functions.
* See <linux/times.h> for the original.
*/
static inline u32 jiffies_to_AHZ(unsigned long x)
{
#if (TICK_NSEC % (NSEC_PER_SEC / AHZ)) == 0
return x / (HZ / USER_HZ);
#else
u64 tmp = (u64)x * TICK_NSEC;
do_div(tmp, (NSEC_PER_SEC / AHZ));
return (long)tmp;
#endif
}
static inline u64 nsec_to_AHZ(u64 x)
{
#if (NSEC_PER_SEC % AHZ) == 0
do_div(x, (NSEC_PER_SEC / AHZ));
#elif (AHZ % 512) == 0
x *= AHZ/512;
do_div(x, (NSEC_PER_SEC / 512));
#else
/*
* max relative error 5.7e-8 (1.8s per year) for AHZ <= 1024,
* overflow after 64.99 years.
* exact for AHZ=60, 72, 90, 120, 144, 180, 300, 600, 900, ...
*/
x *= 9;
do_div(x, (unsigned long)((9ull * NSEC_PER_SEC + (AHZ/2))
/ AHZ));
#endif
return x;
}
#endif /* __KERNEL */
#endif /* _LINUX_ACCT_H */

536
include/linux/acpi.h Normal file
View File

@@ -0,0 +1,536 @@
/*
* acpi.h - ACPI Interface
*
* Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* 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 of the License, 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; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#ifndef _LINUX_ACPI_H
#define _LINUX_ACPI_H
#ifndef _LINUX
#define _LINUX
#endif
#include <linux/list.h>
#include <acpi/acpi.h>
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#include <asm/acpi.h>
#ifdef CONFIG_ACPI_BOOT
enum acpi_irq_model_id {
ACPI_IRQ_MODEL_PIC = 0,
ACPI_IRQ_MODEL_IOAPIC,
ACPI_IRQ_MODEL_IOSAPIC,
ACPI_IRQ_MODEL_COUNT
};
extern enum acpi_irq_model_id acpi_irq_model;
/* Root System Description Pointer (RSDP) */
struct acpi_table_rsdp {
char signature[8];
u8 checksum;
char oem_id[6];
u8 revision;
u32 rsdt_address;
} __attribute__ ((packed));
struct acpi20_table_rsdp {
char signature[8];
u8 checksum;
char oem_id[6];
u8 revision;
u32 rsdt_address;
u32 length;
u64 xsdt_address;
u8 ext_checksum;
u8 reserved[3];
} __attribute__ ((packed));
typedef struct {
u8 type;
u8 length;
} __attribute__ ((packed)) acpi_table_entry_header;
/* Root System Description Table (RSDT) */
struct acpi_table_rsdt {
struct acpi_table_header header;
u32 entry[8];
} __attribute__ ((packed));
/* Extended System Description Table (XSDT) */
struct acpi_table_xsdt {
struct acpi_table_header header;
u64 entry[1];
} __attribute__ ((packed));
/* Fixed ACPI Description Table (FADT) */
struct acpi_table_fadt {
struct acpi_table_header header;
u32 facs_addr;
u32 dsdt_addr;
/* ... */
} __attribute__ ((packed));
/* Multiple APIC Description Table (MADT) */
struct acpi_table_madt {
struct acpi_table_header header;
u32 lapic_address;
struct {
u32 pcat_compat:1;
u32 reserved:31;
} flags;
} __attribute__ ((packed));
enum acpi_madt_entry_id {
ACPI_MADT_LAPIC = 0,
ACPI_MADT_IOAPIC,
ACPI_MADT_INT_SRC_OVR,
ACPI_MADT_NMI_SRC,
ACPI_MADT_LAPIC_NMI,
ACPI_MADT_LAPIC_ADDR_OVR,
ACPI_MADT_IOSAPIC,
ACPI_MADT_LSAPIC,
ACPI_MADT_PLAT_INT_SRC,
ACPI_MADT_ENTRY_COUNT
};
typedef struct {
u16 polarity:2;
u16 trigger:2;
u16 reserved:12;
} __attribute__ ((packed)) acpi_interrupt_flags;
struct acpi_table_lapic {
acpi_table_entry_header header;
u8 acpi_id;
u8 id;
struct {
u32 enabled:1;
u32 reserved:31;
} flags;
} __attribute__ ((packed));
struct acpi_table_ioapic {
acpi_table_entry_header header;
u8 id;
u8 reserved;
u32 address;
u32 global_irq_base;
} __attribute__ ((packed));
struct acpi_table_int_src_ovr {
acpi_table_entry_header header;
u8 bus;
u8 bus_irq;
u32 global_irq;
acpi_interrupt_flags flags;
} __attribute__ ((packed));
struct acpi_table_nmi_src {
acpi_table_entry_header header;
acpi_interrupt_flags flags;
u32 global_irq;
} __attribute__ ((packed));
struct acpi_table_lapic_nmi {
acpi_table_entry_header header;
u8 acpi_id;
acpi_interrupt_flags flags;
u8 lint;
} __attribute__ ((packed));
struct acpi_table_lapic_addr_ovr {
acpi_table_entry_header header;
u8 reserved[2];
u64 address;
} __attribute__ ((packed));
struct acpi_table_iosapic {
acpi_table_entry_header header;
u8 id;
u8 reserved;
u32 global_irq_base;
u64 address;
} __attribute__ ((packed));
struct acpi_table_lsapic {
acpi_table_entry_header header;
u8 acpi_id;
u8 id;
u8 eid;
u8 reserved[3];
struct {
u32 enabled:1;
u32 reserved:31;
} flags;
} __attribute__ ((packed));
struct acpi_table_plat_int_src {
acpi_table_entry_header header;
acpi_interrupt_flags flags;
u8 type; /* See acpi_interrupt_type */
u8 id;
u8 eid;
u8 iosapic_vector;
u32 global_irq;
u32 reserved;
} __attribute__ ((packed));
enum acpi_interrupt_id {
ACPI_INTERRUPT_PMI = 1,
ACPI_INTERRUPT_INIT,
ACPI_INTERRUPT_CPEI,
ACPI_INTERRUPT_COUNT
};
#define ACPI_SPACE_MEM 0
struct acpi_gen_regaddr {
u8 space_id;
u8 bit_width;
u8 bit_offset;
u8 resv;
u32 addrl;
u32 addrh;
} __attribute__ ((packed));
struct acpi_table_hpet {
struct acpi_table_header header;
u32 id;
struct acpi_gen_regaddr addr;
u8 number;
u16 min_tick;
u8 page_protect;
} __attribute__ ((packed));
/*
* Simple Boot Flags
* http://www.microsoft.com/whdc/hwdev/resources/specs/simp_bios.mspx
*/
struct acpi_table_sbf
{
u8 sbf_signature[4];
u32 sbf_len;
u8 sbf_revision;
u8 sbf_csum;
u8 sbf_oemid[6];
u8 sbf_oemtable[8];
u8 sbf_revdata[4];
u8 sbf_creator[4];
u8 sbf_crearev[4];
u8 sbf_cmos;
u8 sbf_spare[3];
} __attribute__ ((packed));
/*
* System Resource Affinity Table (SRAT)
* http://www.microsoft.com/whdc/hwdev/platform/proc/SRAT.mspx
*/
struct acpi_table_srat {
struct acpi_table_header header;
u32 table_revision;
u64 reserved;
} __attribute__ ((packed));
enum acpi_srat_entry_id {
ACPI_SRAT_PROCESSOR_AFFINITY = 0,
ACPI_SRAT_MEMORY_AFFINITY,
ACPI_SRAT_ENTRY_COUNT
};
struct acpi_table_processor_affinity {
acpi_table_entry_header header;
u8 proximity_domain;
u8 apic_id;
struct {
u32 enabled:1;
u32 reserved:31;
} flags;
u8 lsapic_eid;
u8 reserved[7];
} __attribute__ ((packed));
struct acpi_table_memory_affinity {
acpi_table_entry_header header;
u8 proximity_domain;
u8 reserved1[5];
u32 base_addr_lo;
u32 base_addr_hi;
u32 length_lo;
u32 length_hi;
u32 memory_type; /* See acpi_address_range_id */
struct {
u32 enabled:1;
u32 hot_pluggable:1;
u32 reserved:30;
} flags;
u64 reserved2;
} __attribute__ ((packed));
enum acpi_address_range_id {
ACPI_ADDRESS_RANGE_MEMORY = 1,
ACPI_ADDRESS_RANGE_RESERVED = 2,
ACPI_ADDRESS_RANGE_ACPI = 3,
ACPI_ADDRESS_RANGE_NVS = 4,
ACPI_ADDRESS_RANGE_COUNT
};
/*
* System Locality Information Table (SLIT)
* see http://devresource.hp.com/devresource/docs/techpapers/ia64/slit.pdf
*/
struct acpi_table_slit {
struct acpi_table_header header;
u64 localities;
u8 entry[1]; /* real size = localities^2 */
} __attribute__ ((packed));
/* Smart Battery Description Table (SBST) */
struct acpi_table_sbst {
struct acpi_table_header header;
u32 warning; /* Warn user */
u32 low; /* Critical sleep */
u32 critical; /* Critical shutdown */
} __attribute__ ((packed));
/* Embedded Controller Boot Resources Table (ECDT) */
struct acpi_table_ecdt {
struct acpi_table_header header;
struct acpi_generic_address ec_control;
struct acpi_generic_address ec_data;
u32 uid;
u8 gpe_bit;
char ec_id[0];
} __attribute__ ((packed));
/* PCI MMCONFIG */
struct acpi_table_mcfg {
struct acpi_table_header header;
u8 reserved[8];
u32 base_address;
u32 base_reserved;
} __attribute__ ((packed));
/* Table Handlers */
enum acpi_table_id {
ACPI_TABLE_UNKNOWN = 0,
ACPI_APIC,
ACPI_BOOT,
ACPI_DBGP,
ACPI_DSDT,
ACPI_ECDT,
ACPI_ETDT,
ACPI_FADT,
ACPI_FACS,
ACPI_OEMX,
ACPI_PSDT,
ACPI_SBST,
ACPI_SLIT,
ACPI_SPCR,
ACPI_SRAT,
ACPI_SSDT,
ACPI_SPMI,
ACPI_HPET,
ACPI_MCFG,
ACPI_TABLE_COUNT
};
typedef int (*acpi_table_handler) (unsigned long phys_addr, unsigned long size);
extern acpi_table_handler acpi_table_ops[ACPI_TABLE_COUNT];
typedef int (*acpi_madt_entry_handler) (acpi_table_entry_header *header, const unsigned long end);
char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
unsigned long acpi_find_rsdp (void);
int acpi_boot_init (void);
int acpi_boot_table_init (void);
int acpi_numa_init (void);
int acpi_table_init (void);
int acpi_table_parse (enum acpi_table_id id, acpi_table_handler handler);
int acpi_get_table_header_early (enum acpi_table_id id, struct acpi_table_header **header);
int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries);
int acpi_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries);
void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr);
void acpi_table_print_madt_entry (acpi_table_entry_header *madt);
void acpi_table_print_srat_entry (acpi_table_entry_header *srat);
/* the following four functions are architecture-dependent */
void acpi_numa_slit_init (struct acpi_table_slit *slit);
void acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa);
void acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma);
void acpi_numa_arch_fixup(void);
#ifdef CONFIG_ACPI_HOTPLUG_CPU
/* Arch dependent functions for cpu hotplug support */
int acpi_map_lsapic(acpi_handle handle, int *pcpu);
int acpi_unmap_lsapic(int cpu);
#endif /* CONFIG_ACPI_HOTPLUG_CPU */
extern int acpi_mp_config;
extern u32 pci_mmcfg_base_addr;
extern int sbf_port ;
#else /*!CONFIG_ACPI_BOOT*/
#define acpi_mp_config 0
static inline int acpi_boot_init(void)
{
return 0;
}
static inline int acpi_boot_table_init(void)
{
return 0;
}
#endif /*!CONFIG_ACPI_BOOT*/
unsigned int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low);
int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
/*
* This function undoes the effect of one call to acpi_register_gsi().
* If this matches the last registration, any IRQ resources for gsi
* are freed.
*/
#ifdef CONFIG_ACPI_DEALLOCATE_IRQ
void acpi_unregister_gsi (u32 gsi);
#endif
#ifdef CONFIG_ACPI_PCI
struct acpi_prt_entry {
struct list_head node;
struct acpi_pci_id id;
u8 pin;
struct {
acpi_handle handle;
u32 index;
} link;
u32 irq;
};
struct acpi_prt_list {
int count;
struct list_head entries;
};
struct pci_dev;
int acpi_pci_irq_enable (struct pci_dev *dev);
void acpi_penalize_isa_irq(int irq);
#ifdef CONFIG_ACPI_DEALLOCATE_IRQ
void acpi_pci_irq_disable (struct pci_dev *dev);
#endif
struct acpi_pci_driver {
struct acpi_pci_driver *next;
int (*add)(acpi_handle handle);
void (*remove)(acpi_handle handle);
};
int acpi_pci_register_driver(struct acpi_pci_driver *driver);
void acpi_pci_unregister_driver(struct acpi_pci_driver *driver);
#endif /*CONFIG_ACPI_PCI*/
#ifdef CONFIG_ACPI_EC
extern int ec_read(u8 addr, u8 *val);
extern int ec_write(u8 addr, u8 val);
#endif /*CONFIG_ACPI_EC*/
#ifdef CONFIG_ACPI_INTERPRETER
extern int acpi_blacklisted(void);
extern void acpi_bios_year(char *s);
#else /*!CONFIG_ACPI_INTERPRETER*/
static inline int acpi_blacklisted(void)
{
return 0;
}
#endif /*!CONFIG_ACPI_INTERPRETER*/
#define ACPI_CSTATE_LIMIT_DEFINED /* for driver builds */
#ifdef CONFIG_ACPI
/*
* Set highest legal C-state
* 0: C0 okay, but not C1
* 1: C1 okay, but not C2
* 2: C2 okay, but not C3 etc.
*/
extern unsigned int max_cstate;
static inline unsigned int acpi_get_cstate_limit(void)
{
return max_cstate;
}
static inline void acpi_set_cstate_limit(unsigned int new_limit)
{
max_cstate = new_limit;
return;
}
#else
static inline unsigned int acpi_get_cstate_limit(void) { return 0; }
static inline void acpi_set_cstate_limit(unsigned int new_limit) { return; }
#endif
#ifdef CONFIG_ACPI_NUMA
int acpi_get_pxm(acpi_handle handle);
#else
static inline int acpi_get_pxm(acpi_handle handle)
{
return 0;
}
#endif
extern int pnpacpi_disabled;
#endif /*_LINUX_ACPI_H*/

104
include/linux/adb.h Normal file
View File

@@ -0,0 +1,104 @@
/*
* Definitions for ADB (Apple Desktop Bus) support.
*/
#ifndef __ADB_H
#define __ADB_H
/* ADB commands */
#define ADB_BUSRESET 0
#define ADB_FLUSH(id) (0x01 | ((id) << 4))
#define ADB_WRITEREG(id, reg) (0x08 | (reg) | ((id) << 4))
#define ADB_READREG(id, reg) (0x0C | (reg) | ((id) << 4))
/* ADB default device IDs (upper 4 bits of ADB command byte) */
#define ADB_DONGLE 1 /* "software execution control" devices */
#define ADB_KEYBOARD 2
#define ADB_MOUSE 3
#define ADB_TABLET 4
#define ADB_MODEM 5
#define ADB_MISC 7 /* maybe a monitor */
#define ADB_RET_OK 0
#define ADB_RET_TIMEOUT 3
/* The kind of ADB request. The controller may emulate some
or all of those CUDA/PMU packet kinds */
#define ADB_PACKET 0
#define CUDA_PACKET 1
#define ERROR_PACKET 2
#define TIMER_PACKET 3
#define POWER_PACKET 4
#define MACIIC_PACKET 5
#define PMU_PACKET 6
#define ADB_QUERY 7
/* ADB queries */
/* ADB_QUERY_GETDEVINFO
* Query ADB slot for device presence
* data[2] = id, rep[0] = orig addr, rep[1] = handler_id
*/
#define ADB_QUERY_GETDEVINFO 1
#ifdef __KERNEL__
struct adb_request {
unsigned char data[32];
int nbytes;
unsigned char reply[32];
int reply_len;
unsigned char reply_expected;
unsigned char sent;
unsigned char complete;
void (*done)(struct adb_request *);
void *arg;
struct adb_request *next;
};
struct adb_ids {
int nids;
unsigned char id[16];
};
/* Structure which encapsulates a low-level ADB driver */
struct adb_driver {
char name[16];
int (*probe)(void);
int (*init)(void);
int (*send_request)(struct adb_request *req, int sync);
int (*autopoll)(int devs);
void (*poll)(void);
int (*reset_bus)(void);
};
/* Values for adb_request flags */
#define ADBREQ_REPLY 1 /* expect reply */
#define ADBREQ_SYNC 2 /* poll until done */
#define ADBREQ_NOSEND 4 /* build the request, but don't send it */
/* Messages sent thru the client_list notifier. You should NOT stop
the operation, at least not with this version */
enum adb_message {
ADB_MSG_POWERDOWN, /* Currently called before sleep only */
ADB_MSG_PRE_RESET, /* Called before resetting the bus */
ADB_MSG_POST_RESET /* Called after resetting the bus (re-do init & register) */
};
extern struct adb_driver *adb_controller;
extern struct notifier_block *adb_client_list;
int adb_request(struct adb_request *req, void (*done)(struct adb_request *),
int flags, int nbytes, ...);
int adb_register(int default_id,int handler_id,struct adb_ids *ids,
void (*handler)(unsigned char *, int, struct pt_regs *, int));
int adb_unregister(int index);
void adb_poll(void);
void adb_input(unsigned char *, int, struct pt_regs *, int);
int adb_reset_bus(void);
int adb_try_handler_change(int address, int new_id);
int adb_get_infos(int address, int *original_address, int *handler_id);
#endif /* __KERNEL__ */
#endif /* __ADB_H */

76
include/linux/adfs_fs.h Normal file
View File

@@ -0,0 +1,76 @@
#ifndef _ADFS_FS_H
#define _ADFS_FS_H
#include <linux/types.h>
/*
* Disc Record at disc address 0xc00
*/
struct adfs_discrecord {
__u8 log2secsize;
__u8 secspertrack;
__u8 heads;
__u8 density;
__u8 idlen;
__u8 log2bpmb;
__u8 skew;
__u8 bootoption;
__u8 lowsector;
__u8 nzones;
__le16 zone_spare;
__le32 root;
__le32 disc_size;
__le16 disc_id;
__u8 disc_name[10];
__le32 disc_type;
__le32 disc_size_high;
__u8 log2sharesize:4;
__u8 unused40:4;
__u8 big_flag:1;
__u8 unused41:1;
__u8 nzones_high;
__le32 format_version;
__le32 root_size;
__u8 unused52[60 - 52];
};
#define ADFS_DISCRECORD (0xc00)
#define ADFS_DR_OFFSET (0x1c0)
#define ADFS_DR_SIZE 60
#define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3)
#define ADFS_SUPER_MAGIC 0xadf5
#ifdef __KERNEL__
#include <linux/adfs_fs_i.h>
#include <linux/adfs_fs_sb.h>
/*
* Calculate the boot block checksum on an ADFS drive. Note that this will
* appear to be correct if the sector contains all zeros, so also check that
* the disk size is non-zero!!!
*/
static inline int adfs_checkbblk(unsigned char *ptr)
{
unsigned int result = 0;
unsigned char *p = ptr + 511;
do {
result = (result & 0xff) + (result >> 8);
result = result + *--p;
} while (p != ptr);
return (result & 0xff) != ptr[511];
}
static inline struct adfs_sb_info *ADFS_SB(struct super_block *sb)
{
return sb->s_fs_info;
}
static inline struct adfs_inode_info *ADFS_I(struct inode *inode)
{
return container_of(inode, struct adfs_inode_info, vfs_inode);
}
#endif
#endif

24
include/linux/adfs_fs_i.h Normal file
View File

@@ -0,0 +1,24 @@
/*
* linux/include/linux/adfs_fs_i.h
*
* Copyright (C) 1997 Russell King
*/
#ifndef _ADFS_FS_I
#define _ADFS_FS_I
/*
* adfs file system inode data in memory
*/
struct adfs_inode_info {
loff_t mmu_private;
unsigned long parent_id; /* object id of parent */
__u32 loadaddr; /* RISC OS load address */
__u32 execaddr; /* RISC OS exec address */
unsigned int filetype; /* RISC OS file type */
unsigned int attr; /* RISC OS permissions */
unsigned int stamped:1; /* RISC OS file has date/time */
struct inode vfs_inode;
};
#endif

View File

@@ -0,0 +1,38 @@
/*
* linux/include/linux/adfs_fs_sb.h
*
* Copyright (C) 1997-1999 Russell King
*/
#ifndef _ADFS_FS_SB
#define _ADFS_FS_SB
/*
* Forward-declare this
*/
struct adfs_discmap;
struct adfs_dir_ops;
/*
* ADFS file system superblock data in memory
*/
struct adfs_sb_info {
struct adfs_discmap *s_map; /* bh list containing map */
struct adfs_dir_ops *s_dir; /* directory operations */
uid_t s_uid; /* owner uid */
gid_t s_gid; /* owner gid */
umode_t s_owner_mask; /* ADFS owner perm -> unix perm */
umode_t s_other_mask; /* ADFS other perm -> unix perm */
__u32 s_ids_per_zone; /* max. no ids in one zone */
__u32 s_idlen; /* length of ID in map */
__u32 s_map_size; /* sector size of a map */
unsigned long s_size; /* total size (in blocks) of this fs */
signed int s_map2blk; /* shift left by this for map->sector */
unsigned int s_log2sharesize;/* log2 share size */
__le32 s_version; /* disc format version */
unsigned int s_namelen; /* maximum number of characters in name */
};
#endif

7
include/linux/affs_fs.h Normal file
View File

@@ -0,0 +1,7 @@
#ifndef _AFFS_FS_H
#define _AFFS_FS_H
/*
* The affs filesystem constants/structures
*/
#define AFFS_SUPER_MAGIC 0xadff
#endif

View File

@@ -0,0 +1,66 @@
#ifndef AFFS_HARDBLOCKS_H
#define AFFS_HARDBLOCKS_H
/* Just the needed definitions for the RDB of an Amiga HD. */
struct RigidDiskBlock {
u32 rdb_ID;
__be32 rdb_SummedLongs;
s32 rdb_ChkSum;
u32 rdb_HostID;
__be32 rdb_BlockBytes;
u32 rdb_Flags;
u32 rdb_BadBlockList;
__be32 rdb_PartitionList;
u32 rdb_FileSysHeaderList;
u32 rdb_DriveInit;
u32 rdb_Reserved1[6];
u32 rdb_Cylinders;
u32 rdb_Sectors;
u32 rdb_Heads;
u32 rdb_Interleave;
u32 rdb_Park;
u32 rdb_Reserved2[3];
u32 rdb_WritePreComp;
u32 rdb_ReducedWrite;
u32 rdb_StepRate;
u32 rdb_Reserved3[5];
u32 rdb_RDBBlocksLo;
u32 rdb_RDBBlocksHi;
u32 rdb_LoCylinder;
u32 rdb_HiCylinder;
u32 rdb_CylBlocks;
u32 rdb_AutoParkSeconds;
u32 rdb_HighRDSKBlock;
u32 rdb_Reserved4;
char rdb_DiskVendor[8];
char rdb_DiskProduct[16];
char rdb_DiskRevision[4];
char rdb_ControllerVendor[8];
char rdb_ControllerProduct[16];
char rdb_ControllerRevision[4];
u32 rdb_Reserved5[10];
};
#define IDNAME_RIGIDDISK 0x5244534B /* "RDSK" */
struct PartitionBlock {
__be32 pb_ID;
__be32 pb_SummedLongs;
s32 pb_ChkSum;
u32 pb_HostID;
__be32 pb_Next;
u32 pb_Flags;
u32 pb_Reserved1[2];
u32 pb_DevFlags;
u8 pb_DriveName[32];
u32 pb_Reserved2[15];
__be32 pb_Environment[17];
u32 pb_EReserved[15];
};
#define IDNAME_PARTITION 0x50415254 /* "PART" */
#define RDB_ALLOCATION_LIMIT 16
#endif /* AFFS_HARDBLOCKS_H */

109
include/linux/agp_backend.h Normal file
View File

@@ -0,0 +1,109 @@
/*
* AGPGART backend specific includes. Not for userspace consumption.
*
* Copyright (C) 2004 Silicon Graphics, Inc.
* Copyright (C) 2002-2003 Dave Jones
* Copyright (C) 1999 Jeff Hartmann
* Copyright (C) 1999 Precision Insight, Inc.
* Copyright (C) 1999 Xi Graphics, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifndef _AGP_BACKEND_H
#define _AGP_BACKEND_H 1
#ifdef __KERNEL__
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
enum chipset_type {
NOT_SUPPORTED,
SUPPORTED,
};
struct agp_version {
u16 major;
u16 minor;
};
struct agp_kern_info {
struct agp_version version;
struct pci_dev *device;
enum chipset_type chipset;
unsigned long mode;
unsigned long aper_base;
size_t aper_size;
int max_memory; /* In pages */
int current_memory;
int cant_use_aperture;
unsigned long page_mask;
struct vm_operations_struct *vm_ops;
};
/*
* The agp_memory structure has information about the block of agp memory
* allocated. A caller may manipulate the next and prev pointers to link
* each allocated item into a list. These pointers are ignored by the backend.
* Everything else should never be written to, but the caller may read any of
* the items to determine the status of this block of agp memory.
*/
struct agp_bridge_data;
struct agp_memory {
struct agp_memory *next;
struct agp_memory *prev;
struct agp_bridge_data *bridge;
unsigned long *memory;
size_t page_count;
int key;
int num_scratch_pages;
off_t pg_start;
u32 type;
u32 physical;
u8 is_bound;
u8 is_flushed;
};
#define AGP_NORMAL_MEMORY 0
extern struct agp_bridge_data *agp_bridge;
extern struct list_head agp_bridges;
extern struct agp_bridge_data *(*agp_find_bridge)(struct pci_dev *);
extern void agp_free_memory(struct agp_memory *);
extern struct agp_memory *agp_allocate_memory(struct agp_bridge_data *, size_t, u32);
extern int agp_copy_info(struct agp_bridge_data *, struct agp_kern_info *);
extern int agp_bind_memory(struct agp_memory *, off_t);
extern int agp_unbind_memory(struct agp_memory *);
extern void agp_enable(struct agp_bridge_data *, u32);
extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *);
extern void agp_backend_release(struct agp_bridge_data *);
#endif /* __KERNEL__ */
#endif /* _AGP_BACKEND_H */

214
include/linux/agpgart.h Normal file
View File

@@ -0,0 +1,214 @@
/*
* AGPGART module version 0.99
* Copyright (C) 1999 Jeff Hartmann
* Copyright (C) 1999 Precision Insight, Inc.
* Copyright (C) 1999 Xi Graphics, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifndef _AGP_H
#define _AGP_H 1
#include <linux/agp_backend.h>
#define AGPIOC_BASE 'A'
#define AGPIOC_INFO _IOR (AGPIOC_BASE, 0, struct agp_info*)
#define AGPIOC_ACQUIRE _IO (AGPIOC_BASE, 1)
#define AGPIOC_RELEASE _IO (AGPIOC_BASE, 2)
#define AGPIOC_SETUP _IOW (AGPIOC_BASE, 3, struct agp_setup*)
#define AGPIOC_RESERVE _IOW (AGPIOC_BASE, 4, struct agp_region*)
#define AGPIOC_PROTECT _IOW (AGPIOC_BASE, 5, struct agp_region*)
#define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 6, struct agp_allocate*)
#define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int)
#define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, struct agp_bind*)
#define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, struct agp_unbind*)
#define AGP_DEVICE "/dev/agpgart"
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef __KERNEL__
#include <linux/types.h>
#include <asm/types.h>
struct agp_version {
__u16 major;
__u16 minor;
};
typedef struct _agp_info {
struct agp_version version; /* version of the driver */
__u32 bridge_id; /* bridge vendor/device */
__u32 agp_mode; /* mode info of bridge */
unsigned long aper_base;/* base of aperture */
size_t aper_size; /* size of aperture */
size_t pg_total; /* max pages (swap + system) */
size_t pg_system; /* max pages (system) */
size_t pg_used; /* current pages used */
} agp_info;
typedef struct _agp_setup {
__u32 agp_mode; /* mode info of bridge */
} agp_setup;
/*
* The "prot" down below needs still a "sleep" flag somehow ...
*/
typedef struct _agp_segment {
off_t pg_start; /* starting page to populate */
size_t pg_count; /* number of pages */
int prot; /* prot flags for mmap */
} agp_segment;
typedef struct _agp_region {
pid_t pid; /* pid of process */
size_t seg_count; /* number of segments */
struct _agp_segment *seg_list;
} agp_region;
typedef struct _agp_allocate {
int key; /* tag of allocation */
size_t pg_count; /* number of pages */
__u32 type; /* 0 == normal, other devspec */
__u32 physical; /* device specific (some devices
* need a phys address of the
* actual page behind the gatt
* table) */
} agp_allocate;
typedef struct _agp_bind {
int key; /* tag of allocation */
off_t pg_start; /* starting page to populate */
} agp_bind;
typedef struct _agp_unbind {
int key; /* tag of allocation */
__u32 priority; /* priority for paging out */
} agp_unbind;
#else /* __KERNEL__ */
#define AGPGART_MINOR 175
struct agp_info {
struct agp_version version; /* version of the driver */
u32 bridge_id; /* bridge vendor/device */
u32 agp_mode; /* mode info of bridge */
unsigned long aper_base;/* base of aperture */
size_t aper_size; /* size of aperture */
size_t pg_total; /* max pages (swap + system) */
size_t pg_system; /* max pages (system) */
size_t pg_used; /* current pages used */
};
struct agp_setup {
u32 agp_mode; /* mode info of bridge */
};
/*
* The "prot" down below needs still a "sleep" flag somehow ...
*/
struct agp_segment {
off_t pg_start; /* starting page to populate */
size_t pg_count; /* number of pages */
int prot; /* prot flags for mmap */
};
struct agp_segment_priv {
off_t pg_start;
size_t pg_count;
pgprot_t prot;
};
struct agp_region {
pid_t pid; /* pid of process */
size_t seg_count; /* number of segments */
struct agp_segment *seg_list;
};
struct agp_allocate {
int key; /* tag of allocation */
size_t pg_count; /* number of pages */
u32 type; /* 0 == normal, other devspec */
u32 physical; /* device specific (some devices
* need a phys address of the
* actual page behind the gatt
* table) */
};
struct agp_bind {
int key; /* tag of allocation */
off_t pg_start; /* starting page to populate */
};
struct agp_unbind {
int key; /* tag of allocation */
u32 priority; /* priority for paging out */
};
struct agp_client {
struct agp_client *next;
struct agp_client *prev;
pid_t pid;
int num_segments;
struct agp_segment_priv **segments;
};
struct agp_controller {
struct agp_controller *next;
struct agp_controller *prev;
pid_t pid;
int num_clients;
struct agp_memory *pool;
struct agp_client *clients;
};
#define AGP_FF_ALLOW_CLIENT 0
#define AGP_FF_ALLOW_CONTROLLER 1
#define AGP_FF_IS_CLIENT 2
#define AGP_FF_IS_CONTROLLER 3
#define AGP_FF_IS_VALID 4
struct agp_file_private {
struct agp_file_private *next;
struct agp_file_private *prev;
pid_t my_pid;
long access_flags; /* long req'd for set_bit --RR */
};
struct agp_front_data {
struct semaphore agp_mutex;
struct agp_controller *current_controller;
struct agp_controller *controllers;
struct agp_file_private *file_priv_list;
u8 used_by_controller;
u8 backend_acquired;
};
#endif /* __KERNEL__ */
#endif /* _AGP_H */

201
include/linux/aio.h Normal file
View File

@@ -0,0 +1,201 @@
#ifndef __LINUX__AIO_H
#define __LINUX__AIO_H
#include <linux/list.h>
#include <linux/workqueue.h>
#include <linux/aio_abi.h>
#include <asm/atomic.h>
#define AIO_MAXSEGS 4
#define AIO_KIOGRP_NR_ATOMIC 8
struct kioctx;
/* Notes on cancelling a kiocb:
* If a kiocb is cancelled, aio_complete may return 0 to indicate
* that cancel has not yet disposed of the kiocb. All cancel
* operations *must* call aio_put_req to dispose of the kiocb
* to guard against races with the completion code.
*/
#define KIOCB_C_CANCELLED 0x01
#define KIOCB_C_COMPLETE 0x02
#define KIOCB_SYNC_KEY (~0U)
/* ki_flags bits */
#define KIF_LOCKED 0
#define KIF_KICKED 1
#define KIF_CANCELLED 2
#define kiocbTryLock(iocb) test_and_set_bit(KIF_LOCKED, &(iocb)->ki_flags)
#define kiocbTryKick(iocb) test_and_set_bit(KIF_KICKED, &(iocb)->ki_flags)
#define kiocbSetLocked(iocb) set_bit(KIF_LOCKED, &(iocb)->ki_flags)
#define kiocbSetKicked(iocb) set_bit(KIF_KICKED, &(iocb)->ki_flags)
#define kiocbSetCancelled(iocb) set_bit(KIF_CANCELLED, &(iocb)->ki_flags)
#define kiocbClearLocked(iocb) clear_bit(KIF_LOCKED, &(iocb)->ki_flags)
#define kiocbClearKicked(iocb) clear_bit(KIF_KICKED, &(iocb)->ki_flags)
#define kiocbClearCancelled(iocb) clear_bit(KIF_CANCELLED, &(iocb)->ki_flags)
#define kiocbIsLocked(iocb) test_bit(KIF_LOCKED, &(iocb)->ki_flags)
#define kiocbIsKicked(iocb) test_bit(KIF_KICKED, &(iocb)->ki_flags)
#define kiocbIsCancelled(iocb) test_bit(KIF_CANCELLED, &(iocb)->ki_flags)
struct kiocb {
struct list_head ki_run_list;
long ki_flags;
int ki_users;
unsigned ki_key; /* id of this request */
struct file *ki_filp;
struct kioctx *ki_ctx; /* may be NULL for sync ops */
int (*ki_cancel)(struct kiocb *, struct io_event *);
ssize_t (*ki_retry)(struct kiocb *);
void (*ki_dtor)(struct kiocb *);
struct list_head ki_list; /* the aio core uses this
* for cancellation */
union {
void __user *user;
struct task_struct *tsk;
} ki_obj;
__u64 ki_user_data; /* user's data for completion */
loff_t ki_pos;
/* State that we remember to be able to restart/retry */
unsigned short ki_opcode;
size_t ki_nbytes; /* copy of iocb->aio_nbytes */
char __user *ki_buf; /* remaining iocb->aio_buf */
size_t ki_left; /* remaining bytes */
wait_queue_t ki_wait;
long ki_retried; /* just for testing */
long ki_kicked; /* just for testing */
long ki_queued; /* just for testing */
void *private;
};
#define is_sync_kiocb(iocb) ((iocb)->ki_key == KIOCB_SYNC_KEY)
#define init_sync_kiocb(x, filp) \
do { \
struct task_struct *tsk = current; \
(x)->ki_flags = 0; \
(x)->ki_users = 1; \
(x)->ki_key = KIOCB_SYNC_KEY; \
(x)->ki_filp = (filp); \
(x)->ki_ctx = &tsk->active_mm->default_kioctx; \
(x)->ki_cancel = NULL; \
(x)->ki_dtor = NULL; \
(x)->ki_obj.tsk = tsk; \
(x)->ki_user_data = 0; \
init_wait((&(x)->ki_wait)); \
} while (0)
#define AIO_RING_MAGIC 0xa10a10a1
#define AIO_RING_COMPAT_FEATURES 1
#define AIO_RING_INCOMPAT_FEATURES 0
struct aio_ring {
unsigned id; /* kernel internal index number */
unsigned nr; /* number of io_events */
unsigned head;
unsigned tail;
unsigned magic;
unsigned compat_features;
unsigned incompat_features;
unsigned header_length; /* size of aio_ring */
struct io_event io_events[0];
}; /* 128 bytes + ring size */
#define aio_ring_avail(info, ring) (((ring)->head + (info)->nr - 1 - (ring)->tail) % (info)->nr)
#define AIO_RING_PAGES 8
struct aio_ring_info {
unsigned long mmap_base;
unsigned long mmap_size;
struct page **ring_pages;
spinlock_t ring_lock;
long nr_pages;
unsigned nr, tail;
struct page *internal_pages[AIO_RING_PAGES];
};
struct kioctx {
atomic_t users;
int dead;
struct mm_struct *mm;
/* This needs improving */
unsigned long user_id;
struct kioctx *next;
wait_queue_head_t wait;
spinlock_t ctx_lock;
int reqs_active;
struct list_head active_reqs; /* used for cancellation */
struct list_head run_list; /* used for kicked reqs */
unsigned max_reqs;
struct aio_ring_info ring_info;
struct work_struct wq;
};
/* prototypes */
extern unsigned aio_max_size;
extern ssize_t FASTCALL(wait_on_sync_kiocb(struct kiocb *iocb));
extern int FASTCALL(aio_put_req(struct kiocb *iocb));
extern void FASTCALL(kick_iocb(struct kiocb *iocb));
extern int FASTCALL(aio_complete(struct kiocb *iocb, long res, long res2));
extern void FASTCALL(__put_ioctx(struct kioctx *ctx));
struct mm_struct;
extern void FASTCALL(exit_aio(struct mm_struct *mm));
extern struct kioctx *lookup_ioctx(unsigned long ctx_id);
extern int FASTCALL(io_submit_one(struct kioctx *ctx,
struct iocb __user *user_iocb, struct iocb *iocb));
/* semi private, but used by the 32bit emulations: */
struct kioctx *lookup_ioctx(unsigned long ctx_id);
int FASTCALL(io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
struct iocb *iocb));
#define get_ioctx(kioctx) do { if (unlikely(atomic_read(&(kioctx)->users) <= 0)) BUG(); atomic_inc(&(kioctx)->users); } while (0)
#define put_ioctx(kioctx) do { if (unlikely(atomic_dec_and_test(&(kioctx)->users))) __put_ioctx(kioctx); else if (unlikely(atomic_read(&(kioctx)->users) < 0)) BUG(); } while (0)
#define in_aio() !is_sync_wait(current->io_wait)
/* may be used for debugging */
#define warn_if_async() \
do { \
if (in_aio()) { \
printk(KERN_ERR "%s(%s:%d) called in async context!\n", \
__FUNCTION__, __FILE__, __LINE__); \
dump_stack(); \
} \
} while (0)
#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait)
#define is_retried_kiocb(iocb) ((iocb)->ki_retried > 1)
#include <linux/aio_abi.h>
static inline struct kiocb *list_kiocb(struct list_head *h)
{
return list_entry(h, struct kiocb, ki_list);
}
/* for sysctl: */
extern atomic_t aio_nr;
extern unsigned aio_max_nr;
#endif /* __LINUX__AIO_H */

92
include/linux/aio_abi.h Normal file
View File

@@ -0,0 +1,92 @@
/* linux/aio_abi.h
*
* Copyright 2000,2001,2002 Red Hat.
*
* Written by Benjamin LaHaise <bcrl@kvack.org>
*
* Distribute under the terms of the GPLv2 (see ../../COPYING) or under
* the following terms.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation is hereby granted, provided that the above copyright
* notice appears in all copies. This software is provided without any
* warranty, express or implied. Red Hat makes no representations about
* the suitability of this software for any purpose.
*
* IN NO EVENT SHALL RED HAT BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
* SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
* THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF RED HAT HAS BEEN ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* RED HAT DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND
* RED HAT HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
* ENHANCEMENTS, OR MODIFICATIONS.
*/
#ifndef __LINUX__AIO_ABI_H
#define __LINUX__AIO_ABI_H
#include <asm/byteorder.h>
typedef unsigned long aio_context_t;
enum {
IOCB_CMD_PREAD = 0,
IOCB_CMD_PWRITE = 1,
IOCB_CMD_FSYNC = 2,
IOCB_CMD_FDSYNC = 3,
/* These two are experimental.
* IOCB_CMD_PREADX = 4,
* IOCB_CMD_POLL = 5,
*/
IOCB_CMD_NOOP = 6,
};
/* read() from /dev/aio returns these structures. */
struct io_event {
__u64 data; /* the data field from the iocb */
__u64 obj; /* what iocb this event came from */
__s64 res; /* result code for this event */
__s64 res2; /* secondary result */
};
#if defined(__LITTLE_ENDIAN)
#define PADDED(x,y) x, y
#elif defined(__BIG_ENDIAN)
#define PADDED(x,y) y, x
#else
#error edit for your odd byteorder.
#endif
/*
* we always use a 64bit off_t when communicating
* with userland. its up to libraries to do the
* proper padding and aio_error abstraction
*/
struct iocb {
/* these are internal to the kernel/libc. */
__u64 aio_data; /* data to be returned in event's data */
__u32 PADDED(aio_key, aio_reserved1);
/* the kernel sets aio_key to the req # */
/* common fields */
__u16 aio_lio_opcode; /* see IOCB_CMD_ above */
__s16 aio_reqprio;
__u32 aio_fildes;
__u64 aio_buf;
__u64 aio_nbytes;
__s64 aio_offset;
/* extra parameters */
__u64 aio_reserved2; /* TODO: use this for a (struct sigevent *) */
__u64 aio_reserved3;
}; /* 64 bytes */
#undef IFBIG
#undef IFLITTLE
#endif /* __LINUX__AIO_ABI_H */

62
include/linux/amifd.h Normal file
View File

@@ -0,0 +1,62 @@
#ifndef _AMIFD_H
#define _AMIFD_H
/* Definitions for the Amiga floppy driver */
#include <linux/fd.h>
#define FD_MAX_UNITS 4 /* Max. Number of drives */
#define FLOPPY_MAX_SECTORS 22 /* Max. Number of sectors per track */
#ifndef ASSEMBLER
struct fd_data_type {
char *name; /* description of data type */
int sects; /* sectors per track */
#ifdef __STDC__
int (*read_fkt)(int);
void (*write_fkt)(int);
#else
int (*read_fkt)(); /* read whole track */
void (*write_fkt)(); /* write whole track */
#endif
};
/*
** Floppy type descriptions
*/
struct fd_drive_type {
unsigned long code; /* code returned from drive */
char *name; /* description of drive */
unsigned int tracks; /* number of tracks */
unsigned int heads; /* number of heads */
unsigned int read_size; /* raw read size for one track */
unsigned int write_size; /* raw write size for one track */
unsigned int sect_mult; /* sectors and gap multiplier (HD = 2) */
unsigned int precomp1; /* start track for precomp 1 */
unsigned int precomp2; /* start track for precomp 2 */
unsigned int step_delay; /* time (in ms) for delay after step */
unsigned int settle_time; /* time to settle after dir change */
unsigned int side_time; /* time needed to change sides */
};
struct amiga_floppy_struct {
struct fd_drive_type *type; /* type of floppy for this unit */
struct fd_data_type *dtype; /* type of floppy for this unit */
int track; /* current track (-1 == unknown) */
unsigned char *trackbuf; /* current track (kmaloc()'d */
int blocks; /* total # blocks on disk */
int changed; /* true when not known */
int disk; /* disk in drive (-1 == unknown) */
int motor; /* true when motor is at speed */
int busy; /* true when drive is active */
int dirty; /* true when trackbuf is not on disk */
int status; /* current error code for unit */
struct gendisk *gendisk;
};
#endif
#endif

81
include/linux/amifdreg.h Normal file
View File

@@ -0,0 +1,81 @@
#ifndef _LINUX_AMIFDREG_H
#define _LINUX_AMIFDREG_H
/*
** CIAAPRA bits (read only)
*/
#define DSKRDY (0x1<<5) /* disk ready when low */
#define DSKTRACK0 (0x1<<4) /* head at track zero when low */
#define DSKPROT (0x1<<3) /* disk protected when low */
#define DSKCHANGE (0x1<<2) /* low when disk removed */
/*
** CIAAPRB bits (read/write)
*/
#define DSKMOTOR (0x1<<7) /* motor on when low */
#define DSKSEL3 (0x1<<6) /* select drive 3 when low */
#define DSKSEL2 (0x1<<5) /* select drive 2 when low */
#define DSKSEL1 (0x1<<4) /* select drive 1 when low */
#define DSKSEL0 (0x1<<3) /* select drive 0 when low */
#define DSKSIDE (0x1<<2) /* side selection: 0 = upper, 1 = lower */
#define DSKDIREC (0x1<<1) /* step direction: 0=in, 1=out (to trk 0) */
#define DSKSTEP (0x1) /* pulse low to step head 1 track */
/*
** DSKBYTR bits (read only)
*/
#define DSKBYT (1<<15) /* register contains valid byte when set */
#define DMAON (1<<14) /* disk DMA enabled */
#define DISKWRITE (1<<13) /* disk write bit in DSKLEN enabled */
#define WORDEQUAL (1<<12) /* DSKSYNC register match when true */
/* bits 7-0 are data */
/*
** ADKCON/ADKCONR bits
*/
#ifndef SETCLR
#define ADK_SETCLR (1<<15) /* control bit */
#endif
#define ADK_PRECOMP1 (1<<14) /* precompensation selection */
#define ADK_PRECOMP0 (1<<13) /* 00=none, 01=140ns, 10=280ns, 11=500ns */
#define ADK_MFMPREC (1<<12) /* 0=GCR precomp., 1=MFM precomp. */
#define ADK_WORDSYNC (1<<10) /* enable DSKSYNC auto DMA */
#define ADK_MSBSYNC (1<<9) /* when 1, enable sync on MSbit (for GCR) */
#define ADK_FAST (1<<8) /* bit cell: 0=2us (GCR), 1=1us (MFM) */
/*
** DSKLEN bits
*/
#define DSKLEN_DMAEN (1<<15)
#define DSKLEN_WRITE (1<<14)
/*
** INTENA/INTREQ bits
*/
#define DSKINDEX (0x1<<4) /* DSKINDEX bit */
/*
** Misc
*/
#define MFM_SYNC 0x4489 /* standard MFM sync value */
/* Values for FD_COMMAND */
#define FD_RECALIBRATE 0x07 /* move to track 0 */
#define FD_SEEK 0x0F /* seek track */
#define FD_READ 0xE6 /* read with MT, MFM, SKip deleted */
#define FD_WRITE 0xC5 /* write with MT, MFM */
#define FD_SENSEI 0x08 /* Sense Interrupt Status */
#define FD_SPECIFY 0x03 /* specify HUT etc */
#define FD_FORMAT 0x4D /* format one track */
#define FD_VERSION 0x10 /* get version code */
#define FD_CONFIGURE 0x13 /* configure FIFO operation */
#define FD_PERPENDICULAR 0x12 /* perpendicular r/w mode */
#endif /* _LINUX_AMIFDREG_H */

144
include/linux/amigaffs.h Normal file
View File

@@ -0,0 +1,144 @@
#ifndef AMIGAFFS_H
#define AMIGAFFS_H
#include <linux/types.h>
#include <asm/byteorder.h>
#define FS_OFS 0x444F5300
#define FS_FFS 0x444F5301
#define FS_INTLOFS 0x444F5302
#define FS_INTLFFS 0x444F5303
#define FS_DCOFS 0x444F5304
#define FS_DCFFS 0x444F5305
#define MUFS_FS 0x6d754653 /* 'muFS' */
#define MUFS_OFS 0x6d754600 /* 'muF\0' */
#define MUFS_FFS 0x6d754601 /* 'muF\1' */
#define MUFS_INTLOFS 0x6d754602 /* 'muF\2' */
#define MUFS_INTLFFS 0x6d754603 /* 'muF\3' */
#define MUFS_DCOFS 0x6d754604 /* 'muF\4' */
#define MUFS_DCFFS 0x6d754605 /* 'muF\5' */
#define T_SHORT 2
#define T_LIST 16
#define T_DATA 8
#define ST_LINKFILE -4
#define ST_FILE -3
#define ST_ROOT 1
#define ST_USERDIR 2
#define ST_SOFTLINK 3
#define ST_LINKDIR 4
#define AFFS_ROOT_BMAPS 25
struct affs_date {
__be32 days;
__be32 mins;
__be32 ticks;
};
struct affs_short_date {
__be16 days;
__be16 mins;
__be16 ticks;
};
struct affs_root_head {
__be32 ptype;
__be32 spare1;
__be32 spare2;
__be32 hash_size;
__be32 spare3;
__be32 checksum;
__be32 hashtable[1];
};
struct affs_root_tail {
__be32 bm_flag;
__be32 bm_blk[AFFS_ROOT_BMAPS];
__be32 bm_ext;
struct affs_date root_change;
u8 disk_name[32];
__be32 spare1;
__be32 spare2;
struct affs_date disk_change;
struct affs_date disk_create;
__be32 spare3;
__be32 spare4;
__be32 dcache;
__be32 stype;
};
struct affs_head {
__be32 ptype;
__be32 key;
__be32 block_count;
__be32 spare1;
__be32 first_data;
__be32 checksum;
__be32 table[1];
};
struct affs_tail {
__be32 spare1;
__be16 uid;
__be16 gid;
__be32 protect;
__be32 size;
u8 comment[92];
struct affs_date change;
u8 name[32];
__be32 spare2;
__be32 original;
__be32 link_chain;
__be32 spare[5];
__be32 hash_chain;
__be32 parent;
__be32 extension;
__be32 stype;
};
struct slink_front
{
__be32 ptype;
__be32 key;
__be32 spare1[3];
__be32 checksum;
u8 symname[1]; /* depends on block size */
};
struct affs_data_head
{
__be32 ptype;
__be32 key;
__be32 sequence;
__be32 size;
__be32 next;
__be32 checksum;
u8 data[1]; /* depends on block size */
};
/* Permission bits */
#define FIBF_OTR_READ 0x8000
#define FIBF_OTR_WRITE 0x4000
#define FIBF_OTR_EXECUTE 0x2000
#define FIBF_OTR_DELETE 0x1000
#define FIBF_GRP_READ 0x0800
#define FIBF_GRP_WRITE 0x0400
#define FIBF_GRP_EXECUTE 0x0200
#define FIBF_GRP_DELETE 0x0100
#define FIBF_HIDDEN 0x0080
#define FIBF_SCRIPT 0x0040
#define FIBF_PURE 0x0020 /* no use under linux */
#define FIBF_ARCHIVED 0x0010 /* never set, always cleared on write */
#define FIBF_NOREAD 0x0008 /* 0 means allowed */
#define FIBF_NOWRITE 0x0004 /* 0 means allowed */
#define FIBF_NOEXECUTE 0x0002 /* 0 means allowed, ignored under linux */
#define FIBF_NODELETE 0x0001 /* 0 means allowed */
#define FIBF_OWNER 0x000F /* Bits pertaining to owner */
#define FIBF_MASK 0xEE0E /* Bits modified by Linux */
#endif

218
include/linux/apm_bios.h Normal file
View File

@@ -0,0 +1,218 @@
#ifndef _LINUX_APM_H
#define _LINUX_APM_H
/*
* Include file for the interface to an APM BIOS
* Copyright 1994-2001 Stephen Rothwell (sfr@canb.auug.org.au)
*
* 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.
*/
typedef unsigned short apm_event_t;
typedef unsigned short apm_eventinfo_t;
#ifdef __KERNEL__
#define APM_CS (GDT_ENTRY_APMBIOS_BASE * 8)
#define APM_CS_16 (APM_CS + 8)
#define APM_DS (APM_CS_16 + 8)
struct apm_bios_info {
unsigned short version;
unsigned short cseg;
unsigned long offset;
unsigned short cseg_16;
unsigned short dseg;
unsigned short flags;
unsigned short cseg_len;
unsigned short cseg_16_len;
unsigned short dseg_len;
};
/* Results of APM Installation Check */
#define APM_16_BIT_SUPPORT 0x0001
#define APM_32_BIT_SUPPORT 0x0002
#define APM_IDLE_SLOWS_CLOCK 0x0004
#define APM_BIOS_DISABLED 0x0008
#define APM_BIOS_DISENGAGED 0x0010
/*
* Data for APM that is persistent across module unload/load
*/
struct apm_info {
struct apm_bios_info bios;
unsigned short connection_version;
int get_power_status_broken;
int get_power_status_swabinminutes;
int allow_ints;
int forbid_idle;
int realmode_power_off;
int disabled;
};
/*
* The APM function codes
*/
#define APM_FUNC_INST_CHECK 0x5300
#define APM_FUNC_REAL_CONN 0x5301
#define APM_FUNC_16BIT_CONN 0x5302
#define APM_FUNC_32BIT_CONN 0x5303
#define APM_FUNC_DISCONN 0x5304
#define APM_FUNC_IDLE 0x5305
#define APM_FUNC_BUSY 0x5306
#define APM_FUNC_SET_STATE 0x5307
#define APM_FUNC_ENABLE_PM 0x5308
#define APM_FUNC_RESTORE_BIOS 0x5309
#define APM_FUNC_GET_STATUS 0x530a
#define APM_FUNC_GET_EVENT 0x530b
#define APM_FUNC_GET_STATE 0x530c
#define APM_FUNC_ENABLE_DEV_PM 0x530d
#define APM_FUNC_VERSION 0x530e
#define APM_FUNC_ENGAGE_PM 0x530f
#define APM_FUNC_GET_CAP 0x5310
#define APM_FUNC_RESUME_TIMER 0x5311
#define APM_FUNC_RESUME_ON_RING 0x5312
#define APM_FUNC_TIMER 0x5313
/*
* Function code for APM_FUNC_RESUME_TIMER
*/
#define APM_FUNC_DISABLE_TIMER 0
#define APM_FUNC_GET_TIMER 1
#define APM_FUNC_SET_TIMER 2
/*
* Function code for APM_FUNC_RESUME_ON_RING
*/
#define APM_FUNC_DISABLE_RING 0
#define APM_FUNC_ENABLE_RING 1
#define APM_FUNC_GET_RING 2
/*
* Function code for APM_FUNC_TIMER_STATUS
*/
#define APM_FUNC_TIMER_DISABLE 0
#define APM_FUNC_TIMER_ENABLE 1
#define APM_FUNC_TIMER_GET 2
/*
* in arch/i386/kernel/setup.c
*/
extern struct apm_info apm_info;
#endif /* __KERNEL__ */
/*
* Power states
*/
#define APM_STATE_READY 0x0000
#define APM_STATE_STANDBY 0x0001
#define APM_STATE_SUSPEND 0x0002
#define APM_STATE_OFF 0x0003
#define APM_STATE_BUSY 0x0004
#define APM_STATE_REJECT 0x0005
#define APM_STATE_OEM_SYS 0x0020
#define APM_STATE_OEM_DEV 0x0040
#define APM_STATE_DISABLE 0x0000
#define APM_STATE_ENABLE 0x0001
#define APM_STATE_DISENGAGE 0x0000
#define APM_STATE_ENGAGE 0x0001
/*
* Events (results of Get PM Event)
*/
#define APM_SYS_STANDBY 0x0001
#define APM_SYS_SUSPEND 0x0002
#define APM_NORMAL_RESUME 0x0003
#define APM_CRITICAL_RESUME 0x0004
#define APM_LOW_BATTERY 0x0005
#define APM_POWER_STATUS_CHANGE 0x0006
#define APM_UPDATE_TIME 0x0007
#define APM_CRITICAL_SUSPEND 0x0008
#define APM_USER_STANDBY 0x0009
#define APM_USER_SUSPEND 0x000a
#define APM_STANDBY_RESUME 0x000b
#define APM_CAPABILITY_CHANGE 0x000c
/*
* Error codes
*/
#define APM_SUCCESS 0x00
#define APM_DISABLED 0x01
#define APM_CONNECTED 0x02
#define APM_NOT_CONNECTED 0x03
#define APM_16_CONNECTED 0x05
#define APM_16_UNSUPPORTED 0x06
#define APM_32_CONNECTED 0x07
#define APM_32_UNSUPPORTED 0x08
#define APM_BAD_DEVICE 0x09
#define APM_BAD_PARAM 0x0a
#define APM_NOT_ENGAGED 0x0b
#define APM_BAD_FUNCTION 0x0c
#define APM_RESUME_DISABLED 0x0d
#define APM_NO_ERROR 0x53
#define APM_BAD_STATE 0x60
#define APM_NO_EVENTS 0x80
#define APM_NOT_PRESENT 0x86
/*
* APM Device IDs
*/
#define APM_DEVICE_BIOS 0x0000
#define APM_DEVICE_ALL 0x0001
#define APM_DEVICE_DISPLAY 0x0100
#define APM_DEVICE_STORAGE 0x0200
#define APM_DEVICE_PARALLEL 0x0300
#define APM_DEVICE_SERIAL 0x0400
#define APM_DEVICE_NETWORK 0x0500
#define APM_DEVICE_PCMCIA 0x0600
#define APM_DEVICE_BATTERY 0x8000
#define APM_DEVICE_OEM 0xe000
#define APM_DEVICE_OLD_ALL 0xffff
#define APM_DEVICE_CLASS 0x00ff
#define APM_DEVICE_MASK 0xff00
#ifdef __KERNEL__
/*
* This is the "All Devices" ID communicated to the BIOS
*/
#define APM_DEVICE_BALL ((apm_info.connection_version > 0x0100) ? \
APM_DEVICE_ALL : APM_DEVICE_OLD_ALL)
#endif
/*
* Battery status
*/
#define APM_MAX_BATTERIES 2
/*
* APM defined capability bit flags
*/
#define APM_CAP_GLOBAL_STANDBY 0x0001
#define APM_CAP_GLOBAL_SUSPEND 0x0002
#define APM_CAP_RESUME_STANDBY_TIMER 0x0004 /* Timer resume from standby */
#define APM_CAP_RESUME_SUSPEND_TIMER 0x0008 /* Timer resume from suspend */
#define APM_CAP_RESUME_STANDBY_RING 0x0010 /* Resume on Ring fr standby */
#define APM_CAP_RESUME_SUSPEND_RING 0x0020 /* Resume on Ring fr suspend */
#define APM_CAP_RESUME_STANDBY_PCMCIA 0x0040 /* Resume on PCMCIA Ring */
#define APM_CAP_RESUME_SUSPEND_PCMCIA 0x0080 /* Resume on PCMCIA Ring */
/*
* ioctl operations
*/
#include <linux/ioctl.h>
#define APM_IOC_STANDBY _IO('A', 1)
#define APM_IOC_SUSPEND _IO('A', 2)
#endif /* LINUX_APM_H */

350
include/linux/arcdevice.h Normal file
View File

@@ -0,0 +1,350 @@
/*
* INET An implementation of the TCP/IP protocol suite for the LINUX
* operating system. NET is implemented using the BSD Socket
* interface as the means of communication with the user level.
*
* Definitions used by the ARCnet driver.
*
* Authors: Avery Pennarun and David Woodhouse
*
* 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 of the License, or (at your option) any later version.
*
*/
#ifndef _LINUX_ARCDEVICE_H
#define _LINUX_ARCDEVICE_H
#include <asm/timex.h>
#include <linux/if_arcnet.h>
#ifdef __KERNEL__
#ifndef bool
#define bool int
#endif
/*
* RECON_THRESHOLD is the maximum number of RECON messages to receive
* within one minute before printing a "cabling problem" warning. The
* default value should be fine.
*
* After that, a "cabling restored" message will be printed on the next IRQ
* if no RECON messages have been received for 10 seconds.
*
* Do not define RECON_THRESHOLD at all if you want to disable this feature.
*/
#define RECON_THRESHOLD 30
/*
* Define this to the minimum "timeout" value. If a transmit takes longer
* than TX_TIMEOUT jiffies, Linux will abort the TX and retry. On a large
* network, or one with heavy network traffic, this timeout may need to be
* increased. The larger it is, though, the longer it will be between
* necessary transmits - don't set this too high.
*/
#define TX_TIMEOUT (HZ * 200 / 1000)
/* Display warnings about the driver being an ALPHA version. */
#undef ALPHA_WARNING
/*
* Debugging bitflags: each option can be enabled individually.
*
* Note: only debug flags included in the ARCNET_DEBUG_MAX define will
* actually be available. GCC will (at least, GCC 2.7.0 will) notice
* lines using a BUGLVL not in ARCNET_DEBUG_MAX and automatically optimize
* them out.
*/
#define D_NORMAL 1 /* important operational info */
#define D_EXTRA 2 /* useful, but non-vital information */
#define D_INIT 4 /* show init/probe messages */
#define D_INIT_REASONS 8 /* show reasons for discarding probes */
#define D_RECON 32 /* print a message whenever token is lost */
#define D_PROTO 64 /* debug auto-protocol support */
/* debug levels below give LOTS of output during normal operation! */
#define D_DURING 128 /* trace operations (including irq's) */
#define D_TX 256 /* show tx packets */
#define D_RX 512 /* show rx packets */
#define D_SKB 1024 /* show skb's */
#define D_SKB_SIZE 2048 /* show skb sizes */
#define D_TIMING 4096 /* show time needed to copy buffers to card */
#define D_DEBUG 8192 /* Very detailed debug line for line */
#ifndef ARCNET_DEBUG_MAX
#define ARCNET_DEBUG_MAX (127) /* change to ~0 if you want detailed debugging */
#endif
#ifndef ARCNET_DEBUG
#define ARCNET_DEBUG (D_NORMAL|D_EXTRA)
#endif
extern int arcnet_debug;
/* macros to simplify debug checking */
#define BUGLVL(x) if ((ARCNET_DEBUG_MAX)&arcnet_debug&(x))
#define BUGMSG2(x,msg,args...) do { BUGLVL(x) printk(msg, ## args); } while (0)
#define BUGMSG(x,msg,args...) \
BUGMSG2(x, "%s%6s: " msg, \
x==D_NORMAL ? KERN_WARNING \
: x < D_DURING ? KERN_INFO : KERN_DEBUG, \
dev->name , ## args)
/* see how long a function call takes to run, expressed in CPU cycles */
#define TIME(name, bytes, call) BUGLVL(D_TIMING) { \
unsigned long _x, _y; \
_x = get_cycles(); \
call; \
_y = get_cycles(); \
BUGMSG(D_TIMING, \
"%s: %d bytes in %lu cycles == " \
"%lu Kbytes/100Mcycle\n",\
name, bytes, _y - _x, \
100000000 / 1024 * bytes / (_y - _x + 1));\
} \
else { \
call;\
}
/*
* Time needed to reset the card - in ms (milliseconds). This works on my
* SMC PC100. I can't find a reference that tells me just how long I
* should wait.
*/
#define RESETtime (300)
/*
* These are the max/min lengths of packet payload, not including the
* arc_hardware header, but definitely including the soft header.
*
* Note: packet sizes 254, 255, 256 are impossible because of the way
* ARCnet registers work That's why RFC1201 defines "exception" packets.
* In non-RFC1201 protocols, we have to just tack some extra bytes on the
* end.
*/
#define MTU 253 /* normal packet max size */
#define MinTU 257 /* extended packet min size */
#define XMTU 508 /* extended packet max size */
/* status/interrupt mask bit fields */
#define TXFREEflag 0x01 /* transmitter available */
#define TXACKflag 0x02 /* transmitted msg. ackd */
#define RECONflag 0x04 /* network reconfigured */
#define TESTflag 0x08 /* test flag */
#define EXCNAKflag 0x08 /* excesive nak flag */
#define RESETflag 0x10 /* power-on-reset */
#define RES1flag 0x20 /* reserved - usually set by jumper */
#define RES2flag 0x40 /* reserved - usually set by jumper */
#define NORXflag 0x80 /* receiver inhibited */
/* Flags used for IO-mapped memory operations */
#define AUTOINCflag 0x40 /* Increase location with each access */
#define IOMAPflag 0x02 /* (for 90xx) Use IO mapped memory, not mmap */
#define ENABLE16flag 0x80 /* (for 90xx) Enable 16-bit mode */
/* in the command register, the following bits have these meanings:
* 0-2 command
* 3-4 page number (for enable rcv/xmt command)
* 7 receive broadcasts
*/
#define NOTXcmd 0x01 /* disable transmitter */
#define NORXcmd 0x02 /* disable receiver */
#define TXcmd 0x03 /* enable transmitter */
#define RXcmd 0x04 /* enable receiver */
#define CONFIGcmd 0x05 /* define configuration */
#define CFLAGScmd 0x06 /* clear flags */
#define TESTcmd 0x07 /* load test flags */
/* flags for "clear flags" command */
#define RESETclear 0x08 /* power-on-reset */
#define CONFIGclear 0x10 /* system reconfigured */
#define EXCNAKclear 0x0E /* Clear and acknowledge the excive nak bit */
/* flags for "load test flags" command */
#define TESTload 0x08 /* test flag (diagnostic) */
/* byte deposited into first address of buffers on reset */
#define TESTvalue 0321 /* that's octal for 0xD1 :) */
/* for "enable receiver" command */
#define RXbcasts 0x80 /* receive broadcasts */
/* flags for "define configuration" command */
#define NORMALconf 0x00 /* 1-249 byte packets */
#define EXTconf 0x08 /* 250-504 byte packets */
/* card feature flags, set during auto-detection.
* (currently only used by com20020pci)
*/
#define ARC_IS_5MBIT 1 /* card default speed is 5MBit */
#define ARC_CAN_10MBIT 2 /* card uses COM20022, supporting 10MBit,
but default is 2.5MBit. */
/* information needed to define an encapsulation driver */
struct ArcProto {
char suffix; /* a for RFC1201, e for ether-encap, etc. */
int mtu; /* largest possible packet */
int is_ip; /* This is a ip plugin - not a raw thing */
void (*rx) (struct net_device * dev, int bufnum,
struct archdr * pkthdr, int length);
int (*build_header) (struct sk_buff * skb, struct net_device *dev,
unsigned short ethproto, uint8_t daddr);
/* these functions return '1' if the skb can now be freed */
int (*prepare_tx) (struct net_device * dev, struct archdr * pkt, int length,
int bufnum);
int (*continue_tx) (struct net_device * dev, int bufnum);
int (*ack_tx) (struct net_device * dev, int acked);
};
extern struct ArcProto *arc_proto_map[256], *arc_proto_default,
*arc_bcast_proto, *arc_raw_proto;
extern struct ArcProto arc_proto_null;
/*
* "Incoming" is information needed for each address that could be sending
* to us. Mostly for partially-received split packets.
*/
struct Incoming {
struct sk_buff *skb; /* packet data buffer */
uint16_t sequence; /* sequence number of assembly */
uint8_t lastpacket, /* number of last packet (from 1) */
numpackets; /* number of packets in split */
};
/* only needed for RFC1201 */
struct Outgoing {
struct ArcProto *proto; /* protocol driver that owns this:
* if NULL, no packet is pending.
*/
struct sk_buff *skb; /* buffer from upper levels */
struct archdr *pkt; /* a pointer into the skb */
uint16_t length, /* bytes total */
dataleft, /* bytes left */
segnum, /* segment being sent */
numsegs; /* number of segments */
};
struct arcnet_local {
struct net_device_stats stats;
uint8_t config, /* current value of CONFIG register */
timeout, /* Extended timeout for COM20020 */
backplane, /* Backplane flag for COM20020 */
clockp, /* COM20020 clock divider */
clockm, /* COM20020 clock multiplier flag */
setup, /* Contents of setup1 register */
setup2, /* Contents of setup2 register */
intmask; /* current value of INTMASK register */
uint8_t default_proto[256]; /* default encap to use for each host */
int cur_tx, /* buffer used by current transmit, or -1 */
next_tx, /* buffer where a packet is ready to send */
cur_rx; /* current receive buffer */
int lastload_dest, /* can last loaded packet be acked? */
lasttrans_dest; /* can last TX'd packet be acked? */
int timed_out; /* need to process TX timeout and drop packet */
unsigned long last_timeout; /* time of last reported timeout */
char *card_name; /* card ident string */
int card_flags; /* special card features */
/* On preemtive and SMB a lock is needed */
spinlock_t lock;
/*
* Buffer management: an ARCnet card has 4 x 512-byte buffers, each of
* which can be used for either sending or receiving. The new dynamic
* buffer management routines use a simple circular queue of available
* buffers, and take them as they're needed. This way, we simplify
* situations in which we (for example) want to pre-load a transmit
* buffer, or start receiving while we copy a received packet to
* memory.
*
* The rules: only the interrupt handler is allowed to _add_ buffers to
* the queue; thus, this doesn't require a lock. Both the interrupt
* handler and the transmit function will want to _remove_ buffers, so
* we need to handle the situation where they try to do it at the same
* time.
*
* If next_buf == first_free_buf, the queue is empty. Since there are
* only four possible buffers, the queue should never be full.
*/
atomic_t buf_lock;
int buf_queue[5];
int next_buf, first_free_buf;
/* network "reconfiguration" handling */
time_t first_recon, /* time of "first" RECON message to count */
last_recon; /* time of most recent RECON */
int num_recons; /* number of RECONs between first and last. */
bool network_down; /* do we think the network is down? */
bool excnak_pending; /* We just got an excesive nak interrupt */
struct {
uint16_t sequence; /* sequence number (incs with each packet) */
uint16_t aborted_seq;
struct Incoming incoming[256]; /* one from each address */
} rfc1201;
/* really only used by rfc1201, but we'll pretend it's not */
struct Outgoing outgoing; /* packet currently being sent */
/* hardware-specific functions */
struct {
struct module *owner;
void (*command) (struct net_device * dev, int cmd);
int (*status) (struct net_device * dev);
void (*intmask) (struct net_device * dev, int mask);
bool (*reset) (struct net_device * dev, bool really_reset);
void (*open) (struct net_device * dev);
void (*close) (struct net_device * dev);
void (*copy_to_card) (struct net_device * dev, int bufnum, int offset,
void *buf, int count);
void (*copy_from_card) (struct net_device * dev, int bufnum, int offset,
void *buf, int count);
} hw;
void __iomem *mem_start; /* pointer to ioremap'ed MMIO */
};
#define ARCRESET(x) (lp->hw.reset(dev, (x)))
#define ACOMMAND(x) (lp->hw.command(dev, (x)))
#define ASTATUS() (lp->hw.status(dev))
#define AINTMASK(x) (lp->hw.intmask(dev, (x)))
#if ARCNET_DEBUG_MAX & D_SKB
void arcnet_dump_skb(struct net_device *dev, struct sk_buff *skb, char *desc);
#else
#define arcnet_dump_skb(dev,skb,desc) ;
#endif
#if (ARCNET_DEBUG_MAX & D_RX) || (ARCNET_DEBUG_MAX & D_TX)
void arcnet_dump_packet(struct net_device *dev, int bufnum, char *desc,
int take_arcnet_lock);
#else
#define arcnet_dump_packet(dev, bufnum, desc,take_arcnet_lock) ;
#endif
void arcnet_unregister_proto(struct ArcProto *proto);
irqreturn_t arcnet_interrupt(int irq, void *dev_id, struct pt_regs *regs);
struct net_device *alloc_arcdev(char *name);
void arcnet_rx(struct net_device *dev, int bufnum);
#endif /* __KERNEL__ */
#endif /* _LINUX_ARCDEVICE_H */

268
include/linux/ata.h Normal file
View File

@@ -0,0 +1,268 @@
/*
Copyright 2003-2004 Red Hat, Inc. All rights reserved.
Copyright 2003-2004 Jeff Garzik
The contents of this file are subject to the Open
Software License version 1.1 that can be found at
http://www.opensource.org/licenses/osl-1.1.txt and is included herein
by reference.
Alternatively, the contents of this file may be used under the terms
of the GNU General Public License version 2 (the "GPL") as distributed
in the kernel source COPYING file, in which case the provisions of
the GPL are applicable instead of the above. If you wish to allow
the use of your version of this file only under the terms of the
GPL and not to allow others to use your version of this file under
the OSL, indicate your decision by deleting the provisions above and
replace them with the notice and other provisions required by the GPL.
If you do not delete the provisions above, a recipient may use your
version of this file under either the OSL or the GPL.
*/
#ifndef __LINUX_ATA_H__
#define __LINUX_ATA_H__
#include <linux/types.h>
/* defines only for the constants which don't work well as enums */
#define ATA_DMA_BOUNDARY 0xffffUL
#define ATA_DMA_MASK 0xffffffffULL
enum {
/* various global constants */
ATA_MAX_DEVICES = 2, /* per bus/port */
ATA_MAX_PRD = 256, /* we could make these 256/256 */
ATA_SECT_SIZE = 512,
ATA_ID_WORDS = 256,
ATA_ID_PROD_OFS = 27,
ATA_ID_FW_REV_OFS = 23,
ATA_ID_SERNO_OFS = 10,
ATA_ID_MAJOR_VER = 80,
ATA_ID_PIO_MODES = 64,
ATA_ID_MWDMA_MODES = 63,
ATA_ID_UDMA_MODES = 88,
ATA_ID_PIO4 = (1 << 1),
ATA_PCI_CTL_OFS = 2,
ATA_SERNO_LEN = 20,
ATA_UDMA0 = (1 << 0),
ATA_UDMA1 = ATA_UDMA0 | (1 << 1),
ATA_UDMA2 = ATA_UDMA1 | (1 << 2),
ATA_UDMA3 = ATA_UDMA2 | (1 << 3),
ATA_UDMA4 = ATA_UDMA3 | (1 << 4),
ATA_UDMA5 = ATA_UDMA4 | (1 << 5),
ATA_UDMA6 = ATA_UDMA5 | (1 << 6),
ATA_UDMA7 = ATA_UDMA6 | (1 << 7),
/* ATA_UDMA7 is just for completeness... doesn't exist (yet?). */
ATA_UDMA_MASK_40C = ATA_UDMA2, /* udma0-2 */
/* DMA-related */
ATA_PRD_SZ = 8,
ATA_PRD_TBL_SZ = (ATA_MAX_PRD * ATA_PRD_SZ),
ATA_PRD_EOT = (1 << 31), /* end-of-table flag */
ATA_DMA_TABLE_OFS = 4,
ATA_DMA_STATUS = 2,
ATA_DMA_CMD = 0,
ATA_DMA_WR = (1 << 3),
ATA_DMA_START = (1 << 0),
ATA_DMA_INTR = (1 << 2),
ATA_DMA_ERR = (1 << 1),
ATA_DMA_ACTIVE = (1 << 0),
/* bits in ATA command block registers */
ATA_HOB = (1 << 7), /* LBA48 selector */
ATA_NIEN = (1 << 1), /* disable-irq flag */
ATA_LBA = (1 << 6), /* LBA28 selector */
ATA_DEV1 = (1 << 4), /* Select Device 1 (slave) */
ATA_DEVICE_OBS = (1 << 7) | (1 << 5), /* obs bits in dev reg */
ATA_DEVCTL_OBS = (1 << 3), /* obsolete bit in devctl reg */
ATA_BUSY = (1 << 7), /* BSY status bit */
ATA_DRDY = (1 << 6), /* device ready */
ATA_DF = (1 << 5), /* device fault */
ATA_DRQ = (1 << 3), /* data request i/o */
ATA_ERR = (1 << 0), /* have an error */
ATA_SRST = (1 << 2), /* software reset */
ATA_ABORTED = (1 << 2), /* command aborted */
/* ATA command block registers */
ATA_REG_DATA = 0x00,
ATA_REG_ERR = 0x01,
ATA_REG_NSECT = 0x02,
ATA_REG_LBAL = 0x03,
ATA_REG_LBAM = 0x04,
ATA_REG_LBAH = 0x05,
ATA_REG_DEVICE = 0x06,
ATA_REG_STATUS = 0x07,
ATA_REG_FEATURE = ATA_REG_ERR, /* and their aliases */
ATA_REG_CMD = ATA_REG_STATUS,
ATA_REG_BYTEL = ATA_REG_LBAM,
ATA_REG_BYTEH = ATA_REG_LBAH,
ATA_REG_DEVSEL = ATA_REG_DEVICE,
ATA_REG_IRQ = ATA_REG_NSECT,
/* ATA device commands */
ATA_CMD_CHK_POWER = 0xE5, /* check power mode */
ATA_CMD_EDD = 0x90, /* execute device diagnostic */
ATA_CMD_FLUSH = 0xE7,
ATA_CMD_FLUSH_EXT = 0xEA,
ATA_CMD_ID_ATA = 0xEC,
ATA_CMD_ID_ATAPI = 0xA1,
ATA_CMD_READ = 0xC8,
ATA_CMD_READ_EXT = 0x25,
ATA_CMD_WRITE = 0xCA,
ATA_CMD_WRITE_EXT = 0x35,
ATA_CMD_PIO_READ = 0x20,
ATA_CMD_PIO_READ_EXT = 0x24,
ATA_CMD_PIO_WRITE = 0x30,
ATA_CMD_PIO_WRITE_EXT = 0x34,
ATA_CMD_SET_FEATURES = 0xEF,
ATA_CMD_PACKET = 0xA0,
ATA_CMD_VERIFY = 0x40,
ATA_CMD_VERIFY_EXT = 0x42,
/* SETFEATURES stuff */
SETFEATURES_XFER = 0x03,
XFER_UDMA_7 = 0x47,
XFER_UDMA_6 = 0x46,
XFER_UDMA_5 = 0x45,
XFER_UDMA_4 = 0x44,
XFER_UDMA_3 = 0x43,
XFER_UDMA_2 = 0x42,
XFER_UDMA_1 = 0x41,
XFER_UDMA_0 = 0x40,
XFER_MW_DMA_2 = 0x22,
XFER_MW_DMA_1 = 0x21,
XFER_MW_DMA_0 = 0x20,
XFER_PIO_4 = 0x0C,
XFER_PIO_3 = 0x0B,
XFER_PIO_2 = 0x0A,
XFER_PIO_1 = 0x09,
XFER_PIO_0 = 0x08,
XFER_SW_DMA_2 = 0x12,
XFER_SW_DMA_1 = 0x11,
XFER_SW_DMA_0 = 0x10,
XFER_PIO_SLOW = 0x00,
/* ATAPI stuff */
ATAPI_PKT_DMA = (1 << 0),
ATAPI_DMADIR = (1 << 2), /* ATAPI data dir:
0=to device, 1=to host */
ATAPI_CDB_LEN = 16,
/* cable types */
ATA_CBL_NONE = 0,
ATA_CBL_PATA40 = 1,
ATA_CBL_PATA80 = 2,
ATA_CBL_PATA_UNK = 3,
ATA_CBL_SATA = 4,
/* SATA Status and Control Registers */
SCR_STATUS = 0,
SCR_ERROR = 1,
SCR_CONTROL = 2,
SCR_ACTIVE = 3,
SCR_NOTIFICATION = 4,
/* struct ata_taskfile flags */
ATA_TFLAG_LBA48 = (1 << 0), /* enable 48-bit LBA and "HOB" */
ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */
ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */
ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */
};
enum ata_tf_protocols {
/* ATA taskfile protocols */
ATA_PROT_UNKNOWN, /* unknown/invalid */
ATA_PROT_NODATA, /* no data */
ATA_PROT_PIO, /* PIO single sector */
ATA_PROT_PIO_MULT, /* PIO multiple sector */
ATA_PROT_DMA, /* DMA */
ATA_PROT_ATAPI, /* packet command, PIO data xfer*/
ATA_PROT_ATAPI_NODATA, /* packet command, no data */
ATA_PROT_ATAPI_DMA, /* packet command with special DMA sauce */
};
enum ata_ioctls {
ATA_IOC_GET_IO32 = 0x309,
ATA_IOC_SET_IO32 = 0x324,
};
/* core structures */
struct ata_prd {
u32 addr;
u32 flags_len;
};
struct ata_taskfile {
unsigned long flags; /* ATA_TFLAG_xxx */
u8 protocol; /* ATA_PROT_xxx */
u8 ctl; /* control reg */
u8 hob_feature; /* additional data */
u8 hob_nsect; /* to support LBA48 */
u8 hob_lbal;
u8 hob_lbam;
u8 hob_lbah;
u8 feature;
u8 nsect;
u8 lbal;
u8 lbam;
u8 lbah;
u8 device;
u8 command; /* IO operation */
};
#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0)
#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6))
#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5))
#define ata_id_has_flush(id) ((id)[83] & (1 << 12))
#define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13))
#define ata_id_has_lba48(id) ((id)[83] & (1 << 10))
#define ata_id_has_wcache(id) ((id)[82] & (1 << 5))
#define ata_id_has_pm(id) ((id)[82] & (1 << 3))
#define ata_id_has_lba(id) ((id)[49] & (1 << 9))
#define ata_id_has_dma(id) ((id)[49] & (1 << 8))
#define ata_id_removeable(id) ((id)[0] & (1 << 7))
#define ata_id_u32(id,n) \
(((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)]))
#define ata_id_u64(id,n) \
( ((u64) (id)[(n) + 3] << 48) | \
((u64) (id)[(n) + 2] << 32) | \
((u64) (id)[(n) + 1] << 16) | \
((u64) (id)[(n) + 0]) )
static inline int atapi_cdb_len(u16 *dev_id)
{
u16 tmp = dev_id[0] & 0x3;
switch (tmp) {
case 0: return 12;
case 1: return 16;
default: return -1;
}
}
static inline int is_atapi_taskfile(struct ata_taskfile *tf)
{
return (tf->protocol == ATA_PROT_ATAPI) ||
(tf->protocol == ATA_PROT_ATAPI_NODATA) ||
(tf->protocol == ATA_PROT_ATAPI_DMA);
}
static inline int ata_ok(u8 status)
{
return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR))
== ATA_DRDY);
}
#endif /* __LINUX_ATA_H__ */

245
include/linux/atalk.h Normal file
View File

@@ -0,0 +1,245 @@
#ifndef __LINUX_ATALK_H__
#define __LINUX_ATALK_H__
#include <net/sock.h>
/*
* AppleTalk networking structures
*
* The following are directly referenced from the University Of Michigan
* netatalk for compatibility reasons.
*/
#define ATPORT_FIRST 1
#define ATPORT_RESERVED 128
#define ATPORT_LAST 254 /* 254 is only legal on localtalk */
#define ATADDR_ANYNET (__u16)0
#define ATADDR_ANYNODE (__u8)0
#define ATADDR_ANYPORT (__u8)0
#define ATADDR_BCAST (__u8)255
#define DDP_MAXSZ 587
#define DDP_MAXHOPS 15 /* 4 bits of hop counter */
#define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0)
struct atalk_addr {
__u16 s_net;
__u8 s_node;
};
struct sockaddr_at {
sa_family_t sat_family;
__u8 sat_port;
struct atalk_addr sat_addr;
char sat_zero[8];
};
struct atalk_netrange {
__u8 nr_phase;
__u16 nr_firstnet;
__u16 nr_lastnet;
};
struct atalk_route {
struct net_device *dev;
struct atalk_addr target;
struct atalk_addr gateway;
int flags;
struct atalk_route *next;
};
/**
* struct atalk_iface - AppleTalk Interface
* @dev - Network device associated with this interface
* @address - Our address
* @status - What are we doing?
* @nets - Associated direct netrange
* @next - next element in the list of interfaces
*/
struct atalk_iface {
struct net_device *dev;
struct atalk_addr address;
int status;
#define ATIF_PROBE 1 /* Probing for an address */
#define ATIF_PROBE_FAIL 2 /* Probe collided */
struct atalk_netrange nets;
struct atalk_iface *next;
};
struct atalk_sock {
/* struct sock has to be the first member of atalk_sock */
struct sock sk;
unsigned short dest_net;
unsigned short src_net;
unsigned char dest_node;
unsigned char src_node;
unsigned char dest_port;
unsigned char src_port;
};
static inline struct atalk_sock *at_sk(struct sock *sk)
{
return (struct atalk_sock *)sk;
}
#ifdef __KERNEL__
#include <asm/byteorder.h>
struct ddpehdr {
#ifdef __LITTLE_ENDIAN_BITFIELD
__u16 deh_len:10,
deh_hops:4,
deh_pad:2;
#else
__u16 deh_pad:2,
deh_hops:4,
deh_len:10;
#endif
__u16 deh_sum;
__u16 deh_dnet;
__u16 deh_snet;
__u8 deh_dnode;
__u8 deh_snode;
__u8 deh_dport;
__u8 deh_sport;
/* And netatalk apps expect to stick the type in themselves */
};
static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb)
{
return (struct ddpehdr *)skb->h.raw;
}
/*
* Don't drop the struct into the struct above. You'll get some
* surprise padding.
*/
struct ddpebits {
#ifdef __LITTLE_ENDIAN_BITFIELD
__u16 deh_len:10,
deh_hops:4,
deh_pad:2;
#else
__u16 deh_pad:2,
deh_hops:4,
deh_len:10;
#endif
};
/* Short form header */
struct ddpshdr {
#ifdef __LITTLE_ENDIAN_BITFIELD
__u16 dsh_len:10,
dsh_pad:6;
#else
__u16 dsh_pad:6,
dsh_len:10;
#endif
__u8 dsh_dport;
__u8 dsh_sport;
/* And netatalk apps expect to stick the type in themselves */
};
/* AppleTalk AARP headers */
struct elapaarp {
__u16 hw_type;
#define AARP_HW_TYPE_ETHERNET 1
#define AARP_HW_TYPE_TOKENRING 2
__u16 pa_type;
__u8 hw_len;
__u8 pa_len;
#define AARP_PA_ALEN 4
__u16 function;
#define AARP_REQUEST 1
#define AARP_REPLY 2
#define AARP_PROBE 3
__u8 hw_src[ETH_ALEN] __attribute__ ((packed));
__u8 pa_src_zero __attribute__ ((packed));
__u16 pa_src_net __attribute__ ((packed));
__u8 pa_src_node __attribute__ ((packed));
__u8 hw_dst[ETH_ALEN] __attribute__ ((packed));
__u8 pa_dst_zero __attribute__ ((packed));
__u16 pa_dst_net __attribute__ ((packed));
__u8 pa_dst_node __attribute__ ((packed));
};
static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb)
{
return (struct elapaarp *)skb->h.raw;
}
/* Not specified - how long till we drop a resolved entry */
#define AARP_EXPIRY_TIME (5 * 60 * HZ)
/* Size of hash table */
#define AARP_HASH_SIZE 16
/* Fast retransmission timer when resolving */
#define AARP_TICK_TIME (HZ / 5)
/* Send 10 requests then give up (2 seconds) */
#define AARP_RETRANSMIT_LIMIT 10
/*
* Some value bigger than total retransmit time + a bit for last reply to
* appear and to stop continual requests
*/
#define AARP_RESOLVE_TIME (10 * HZ)
extern struct datalink_proto *ddp_dl, *aarp_dl;
extern void aarp_proto_init(void);
/* Inter module exports */
/* Give a device find its atif control structure */
static inline struct atalk_iface *atalk_find_dev(struct net_device *dev)
{
return dev->atalk_ptr;
}
extern struct atalk_addr *atalk_find_dev_addr(struct net_device *dev);
extern struct net_device *atrtr_get_dev(struct atalk_addr *sa);
extern int aarp_send_ddp(struct net_device *dev,
struct sk_buff *skb,
struct atalk_addr *sa, void *hwaddr);
extern void aarp_device_down(struct net_device *dev);
extern void aarp_probe_network(struct atalk_iface *atif);
extern int aarp_proxy_probe_network(struct atalk_iface *atif,
struct atalk_addr *sa);
extern void aarp_proxy_remove(struct net_device *dev,
struct atalk_addr *sa);
extern void aarp_cleanup_module(void);
extern struct hlist_head atalk_sockets;
extern rwlock_t atalk_sockets_lock;
extern struct atalk_route *atalk_routes;
extern rwlock_t atalk_routes_lock;
extern struct atalk_iface *atalk_interfaces;
extern rwlock_t atalk_interfaces_lock;
extern struct atalk_route atrtr_default;
extern struct file_operations atalk_seq_arp_fops;
extern int sysctl_aarp_expiry_time;
extern int sysctl_aarp_tick_time;
extern int sysctl_aarp_retransmit_limit;
extern int sysctl_aarp_resolve_time;
#ifdef CONFIG_SYSCTL
extern void atalk_register_sysctl(void);
extern void atalk_unregister_sysctl(void);
#else
#define atalk_register_sysctl() do { } while(0)
#define atalk_unregister_sysctl() do { } while(0)
#endif
#ifdef CONFIG_PROC_FS
extern int atalk_proc_init(void);
extern void atalk_proc_exit(void);
#else
#define atalk_proc_init() ({ 0; })
#define atalk_proc_exit() do { } while(0)
#endif /* CONFIG_PROC_FS */
#endif /* __KERNEL__ */
#endif /* __LINUX_ATALK_H__ */

243
include/linux/atm.h Normal file
View File

@@ -0,0 +1,243 @@
/* atm.h - general ATM declarations */
/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
/*
* WARNING: User-space programs should not #include <linux/atm.h> directly.
* Instead, #include <atm.h>
*/
#ifndef _LINUX_ATM_H
#define _LINUX_ATM_H
/*
* BEGIN_xx and END_xx markers are used for automatic generation of
* documentation. Do not change them.
*/
#ifdef __KERNEL__
#include <linux/socket.h>
#include <linux/types.h>
#endif
#include <linux/compiler.h>
#include <linux/atmapi.h>
#include <linux/atmsap.h>
#include <linux/atmioc.h>
/* general ATM constants */
#define ATM_CELL_SIZE 53 /* ATM cell size incl. header */
#define ATM_CELL_PAYLOAD 48 /* ATM payload size */
#define ATM_AAL0_SDU 52 /* AAL0 SDU size */
#define ATM_MAX_AAL34_PDU 65535 /* maximum AAL3/4 PDU payload */
#define ATM_AAL5_TRAILER 8 /* AAL5 trailer size */
#define ATM_MAX_AAL5_PDU 65535 /* maximum AAL5 PDU payload */
#define ATM_MAX_CDV 9999 /* maximum (default) CDV */
#define ATM_NOT_RSV_VCI 32 /* first non-reserved VCI value */
#define ATM_MAX_VPI 255 /* maximum VPI at the UNI */
#define ATM_MAX_VPI_NNI 4096 /* maximum VPI at the NNI */
#define ATM_MAX_VCI 65535 /* maximum VCI */
/* "protcol" values for the socket system call */
#define ATM_NO_AAL 0 /* AAL not specified */
#define ATM_AAL0 13 /* "raw" ATM cells */
#define ATM_AAL1 1 /* AAL1 (CBR) */
#define ATM_AAL2 2 /* AAL2 (VBR) */
#define ATM_AAL34 3 /* AAL3/4 (data) */
#define ATM_AAL5 5 /* AAL5 (data) */
/*
* socket option name coding functions
*
* Note that __SO_ENCODE and __SO_LEVEL are somewhat a hack since the
* << 22 only reserves 9 bits for the level. On some architectures
* SOL_SOCKET is 0xFFFF, so that's a bit of a problem
*/
#define __SO_ENCODE(l,n,t) ((((l) & 0x1FF) << 22) | ((n) << 16) | \
sizeof(t))
#define __SO_LEVEL_MATCH(c,m) (((c) >> 22) == ((m) & 0x1FF))
#define __SO_NUMBER(c) (((c) >> 16) & 0x3f)
#define __SO_SIZE(c) ((c) & 0x3fff)
/*
* ATM layer
*/
#define SO_SETCLP __SO_ENCODE(SOL_ATM,0,int)
/* set CLP bit value - TODO */
#define SO_CIRANGE __SO_ENCODE(SOL_ATM,1,struct atm_cirange)
/* connection identifier range; socket must be
bound or connected */
#define SO_ATMQOS __SO_ENCODE(SOL_ATM,2,struct atm_qos)
/* Quality of Service setting */
#define SO_ATMSAP __SO_ENCODE(SOL_ATM,3,struct atm_sap)
/* Service Access Point */
#define SO_ATMPVC __SO_ENCODE(SOL_ATM,4,struct sockaddr_atmpvc)
/* "PVC" address (also for SVCs); get only */
#define SO_MULTIPOINT __SO_ENCODE(SOL_ATM, 5, int)
/* make this vc a p2mp */
/*
* Note @@@: since the socket layers don't really distinguish the control and
* the data plane but generally seems to be data plane-centric, any layer is
* about equally wrong for the SAP. If you have a better idea about this,
* please speak up ...
*/
/* ATM cell header (for AAL0) */
/* BEGIN_CH */
#define ATM_HDR_GFC_MASK 0xf0000000
#define ATM_HDR_GFC_SHIFT 28
#define ATM_HDR_VPI_MASK 0x0ff00000
#define ATM_HDR_VPI_SHIFT 20
#define ATM_HDR_VCI_MASK 0x000ffff0
#define ATM_HDR_VCI_SHIFT 4
#define ATM_HDR_PTI_MASK 0x0000000e
#define ATM_HDR_PTI_SHIFT 1
#define ATM_HDR_CLP 0x00000001
/* END_CH */
/* PTI codings */
/* BEGIN_PTI */
#define ATM_PTI_US0 0 /* user data cell, congestion not exp, SDU-type 0 */
#define ATM_PTI_US1 1 /* user data cell, congestion not exp, SDU-type 1 */
#define ATM_PTI_UCES0 2 /* user data cell, cong. experienced, SDU-type 0 */
#define ATM_PTI_UCES1 3 /* user data cell, cong. experienced, SDU-type 1 */
#define ATM_PTI_SEGF5 4 /* segment OAM F5 flow related cell */
#define ATM_PTI_E2EF5 5 /* end-to-end OAM F5 flow related cell */
#define ATM_PTI_RSV_RM 6 /* reserved for traffic control/resource mgmt */
#define ATM_PTI_RSV 7 /* reserved */
/* END_PTI */
/*
* The following items should stay in linux/atm.h, which should be linked to
* netatm/atm.h
*/
/* Traffic description */
#define ATM_NONE 0 /* no traffic */
#define ATM_UBR 1
#define ATM_CBR 2
#define ATM_VBR 3
#define ATM_ABR 4
#define ATM_ANYCLASS 5 /* compatible with everything */
#define ATM_MAX_PCR -1 /* maximum available PCR */
struct atm_trafprm {
unsigned char traffic_class; /* traffic class (ATM_UBR, ...) */
int max_pcr; /* maximum PCR in cells per second */
int pcr; /* desired PCR in cells per second */
int min_pcr; /* minimum PCR in cells per second */
int max_cdv; /* maximum CDV in microseconds */
int max_sdu; /* maximum SDU in bytes */
/* extra params for ABR */
unsigned int icr; /* Initial Cell Rate (24-bit) */
unsigned int tbe; /* Transient Buffer Exposure (24-bit) */
unsigned int frtt : 24; /* Fixed Round Trip Time (24-bit) */
unsigned int rif : 4; /* Rate Increment Factor (4-bit) */
unsigned int rdf : 4; /* Rate Decrease Factor (4-bit) */
unsigned int nrm_pres :1; /* nrm present bit */
unsigned int trm_pres :1; /* rm present bit */
unsigned int adtf_pres :1; /* adtf present bit */
unsigned int cdf_pres :1; /* cdf present bit*/
unsigned int nrm :3; /* Max # of Cells for each forward RM cell (3-bit) */
unsigned int trm :3; /* Time between forward RM cells (3-bit) */
unsigned int adtf :10; /* ACR Decrease Time Factor (10-bit) */
unsigned int cdf :3; /* Cutoff Decrease Factor (3-bit) */
unsigned int spare :9; /* spare bits */
};
struct atm_qos {
struct atm_trafprm txtp; /* parameters in TX direction */
struct atm_trafprm rxtp __ATM_API_ALIGN;
/* parameters in RX direction */
unsigned char aal __ATM_API_ALIGN;
};
/* PVC addressing */
#define ATM_ITF_ANY -1 /* "magic" PVC address values */
#define ATM_VPI_ANY -1
#define ATM_VCI_ANY -1
#define ATM_VPI_UNSPEC -2
#define ATM_VCI_UNSPEC -2
struct sockaddr_atmpvc {
unsigned short sap_family; /* address family, AF_ATMPVC */
struct { /* PVC address */
short itf; /* ATM interface */
short vpi; /* VPI (only 8 bits at UNI) */
int vci; /* VCI (only 16 bits at UNI) */
} sap_addr __ATM_API_ALIGN; /* PVC address */
};
/* SVC addressing */
#define ATM_ESA_LEN 20 /* ATM End System Address length */
#define ATM_E164_LEN 12 /* maximum E.164 number length */
#define ATM_AFI_DCC 0x39 /* DCC ATM Format */
#define ATM_AFI_ICD 0x47 /* ICD ATM Format */
#define ATM_AFI_E164 0x45 /* E.164 ATM Format */
#define ATM_AFI_LOCAL 0x49 /* Local ATM Format */
#define ATM_AFI_DCC_GROUP 0xBD /* DCC ATM Group Format */
#define ATM_AFI_ICD_GROUP 0xC5 /* ICD ATM Group Format */
#define ATM_AFI_E164_GROUP 0xC3 /* E.164 ATM Group Format */
#define ATM_AFI_LOCAL_GROUP 0xC7 /* Local ATM Group Format */
#define ATM_LIJ_NONE 0 /* no leaf-initiated join */
#define ATM_LIJ 1 /* request joining */
#define ATM_LIJ_RPJ 2 /* set to root-prompted join */
#define ATM_LIJ_NJ 3 /* set to network join */
struct sockaddr_atmsvc {
unsigned short sas_family; /* address family, AF_ATMSVC */
struct { /* SVC address */
unsigned char prv[ATM_ESA_LEN];/* private ATM address */
char pub[ATM_E164_LEN+1]; /* public address (E.164) */
/* unused addresses must be bzero'ed */
char lij_type; /* role in LIJ call; one of ATM_LIJ* */
uint32_t lij_id; /* LIJ call identifier */
} sas_addr __ATM_API_ALIGN; /* SVC address */
};
static __inline__ int atmsvc_addr_in_use(struct sockaddr_atmsvc addr)
{
return *addr.sas_addr.prv || *addr.sas_addr.pub;
}
static __inline__ int atmpvc_addr_in_use(struct sockaddr_atmpvc addr)
{
return addr.sap_addr.itf || addr.sap_addr.vpi || addr.sap_addr.vci;
}
/*
* Some stuff for linux/sockios.h
*/
struct atmif_sioc {
int number;
int length;
void __user *arg;
};
typedef unsigned short atm_backend_t;
#endif

23
include/linux/atm_eni.h Normal file
View File

@@ -0,0 +1,23 @@
/* atm_eni.h - Driver-specific declarations of the ENI driver (for use by
driver-specific utilities) */
/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
#ifndef LINUX_ATM_ENI_H
#define LINUX_ATM_ENI_H
#include <linux/atmioc.h>
struct eni_multipliers {
int tx,rx; /* values are in percent and must be > 100 */
};
#define ENI_MEMDUMP _IOW('a',ATMIOC_SARPRV,struct atmif_sioc)
/* printk memory map */
#define ENI_SETMULT _IOW('a',ATMIOC_SARPRV+7,struct atmif_sioc)
/* set buffer multipliers */
#endif

20
include/linux/atm_he.h Normal file
View File

@@ -0,0 +1,20 @@
/* atm_he.h */
#ifndef LINUX_ATM_HE_H
#define LINUX_ATM_HE_H
#include <linux/atmioc.h>
#define HE_GET_REG _IOW('a', ATMIOC_SARPRV, struct atmif_sioc)
#define HE_REGTYPE_PCI 1
#define HE_REGTYPE_RCM 2
#define HE_REGTYPE_TCM 3
#define HE_REGTYPE_MBOX 4
struct he_ioctl_reg {
unsigned addr, val;
char type;
};
#endif /* LINUX_ATM_HE_H */

View File

@@ -0,0 +1,28 @@
/* atm_idt77105.h - Driver-specific declarations of the IDT77105 driver (for
* use by driver-specific utilities) */
/* Written 1999 by Greg Banks <gnb@linuxfan.com>. Copied from atm_suni.h. */
#ifndef LINUX_ATM_IDT77105_H
#define LINUX_ATM_IDT77105_H
#include <asm/types.h>
#include <linux/atmioc.h>
#include <linux/atmdev.h>
/*
* Structure for IDT77105_GETSTAT and IDT77105_GETSTATZ ioctls.
* Pointed to by `arg' in atmif_sioc.
*/
struct idt77105_stats {
__u32 symbol_errors; /* wire symbol errors */
__u32 tx_cells; /* cells transmitted */
__u32 rx_cells; /* cells received */
__u32 rx_hec_errors; /* Header Error Check errors on receive */
};
#define IDT77105_GETSTAT _IOW('a',ATMIOC_PHYPRV+2,struct atmif_sioc) /* get stats */
#define IDT77105_GETSTATZ _IOW('a',ATMIOC_PHYPRV+3,struct atmif_sioc) /* get stats and zero */
#endif

View File

@@ -0,0 +1,53 @@
/******************************************************************************
*
* atm_nicstar.h
*
* Driver-specific declarations for use by NICSTAR driver specific utils.
*
* Author: Rui Prior
*
* (C) INESC 1998
*
******************************************************************************/
#ifndef LINUX_ATM_NICSTAR_H
#define LINUX_ATM_NICSTAR_H
/* Note: non-kernel programs including this file must also include
* sys/types.h for struct timeval
*/
#include <linux/atmapi.h>
#include <linux/atmioc.h>
#define NS_GETPSTAT _IOWR('a',ATMIOC_SARPRV+1,struct atmif_sioc)
/* get pool statistics */
#define NS_SETBUFLEV _IOW('a',ATMIOC_SARPRV+2,struct atmif_sioc)
/* set buffer level markers */
#define NS_ADJBUFLEV _IO('a',ATMIOC_SARPRV+3)
/* adjust buffer level */
typedef struct buf_nr
{
unsigned min;
unsigned init;
unsigned max;
}buf_nr;
typedef struct pool_levels
{
int buftype;
int count; /* (At least for now) only used in NS_GETPSTAT */
buf_nr level;
} pool_levels;
/* type must be one of the following: */
#define NS_BUFTYPE_SMALL 1
#define NS_BUFTYPE_LARGE 2
#define NS_BUFTYPE_HUGE 3
#define NS_BUFTYPE_IOVEC 4
#endif /* LINUX_ATM_NICSTAR_H */

12
include/linux/atm_suni.h Normal file
View File

@@ -0,0 +1,12 @@
/* atm_suni.h - Driver-specific declarations of the SUNI driver (for use by
driver-specific utilities) */
/* Written 1998,2000 by Werner Almesberger, EPFL ICA */
#ifndef LINUX_ATM_SUNI_H
#define LINUX_ATM_SUNI_H
/* everything obsoleted */
#endif

75
include/linux/atm_tcp.h Normal file
View File

@@ -0,0 +1,75 @@
/* atm_tcp.h - Driver-specific declarations of the ATMTCP driver (for use by
driver-specific utilities) */
/* Written 1997-2000 by Werner Almesberger, EPFL LRC/ICA */
#ifndef LINUX_ATM_TCP_H
#define LINUX_ATM_TCP_H
#include <linux/atmapi.h>
#ifdef __KERNEL__
#include <linux/types.h>
#endif
#include <linux/atmioc.h>
/*
* All values in struct atmtcp_hdr are in network byte order
*/
struct atmtcp_hdr {
uint16_t vpi;
uint16_t vci;
uint32_t length; /* ... of data part */
};
/*
* All values in struct atmtcp_command are in host byte order
*/
#define ATMTCP_HDR_MAGIC (~0) /* this length indicates a command */
#define ATMTCP_CTRL_OPEN 1 /* request/reply */
#define ATMTCP_CTRL_CLOSE 2 /* request/reply */
struct atmtcp_control {
struct atmtcp_hdr hdr; /* must be first */
int type; /* message type; both directions */
atm_kptr_t vcc; /* both directions */
struct sockaddr_atmpvc addr; /* suggested value from kernel */
struct atm_qos qos; /* both directions */
int result; /* to kernel only */
} __ATM_API_ALIGN;
/*
* Field usage:
* Messge type dir. hdr.v?i type addr qos vcc result
* ----------- ---- ------- ---- ---- --- --- ------
* OPEN K->D Y Y Y Y Y 0
* OPEN D->K - Y Y Y Y Y
* CLOSE K->D - - Y - Y 0
* CLOSE D->K - - - - Y Y
*/
#define SIOCSIFATMTCP _IO('a',ATMIOC_ITF) /* set ATMTCP mode */
#define ATMTCP_CREATE _IO('a',ATMIOC_ITF+14) /* create persistent ATMTCP
interface */
#define ATMTCP_REMOVE _IO('a',ATMIOC_ITF+15) /* destroy persistent ATMTCP
interface */
#ifdef __KERNEL__
struct atm_tcp_ops {
int (*attach)(struct atm_vcc *vcc,int itf);
int (*create_persistent)(int itf);
int (*remove_persistent)(int itf);
struct module *owner;
};
extern struct atm_tcp_ops atm_tcp_ops;
#endif
#endif

52
include/linux/atm_zatm.h Normal file
View File

@@ -0,0 +1,52 @@
/* atm_zatm.h - Driver-specific declarations of the ZATM driver (for use by
driver-specific utilities) */
/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */
#ifndef LINUX_ATM_ZATM_H
#define LINUX_ATM_ZATM_H
/*
* Note: non-kernel programs including this file must also include
* sys/types.h for struct timeval
*/
#include <linux/atmapi.h>
#include <linux/atmioc.h>
#define ZATM_GETPOOL _IOW('a',ATMIOC_SARPRV+1,struct atmif_sioc)
/* get pool statistics */
#define ZATM_GETPOOLZ _IOW('a',ATMIOC_SARPRV+2,struct atmif_sioc)
/* get statistics and zero */
#define ZATM_SETPOOL _IOW('a',ATMIOC_SARPRV+3,struct atmif_sioc)
/* set pool parameters */
struct zatm_pool_info {
int ref_count; /* free buffer pool usage counters */
int low_water,high_water; /* refill parameters */
int rqa_count,rqu_count; /* queue condition counters */
int offset,next_off; /* alignment optimizations: offset */
int next_cnt,next_thres; /* repetition counter and threshold */
};
struct zatm_pool_req {
int pool_num; /* pool number */
struct zatm_pool_info info; /* actual information */
};
struct zatm_t_hist {
struct timeval real; /* real (wall-clock) time */
struct timeval expected; /* expected real time */
};
#define ZATM_OAM_POOL 0 /* free buffer pool for OAM cells */
#define ZATM_AAL0_POOL 1 /* free buffer pool for AAL0 cells */
#define ZATM_AAL5_POOL_BASE 2 /* first AAL5 free buffer pool */
#define ZATM_LAST_POOL ZATM_AAL5_POOL_BASE+10 /* max. 64 kB */
#define ZATM_TIMER_HISTORY_SIZE 16 /* number of timer adjustments to
record; must be 2^n */
#endif

29
include/linux/atmapi.h Normal file
View File

@@ -0,0 +1,29 @@
/* atmapi.h - ATM API user space/kernel compatibility */
/* Written 1999,2000 by Werner Almesberger, EPFL ICA */
#ifndef _LINUX_ATMAPI_H
#define _LINUX_ATMAPI_H
#if defined(__sparc__) || defined(__ia64__)
/* such alignment is not required on 32 bit sparcs, but we can't
figure that we are on a sparc64 while compiling user-space programs. */
#define __ATM_API_ALIGN __attribute__((aligned(8)))
#else
#define __ATM_API_ALIGN
#endif
/*
* Opaque type for kernel pointers. Note that _ is never accessed. We need
* the struct in order hide the array, so that we can make simple assignments
* instead of being forced to use memcpy. It also improves error reporting for
* code that still assumes that we're passing unsigned longs.
*
* Convention: NULL pointers are passed as a field of all zeroes.
*/
typedef struct { unsigned char _[8]; } __ATM_API_ALIGN atm_kptr_t;
#endif

43
include/linux/atmarp.h Normal file
View File

@@ -0,0 +1,43 @@
/* atmarp.h - ATM ARP protocol and kernel-demon interface definitions */
/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */
#ifndef _LINUX_ATMARP_H
#define _LINUX_ATMARP_H
#ifdef __KERNEL__
#include <linux/types.h>
#endif
#include <linux/atmapi.h>
#include <linux/atmioc.h>
#define ATMARP_RETRY_DELAY 30 /* request next resolution or forget
NAK after 30 sec - should go into
atmclip.h */
#define ATMARP_MAX_UNRES_PACKETS 5 /* queue that many packets while
waiting for the resolver */
#define ATMARPD_CTRL _IO('a',ATMIOC_CLIP+1) /* become atmarpd ctrl sock */
#define ATMARP_MKIP _IO('a',ATMIOC_CLIP+2) /* attach socket to IP */
#define ATMARP_SETENTRY _IO('a',ATMIOC_CLIP+3) /* fill or hide ARP entry */
#define ATMARP_ENCAP _IO('a',ATMIOC_CLIP+5) /* change encapsulation */
enum atmarp_ctrl_type {
act_invalid, /* catch uninitialized structures */
act_need, /* need address resolution */
act_up, /* interface is coming up */
act_down, /* interface is going down */
act_change /* interface configuration has changed */
};
struct atmarp_ctrl {
enum atmarp_ctrl_type type; /* message type */
int itf_num;/* interface number (if present) */
uint32_t ip; /* IP address (act_need only) */
};
#endif

101
include/linux/atmbr2684.h Normal file
View File

@@ -0,0 +1,101 @@
#ifndef _LINUX_ATMBR2684_H
#define _LINUX_ATMBR2684_H
#include <linux/atm.h>
#include <linux/if.h> /* For IFNAMSIZ */
/*
* Type of media we're bridging (ethernet, token ring, etc) Currently only
* ethernet is supported
*/
#define BR2684_MEDIA_ETHERNET (0) /* 802.3 */
#define BR2684_MEDIA_802_4 (1) /* 802.4 */
#define BR2684_MEDIA_TR (2) /* 802.5 - token ring */
#define BR2684_MEDIA_FDDI (3)
#define BR2684_MEDIA_802_6 (4) /* 802.6 */
/*
* Is there FCS inbound on this VC? This currently isn't supported.
*/
#define BR2684_FCSIN_NO (0)
#define BR2684_FCSIN_IGNORE (1)
#define BR2684_FCSIN_VERIFY (2)
/*
* Is there FCS outbound on this VC? This currently isn't supported.
*/
#define BR2684_FCSOUT_NO (0)
#define BR2684_FCSOUT_SENDZERO (1)
#define BR2684_FCSOUT_GENERATE (2)
/*
* Does this VC include LLC encapsulation?
*/
#define BR2684_ENCAPS_VC (0) /* VC-mux */
#define BR2684_ENCAPS_LLC (1)
#define BR2684_ENCAPS_AUTODETECT (2) /* Unsuported */
/*
* This is for the ATM_NEWBACKENDIF call - these are like socket families:
* the first element of the structure is the backend number and the rest
* is per-backend specific
*/
struct atm_newif_br2684 {
atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */
int media; /* BR2684_MEDIA_* */
char ifname[IFNAMSIZ];
int mtu;
};
/*
* This structure is used to specify a br2684 interface - either by a
* positive integer (returned by ATM_NEWBACKENDIF) or the interfaces name
*/
#define BR2684_FIND_BYNOTHING (0)
#define BR2684_FIND_BYNUM (1)
#define BR2684_FIND_BYIFNAME (2)
struct br2684_if_spec {
int method; /* BR2684_FIND_* */
union {
char ifname[IFNAMSIZ];
int devnum;
} spec;
};
/*
* This is for the ATM_SETBACKEND call - these are like socket families:
* the first element of the structure is the backend number and the rest
* is per-backend specific
*/
struct atm_backend_br2684 {
atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */
struct br2684_if_spec ifspec;
int fcs_in; /* BR2684_FCSIN_* */
int fcs_out; /* BR2684_FCSOUT_* */
int fcs_auto; /* 1: fcs_{in,out} disabled if no FCS rx'ed */
int encaps; /* BR2684_ENCAPS_* */
int has_vpiid; /* 1: use vpn_id - Unsupported */
__u8 vpn_id[7];
int send_padding; /* unsupported */
int min_size; /* we will pad smaller packets than this */
};
/*
* The BR2684_SETFILT ioctl is an experimental mechanism for folks
* terminating a large number of IP-only vcc's. When netfilter allows
* efficient per-if in/out filters, this support will be removed
*/
struct br2684_filter {
__u32 prefix; /* network byte order */
__u32 netmask; /* 0 = disable filter */
};
struct br2684_filter_set {
struct br2684_if_spec ifspec;
struct br2684_filter filter;
};
#define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \
struct br2684_filter_set)
#endif /* _LINUX_ATMBR2684_H */

21
include/linux/atmclip.h Normal file
View File

@@ -0,0 +1,21 @@
/* atmclip.h - Classical IP over ATM */
/* Written 1995-1998 by Werner Almesberger, EPFL LRC/ICA */
#ifndef LINUX_ATMCLIP_H
#define LINUX_ATMCLIP_H
#include <linux/sockios.h>
#include <linux/atmioc.h>
#define RFC1483LLC_LEN 8 /* LLC+OUI+PID = 8 */
#define RFC1626_MTU 9180 /* RFC1626 default MTU */
#define CLIP_DEFAULT_IDLETIMER 1200 /* 20 minutes, see RFC1755 */
#define CLIP_CHECK_INTERVAL 10 /* check every ten seconds */
#define SIOCMKCLIP _IO('a',ATMIOC_CLIP) /* create IP interface */
#endif

489
include/linux/atmdev.h Normal file
View File

@@ -0,0 +1,489 @@
/* atmdev.h - ATM device driver declarations and various related items */
/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
#ifndef LINUX_ATMDEV_H
#define LINUX_ATMDEV_H
#include <linux/config.h>
#include <linux/atmapi.h>
#include <linux/atm.h>
#include <linux/atmioc.h>
#define ESI_LEN 6
#define ATM_OC3_PCR (155520000/270*260/8/53)
/* OC3 link rate: 155520000 bps
SONET overhead: /270*260 (9 section, 1 path)
bits per cell: /8/53
max cell rate: 353207.547 cells/sec */
#define ATM_25_PCR ((25600000/8-8000)/54)
/* 25 Mbps ATM cell rate (59111) */
#define ATM_OC12_PCR (622080000/1080*1040/8/53)
/* OC12 link rate: 622080000 bps
SONET overhead: /1080*1040
bits per cell: /8/53
max cell rate: 1412830.188 cells/sec */
#define ATM_DS3_PCR (8000*12)
/* DS3: 12 cells in a 125 usec time slot */
#define __AAL_STAT_ITEMS \
__HANDLE_ITEM(tx); /* TX okay */ \
__HANDLE_ITEM(tx_err); /* TX errors */ \
__HANDLE_ITEM(rx); /* RX okay */ \
__HANDLE_ITEM(rx_err); /* RX errors */ \
__HANDLE_ITEM(rx_drop); /* RX out of memory */
struct atm_aal_stats {
#define __HANDLE_ITEM(i) int i
__AAL_STAT_ITEMS
#undef __HANDLE_ITEM
};
struct atm_dev_stats {
struct atm_aal_stats aal0;
struct atm_aal_stats aal34;
struct atm_aal_stats aal5;
} __ATM_API_ALIGN;
#define ATM_GETLINKRATE _IOW('a',ATMIOC_ITF+1,struct atmif_sioc)
/* get link rate */
#define ATM_GETNAMES _IOW('a',ATMIOC_ITF+3,struct atm_iobuf)
/* get interface names (numbers) */
#define ATM_GETTYPE _IOW('a',ATMIOC_ITF+4,struct atmif_sioc)
/* get interface type name */
#define ATM_GETESI _IOW('a',ATMIOC_ITF+5,struct atmif_sioc)
/* get interface ESI */
#define ATM_GETADDR _IOW('a',ATMIOC_ITF+6,struct atmif_sioc)
/* get itf's local ATM addr. list */
#define ATM_RSTADDR _IOW('a',ATMIOC_ITF+7,struct atmif_sioc)
/* reset itf's ATM address list */
#define ATM_ADDADDR _IOW('a',ATMIOC_ITF+8,struct atmif_sioc)
/* add a local ATM address */
#define ATM_DELADDR _IOW('a',ATMIOC_ITF+9,struct atmif_sioc)
/* remove a local ATM address */
#define ATM_GETCIRANGE _IOW('a',ATMIOC_ITF+10,struct atmif_sioc)
/* get connection identifier range */
#define ATM_SETCIRANGE _IOW('a',ATMIOC_ITF+11,struct atmif_sioc)
/* set connection identifier range */
#define ATM_SETESI _IOW('a',ATMIOC_ITF+12,struct atmif_sioc)
/* set interface ESI */
#define ATM_SETESIF _IOW('a',ATMIOC_ITF+13,struct atmif_sioc)
/* force interface ESI */
#define ATM_GETSTAT _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc)
/* get AAL layer statistics */
#define ATM_GETSTATZ _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc)
/* get AAL layer statistics and zero */
#define ATM_GETLOOP _IOW('a',ATMIOC_SARCOM+2,struct atmif_sioc)
/* get loopback mode */
#define ATM_SETLOOP _IOW('a',ATMIOC_SARCOM+3,struct atmif_sioc)
/* set loopback mode */
#define ATM_QUERYLOOP _IOW('a',ATMIOC_SARCOM+4,struct atmif_sioc)
/* query supported loopback modes */
#define ATM_SETSC _IOW('a',ATMIOC_SPECIAL+1,int)
/* enable or disable single-copy */
#define ATM_SETBACKEND _IOW('a',ATMIOC_SPECIAL+2,atm_backend_t)
/* set backend handler */
#define ATM_NEWBACKENDIF _IOW('a',ATMIOC_SPECIAL+3,atm_backend_t)
/* use backend to make new if */
#define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf)
/* add party to p2mp call */
#define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int)
/* drop party from p2mp call */
/*
* These are backend handkers that can be set via the ATM_SETBACKEND call
* above. In the future we may support dynamic loading of these - for now,
* they're just being used to share the ATMIOC_BACKEND ioctls
*/
#define ATM_BACKEND_RAW 0
#define ATM_BACKEND_PPP 1 /* PPPoATM - RFC2364 */
#define ATM_BACKEND_BR2684 2 /* Bridged RFC1483/2684 */
/* for ATM_GETTYPE */
#define ATM_ITFTYP_LEN 8 /* maximum length of interface type name */
/*
* Loopback modes for ATM_{PHY,SAR}_{GET,SET}LOOP
*/
/* Point of loopback CPU-->SAR-->PHY-->line--> ... */
#define __ATM_LM_NONE 0 /* no loop back ^ ^ ^ ^ */
#define __ATM_LM_AAL 1 /* loop back PDUs --' | | | */
#define __ATM_LM_ATM 2 /* loop back ATM cells ---' | | */
/* RESERVED 4 loop back on PHY side ---' */
#define __ATM_LM_PHY 8 /* loop back bits (digital) ----' | */
#define __ATM_LM_ANALOG 16 /* loop back the analog signal --------' */
/* Direction of loopback */
#define __ATM_LM_MKLOC(n) ((n)) /* Local (i.e. loop TX to RX) */
#define __ATM_LM_MKRMT(n) ((n) << 8) /* Remote (i.e. loop RX to TX) */
#define __ATM_LM_XTLOC(n) ((n) & 0xff)
#define __ATM_LM_XTRMT(n) (((n) >> 8) & 0xff)
#define ATM_LM_NONE 0 /* no loopback */
#define ATM_LM_LOC_AAL __ATM_LM_MKLOC(__ATM_LM_AAL)
#define ATM_LM_LOC_ATM __ATM_LM_MKLOC(__ATM_LM_ATM)
#define ATM_LM_LOC_PHY __ATM_LM_MKLOC(__ATM_LM_PHY)
#define ATM_LM_LOC_ANALOG __ATM_LM_MKLOC(__ATM_LM_ANALOG)
#define ATM_LM_RMT_AAL __ATM_LM_MKRMT(__ATM_LM_AAL)
#define ATM_LM_RMT_ATM __ATM_LM_MKRMT(__ATM_LM_ATM)
#define ATM_LM_RMT_PHY __ATM_LM_MKRMT(__ATM_LM_PHY)
#define ATM_LM_RMT_ANALOG __ATM_LM_MKRMT(__ATM_LM_ANALOG)
/*
* Note: ATM_LM_LOC_* and ATM_LM_RMT_* can be combined, provided that
* __ATM_LM_XTLOC(x) <= __ATM_LM_XTRMT(x)
*/
struct atm_iobuf {
int length;
void __user *buffer;
};
/* for ATM_GETCIRANGE / ATM_SETCIRANGE */
#define ATM_CI_MAX -1 /* use maximum range of VPI/VCI */
struct atm_cirange {
signed char vpi_bits; /* 1..8, ATM_CI_MAX (-1) for maximum */
signed char vci_bits; /* 1..16, ATM_CI_MAX (-1) for maximum */
};
/* for ATM_SETSC; actually taken from the ATM_VF number space */
#define ATM_SC_RX 1024 /* enable RX single-copy */
#define ATM_SC_TX 2048 /* enable TX single-copy */
#define ATM_BACKLOG_DEFAULT 32 /* if we get more, we're likely to time out
anyway */
/* MF: change_qos (Modify) flags */
#define ATM_MF_IMMED 1 /* Block until change is effective */
#define ATM_MF_INC_RSV 2 /* Change reservation on increase */
#define ATM_MF_INC_SHP 4 /* Change shaping on increase */
#define ATM_MF_DEC_RSV 8 /* Change reservation on decrease */
#define ATM_MF_DEC_SHP 16 /* Change shaping on decrease */
#define ATM_MF_BWD 32 /* Set the backward direction parameters */
#define ATM_MF_SET (ATM_MF_INC_RSV | ATM_MF_INC_SHP | ATM_MF_DEC_RSV | \
ATM_MF_DEC_SHP | ATM_MF_BWD)
/*
* ATM_VS_* are used to express VC state in a human-friendly way.
*/
#define ATM_VS_IDLE 0 /* VC is not used */
#define ATM_VS_CONNECTED 1 /* VC is connected */
#define ATM_VS_CLOSING 2 /* VC is closing */
#define ATM_VS_LISTEN 3 /* VC is listening for incoming setups */
#define ATM_VS_INUSE 4 /* VC is in use (registered with atmsigd) */
#define ATM_VS_BOUND 5 /* VC is bound */
#define ATM_VS2TXT_MAP \
"IDLE", "CONNECTED", "CLOSING", "LISTEN", "INUSE", "BOUND"
#define ATM_VF2TXT_MAP \
"ADDR", "READY", "PARTIAL", "REGIS", \
"RELEASED", "HASQOS", "LISTEN", "META", \
"256", "512", "1024", "2048", \
"SESSION", "HASSAP", "BOUND", "CLOSE"
#ifdef __KERNEL__
#include <linux/wait.h> /* wait_queue_head_t */
#include <linux/time.h> /* struct timeval */
#include <linux/net.h>
#include <linux/skbuff.h> /* struct sk_buff */
#include <linux/uio.h>
#include <net/sock.h>
#include <asm/atomic.h>
#ifdef CONFIG_PROC_FS
#include <linux/proc_fs.h>
extern struct proc_dir_entry *atm_proc_root;
#endif
struct k_atm_aal_stats {
#define __HANDLE_ITEM(i) atomic_t i
__AAL_STAT_ITEMS
#undef __HANDLE_ITEM
};
struct k_atm_dev_stats {
struct k_atm_aal_stats aal0;
struct k_atm_aal_stats aal34;
struct k_atm_aal_stats aal5;
};
enum {
ATM_VF_ADDR, /* Address is in use. Set by anybody, cleared
by device driver. */
ATM_VF_READY, /* VC is ready to transfer data. Set by device
driver, cleared by anybody. */
ATM_VF_PARTIAL, /* resources are bound to PVC (partial PVC
setup), controlled by socket layer */
ATM_VF_REGIS, /* registered with demon, controlled by SVC
socket layer */
ATM_VF_BOUND, /* local SAP is set, controlled by SVC socket
layer */
ATM_VF_RELEASED, /* demon has indicated/requested release,
controlled by SVC socket layer */
ATM_VF_HASQOS, /* QOS parameters have been set */
ATM_VF_LISTEN, /* socket is used for listening */
ATM_VF_META, /* SVC socket isn't used for normal data
traffic and doesn't depend on signaling
to be available */
ATM_VF_SESSION, /* VCC is p2mp session control descriptor */
ATM_VF_HASSAP, /* SAP has been set */
ATM_VF_CLOSE, /* asynchronous close - treat like VF_RELEASED*/
ATM_VF_WAITING, /* waiting for reply from sigd */
ATM_VF_IS_CLIP, /* in use by CLIP protocol */
};
#define ATM_VF2VS(flags) \
(test_bit(ATM_VF_READY,&(flags)) ? ATM_VS_CONNECTED : \
test_bit(ATM_VF_RELEASED,&(flags)) ? ATM_VS_CLOSING : \
test_bit(ATM_VF_LISTEN,&(flags)) ? ATM_VS_LISTEN : \
test_bit(ATM_VF_REGIS,&(flags)) ? ATM_VS_INUSE : \
test_bit(ATM_VF_BOUND,&(flags)) ? ATM_VS_BOUND : ATM_VS_IDLE)
enum {
ATM_DF_CLOSE, /* close device when last VCC is closed */
};
#define ATM_PHY_SIG_LOST 0 /* no carrier/light */
#define ATM_PHY_SIG_UNKNOWN 1 /* carrier/light status is unknown */
#define ATM_PHY_SIG_FOUND 2 /* carrier/light okay */
#define ATM_ATMOPT_CLP 1 /* set CLP bit */
struct atm_vcc {
/* struct sock has to be the first member of atm_vcc */
struct sock sk;
unsigned long flags; /* VCC flags (ATM_VF_*) */
short vpi; /* VPI and VCI (types must be equal */
/* with sockaddr) */
int vci;
unsigned long aal_options; /* AAL layer options */
unsigned long atm_options; /* ATM layer options */
struct atm_dev *dev; /* device back pointer */
struct atm_qos qos; /* QOS */
struct atm_sap sap; /* SAP */
void (*push)(struct atm_vcc *vcc,struct sk_buff *skb);
void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */
int (*push_oam)(struct atm_vcc *vcc,void *cell);
int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
void *dev_data; /* per-device data */
void *proto_data; /* per-protocol data */
struct k_atm_aal_stats *stats; /* pointer to AAL stats group */
/* SVC part --- may move later ------------------------------------- */
short itf; /* interface number */
struct sockaddr_atmsvc local;
struct sockaddr_atmsvc remote;
/* Multipoint part ------------------------------------------------- */
struct atm_vcc *session; /* session VCC descriptor */
/* Other stuff ----------------------------------------------------- */
void *user_back; /* user backlink - not touched by */
/* native ATM stack. Currently used */
/* by CLIP and sch_atm. */
};
static inline struct atm_vcc *atm_sk(struct sock *sk)
{
return (struct atm_vcc *)sk;
}
static inline struct atm_vcc *ATM_SD(struct socket *sock)
{
return atm_sk(sock->sk);
}
static inline struct sock *sk_atm(struct atm_vcc *vcc)
{
return (struct sock *)vcc;
}
struct atm_dev_addr {
struct sockaddr_atmsvc addr; /* ATM address */
struct list_head entry; /* next address */
};
struct atm_dev {
const struct atmdev_ops *ops; /* device operations; NULL if unused */
const struct atmphy_ops *phy; /* PHY operations, may be undefined */
/* (NULL) */
const char *type; /* device type name */
int number; /* device index */
void *dev_data; /* per-device data */
void *phy_data; /* private PHY date */
unsigned long flags; /* device flags (ATM_DF_*) */
struct list_head local; /* local ATM addresses */
unsigned char esi[ESI_LEN]; /* ESI ("MAC" addr) */
struct atm_cirange ci_range; /* VPI/VCI range */
struct k_atm_dev_stats stats; /* statistics */
char signal; /* signal status (ATM_PHY_SIG_*) */
int link_rate; /* link rate (default: OC3) */
atomic_t refcnt; /* reference count */
spinlock_t lock; /* protect internal members */
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *proc_entry; /* proc entry */
char *proc_name; /* proc entry name */
#endif
struct list_head dev_list; /* linkage */
};
/* OF: send_Oam Flags */
#define ATM_OF_IMMED 1 /* Attempt immediate delivery */
#define ATM_OF_INRATE 2 /* Attempt in-rate delivery */
/*
* ioctl, getsockopt, and setsockopt are optional and can be set to NULL.
*/
struct atmdev_ops { /* only send is required */
void (*dev_close)(struct atm_dev *dev);
int (*open)(struct atm_vcc *vcc);
void (*close)(struct atm_vcc *vcc);
int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg);
int (*getsockopt)(struct atm_vcc *vcc,int level,int optname,
void __user *optval,int optlen);
int (*setsockopt)(struct atm_vcc *vcc,int level,int optname,
void __user *optval,int optlen);
int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
int (*send_oam)(struct atm_vcc *vcc,void *cell,int flags);
void (*phy_put)(struct atm_dev *dev,unsigned char value,
unsigned long addr);
unsigned char (*phy_get)(struct atm_dev *dev,unsigned long addr);
int (*change_qos)(struct atm_vcc *vcc,struct atm_qos *qos,int flags);
int (*proc_read)(struct atm_dev *dev,loff_t *pos,char *page);
struct module *owner;
};
struct atmphy_ops {
int (*start)(struct atm_dev *dev);
int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg);
void (*interrupt)(struct atm_dev *dev);
int (*stop)(struct atm_dev *dev);
};
struct atm_skb_data {
struct atm_vcc *vcc; /* ATM VCC */
unsigned long atm_options; /* ATM layer options */
};
#define VCC_HTABLE_SIZE 32
extern struct hlist_head vcc_hash[VCC_HTABLE_SIZE];
extern rwlock_t vcc_sklist_lock;
#define ATM_SKB(skb) (((struct atm_skb_data *) (skb)->cb))
struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops,
int number,unsigned long *flags); /* number == -1: pick first available */
struct atm_dev *atm_dev_lookup(int number);
void atm_dev_deregister(struct atm_dev *dev);
void shutdown_atm_dev(struct atm_dev *dev);
void vcc_insert_socket(struct sock *sk);
/*
* This is approximately the algorithm used by alloc_skb.
*
*/
static inline int atm_guess_pdu2truesize(int size)
{
return (SKB_DATA_ALIGN(size) + sizeof(struct skb_shared_info));
}
static inline void atm_force_charge(struct atm_vcc *vcc,int truesize)
{
atomic_add(truesize, &sk_atm(vcc)->sk_rmem_alloc);
}
static inline void atm_return(struct atm_vcc *vcc,int truesize)
{
atomic_sub(truesize, &sk_atm(vcc)->sk_rmem_alloc);
}
static inline int atm_may_send(struct atm_vcc *vcc,unsigned int size)
{
return (size + atomic_read(&sk_atm(vcc)->sk_wmem_alloc)) <
sk_atm(vcc)->sk_sndbuf;
}
static inline void atm_dev_hold(struct atm_dev *dev)
{
atomic_inc(&dev->refcnt);
}
static inline void atm_dev_put(struct atm_dev *dev)
{
atomic_dec(&dev->refcnt);
if ((atomic_read(&dev->refcnt) == 1) &&
test_bit(ATM_DF_CLOSE,&dev->flags))
shutdown_atm_dev(dev);
}
int atm_charge(struct atm_vcc *vcc,int truesize);
struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size,
int gfp_flags);
int atm_pcr_goal(struct atm_trafprm *tp);
void vcc_release_async(struct atm_vcc *vcc, int reply);
struct atm_ioctl {
struct module *owner;
/* A module reference is kept if appropriate over this call.
* Return -ENOIOCTLCMD if you don't handle it. */
int (*ioctl)(struct socket *, unsigned int cmd, unsigned long arg);
struct list_head list;
};
/**
* register_atm_ioctl - register handler for ioctl operations
*
* Special (non-device) handlers of ioctl's should
* register here. If you're a normal device, you should
* set .ioctl in your atmdev_ops instead.
*/
void register_atm_ioctl(struct atm_ioctl *);
/**
* deregister_atm_ioctl - remove the ioctl handler
*/
void deregister_atm_ioctl(struct atm_ioctl *);
#endif /* __KERNEL__ */
#endif

41
include/linux/atmioc.h Normal file
View File

@@ -0,0 +1,41 @@
/* atmioc.h - ranges for ATM-related ioctl numbers */
/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */
/*
* See http://icawww1.epfl.ch/linux-atm/magic.html for the complete list of
* "magic" ioctl numbers.
*/
#ifndef _LINUX_ATMIOC_H
#define _LINUX_ATMIOC_H
#include <asm/ioctl.h>
/* everybody including atmioc.h will also need _IO{,R,W,WR} */
#define ATMIOC_PHYCOM 0x00 /* PHY device common ioctls, globally unique */
#define ATMIOC_PHYCOM_END 0x0f
#define ATMIOC_PHYTYP 0x10 /* PHY dev type ioctls, unique per PHY type */
#define ATMIOC_PHYTYP_END 0x2f
#define ATMIOC_PHYPRV 0x30 /* PHY dev private ioctls, unique per driver */
#define ATMIOC_PHYPRV_END 0x4f
#define ATMIOC_SARCOM 0x50 /* SAR device common ioctls, globally unique */
#define ATMIOC_SARCOM_END 0x50
#define ATMIOC_SARPRV 0x60 /* SAR dev private ioctls, unique per driver */
#define ATMIOC_SARPRV_END 0x7f
#define ATMIOC_ITF 0x80 /* Interface ioctls, globally unique */
#define ATMIOC_ITF_END 0x8f
#define ATMIOC_BACKEND 0x90 /* ATM generic backend ioctls, u. per backend */
#define ATMIOC_BACKEND_END 0xaf
/* 0xb0-0xbf: Reserved for future use */
#define ATMIOC_AREQUIPA 0xc0 /* Application requested IP over ATM, glob. u. */
#define ATMIOC_LANE 0xd0 /* LAN Emulation, globally unique */
#define ATMIOC_MPOA 0xd8 /* MPOA, globally unique */
#define ATMIOC_CLIP 0xe0 /* Classical IP over ATM control, globally u. */
#define ATMIOC_CLIP_END 0xef
#define ATMIOC_SPECIAL 0xf0 /* Special-purpose controls, globally unique */
#define ATMIOC_SPECIAL_END 0xff
#endif

88
include/linux/atmlec.h Normal file
View File

@@ -0,0 +1,88 @@
/*
*
* ATM Lan Emulation Daemon vs. driver interface
*
* mkiiskila@yahoo.com
*
*/
#ifndef _ATMLEC_H_
#define _ATMLEC_H_
#include <linux/atmapi.h>
#include <linux/atmioc.h>
#include <linux/atm.h>
#include <linux/if_ether.h>
/* ATM lec daemon control socket */
#define ATMLEC_CTRL _IO('a',ATMIOC_LANE)
#define ATMLEC_DATA _IO('a',ATMIOC_LANE+1)
#define ATMLEC_MCAST _IO('a',ATMIOC_LANE+2)
/* Maximum number of LEC interfaces (tweakable) */
#define MAX_LEC_ITF 48
/* From the total of MAX_LEC_ITF, last NUM_TR_DEVS are reserved for Token Ring.
* E.g. if MAX_LEC_ITF = 48 and NUM_TR_DEVS = 8, then lec0-lec39 are for
* Ethernet ELANs and lec40-lec47 are for Token Ring ELANS.
*/
#define NUM_TR_DEVS 8
typedef enum {
l_set_mac_addr, l_del_mac_addr,
l_svc_setup,
l_addr_delete, l_topology_change,
l_flush_complete, l_arp_update,
l_narp_req, /* LANE2 mandates the use of this */
l_config, l_flush_tran_id,
l_set_lecid, l_arp_xmt,
l_rdesc_arp_xmt,
l_associate_req,
l_should_bridge /* should we bridge this MAC? */
} atmlec_msg_type;
#define ATMLEC_MSG_TYPE_MAX l_should_bridge
struct atmlec_config_msg {
unsigned int maximum_unknown_frame_count;
unsigned int max_unknown_frame_time;
unsigned short max_retry_count;
unsigned int aging_time;
unsigned int forward_delay_time;
unsigned int arp_response_time;
unsigned int flush_timeout;
unsigned int path_switching_delay;
unsigned int lane_version; /* LANE2: 1 for LANEv1, 2 for LANEv2 */
int mtu;
int is_proxy;
};
struct atmlec_msg {
atmlec_msg_type type;
int sizeoftlvs; /* LANE2: if != 0, tlvs follow */
union {
struct {
unsigned char mac_addr[ETH_ALEN];
unsigned char atm_addr[ATM_ESA_LEN];
unsigned int flag;/* Topology_change flag,
remoteflag, permanent flag,
lecid, transaction id */
unsigned int targetless_le_arp; /* LANE2 */
unsigned int no_source_le_narp; /* LANE2 */
} normal;
struct atmlec_config_msg config;
struct {
uint16_t lec_id; /* requestor lec_id */
uint32_t tran_id; /* transaction id */
unsigned char mac_addr[ETH_ALEN]; /* dst mac addr */
unsigned char atm_addr[ATM_ESA_LEN]; /* reqestor ATM addr */
} proxy;
/* For mapping LE_ARP requests to responses. Filled by */
} content; /* zeppelin, returned by kernel. Used only when proxying */
} __ATM_API_ALIGN;
struct atmlec_ioc {
int dev_num;
unsigned char atm_addr[ATM_ESA_LEN];
unsigned char receive; /* 1= receive vcc, 0 = send vcc */
};
#endif /* _ATMLEC_H_ */

125
include/linux/atmmpc.h Normal file
View File

@@ -0,0 +1,125 @@
#ifndef _ATMMPC_H_
#define _ATMMPC_H_
#include <linux/atmapi.h>
#include <linux/atmioc.h>
#include <linux/atm.h>
#define ATMMPC_CTRL _IO('a', ATMIOC_MPOA)
#define ATMMPC_DATA _IO('a', ATMIOC_MPOA+1)
#define MPC_SOCKET_INGRESS 1
#define MPC_SOCKET_EGRESS 2
struct atmmpc_ioc {
int dev_num;
uint32_t ipaddr; /* the IP address of the shortcut */
int type; /* ingress or egress */
};
typedef struct in_ctrl_info {
uint8_t Last_NHRP_CIE_code;
uint8_t Last_Q2931_cause_value;
uint8_t eg_MPC_ATM_addr[ATM_ESA_LEN];
uint32_t tag;
uint32_t in_dst_ip; /* IP address this ingress MPC sends packets to */
uint16_t holding_time;
uint32_t request_id;
} in_ctrl_info;
typedef struct eg_ctrl_info {
uint8_t DLL_header[256];
uint8_t DH_length;
uint32_t cache_id;
uint32_t tag;
uint32_t mps_ip;
uint32_t eg_dst_ip; /* IP address to which ingress MPC sends packets */
uint8_t in_MPC_data_ATM_addr[ATM_ESA_LEN];
uint16_t holding_time;
} eg_ctrl_info;
struct mpc_parameters {
uint16_t mpc_p1; /* Shortcut-Setup Frame Count */
uint16_t mpc_p2; /* Shortcut-Setup Frame Time */
uint8_t mpc_p3[8]; /* Flow-detection Protocols */
uint16_t mpc_p4; /* MPC Initial Retry Time */
uint16_t mpc_p5; /* MPC Retry Time Maximum */
uint16_t mpc_p6; /* Hold Down Time */
} ;
struct k_message {
uint16_t type;
uint32_t ip_mask;
uint8_t MPS_ctrl[ATM_ESA_LEN];
union {
in_ctrl_info in_info;
eg_ctrl_info eg_info;
struct mpc_parameters params;
} content;
struct atm_qos qos;
} __ATM_API_ALIGN;
struct llc_snap_hdr {
/* RFC 1483 LLC/SNAP encapsulation for routed IP PDUs */
uint8_t dsap; /* Destination Service Access Point (0xAA) */
uint8_t ssap; /* Source Service Access Point (0xAA) */
uint8_t ui; /* Unnumbered Information (0x03) */
uint8_t org[3]; /* Organizational identification (0x000000) */
uint8_t type[2]; /* Ether type (for IP) (0x0800) */
};
/* TLVs this MPC recognizes */
#define TLV_MPOA_DEVICE_TYPE 0x00a03e2a
/* MPOA device types in MPOA Device Type TLV */
#define NON_MPOA 0
#define MPS 1
#define MPC 2
#define MPS_AND_MPC 3
/* MPC parameter defaults */
#define MPC_P1 10 /* Shortcut-Setup Frame Count */
#define MPC_P2 1 /* Shortcut-Setup Frame Time */
#define MPC_P3 0 /* Flow-detection Protocols */
#define MPC_P4 5 /* MPC Initial Retry Time */
#define MPC_P5 40 /* MPC Retry Time Maximum */
#define MPC_P6 160 /* Hold Down Time */
#define HOLDING_TIME_DEFAULT 1200 /* same as MPS-p7 */
/* MPC constants */
#define MPC_C1 2 /* Retry Time Multiplier */
#define MPC_C2 60 /* Initial Keep-Alive Lifetime */
/* Message types - to MPOA daemon */
#define SND_MPOA_RES_RQST 201
#define SET_MPS_CTRL_ADDR 202
#define SND_MPOA_RES_RTRY 203 /* Different type in a retry due to req id */
#define STOP_KEEP_ALIVE_SM 204
#define EGRESS_ENTRY_REMOVED 205
#define SND_EGRESS_PURGE 206
#define DIE 207 /* tell the daemon to exit() */
#define DATA_PLANE_PURGE 208 /* Data plane purge because of egress cache hit miss or dead MPS */
#define OPEN_INGRESS_SVC 209
/* Message types - from MPOA daemon */
#define MPOA_TRIGGER_RCVD 101
#define MPOA_RES_REPLY_RCVD 102
#define INGRESS_PURGE_RCVD 103
#define EGRESS_PURGE_RCVD 104
#define MPS_DEATH 105
#define CACHE_IMPOS_RCVD 106
#define SET_MPC_CTRL_ADDR 107 /* Our MPC's control ATM address */
#define SET_MPS_MAC_ADDR 108
#define CLEAN_UP_AND_EXIT 109
#define SET_MPC_PARAMS 110 /* MPC configuration parameters */
/* Message types - bidirectional */
#define RELOAD 301 /* kill -HUP the daemon for reload */
#endif /* _ATMMPC_H_ */

24
include/linux/atmppp.h Normal file
View File

@@ -0,0 +1,24 @@
/* atmppp.h - RFC2364 PPPoATM */
/* Written 2000 by Mitchell Blank Jr */
#ifndef _LINUX_ATMPPP_H
#define _LINUX_ATMPPP_H
#include <linux/atm.h>
#define PPPOATM_ENCAPS_AUTODETECT (0)
#define PPPOATM_ENCAPS_VC (1)
#define PPPOATM_ENCAPS_LLC (2)
/*
* This is for the ATM_SETBACKEND call - these are like socket families:
* the first element of the structure is the backend number and the rest
* is per-backend specific
*/
struct atm_backend_ppp {
atm_backend_t backend_num; /* ATM_BACKEND_PPP */
int encaps; /* PPPOATM_ENCAPS_* */
};
#endif /* _LINUX_ATMPPP_H */

162
include/linux/atmsap.h Normal file
View File

@@ -0,0 +1,162 @@
/* atmsap.h - ATM Service Access Point addressing definitions */
/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */
#ifndef _LINUX_ATMSAP_H
#define _LINUX_ATMSAP_H
#include <linux/atmapi.h>
/*
* BEGIN_xx and END_xx markers are used for automatic generation of
* documentation. Do not change them.
*/
/*
* Layer 2 protocol identifiers
*/
/* BEGIN_L2 */
#define ATM_L2_NONE 0 /* L2 not specified */
#define ATM_L2_ISO1745 0x01 /* Basic mode ISO 1745 */
#define ATM_L2_Q291 0x02 /* ITU-T Q.291 (Rec. I.441) */
#define ATM_L2_X25_LL 0x06 /* ITU-T X.25, link layer */
#define ATM_L2_X25_ML 0x07 /* ITU-T X.25, multilink */
#define ATM_L2_LAPB 0x08 /* Extended LAPB, half-duplex (Rec. T.71) */
#define ATM_L2_HDLC_ARM 0x09 /* HDLC ARM (ISO/IEC 4335) */
#define ATM_L2_HDLC_NRM 0x0a /* HDLC NRM (ISO/IEC 4335) */
#define ATM_L2_HDLC_ABM 0x0b /* HDLC ABM (ISO/IEC 4335) */
#define ATM_L2_ISO8802 0x0c /* LAN LLC (ISO/IEC 8802/2) */
#define ATM_L2_X75 0x0d /* ITU-T X.75, SLP */
#define ATM_L2_Q922 0x0e /* ITU-T Q.922 */
#define ATM_L2_USER 0x10 /* user-specified */
#define ATM_L2_ISO7776 0x11 /* ISO 7776 DTE-DTE */
/* END_L2 */
/*
* Layer 3 protocol identifiers
*/
/* BEGIN_L3 */
#define ATM_L3_NONE 0 /* L3 not specified */
#define ATM_L3_X25 0x06 /* ITU-T X.25, packet layer */
#define ATM_L3_ISO8208 0x07 /* ISO/IEC 8208 */
#define ATM_L3_X223 0x08 /* ITU-T X.223 | ISO/IEC 8878 */
#define ATM_L3_ISO8473 0x09 /* ITU-T X.233 | ISO/IEC 8473 */
#define ATM_L3_T70 0x0a /* ITU-T T.70 minimum network layer */
#define ATM_L3_TR9577 0x0b /* ISO/IEC TR 9577 */
#define ATM_L3_H310 0x0c /* ITU-T Recommendation H.310 */
#define ATM_L3_H321 0x0d /* ITU-T Recommendation H.321 */
#define ATM_L3_USER 0x10 /* user-specified */
/* END_L3 */
/*
* High layer identifiers
*/
/* BEGIN_HL */
#define ATM_HL_NONE 0 /* HL not specified */
#define ATM_HL_ISO 0x01 /* ISO */
#define ATM_HL_USER 0x02 /* user-specific */
#define ATM_HL_HLP 0x03 /* high layer profile - UNI 3.0 only */
#define ATM_HL_VENDOR 0x04 /* vendor-specific application identifier */
/* END_HL */
/*
* ITU-T coded mode of operation
*/
/* BEGIN_IMD */
#define ATM_IMD_NONE 0 /* mode not specified */
#define ATM_IMD_NORMAL 1 /* normal mode of operation */
#define ATM_IMD_EXTENDED 2 /* extended mode of operation */
/* END_IMD */
/*
* H.310 code points
*/
#define ATM_TT_NONE 0 /* terminal type not specified */
#define ATM_TT_RX 1 /* receive only */
#define ATM_TT_TX 2 /* send only */
#define ATM_TT_RXTX 3 /* receive and send */
#define ATM_MC_NONE 0 /* no multiplexing */
#define ATM_MC_TS 1 /* transport stream (TS) */
#define ATM_MC_TS_FEC 2 /* transport stream with forward error corr. */
#define ATM_MC_PS 3 /* program stream (PS) */
#define ATM_MC_PS_FEC 4 /* program stream with forward error corr. */
#define ATM_MC_H221 5 /* ITU-T Rec. H.221 */
/*
* SAP structures
*/
#define ATM_MAX_HLI 8 /* maximum high-layer information length */
struct atm_blli {
unsigned char l2_proto; /* layer 2 protocol */
union {
struct {
unsigned char mode; /* mode of operation (ATM_IMD_xxx), 0 if */
/* absent */
unsigned char window; /* window size (k), 1-127 (0 to omit) */
} itu; /* ITU-T encoding */
unsigned char user; /* user-specified l2 information */
} l2;
unsigned char l3_proto; /* layer 3 protocol */
union {
struct {
unsigned char mode; /* mode of operation (ATM_IMD_xxx), 0 if */
/* absent */
unsigned char def_size; /* default packet size (log2), 4-12 (0 to */
/* omit) */
unsigned char window;/* packet window size, 1-127 (0 to omit) */
} itu; /* ITU-T encoding */
unsigned char user; /* user specified l3 information */
struct { /* if l3_proto = ATM_L3_H310 */
unsigned char term_type; /* terminal type */
unsigned char fw_mpx_cap; /* forward multiplexing capability */
/* only if term_type != ATM_TT_NONE */
unsigned char bw_mpx_cap; /* backward multiplexing capability */
/* only if term_type != ATM_TT_NONE */
} h310;
struct { /* if l3_proto = ATM_L3_TR9577 */
unsigned char ipi; /* initial protocol id */
unsigned char snap[5];/* IEEE 802.1 SNAP identifier */
/* (only if ipi == NLPID_IEEE802_1_SNAP) */
} tr9577;
} l3;
} __ATM_API_ALIGN;
struct atm_bhli {
unsigned char hl_type; /* high layer information type */
unsigned char hl_length; /* length (only if hl_type == ATM_HL_USER || */
/* hl_type == ATM_HL_ISO) */
unsigned char hl_info[ATM_MAX_HLI];/* high layer information */
};
#define ATM_MAX_BLLI 3 /* maximum number of BLLI elements */
struct atm_sap {
struct atm_bhli bhli; /* local SAP, high-layer information */
struct atm_blli blli[ATM_MAX_BLLI] __ATM_API_ALIGN;
/* local SAP, low-layer info */
};
static __inline__ int blli_in_use(struct atm_blli blli)
{
return blli.l2_proto || blli.l3_proto;
}
#endif

55
include/linux/atmsvc.h Normal file
View File

@@ -0,0 +1,55 @@
/* atmsvc.h - ATM signaling kernel-demon interface definitions */
/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
#ifndef _LINUX_ATMSVC_H
#define _LINUX_ATMSVC_H
#include <linux/atmapi.h>
#include <linux/atm.h>
#include <linux/atmioc.h>
#define ATMSIGD_CTRL _IO('a',ATMIOC_SPECIAL)
/* become ATM signaling demon control socket */
enum atmsvc_msg_type { as_catch_null, as_bind, as_connect, as_accept, as_reject,
as_listen, as_okay, as_error, as_indicate, as_close,
as_itf_notify, as_modify, as_identify, as_terminate,
as_addparty, as_dropparty };
struct atmsvc_msg {
enum atmsvc_msg_type type;
atm_kptr_t vcc;
atm_kptr_t listen_vcc; /* indicate */
int reply; /* for okay and close: */
/* < 0: error before active */
/* (sigd has discarded ctx) */
/* ==0: success */
/* > 0: error when active (still */
/* need to close) */
struct sockaddr_atmpvc pvc; /* indicate, okay (connect) */
struct sockaddr_atmsvc local; /* local SVC address */
struct atm_qos qos; /* QOS parameters */
struct atm_sap sap; /* SAP */
unsigned int session; /* for p2pm */
struct sockaddr_atmsvc svc; /* SVC address */
} __ATM_API_ALIGN;
/*
* Message contents: see ftp://icaftp.epfl.ch/pub/linux/atm/docs/isp-*.tar.gz
*/
/*
* Some policy stuff for atmsigd and for net/atm/svc.c. Both have to agree on
* what PCR is used to request bandwidth from the device driver. net/atm/svc.c
* tries to do better than that, but only if there's no routing decision (i.e.
* if signaling only uses one ATM interface).
*/
#define SELECT_TOP_PCR(tp) ((tp).pcr ? (tp).pcr : \
(tp).max_pcr && (tp).max_pcr != ATM_MAX_PCR ? (tp).max_pcr : \
(tp).min_pcr ? (tp).min_pcr : ATM_MAX_PCR)
#endif

View File

@@ -0,0 +1,73 @@
/*
* class_container.h - a generic container for all classes
*
* Copyright (c) 2005 - James Bottomley <James.Bottomley@steeleye.com>
*
* This file is licensed under GPLv2
*/
#ifndef _ATTRIBUTE_CONTAINER_H_
#define _ATTRIBUTE_CONTAINER_H_
#include <linux/device.h>
#include <linux/list.h>
struct attribute_container {
struct list_head node;
struct list_head containers;
struct class *class;
struct class_device_attribute **attrs;
int (*match)(struct attribute_container *, struct device *);
#define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01
unsigned long flags;
};
static inline int
attribute_container_no_classdevs(struct attribute_container *atc)
{
return atc->flags & ATTRIBUTE_CONTAINER_NO_CLASSDEVS;
}
static inline void
attribute_container_set_no_classdevs(struct attribute_container *atc)
{
atc->flags |= ATTRIBUTE_CONTAINER_NO_CLASSDEVS;
}
int attribute_container_register(struct attribute_container *cont);
int attribute_container_unregister(struct attribute_container *cont);
void attribute_container_create_device(struct device *dev,
int (*fn)(struct attribute_container *,
struct device *,
struct class_device *));
void attribute_container_add_device(struct device *dev,
int (*fn)(struct attribute_container *,
struct device *,
struct class_device *));
void attribute_container_remove_device(struct device *dev,
void (*fn)(struct attribute_container *,
struct device *,
struct class_device *));
void attribute_container_device_trigger(struct device *dev,
int (*fn)(struct attribute_container *,
struct device *,
struct class_device *));
void attribute_container_trigger(struct device *dev,
int (*fn)(struct attribute_container *,
struct device *));
int attribute_container_add_attrs(struct class_device *classdev);
int attribute_container_add_class_device(struct class_device *classdev);
int attribute_container_add_class_device_adapter(struct attribute_container *cont,
struct device *dev,
struct class_device *classdev);
void attribute_container_remove_attrs(struct class_device *classdev);
void attribute_container_class_device_del(struct class_device *classdev);
struct class_device_attribute **attribute_container_classdev_to_attrs(const struct class_device *classdev);
#endif

196
include/linux/audit.h Normal file
View File

@@ -0,0 +1,196 @@
/* audit.h -- Auditing support -*- linux-c -*-
*
* Copyright 2003-2004 Red Hat Inc., Durham, North Carolina.
* All Rights Reserved.
*
* 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 of the License, 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; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Written by Rickard E. (Rik) Faith <faith@redhat.com>
*
*/
#ifndef _LINUX_AUDIT_H_
#define _LINUX_AUDIT_H_
/* Request and reply types */
#define AUDIT_GET 1000 /* Get status */
#define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */
#define AUDIT_LIST 1002 /* List filtering rules */
#define AUDIT_ADD 1003 /* Add filtering rule */
#define AUDIT_DEL 1004 /* Delete filtering rule */
#define AUDIT_USER 1005 /* Send a message from user-space */
#define AUDIT_LOGIN 1006 /* Define the login id and informaiton */
#define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */
/* Rule flags */
#define AUDIT_PER_TASK 0x01 /* Apply rule at task creation (not syscall) */
#define AUDIT_AT_ENTRY 0x02 /* Apply rule at syscall entry */
#define AUDIT_AT_EXIT 0x04 /* Apply rule at syscall exit */
#define AUDIT_PREPEND 0x10 /* Prepend to front of list */
/* Rule actions */
#define AUDIT_NEVER 0 /* Do not build context if rule matches */
#define AUDIT_POSSIBLE 1 /* Build context if rule matches */
#define AUDIT_ALWAYS 2 /* Generate audit record if rule matches */
/* Rule structure sizes -- if these change, different AUDIT_ADD and
* AUDIT_LIST commands must be implemented. */
#define AUDIT_MAX_FIELDS 64
#define AUDIT_BITMASK_SIZE 64
#define AUDIT_WORD(nr) ((__u32)((nr)/32))
#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32))
/* Rule fields */
/* These are useful when checking the
* task structure at task creation time
* (AUDIT_PER_TASK). */
#define AUDIT_PID 0
#define AUDIT_UID 1
#define AUDIT_EUID 2
#define AUDIT_SUID 3
#define AUDIT_FSUID 4
#define AUDIT_GID 5
#define AUDIT_EGID 6
#define AUDIT_SGID 7
#define AUDIT_FSGID 8
#define AUDIT_LOGINUID 9
#define AUDIT_PERS 10
/* These are ONLY useful when checking
* at syscall exit time (AUDIT_AT_EXIT). */
#define AUDIT_DEVMAJOR 100
#define AUDIT_DEVMINOR 101
#define AUDIT_INODE 102
#define AUDIT_EXIT 103
#define AUDIT_SUCCESS 104 /* exit >= 0; value ignored */
#define AUDIT_ARG0 200
#define AUDIT_ARG1 (AUDIT_ARG0+1)
#define AUDIT_ARG2 (AUDIT_ARG0+2)
#define AUDIT_ARG3 (AUDIT_ARG0+3)
#define AUDIT_NEGATE 0x80000000
/* Status symbols */
/* Mask values */
#define AUDIT_STATUS_ENABLED 0x0001
#define AUDIT_STATUS_FAILURE 0x0002
#define AUDIT_STATUS_PID 0x0004
#define AUDIT_STATUS_RATE_LIMIT 0x0008
#define AUDIT_STATUS_BACKLOG_LIMIT 0x0010
/* Failure-to-log actions */
#define AUDIT_FAIL_SILENT 0
#define AUDIT_FAIL_PRINTK 1
#define AUDIT_FAIL_PANIC 2
#ifndef __KERNEL__
struct audit_message {
struct nlmsghdr nlh;
char data[1200];
};
#endif
struct audit_status {
__u32 mask; /* Bit mask for valid entries */
__u32 enabled; /* 1 = enabled, 0 = disbaled */
__u32 failure; /* Failure-to-log action */
__u32 pid; /* pid of auditd process */
__u32 rate_limit; /* messages rate limit (per second) */
__u32 backlog_limit; /* waiting messages limit */
__u32 lost; /* messages lost */
__u32 backlog; /* messages waiting in queue */
};
struct audit_rule { /* for AUDIT_LIST, AUDIT_ADD, and AUDIT_DEL */
__u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */
__u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */
__u32 field_count;
__u32 mask[AUDIT_BITMASK_SIZE];
__u32 fields[AUDIT_MAX_FIELDS];
__u32 values[AUDIT_MAX_FIELDS];
};
#ifdef __KERNEL__
struct audit_buffer;
struct audit_context;
struct inode;
#ifdef CONFIG_AUDITSYSCALL
/* These are defined in auditsc.c */
/* Public API */
extern int audit_alloc(struct task_struct *task);
extern void audit_free(struct task_struct *task);
extern void audit_syscall_entry(struct task_struct *task,
int major, unsigned long a0, unsigned long a1,
unsigned long a2, unsigned long a3);
extern void audit_syscall_exit(struct task_struct *task, int return_code);
extern void audit_getname(const char *name);
extern void audit_putname(const char *name);
extern void audit_inode(const char *name, const struct inode *inode);
/* Private API (for audit.c only) */
extern int audit_receive_filter(int type, int pid, int uid, int seq,
void *data);
extern void audit_get_stamp(struct audit_context *ctx,
struct timespec *t, int *serial);
extern int audit_set_loginuid(struct audit_context *ctx, uid_t loginuid);
extern uid_t audit_get_loginuid(struct audit_context *ctx);
extern int audit_ipc_perms(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode);
#else
#define audit_alloc(t) ({ 0; })
#define audit_free(t) do { ; } while (0)
#define audit_syscall_entry(t,a,b,c,d,e) do { ; } while (0)
#define audit_syscall_exit(t,r) do { ; } while (0)
#define audit_getname(n) do { ; } while (0)
#define audit_putname(n) do { ; } while (0)
#define audit_inode(n,i) do { ; } while (0)
#define audit_get_loginuid(c) ({ -1; })
#define audit_ipc_perms(q,u,g,m) ({ 0; })
#endif
#ifdef CONFIG_AUDIT
/* These are defined in audit.c */
/* Public API */
extern void audit_log(struct audit_context *ctx,
const char *fmt, ...)
__attribute__((format(printf,2,3)));
extern struct audit_buffer *audit_log_start(struct audit_context *ctx);
extern void audit_log_format(struct audit_buffer *ab,
const char *fmt, ...)
__attribute__((format(printf,2,3)));
extern void audit_log_end(struct audit_buffer *ab);
extern void audit_log_d_path(struct audit_buffer *ab,
const char *prefix,
struct dentry *dentry,
struct vfsmount *vfsmnt);
/* Private API (for auditsc.c only) */
extern void audit_send_reply(int pid, int seq, int type,
int done, int multi,
void *payload, int size);
extern void audit_log_lost(const char *message);
#else
#define audit_log(t,f,...) do { ; } while (0)
#define audit_log_start(t) ({ NULL; })
#define audit_log_vformat(b,f,a) do { ; } while (0)
#define audit_log_format(b,f,...) do { ; } while (0)
#define audit_log_end(b) do { ; } while (0)
#define audit_log_d_path(b,p,d,v) do { ; } while (0)
#endif
#endif
#endif

84
include/linux/auto_fs.h Normal file
View File

@@ -0,0 +1,84 @@
/* -*- linux-c -*- ------------------------------------------------------- *
*
* linux/include/linux/auto_fs.h
*
* Copyright 1997 Transmeta Corporation - All Rights Reserved
*
* This file is part of the Linux kernel and is made available under
* the terms of the GNU General Public License, version 2, or at your
* option, any later version, incorporated herein by reference.
*
* ----------------------------------------------------------------------- */
#ifndef _LINUX_AUTO_FS_H
#define _LINUX_AUTO_FS_H
#ifdef __KERNEL__
#include <linux/fs.h>
#include <linux/limits.h>
#include <asm/types.h>
#endif /* __KERNEL__ */
#include <linux/ioctl.h>
/* This file describes autofs v3 */
#define AUTOFS_PROTO_VERSION 3
/* Range of protocol versions defined */
#define AUTOFS_MAX_PROTO_VERSION AUTOFS_PROTO_VERSION
#define AUTOFS_MIN_PROTO_VERSION AUTOFS_PROTO_VERSION
/*
* Architectures where both 32- and 64-bit binaries can be executed
* on 64-bit kernels need this. This keeps the structure format
* uniform, and makes sure the wait_queue_token isn't too big to be
* passed back down to the kernel.
*
* This assumes that on these architectures:
* mode 32 bit 64 bit
* -------------------------
* int 32 bit 32 bit
* long 32 bit 64 bit
*
* If so, 32-bit user-space code should be backwards compatible.
*/
#if defined(__sparc__) || defined(__mips__) || defined(__x86_64__) \
|| defined(__powerpc__) || defined(__s390__)
typedef unsigned int autofs_wqt_t;
#else
typedef unsigned long autofs_wqt_t;
#endif
/* Packet types */
#define autofs_ptype_missing 0 /* Missing entry (mount request) */
#define autofs_ptype_expire 1 /* Expire entry (umount request) */
struct autofs_packet_hdr {
int proto_version; /* Protocol version */
int type; /* Type of packet */
};
struct autofs_packet_missing {
struct autofs_packet_hdr hdr;
autofs_wqt_t wait_queue_token;
int len;
char name[NAME_MAX+1];
};
/* v3 expire (via ioctl) */
struct autofs_packet_expire {
struct autofs_packet_hdr hdr;
int len;
char name[NAME_MAX+1];
};
#define AUTOFS_IOC_READY _IO(0x93,0x60)
#define AUTOFS_IOC_FAIL _IO(0x93,0x61)
#define AUTOFS_IOC_CATATONIC _IO(0x93,0x62)
#define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int)
#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long)
#define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire)
#endif /* _LINUX_AUTO_FS_H */

57
include/linux/auto_fs4.h Normal file
View File

@@ -0,0 +1,57 @@
/* -*- c -*-
* linux/include/linux/auto_fs4.h
*
* Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org>
*
* This file is part of the Linux kernel and is made available under
* the terms of the GNU General Public License, version 2, or at your
* option, any later version, incorporated herein by reference.
*/
#ifndef _LINUX_AUTO_FS4_H
#define _LINUX_AUTO_FS4_H
/* Include common v3 definitions */
#include <linux/auto_fs.h>
/* autofs v4 definitions */
#undef AUTOFS_PROTO_VERSION
#undef AUTOFS_MIN_PROTO_VERSION
#undef AUTOFS_MAX_PROTO_VERSION
#define AUTOFS_PROTO_VERSION 4
#define AUTOFS_MIN_PROTO_VERSION 3
#define AUTOFS_MAX_PROTO_VERSION 4
#define AUTOFS_PROTO_SUBVERSION 5
/* Mask for expire behaviour */
#define AUTOFS_EXP_IMMEDIATE 1
#define AUTOFS_EXP_LEAVES 2
/* New message type */
#define autofs_ptype_expire_multi 2 /* Expire entry (umount request) */
/* v4 multi expire (via pipe) */
struct autofs_packet_expire_multi {
struct autofs_packet_hdr hdr;
autofs_wqt_t wait_queue_token;
int len;
char name[NAME_MAX+1];
};
union autofs_packet_union {
struct autofs_packet_hdr hdr;
struct autofs_packet_missing missing;
struct autofs_packet_expire expire;
struct autofs_packet_expire_multi expire_multi;
};
#define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93,0x66,int)
#define AUTOFS_IOC_PROTOSUBVER _IOR(0x93,0x67,int)
#define AUTOFS_IOC_ASKREGHOST _IOR(0x93,0x68,int)
#define AUTOFS_IOC_TOGGLEREGHOST _IOR(0x93,0x69,int)
#define AUTOFS_IOC_ASKUMOUNT _IOR(0x93,0x70,int)
#endif /* _LINUX_AUTO_FS4_H */

525
include/linux/awe_voice.h Normal file
View File

@@ -0,0 +1,525 @@
/*
* sound/awe_voice.h
*
* Voice information definitions for the low level driver for the
* AWE32/SB32/AWE64 wave table synth.
* version 0.4.4; Jan. 4, 2000
*
* Copyright (C) 1996-2000 Takashi Iwai
*
* 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 of the License, 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; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef AWE_VOICE_H
#define AWE_VOICE_H
#ifndef SAMPLE_TYPE_AWE32
#define SAMPLE_TYPE_AWE32 0x20
#endif
#ifndef _PATCHKEY
#define _PATCHKEY(id) ((id<<8)|0xfd)
#endif
/*----------------------------------------------------------------
* patch information record
*----------------------------------------------------------------*/
/* patch interface header: 16 bytes */
typedef struct awe_patch_info {
short key; /* use AWE_PATCH here */
#define AWE_PATCH _PATCHKEY(0x07)
short device_no; /* synthesizer number */
unsigned short sf_id; /* file id (should be zero) */
short optarg; /* optional argument */
int len; /* data length (without this header) */
short type; /* patch operation type */
#define AWE_LOAD_INFO 0 /* awe_voice_rec */
#define AWE_LOAD_DATA 1 /* awe_sample_info */
#define AWE_OPEN_PATCH 2 /* awe_open_parm */
#define AWE_CLOSE_PATCH 3 /* none */
#define AWE_UNLOAD_PATCH 4 /* none */
#define AWE_REPLACE_DATA 5 /* awe_sample_info (optarg=#channels)*/
#define AWE_MAP_PRESET 6 /* awe_voice_map */
/*#define AWE_PROBE_INFO 7*/ /* awe_voice_map (pat only) */
#define AWE_PROBE_DATA 8 /* optarg=sample */
#define AWE_REMOVE_INFO 9 /* optarg=(bank<<8)|instr */
#define AWE_LOAD_CHORUS_FX 0x10 /* awe_chorus_fx_rec (optarg=mode) */
#define AWE_LOAD_REVERB_FX 0x11 /* awe_reverb_fx_rec (optarg=mode) */
short reserved; /* word alignment data */
/* the actual patch data begins after this */
#if defined(AWE_COMPAT_030) && AWE_COMPAT_030
char data[0];
#endif
} awe_patch_info;
/*#define AWE_PATCH_INFO_SIZE 16*/
#define AWE_PATCH_INFO_SIZE sizeof(awe_patch_info)
/*----------------------------------------------------------------
* open patch
*----------------------------------------------------------------*/
#define AWE_PATCH_NAME_LEN 32
typedef struct _awe_open_parm {
unsigned short type; /* sample type */
#define AWE_PAT_TYPE_MISC 0
#define AWE_PAT_TYPE_GM 1
#define AWE_PAT_TYPE_GS 2
#define AWE_PAT_TYPE_MT32 3
#define AWE_PAT_TYPE_XG 4
#define AWE_PAT_TYPE_SFX 5
#define AWE_PAT_TYPE_GUS 6
#define AWE_PAT_TYPE_MAP 7
#define AWE_PAT_LOCKED 0x100 /* lock the samples */
#define AWE_PAT_SHARED 0x200 /* sample is shared */
short reserved;
char name[AWE_PATCH_NAME_LEN];
} awe_open_parm;
/*#define AWE_OPEN_PARM_SIZE 28*/
#define AWE_OPEN_PARM_SIZE sizeof(awe_open_parm)
/*----------------------------------------------------------------
* raw voice information record
*----------------------------------------------------------------*/
/* wave table envelope & effect parameters to control EMU8000 */
typedef struct _awe_voice_parm {
unsigned short moddelay; /* modulation delay (0x8000) */
unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */
unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */
unsigned short modrelease; /* modulation release time (0x807f) */
short modkeyhold, modkeydecay; /* envelope change per key (not used) */
unsigned short voldelay; /* volume delay (0x8000) */
unsigned short volatkhld; /* volume attack & hold time (0x7f7f) */
unsigned short voldcysus; /* volume decay & sustain (0x7f7f) */
unsigned short volrelease; /* volume release time (0x807f) */
short volkeyhold, volkeydecay; /* envelope change per key (not used) */
unsigned short lfo1delay; /* LFO1 delay (0x8000) */
unsigned short lfo2delay; /* LFO2 delay (0x8000) */
unsigned short pefe; /* modulation pitch & cutoff (0x0000) */
unsigned short fmmod; /* LFO1 pitch & cutoff (0x0000) */
unsigned short tremfrq; /* LFO1 volume & freq (0x0000) */
unsigned short fm2frq2; /* LFO2 pitch & freq (0x0000) */
unsigned char cutoff; /* initial cutoff (0xff) */
unsigned char filterQ; /* initial filter Q [0-15] (0x0) */
unsigned char chorus; /* chorus send (0x00) */
unsigned char reverb; /* reverb send (0x00) */
unsigned short reserved[4]; /* not used */
} awe_voice_parm;
typedef struct _awe_voice_parm_block {
unsigned short moddelay; /* modulation delay (0x8000) */
unsigned char modatk, modhld;
unsigned char moddcy, modsus;
unsigned char modrel, moddummy;
short modkeyhold, modkeydecay; /* envelope change per key (not used) */
unsigned short voldelay; /* volume delay (0x8000) */
unsigned char volatk, volhld;
unsigned char voldcy, volsus;
unsigned char volrel, voldummy;
short volkeyhold, volkeydecay; /* envelope change per key (not used) */
unsigned short lfo1delay; /* LFO1 delay (0x8000) */
unsigned short lfo2delay; /* LFO2 delay (0x8000) */
unsigned char env1fc, env1pit;
unsigned char lfo1fc, lfo1pit;
unsigned char lfo1freq, lfo1vol;
unsigned char lfo2freq, lfo2pit;
unsigned char cutoff; /* initial cutoff (0xff) */
unsigned char filterQ; /* initial filter Q [0-15] (0x0) */
unsigned char chorus; /* chorus send (0x00) */
unsigned char reverb; /* reverb send (0x00) */
unsigned short reserved[4]; /* not used */
} awe_voice_parm_block;
#define AWE_VOICE_PARM_SIZE 48
/* wave table parameters: 92 bytes */
typedef struct _awe_voice_info {
unsigned short sf_id; /* file id (should be zero) */
unsigned short sample; /* sample id */
int start, end; /* sample offset correction */
int loopstart, loopend; /* loop offset correction */
short rate_offset; /* sample rate pitch offset */
unsigned short mode; /* sample mode */
#define AWE_MODE_ROMSOUND 0x8000
#define AWE_MODE_STEREO 1
#define AWE_MODE_LOOPING 2
#define AWE_MODE_NORELEASE 4 /* obsolete */
#define AWE_MODE_INIT_PARM 8
short root; /* midi root key */
short tune; /* pitch tuning (in cents) */
signed char low, high; /* key note range */
signed char vellow, velhigh; /* velocity range */
signed char fixkey, fixvel; /* fixed key, velocity */
signed char pan, fixpan; /* panning, fixed panning */
short exclusiveClass; /* exclusive class (0 = none) */
unsigned char amplitude; /* sample volume (127 max) */
unsigned char attenuation; /* attenuation (0.375dB) */
short scaleTuning; /* pitch scale tuning(%), normally 100 */
awe_voice_parm parm; /* voice envelope parameters */
short index; /* internal index (set by driver) */
} awe_voice_info;
/*#define AWE_VOICE_INFO_SIZE 92*/
#define AWE_VOICE_INFO_SIZE sizeof(awe_voice_info)
/*----------------------------------------------------------------*/
/* The info entry of awe_voice_rec is changed from 0 to 1
* for some compilers refusing zero size array.
* Due to this change, sizeof(awe_voice_rec) becomes different
* from older versions.
* Use AWE_VOICE_REC_SIZE instead.
*/
/* instrument info header: 4 bytes */
typedef struct _awe_voice_rec_hdr {
unsigned char bank; /* midi bank number */
unsigned char instr; /* midi preset number */
char nvoices; /* number of voices */
char write_mode; /* write mode; normally 0 */
#define AWE_WR_APPEND 0 /* append anyway */
#define AWE_WR_EXCLUSIVE 1 /* skip if already exists */
#define AWE_WR_REPLACE 2 /* replace if already exists */
} awe_voice_rec_hdr;
/*#define AWE_VOICE_REC_SIZE 4*/
#define AWE_VOICE_REC_SIZE sizeof(awe_voice_rec_hdr)
/* the standard patch structure for one sample */
typedef struct _awe_voice_rec_patch {
awe_patch_info patch;
awe_voice_rec_hdr hdr;
awe_voice_info info;
} awe_voice_rec_patch;
/* obsolete data type */
#if defined(AWE_COMPAT_030) && AWE_COMPAT_030
#define AWE_INFOARRAY_SIZE 0
#else
#define AWE_INFOARRAY_SIZE 1
#endif
typedef struct _awe_voice_rec {
unsigned char bank; /* midi bank number */
unsigned char instr; /* midi preset number */
short nvoices; /* number of voices */
/* voice information follows here */
awe_voice_info info[AWE_INFOARRAY_SIZE];
} awe_voice_rec;
/*----------------------------------------------------------------
* sample wave information
*----------------------------------------------------------------*/
/* wave table sample header: 32 bytes */
typedef struct awe_sample_info {
unsigned short sf_id; /* file id (should be zero) */
unsigned short sample; /* sample id */
int start, end; /* start & end offset */
int loopstart, loopend; /* loop start & end offset */
int size; /* size (0 = ROM) */
short checksum_flag; /* use check sum = 1 */
unsigned short mode_flags; /* mode flags */
#define AWE_SAMPLE_8BITS 1 /* wave data is 8bits */
#define AWE_SAMPLE_UNSIGNED 2 /* wave data is unsigned */
#define AWE_SAMPLE_NO_BLANK 4 /* no blank loop is attached */
#define AWE_SAMPLE_SINGLESHOT 8 /* single-shot w/o loop */
#define AWE_SAMPLE_BIDIR_LOOP 16 /* bidirectional looping */
#define AWE_SAMPLE_STEREO_LEFT 32 /* stereo left sound */
#define AWE_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */
#define AWE_SAMPLE_REVERSE_LOOP 128 /* reverse looping */
unsigned int checksum; /* check sum */
#if defined(AWE_COMPAT_030) && AWE_COMPAT_030
unsigned short data[0]; /* sample data follows here */
#endif
} awe_sample_info;
/*#define AWE_SAMPLE_INFO_SIZE 32*/
#define AWE_SAMPLE_INFO_SIZE sizeof(awe_sample_info)
/*----------------------------------------------------------------
* voice preset mapping
*----------------------------------------------------------------*/
typedef struct awe_voice_map {
int map_bank, map_instr, map_key; /* key = -1 means all keys */
int src_bank, src_instr, src_key;
} awe_voice_map;
#define AWE_VOICE_MAP_SIZE sizeof(awe_voice_map)
/*----------------------------------------------------------------
* awe hardware controls
*----------------------------------------------------------------*/
#define _AWE_DEBUG_MODE 0x00
#define _AWE_REVERB_MODE 0x01
#define _AWE_CHORUS_MODE 0x02
#define _AWE_REMOVE_LAST_SAMPLES 0x03
#define _AWE_INITIALIZE_CHIP 0x04
#define _AWE_SEND_EFFECT 0x05
#define _AWE_TERMINATE_CHANNEL 0x06
#define _AWE_TERMINATE_ALL 0x07
#define _AWE_INITIAL_VOLUME 0x08
#define _AWE_INITIAL_ATTEN _AWE_INITIAL_VOLUME
#define _AWE_RESET_CHANNEL 0x09
#define _AWE_CHANNEL_MODE 0x0a
#define _AWE_DRUM_CHANNELS 0x0b
#define _AWE_MISC_MODE 0x0c
#define _AWE_RELEASE_ALL 0x0d
#define _AWE_NOTEOFF_ALL 0x0e
#define _AWE_CHN_PRESSURE 0x0f
/*#define _AWE_GET_CURRENT_MODE 0x10*/
#define _AWE_EQUALIZER 0x11
/*#define _AWE_GET_MISC_MODE 0x12*/
/*#define _AWE_GET_FONTINFO 0x13*/
#define _AWE_MODE_FLAG 0x80
#define _AWE_COOKED_FLAG 0x40 /* not supported */
#define _AWE_MODE_VALUE_MASK 0x3F
/*----------------------------------------------------------------*/
#define _AWE_SET_CMD(p,dev,voice,cmd,p1,p2) \
{((char*)(p))[0] = SEQ_PRIVATE;\
((char*)(p))[1] = dev;\
((char*)(p))[2] = _AWE_MODE_FLAG|(cmd);\
((char*)(p))[3] = voice;\
((unsigned short*)(p))[2] = p1;\
((unsigned short*)(p))[3] = p2;}
/* buffered access */
#define _AWE_CMD(dev, voice, cmd, p1, p2) \
{_SEQ_NEEDBUF(8);\
_AWE_SET_CMD(_seqbuf + _seqbufptr, dev, voice, cmd, p1, p2);\
_SEQ_ADVBUF(8);}
/* direct access */
#define _AWE_CMD_NOW(seqfd,dev,voice,cmd,p1,p2) \
{struct seq_event_rec tmp;\
_AWE_SET_CMD(&tmp, dev, voice, cmd, p1, p2);\
ioctl(seqfd, SNDCTL_SEQ_OUTOFBAND, &tmp);}
/*----------------------------------------------------------------*/
/* set debugging mode */
#define AWE_DEBUG_MODE(dev,p1) _AWE_CMD(dev, 0, _AWE_DEBUG_MODE, p1, 0)
/* set reverb mode; from 0 to 7 */
#define AWE_REVERB_MODE(dev,p1) _AWE_CMD(dev, 0, _AWE_REVERB_MODE, p1, 0)
/* set chorus mode; from 0 to 7 */
#define AWE_CHORUS_MODE(dev,p1) _AWE_CMD(dev, 0, _AWE_CHORUS_MODE, p1, 0)
/* reset channel */
#define AWE_RESET_CHANNEL(dev,ch) _AWE_CMD(dev, ch, _AWE_RESET_CHANNEL, 0, 0)
#define AWE_RESET_CONTROL(dev,ch) _AWE_CMD(dev, ch, _AWE_RESET_CHANNEL, 1, 0)
/* send an effect to all layers */
#define AWE_SEND_EFFECT(dev,voice,type,value) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,type,value)
#define AWE_ADD_EFFECT(dev,voice,type,value) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,((type)|0x80),value)
#define AWE_UNSET_EFFECT(dev,voice,type) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,((type)|0x40),0)
/* send an effect to a layer */
#define AWE_SEND_LAYER_EFFECT(dev,voice,layer,type,value) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,((layer+1)<<8|(type)),value)
#define AWE_ADD_LAYER_EFFECT(dev,voice,layer,type,value) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,((layer+1)<<8|(type)|0x80),value)
#define AWE_UNSET_LAYER_EFFECT(dev,voice,layer,type) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,((layer+1)<<8|(type)|0x40),0)
/* terminate sound on the channel/voice */
#define AWE_TERMINATE_CHANNEL(dev,voice) _AWE_CMD(dev,voice,_AWE_TERMINATE_CHANNEL,0,0)
/* terminate all sounds */
#define AWE_TERMINATE_ALL(dev) _AWE_CMD(dev, 0, _AWE_TERMINATE_ALL, 0, 0)
/* release all sounds (w/o sustain effect) */
#define AWE_RELEASE_ALL(dev) _AWE_CMD(dev, 0, _AWE_RELEASE_ALL, 0, 0)
/* note off all sounds (w sustain effect) */
#define AWE_NOTEOFF_ALL(dev) _AWE_CMD(dev, 0, _AWE_NOTEOFF_ALL, 0, 0)
/* set initial attenuation */
#define AWE_INITIAL_VOLUME(dev,atten) _AWE_CMD(dev, 0, _AWE_INITIAL_VOLUME, atten, 0)
#define AWE_INITIAL_ATTEN AWE_INITIAL_VOLUME
/* relative attenuation */
#define AWE_SET_ATTEN(dev,atten) _AWE_CMD(dev, 0, _AWE_INITIAL_VOLUME, atten, 1)
/* set channel playing mode; mode=0/1/2 */
#define AWE_SET_CHANNEL_MODE(dev,mode) _AWE_CMD(dev, 0, _AWE_CHANNEL_MODE, mode, 0)
#define AWE_PLAY_INDIRECT 0 /* indirect voice mode (default) */
#define AWE_PLAY_MULTI 1 /* multi note voice mode */
#define AWE_PLAY_DIRECT 2 /* direct single voice mode */
#define AWE_PLAY_MULTI2 3 /* sequencer2 mode; used internally */
/* set drum channel mask; channels is 32bit long value */
#define AWE_DRUM_CHANNELS(dev,channels) _AWE_CMD(dev, 0, _AWE_DRUM_CHANNELS, ((channels) & 0xffff), ((channels) >> 16))
/* set bass and treble control; values are from 0 to 11 */
#define AWE_EQUALIZER(dev,bass,treble) _AWE_CMD(dev, 0, _AWE_EQUALIZER, bass, treble)
/* remove last loaded samples */
#define AWE_REMOVE_LAST_SAMPLES(seqfd,dev) _AWE_CMD_NOW(seqfd, dev, 0, _AWE_REMOVE_LAST_SAMPLES, 0, 0)
/* initialize emu8000 chip */
#define AWE_INITIALIZE_CHIP(seqfd,dev) _AWE_CMD_NOW(seqfd, dev, 0, _AWE_INITIALIZE_CHIP, 0, 0)
/* set miscellaneous modes; meta command */
#define AWE_MISC_MODE(dev,mode,value) _AWE_CMD(dev, 0, _AWE_MISC_MODE, mode, value)
/* exclusive sound off; 1=off */
#define AWE_EXCLUSIVE_SOUND(dev,mode) AWE_MISC_MODE(dev,AWE_MD_EXCLUSIVE_SOUND,mode)
/* default GUS bank number */
#define AWE_SET_GUS_BANK(dev,bank) AWE_MISC_MODE(dev,AWE_MD_GUS_BANK,bank)
/* change panning position in realtime; 0=don't 1=do */
#define AWE_REALTIME_PAN(dev,mode) AWE_MISC_MODE(dev,AWE_MD_REALTIME_PAN,mode)
/* extended pressure controls; not portable with other sound drivers */
#define AWE_KEY_PRESSURE(dev,ch,note,vel) SEQ_START_NOTE(dev,ch,(note)+128,vel)
#define AWE_CHN_PRESSURE(dev,ch,vel) _AWE_CMD(dev,ch,_AWE_CHN_PRESSURE,vel,0)
/*----------------------------------------------------------------*/
/* reverb mode parameters */
#define AWE_REVERB_ROOM1 0
#define AWE_REVERB_ROOM2 1
#define AWE_REVERB_ROOM3 2
#define AWE_REVERB_HALL1 3
#define AWE_REVERB_HALL2 4
#define AWE_REVERB_PLATE 5
#define AWE_REVERB_DELAY 6
#define AWE_REVERB_PANNINGDELAY 7
#define AWE_REVERB_PREDEFINED 8
/* user can define reverb modes up to 32 */
#define AWE_REVERB_NUMBERS 32
typedef struct awe_reverb_fx_rec {
unsigned short parms[28];
} awe_reverb_fx_rec;
/*----------------------------------------------------------------*/
/* chorus mode parameters */
#define AWE_CHORUS_1 0
#define AWE_CHORUS_2 1
#define AWE_CHORUS_3 2
#define AWE_CHORUS_4 3
#define AWE_CHORUS_FEEDBACK 4
#define AWE_CHORUS_FLANGER 5
#define AWE_CHORUS_SHORTDELAY 6
#define AWE_CHORUS_SHORTDELAY2 7
#define AWE_CHORUS_PREDEFINED 8
/* user can define chorus modes up to 32 */
#define AWE_CHORUS_NUMBERS 32
typedef struct awe_chorus_fx_rec {
unsigned short feedback; /* feedback level (0xE600-0xE6FF) */
unsigned short delay_offset; /* delay (0-0x0DA3) [1/44100 sec] */
unsigned short lfo_depth; /* LFO depth (0xBC00-0xBCFF) */
unsigned int delay; /* right delay (0-0xFFFFFFFF) [1/256/44100 sec] */
unsigned int lfo_freq; /* LFO freq LFO freq (0-0xFFFFFFFF) */
} awe_chorus_fx_rec;
/*----------------------------------------------------------------*/
/* misc mode types */
enum {
/* 0*/ AWE_MD_EXCLUSIVE_OFF, /* obsolete */
/* 1*/ AWE_MD_EXCLUSIVE_ON, /* obsolete */
/* 2*/ AWE_MD_VERSION, /* read only */
/* 3*/ AWE_MD_EXCLUSIVE_SOUND, /* 0/1: exclusive note on (default=1) */
/* 4*/ AWE_MD_REALTIME_PAN, /* 0/1: do realtime pan change (default=1) */
/* 5*/ AWE_MD_GUS_BANK, /* bank number for GUS patches (default=0) */
/* 6*/ AWE_MD_KEEP_EFFECT, /* 0/1: keep effect values, (default=0) */
/* 7*/ AWE_MD_ZERO_ATTEN, /* attenuation of max volume (default=32) */
/* 8*/ AWE_MD_CHN_PRIOR, /* 0/1: set MIDI channel priority mode (default=1) */
/* 9*/ AWE_MD_MOD_SENSE, /* integer: modwheel sensitivity (def=18) */
/*10*/ AWE_MD_DEF_PRESET, /* integer: default preset number (def=0) */
/*11*/ AWE_MD_DEF_BANK, /* integer: default bank number (def=0) */
/*12*/ AWE_MD_DEF_DRUM, /* integer: default drumset number (def=0) */
/*13*/ AWE_MD_TOGGLE_DRUM_BANK, /* 0/1: toggle drum flag with bank# (def=0) */
/*14*/ AWE_MD_NEW_VOLUME_CALC, /* 0/1: volume calculation mode (def=1) */
/*15*/ AWE_MD_CHORUS_MODE, /* integer: chorus mode (def=2) */
/*16*/ AWE_MD_REVERB_MODE, /* integer: chorus mode (def=4) */
/*17*/ AWE_MD_BASS_LEVEL, /* integer: bass level (def=5) */
/*18*/ AWE_MD_TREBLE_LEVEL, /* integer: treble level (def=9) */
/*19*/ AWE_MD_DEBUG_MODE, /* integer: debug level (def=0) */
/*20*/ AWE_MD_PAN_EXCHANGE, /* 0/1: exchange panning direction (def=0) */
AWE_MD_END,
};
/*----------------------------------------------------------------*/
/* effect parameters */
enum {
/* modulation envelope parameters */
/* 0*/ AWE_FX_ENV1_DELAY, /* WORD: ENVVAL */
/* 1*/ AWE_FX_ENV1_ATTACK, /* BYTE: up ATKHLD */
/* 2*/ AWE_FX_ENV1_HOLD, /* BYTE: lw ATKHLD */
/* 3*/ AWE_FX_ENV1_DECAY, /* BYTE: lw DCYSUS */
/* 4*/ AWE_FX_ENV1_RELEASE, /* BYTE: lw DCYSUS */
/* 5*/ AWE_FX_ENV1_SUSTAIN, /* BYTE: up DCYSUS */
/* 6*/ AWE_FX_ENV1_PITCH, /* BYTE: up PEFE */
/* 7*/ AWE_FX_ENV1_CUTOFF, /* BYTE: lw PEFE */
/* volume envelope parameters */
/* 8*/ AWE_FX_ENV2_DELAY, /* WORD: ENVVOL */
/* 9*/ AWE_FX_ENV2_ATTACK, /* BYTE: up ATKHLDV */
/*10*/ AWE_FX_ENV2_HOLD, /* BYTE: lw ATKHLDV */
/*11*/ AWE_FX_ENV2_DECAY, /* BYTE: lw DCYSUSV */
/*12*/ AWE_FX_ENV2_RELEASE, /* BYTE: lw DCYSUSV */
/*13*/ AWE_FX_ENV2_SUSTAIN, /* BYTE: up DCYSUSV */
/* LFO1 (tremolo & vibrato) parameters */
/*14*/ AWE_FX_LFO1_DELAY, /* WORD: LFO1VAL */
/*15*/ AWE_FX_LFO1_FREQ, /* BYTE: lo TREMFRQ */
/*16*/ AWE_FX_LFO1_VOLUME, /* BYTE: up TREMFRQ */
/*17*/ AWE_FX_LFO1_PITCH, /* BYTE: up FMMOD */
/*18*/ AWE_FX_LFO1_CUTOFF, /* BYTE: lo FMMOD */
/* LFO2 (vibrato) parameters */
/*19*/ AWE_FX_LFO2_DELAY, /* WORD: LFO2VAL */
/*20*/ AWE_FX_LFO2_FREQ, /* BYTE: lo FM2FRQ2 */
/*21*/ AWE_FX_LFO2_PITCH, /* BYTE: up FM2FRQ2 */
/* Other overall effect parameters */
/*22*/ AWE_FX_INIT_PITCH, /* SHORT: pitch offset */
/*23*/ AWE_FX_CHORUS, /* BYTE: chorus effects send (0-255) */
/*24*/ AWE_FX_REVERB, /* BYTE: reverb effects send (0-255) */
/*25*/ AWE_FX_CUTOFF, /* BYTE: up IFATN */
/*26*/ AWE_FX_FILTERQ, /* BYTE: up CCCA */
/* Sample / loop offset changes */
/*27*/ AWE_FX_SAMPLE_START, /* SHORT: offset */
/*28*/ AWE_FX_LOOP_START, /* SHORT: offset */
/*29*/ AWE_FX_LOOP_END, /* SHORT: offset */
/*30*/ AWE_FX_COARSE_SAMPLE_START, /* SHORT: upper word offset */
/*31*/ AWE_FX_COARSE_LOOP_START, /* SHORT: upper word offset */
/*32*/ AWE_FX_COARSE_LOOP_END, /* SHORT: upper word offset */
/*33*/ AWE_FX_ATTEN, /* BYTE: lo IFATN */
AWE_FX_END,
};
#endif /* AWE_VOICE_H */

116
include/linux/ax25.h Normal file
View File

@@ -0,0 +1,116 @@
/*
* These are the public elements of the Linux kernel AX.25 code. A similar
* file netrom.h exists for the NET/ROM protocol.
*/
#ifndef AX25_KERNEL_H
#define AX25_KERNEL_H
#include <linux/socket.h>
#define AX25_MTU 256
#define AX25_MAX_DIGIS 8
#define AX25_WINDOW 1
#define AX25_T1 2
#define AX25_N2 3
#define AX25_T3 4
#define AX25_T2 5
#define AX25_BACKOFF 6
#define AX25_EXTSEQ 7
#define AX25_PIDINCL 8
#define AX25_IDLE 9
#define AX25_PACLEN 10
#define AX25_IAMDIGI 12
#define AX25_KILL 99
#define SIOCAX25GETUID (SIOCPROTOPRIVATE+0)
#define SIOCAX25ADDUID (SIOCPROTOPRIVATE+1)
#define SIOCAX25DELUID (SIOCPROTOPRIVATE+2)
#define SIOCAX25NOUID (SIOCPROTOPRIVATE+3)
#define SIOCAX25OPTRT (SIOCPROTOPRIVATE+7)
#define SIOCAX25CTLCON (SIOCPROTOPRIVATE+8)
#define SIOCAX25GETINFOOLD (SIOCPROTOPRIVATE+9)
#define SIOCAX25ADDFWD (SIOCPROTOPRIVATE+10)
#define SIOCAX25DELFWD (SIOCPROTOPRIVATE+11)
#define SIOCAX25DEVCTL (SIOCPROTOPRIVATE+12)
#define SIOCAX25GETINFO (SIOCPROTOPRIVATE+13)
#define AX25_SET_RT_IPMODE 2
#define AX25_NOUID_DEFAULT 0
#define AX25_NOUID_BLOCK 1
typedef struct {
char ax25_call[7]; /* 6 call + SSID (shifted ascii!) */
} ax25_address;
struct sockaddr_ax25 {
sa_family_t sax25_family;
ax25_address sax25_call;
int sax25_ndigis;
/* Digipeater ax25_address sets follow */
};
#define sax25_uid sax25_ndigis
struct full_sockaddr_ax25 {
struct sockaddr_ax25 fsa_ax25;
ax25_address fsa_digipeater[AX25_MAX_DIGIS];
};
struct ax25_routes_struct {
ax25_address port_addr;
ax25_address dest_addr;
unsigned char digi_count;
ax25_address digi_addr[AX25_MAX_DIGIS];
};
struct ax25_route_opt_struct {
ax25_address port_addr;
ax25_address dest_addr;
int cmd;
int arg;
};
struct ax25_ctl_struct {
ax25_address port_addr;
ax25_address source_addr;
ax25_address dest_addr;
unsigned int cmd;
unsigned long arg;
unsigned char digi_count;
ax25_address digi_addr[AX25_MAX_DIGIS];
};
/* this will go away. Please do not export to user land */
struct ax25_info_struct_deprecated {
unsigned int n2, n2count;
unsigned int t1, t1timer;
unsigned int t2, t2timer;
unsigned int t3, t3timer;
unsigned int idle, idletimer;
unsigned int state;
unsigned int rcv_q, snd_q;
};
struct ax25_info_struct {
unsigned int n2, n2count;
unsigned int t1, t1timer;
unsigned int t2, t2timer;
unsigned int t3, t3timer;
unsigned int idle, idletimer;
unsigned int state;
unsigned int rcv_q, snd_q;
unsigned int vs, vr, va, vs_max;
unsigned int paclen;
unsigned int window;
};
struct ax25_fwd_struct {
ax25_address port_from;
ax25_address port_to;
};
#endif

73
include/linux/b1lli.h Normal file
View File

@@ -0,0 +1,73 @@
/* $Id: b1lli.h,v 1.8.8.3 2001/09/23 22:25:05 kai Exp $
*
* ISDN lowlevel-module for AVM B1-card.
*
* Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#ifndef _B1LLI_H_
#define _B1LLI_H_
/*
* struct for loading t4 file
*/
typedef struct avmb1_t4file {
int len;
unsigned char *data;
} avmb1_t4file;
typedef struct avmb1_loaddef {
int contr;
avmb1_t4file t4file;
} avmb1_loaddef;
typedef struct avmb1_loadandconfigdef {
int contr;
avmb1_t4file t4file;
avmb1_t4file t4config;
} avmb1_loadandconfigdef;
typedef struct avmb1_resetdef {
int contr;
} avmb1_resetdef;
typedef struct avmb1_getdef {
int contr;
int cardtype;
int cardstate;
} avmb1_getdef;
/*
* struct for adding new cards
*/
typedef struct avmb1_carddef {
int port;
int irq;
} avmb1_carddef;
#define AVM_CARDTYPE_B1 0
#define AVM_CARDTYPE_T1 1
#define AVM_CARDTYPE_M1 2
#define AVM_CARDTYPE_M2 3
typedef struct avmb1_extcarddef {
int port;
int irq;
int cardtype;
int cardnr; /* for HEMA/T1 */
} avmb1_extcarddef;
#define AVMB1_LOAD 0 /* load image to card */
#define AVMB1_ADDCARD 1 /* add a new card - OBSOLETE */
#define AVMB1_RESETCARD 2 /* reset a card */
#define AVMB1_LOAD_AND_CONFIG 3 /* load image and config to card */
#define AVMB1_ADDCARD_WITH_TYPE 4 /* add a new card, with cardtype */
#define AVMB1_GET_CARDINFO 5 /* get cardtype */
#define AVMB1_REMOVECARD 6 /* remove a card - OBSOLETE */
#define AVMB1_REGISTERCARD_IS_OBSOLETE
#endif /* _B1LLI_H_ */

21
include/linux/b1pcmcia.h Normal file
View File

@@ -0,0 +1,21 @@
/* $Id: b1pcmcia.h,v 1.1.8.2 2001/09/23 22:25:05 kai Exp $
*
* Exported functions of module b1pcmcia to be called by
* avm_cs card services module.
*
* Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#ifndef _B1PCMCIA_H_
#define _B1PCMCIA_H_
int b1pcmcia_addcard_b1(unsigned int port, unsigned irq);
int b1pcmcia_addcard_m1(unsigned int port, unsigned irq);
int b1pcmcia_addcard_m2(unsigned int port, unsigned irq);
int b1pcmcia_delcard(unsigned int port, unsigned irq);
#endif /* _B1PCMCIA_H_ */

104
include/linux/backing-dev.h Normal file
View File

@@ -0,0 +1,104 @@
/*
* include/linux/backing-dev.h
*
* low-level device information and state which is propagated up through
* to high-level code.
*/
#ifndef _LINUX_BACKING_DEV_H
#define _LINUX_BACKING_DEV_H
#include <asm/atomic.h>
/*
* Bits in backing_dev_info.state
*/
enum bdi_state {
BDI_pdflush, /* A pdflush thread is working this device */
BDI_write_congested, /* The write queue is getting full */
BDI_read_congested, /* The read queue is getting full */
BDI_unused, /* Available bits start here */
};
typedef int (congested_fn)(void *, int);
struct backing_dev_info {
unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */
unsigned long state; /* Always use atomic bitops on this */
unsigned int capabilities; /* Device capabilities */
congested_fn *congested_fn; /* Function pointer if device is md/dm */
void *congested_data; /* Pointer to aux data for congested func */
void (*unplug_io_fn)(struct backing_dev_info *, struct page *);
void *unplug_io_data;
};
/*
* Flags in backing_dev_info::capability
* - The first two flags control whether dirty pages will contribute to the
* VM's accounting and whether writepages() should be called for dirty pages
* (something that would not, for example, be appropriate for ramfs)
* - These flags let !MMU mmap() govern direct device mapping vs immediate
* copying more easily for MAP_PRIVATE, especially for ROM filesystems
*/
#define BDI_CAP_NO_ACCT_DIRTY 0x00000001 /* Dirty pages shouldn't contribute to accounting */
#define BDI_CAP_NO_WRITEBACK 0x00000002 /* Don't write pages back */
#define BDI_CAP_MAP_COPY 0x00000004 /* Copy can be mapped (MAP_PRIVATE) */
#define BDI_CAP_MAP_DIRECT 0x00000008 /* Can be mapped directly (MAP_SHARED) */
#define BDI_CAP_READ_MAP 0x00000010 /* Can be mapped for reading */
#define BDI_CAP_WRITE_MAP 0x00000020 /* Can be mapped for writing */
#define BDI_CAP_EXEC_MAP 0x00000040 /* Can be mapped for execution */
#define BDI_CAP_VMFLAGS \
(BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP)
#if defined(VM_MAYREAD) && \
(BDI_CAP_READ_MAP != VM_MAYREAD || \
BDI_CAP_WRITE_MAP != VM_MAYWRITE || \
BDI_CAP_EXEC_MAP != VM_MAYEXEC)
#error please change backing_dev_info::capabilities flags
#endif
extern struct backing_dev_info default_backing_dev_info;
void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page);
int writeback_acquire(struct backing_dev_info *bdi);
int writeback_in_progress(struct backing_dev_info *bdi);
void writeback_release(struct backing_dev_info *bdi);
static inline int bdi_congested(struct backing_dev_info *bdi, int bdi_bits)
{
if (bdi->congested_fn)
return bdi->congested_fn(bdi->congested_data, bdi_bits);
return (bdi->state & bdi_bits);
}
static inline int bdi_read_congested(struct backing_dev_info *bdi)
{
return bdi_congested(bdi, 1 << BDI_read_congested);
}
static inline int bdi_write_congested(struct backing_dev_info *bdi)
{
return bdi_congested(bdi, 1 << BDI_write_congested);
}
static inline int bdi_rw_congested(struct backing_dev_info *bdi)
{
return bdi_congested(bdi, (1 << BDI_read_congested)|
(1 << BDI_write_congested));
}
#define bdi_cap_writeback_dirty(bdi) \
(!((bdi)->capabilities & BDI_CAP_NO_WRITEBACK))
#define bdi_cap_account_dirty(bdi) \
(!((bdi)->capabilities & BDI_CAP_NO_ACCT_DIRTY))
#define mapping_cap_writeback_dirty(mapping) \
bdi_cap_writeback_dirty((mapping)->backing_dev_info)
#define mapping_cap_account_dirty(mapping) \
bdi_cap_account_dirty((mapping)->backing_dev_info)
#endif /* _LINUX_BACKING_DEV_H */

57
include/linux/backlight.h Normal file
View File

@@ -0,0 +1,57 @@
/*
* Backlight Lowlevel Control Abstraction
*
* Copyright (C) 2003,2004 Hewlett-Packard Company
*
*/
#ifndef _LINUX_BACKLIGHT_H
#define _LINUX_BACKLIGHT_H
#include <linux/device.h>
#include <linux/notifier.h>
struct backlight_device;
struct fb_info;
/* This structure defines all the properties of a backlight
(usually attached to a LCD). */
struct backlight_properties {
/* Owner module */
struct module *owner;
/* Get the backlight power status (0: full on, 1..3: power saving
modes; 4: full off), see FB_BLANK_XXX */
int (*get_power)(struct backlight_device *);
/* Enable or disable power to the LCD (0: on; 4: off, see FB_BLANK_XXX) */
int (*set_power)(struct backlight_device *, int power);
/* Maximal value for brightness (read-only) */
int max_brightness;
/* Get current backlight brightness */
int (*get_brightness)(struct backlight_device *);
/* Set backlight brightness (0..max_brightness) */
int (*set_brightness)(struct backlight_device *, int brightness);
/* Check if given framebuffer device is the one bound to this backlight;
return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */
int (*check_fb)(struct fb_info *);
};
struct backlight_device {
/* This protects the 'props' field. If 'props' is NULL, the driver that
registered this device has been unloaded, and if class_get_devdata()
points to something in the body of that driver, it is also invalid. */
struct semaphore sem;
/* If this is NULL, the backing module is unloaded */
struct backlight_properties *props;
/* The framebuffer notifier block */
struct notifier_block fb_notif;
/* The class device structure */
struct class_device class_dev;
};
extern struct backlight_device *backlight_device_register(const char *name,
void *devdata, struct backlight_properties *bp);
extern void backlight_device_unregister(struct backlight_device *bd);
#define to_backlight_device(obj) container_of(obj, struct backlight_device, class_dev)
#endif

39
include/linux/baycom.h Normal file
View File

@@ -0,0 +1,39 @@
/*
* The Linux BAYCOM driver for the Baycom serial 1200 baud modem
* and the parallel 9600 baud modem
* (C) 1997-1998 by Thomas Sailer, HB9JNX/AE4WA
*/
#ifndef _BAYCOM_H
#define _BAYCOM_H
/* -------------------------------------------------------------------- */
/*
* structs for the IOCTL commands
*/
struct baycom_debug_data {
unsigned long debug1;
unsigned long debug2;
long debug3;
};
struct baycom_ioctl {
int cmd;
union {
struct baycom_debug_data dbg;
} data;
};
/* -------------------------------------------------------------------- */
/*
* ioctl values change for baycom
*/
#define BAYCOMCTL_GETDEBUG 0x92
/* -------------------------------------------------------------------- */
#endif /* _BAYCOM_H */
/* --------------------------------------------------------------------- */

20
include/linux/bcd.h Normal file
View File

@@ -0,0 +1,20 @@
/* Permission is hereby granted to copy, modify and redistribute this code
* in terms of the GNU Library General Public License, Version 2 or later,
* at your option.
*/
/* macros to translate to/from binary and binary-coded decimal (frequently
* found in RTC chips).
*/
#ifndef _BCD_H
#define _BCD_H
#define BCD2BIN(val) (((val) & 0x0f) + ((val)>>4)*10)
#define BIN2BCD(val) ((((val)/10)<<4) + (val)%10)
/* backwards compat */
#define BCD_TO_BIN(val) ((val)=BCD2BIN(val))
#define BIN_TO_BCD(val) ((val)=BIN2BCD(val))
#endif /* _BCD_H */

79
include/linux/bfs_fs.h Normal file
View File

@@ -0,0 +1,79 @@
/*
* include/linux/bfs_fs.h - BFS data structures on disk.
* Copyright (C) 1999 Tigran Aivazian <tigran@veritas.com>
*/
#ifndef _LINUX_BFS_FS_H
#define _LINUX_BFS_FS_H
#define BFS_BSIZE_BITS 9
#define BFS_BSIZE (1<<BFS_BSIZE_BITS)
#define BFS_MAGIC 0x1BADFACE
#define BFS_ROOT_INO 2
#define BFS_INODES_PER_BLOCK 8
/* SVR4 vnode type values (bfs_inode->i_vtype) */
#define BFS_VDIR 2
#define BFS_VREG 1
/* BFS inode layout on disk */
struct bfs_inode {
__u16 i_ino;
__u16 i_unused;
__u32 i_sblock;
__u32 i_eblock;
__u32 i_eoffset;
__u32 i_vtype;
__u32 i_mode;
__s32 i_uid;
__s32 i_gid;
__u32 i_nlink;
__u32 i_atime;
__u32 i_mtime;
__u32 i_ctime;
__u32 i_padding[4];
};
#define BFS_NAMELEN 14
#define BFS_DIRENT_SIZE 16
#define BFS_DIRS_PER_BLOCK 32
struct bfs_dirent {
__u16 ino;
char name[BFS_NAMELEN];
};
/* BFS superblock layout on disk */
struct bfs_super_block {
__u32 s_magic;
__u32 s_start;
__u32 s_end;
__s32 s_from;
__s32 s_to;
__s32 s_bfrom;
__s32 s_bto;
char s_fsname[6];
char s_volume[6];
__u32 s_padding[118];
};
#define BFS_NZFILESIZE(ip) \
(((ip)->i_eoffset + 1) - (ip)->i_sblock * BFS_BSIZE)
#define BFS_FILESIZE(ip) \
((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip))
#define BFS_FILEBLOCKS(ip) \
((ip)->i_sblock == 0 ? 0 : ((ip)->i_eblock + 1) - (ip)->i_sblock)
#define BFS_OFF2INO(offset) \
((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO)
#define BFS_INO2OFF(ino) \
((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE)
#define BFS_UNCLEAN(bfs_sb, sb) \
((bfs_sb->s_from != -1) && (bfs_sb->s_to != -1) && !(sb->s_flags & MS_RDONLY))
#endif /* _LINUX_BFS_FS_H */

87
include/linux/binfmts.h Normal file
View File

@@ -0,0 +1,87 @@
#ifndef _LINUX_BINFMTS_H
#define _LINUX_BINFMTS_H
#include <linux/capability.h>
struct pt_regs;
/*
* MAX_ARG_PAGES defines the number of pages allocated for arguments
* and envelope for the new program. 32 should suffice, this gives
* a maximum env+arg of 128kB w/4KB pages!
*/
#define MAX_ARG_PAGES 32
/* sizeof(linux_binprm->buf) */
#define BINPRM_BUF_SIZE 128
#ifdef __KERNEL__
/*
* This structure is used to hold the arguments that are used when loading binaries.
*/
struct linux_binprm{
char buf[BINPRM_BUF_SIZE];
struct page *page[MAX_ARG_PAGES];
struct mm_struct *mm;
unsigned long p; /* current top of mem */
int sh_bang;
struct file * file;
int e_uid, e_gid;
kernel_cap_t cap_inheritable, cap_permitted, cap_effective;
void *security;
int argc, envc;
char * filename; /* Name of binary as seen by procps */
char * interp; /* Name of the binary really executed. Most
of the time same as filename, but could be
different for binfmt_{misc,script} */
unsigned interp_flags;
unsigned interp_data;
unsigned long loader, exec;
};
#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0
#define BINPRM_FLAGS_ENFORCE_NONDUMP (1 << BINPRM_FLAGS_ENFORCE_NONDUMP_BIT)
/* fd of the binary should be passed to the interpreter */
#define BINPRM_FLAGS_EXECFD_BIT 1
#define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT)
/*
* This structure defines the functions that are used to load the binary formats that
* linux accepts.
*/
struct linux_binfmt {
struct linux_binfmt * next;
struct module *module;
int (*load_binary)(struct linux_binprm *, struct pt_regs * regs);
int (*load_shlib)(struct file *);
int (*core_dump)(long signr, struct pt_regs * regs, struct file * file);
unsigned long min_coredump; /* minimal dump size */
};
extern int register_binfmt(struct linux_binfmt *);
extern int unregister_binfmt(struct linux_binfmt *);
extern int prepare_binprm(struct linux_binprm *);
extern void remove_arg_zero(struct linux_binprm *);
extern int search_binary_handler(struct linux_binprm *,struct pt_regs *);
extern int flush_old_exec(struct linux_binprm * bprm);
/* Stack area protections */
#define EXSTACK_DEFAULT 0 /* Whatever the arch defaults to */
#define EXSTACK_DISABLE_X 1 /* Disable executable stacks */
#define EXSTACK_ENABLE_X 2 /* Enable executable stacks */
extern int setup_arg_pages(struct linux_binprm * bprm,
unsigned long stack_top,
int executable_stack);
extern int copy_strings(int argc,char __user * __user * argv,struct linux_binprm *bprm);
extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm);
extern void compute_creds(struct linux_binprm *binprm);
extern int do_coredump(long signr, int exit_code, struct pt_regs * regs);
extern int set_binfmt(struct linux_binfmt *new);
#endif /* __KERNEL__ */
#endif /* _LINUX_BINFMTS_H */

339
include/linux/bio.h Normal file
View File

@@ -0,0 +1,339 @@
/*
* 2.5 block I/O model
*
* Copyright (C) 2001 Jens Axboe <axboe@suse.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* 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 Licens
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-
*/
#ifndef __LINUX_BIO_H
#define __LINUX_BIO_H
#include <linux/highmem.h>
#include <linux/mempool.h>
/* Platforms may set this to teach the BIO layer about IOMMU hardware. */
#include <asm/io.h>
#if defined(BIO_VMERGE_MAX_SIZE) && defined(BIO_VMERGE_BOUNDARY)
#define BIOVEC_VIRT_START_SIZE(x) (bvec_to_phys(x) & (BIO_VMERGE_BOUNDARY - 1))
#define BIOVEC_VIRT_OVERSIZE(x) ((x) > BIO_VMERGE_MAX_SIZE)
#else
#define BIOVEC_VIRT_START_SIZE(x) 0
#define BIOVEC_VIRT_OVERSIZE(x) 0
#endif
#ifndef BIO_VMERGE_BOUNDARY
#define BIO_VMERGE_BOUNDARY 0
#endif
#define BIO_DEBUG
#ifdef BIO_DEBUG
#define BIO_BUG_ON BUG_ON
#else
#define BIO_BUG_ON
#endif
#define BIO_MAX_PAGES (256)
#define BIO_MAX_SIZE (BIO_MAX_PAGES << PAGE_CACHE_SHIFT)
#define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9)
/*
* was unsigned short, but we might as well be ready for > 64kB I/O pages
*/
struct bio_vec {
struct page *bv_page;
unsigned int bv_len;
unsigned int bv_offset;
};
struct bio_set;
struct bio;
typedef int (bio_end_io_t) (struct bio *, unsigned int, int);
typedef void (bio_destructor_t) (struct bio *);
/*
* main unit of I/O for the block layer and lower layers (ie drivers and
* stacking drivers)
*/
struct bio {
sector_t bi_sector;
struct bio *bi_next; /* request queue link */
struct block_device *bi_bdev;
unsigned long bi_flags; /* status, command, etc */
unsigned long bi_rw; /* bottom bits READ/WRITE,
* top bits priority
*/
unsigned short bi_vcnt; /* how many bio_vec's */
unsigned short bi_idx; /* current index into bvl_vec */
/* Number of segments in this BIO after
* physical address coalescing is performed.
*/
unsigned short bi_phys_segments;
/* Number of segments after physical and DMA remapping
* hardware coalescing is performed.
*/
unsigned short bi_hw_segments;
unsigned int bi_size; /* residual I/O count */
/*
* To keep track of the max hw size, we account for the
* sizes of the first and last virtually mergeable segments
* in this bio
*/
unsigned int bi_hw_front_size;
unsigned int bi_hw_back_size;
unsigned int bi_max_vecs; /* max bvl_vecs we can hold */
struct bio_vec *bi_io_vec; /* the actual vec list */
bio_end_io_t *bi_end_io;
atomic_t bi_cnt; /* pin count */
void *bi_private;
bio_destructor_t *bi_destructor; /* destructor */
struct bio_set *bi_set; /* memory pools set */
};
/*
* bio flags
*/
#define BIO_UPTODATE 0 /* ok after I/O completion */
#define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */
#define BIO_EOF 2 /* out-out-bounds error */
#define BIO_SEG_VALID 3 /* nr_hw_seg valid */
#define BIO_CLONED 4 /* doesn't own data */
#define BIO_BOUNCED 5 /* bio is a bounce bio */
#define BIO_USER_MAPPED 6 /* contains user pages */
#define BIO_EOPNOTSUPP 7 /* not supported */
#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
/*
* top 4 bits of bio flags indicate the pool this bio came from
*/
#define BIO_POOL_BITS (4)
#define BIO_POOL_OFFSET (BITS_PER_LONG - BIO_POOL_BITS)
#define BIO_POOL_MASK (1UL << BIO_POOL_OFFSET)
#define BIO_POOL_IDX(bio) ((bio)->bi_flags >> BIO_POOL_OFFSET)
/*
* bio bi_rw flags
*
* bit 0 -- read (not set) or write (set)
* bit 1 -- rw-ahead when set
* bit 2 -- barrier
* bit 3 -- fail fast, don't want low level driver retries
* bit 4 -- synchronous I/O hint: the block layer will unplug immediately
*/
#define BIO_RW 0
#define BIO_RW_AHEAD 1
#define BIO_RW_BARRIER 2
#define BIO_RW_FAILFAST 3
#define BIO_RW_SYNC 4
/*
* various member access, note that bio_data should of course not be used
* on highmem page vectors
*/
#define bio_iovec_idx(bio, idx) (&((bio)->bi_io_vec[(idx)]))
#define bio_iovec(bio) bio_iovec_idx((bio), (bio)->bi_idx)
#define bio_page(bio) bio_iovec((bio))->bv_page
#define bio_offset(bio) bio_iovec((bio))->bv_offset
#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx)
#define bio_sectors(bio) ((bio)->bi_size >> 9)
#define bio_cur_sectors(bio) (bio_iovec(bio)->bv_len >> 9)
#define bio_data(bio) (page_address(bio_page((bio))) + bio_offset((bio)))
#define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER))
#define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC))
#define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST))
#define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD))
/*
* will die
*/
#define bio_to_phys(bio) (page_to_phys(bio_page((bio))) + (unsigned long) bio_offset((bio)))
#define bvec_to_phys(bv) (page_to_phys((bv)->bv_page) + (unsigned long) (bv)->bv_offset)
/*
* queues that have highmem support enabled may still need to revert to
* PIO transfers occasionally and thus map high pages temporarily. For
* permanent PIO fall back, user is probably better off disabling highmem
* I/O completely on that queue (see ide-dma for example)
*/
#define __bio_kmap_atomic(bio, idx, kmtype) \
(kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page, kmtype) + \
bio_iovec_idx((bio), (idx))->bv_offset)
#define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr, kmtype)
/*
* merge helpers etc
*/
#define __BVEC_END(bio) bio_iovec_idx((bio), (bio)->bi_vcnt - 1)
#define __BVEC_START(bio) bio_iovec_idx((bio), (bio)->bi_idx)
/*
* allow arch override, for eg virtualized architectures (put in asm/io.h)
*/
#ifndef BIOVEC_PHYS_MERGEABLE
#define BIOVEC_PHYS_MERGEABLE(vec1, vec2) \
((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2)))
#endif
#define BIOVEC_VIRT_MERGEABLE(vec1, vec2) \
((((bvec_to_phys((vec1)) + (vec1)->bv_len) | bvec_to_phys((vec2))) & (BIO_VMERGE_BOUNDARY - 1)) == 0)
#define __BIO_SEG_BOUNDARY(addr1, addr2, mask) \
(((addr1) | (mask)) == (((addr2) - 1) | (mask)))
#define BIOVEC_SEG_BOUNDARY(q, b1, b2) \
__BIO_SEG_BOUNDARY(bvec_to_phys((b1)), bvec_to_phys((b2)) + (b2)->bv_len, (q)->seg_boundary_mask)
#define BIO_SEG_BOUNDARY(q, b1, b2) \
BIOVEC_SEG_BOUNDARY((q), __BVEC_END((b1)), __BVEC_START((b2)))
#define bio_io_error(bio, bytes) bio_endio((bio), (bytes), -EIO)
/*
* drivers should not use the __ version unless they _really_ want to
* run through the entire bio and not just pending pieces
*/
#define __bio_for_each_segment(bvl, bio, i, start_idx) \
for (bvl = bio_iovec_idx((bio), (start_idx)), i = (start_idx); \
i < (bio)->bi_vcnt; \
bvl++, i++)
#define bio_for_each_segment(bvl, bio, i) \
__bio_for_each_segment(bvl, bio, i, (bio)->bi_idx)
/*
* get a reference to a bio, so it won't disappear. the intended use is
* something like:
*
* bio_get(bio);
* submit_bio(rw, bio);
* if (bio->bi_flags ...)
* do_something
* bio_put(bio);
*
* without the bio_get(), it could potentially complete I/O before submit_bio
* returns. and then bio would be freed memory when if (bio->bi_flags ...)
* runs
*/
#define bio_get(bio) atomic_inc(&(bio)->bi_cnt)
/*
* A bio_pair is used when we need to split a bio.
* This can only happen for a bio that refers to just one
* page of data, and in the unusual situation when the
* page crosses a chunk/device boundary
*
* The address of the master bio is stored in bio1.bi_private
* The address of the pool the pair was allocated from is stored
* in bio2.bi_private
*/
struct bio_pair {
struct bio bio1, bio2;
struct bio_vec bv1, bv2;
atomic_t cnt;
int error;
};
extern struct bio_pair *bio_split(struct bio *bi, mempool_t *pool,
int first_sectors);
extern mempool_t *bio_split_pool;
extern void bio_pair_release(struct bio_pair *dbio);
extern struct bio_set *bioset_create(int, int, int);
extern void bioset_free(struct bio_set *);
extern struct bio *bio_alloc(unsigned int __nocast, int);
extern struct bio *bio_alloc_bioset(unsigned int __nocast, int, struct bio_set *);
extern void bio_put(struct bio *);
extern void bio_endio(struct bio *, unsigned int, int);
struct request_queue;
extern int bio_phys_segments(struct request_queue *, struct bio *);
extern int bio_hw_segments(struct request_queue *, struct bio *);
extern void __bio_clone(struct bio *, struct bio *);
extern struct bio *bio_clone(struct bio *, unsigned int __nocast);
extern void bio_init(struct bio *);
extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int);
extern int bio_get_nr_vecs(struct block_device *);
extern struct bio *bio_map_user(struct request_queue *, struct block_device *,
unsigned long, unsigned int, int);
extern void bio_unmap_user(struct bio *);
extern void bio_set_pages_dirty(struct bio *bio);
extern void bio_check_pages_dirty(struct bio *bio);
extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int);
extern int bio_uncopy_user(struct bio *);
void zero_fill_bio(struct bio *bio);
#ifdef CONFIG_HIGHMEM
/*
* remember to add offset! and never ever reenable interrupts between a
* bvec_kmap_irq and bvec_kunmap_irq!!
*
* This function MUST be inlined - it plays with the CPU interrupt flags.
* Hence the `extern inline'.
*/
extern inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
{
unsigned long addr;
/*
* might not be a highmem page, but the preempt/irq count
* balancing is a lot nicer this way
*/
local_irq_save(*flags);
addr = (unsigned long) kmap_atomic(bvec->bv_page, KM_BIO_SRC_IRQ);
BUG_ON(addr & ~PAGE_MASK);
return (char *) addr + bvec->bv_offset;
}
extern inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
{
unsigned long ptr = (unsigned long) buffer & PAGE_MASK;
kunmap_atomic((void *) ptr, KM_BIO_SRC_IRQ);
local_irq_restore(*flags);
}
#else
#define bvec_kmap_irq(bvec, flags) (page_address((bvec)->bv_page) + (bvec)->bv_offset)
#define bvec_kunmap_irq(buf, flags) do { *(flags) = 0; } while (0)
#endif
extern inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
unsigned long *flags)
{
return bvec_kmap_irq(bio_iovec_idx(bio, idx), flags);
}
#define __bio_kunmap_irq(buf, flags) bvec_kunmap_irq(buf, flags)
#define bio_kmap_irq(bio, flags) \
__bio_kmap_irq((bio), (bio)->bi_idx, (flags))
#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags)
#endif /* __LINUX_BIO_H */

261
include/linux/bitmap.h Normal file
View File

@@ -0,0 +1,261 @@
#ifndef __LINUX_BITMAP_H
#define __LINUX_BITMAP_H
#ifndef __ASSEMBLY__
#include <linux/types.h>
#include <linux/bitops.h>
#include <linux/string.h>
/*
* bitmaps provide bit arrays that consume one or more unsigned
* longs. The bitmap interface and available operations are listed
* here, in bitmap.h
*
* Function implementations generic to all architectures are in
* lib/bitmap.c. Functions implementations that are architecture
* specific are in various include/asm-<arch>/bitops.h headers
* and other arch/<arch> specific files.
*
* See lib/bitmap.c for more details.
*/
/*
* The available bitmap operations and their rough meaning in the
* case that the bitmap is a single unsigned long are thus:
*
* bitmap_zero(dst, nbits) *dst = 0UL
* bitmap_fill(dst, nbits) *dst = ~0UL
* bitmap_copy(dst, src, nbits) *dst = *src
* bitmap_and(dst, src1, src2, nbits) *dst = *src1 & *src2
* bitmap_or(dst, src1, src2, nbits) *dst = *src1 | *src2
* bitmap_xor(dst, src1, src2, nbits) *dst = *src1 ^ *src2
* bitmap_andnot(dst, src1, src2, nbits) *dst = *src1 & ~(*src2)
* bitmap_complement(dst, src, nbits) *dst = ~(*src)
* bitmap_equal(src1, src2, nbits) Are *src1 and *src2 equal?
* bitmap_intersects(src1, src2, nbits) Do *src1 and *src2 overlap?
* bitmap_subset(src1, src2, nbits) Is *src1 a subset of *src2?
* bitmap_empty(src, nbits) Are all bits zero in *src?
* bitmap_full(src, nbits) Are all bits set in *src?
* bitmap_weight(src, nbits) Hamming Weight: number set bits
* bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n
* bitmap_shift_left(dst, src, n, nbits) *dst = *src << n
* bitmap_scnprintf(buf, len, src, nbits) Print bitmap src to buf
* bitmap_parse(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf
* bitmap_scnlistprintf(buf, len, src, nbits) Print bitmap src as list to buf
* bitmap_parselist(buf, dst, nbits) Parse bitmap dst from list
*/
/*
* Also the following operations in asm/bitops.h apply to bitmaps.
*
* set_bit(bit, addr) *addr |= bit
* clear_bit(bit, addr) *addr &= ~bit
* change_bit(bit, addr) *addr ^= bit
* test_bit(bit, addr) Is bit set in *addr?
* test_and_set_bit(bit, addr) Set bit and return old value
* test_and_clear_bit(bit, addr) Clear bit and return old value
* test_and_change_bit(bit, addr) Change bit and return old value
* find_first_zero_bit(addr, nbits) Position first zero bit in *addr
* find_first_bit(addr, nbits) Position first set bit in *addr
* find_next_zero_bit(addr, nbits, bit) Position next zero bit in *addr >= bit
* find_next_bit(addr, nbits, bit) Position next set bit in *addr >= bit
*/
/*
* The DECLARE_BITMAP(name,bits) macro, in linux/types.h, can be used
* to declare an array named 'name' of just enough unsigned longs to
* contain all bit positions from 0 to 'bits' - 1.
*/
/*
* lib/bitmap.c provides these functions:
*/
extern int __bitmap_empty(const unsigned long *bitmap, int bits);
extern int __bitmap_full(const unsigned long *bitmap, int bits);
extern int __bitmap_equal(const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits);
extern void __bitmap_complement(unsigned long *dst, const unsigned long *src,
int bits);
extern void __bitmap_shift_right(unsigned long *dst,
const unsigned long *src, int shift, int bits);
extern void __bitmap_shift_left(unsigned long *dst,
const unsigned long *src, int shift, int bits);
extern void __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits);
extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits);
extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits);
extern void __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits);
extern int __bitmap_intersects(const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits);
extern int __bitmap_subset(const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits);
extern int __bitmap_weight(const unsigned long *bitmap, int bits);
extern int bitmap_scnprintf(char *buf, unsigned int len,
const unsigned long *src, int nbits);
extern int bitmap_parse(const char __user *ubuf, unsigned int ulen,
unsigned long *dst, int nbits);
extern int bitmap_scnlistprintf(char *buf, unsigned int len,
const unsigned long *src, int nbits);
extern int bitmap_parselist(const char *buf, unsigned long *maskp,
int nmaskbits);
extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order);
extern void bitmap_release_region(unsigned long *bitmap, int pos, int order);
extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order);
#define BITMAP_LAST_WORD_MASK(nbits) \
( \
((nbits) % BITS_PER_LONG) ? \
(1UL<<((nbits) % BITS_PER_LONG))-1 : ~0UL \
)
static inline void bitmap_zero(unsigned long *dst, int nbits)
{
if (nbits <= BITS_PER_LONG)
*dst = 0UL;
else {
int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
memset(dst, 0, len);
}
}
static inline void bitmap_fill(unsigned long *dst, int nbits)
{
size_t nlongs = BITS_TO_LONGS(nbits);
if (nlongs > 1) {
int len = (nlongs - 1) * sizeof(unsigned long);
memset(dst, 0xff, len);
}
dst[nlongs - 1] = BITMAP_LAST_WORD_MASK(nbits);
}
static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
int nbits)
{
if (nbits <= BITS_PER_LONG)
*dst = *src;
else {
int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
memcpy(dst, src, len);
}
}
static inline void bitmap_and(unsigned long *dst, const unsigned long *src1,
const unsigned long *src2, int nbits)
{
if (nbits <= BITS_PER_LONG)
*dst = *src1 & *src2;
else
__bitmap_and(dst, src1, src2, nbits);
}
static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
const unsigned long *src2, int nbits)
{
if (nbits <= BITS_PER_LONG)
*dst = *src1 | *src2;
else
__bitmap_or(dst, src1, src2, nbits);
}
static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
const unsigned long *src2, int nbits)
{
if (nbits <= BITS_PER_LONG)
*dst = *src1 ^ *src2;
else
__bitmap_xor(dst, src1, src2, nbits);
}
static inline void bitmap_andnot(unsigned long *dst, const unsigned long *src1,
const unsigned long *src2, int nbits)
{
if (nbits <= BITS_PER_LONG)
*dst = *src1 & ~(*src2);
else
__bitmap_andnot(dst, src1, src2, nbits);
}
static inline void bitmap_complement(unsigned long *dst, const unsigned long *src,
int nbits)
{
if (nbits <= BITS_PER_LONG)
*dst = ~(*src) & BITMAP_LAST_WORD_MASK(nbits);
else
__bitmap_complement(dst, src, nbits);
}
static inline int bitmap_equal(const unsigned long *src1,
const unsigned long *src2, int nbits)
{
if (nbits <= BITS_PER_LONG)
return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits));
else
return __bitmap_equal(src1, src2, nbits);
}
static inline int bitmap_intersects(const unsigned long *src1,
const unsigned long *src2, int nbits)
{
if (nbits <= BITS_PER_LONG)
return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0;
else
return __bitmap_intersects(src1, src2, nbits);
}
static inline int bitmap_subset(const unsigned long *src1,
const unsigned long *src2, int nbits)
{
if (nbits <= BITS_PER_LONG)
return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits));
else
return __bitmap_subset(src1, src2, nbits);
}
static inline int bitmap_empty(const unsigned long *src, int nbits)
{
if (nbits <= BITS_PER_LONG)
return ! (*src & BITMAP_LAST_WORD_MASK(nbits));
else
return __bitmap_empty(src, nbits);
}
static inline int bitmap_full(const unsigned long *src, int nbits)
{
if (nbits <= BITS_PER_LONG)
return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits));
else
return __bitmap_full(src, nbits);
}
static inline int bitmap_weight(const unsigned long *src, int nbits)
{
return __bitmap_weight(src, nbits);
}
static inline void bitmap_shift_right(unsigned long *dst,
const unsigned long *src, int n, int nbits)
{
if (nbits <= BITS_PER_LONG)
*dst = *src >> n;
else
__bitmap_shift_right(dst, src, n, nbits);
}
static inline void bitmap_shift_left(unsigned long *dst,
const unsigned long *src, int n, int nbits)
{
if (nbits <= BITS_PER_LONG)
*dst = (*src << n) & BITMAP_LAST_WORD_MASK(nbits);
else
__bitmap_shift_left(dst, src, n, nbits);
}
#endif /* __ASSEMBLY__ */
#endif /* __LINUX_BITMAP_H */

159
include/linux/bitops.h Normal file
View File

@@ -0,0 +1,159 @@
#ifndef _LINUX_BITOPS_H
#define _LINUX_BITOPS_H
#include <asm/types.h>
/*
* ffs: find first bit set. This is defined the same way as
* the libc and compiler builtin ffs routines, therefore
* differs in spirit from the above ffz (man ffs).
*/
static inline int generic_ffs(int x)
{
int r = 1;
if (!x)
return 0;
if (!(x & 0xffff)) {
x >>= 16;
r += 16;
}
if (!(x & 0xff)) {
x >>= 8;
r += 8;
}
if (!(x & 0xf)) {
x >>= 4;
r += 4;
}
if (!(x & 3)) {
x >>= 2;
r += 2;
}
if (!(x & 1)) {
x >>= 1;
r += 1;
}
return r;
}
/*
* fls: find last bit set.
*/
static __inline__ int generic_fls(int x)
{
int r = 32;
if (!x)
return 0;
if (!(x & 0xffff0000u)) {
x <<= 16;
r -= 16;
}
if (!(x & 0xff000000u)) {
x <<= 8;
r -= 8;
}
if (!(x & 0xf0000000u)) {
x <<= 4;
r -= 4;
}
if (!(x & 0xc0000000u)) {
x <<= 2;
r -= 2;
}
if (!(x & 0x80000000u)) {
x <<= 1;
r -= 1;
}
return r;
}
/*
* Include this here because some architectures need generic_ffs/fls in
* scope
*/
#include <asm/bitops.h>
static __inline__ int get_bitmask_order(unsigned int count)
{
int order;
order = fls(count);
return order; /* We could be slightly more clever with -1 here... */
}
/*
* hweightN: returns the hamming weight (i.e. the number
* of bits set) of a N-bit word
*/
static inline unsigned int generic_hweight32(unsigned int w)
{
unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555);
res = (res & 0x33333333) + ((res >> 2) & 0x33333333);
res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F);
res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF);
return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF);
}
static inline unsigned int generic_hweight16(unsigned int w)
{
unsigned int res = (w & 0x5555) + ((w >> 1) & 0x5555);
res = (res & 0x3333) + ((res >> 2) & 0x3333);
res = (res & 0x0F0F) + ((res >> 4) & 0x0F0F);
return (res & 0x00FF) + ((res >> 8) & 0x00FF);
}
static inline unsigned int generic_hweight8(unsigned int w)
{
unsigned int res = (w & 0x55) + ((w >> 1) & 0x55);
res = (res & 0x33) + ((res >> 2) & 0x33);
return (res & 0x0F) + ((res >> 4) & 0x0F);
}
static inline unsigned long generic_hweight64(__u64 w)
{
#if BITS_PER_LONG < 64
return generic_hweight32((unsigned int)(w >> 32)) +
generic_hweight32((unsigned int)w);
#else
u64 res;
res = (w & 0x5555555555555555ul) + ((w >> 1) & 0x5555555555555555ul);
res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul);
res = (res & 0x0F0F0F0F0F0F0F0Ful) + ((res >> 4) & 0x0F0F0F0F0F0F0F0Ful);
res = (res & 0x00FF00FF00FF00FFul) + ((res >> 8) & 0x00FF00FF00FF00FFul);
res = (res & 0x0000FFFF0000FFFFul) + ((res >> 16) & 0x0000FFFF0000FFFFul);
return (res & 0x00000000FFFFFFFFul) + ((res >> 32) & 0x00000000FFFFFFFFul);
#endif
}
static inline unsigned long hweight_long(unsigned long w)
{
return sizeof(w) == 4 ? generic_hweight32(w) : generic_hweight64(w);
}
/*
* rol32 - rotate a 32-bit value left
*
* @word: value to rotate
* @shift: bits to roll
*/
static inline __u32 rol32(__u32 word, unsigned int shift)
{
return (word << shift) | (word >> (32 - shift));
}
/*
* ror32 - rotate a 32-bit value right
*
* @word: value to rotate
* @shift: bits to roll
*/
static inline __u32 ror32(__u32 word, unsigned int shift)
{
return (word >> shift) | (word << (32 - shift));
}
#endif

759
include/linux/blkdev.h Normal file
View File

@@ -0,0 +1,759 @@
#ifndef _LINUX_BLKDEV_H
#define _LINUX_BLKDEV_H
#include <linux/config.h>
#include <linux/major.h>
#include <linux/genhd.h>
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/workqueue.h>
#include <linux/pagemap.h>
#include <linux/backing-dev.h>
#include <linux/wait.h>
#include <linux/mempool.h>
#include <linux/bio.h>
#include <linux/module.h>
#include <linux/stringify.h>
#include <asm/scatterlist.h>
struct request_queue;
typedef struct request_queue request_queue_t;
struct elevator_queue;
typedef struct elevator_queue elevator_t;
struct request_pm_state;
#define BLKDEV_MIN_RQ 4
#define BLKDEV_MAX_RQ 128 /* Default maximum */
/*
* This is the per-process anticipatory I/O scheduler state.
*/
struct as_io_context {
spinlock_t lock;
void (*dtor)(struct as_io_context *aic); /* destructor */
void (*exit)(struct as_io_context *aic); /* called on task exit */
unsigned long state;
atomic_t nr_queued; /* queued reads & sync writes */
atomic_t nr_dispatched; /* number of requests gone to the drivers */
/* IO History tracking */
/* Thinktime */
unsigned long last_end_request;
unsigned long ttime_total;
unsigned long ttime_samples;
unsigned long ttime_mean;
/* Layout pattern */
unsigned int seek_samples;
sector_t last_request_pos;
u64 seek_total;
sector_t seek_mean;
};
struct cfq_queue;
struct cfq_io_context {
void (*dtor)(struct cfq_io_context *);
void (*exit)(struct cfq_io_context *);
struct io_context *ioc;
/*
* circular list of cfq_io_contexts belonging to a process io context
*/
struct list_head list;
struct cfq_queue *cfqq;
};
/*
* This is the per-process I/O subsystem state. It is refcounted and
* kmalloc'ed. Currently all fields are modified in process io context
* (apart from the atomic refcount), so require no locking.
*/
struct io_context {
atomic_t refcount;
pid_t pid;
/*
* For request batching
*/
unsigned long last_waited; /* Time last woken after wait for request */
int nr_batch_requests; /* Number of requests left in the batch */
spinlock_t lock;
struct as_io_context *aic;
struct cfq_io_context *cic;
};
void put_io_context(struct io_context *ioc);
void exit_io_context(void);
struct io_context *get_io_context(int gfp_flags);
void copy_io_context(struct io_context **pdst, struct io_context **psrc);
void swap_io_context(struct io_context **ioc1, struct io_context **ioc2);
struct request;
typedef void (rq_end_io_fn)(struct request *);
struct request_list {
int count[2];
int starved[2];
mempool_t *rq_pool;
wait_queue_head_t wait[2];
wait_queue_head_t drain;
};
#define BLK_MAX_CDB 16
/*
* try to put the fields that are referenced together in the same cacheline
*/
struct request {
struct list_head queuelist; /* looking for ->queue? you must _not_
* access it directly, use
* blkdev_dequeue_request! */
unsigned long flags; /* see REQ_ bits below */
/* Maintain bio traversal state for part by part I/O submission.
* hard_* are block layer internals, no driver should touch them!
*/
sector_t sector; /* next sector to submit */
unsigned long nr_sectors; /* no. of sectors left to submit */
/* no. of sectors left to submit in the current segment */
unsigned int current_nr_sectors;
sector_t hard_sector; /* next sector to complete */
unsigned long hard_nr_sectors; /* no. of sectors left to complete */
/* no. of sectors left to complete in the current segment */
unsigned int hard_cur_sectors;
struct bio *bio;
struct bio *biotail;
void *elevator_private;
int rq_status; /* should split this into a few status bits */
struct gendisk *rq_disk;
int errors;
unsigned long start_time;
/* Number of scatter-gather DMA addr+len pairs after
* physical address coalescing is performed.
*/
unsigned short nr_phys_segments;
/* Number of scatter-gather addr+len pairs after
* physical and DMA remapping hardware coalescing is performed.
* This is the number of scatter-gather entries the driver
* will actually have to deal with after DMA mapping is done.
*/
unsigned short nr_hw_segments;
int tag;
char *buffer;
int ref_count;
request_queue_t *q;
struct request_list *rl;
struct completion *waiting;
void *special;
/*
* when request is used as a packet command carrier
*/
unsigned int cmd_len;
unsigned char cmd[BLK_MAX_CDB];
unsigned int data_len;
void *data;
unsigned int sense_len;
void *sense;
unsigned int timeout;
/*
* For Power Management requests
*/
struct request_pm_state *pm;
/*
* completion callback. end_io_data should be folded in with waiting
*/
rq_end_io_fn *end_io;
void *end_io_data;
};
/*
* first three bits match BIO_RW* bits, important
*/
enum rq_flag_bits {
__REQ_RW, /* not set, read. set, write */
__REQ_FAILFAST, /* no low level driver retries */
__REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
__REQ_HARDBARRIER, /* may not be passed by drive either */
__REQ_CMD, /* is a regular fs rw request */
__REQ_NOMERGE, /* don't touch this for merging */
__REQ_STARTED, /* drive already may have started this one */
__REQ_DONTPREP, /* don't call prep for this one */
__REQ_QUEUED, /* uses queueing */
/*
* for ATA/ATAPI devices
*/
__REQ_PC, /* packet command (special) */
__REQ_BLOCK_PC, /* queued down pc from block layer */
__REQ_SENSE, /* sense retrival */
__REQ_FAILED, /* set if the request failed */
__REQ_QUIET, /* don't worry about errors */
__REQ_SPECIAL, /* driver suplied command */
__REQ_DRIVE_CMD,
__REQ_DRIVE_TASK,
__REQ_DRIVE_TASKFILE,
__REQ_PREEMPT, /* set for "ide_preempt" requests */
__REQ_PM_SUSPEND, /* suspend request */
__REQ_PM_RESUME, /* resume request */
__REQ_PM_SHUTDOWN, /* shutdown request */
__REQ_BAR_PREFLUSH, /* barrier pre-flush done */
__REQ_BAR_POSTFLUSH, /* barrier post-flush */
__REQ_BAR_FLUSH, /* rq is the flush request */
__REQ_NR_BITS, /* stops here */
};
#define REQ_RW (1 << __REQ_RW)
#define REQ_FAILFAST (1 << __REQ_FAILFAST)
#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER)
#define REQ_CMD (1 << __REQ_CMD)
#define REQ_NOMERGE (1 << __REQ_NOMERGE)
#define REQ_STARTED (1 << __REQ_STARTED)
#define REQ_DONTPREP (1 << __REQ_DONTPREP)
#define REQ_QUEUED (1 << __REQ_QUEUED)
#define REQ_PC (1 << __REQ_PC)
#define REQ_BLOCK_PC (1 << __REQ_BLOCK_PC)
#define REQ_SENSE (1 << __REQ_SENSE)
#define REQ_FAILED (1 << __REQ_FAILED)
#define REQ_QUIET (1 << __REQ_QUIET)
#define REQ_SPECIAL (1 << __REQ_SPECIAL)
#define REQ_DRIVE_CMD (1 << __REQ_DRIVE_CMD)
#define REQ_DRIVE_TASK (1 << __REQ_DRIVE_TASK)
#define REQ_DRIVE_TASKFILE (1 << __REQ_DRIVE_TASKFILE)
#define REQ_PREEMPT (1 << __REQ_PREEMPT)
#define REQ_PM_SUSPEND (1 << __REQ_PM_SUSPEND)
#define REQ_PM_RESUME (1 << __REQ_PM_RESUME)
#define REQ_PM_SHUTDOWN (1 << __REQ_PM_SHUTDOWN)
#define REQ_BAR_PREFLUSH (1 << __REQ_BAR_PREFLUSH)
#define REQ_BAR_POSTFLUSH (1 << __REQ_BAR_POSTFLUSH)
#define REQ_BAR_FLUSH (1 << __REQ_BAR_FLUSH)
/*
* State information carried for REQ_PM_SUSPEND and REQ_PM_RESUME
* requests. Some step values could eventually be made generic.
*/
struct request_pm_state
{
/* PM state machine step value, currently driver specific */
int pm_step;
/* requested PM state value (S1, S2, S3, S4, ...) */
u32 pm_state;
void* data; /* for driver use */
};
#include <linux/elevator.h>
typedef int (merge_request_fn) (request_queue_t *, struct request *,
struct bio *);
typedef int (merge_requests_fn) (request_queue_t *, struct request *,
struct request *);
typedef void (request_fn_proc) (request_queue_t *q);
typedef int (make_request_fn) (request_queue_t *q, struct bio *bio);
typedef int (prep_rq_fn) (request_queue_t *, struct request *);
typedef void (unplug_fn) (request_queue_t *);
struct bio_vec;
typedef int (merge_bvec_fn) (request_queue_t *, struct bio *, struct bio_vec *);
typedef void (activity_fn) (void *data, int rw);
typedef int (issue_flush_fn) (request_queue_t *, struct gendisk *, sector_t *);
typedef int (prepare_flush_fn) (request_queue_t *, struct request *);
typedef void (end_flush_fn) (request_queue_t *, struct request *);
enum blk_queue_state {
Queue_down,
Queue_up,
};
#define BLK_TAGS_PER_LONG (sizeof(unsigned long) * 8)
#define BLK_TAGS_MASK (BLK_TAGS_PER_LONG - 1)
struct blk_queue_tag {
struct request **tag_index; /* map of busy tags */
unsigned long *tag_map; /* bit map of free/busy tags */
struct list_head busy_list; /* fifo list of busy tags */
int busy; /* current depth */
int max_depth; /* what we will send to device */
int real_max_depth; /* what the array can hold */
atomic_t refcnt; /* map can be shared */
};
struct request_queue
{
/*
* Together with queue_head for cacheline sharing
*/
struct list_head queue_head;
struct request *last_merge;
elevator_t *elevator;
/*
* the queue request freelist, one for reads and one for writes
*/
struct request_list rq;
request_fn_proc *request_fn;
merge_request_fn *back_merge_fn;
merge_request_fn *front_merge_fn;
merge_requests_fn *merge_requests_fn;
make_request_fn *make_request_fn;
prep_rq_fn *prep_rq_fn;
unplug_fn *unplug_fn;
merge_bvec_fn *merge_bvec_fn;
activity_fn *activity_fn;
issue_flush_fn *issue_flush_fn;
prepare_flush_fn *prepare_flush_fn;
end_flush_fn *end_flush_fn;
/*
* Auto-unplugging state
*/
struct timer_list unplug_timer;
int unplug_thresh; /* After this many requests */
unsigned long unplug_delay; /* After this many jiffies */
struct work_struct unplug_work;
struct backing_dev_info backing_dev_info;
/*
* The queue owner gets to use this for whatever they like.
* ll_rw_blk doesn't touch it.
*/
void *queuedata;
void *activity_data;
/*
* queue needs bounce pages for pages above this limit
*/
unsigned long bounce_pfn;
unsigned int bounce_gfp;
/*
* various queue flags, see QUEUE_* below
*/
unsigned long queue_flags;
/*
* protects queue structures from reentrancy
*/
spinlock_t *queue_lock;
/*
* queue kobject
*/
struct kobject kobj;
/*
* queue settings
*/
unsigned long nr_requests; /* Max # of requests */
unsigned int nr_congestion_on;
unsigned int nr_congestion_off;
unsigned int nr_batching;
unsigned short max_sectors;
unsigned short max_hw_sectors;
unsigned short max_phys_segments;
unsigned short max_hw_segments;
unsigned short hardsect_size;
unsigned int max_segment_size;
unsigned long seg_boundary_mask;
unsigned int dma_alignment;
struct blk_queue_tag *queue_tags;
atomic_t refcnt;
unsigned int in_flight;
/*
* sg stuff
*/
unsigned int sg_timeout;
unsigned int sg_reserved_size;
struct list_head drain_list;
/*
* reserved for flush operations
*/
struct request *flush_rq;
unsigned char ordered;
};
enum {
QUEUE_ORDERED_NONE,
QUEUE_ORDERED_TAG,
QUEUE_ORDERED_FLUSH,
};
#define RQ_INACTIVE (-1)
#define RQ_ACTIVE 1
#define RQ_SCSI_BUSY 0xffff
#define RQ_SCSI_DONE 0xfffe
#define RQ_SCSI_DISCONNECTING 0xffe0
#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */
#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
#define QUEUE_FLAG_STOPPED 2 /* queue is stopped */
#define QUEUE_FLAG_READFULL 3 /* write queue has been filled */
#define QUEUE_FLAG_WRITEFULL 4 /* read queue has been filled */
#define QUEUE_FLAG_DEAD 5 /* queue being torn down */
#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */
#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */
#define QUEUE_FLAG_DRAIN 8 /* draining queue for sched switch */
#define QUEUE_FLAG_FLUSH 9 /* doing barrier flush sequence */
#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags)
#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
#define blk_queue_flushing(q) test_bit(QUEUE_FLAG_FLUSH, &(q)->queue_flags)
#define blk_fs_request(rq) ((rq)->flags & REQ_CMD)
#define blk_pc_request(rq) ((rq)->flags & REQ_BLOCK_PC)
#define blk_noretry_request(rq) ((rq)->flags & REQ_FAILFAST)
#define blk_rq_started(rq) ((rq)->flags & REQ_STARTED)
#define blk_account_rq(rq) (blk_rq_started(rq) && blk_fs_request(rq))
#define blk_pm_suspend_request(rq) ((rq)->flags & REQ_PM_SUSPEND)
#define blk_pm_resume_request(rq) ((rq)->flags & REQ_PM_RESUME)
#define blk_pm_request(rq) \
((rq)->flags & (REQ_PM_SUSPEND | REQ_PM_RESUME))
#define blk_barrier_rq(rq) ((rq)->flags & REQ_HARDBARRIER)
#define blk_barrier_preflush(rq) ((rq)->flags & REQ_BAR_PREFLUSH)
#define blk_barrier_postflush(rq) ((rq)->flags & REQ_BAR_POSTFLUSH)
#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist)
#define rq_data_dir(rq) ((rq)->flags & 1)
static inline int blk_queue_full(struct request_queue *q, int rw)
{
if (rw == READ)
return test_bit(QUEUE_FLAG_READFULL, &q->queue_flags);
return test_bit(QUEUE_FLAG_WRITEFULL, &q->queue_flags);
}
static inline void blk_set_queue_full(struct request_queue *q, int rw)
{
if (rw == READ)
set_bit(QUEUE_FLAG_READFULL, &q->queue_flags);
else
set_bit(QUEUE_FLAG_WRITEFULL, &q->queue_flags);
}
static inline void blk_clear_queue_full(struct request_queue *q, int rw)
{
if (rw == READ)
clear_bit(QUEUE_FLAG_READFULL, &q->queue_flags);
else
clear_bit(QUEUE_FLAG_WRITEFULL, &q->queue_flags);
}
/*
* mergeable request must not have _NOMERGE or _BARRIER bit set, nor may
* it already be started by driver.
*/
#define RQ_NOMERGE_FLAGS \
(REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER)
#define rq_mergeable(rq) \
(!((rq)->flags & RQ_NOMERGE_FLAGS) && blk_fs_request((rq)))
/*
* noop, requests are automagically marked as active/inactive by I/O
* scheduler -- see elv_next_request
*/
#define blk_queue_headactive(q, head_active)
/*
* q->prep_rq_fn return values
*/
#define BLKPREP_OK 0 /* serve it */
#define BLKPREP_KILL 1 /* fatal error, kill */
#define BLKPREP_DEFER 2 /* leave on queue */
extern unsigned long blk_max_low_pfn, blk_max_pfn;
/*
* standard bounce addresses:
*
* BLK_BOUNCE_HIGH : bounce all highmem pages
* BLK_BOUNCE_ANY : don't bounce anything
* BLK_BOUNCE_ISA : bounce pages above ISA DMA boundary
*/
#define BLK_BOUNCE_HIGH ((u64)blk_max_low_pfn << PAGE_SHIFT)
#define BLK_BOUNCE_ANY ((u64)blk_max_pfn << PAGE_SHIFT)
#define BLK_BOUNCE_ISA (ISA_DMA_THRESHOLD)
#ifdef CONFIG_MMU
extern int init_emergency_isa_pool(void);
extern void blk_queue_bounce(request_queue_t *q, struct bio **bio);
#else
static inline int init_emergency_isa_pool(void)
{
return 0;
}
static inline void blk_queue_bounce(request_queue_t *q, struct bio **bio)
{
}
#endif /* CONFIG_MMU */
#define rq_for_each_bio(_bio, rq) \
if ((rq->bio)) \
for (_bio = (rq)->bio; _bio; _bio = _bio->bi_next)
struct sec_size {
unsigned block_size;
unsigned block_size_bits;
};
extern int blk_register_queue(struct gendisk *disk);
extern void blk_unregister_queue(struct gendisk *disk);
extern void register_disk(struct gendisk *dev);
extern void generic_make_request(struct bio *bio);
extern void blk_put_request(struct request *);
extern void blk_end_sync_rq(struct request *rq);
extern void blk_attempt_remerge(request_queue_t *, struct request *);
extern void __blk_attempt_remerge(request_queue_t *, struct request *);
extern struct request *blk_get_request(request_queue_t *, int, int);
extern void blk_insert_request(request_queue_t *, struct request *, int, void *, int);
extern void blk_requeue_request(request_queue_t *, struct request *);
extern void blk_plug_device(request_queue_t *);
extern int blk_remove_plug(request_queue_t *);
extern void blk_recount_segments(request_queue_t *, struct bio *);
extern int blk_phys_contig_segment(request_queue_t *q, struct bio *, struct bio *);
extern int blk_hw_contig_segment(request_queue_t *q, struct bio *, struct bio *);
extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *);
extern void blk_start_queue(request_queue_t *q);
extern void blk_stop_queue(request_queue_t *q);
extern void blk_sync_queue(struct request_queue *q);
extern void __blk_stop_queue(request_queue_t *q);
extern void blk_run_queue(request_queue_t *);
extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *);
extern struct request *blk_rq_map_user(request_queue_t *, int, void __user *, unsigned int);
extern int blk_rq_unmap_user(struct request *, struct bio *, unsigned int);
extern int blk_execute_rq(request_queue_t *, struct gendisk *, struct request *);
static inline request_queue_t *bdev_get_queue(struct block_device *bdev)
{
return bdev->bd_disk->queue;
}
static inline void blk_run_backing_dev(struct backing_dev_info *bdi,
struct page *page)
{
if (bdi && bdi->unplug_io_fn)
bdi->unplug_io_fn(bdi, page);
}
static inline void blk_run_address_space(struct address_space *mapping)
{
if (mapping)
blk_run_backing_dev(mapping->backing_dev_info, NULL);
}
/*
* end_request() and friends. Must be called with the request queue spinlock
* acquired. All functions called within end_request() _must_be_ atomic.
*
* Several drivers define their own end_request and call
* end_that_request_first() and end_that_request_last()
* for parts of the original function. This prevents
* code duplication in drivers.
*/
extern int end_that_request_first(struct request *, int, int);
extern int end_that_request_chunk(struct request *, int, int);
extern void end_that_request_last(struct request *);
extern void end_request(struct request *req, int uptodate);
/*
* end_that_request_first/chunk() takes an uptodate argument. we account
* any value <= as an io error. 0 means -EIO for compatability reasons,
* any other < 0 value is the direct error type. An uptodate value of
* 1 indicates successful io completion
*/
#define end_io_error(uptodate) (unlikely((uptodate) <= 0))
static inline void blkdev_dequeue_request(struct request *req)
{
BUG_ON(list_empty(&req->queuelist));
list_del_init(&req->queuelist);
if (req->rl)
elv_remove_request(req->q, req);
}
/*
* Access functions for manipulating queue properties
*/
extern request_queue_t *blk_init_queue(request_fn_proc *, spinlock_t *);
extern void blk_cleanup_queue(request_queue_t *);
extern void blk_queue_make_request(request_queue_t *, make_request_fn *);
extern void blk_queue_bounce_limit(request_queue_t *, u64);
extern void blk_queue_max_sectors(request_queue_t *, unsigned short);
extern void blk_queue_max_phys_segments(request_queue_t *, unsigned short);
extern void blk_queue_max_hw_segments(request_queue_t *, unsigned short);
extern void blk_queue_max_segment_size(request_queue_t *, unsigned int);
extern void blk_queue_hardsect_size(request_queue_t *, unsigned short);
extern void blk_queue_stack_limits(request_queue_t *t, request_queue_t *b);
extern void blk_queue_segment_boundary(request_queue_t *, unsigned long);
extern void blk_queue_prep_rq(request_queue_t *, prep_rq_fn *pfn);
extern void blk_queue_merge_bvec(request_queue_t *, merge_bvec_fn *);
extern void blk_queue_dma_alignment(request_queue_t *, int);
extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
extern void blk_queue_ordered(request_queue_t *, int);
extern void blk_queue_issue_flush_fn(request_queue_t *, issue_flush_fn *);
extern int blkdev_scsi_issue_flush_fn(request_queue_t *, struct gendisk *, sector_t *);
extern struct request *blk_start_pre_flush(request_queue_t *,struct request *);
extern int blk_complete_barrier_rq(request_queue_t *, struct request *, int);
extern int blk_complete_barrier_rq_locked(request_queue_t *, struct request *, int);
extern int blk_rq_map_sg(request_queue_t *, struct request *, struct scatterlist *);
extern void blk_dump_rq_flags(struct request *, char *);
extern void generic_unplug_device(request_queue_t *);
extern void __generic_unplug_device(request_queue_t *);
extern long nr_blockdev_pages(void);
extern void blk_wait_queue_drained(request_queue_t *, int);
extern void blk_finish_queue_drain(request_queue_t *);
int blk_get_queue(request_queue_t *);
request_queue_t *blk_alloc_queue(int);
#define blk_put_queue(q) blk_cleanup_queue((q))
/*
* tag stuff
*/
#define blk_queue_tag_depth(q) ((q)->queue_tags->busy)
#define blk_queue_tag_queue(q) ((q)->queue_tags->busy < (q)->queue_tags->max_depth)
#define blk_rq_tagged(rq) ((rq)->flags & REQ_QUEUED)
extern int blk_queue_start_tag(request_queue_t *, struct request *);
extern struct request *blk_queue_find_tag(request_queue_t *, int);
extern void blk_queue_end_tag(request_queue_t *, struct request *);
extern int blk_queue_init_tags(request_queue_t *, int, struct blk_queue_tag *);
extern void blk_queue_free_tags(request_queue_t *);
extern int blk_queue_resize_tags(request_queue_t *, int);
extern void blk_queue_invalidate_tags(request_queue_t *);
extern long blk_congestion_wait(int rw, long timeout);
extern void blk_rq_bio_prep(request_queue_t *, struct request *, struct bio *);
extern int blkdev_issue_flush(struct block_device *, sector_t *);
#define MAX_PHYS_SEGMENTS 128
#define MAX_HW_SEGMENTS 128
#define MAX_SECTORS 255
#define MAX_SEGMENT_SIZE 65536
#define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist)
extern void drive_stat_acct(struct request *, int, int);
static inline int queue_hardsect_size(request_queue_t *q)
{
int retval = 512;
if (q && q->hardsect_size)
retval = q->hardsect_size;
return retval;
}
static inline int bdev_hardsect_size(struct block_device *bdev)
{
return queue_hardsect_size(bdev_get_queue(bdev));
}
static inline int queue_dma_alignment(request_queue_t *q)
{
int retval = 511;
if (q && q->dma_alignment)
retval = q->dma_alignment;
return retval;
}
static inline int bdev_dma_aligment(struct block_device *bdev)
{
return queue_dma_alignment(bdev_get_queue(bdev));
}
#define blk_finished_io(nsects) do { } while (0)
#define blk_started_io(nsects) do { } while (0)
/* assumes size > 256 */
static inline unsigned int blksize_bits(unsigned int size)
{
unsigned int bits = 8;
do {
bits++;
size >>= 1;
} while (size > 256);
return bits;
}
extern inline unsigned int block_size(struct block_device *bdev)
{
return bdev->bd_block_size;
}
typedef struct {struct page *v;} Sector;
unsigned char *read_dev_sector(struct block_device *, sector_t, Sector *);
static inline void put_dev_sector(Sector p)
{
page_cache_release(p.v);
}
struct work_struct;
int kblockd_schedule_work(struct work_struct *work);
void kblockd_flush(void);
#ifdef CONFIG_LBD
# include <asm/div64.h>
# define sector_div(a, b) do_div(a, b)
#else
# define sector_div(n, b)( \
{ \
int _res; \
_res = (n) % (b); \
(n) /= (b); \
_res; \
} \
)
#endif
#define MODULE_ALIAS_BLOCKDEV(major,minor) \
MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor))
#define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \
MODULE_ALIAS("block-major-" __stringify(major) "-*")
#endif

57
include/linux/blkpg.h Normal file
View File

@@ -0,0 +1,57 @@
#ifndef _LINUX_BLKPG_H
#define _LINUX_BLKPG_H
/*
* Partition table and disk geometry handling
*
* A single ioctl with lots of subfunctions:
*
* Device number stuff:
* get_whole_disk() (given the device number of a partition,
* find the device number of the encompassing disk)
* get_all_partitions() (given the device number of a disk, return the
* device numbers of all its known partitions)
*
* Partition stuff:
* add_partition()
* delete_partition()
* test_partition_in_use() (also for test_disk_in_use)
*
* Geometry stuff:
* get_geometry()
* set_geometry()
* get_bios_drivedata()
*
* For today, only the partition stuff - aeb, 990515
*/
#include <linux/ioctl.h>
#define BLKPG _IO(0x12,105)
/* The argument structure */
struct blkpg_ioctl_arg {
int op;
int flags;
int datalen;
void __user *data;
};
/* The subfunctions (for the op field) */
#define BLKPG_ADD_PARTITION 1
#define BLKPG_DEL_PARTITION 2
/* Sizes of name fields. Unused at present. */
#define BLKPG_DEVNAMELTH 64
#define BLKPG_VOLNAMELTH 64
/* The data structure for ADD_PARTITION and DEL_PARTITION */
struct blkpg_partition {
long long start; /* starting offset in bytes */
long long length; /* length in bytes */
int pno; /* partition number */
char devname[BLKPG_DEVNAMELTH]; /* partition name, like sda5 or c0d1p2,
to be used in kernel messages */
char volname[BLKPG_VOLNAMELTH]; /* volume label */
};
#endif /* _LINUX_BLKPG_H */

View File

@@ -0,0 +1,60 @@
#ifndef _LINUX_BLOCKGROUP_LOCK_H
#define _LINUX_BLOCKGROUP_LOCK_H
/*
* Per-blockgroup locking for ext2 and ext3.
*
* Simple hashed spinlocking.
*/
#include <linux/config.h>
#include <linux/spinlock.h>
#include <linux/cache.h>
#ifdef CONFIG_SMP
/*
* We want a power-of-two. Is there a better way than this?
*/
#if NR_CPUS >= 32
#define NR_BG_LOCKS 128
#elif NR_CPUS >= 16
#define NR_BG_LOCKS 64
#elif NR_CPUS >= 8
#define NR_BG_LOCKS 32
#elif NR_CPUS >= 4
#define NR_BG_LOCKS 16
#elif NR_CPUS >= 2
#define NR_BG_LOCKS 8
#else
#define NR_BG_LOCKS 4
#endif
#else /* CONFIG_SMP */
#define NR_BG_LOCKS 1
#endif /* CONFIG_SMP */
struct bgl_lock {
spinlock_t lock;
} ____cacheline_aligned_in_smp;
struct blockgroup_lock {
struct bgl_lock locks[NR_BG_LOCKS];
};
static inline void bgl_lock_init(struct blockgroup_lock *bgl)
{
int i;
for (i = 0; i < NR_BG_LOCKS; i++)
spin_lock_init(&bgl->locks[i].lock);
}
/*
* The accessor is a macro so we can embed a blockgroup_lock into different
* superblock types
*/
#define sb_bgl_lock(sb, block_group) \
(&(sb)->s_blockgroup_lock.locks[(block_group) & (NR_BG_LOCKS-1)].lock)
#endif

96
include/linux/bootmem.h Normal file
View File

@@ -0,0 +1,96 @@
/*
* Discontiguous memory support, Kanoj Sarcar, SGI, Nov 1999
*/
#ifndef _LINUX_BOOTMEM_H
#define _LINUX_BOOTMEM_H
#include <asm/pgtable.h>
#include <asm/dma.h>
#include <linux/cache.h>
#include <linux/init.h>
#include <linux/mmzone.h>
/*
* simple boot-time physical memory area allocator.
*/
extern unsigned long max_low_pfn;
extern unsigned long min_low_pfn;
/*
* highest page
*/
extern unsigned long max_pfn;
/*
* node_bootmem_map is a map pointer - the bits represent all physical
* memory pages (including holes) on the node.
*/
typedef struct bootmem_data {
unsigned long node_boot_start;
unsigned long node_low_pfn;
void *node_bootmem_map;
unsigned long last_offset;
unsigned long last_pos;
unsigned long last_success; /* Previous allocation point. To speed
* up searching */
} bootmem_data_t;
extern unsigned long __init bootmem_bootmap_pages (unsigned long);
extern unsigned long __init init_bootmem (unsigned long addr, unsigned long memend);
extern void __init free_bootmem (unsigned long addr, unsigned long size);
extern void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal);
#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
extern void __init reserve_bootmem (unsigned long addr, unsigned long size);
#define alloc_bootmem(x) \
__alloc_bootmem((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
#define alloc_bootmem_low(x) \
__alloc_bootmem((x), SMP_CACHE_BYTES, 0)
#define alloc_bootmem_pages(x) \
__alloc_bootmem((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
#define alloc_bootmem_low_pages(x) \
__alloc_bootmem((x), PAGE_SIZE, 0)
#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
extern unsigned long __init free_all_bootmem (void);
extern unsigned long __init init_bootmem_node (pg_data_t *pgdat, unsigned long freepfn, unsigned long startpfn, unsigned long endpfn);
extern void __init reserve_bootmem_node (pg_data_t *pgdat, unsigned long physaddr, unsigned long size);
extern void __init free_bootmem_node (pg_data_t *pgdat, unsigned long addr, unsigned long size);
extern unsigned long __init free_all_bootmem_node (pg_data_t *pgdat);
extern void * __init __alloc_bootmem_node (pg_data_t *pgdat, unsigned long size, unsigned long align, unsigned long goal);
#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
#define alloc_bootmem_node(pgdat, x) \
__alloc_bootmem_node((pgdat), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
#define alloc_bootmem_pages_node(pgdat, x) \
__alloc_bootmem_node((pgdat), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
#define alloc_bootmem_low_pages_node(pgdat, x) \
__alloc_bootmem_node((pgdat), (x), PAGE_SIZE, 0)
#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
extern unsigned long __initdata nr_kernel_pages;
extern unsigned long __initdata nr_all_pages;
extern void *__init alloc_large_system_hash(const char *tablename,
unsigned long bucketsize,
unsigned long numentries,
int scale,
int flags,
unsigned int *_hash_shift,
unsigned int *_hash_mask,
unsigned long limit);
#define HASH_HIGHMEM 0x00000001 /* Consider highmem? */
#define HASH_EARLY 0x00000002 /* Allocating during early boot? */
/* Only NUMA needs hash distribution.
* IA64 is known to have sufficient vmalloc space.
*/
#if defined(CONFIG_NUMA) && defined(CONFIG_IA64)
#define HASHDIST_DEFAULT 1
#else
#define HASHDIST_DEFAULT 0
#endif
extern int __initdata hashdist; /* Distribute hashes across NUMA nodes? */
#endif /* _LINUX_BOOTMEM_H */

41
include/linux/bpqether.h Normal file
View File

@@ -0,0 +1,41 @@
#ifndef __BPQETHER_H
#define __BPQETHER_H
/*
* Defines for the BPQETHER pseudo device driver
*/
#ifndef __LINUX_IF_ETHER_H
#include <linux/if_ether.h>
#endif
#define SIOCSBPQETHOPT (SIOCDEVPRIVATE+0) /* reserved */
#define SIOCSBPQETHADDR (SIOCDEVPRIVATE+1)
struct bpq_ethaddr {
unsigned char destination[ETH_ALEN];
unsigned char accept[ETH_ALEN];
};
/*
* For SIOCSBPQETHOPT - this is compatible with PI2/PacketTwin card drivers,
* currently not implemented, though. If someone wants to hook a radio
* to his Ethernet card he may find this useful. ;-)
*/
#define SIOCGBPQETHPARAM 0x5000 /* get Level 1 parameters */
#define SIOCSBPQETHPARAM 0x5001 /* set */
struct bpq_req {
int cmd;
int speed; /* unused */
int clockmode; /* unused */
int txdelay;
unsigned char persist; /* unused */
int slotime; /* unused */
int squeldelay;
int dmachan; /* unused */
int irq; /* unused */
};
#endif

296
include/linux/buffer_head.h Normal file
View File

@@ -0,0 +1,296 @@
/*
* include/linux/buffer_head.h
*
* Everything to do with buffer_heads.
*/
#ifndef _LINUX_BUFFER_HEAD_H
#define _LINUX_BUFFER_HEAD_H
#include <linux/types.h>
#include <linux/fs.h>
#include <linux/linkage.h>
#include <linux/pagemap.h>
#include <linux/wait.h>
#include <asm/atomic.h>
enum bh_state_bits {
BH_Uptodate, /* Contains valid data */
BH_Dirty, /* Is dirty */
BH_Lock, /* Is locked */
BH_Req, /* Has been submitted for I/O */
BH_Mapped, /* Has a disk mapping */
BH_New, /* Disk mapping was newly created by get_block */
BH_Async_Read, /* Is under end_buffer_async_read I/O */
BH_Async_Write, /* Is under end_buffer_async_write I/O */
BH_Delay, /* Buffer is not yet allocated on disk */
BH_Boundary, /* Block is followed by a discontiguity */
BH_Write_EIO, /* I/O error on write */
BH_Ordered, /* ordered write */
BH_Eopnotsupp, /* operation not supported (barrier) */
BH_PrivateStart,/* not a state bit, but the first bit available
* for private allocation by other entities
*/
};
#define MAX_BUF_PER_PAGE (PAGE_CACHE_SIZE / 512)
struct page;
struct buffer_head;
struct address_space;
typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate);
/*
* Keep related fields in common cachelines. The most commonly accessed
* field (b_state) goes at the start so the compiler does not generate
* indexed addressing for it.
*/
struct buffer_head {
/* First cache line: */
unsigned long b_state; /* buffer state bitmap (see above) */
struct buffer_head *b_this_page;/* circular list of page's buffers */
struct page *b_page; /* the page this bh is mapped to */
atomic_t b_count; /* users using this block */
u32 b_size; /* block size */
sector_t b_blocknr; /* block number */
char *b_data; /* pointer to data block */
struct block_device *b_bdev;
bh_end_io_t *b_end_io; /* I/O completion */
void *b_private; /* reserved for b_end_io */
struct list_head b_assoc_buffers; /* associated with another mapping */
};
/*
* macro tricks to expand the set_buffer_foo(), clear_buffer_foo()
* and buffer_foo() functions.
*/
#define BUFFER_FNS(bit, name) \
static inline void set_buffer_##name(struct buffer_head *bh) \
{ \
set_bit(BH_##bit, &(bh)->b_state); \
} \
static inline void clear_buffer_##name(struct buffer_head *bh) \
{ \
clear_bit(BH_##bit, &(bh)->b_state); \
} \
static inline int buffer_##name(const struct buffer_head *bh) \
{ \
return test_bit(BH_##bit, &(bh)->b_state); \
}
/*
* test_set_buffer_foo() and test_clear_buffer_foo()
*/
#define TAS_BUFFER_FNS(bit, name) \
static inline int test_set_buffer_##name(struct buffer_head *bh) \
{ \
return test_and_set_bit(BH_##bit, &(bh)->b_state); \
} \
static inline int test_clear_buffer_##name(struct buffer_head *bh) \
{ \
return test_and_clear_bit(BH_##bit, &(bh)->b_state); \
} \
/*
* Emit the buffer bitops functions. Note that there are also functions
* of the form "mark_buffer_foo()". These are higher-level functions which
* do something in addition to setting a b_state bit.
*/
BUFFER_FNS(Uptodate, uptodate)
BUFFER_FNS(Dirty, dirty)
TAS_BUFFER_FNS(Dirty, dirty)
BUFFER_FNS(Lock, locked)
TAS_BUFFER_FNS(Lock, locked)
BUFFER_FNS(Req, req)
TAS_BUFFER_FNS(Req, req)
BUFFER_FNS(Mapped, mapped)
BUFFER_FNS(New, new)
BUFFER_FNS(Async_Read, async_read)
BUFFER_FNS(Async_Write, async_write)
BUFFER_FNS(Delay, delay)
BUFFER_FNS(Boundary, boundary)
BUFFER_FNS(Write_EIO, write_io_error)
BUFFER_FNS(Ordered, ordered)
BUFFER_FNS(Eopnotsupp, eopnotsupp)
#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK)
#define touch_buffer(bh) mark_page_accessed(bh->b_page)
/* If we *know* page->private refers to buffer_heads */
#define page_buffers(page) \
({ \
BUG_ON(!PagePrivate(page)); \
((struct buffer_head *)(page)->private); \
})
#define page_has_buffers(page) PagePrivate(page)
/*
* Declarations
*/
void FASTCALL(mark_buffer_dirty(struct buffer_head *bh));
void init_buffer(struct buffer_head *, bh_end_io_t *, void *);
void set_bh_page(struct buffer_head *bh,
struct page *page, unsigned long offset);
int try_to_free_buffers(struct page *);
struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size,
int retry);
void create_empty_buffers(struct page *, unsigned long,
unsigned long b_state);
void end_buffer_read_sync(struct buffer_head *bh, int uptodate);
void end_buffer_write_sync(struct buffer_head *bh, int uptodate);
void end_buffer_async_write(struct buffer_head *bh, int uptodate);
/* Things to do with buffers at mapping->private_list */
void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode);
int inode_has_buffers(struct inode *);
void invalidate_inode_buffers(struct inode *);
int remove_inode_buffers(struct inode *inode);
int sync_mapping_buffers(struct address_space *mapping);
void unmap_underlying_metadata(struct block_device *bdev, sector_t block);
void mark_buffer_async_write(struct buffer_head *bh);
void invalidate_bdev(struct block_device *, int);
int sync_blockdev(struct block_device *bdev);
void __wait_on_buffer(struct buffer_head *);
wait_queue_head_t *bh_waitq_head(struct buffer_head *bh);
int fsync_bdev(struct block_device *);
struct super_block *freeze_bdev(struct block_device *);
void thaw_bdev(struct block_device *, struct super_block *);
int fsync_super(struct super_block *);
int fsync_no_super(struct block_device *);
struct buffer_head *__find_get_block(struct block_device *, sector_t, int);
struct buffer_head * __getblk(struct block_device *, sector_t, int);
void __brelse(struct buffer_head *);
void __bforget(struct buffer_head *);
void __breadahead(struct block_device *, sector_t block, int size);
struct buffer_head *__bread(struct block_device *, sector_t block, int size);
struct buffer_head *alloc_buffer_head(unsigned int __nocast gfp_flags);
void free_buffer_head(struct buffer_head * bh);
void FASTCALL(unlock_buffer(struct buffer_head *bh));
void FASTCALL(__lock_buffer(struct buffer_head *bh));
void ll_rw_block(int, int, struct buffer_head * bh[]);
int sync_dirty_buffer(struct buffer_head *bh);
int submit_bh(int, struct buffer_head *);
void write_boundary_block(struct block_device *bdev,
sector_t bblock, unsigned blocksize);
extern int buffer_heads_over_limit;
/*
* Generic address_space_operations implementations for buffer_head-backed
* address_spaces.
*/
int try_to_release_page(struct page * page, int gfp_mask);
int block_invalidatepage(struct page *page, unsigned long offset);
int block_write_full_page(struct page *page, get_block_t *get_block,
struct writeback_control *wbc);
int block_read_full_page(struct page*, get_block_t*);
int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*,
loff_t *);
int generic_cont_expand(struct inode *inode, loff_t size) ;
int block_commit_write(struct page *page, unsigned from, unsigned to);
int block_sync_page(struct page *);
sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
int generic_commit_write(struct file *, struct page *, unsigned, unsigned);
int block_truncate_page(struct address_space *, loff_t, get_block_t *);
int file_fsync(struct file *, struct dentry *, int);
int nobh_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
int nobh_commit_write(struct file *, struct page *, unsigned, unsigned);
int nobh_truncate_page(struct address_space *, loff_t);
int nobh_writepage(struct page *page, get_block_t *get_block,
struct writeback_control *wbc);
/*
* inline definitions
*/
static inline void attach_page_buffers(struct page *page,
struct buffer_head *head)
{
page_cache_get(page);
SetPagePrivate(page);
page->private = (unsigned long)head;
}
static inline void get_bh(struct buffer_head *bh)
{
atomic_inc(&bh->b_count);
}
static inline void put_bh(struct buffer_head *bh)
{
smp_mb__before_atomic_dec();
atomic_dec(&bh->b_count);
}
static inline void brelse(struct buffer_head *bh)
{
if (bh)
__brelse(bh);
}
static inline void bforget(struct buffer_head *bh)
{
if (bh)
__bforget(bh);
}
static inline struct buffer_head *
sb_bread(struct super_block *sb, sector_t block)
{
return __bread(sb->s_bdev, block, sb->s_blocksize);
}
static inline void
sb_breadahead(struct super_block *sb, sector_t block)
{
__breadahead(sb->s_bdev, block, sb->s_blocksize);
}
static inline struct buffer_head *
sb_getblk(struct super_block *sb, sector_t block)
{
return __getblk(sb->s_bdev, block, sb->s_blocksize);
}
static inline struct buffer_head *
sb_find_get_block(struct super_block *sb, sector_t block)
{
return __find_get_block(sb->s_bdev, block, sb->s_blocksize);
}
static inline void
map_bh(struct buffer_head *bh, struct super_block *sb, sector_t block)
{
set_buffer_mapped(bh);
bh->b_bdev = sb->s_bdev;
bh->b_blocknr = block;
}
/*
* Calling wait_on_buffer() for a zero-ref buffer is illegal, so we call into
* __wait_on_buffer() just to trip a debug check. Because debug code in inline
* functions is bloaty.
*/
static inline void wait_on_buffer(struct buffer_head *bh)
{
might_sleep();
if (buffer_locked(bh) || atomic_read(&bh->b_count) == 0)
__wait_on_buffer(bh);
}
static inline void lock_buffer(struct buffer_head *bh)
{
might_sleep();
if (test_set_buffer_locked(bh))
__lock_buffer(bh);
}
#endif /* _LINUX_BUFFER_HEAD_H */

View File

@@ -0,0 +1,106 @@
#ifndef _LINUX_BYTEORDER_BIG_ENDIAN_H
#define _LINUX_BYTEORDER_BIG_ENDIAN_H
#ifndef __BIG_ENDIAN
#define __BIG_ENDIAN 4321
#endif
#ifndef __BIG_ENDIAN_BITFIELD
#define __BIG_ENDIAN_BITFIELD
#endif
#include <linux/types.h>
#include <linux/byteorder/swab.h>
#define __constant_htonl(x) ((__force __be32)(__u32)(x))
#define __constant_ntohl(x) ((__force __u32)(__be32)(x))
#define __constant_htons(x) ((__force __be16)(__u16)(x))
#define __constant_ntohs(x) ((__force __u16)(__be16)(x))
#define __constant_cpu_to_le64(x) ((__force __le64)___constant_swab64((x)))
#define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x))
#define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x)))
#define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le32)(x))
#define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x)))
#define __constant_le16_to_cpu(x) ___constant_swab16((__force __u16)(__le16)(x))
#define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x))
#define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x))
#define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x))
#define __constant_be32_to_cpu(x) ((__force __u32)(__be32)(x))
#define __constant_cpu_to_be16(x) ((__force __be16)(__u16)(x))
#define __constant_be16_to_cpu(x) ((__force __u16)(__be16)(x))
#define __cpu_to_le64(x) ((__force __le64)__swab64((x)))
#define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x))
#define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
#define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
#define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
#define __cpu_to_be64(x) ((__force __be64)(__u64)(x))
#define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
#define __cpu_to_be32(x) ((__force __be32)(__u32)(x))
#define __be32_to_cpu(x) ((__force __u32)(__be32)(x))
#define __cpu_to_be16(x) ((__force __be16)(__u16)(x))
#define __be16_to_cpu(x) ((__force __u16)(__be16)(x))
static inline __le64 __cpu_to_le64p(const __u64 *p)
{
return (__force __le64)__swab64p(p);
}
static inline __u64 __le64_to_cpup(const __le64 *p)
{
return __swab64p((__u64 *)p);
}
static inline __le32 __cpu_to_le32p(const __u32 *p)
{
return (__force __le32)__swab32p(p);
}
static inline __u32 __le32_to_cpup(const __le32 *p)
{
return __swab32p((__u32 *)p);
}
static inline __le16 __cpu_to_le16p(const __u16 *p)
{
return (__force __le16)__swab16p(p);
}
static inline __u16 __le16_to_cpup(const __le16 *p)
{
return __swab16p((__u16 *)p);
}
static inline __be64 __cpu_to_be64p(const __u64 *p)
{
return (__force __be64)*p;
}
static inline __u64 __be64_to_cpup(const __be64 *p)
{
return (__force __u64)*p;
}
static inline __be32 __cpu_to_be32p(const __u32 *p)
{
return (__force __be32)*p;
}
static inline __u32 __be32_to_cpup(const __be32 *p)
{
return (__force __u32)*p;
}
static inline __be16 __cpu_to_be16p(const __u16 *p)
{
return (__force __be16)*p;
}
static inline __u16 __be16_to_cpup(const __be16 *p)
{
return (__force __u16)*p;
}
#define __cpu_to_le64s(x) __swab64s((x))
#define __le64_to_cpus(x) __swab64s((x))
#define __cpu_to_le32s(x) __swab32s((x))
#define __le32_to_cpus(x) __swab32s((x))
#define __cpu_to_le16s(x) __swab16s((x))
#define __le16_to_cpus(x) __swab16s((x))
#define __cpu_to_be64s(x) do {} while (0)
#define __be64_to_cpus(x) do {} while (0)
#define __cpu_to_be32s(x) do {} while (0)
#define __be32_to_cpus(x) do {} while (0)
#define __cpu_to_be16s(x) do {} while (0)
#define __be16_to_cpus(x) do {} while (0)
#include <linux/byteorder/generic.h>
#endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */

View File

@@ -0,0 +1,172 @@
#ifndef _LINUX_BYTEORDER_GENERIC_H
#define _LINUX_BYTEORDER_GENERIC_H
/*
* linux/byteorder_generic.h
* Generic Byte-reordering support
*
* Francois-Rene Rideau <fare@tunes.org> 19970707
* gathered all the good ideas from all asm-foo/byteorder.h into one file,
* cleaned them up.
* I hope it is compliant with non-GCC compilers.
* I decided to put __BYTEORDER_HAS_U64__ in byteorder.h,
* because I wasn't sure it would be ok to put it in types.h
* Upgraded it to 2.1.43
* Francois-Rene Rideau <fare@tunes.org> 19971012
* Upgraded it to 2.1.57
* to please Linus T., replaced huge #ifdef's between little/big endian
* by nestedly #include'd files.
* Francois-Rene Rideau <fare@tunes.org> 19971205
* Made it to 2.1.71; now a facelift:
* Put files under include/linux/byteorder/
* Split swab from generic support.
*
* TODO:
* = Regular kernel maintainers could also replace all these manual
* byteswap macros that remain, disseminated among drivers,
* after some grep or the sources...
* = Linus might want to rename all these macros and files to fit his taste,
* to fit his personal naming scheme.
* = it seems that a few drivers would also appreciate
* nybble swapping support...
* = every architecture could add their byteswap macro in asm/byteorder.h
* see how some architectures already do (i386, alpha, ppc, etc)
* = cpu_to_beXX and beXX_to_cpu might some day need to be well
* distinguished throughout the kernel. This is not the case currently,
* since little endian, big endian, and pdp endian machines needn't it.
* But this might be the case for, say, a port of Linux to 20/21 bit
* architectures (and F21 Linux addict around?).
*/
/*
* The following macros are to be defined by <asm/byteorder.h>:
*
* Conversion of long and short int between network and host format
* ntohl(__u32 x)
* ntohs(__u16 x)
* htonl(__u32 x)
* htons(__u16 x)
* It seems that some programs (which? where? or perhaps a standard? POSIX?)
* might like the above to be functions, not macros (why?).
* if that's true, then detect them, and take measures.
* Anyway, the measure is: define only ___ntohl as a macro instead,
* and in a separate file, have
* unsigned long inline ntohl(x){return ___ntohl(x);}
*
* The same for constant arguments
* __constant_ntohl(__u32 x)
* __constant_ntohs(__u16 x)
* __constant_htonl(__u32 x)
* __constant_htons(__u16 x)
*
* Conversion of XX-bit integers (16- 32- or 64-)
* between native CPU format and little/big endian format
* 64-bit stuff only defined for proper architectures
* cpu_to_[bl]eXX(__uXX x)
* [bl]eXX_to_cpu(__uXX x)
*
* The same, but takes a pointer to the value to convert
* cpu_to_[bl]eXXp(__uXX x)
* [bl]eXX_to_cpup(__uXX x)
*
* The same, but change in situ
* cpu_to_[bl]eXXs(__uXX x)
* [bl]eXX_to_cpus(__uXX x)
*
* See asm-foo/byteorder.h for examples of how to provide
* architecture-optimized versions
*
*/
#if defined(__KERNEL__)
/*
* inside the kernel, we can use nicknames;
* outside of it, we must avoid POSIX namespace pollution...
*/
#define cpu_to_le64 __cpu_to_le64
#define le64_to_cpu __le64_to_cpu
#define cpu_to_le32 __cpu_to_le32
#define le32_to_cpu __le32_to_cpu
#define cpu_to_le16 __cpu_to_le16
#define le16_to_cpu __le16_to_cpu
#define cpu_to_be64 __cpu_to_be64
#define be64_to_cpu __be64_to_cpu
#define cpu_to_be32 __cpu_to_be32
#define be32_to_cpu __be32_to_cpu
#define cpu_to_be16 __cpu_to_be16
#define be16_to_cpu __be16_to_cpu
#define cpu_to_le64p __cpu_to_le64p
#define le64_to_cpup __le64_to_cpup
#define cpu_to_le32p __cpu_to_le32p
#define le32_to_cpup __le32_to_cpup
#define cpu_to_le16p __cpu_to_le16p
#define le16_to_cpup __le16_to_cpup
#define cpu_to_be64p __cpu_to_be64p
#define be64_to_cpup __be64_to_cpup
#define cpu_to_be32p __cpu_to_be32p
#define be32_to_cpup __be32_to_cpup
#define cpu_to_be16p __cpu_to_be16p
#define be16_to_cpup __be16_to_cpup
#define cpu_to_le64s __cpu_to_le64s
#define le64_to_cpus __le64_to_cpus
#define cpu_to_le32s __cpu_to_le32s
#define le32_to_cpus __le32_to_cpus
#define cpu_to_le16s __cpu_to_le16s
#define le16_to_cpus __le16_to_cpus
#define cpu_to_be64s __cpu_to_be64s
#define be64_to_cpus __be64_to_cpus
#define cpu_to_be32s __cpu_to_be32s
#define be32_to_cpus __be32_to_cpus
#define cpu_to_be16s __cpu_to_be16s
#define be16_to_cpus __be16_to_cpus
#endif
#if defined(__KERNEL__)
/*
* Handle ntohl and suches. These have various compatibility
* issues - like we want to give the prototype even though we
* also have a macro for them in case some strange program
* wants to take the address of the thing or something..
*
* Note that these used to return a "long" in libc5, even though
* long is often 64-bit these days.. Thus the casts.
*
* They have to be macros in order to do the constant folding
* correctly - if the argument passed into a inline function
* it is no longer constant according to gcc..
*/
#undef ntohl
#undef ntohs
#undef htonl
#undef htons
/*
* Do the prototypes. Somebody might want to take the
* address or some such sick thing..
*/
extern __u32 ntohl(__be32);
extern __be32 htonl(__u32);
extern __u16 ntohs(__be16);
extern __be16 htons(__u16);
#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__)
#define ___htonl(x) __cpu_to_be32(x)
#define ___htons(x) __cpu_to_be16(x)
#define ___ntohl(x) __be32_to_cpu(x)
#define ___ntohs(x) __be16_to_cpu(x)
#define htonl(x) ___htonl(x)
#define ntohl(x) ___ntohl(x)
#define htons(x) ___htons(x)
#define ntohs(x) ___ntohs(x)
#endif /* OPTIMIZE */
#endif /* KERNEL */
#endif /* _LINUX_BYTEORDER_GENERIC_H */

View File

@@ -0,0 +1,106 @@
#ifndef _LINUX_BYTEORDER_LITTLE_ENDIAN_H
#define _LINUX_BYTEORDER_LITTLE_ENDIAN_H
#ifndef __LITTLE_ENDIAN
#define __LITTLE_ENDIAN 1234
#endif
#ifndef __LITTLE_ENDIAN_BITFIELD
#define __LITTLE_ENDIAN_BITFIELD
#endif
#include <linux/types.h>
#include <linux/byteorder/swab.h>
#define __constant_htonl(x) ((__force __be32)___constant_swab32((x)))
#define __constant_ntohl(x) ___constant_swab32((__force __be32)(x))
#define __constant_htons(x) ((__force __be16)___constant_swab16((x)))
#define __constant_ntohs(x) ___constant_swab16((__force __be16)(x))
#define __constant_cpu_to_le64(x) ((__force __le64)(__u64)(x))
#define __constant_le64_to_cpu(x) ((__force __u64)(__le64)(x))
#define __constant_cpu_to_le32(x) ((__force __le32)(__u32)(x))
#define __constant_le32_to_cpu(x) ((__force __u32)(__le32)(x))
#define __constant_cpu_to_le16(x) ((__force __le16)(__u16)(x))
#define __constant_le16_to_cpu(x) ((__force __u16)(__le16)(x))
#define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x)))
#define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x))
#define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x)))
#define __constant_be32_to_cpu(x) ___constant_swab32((__force __u32)(__be32)(x))
#define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x)))
#define __constant_be16_to_cpu(x) ___constant_swab16((__force __u16)(__be16)(x))
#define __cpu_to_le64(x) ((__force __le64)(__u64)(x))
#define __le64_to_cpu(x) ((__force __u64)(__le64)(x))
#define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
#define __cpu_to_le16(x) ((__force __le16)(__u16)(x))
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
#define __cpu_to_be64(x) ((__force __be64)__swab64((x)))
#define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x))
#define __cpu_to_be32(x) ((__force __be32)__swab32((x)))
#define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
#define __cpu_to_be16(x) ((__force __be16)__swab16((x)))
#define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x))
static inline __le64 __cpu_to_le64p(const __u64 *p)
{
return (__force __le64)*p;
}
static inline __u64 __le64_to_cpup(const __le64 *p)
{
return (__force __u64)*p;
}
static inline __le32 __cpu_to_le32p(const __u32 *p)
{
return (__force __le32)*p;
}
static inline __u32 __le32_to_cpup(const __le32 *p)
{
return (__force __u32)*p;
}
static inline __le16 __cpu_to_le16p(const __u16 *p)
{
return (__force __le16)*p;
}
static inline __u16 __le16_to_cpup(const __le16 *p)
{
return (__force __u16)*p;
}
static inline __be64 __cpu_to_be64p(const __u64 *p)
{
return (__force __be64)__swab64p(p);
}
static inline __u64 __be64_to_cpup(const __be64 *p)
{
return __swab64p((__u64 *)p);
}
static inline __be32 __cpu_to_be32p(const __u32 *p)
{
return (__force __be32)__swab32p(p);
}
static inline __u32 __be32_to_cpup(const __be32 *p)
{
return __swab32p((__u32 *)p);
}
static inline __be16 __cpu_to_be16p(const __u16 *p)
{
return (__force __be16)__swab16p(p);
}
static inline __u16 __be16_to_cpup(const __be16 *p)
{
return __swab16p((__u16 *)p);
}
#define __cpu_to_le64s(x) do {} while (0)
#define __le64_to_cpus(x) do {} while (0)
#define __cpu_to_le32s(x) do {} while (0)
#define __le32_to_cpus(x) do {} while (0)
#define __cpu_to_le16s(x) do {} while (0)
#define __le16_to_cpus(x) do {} while (0)
#define __cpu_to_be64s(x) __swab64s((x))
#define __be64_to_cpus(x) __swab64s((x))
#define __cpu_to_be32s(x) __swab32s((x))
#define __be32_to_cpus(x) __swab32s((x))
#define __cpu_to_be16s(x) __swab16s((x))
#define __be16_to_cpus(x) __swab16s((x))
#include <linux/byteorder/generic.h>
#endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */

View File

@@ -0,0 +1,88 @@
#ifndef _LINUX_BYTEORDER_PDP_ENDIAN_H
#define _LINUX_BYTEORDER_PDP_ENDIAN_H
/*
* Could have been named NUXI-endian, but we use the same name as in glibc.
* hopefully only the PDP and its evolutions (old VAXen in compatibility mode)
* should ever use this braindead byteorder.
* This file *should* work, but has not been tested.
*
* little-endian is 1234; big-endian is 4321; nuxi/pdp-endian is 3412
*
* I thought vaxen were NUXI-endian, but was told they were correct-endian
* (little-endian), though indeed there existed NUXI-endian machines
* (DEC PDP-11 and old VAXen in compatibility mode).
* This makes this file a bit useless, but as a proof-of-concept.
*
* But what does a __u64 look like: is it 34127856 or 78563412 ???
* I don't dare imagine! Hence, no 64-bit byteorder support yet.
* Hopefully, there 64-bit pdp-endian support shouldn't ever be required.
*
*/
#ifndef __PDP_ENDIAN
#define __PDP_ENDIAN 3412
#endif
#ifndef __PDP_ENDIAN_BITFIELD
#define __PDP_ENDIAN_BITFIELD
#endif
#include <linux/byteorder/swab.h>
#include <linux/byteorder/swabb.h>
#define __constant_htonl(x) ___constant_swahb32((x))
#define __constant_ntohl(x) ___constant_swahb32((x))
#define __constant_htons(x) ___constant_swab16((x))
#define __constant_ntohs(x) ___constant_swab16((x))
#define __constant_cpu_to_le64(x) I DON'T KNOW
#define __constant_le64_to_cpu(x) I DON'T KNOW
#define __constant_cpu_to_le32(x) ___constant_swahw32((x))
#define __constant_le32_to_cpu(x) ___constant_swahw32((x))
#define __constant_cpu_to_le16(x) ((__u16)(x)
#define __constant_le16_to_cpu(x) ((__u16)(x)
#define __constant_cpu_to_be64(x) I DON'T KNOW
#define __constant_be64_to_cpu(x) I DON'T KNOW
#define __constant_cpu_to_be32(x) ___constant_swahb32((x))
#define __constant_be32_to_cpu(x) ___constant_swahb32((x))
#define __constant_cpu_to_be16(x) ___constant_swab16((x))
#define __constant_be16_to_cpu(x) ___constant_swab16((x))
#define __cpu_to_le64(x) I DON'T KNOW
#define __le64_to_cpu(x) I DON'T KNOW
#define __cpu_to_le32(x) ___swahw32((x))
#define __le32_to_cpu(x) ___swahw32((x))
#define __cpu_to_le16(x) ((__u16)(x)
#define __le16_to_cpu(x) ((__u16)(x)
#define __cpu_to_be64(x) I DON'T KNOW
#define __be64_to_cpu(x) I DON'T KNOW
#define __cpu_to_be32(x) __swahb32((x))
#define __be32_to_cpu(x) __swahb32((x))
#define __cpu_to_be16(x) __swab16((x))
#define __be16_to_cpu(x) __swab16((x))
#define __cpu_to_le64p(x) I DON'T KNOW
#define __le64_to_cpup(x) I DON'T KNOW
#define __cpu_to_le32p(x) ___swahw32p((x))
#define __le32_to_cpup(x) ___swahw32p((x))
#define __cpu_to_le16p(x) (*(__u16*)(x))
#define __le16_to_cpup(x) (*(__u16*)(x))
#define __cpu_to_be64p(x) I DON'T KNOW
#define __be64_to_cpup(x) I DON'T KNOW
#define __cpu_to_be32p(x) __swahb32p((x))
#define __be32_to_cpup(x) __swahb32p((x))
#define __cpu_to_be16p(x) __swab16p((x))
#define __be16_to_cpup(x) __swab16p((x))
#define __cpu_to_le64s(x) I DON'T KNOW
#define __le64_to_cpus(x) I DON'T KNOW
#define __cpu_to_le32s(x) ___swahw32s((x))
#define __le32_to_cpus(x) ___swahw32s((x))
#define __cpu_to_le16s(x) do {} while (0)
#define __le16_to_cpus(x) do {} while (0)
#define __cpu_to_be64s(x) I DON'T KNOW
#define __be64_to_cpus(x) I DON'T KNOW
#define __cpu_to_be32s(x) __swahb32s((x))
#define __be32_to_cpus(x) __swahb32s((x))
#define __cpu_to_be16s(x) __swab16s((x))
#define __be16_to_cpus(x) __swab16s((x))
#include <linux/byteorder/generic.h>
#endif /* _LINUX_BYTEORDER_PDP_ENDIAN_H */

View File

@@ -0,0 +1,192 @@
#ifndef _LINUX_BYTEORDER_SWAB_H
#define _LINUX_BYTEORDER_SWAB_H
/*
* linux/byteorder/swab.h
* Byte-swapping, independently from CPU endianness
* swabXX[ps]?(foo)
*
* Francois-Rene Rideau <fare@tunes.org> 19971205
* separated swab functions from cpu_to_XX,
* to clean up support for bizarre-endian architectures.
*
* See asm-i386/byteorder.h and suches for examples of how to provide
* architecture-dependent optimized versions
*
*/
#include <linux/compiler.h>
/* casts are necessary for constants, because we never know how for sure
* how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
*/
#define ___swab16(x) \
({ \
__u16 __x = (x); \
((__u16)( \
(((__u16)(__x) & (__u16)0x00ffU) << 8) | \
(((__u16)(__x) & (__u16)0xff00U) >> 8) )); \
})
#define ___swab32(x) \
({ \
__u32 __x = (x); \
((__u32)( \
(((__u32)(__x) & (__u32)0x000000ffUL) << 24) | \
(((__u32)(__x) & (__u32)0x0000ff00UL) << 8) | \
(((__u32)(__x) & (__u32)0x00ff0000UL) >> 8) | \
(((__u32)(__x) & (__u32)0xff000000UL) >> 24) )); \
})
#define ___swab64(x) \
({ \
__u64 __x = (x); \
((__u64)( \
(__u64)(((__u64)(__x) & (__u64)0x00000000000000ffULL) << 56) | \
(__u64)(((__u64)(__x) & (__u64)0x000000000000ff00ULL) << 40) | \
(__u64)(((__u64)(__x) & (__u64)0x0000000000ff0000ULL) << 24) | \
(__u64)(((__u64)(__x) & (__u64)0x00000000ff000000ULL) << 8) | \
(__u64)(((__u64)(__x) & (__u64)0x000000ff00000000ULL) >> 8) | \
(__u64)(((__u64)(__x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
(__u64)(((__u64)(__x) & (__u64)0x00ff000000000000ULL) >> 40) | \
(__u64)(((__u64)(__x) & (__u64)0xff00000000000000ULL) >> 56) )); \
})
#define ___constant_swab16(x) \
((__u16)( \
(((__u16)(x) & (__u16)0x00ffU) << 8) | \
(((__u16)(x) & (__u16)0xff00U) >> 8) ))
#define ___constant_swab32(x) \
((__u32)( \
(((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
(((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
(((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
(((__u32)(x) & (__u32)0xff000000UL) >> 24) ))
#define ___constant_swab64(x) \
((__u64)( \
(__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
(__u64)(((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \
(__u64)(((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \
(__u64)(((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \
(__u64)(((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \
(__u64)(((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
(__u64)(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
(__u64)(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56) ))
/*
* provide defaults when no architecture-specific optimization is detected
*/
#ifndef __arch__swab16
# define __arch__swab16(x) ({ __u16 __tmp = (x) ; ___swab16(__tmp); })
#endif
#ifndef __arch__swab32
# define __arch__swab32(x) ({ __u32 __tmp = (x) ; ___swab32(__tmp); })
#endif
#ifndef __arch__swab64
# define __arch__swab64(x) ({ __u64 __tmp = (x) ; ___swab64(__tmp); })
#endif
#ifndef __arch__swab16p
# define __arch__swab16p(x) __arch__swab16(*(x))
#endif
#ifndef __arch__swab32p
# define __arch__swab32p(x) __arch__swab32(*(x))
#endif
#ifndef __arch__swab64p
# define __arch__swab64p(x) __arch__swab64(*(x))
#endif
#ifndef __arch__swab16s
# define __arch__swab16s(x) do { *(x) = __arch__swab16p((x)); } while (0)
#endif
#ifndef __arch__swab32s
# define __arch__swab32s(x) do { *(x) = __arch__swab32p((x)); } while (0)
#endif
#ifndef __arch__swab64s
# define __arch__swab64s(x) do { *(x) = __arch__swab64p((x)); } while (0)
#endif
/*
* Allow constant folding
*/
#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__)
# define __swab16(x) \
(__builtin_constant_p((__u16)(x)) ? \
___swab16((x)) : \
__fswab16((x)))
# define __swab32(x) \
(__builtin_constant_p((__u32)(x)) ? \
___swab32((x)) : \
__fswab32((x)))
# define __swab64(x) \
(__builtin_constant_p((__u64)(x)) ? \
___swab64((x)) : \
__fswab64((x)))
#else
# define __swab16(x) __fswab16(x)
# define __swab32(x) __fswab32(x)
# define __swab64(x) __fswab64(x)
#endif /* OPTIMIZE */
static __inline__ __attribute_const__ __u16 __fswab16(__u16 x)
{
return __arch__swab16(x);
}
static __inline__ __u16 __swab16p(const __u16 *x)
{
return __arch__swab16p(x);
}
static __inline__ void __swab16s(__u16 *addr)
{
__arch__swab16s(addr);
}
static __inline__ __attribute_const__ __u32 __fswab32(__u32 x)
{
return __arch__swab32(x);
}
static __inline__ __u32 __swab32p(const __u32 *x)
{
return __arch__swab32p(x);
}
static __inline__ void __swab32s(__u32 *addr)
{
__arch__swab32s(addr);
}
#ifdef __BYTEORDER_HAS_U64__
static __inline__ __attribute_const__ __u64 __fswab64(__u64 x)
{
# ifdef __SWAB_64_THRU_32__
__u32 h = x >> 32;
__u32 l = x & ((1ULL<<32)-1);
return (((__u64)__swab32(l)) << 32) | ((__u64)(__swab32(h)));
# else
return __arch__swab64(x);
# endif
}
static __inline__ __u64 __swab64p(const __u64 *x)
{
return __arch__swab64p(x);
}
static __inline__ void __swab64s(__u64 *addr)
{
__arch__swab64s(addr);
}
#endif /* __BYTEORDER_HAS_U64__ */
#if defined(__KERNEL__)
#define swab16 __swab16
#define swab32 __swab32
#define swab64 __swab64
#define swab16p __swab16p
#define swab32p __swab32p
#define swab64p __swab64p
#define swab16s __swab16s
#define swab32s __swab32s
#define swab64s __swab64s
#endif
#endif /* _LINUX_BYTEORDER_SWAB_H */

View File

@@ -0,0 +1,137 @@
#ifndef _LINUX_BYTEORDER_SWABB_H
#define _LINUX_BYTEORDER_SWABB_H
/*
* linux/byteorder/swabb.h
* SWAp Bytes Bizarrely
* swaHHXX[ps]?(foo)
*
* Support for obNUXIous pdp-endian and other bizarre architectures.
* Will Linux ever run on such ancient beasts? if not, this file
* will be but a programming pearl. Still, it's a reminder that we
* shouldn't be making too many assumptions when trying to be portable.
*
*/
/*
* Meaning of the names I chose (vaxlinux people feel free to correct them):
* swahw32 swap 16-bit half-words in a 32-bit word
* swahb32 swap 8-bit halves of each 16-bit half-word in a 32-bit word
*
* No 64-bit support yet. I don't know NUXI conventions for long longs.
* I guarantee it will be a mess when it's there, though :->
* It will be even worse if there are conflicting 64-bit conventions.
* Hopefully, no one ever used 64-bit objects on NUXI machines.
*
*/
#define ___swahw32(x) \
({ \
__u32 __x = (x); \
((__u32)( \
(((__u32)(__x) & (__u32)0x0000ffffUL) << 16) | \
(((__u32)(__x) & (__u32)0xffff0000UL) >> 16) )); \
})
#define ___swahb32(x) \
({ \
__u32 __x = (x); \
((__u32)( \
(((__u32)(__x) & (__u32)0x00ff00ffUL) << 8) | \
(((__u32)(__x) & (__u32)0xff00ff00UL) >> 8) )); \
})
#define ___constant_swahw32(x) \
((__u32)( \
(((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \
(((__u32)(x) & (__u32)0xffff0000UL) >> 16) ))
#define ___constant_swahb32(x) \
((__u32)( \
(((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \
(((__u32)(x) & (__u32)0xff00ff00UL) >> 8) ))
/*
* provide defaults when no architecture-specific optimization is detected
*/
#ifndef __arch__swahw32
# define __arch__swahw32(x) ___swahw32(x)
#endif
#ifndef __arch__swahb32
# define __arch__swahb32(x) ___swahb32(x)
#endif
#ifndef __arch__swahw32p
# define __arch__swahw32p(x) __swahw32(*(x))
#endif
#ifndef __arch__swahb32p
# define __arch__swahb32p(x) __swahb32(*(x))
#endif
#ifndef __arch__swahw32s
# define __arch__swahw32s(x) do { *(x) = __swahw32p((x)); } while (0)
#endif
#ifndef __arch__swahb32s
# define __arch__swahb32s(x) do { *(x) = __swahb32p((x)); } while (0)
#endif
/*
* Allow constant folding
*/
#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__)
# define __swahw32(x) \
(__builtin_constant_p((__u32)(x)) ? \
___swahw32((x)) : \
__fswahw32((x)))
# define __swahb32(x) \
(__builtin_constant_p((__u32)(x)) ? \
___swahb32((x)) : \
__fswahb32((x)))
#else
# define __swahw32(x) __fswahw32(x)
# define __swahb32(x) __fswahb32(x)
#endif /* OPTIMIZE */
static __inline__ __const__ __u32 __fswahw32(__u32 x)
{
return __arch__swahw32(x);
}
static __inline__ __u32 __swahw32p(__u32 *x)
{
return __arch__swahw32p(x);
}
static __inline__ void __swahw32s(__u32 *addr)
{
__arch__swahw32s(addr);
}
static __inline__ __const__ __u32 __fswahb32(__u32 x)
{
return __arch__swahb32(x);
}
static __inline__ __u32 __swahb32p(__u32 *x)
{
return __arch__swahb32p(x);
}
static __inline__ void __swahb32s(__u32 *addr)
{
__arch__swahb32s(addr);
}
#ifdef __BYTEORDER_HAS_U64__
/*
* Not supported yet
*/
#endif /* __BYTEORDER_HAS_U64__ */
#if defined(__KERNEL__)
#define swahw32 __swahw32
#define swahb32 __swahb32
#define swahw32p __swahw32p
#define swahb32p __swahb32p
#define swahw32s __swahw32s
#define swahb32s __swahb32s
#endif
#endif /* _LINUX_BYTEORDER_SWABB_H */

51
include/linux/cache.h Normal file
View File

@@ -0,0 +1,51 @@
#ifndef __LINUX_CACHE_H
#define __LINUX_CACHE_H
#include <linux/kernel.h>
#include <linux/config.h>
#include <asm/cache.h>
#ifndef L1_CACHE_ALIGN
#define L1_CACHE_ALIGN(x) ALIGN(x, L1_CACHE_BYTES)
#endif
#ifndef SMP_CACHE_BYTES
#define SMP_CACHE_BYTES L1_CACHE_BYTES
#endif
#ifndef ____cacheline_aligned
#define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
#endif
#ifndef ____cacheline_aligned_in_smp
#ifdef CONFIG_SMP
#define ____cacheline_aligned_in_smp ____cacheline_aligned
#else
#define ____cacheline_aligned_in_smp
#endif /* CONFIG_SMP */
#endif
#ifndef __cacheline_aligned
#define __cacheline_aligned \
__attribute__((__aligned__(SMP_CACHE_BYTES), \
__section__(".data.cacheline_aligned")))
#endif /* __cacheline_aligned */
#ifndef __cacheline_aligned_in_smp
#ifdef CONFIG_SMP
#define __cacheline_aligned_in_smp __cacheline_aligned
#else
#define __cacheline_aligned_in_smp
#endif /* CONFIG_SMP */
#endif
#if !defined(____cacheline_maxaligned_in_smp)
#if defined(CONFIG_SMP)
#define ____cacheline_maxaligned_in_smp \
__attribute__((__aligned__(1 << (L1_CACHE_SHIFT_MAX))))
#else
#define ____cacheline_maxaligned_in_smp
#endif
#endif
#endif /* __LINUX_CACHE_H */

360
include/linux/capability.h Normal file
View File

@@ -0,0 +1,360 @@
/*
* This is <linux/capability.h>
*
* Andrew G. Morgan <morgan@transmeta.com>
* Alexander Kjeldaas <astor@guardian.no>
* with help from Aleph1, Roland Buresund and Andrew Main.
*
* See here for the libcap library ("POSIX draft" compliance):
*
* ftp://linux.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.2/
*/
#ifndef _LINUX_CAPABILITY_H
#define _LINUX_CAPABILITY_H
#include <linux/types.h>
#include <linux/compiler.h>
/* User-level do most of the mapping between kernel and user
capabilities based on the version tag given by the kernel. The
kernel might be somewhat backwards compatible, but don't bet on
it. */
/* XXX - Note, cap_t, is defined by POSIX to be an "opaque" pointer to
a set of three capability sets. The transposition of 3*the
following structure to such a composite is better handled in a user
library since the draft standard requires the use of malloc/free
etc.. */
#define _LINUX_CAPABILITY_VERSION 0x19980330
typedef struct __user_cap_header_struct {
__u32 version;
int pid;
} __user *cap_user_header_t;
typedef struct __user_cap_data_struct {
__u32 effective;
__u32 permitted;
__u32 inheritable;
} __user *cap_user_data_t;
#ifdef __KERNEL__
#include <linux/spinlock.h>
/* #define STRICT_CAP_T_TYPECHECKS */
#ifdef STRICT_CAP_T_TYPECHECKS
typedef struct kernel_cap_struct {
__u32 cap;
} kernel_cap_t;
#else
typedef __u32 kernel_cap_t;
#endif
#define _USER_CAP_HEADER_SIZE (2*sizeof(__u32))
#define _KERNEL_CAP_T_SIZE (sizeof(kernel_cap_t))
#endif
/**
** POSIX-draft defined capabilities.
**/
/* In a system with the [_POSIX_CHOWN_RESTRICTED] option defined, this
overrides the restriction of changing file ownership and group
ownership. */
#define CAP_CHOWN 0
/* Override all DAC access, including ACL execute access if
[_POSIX_ACL] is defined. Excluding DAC access covered by
CAP_LINUX_IMMUTABLE. */
#define CAP_DAC_OVERRIDE 1
/* Overrides all DAC restrictions regarding read and search on files
and directories, including ACL restrictions if [_POSIX_ACL] is
defined. Excluding DAC access covered by CAP_LINUX_IMMUTABLE. */
#define CAP_DAC_READ_SEARCH 2
/* Overrides all restrictions about allowed operations on files, where
file owner ID must be equal to the user ID, except where CAP_FSETID
is applicable. It doesn't override MAC and DAC restrictions. */
#define CAP_FOWNER 3
/* Overrides the following restrictions that the effective user ID
shall match the file owner ID when setting the S_ISUID and S_ISGID
bits on that file; that the effective group ID (or one of the
supplementary group IDs) shall match the file owner ID when setting
the S_ISGID bit on that file; that the S_ISUID and S_ISGID bits are
cleared on successful return from chown(2) (not implemented). */
#define CAP_FSETID 4
/* Used to decide between falling back on the old suser() or fsuser(). */
#define CAP_FS_MASK 0x1f
/* Overrides the restriction that the real or effective user ID of a
process sending a signal must match the real or effective user ID
of the process receiving the signal. */
#define CAP_KILL 5
/* Allows setgid(2) manipulation */
/* Allows setgroups(2) */
/* Allows forged gids on socket credentials passing. */
#define CAP_SETGID 6
/* Allows set*uid(2) manipulation (including fsuid). */
/* Allows forged pids on socket credentials passing. */
#define CAP_SETUID 7
/**
** Linux-specific capabilities
**/
/* Transfer any capability in your permitted set to any pid,
remove any capability in your permitted set from any pid */
#define CAP_SETPCAP 8
/* Allow modification of S_IMMUTABLE and S_APPEND file attributes */
#define CAP_LINUX_IMMUTABLE 9
/* Allows binding to TCP/UDP sockets below 1024 */
/* Allows binding to ATM VCIs below 32 */
#define CAP_NET_BIND_SERVICE 10
/* Allow broadcasting, listen to multicast */
#define CAP_NET_BROADCAST 11
/* Allow interface configuration */
/* Allow administration of IP firewall, masquerading and accounting */
/* Allow setting debug option on sockets */
/* Allow modification of routing tables */
/* Allow setting arbitrary process / process group ownership on
sockets */
/* Allow binding to any address for transparent proxying */
/* Allow setting TOS (type of service) */
/* Allow setting promiscuous mode */
/* Allow clearing driver statistics */
/* Allow multicasting */
/* Allow read/write of device-specific registers */
/* Allow activation of ATM control sockets */
#define CAP_NET_ADMIN 12
/* Allow use of RAW sockets */
/* Allow use of PACKET sockets */
#define CAP_NET_RAW 13
/* Allow locking of shared memory segments */
/* Allow mlock and mlockall (which doesn't really have anything to do
with IPC) */
#define CAP_IPC_LOCK 14
/* Override IPC ownership checks */
#define CAP_IPC_OWNER 15
/* Insert and remove kernel modules - modify kernel without limit */
/* Modify cap_bset */
#define CAP_SYS_MODULE 16
/* Allow ioperm/iopl access */
/* Allow sending USB messages to any device via /proc/bus/usb */
#define CAP_SYS_RAWIO 17
/* Allow use of chroot() */
#define CAP_SYS_CHROOT 18
/* Allow ptrace() of any process */
#define CAP_SYS_PTRACE 19
/* Allow configuration of process accounting */
#define CAP_SYS_PACCT 20
/* Allow configuration of the secure attention key */
/* Allow administration of the random device */
/* Allow examination and configuration of disk quotas */
/* Allow configuring the kernel's syslog (printk behaviour) */
/* Allow setting the domainname */
/* Allow setting the hostname */
/* Allow calling bdflush() */
/* Allow mount() and umount(), setting up new smb connection */
/* Allow some autofs root ioctls */
/* Allow nfsservctl */
/* Allow VM86_REQUEST_IRQ */
/* Allow to read/write pci config on alpha */
/* Allow irix_prctl on mips (setstacksize) */
/* Allow flushing all cache on m68k (sys_cacheflush) */
/* Allow removing semaphores */
/* Used instead of CAP_CHOWN to "chown" IPC message queues, semaphores
and shared memory */
/* Allow locking/unlocking of shared memory segment */
/* Allow turning swap on/off */
/* Allow forged pids on socket credentials passing */
/* Allow setting readahead and flushing buffers on block devices */
/* Allow setting geometry in floppy driver */
/* Allow turning DMA on/off in xd driver */
/* Allow administration of md devices (mostly the above, but some
extra ioctls) */
/* Allow tuning the ide driver */
/* Allow access to the nvram device */
/* Allow administration of apm_bios, serial and bttv (TV) device */
/* Allow manufacturer commands in isdn CAPI support driver */
/* Allow reading non-standardized portions of pci configuration space */
/* Allow DDI debug ioctl on sbpcd driver */
/* Allow setting up serial ports */
/* Allow sending raw qic-117 commands */
/* Allow enabling/disabling tagged queuing on SCSI controllers and sending
arbitrary SCSI commands */
/* Allow setting encryption key on loopback filesystem */
#define CAP_SYS_ADMIN 21
/* Allow use of reboot() */
#define CAP_SYS_BOOT 22
/* Allow raising priority and setting priority on other (different
UID) processes */
/* Allow use of FIFO and round-robin (realtime) scheduling on own
processes and setting the scheduling algorithm used by another
process. */
/* Allow setting cpu affinity on other processes */
#define CAP_SYS_NICE 23
/* Override resource limits. Set resource limits. */
/* Override quota limits. */
/* Override reserved space on ext2 filesystem */
/* Modify data journaling mode on ext3 filesystem (uses journaling
resources) */
/* NOTE: ext2 honors fsuid when checking for resource overrides, so
you can override using fsuid too */
/* Override size restrictions on IPC message queues */
/* Allow more than 64hz interrupts from the real-time clock */
/* Override max number of consoles on console allocation */
/* Override max number of keymaps */
#define CAP_SYS_RESOURCE 24
/* Allow manipulation of system clock */
/* Allow irix_stime on mips */
/* Allow setting the real-time clock */
#define CAP_SYS_TIME 25
/* Allow configuration of tty devices */
/* Allow vhangup() of tty */
#define CAP_SYS_TTY_CONFIG 26
/* Allow the privileged aspects of mknod() */
#define CAP_MKNOD 27
/* Allow taking of leases on files */
#define CAP_LEASE 28
#define CAP_AUDIT_WRITE 29
#define CAP_AUDIT_CONTROL 30
#ifdef __KERNEL__
/*
* Bounding set
*/
extern kernel_cap_t cap_bset;
/*
* Internal kernel functions only
*/
#ifdef STRICT_CAP_T_TYPECHECKS
#define to_cap_t(x) { x }
#define cap_t(x) (x).cap
#else
#define to_cap_t(x) (x)
#define cap_t(x) (x)
#endif
#define CAP_EMPTY_SET to_cap_t(0)
#define CAP_FULL_SET to_cap_t(~0)
#define CAP_INIT_EFF_SET to_cap_t(~0 & ~CAP_TO_MASK(CAP_SETPCAP))
#define CAP_INIT_INH_SET to_cap_t(0)
#define CAP_TO_MASK(x) (1 << (x))
#define cap_raise(c, flag) (cap_t(c) |= CAP_TO_MASK(flag))
#define cap_lower(c, flag) (cap_t(c) &= ~CAP_TO_MASK(flag))
#define cap_raised(c, flag) (cap_t(c) & CAP_TO_MASK(flag))
static inline kernel_cap_t cap_combine(kernel_cap_t a, kernel_cap_t b)
{
kernel_cap_t dest;
cap_t(dest) = cap_t(a) | cap_t(b);
return dest;
}
static inline kernel_cap_t cap_intersect(kernel_cap_t a, kernel_cap_t b)
{
kernel_cap_t dest;
cap_t(dest) = cap_t(a) & cap_t(b);
return dest;
}
static inline kernel_cap_t cap_drop(kernel_cap_t a, kernel_cap_t drop)
{
kernel_cap_t dest;
cap_t(dest) = cap_t(a) & ~cap_t(drop);
return dest;
}
static inline kernel_cap_t cap_invert(kernel_cap_t c)
{
kernel_cap_t dest;
cap_t(dest) = ~cap_t(c);
return dest;
}
#define cap_isclear(c) (!cap_t(c))
#define cap_issubset(a,set) (!(cap_t(a) & ~cap_t(set)))
#define cap_clear(c) do { cap_t(c) = 0; } while(0)
#define cap_set_full(c) do { cap_t(c) = ~0; } while(0)
#define cap_mask(c,mask) do { cap_t(c) &= cap_t(mask); } while(0)
#define cap_is_fs_cap(c) (CAP_TO_MASK(c) & CAP_FS_MASK)
#endif /* __KERNEL__ */
#endif /* !_LINUX_CAPABILITY_H */

133
include/linux/capi.h Normal file
View File

@@ -0,0 +1,133 @@
/* $Id: capi.h,v 1.4.6.1 2001/09/23 22:25:05 kai Exp $
*
* CAPI 2.0 Interface for Linux
*
* Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
*/
#ifndef __LINUX_CAPI_H__
#define __LINUX_CAPI_H__
#include <asm/types.h>
#include <linux/ioctl.h>
#ifndef __KERNEL__
#include <linux/kernelcapi.h>
#endif
/*
* CAPI_REGISTER
*/
typedef struct capi_register_params { /* CAPI_REGISTER */
__u32 level3cnt; /* No. of simulatneous user data connections */
__u32 datablkcnt; /* No. of buffered data messages */
__u32 datablklen; /* Size of buffered data messages */
} capi_register_params;
#define CAPI_REGISTER _IOW('C',0x01,struct capi_register_params)
/*
* CAPI_GET_MANUFACTURER
*/
#define CAPI_MANUFACTURER_LEN 64
#define CAPI_GET_MANUFACTURER _IOWR('C',0x06,int) /* broken: wanted size 64 (CAPI_MANUFACTURER_LEN) */
/*
* CAPI_GET_VERSION
*/
typedef struct capi_version {
__u32 majorversion;
__u32 minorversion;
__u32 majormanuversion;
__u32 minormanuversion;
} capi_version;
#define CAPI_GET_VERSION _IOWR('C',0x07,struct capi_version)
/*
* CAPI_GET_SERIAL
*/
#define CAPI_SERIAL_LEN 8
#define CAPI_GET_SERIAL _IOWR('C',0x08,int) /* broken: wanted size 8 (CAPI_SERIAL_LEN) */
/*
* CAPI_GET_PROFILE
*/
typedef struct capi_profile {
__u16 ncontroller; /* number of installed controller */
__u16 nbchannel; /* number of B-Channels */
__u32 goptions; /* global options */
__u32 support1; /* B1 protocols support */
__u32 support2; /* B2 protocols support */
__u32 support3; /* B3 protocols support */
__u32 reserved[6]; /* reserved */
__u32 manu[5]; /* manufacturer specific information */
} capi_profile;
#define CAPI_GET_PROFILE _IOWR('C',0x09,struct capi_profile)
typedef struct capi_manufacturer_cmd {
unsigned long cmd;
void __user *data;
} capi_manufacturer_cmd;
/*
* CAPI_MANUFACTURER_CMD
*/
#define CAPI_MANUFACTURER_CMD _IOWR('C',0x20, struct capi_manufacturer_cmd)
/*
* CAPI_GET_ERRCODE
* capi errcode is set, * if read, write, or ioctl returns EIO,
* ioctl returns errcode directly, and in arg, if != 0
*/
#define CAPI_GET_ERRCODE _IOR('C',0x21, __u16)
/*
* CAPI_INSTALLED
*/
#define CAPI_INSTALLED _IOR('C',0x22, __u16)
/*
* member contr is input for
* CAPI_GET_MANUFACTURER, CAPI_VERSION, CAPI_GET_SERIAL
* and CAPI_GET_PROFILE
*/
typedef union capi_ioctl_struct {
__u32 contr;
capi_register_params rparams;
__u8 manufacturer[CAPI_MANUFACTURER_LEN];
capi_version version;
__u8 serial[CAPI_SERIAL_LEN];
capi_profile profile;
capi_manufacturer_cmd cmd;
__u16 errcode;
} capi_ioctl_struct;
/*
* Middleware extension
*/
#define CAPIFLAG_HIGHJACKING 0x0001
#define CAPI_GET_FLAGS _IOR('C',0x23, unsigned)
#define CAPI_SET_FLAGS _IOR('C',0x24, unsigned)
#define CAPI_CLR_FLAGS _IOR('C',0x25, unsigned)
#define CAPI_NCCI_OPENCOUNT _IOR('C',0x26, unsigned)
#define CAPI_NCCI_GETUNIT _IOR('C',0x27, unsigned)
#endif /* __LINUX_CAPI_H__ */

240
include/linux/cciss_ioctl.h Normal file
View File

@@ -0,0 +1,240 @@
#ifndef CCISS_IOCTLH
#define CCISS_IOCTLH
#include <linux/types.h>
#include <linux/ioctl.h>
#define CCISS_IOC_MAGIC 'B'
typedef struct _cciss_pci_info_struct
{
unsigned char bus;
unsigned char dev_fn;
__u32 board_id;
} cciss_pci_info_struct;
typedef struct _cciss_coalint_struct
{
__u32 delay;
__u32 count;
} cciss_coalint_struct;
typedef char NodeName_type[16];
typedef __u32 Heartbeat_type;
#define CISS_PARSCSIU2 0x0001
#define CISS_PARCSCIU3 0x0002
#define CISS_FIBRE1G 0x0100
#define CISS_FIBRE2G 0x0200
typedef __u32 BusTypes_type;
typedef char FirmwareVer_type[4];
typedef __u32 DriverVer_type;
#define MAX_KMALLOC_SIZE 128000
#ifndef CCISS_CMD_H
// This defines are duplicated in cciss_cmd.h in the driver directory
//general boundary defintions
#define SENSEINFOBYTES 32//note that this value may vary between host implementations
//Command Status value
#define CMD_SUCCESS 0x0000
#define CMD_TARGET_STATUS 0x0001
#define CMD_DATA_UNDERRUN 0x0002
#define CMD_DATA_OVERRUN 0x0003
#define CMD_INVALID 0x0004
#define CMD_PROTOCOL_ERR 0x0005
#define CMD_HARDWARE_ERR 0x0006
#define CMD_CONNECTION_LOST 0x0007
#define CMD_ABORTED 0x0008
#define CMD_ABORT_FAILED 0x0009
#define CMD_UNSOLICITED_ABORT 0x000A
#define CMD_TIMEOUT 0x000B
#define CMD_UNABORTABLE 0x000C
//transfer direction
#define XFER_NONE 0x00
#define XFER_WRITE 0x01
#define XFER_READ 0x02
#define XFER_RSVD 0x03
//task attribute
#define ATTR_UNTAGGED 0x00
#define ATTR_SIMPLE 0x04
#define ATTR_HEADOFQUEUE 0x05
#define ATTR_ORDERED 0x06
#define ATTR_ACA 0x07
//cdb type
#define TYPE_CMD 0x00
#define TYPE_MSG 0x01
// Type defs used in the following structs
#define BYTE __u8
#define WORD __u16
#define HWORD __u16
#define DWORD __u32
#define CISS_MAX_LUN 16
#define LEVEL2LUN 1 // index into Target(x) structure, due to byte swapping
#define LEVEL3LUN 0
#pragma pack(1)
//Command List Structure
typedef union _SCSI3Addr_struct {
struct {
BYTE Dev;
BYTE Bus:6;
BYTE Mode:2; // b00
} PeripDev;
struct {
BYTE DevLSB;
BYTE DevMSB:6;
BYTE Mode:2; // b01
} LogDev;
struct {
BYTE Dev:5;
BYTE Bus:3;
BYTE Targ:6;
BYTE Mode:2; // b10
} LogUnit;
} SCSI3Addr_struct;
typedef struct _PhysDevAddr_struct {
DWORD TargetId:24;
DWORD Bus:6;
DWORD Mode:2;
SCSI3Addr_struct Target[2]; //2 level target device addr
} PhysDevAddr_struct;
typedef struct _LogDevAddr_struct {
DWORD VolId:30;
DWORD Mode:2;
BYTE reserved[4];
} LogDevAddr_struct;
typedef union _LUNAddr_struct {
BYTE LunAddrBytes[8];
SCSI3Addr_struct SCSI3Lun[4];
PhysDevAddr_struct PhysDev;
LogDevAddr_struct LogDev;
} LUNAddr_struct;
typedef struct _RequestBlock_struct {
BYTE CDBLen;
struct {
BYTE Type:3;
BYTE Attribute:3;
BYTE Direction:2;
} Type;
HWORD Timeout;
BYTE CDB[16];
} RequestBlock_struct;
typedef union _MoreErrInfo_struct{
struct {
BYTE Reserved[3];
BYTE Type;
DWORD ErrorInfo;
}Common_Info;
struct{
BYTE Reserved[2];
BYTE offense_size;//size of offending entry
BYTE offense_num; //byte # of offense 0-base
DWORD offense_value;
}Invalid_Cmd;
}MoreErrInfo_struct;
typedef struct _ErrorInfo_struct {
BYTE ScsiStatus;
BYTE SenseLen;
HWORD CommandStatus;
DWORD ResidualCnt;
MoreErrInfo_struct MoreErrInfo;
BYTE SenseInfo[SENSEINFOBYTES];
} ErrorInfo_struct;
#pragma pack()
#endif /* CCISS_CMD_H */
typedef struct _IOCTL_Command_struct {
LUNAddr_struct LUN_info;
RequestBlock_struct Request;
ErrorInfo_struct error_info;
WORD buf_size; /* size in bytes of the buf */
BYTE __user *buf;
} IOCTL_Command_struct;
typedef struct _BIG_IOCTL_Command_struct {
LUNAddr_struct LUN_info;
RequestBlock_struct Request;
ErrorInfo_struct error_info;
DWORD malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */
DWORD buf_size; /* size in bytes of the buf */
/* < malloc_size * MAXSGENTRIES */
BYTE __user *buf;
} BIG_IOCTL_Command_struct;
typedef struct _LogvolInfo_struct{
__u32 LunID;
int num_opens; /* number of opens on the logical volume */
int num_parts; /* number of partitions configured on logvol */
} LogvolInfo_struct;
#define CCISS_GETPCIINFO _IOR(CCISS_IOC_MAGIC, 1, cciss_pci_info_struct)
#define CCISS_GETINTINFO _IOR(CCISS_IOC_MAGIC, 2, cciss_coalint_struct)
#define CCISS_SETINTINFO _IOW(CCISS_IOC_MAGIC, 3, cciss_coalint_struct)
#define CCISS_GETNODENAME _IOR(CCISS_IOC_MAGIC, 4, NodeName_type)
#define CCISS_SETNODENAME _IOW(CCISS_IOC_MAGIC, 5, NodeName_type)
#define CCISS_GETHEARTBEAT _IOR(CCISS_IOC_MAGIC, 6, Heartbeat_type)
#define CCISS_GETBUSTYPES _IOR(CCISS_IOC_MAGIC, 7, BusTypes_type)
#define CCISS_GETFIRMVER _IOR(CCISS_IOC_MAGIC, 8, FirmwareVer_type)
#define CCISS_GETDRIVVER _IOR(CCISS_IOC_MAGIC, 9, DriverVer_type)
#define CCISS_REVALIDVOLS _IO(CCISS_IOC_MAGIC, 10)
#define CCISS_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 11, IOCTL_Command_struct)
#define CCISS_DEREGDISK _IO(CCISS_IOC_MAGIC, 12)
/* no longer used... use REGNEWD instead */
#define CCISS_REGNEWDISK _IOW(CCISS_IOC_MAGIC, 13, int)
#define CCISS_REGNEWD _IO(CCISS_IOC_MAGIC, 14)
#define CCISS_RESCANDISK _IO(CCISS_IOC_MAGIC, 16)
#define CCISS_GETLUNINFO _IOR(CCISS_IOC_MAGIC, 17, LogvolInfo_struct)
#define CCISS_BIG_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL_Command_struct)
#ifdef __KERNEL__
#ifdef CONFIG_COMPAT
/* 32 bit compatible ioctl structs */
typedef struct _IOCTL32_Command_struct {
LUNAddr_struct LUN_info;
RequestBlock_struct Request;
ErrorInfo_struct error_info;
WORD buf_size; /* size in bytes of the buf */
__u32 buf; /* 32 bit pointer to data buffer */
} IOCTL32_Command_struct;
typedef struct _BIG_IOCTL32_Command_struct {
LUNAddr_struct LUN_info;
RequestBlock_struct Request;
ErrorInfo_struct error_info;
DWORD malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */
DWORD buf_size; /* size in bytes of the buf */
/* < malloc_size * MAXSGENTRIES */
__u32 buf; /* 32 bit pointer to data buffer */
} BIG_IOCTL32_Command_struct;
#define CCISS_PASSTHRU32 _IOWR(CCISS_IOC_MAGIC, 11, IOCTL32_Command_struct)
#define CCISS_BIG_PASSTHRU32 _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL32_Command_struct)
#endif /* CONFIG_COMPAT */
#endif /* __KERNEL__ */
#endif

292
include/linux/cd1400.h Normal file
View File

@@ -0,0 +1,292 @@
/*****************************************************************************/
/*
* cd1400.h -- cd1400 UART hardware info.
*
* Copyright (C) 1996-1998 Stallion Technologies
* Copyright (C) 1994-1996 Greg Ungerer.
*
* 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 of the License, 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; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*****************************************************************************/
#ifndef _CD1400_H
#define _CD1400_H
/*****************************************************************************/
/*
* Define the number of async ports per cd1400 uart chip.
*/
#define CD1400_PORTS 4
/*
* Define the cd1400 uarts internal FIFO sizes.
*/
#define CD1400_TXFIFOSIZE 12
#define CD1400_RXFIFOSIZE 12
/*
* Local RX FIFO thresh hold level. Also define the RTS thresh hold
* based on the RX thresh hold.
*/
#define FIFO_RXTHRESHOLD 6
#define FIFO_RTSTHRESHOLD 7
/*****************************************************************************/
/*
* Define the cd1400 register addresses. These are all the valid
* registers with the cd1400. Some are global, some virtual, some
* per port.
*/
#define GFRCR 0x40
#define CAR 0x68
#define GCR 0x4b
#define SVRR 0x67
#define RICR 0x44
#define TICR 0x45
#define MICR 0x46
#define RIR 0x6b
#define TIR 0x6a
#define MIR 0x69
#define PPR 0x7e
#define RIVR 0x43
#define TIVR 0x42
#define MIVR 0x41
#define TDR 0x63
#define RDSR 0x62
#define MISR 0x4c
#define EOSRR 0x60
#define LIVR 0x18
#define CCR 0x05
#define SRER 0x06
#define COR1 0x08
#define COR2 0x09
#define COR3 0x0a
#define COR4 0x1e
#define COR5 0x1f
#define CCSR 0x0b
#define RDCR 0x0e
#define SCHR1 0x1a
#define SCHR2 0x1b
#define SCHR3 0x1c
#define SCHR4 0x1d
#define SCRL 0x22
#define SCRH 0x23
#define LNC 0x24
#define MCOR1 0x15
#define MCOR2 0x16
#define RTPR 0x21
#define MSVR1 0x6c
#define MSVR2 0x6d
#define PSVR 0x6f
#define RBPR 0x78
#define RCOR 0x7c
#define TBPR 0x72
#define TCOR 0x76
/*****************************************************************************/
/*
* Define the set of baud rate clock divisors.
*/
#define CD1400_CLK0 8
#define CD1400_CLK1 32
#define CD1400_CLK2 128
#define CD1400_CLK3 512
#define CD1400_CLK4 2048
#define CD1400_NUMCLKS 5
/*****************************************************************************/
/*
* Define the clock pre-scalar value to be a 5 ms clock. This should be
* OK for now. It would probably be better to make it 10 ms, but we
* can't fit that divisor into 8 bits!
*/
#define PPR_SCALAR 244
/*****************************************************************************/
/*
* Define values used to set character size options.
*/
#define COR1_CHL5 0x00
#define COR1_CHL6 0x01
#define COR1_CHL7 0x02
#define COR1_CHL8 0x03
/*
* Define values used to set the number of stop bits.
*/
#define COR1_STOP1 0x00
#define COR1_STOP15 0x04
#define COR1_STOP2 0x08
/*
* Define values used to set the parity scheme in use.
*/
#define COR1_PARNONE 0x00
#define COR1_PARFORCE 0x20
#define COR1_PARENB 0x40
#define COR1_PARIGNORE 0x10
#define COR1_PARODD 0x80
#define COR1_PAREVEN 0x00
#define COR2_IXM 0x80
#define COR2_TXIBE 0x40
#define COR2_ETC 0x20
#define COR2_LLM 0x10
#define COR2_RLM 0x08
#define COR2_RTSAO 0x04
#define COR2_CTSAE 0x02
#define COR3_SCDRNG 0x80
#define COR3_SCD34 0x40
#define COR3_FCT 0x20
#define COR3_SCD12 0x10
/*
* Define values used by COR4.
*/
#define COR4_BRKINT 0x08
#define COR4_IGNBRK 0x18
/*****************************************************************************/
/*
* Define the modem control register values.
* Note that the actual hardware is a little different to the conventional
* pin names on the cd1400.
*/
#define MSVR1_DTR 0x01
#define MSVR1_DSR 0x10
#define MSVR1_RI 0x20
#define MSVR1_CTS 0x40
#define MSVR1_DCD 0x80
#define MSVR2_RTS 0x02
#define MSVR2_DSR 0x10
#define MSVR2_RI 0x20
#define MSVR2_CTS 0x40
#define MSVR2_DCD 0x80
#define MCOR1_DCD 0x80
#define MCOR1_CTS 0x40
#define MCOR1_RI 0x20
#define MCOR1_DSR 0x10
#define MCOR2_DCD 0x80
#define MCOR2_CTS 0x40
#define MCOR2_RI 0x20
#define MCOR2_DSR 0x10
/*****************************************************************************/
/*
* Define the bits used with the service (interrupt) enable register.
*/
#define SRER_NNDT 0x01
#define SRER_TXEMPTY 0x02
#define SRER_TXDATA 0x04
#define SRER_RXDATA 0x10
#define SRER_MODEM 0x80
/*****************************************************************************/
/*
* Define operational commands for the command register.
*/
#define CCR_RESET 0x80
#define CCR_CORCHANGE 0x4e
#define CCR_SENDCH 0x20
#define CCR_CHANCTRL 0x10
#define CCR_TXENABLE (CCR_CHANCTRL | 0x08)
#define CCR_TXDISABLE (CCR_CHANCTRL | 0x04)
#define CCR_RXENABLE (CCR_CHANCTRL | 0x02)
#define CCR_RXDISABLE (CCR_CHANCTRL | 0x01)
#define CCR_SENDSCHR1 (CCR_SENDCH | 0x01)
#define CCR_SENDSCHR2 (CCR_SENDCH | 0x02)
#define CCR_SENDSCHR3 (CCR_SENDCH | 0x03)
#define CCR_SENDSCHR4 (CCR_SENDCH | 0x04)
#define CCR_RESETCHAN (CCR_RESET | 0x00)
#define CCR_RESETFULL (CCR_RESET | 0x01)
#define CCR_TXFLUSHFIFO (CCR_RESET | 0x02)
#define CCR_MAXWAIT 10000
/*****************************************************************************/
/*
* Define the valid acknowledgement types (for hw ack cycle).
*/
#define ACK_TYPMASK 0x07
#define ACK_TYPTX 0x02
#define ACK_TYPMDM 0x01
#define ACK_TYPRXGOOD 0x03
#define ACK_TYPRXBAD 0x07
#define SVRR_RX 0x01
#define SVRR_TX 0x02
#define SVRR_MDM 0x04
#define ST_OVERRUN 0x01
#define ST_FRAMING 0x02
#define ST_PARITY 0x04
#define ST_BREAK 0x08
#define ST_SCHAR1 0x10
#define ST_SCHAR2 0x20
#define ST_SCHAR3 0x30
#define ST_SCHAR4 0x40
#define ST_RANGE 0x70
#define ST_SCHARMASK 0x70
#define ST_TIMEOUT 0x80
#define MISR_DCD 0x80
#define MISR_CTS 0x40
#define MISR_RI 0x20
#define MISR_DSR 0x10
/*****************************************************************************/
/*
* Defines for the CCSR status register.
*/
#define CCSR_RXENABLED 0x80
#define CCSR_RXFLOWON 0x40
#define CCSR_RXFLOWOFF 0x20
#define CCSR_TXENABLED 0x08
#define CCSR_TXFLOWON 0x04
#define CCSR_TXFLOWOFF 0x02
/*****************************************************************************/
/*
* Define the embedded commands.
*/
#define ETC_CMD 0x00
#define ETC_STARTBREAK 0x81
#define ETC_DELAY 0x82
#define ETC_STOPBREAK 0x83
/*****************************************************************************/
#endif

27
include/linux/cdev.h Normal file
View File

@@ -0,0 +1,27 @@
#ifndef _LINUX_CDEV_H
#define _LINUX_CDEV_H
#ifdef __KERNEL__
struct cdev {
struct kobject kobj;
struct module *owner;
struct file_operations *ops;
struct list_head list;
dev_t dev;
unsigned int count;
};
void cdev_init(struct cdev *, struct file_operations *);
struct cdev *cdev_alloc(void);
void cdev_put(struct cdev *p);
int cdev_add(struct cdev *, dev_t, unsigned);
void cdev_del(struct cdev *);
void cd_forget(struct inode *);
#endif
#endif

486
include/linux/cdk.h Normal file
View File

@@ -0,0 +1,486 @@
/*****************************************************************************/
/*
* cdk.h -- CDK interface definitions.
*
* Copyright (C) 1996-1998 Stallion Technologies
* Copyright (C) 1994-1996 Greg Ungerer.
*
* 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 of the License, 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; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*****************************************************************************/
#ifndef _CDK_H
#define _CDK_H
/*****************************************************************************/
#pragma pack(2)
/*
* The following set of definitions is used to communicate with the
* shared memory interface of the Stallion intelligent multiport serial
* boards. The definitions in this file are taken directly from the
* document titled "Generic Stackable Interface, Downloader and
* Communications Development Kit".
*/
/*
* Define the set of important shared memory addresses. These are
* required to initialize the board and get things started. All of these
* addresses are relative to the start of the shared memory.
*/
#define CDK_SIGADDR 0x200
#define CDK_FEATADDR 0x280
#define CDK_CDKADDR 0x300
#define CDK_RDYADDR 0x262
#define CDK_ALIVEMARKER 13
/*
* On hardware power up the ROMs located on the EasyConnection 8/64 will
* fill out the following signature information into shared memory. This
* way the host system can quickly determine that the board is present
* and is operational.
*/
typedef struct cdkecpsig {
unsigned long magic;
unsigned short romver;
unsigned short cputype;
unsigned char panelid[8];
} cdkecpsig_t;
#define ECP_MAGIC 0x21504345
/*
* On hardware power up the ROMs located on the ONboard, Stallion and
* Brumbys will fill out the following signature information into shared
* memory. This way the host system can quickly determine that the board
* is present and is operational.
*/
typedef struct cdkonbsig {
unsigned short magic0;
unsigned short magic1;
unsigned short magic2;
unsigned short magic3;
unsigned short romver;
unsigned short memoff;
unsigned short memseg;
unsigned short amask0;
unsigned short pic;
unsigned short status;
unsigned short btype;
unsigned short clkticks;
unsigned short clkspeed;
unsigned short amask1;
unsigned short amask2;
} cdkonbsig_t;
#define ONB_MAGIC0 0xf2a7
#define ONB_MAGIC1 0xa149
#define ONB_MAGIC2 0x6352
#define ONB_MAGIC3 0xf121
/*
* Define the feature area structure. The feature area is the set of
* startup parameters used by the slave image when it starts executing.
* They allow for the specification of buffer sizes, debug trace, etc.
*/
typedef struct cdkfeature {
unsigned long debug;
unsigned long banner;
unsigned long etype;
unsigned long nrdevs;
unsigned long brdspec;
unsigned long txrqsize;
unsigned long rxrqsize;
unsigned long flags;
} cdkfeature_t;
#define ETYP_DDK 0
#define ETYP_CDK 1
/*
* Define the CDK header structure. This is the info that the slave
* environment sets up after it has been downloaded and started. It
* essentially provides a memory map for the shared memory interface.
*/
typedef struct cdkhdr {
unsigned short command;
unsigned short status;
unsigned short port;
unsigned short mode;
unsigned long cmd_buf[14];
unsigned short alive_cnt;
unsigned short intrpt_mode;
unsigned char intrpt_id[8];
unsigned char ver_release;
unsigned char ver_modification;
unsigned char ver_fix;
unsigned char deadman_restart;
unsigned short deadman;
unsigned short nrdevs;
unsigned long memp;
unsigned long hostp;
unsigned long slavep;
unsigned char hostreq;
unsigned char slavereq;
unsigned char cmd_reserved[30];
} cdkhdr_t;
#define MODE_DDK 0
#define MODE_CDK 1
#define IMD_INTR 0x0
#define IMD_PPINTR 0x1
#define IMD_POLL 0xff
/*
* Define the memory mapping structure. This structure is pointed to by
* the memp field in the stlcdkhdr struct. As many as these structures
* as required are layed out in shared memory to define how the rest of
* shared memory is divided up. There will be one for each port.
*/
typedef struct cdkmem {
unsigned short dtype;
unsigned long offset;
} cdkmem_t;
#define TYP_UNDEFINED 0x0
#define TYP_ASYNCTRL 0x1
#define TYP_ASYNC 0x20
#define TYP_PARALLEL 0x40
#define TYP_SYNCX21 0x60
/*****************************************************************************/
/*
* Following is a set of defines and structures used to actually deal
* with the serial ports on the board. Firstly is the set of commands
* that can be applied to ports.
*/
#define ASYCMD (((unsigned long) 'a') << 8)
#define A_NULL (ASYCMD | 0)
#define A_FLUSH (ASYCMD | 1)
#define A_BREAK (ASYCMD | 2)
#define A_GETPORT (ASYCMD | 3)
#define A_SETPORT (ASYCMD | 4)
#define A_SETPORTF (ASYCMD | 5)
#define A_SETPORTFTX (ASYCMD | 6)
#define A_SETPORTFRX (ASYCMD | 7)
#define A_GETSIGNALS (ASYCMD | 8)
#define A_SETSIGNALS (ASYCMD | 9)
#define A_SETSIGNALSF (ASYCMD | 10)
#define A_SETSIGNALSFTX (ASYCMD | 11)
#define A_SETSIGNALSFRX (ASYCMD | 12)
#define A_GETNOTIFY (ASYCMD | 13)
#define A_SETNOTIFY (ASYCMD | 14)
#define A_NOTIFY (ASYCMD | 15)
#define A_PORTCTRL (ASYCMD | 16)
#define A_GETSTATS (ASYCMD | 17)
#define A_RQSTATE (ASYCMD | 18)
#define A_FLOWSTATE (ASYCMD | 19)
#define A_CLEARSTATS (ASYCMD | 20)
/*
* Define those arguments used for simple commands.
*/
#define FLUSHRX 0x1
#define FLUSHTX 0x2
#define BREAKON -1
#define BREAKOFF -2
/*
* Define the port setting structure, and all those defines that go along
* with it. Basically this structure defines the characteristics of this
* port: baud rate, chars, parity, input/output char cooking etc.
*/
typedef struct asyport {
unsigned long baudout;
unsigned long baudin;
unsigned long iflag;
unsigned long oflag;
unsigned long lflag;
unsigned long pflag;
unsigned long flow;
unsigned long spare1;
unsigned short vtime;
unsigned short vmin;
unsigned short txlo;
unsigned short txhi;
unsigned short rxlo;
unsigned short rxhi;
unsigned short rxhog;
unsigned short spare2;
unsigned char csize;
unsigned char stopbs;
unsigned char parity;
unsigned char stopin;
unsigned char startin;
unsigned char stopout;
unsigned char startout;
unsigned char parmark;
unsigned char brkmark;
unsigned char cc[11];
} asyport_t;
#define PT_STOP1 0x0
#define PT_STOP15 0x1
#define PT_STOP2 0x2
#define PT_NOPARITY 0x0
#define PT_ODDPARITY 0x1
#define PT_EVENPARITY 0x2
#define PT_MARKPARITY 0x3
#define PT_SPACEPARITY 0x4
#define F_NONE 0x0
#define F_IXON 0x1
#define F_IXOFF 0x2
#define F_IXANY 0x4
#define F_IOXANY 0x8
#define F_RTSFLOW 0x10
#define F_CTSFLOW 0x20
#define F_DTRFLOW 0x40
#define F_DCDFLOW 0x80
#define F_DSROFLOW 0x100
#define F_DSRIFLOW 0x200
#define FI_NORX 0x1
#define FI_RAW 0x2
#define FI_ISTRIP 0x4
#define FI_UCLC 0x8
#define FI_INLCR 0x10
#define FI_ICRNL 0x20
#define FI_IGNCR 0x40
#define FI_IGNBREAK 0x80
#define FI_DSCRDBREAK 0x100
#define FI_1MARKBREAK 0x200
#define FI_2MARKBREAK 0x400
#define FI_XCHNGBREAK 0x800
#define FI_IGNRXERRS 0x1000
#define FI_DSCDRXERRS 0x2000
#define FI_1MARKRXERRS 0x4000
#define FI_2MARKRXERRS 0x8000
#define FI_XCHNGRXERRS 0x10000
#define FI_DSCRDNULL 0x20000
#define FO_OLCUC 0x1
#define FO_ONLCR 0x2
#define FO_OOCRNL 0x4
#define FO_ONOCR 0x8
#define FO_ONLRET 0x10
#define FO_ONL 0x20
#define FO_OBS 0x40
#define FO_OVT 0x80
#define FO_OFF 0x100
#define FO_OTAB1 0x200
#define FO_OTAB2 0x400
#define FO_OTAB3 0x800
#define FO_OCR1 0x1000
#define FO_OCR2 0x2000
#define FO_OCR3 0x4000
#define FO_OFILL 0x8000
#define FO_ODELL 0x10000
#define P_RTSLOCK 0x1
#define P_CTSLOCK 0x2
#define P_MAPRTS 0x4
#define P_MAPCTS 0x8
#define P_LOOPBACK 0x10
#define P_DTRFOLLOW 0x20
#define P_FAKEDCD 0x40
#define P_RXIMIN 0x10000
#define P_RXITIME 0x20000
#define P_RXTHOLD 0x40000
/*
* Define a structure to communicate serial port signal and data state
* information.
*/
typedef struct asysigs {
unsigned long data;
unsigned long signal;
unsigned long sigvalue;
} asysigs_t;
#define DT_TXBUSY 0x1
#define DT_TXEMPTY 0x2
#define DT_TXLOW 0x4
#define DT_TXHIGH 0x8
#define DT_TXFULL 0x10
#define DT_TXHOG 0x20
#define DT_TXFLOWED 0x40
#define DT_TXBREAK 0x80
#define DT_RXBUSY 0x100
#define DT_RXEMPTY 0x200
#define DT_RXLOW 0x400
#define DT_RXHIGH 0x800
#define DT_RXFULL 0x1000
#define DT_RXHOG 0x2000
#define DT_RXFLOWED 0x4000
#define DT_RXBREAK 0x8000
#define SG_DTR 0x1
#define SG_DCD 0x2
#define SG_RTS 0x4
#define SG_CTS 0x8
#define SG_DSR 0x10
#define SG_RI 0x20
/*
* Define the notification setting structure. This is used to tell the
* port what events we want to be informed about. Fields here use the
* same defines as for the asysigs structure above.
*/
typedef struct asynotify {
unsigned long ctrl;
unsigned long data;
unsigned long signal;
unsigned long sigvalue;
} asynotify_t;
/*
* Define the port control structure. It is used to do fine grain
* control operations on the port.
*/
typedef struct {
unsigned long rxctrl;
unsigned long txctrl;
char rximdch;
char tximdch;
char spare1;
char spare2;
} asyctrl_t;
#define CT_ENABLE 0x1
#define CT_DISABLE 0x2
#define CT_STOP 0x4
#define CT_START 0x8
#define CT_STARTFLOW 0x10
#define CT_STOPFLOW 0x20
#define CT_SENDCHR 0x40
/*
* Define the stats structure kept for each port. This is a useful set
* of data collected for each port on the slave. The A_GETSTATS command
* is used to retrieve this data from the slave.
*/
typedef struct asystats {
unsigned long opens;
unsigned long txchars;
unsigned long rxchars;
unsigned long txringq;
unsigned long rxringq;
unsigned long txmsgs;
unsigned long rxmsgs;
unsigned long txflushes;
unsigned long rxflushes;
unsigned long overruns;
unsigned long framing;
unsigned long parity;
unsigned long ringover;
unsigned long lost;
unsigned long rxstart;
unsigned long rxstop;
unsigned long txstart;
unsigned long txstop;
unsigned long dcdcnt;
unsigned long dtrcnt;
unsigned long ctscnt;
unsigned long rtscnt;
unsigned long dsrcnt;
unsigned long ricnt;
unsigned long txbreaks;
unsigned long rxbreaks;
unsigned long signals;
unsigned long state;
unsigned long hwid;
} asystats_t;
/*****************************************************************************/
/*
* All command and control communication with a device on the slave is
* via a control block in shared memory. Each device has its own control
* block, defined by the following structure. The control block allows
* the host to open, close and control the device on the slave.
*/
typedef struct cdkctrl {
unsigned char open;
unsigned char close;
unsigned long openarg;
unsigned long closearg;
unsigned long cmd;
unsigned long status;
unsigned long args[32];
} cdkctrl_t;
/*
* Each device on the slave passes data to and from the host via a ring
* queue in shared memory. Define a ring queue structure to hold the
* vital information about each ring queue. Two ring queues will be
* allocated for each port, one for receive data and one for transmit
* data.
*/
typedef struct cdkasyrq {
unsigned long offset;
unsigned short size;
unsigned short head;
unsigned short tail;
} cdkasyrq_t;
/*
* Each asynchronous port is defined in shared memory by the following
* structure. It contains a control block to command a device, and also
* the necessary data channel information as well.
*/
typedef struct cdkasy {
cdkctrl_t ctrl;
unsigned short notify;
asynotify_t changed;
unsigned short receive;
cdkasyrq_t rxq;
unsigned short transmit;
cdkasyrq_t txq;
} cdkasy_t;
#pragma pack()
/*****************************************************************************/
/*
* Define the set of ioctls used by the driver to do special things
* to the board. These include interrupting it, and initializing
* the driver after board startup and shutdown.
*/
#include <linux/ioctl.h>
#define STL_BINTR _IO('s',20)
#define STL_BSTART _IO('s',21)
#define STL_BSTOP _IO('s',22)
#define STL_BRESET _IO('s',23)
/*
* Define a set of ioctl extensions, used to get at special stuff.
*/
#define STL_GETPFLAG _IO('s',80)
#define STL_SETPFLAG _IO('s',81)
/*****************************************************************************/
#endif

1192
include/linux/cdrom.h Normal file

File diff suppressed because it is too large Load Diff

32
include/linux/circ_buf.h Normal file
View File

@@ -0,0 +1,32 @@
#ifndef _LINUX_CIRC_BUF_H
#define _LINUX_CIRC_BUF_H 1
struct circ_buf {
char *buf;
int head;
int tail;
};
/* Return count in buffer. */
#define CIRC_CNT(head,tail,size) (((head) - (tail)) & ((size)-1))
/* Return space available, 0..size-1. We always leave one free char
as a completely full buffer has head == tail, which is the same as
empty. */
#define CIRC_SPACE(head,tail,size) CIRC_CNT((tail),((head)+1),(size))
/* Return count up to the end of the buffer. Carefully avoid
accessing head and tail more than once, so they can change
underneath us without returning inconsistent results. */
#define CIRC_CNT_TO_END(head,tail,size) \
({int end = (size) - (tail); \
int n = ((head) + end) & ((size)-1); \
n < end ? n : end;})
/* Return space available up to the end of the buffer. */
#define CIRC_SPACE_TO_END(head,tail,size) \
({int end = (size) - 1 - (head); \
int n = (end + (tail)) & ((size)-1); \
n <= end ? n : end+1;})
#endif /* _LINUX_CIRC_BUF_H */

View File

@@ -0,0 +1,109 @@
/*
* $Id: cobalt-nvram.h,v 1.20 2001/10/17 23:16:55 thockin Exp $
* cobalt-nvram.h : defines for the various fields in the cobalt NVRAM
*
* Copyright 2001,2002 Sun Microsystems, Inc.
*/
#ifndef COBALT_NVRAM_H
#define COBALT_NVRAM_H
#include <linux/nvram.h>
#define COBT_CMOS_INFO_MAX 0x7f /* top address allowed */
#define COBT_CMOS_BIOS_DRIVE_INFO 0x12 /* drive info would go here */
#define COBT_CMOS_CKS_START NVRAM_OFFSET(0x0e)
#define COBT_CMOS_CKS_END NVRAM_OFFSET(0x7f)
/* flag bytes - 16 flags for now, leave room for more */
#define COBT_CMOS_FLAG_BYTE_0 NVRAM_OFFSET(0x10)
#define COBT_CMOS_FLAG_BYTE_1 NVRAM_OFFSET(0x11)
/* flags in flag bytes - up to 16 */
#define COBT_CMOS_FLAG_MIN 0x0001
#define COBT_CMOS_CONSOLE_FLAG 0x0001 /* console on/off */
#define COBT_CMOS_DEBUG_FLAG 0x0002 /* ROM debug messages */
#define COBT_CMOS_AUTO_PROMPT_FLAG 0x0004 /* boot to ROM prompt? */
#define COBT_CMOS_CLEAN_BOOT_FLAG 0x0008 /* set by a clean shutdown */
#define COBT_CMOS_HW_NOPROBE_FLAG 0x0010 /* go easy on the probing */
#define COBT_CMOS_SYSFAULT_FLAG 0x0020 /* system fault detected */
#define COBT_CMOS_OOPSPANIC_FLAG 0x0040 /* panic on oops */
#define COBT_CMOS_DELAY_CACHE_FLAG 0x0080 /* delay cache initialization */
#define COBT_CMOS_NOLOGO_FLAG 0x0100 /* hide "C" logo @ boot */
#define COBT_CMOS_VERSION_FLAG 0x0200 /* the version field is valid */
#define COBT_CMOS_FLAG_MAX 0x0200
/* leave byte 0x12 blank - Linux looks for drive info here */
/* CMOS structure version, valid if COBT_CMOS_VERSION_FLAG is true */
#define COBT_CMOS_VERSION NVRAM_OFFSET(0x13)
#define COBT_CMOS_VER_BTOCODE 1 /* min. version needed for btocode */
/* index of default boot method */
#define COBT_CMOS_BOOT_METHOD NVRAM_OFFSET(0x20)
#define COBT_CMOS_BOOT_METHOD_DISK 0
#define COBT_CMOS_BOOT_METHOD_ROM 1
#define COBT_CMOS_BOOT_METHOD_NET 2
#define COBT_CMOS_BOOT_DEV_MIN NVRAM_OFFSET(0x21)
/* major #, minor # of first through fourth boot device */
#define COBT_CMOS_BOOT_DEV0_MAJ NVRAM_OFFSET(0x21)
#define COBT_CMOS_BOOT_DEV0_MIN NVRAM_OFFSET(0x22)
#define COBT_CMOS_BOOT_DEV1_MAJ NVRAM_OFFSET(0x23)
#define COBT_CMOS_BOOT_DEV1_MIN NVRAM_OFFSET(0x24)
#define COBT_CMOS_BOOT_DEV2_MAJ NVRAM_OFFSET(0x25)
#define COBT_CMOS_BOOT_DEV2_MIN NVRAM_OFFSET(0x26)
#define COBT_CMOS_BOOT_DEV3_MAJ NVRAM_OFFSET(0x27)
#define COBT_CMOS_BOOT_DEV3_MIN NVRAM_OFFSET(0x28)
#define COBT_CMOS_BOOT_DEV_MAX NVRAM_OFFSET(0x28)
/* checksum of bytes 0xe-0x7f */
#define COBT_CMOS_CHECKSUM NVRAM_OFFSET(0x2e)
/* running uptime counter, units of 5 minutes (32 bits =~ 41000 years) */
#define COBT_CMOS_UPTIME_0 NVRAM_OFFSET(0x30)
#define COBT_CMOS_UPTIME_1 NVRAM_OFFSET(0x31)
#define COBT_CMOS_UPTIME_2 NVRAM_OFFSET(0x32)
#define COBT_CMOS_UPTIME_3 NVRAM_OFFSET(0x33)
/* count of successful boots (32 bits) */
#define COBT_CMOS_BOOTCOUNT_0 NVRAM_OFFSET(0x38)
#define COBT_CMOS_BOOTCOUNT_1 NVRAM_OFFSET(0x39)
#define COBT_CMOS_BOOTCOUNT_2 NVRAM_OFFSET(0x3a)
#define COBT_CMOS_BOOTCOUNT_3 NVRAM_OFFSET(0x3b)
/* 13 bytes: system serial number, same as on the back of the system */
#define COBT_CMOS_SYS_SERNUM_LEN 13
#define COBT_CMOS_SYS_SERNUM_0 NVRAM_OFFSET(0x40)
#define COBT_CMOS_SYS_SERNUM_1 NVRAM_OFFSET(0x41)
#define COBT_CMOS_SYS_SERNUM_2 NVRAM_OFFSET(0x42)
#define COBT_CMOS_SYS_SERNUM_3 NVRAM_OFFSET(0x43)
#define COBT_CMOS_SYS_SERNUM_4 NVRAM_OFFSET(0x44)
#define COBT_CMOS_SYS_SERNUM_5 NVRAM_OFFSET(0x45)
#define COBT_CMOS_SYS_SERNUM_6 NVRAM_OFFSET(0x46)
#define COBT_CMOS_SYS_SERNUM_7 NVRAM_OFFSET(0x47)
#define COBT_CMOS_SYS_SERNUM_8 NVRAM_OFFSET(0x48)
#define COBT_CMOS_SYS_SERNUM_9 NVRAM_OFFSET(0x49)
#define COBT_CMOS_SYS_SERNUM_10 NVRAM_OFFSET(0x4a)
#define COBT_CMOS_SYS_SERNUM_11 NVRAM_OFFSET(0x4b)
#define COBT_CMOS_SYS_SERNUM_12 NVRAM_OFFSET(0x4c)
/* checksum for serial num - 1 byte */
#define COBT_CMOS_SYS_SERNUM_CSUM NVRAM_OFFSET(0x4f)
#define COBT_CMOS_ROM_REV_MAJ NVRAM_OFFSET(0x50)
#define COBT_CMOS_ROM_REV_MIN NVRAM_OFFSET(0x51)
#define COBT_CMOS_ROM_REV_REV NVRAM_OFFSET(0x52)
#define COBT_CMOS_BTO_CODE_0 NVRAM_OFFSET(0x53)
#define COBT_CMOS_BTO_CODE_1 NVRAM_OFFSET(0x54)
#define COBT_CMOS_BTO_CODE_2 NVRAM_OFFSET(0x55)
#define COBT_CMOS_BTO_CODE_3 NVRAM_OFFSET(0x56)
#define COBT_CMOS_BTO_IP_CSUM NVRAM_OFFSET(0x57)
#define COBT_CMOS_BTO_IP_0 NVRAM_OFFSET(0x58)
#define COBT_CMOS_BTO_IP_1 NVRAM_OFFSET(0x59)
#define COBT_CMOS_BTO_IP_2 NVRAM_OFFSET(0x5a)
#define COBT_CMOS_BTO_IP_3 NVRAM_OFFSET(0x5b)
#endif /* COBALT_NVRAM_H */

788
include/linux/coda.h Normal file
View File

@@ -0,0 +1,788 @@
/*
You may distribute this file under either of the two licenses that
follow at your discretion.
*/
/* BLURB lgpl
Coda File System
Release 5
Copyright (c) 1987-1999 Carnegie Mellon University
Additional copyrights listed below
This code is distributed "AS IS" without warranty of any kind under
the terms of the GNU Library General Public Licence Version 2, as
shown in the file LICENSE, or under the license shown below. The
technical and financial contributors to Coda are listed in the file
CREDITS.
Additional copyrights
*/
/*
Coda: an Experimental Distributed File System
Release 4.0
Copyright (c) 1987-1999 Carnegie Mellon University
All Rights Reserved
Permission to use, copy, modify and distribute this software and its
documentation is hereby granted, provided that both the copyright
notice and this permission notice appear in all copies of the
software, derivative works or modified versions, and any portions
thereof, and that both notices appear in supporting documentation, and
that credit is given to Carnegie Mellon University in all documents
and publicity pertaining to direct or indirect use of this code or its
derivatives.
CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS
FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON
DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER
RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
ANY DERIVATIVE WORK.
Carnegie Mellon encourages users of this software to return any
improvements or extensions that they make, and to grant Carnegie
Mellon the rights to redistribute these changes without encumbrance.
*/
/*
*
* Based on cfs.h from Mach, but revamped for increased simplicity.
* Linux modifications by
* Peter Braam, Aug 1996
*/
#ifndef _CODA_HEADER_
#define _CODA_HEADER_
#include <linux/config.h>
/* Catch new _KERNEL defn for NetBSD and DJGPP/__CYGWIN32__ */
#if defined(__NetBSD__) || \
((defined(DJGPP) || defined(__CYGWIN32__)) && !defined(KERNEL))
#include <sys/types.h>
#endif
#ifndef CODA_MAXSYMLINKS
#define CODA_MAXSYMLINKS 10
#endif
#if defined(DJGPP) || defined(__CYGWIN32__)
#ifdef KERNEL
typedef unsigned long u_long;
typedef unsigned int u_int;
typedef unsigned short u_short;
typedef u_long ino_t;
typedef u_long dev_t;
typedef void * caddr_t;
#ifdef DOS
typedef unsigned __int64 u_quad_t;
#else
typedef unsigned long long u_quad_t;
#endif
#define inline
struct timespec {
long ts_sec;
long ts_nsec;
};
#else /* DJGPP but not KERNEL */
#include <sys/time.h>
typedef unsigned long long u_quad_t;
#endif /* !KERNEL */
#endif /* !DJGPP */
#if defined(__linux__)
#include <linux/time.h>
#define cdev_t u_quad_t
#ifndef __KERNEL__
#if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2)
#define _UQUAD_T_ 1
typedef unsigned long long u_quad_t;
#endif
#else /*__KERNEL__ */
typedef unsigned long long u_quad_t;
#endif /* __KERNEL__ */
#else
#define cdev_t dev_t
#endif
#ifdef __CYGWIN32__
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
};
#endif
#ifndef __BIT_TYPES_DEFINED__
#define __BIT_TYPES_DEFINED__
typedef signed char int8_t;
typedef unsigned char u_int8_t;
typedef short int16_t;
typedef unsigned short u_int16_t;
typedef int int32_t;
typedef unsigned int u_int32_t;
#endif
/*
* Cfs constants
*/
#define CODA_MAXNAMLEN 255
#define CODA_MAXPATHLEN 1024
#define CODA_MAXSYMLINK 10
/* these are Coda's version of O_RDONLY etc combinations
* to deal with VFS open modes
*/
#define C_O_READ 0x001
#define C_O_WRITE 0x002
#define C_O_TRUNC 0x010
#define C_O_EXCL 0x100
#define C_O_CREAT 0x200
/* these are to find mode bits in Venus */
#define C_M_READ 00400
#define C_M_WRITE 00200
/* for access Venus will use */
#define C_A_C_OK 8 /* Test for writing upon create. */
#define C_A_R_OK 4 /* Test for read permission. */
#define C_A_W_OK 2 /* Test for write permission. */
#define C_A_X_OK 1 /* Test for execute permission. */
#define C_A_F_OK 0 /* Test for existence. */
#ifndef _VENUS_DIRENT_T_
#define _VENUS_DIRENT_T_ 1
struct venus_dirent {
u_int32_t d_fileno; /* file number of entry */
u_int16_t d_reclen; /* length of this record */
u_int8_t d_type; /* file type, see below */
u_int8_t d_namlen; /* length of string in d_name */
char d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */
};
#undef DIRSIZ
#define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \
(((dp)->d_namlen+1 + 3) &~ 3))
/*
* File types
*/
#define CDT_UNKNOWN 0
#define CDT_FIFO 1
#define CDT_CHR 2
#define CDT_DIR 4
#define CDT_BLK 6
#define CDT_REG 8
#define CDT_LNK 10
#define CDT_SOCK 12
#define CDT_WHT 14
/*
* Convert between stat structure types and directory types.
*/
#define IFTOCDT(mode) (((mode) & 0170000) >> 12)
#define CDTTOIF(dirtype) ((dirtype) << 12)
#endif
#ifndef _VUID_T_
#define _VUID_T_
typedef u_int32_t vuid_t;
typedef u_int32_t vgid_t;
#endif /*_VUID_T_ */
#ifdef CONFIG_CODA_FS_OLD_API
struct CodaFid {
u_int32_t opaque[3];
};
static __inline__ ino_t coda_f2i(struct CodaFid *fid)
{
if ( ! fid )
return 0;
if (fid->opaque[1] == 0xfffffffe || fid->opaque[1] == 0xffffffff)
return ((fid->opaque[0] << 20) | (fid->opaque[2] & 0xfffff));
else
return (fid->opaque[2] + (fid->opaque[1]<<10) + (fid->opaque[0]<<20));
}
struct coda_cred {
vuid_t cr_uid, cr_euid, cr_suid, cr_fsuid; /* Real, efftve, set, fs uid*/
vgid_t cr_groupid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */
};
#else /* not defined(CONFIG_CODA_FS_OLD_API) */
struct CodaFid {
u_int32_t opaque[4];
};
#define coda_f2i(fid)\
(fid ? (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]) : 0)
#endif
#ifndef _VENUS_VATTR_T_
#define _VENUS_VATTR_T_
/*
* Vnode types. VNON means no type.
*/
enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD };
struct coda_vattr {
long va_type; /* vnode type (for create) */
u_short va_mode; /* files access mode and type */
short va_nlink; /* number of references to file */
vuid_t va_uid; /* owner user id */
vgid_t va_gid; /* owner group id */
long va_fileid; /* file id */
u_quad_t va_size; /* file size in bytes */
long va_blocksize; /* blocksize preferred for i/o */
struct timespec va_atime; /* time of last access */
struct timespec va_mtime; /* time of last modification */
struct timespec va_ctime; /* time file changed */
u_long va_gen; /* generation number of file */
u_long va_flags; /* flags defined for file */
cdev_t va_rdev; /* device special file represents */
u_quad_t va_bytes; /* bytes of disk space held by file */
u_quad_t va_filerev; /* file modification number */
};
#endif
/* structure used by CODA_STATFS for getting cache information from venus */
struct coda_statfs {
int32_t f_blocks;
int32_t f_bfree;
int32_t f_bavail;
int32_t f_files;
int32_t f_ffree;
};
/*
* Kernel <--> Venus communications.
*/
#define CODA_ROOT 2
#define CODA_OPEN_BY_FD 3
#define CODA_OPEN 4
#define CODA_CLOSE 5
#define CODA_IOCTL 6
#define CODA_GETATTR 7
#define CODA_SETATTR 8
#define CODA_ACCESS 9
#define CODA_LOOKUP 10
#define CODA_CREATE 11
#define CODA_REMOVE 12
#define CODA_LINK 13
#define CODA_RENAME 14
#define CODA_MKDIR 15
#define CODA_RMDIR 16
#define CODA_SYMLINK 18
#define CODA_READLINK 19
#define CODA_FSYNC 20
#define CODA_VGET 22
#define CODA_SIGNAL 23
#define CODA_REPLACE 24 /* DOWNCALL */
#define CODA_FLUSH 25 /* DOWNCALL */
#define CODA_PURGEUSER 26 /* DOWNCALL */
#define CODA_ZAPFILE 27 /* DOWNCALL */
#define CODA_ZAPDIR 28 /* DOWNCALL */
#define CODA_PURGEFID 30 /* DOWNCALL */
#define CODA_OPEN_BY_PATH 31
#define CODA_RESOLVE 32
#define CODA_REINTEGRATE 33
#define CODA_STATFS 34
#define CODA_STORE 35
#define CODA_RELEASE 36
#define CODA_NCALLS 37
#define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID)
#define VC_MAXDATASIZE 8192
#define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\
VC_MAXDATASIZE
#define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t)
#if 0
#define CODA_KERNEL_VERSION 0 /* don't care about kernel version number */
#define CODA_KERNEL_VERSION 1 /* The old venus 4.6 compatible interface */
#endif
#ifdef CONFIG_CODA_FS_OLD_API
#define CODA_KERNEL_VERSION 2 /* venus_lookup got an extra parameter */
#else
#define CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */
#endif
/*
* Venus <-> Coda RPC arguments
*/
struct coda_in_hdr {
u_int32_t opcode;
u_int32_t unique; /* Keep multiple outstanding msgs distinct */
#ifdef CONFIG_CODA_FS_OLD_API
u_int16_t pid; /* Common to all */
u_int16_t pgid; /* Common to all */
u_int16_t sid; /* Common to all */
struct coda_cred cred; /* Common to all */
#else
pid_t pid;
pid_t pgid;
vuid_t uid;
#endif
};
/* Really important that opcode and unique are 1st two fields! */
struct coda_out_hdr {
u_int32_t opcode;
u_int32_t unique;
u_int32_t result;
};
/* coda_root: NO_IN */
struct coda_root_out {
struct coda_out_hdr oh;
struct CodaFid VFid;
};
struct coda_root_in {
struct coda_in_hdr in;
};
/* coda_open: */
struct coda_open_in {
struct coda_in_hdr ih;
struct CodaFid VFid;
int flags;
};
struct coda_open_out {
struct coda_out_hdr oh;
cdev_t dev;
ino_t inode;
};
/* coda_store: */
struct coda_store_in {
struct coda_in_hdr ih;
struct CodaFid VFid;
int flags;
};
struct coda_store_out {
struct coda_out_hdr out;
};
/* coda_release: */
struct coda_release_in {
struct coda_in_hdr ih;
struct CodaFid VFid;
int flags;
};
struct coda_release_out {
struct coda_out_hdr out;
};
/* coda_close: */
struct coda_close_in {
struct coda_in_hdr ih;
struct CodaFid VFid;
int flags;
};
struct coda_close_out {
struct coda_out_hdr out;
};
/* coda_ioctl: */
struct coda_ioctl_in {
struct coda_in_hdr ih;
struct CodaFid VFid;
int cmd;
int len;
int rwflag;
char *data; /* Place holder for data. */
};
struct coda_ioctl_out {
struct coda_out_hdr oh;
int len;
caddr_t data; /* Place holder for data. */
};
/* coda_getattr: */
struct coda_getattr_in {
struct coda_in_hdr ih;
struct CodaFid VFid;
};
struct coda_getattr_out {
struct coda_out_hdr oh;
struct coda_vattr attr;
};
/* coda_setattr: NO_OUT */
struct coda_setattr_in {
struct coda_in_hdr ih;
struct CodaFid VFid;
struct coda_vattr attr;
};
struct coda_setattr_out {
struct coda_out_hdr out;
};
/* coda_access: NO_OUT */
struct coda_access_in {
struct coda_in_hdr ih;
struct CodaFid VFid;
int flags;
};
struct coda_access_out {
struct coda_out_hdr out;
};
/* lookup flags */
#define CLU_CASE_SENSITIVE 0x01
#define CLU_CASE_INSENSITIVE 0x02
/* coda_lookup: */
struct coda_lookup_in {
struct coda_in_hdr ih;
struct CodaFid VFid;
int name; /* Place holder for data. */
int flags;
};
struct coda_lookup_out {
struct coda_out_hdr oh;
struct CodaFid VFid;
int vtype;
};
/* coda_create: */
struct coda_create_in {
struct coda_in_hdr ih;
struct CodaFid VFid;
struct coda_vattr attr;
int excl;
int mode;
int name; /* Place holder for data. */
};
struct coda_create_out {
struct coda_out_hdr oh;
struct CodaFid VFid;
struct coda_vattr attr;
};
/* coda_remove: NO_OUT */
struct coda_remove_in {
struct coda_in_hdr ih;
struct CodaFid VFid;
int name; /* Place holder for data. */
};
struct coda_remove_out {
struct coda_out_hdr out;
};
/* coda_link: NO_OUT */
struct coda_link_in {
struct coda_in_hdr ih;
struct CodaFid sourceFid; /* cnode to link *to* */
struct CodaFid destFid; /* Directory in which to place link */
int tname; /* Place holder for data. */
};
struct coda_link_out {
struct coda_out_hdr out;
};
/* coda_rename: NO_OUT */
struct coda_rename_in {
struct coda_in_hdr ih;
struct CodaFid sourceFid;
int srcname;
struct CodaFid destFid;
int destname;
};
struct coda_rename_out {
struct coda_out_hdr out;
};
/* coda_mkdir: */
struct coda_mkdir_in {
struct coda_in_hdr ih;
struct CodaFid VFid;
struct coda_vattr attr;
int name; /* Place holder for data. */
};
struct coda_mkdir_out {
struct coda_out_hdr oh;
struct CodaFid VFid;
struct coda_vattr attr;
};
/* coda_rmdir: NO_OUT */
struct coda_rmdir_in {
struct coda_in_hdr ih;
struct CodaFid VFid;
int name; /* Place holder for data. */
};
struct coda_rmdir_out {
struct coda_out_hdr out;
};
/* coda_symlink: NO_OUT */
struct coda_symlink_in {
struct coda_in_hdr ih;
struct CodaFid VFid; /* Directory to put symlink in */
int srcname;
struct coda_vattr attr;
int tname;
};
struct coda_symlink_out {
struct coda_out_hdr out;
};
/* coda_readlink: */
struct coda_readlink_in {
struct coda_in_hdr ih;
struct CodaFid VFid;
};
struct coda_readlink_out {
struct coda_out_hdr oh;
int count;
caddr_t data; /* Place holder for data. */
};
/* coda_fsync: NO_OUT */
struct coda_fsync_in {
struct coda_in_hdr ih;
struct CodaFid VFid;
};
struct coda_fsync_out {
struct coda_out_hdr out;
};
/* coda_vget: */
struct coda_vget_in {
struct coda_in_hdr ih;
struct CodaFid VFid;
};
struct coda_vget_out {
struct coda_out_hdr oh;
struct CodaFid VFid;
int vtype;
};
/* CODA_SIGNAL is out-of-band, doesn't need data. */
/* CODA_INVALIDATE is a venus->kernel call */
/* CODA_FLUSH is a venus->kernel call */
/* coda_purgeuser: */
/* CODA_PURGEUSER is a venus->kernel call */
struct coda_purgeuser_out {
struct coda_out_hdr oh;
#ifdef CONFIG_CODA_FS_OLD_API
struct coda_cred cred;
#else
vuid_t uid;
#endif
};
/* coda_zapfile: */
/* CODA_ZAPFILE is a venus->kernel call */
struct coda_zapfile_out {
struct coda_out_hdr oh;
struct CodaFid CodaFid;
};
/* coda_zapdir: */
/* CODA_ZAPDIR is a venus->kernel call */
struct coda_zapdir_out {
struct coda_out_hdr oh;
struct CodaFid CodaFid;
};
/* coda_purgefid: */
/* CODA_PURGEFID is a venus->kernel call */
struct coda_purgefid_out {
struct coda_out_hdr oh;
struct CodaFid CodaFid;
};
/* coda_replace: */
/* CODA_REPLACE is a venus->kernel call */
struct coda_replace_out { /* coda_replace is a venus->kernel call */
struct coda_out_hdr oh;
struct CodaFid NewFid;
struct CodaFid OldFid;
};
/* coda_open_by_fd: */
struct coda_open_by_fd_in {
struct coda_in_hdr ih;
struct CodaFid VFid;
int flags;
};
struct coda_open_by_fd_out {
struct coda_out_hdr oh;
int fd;
#ifdef __KERNEL__
struct file *fh; /* not passed from userspace but used in-kernel only */
#endif
};
/* coda_open_by_path: */
struct coda_open_by_path_in {
struct coda_in_hdr ih;
struct CodaFid VFid;
int flags;
};
struct coda_open_by_path_out {
struct coda_out_hdr oh;
int path;
};
/* coda_statfs: NO_IN */
struct coda_statfs_in {
struct coda_in_hdr in;
};
struct coda_statfs_out {
struct coda_out_hdr oh;
struct coda_statfs stat;
};
/*
* Occasionally, we don't cache the fid returned by CODA_LOOKUP.
* For instance, if the fid is inconsistent.
* This case is handled by setting the top bit of the type result parameter.
*/
#define CODA_NOCACHE 0x80000000
union inputArgs {
struct coda_in_hdr ih; /* NB: every struct below begins with an ih */
struct coda_open_in coda_open;
struct coda_store_in coda_store;
struct coda_release_in coda_release;
struct coda_close_in coda_close;
struct coda_ioctl_in coda_ioctl;
struct coda_getattr_in coda_getattr;
struct coda_setattr_in coda_setattr;
struct coda_access_in coda_access;
struct coda_lookup_in coda_lookup;
struct coda_create_in coda_create;
struct coda_remove_in coda_remove;
struct coda_link_in coda_link;
struct coda_rename_in coda_rename;
struct coda_mkdir_in coda_mkdir;
struct coda_rmdir_in coda_rmdir;
struct coda_symlink_in coda_symlink;
struct coda_readlink_in coda_readlink;
struct coda_fsync_in coda_fsync;
struct coda_vget_in coda_vget;
struct coda_open_by_fd_in coda_open_by_fd;
struct coda_open_by_path_in coda_open_by_path;
struct coda_statfs_in coda_statfs;
};
union outputArgs {
struct coda_out_hdr oh; /* NB: every struct below begins with an oh */
struct coda_root_out coda_root;
struct coda_open_out coda_open;
struct coda_ioctl_out coda_ioctl;
struct coda_getattr_out coda_getattr;
struct coda_lookup_out coda_lookup;
struct coda_create_out coda_create;
struct coda_mkdir_out coda_mkdir;
struct coda_readlink_out coda_readlink;
struct coda_vget_out coda_vget;
struct coda_purgeuser_out coda_purgeuser;
struct coda_zapfile_out coda_zapfile;
struct coda_zapdir_out coda_zapdir;
struct coda_purgefid_out coda_purgefid;
struct coda_replace_out coda_replace;
struct coda_open_by_fd_out coda_open_by_fd;
struct coda_open_by_path_out coda_open_by_path;
struct coda_statfs_out coda_statfs;
};
union coda_downcalls {
/* CODA_INVALIDATE is a venus->kernel call */
/* CODA_FLUSH is a venus->kernel call */
struct coda_purgeuser_out purgeuser;
struct coda_zapfile_out zapfile;
struct coda_zapdir_out zapdir;
struct coda_purgefid_out purgefid;
struct coda_replace_out replace;
};
/*
* Used for identifying usage of "Control" and pioctls
*/
#define PIOCPARM_MASK 0x0000ffff
struct ViceIoctl {
void __user *in; /* Data to be transferred in */
void __user *out; /* Data to be transferred out */
u_short in_size; /* Size of input buffer <= 2K */
u_short out_size; /* Maximum size of output buffer, <= 2K */
};
struct PioctlData {
const char __user *path;
int follow;
struct ViceIoctl vi;
};
#define CODA_CONTROL ".CONTROL"
#define CODA_CONTROLLEN 8
#define CTL_INO -1
/* Data passed to mount */
#define CODA_MOUNT_VERSION 1
struct coda_mount_data {
int version;
int fd; /* Opened device */
};
#endif

View File

@@ -0,0 +1,22 @@
/* Coda filesystem -- Linux Minicache
*
* Copyright (C) 1989 - 1997 Carnegie Mellon University
*
* Carnegie Mellon University encourages users of this software to
* contribute improvements to the Coda project. Contact Peter Braam
* <coda@cs.cmu.edu>
*/
#ifndef _CFSNC_HEADER_
#define _CFSNC_HEADER_
/* credential cache */
void coda_cache_enter(struct inode *inode, int mask);
void coda_cache_clear_inode(struct inode *);
void coda_cache_clear_all(struct super_block *sb);
int coda_cache_check(struct inode *inode, int mask);
/* for downcalls and attributes and lookups */
void coda_flag_inode_children(struct inode *inode, int flag);
#endif /* _CFSNC_HEADER_ */

55
include/linux/coda_fs_i.h Normal file
View File

@@ -0,0 +1,55 @@
/*
* coda_fs_i.h
*
* Copyright (C) 1998 Carnegie Mellon University
*
*/
#ifndef _LINUX_CODA_FS_I
#define _LINUX_CODA_FS_I
#ifdef __KERNEL__
#include <linux/types.h>
#include <linux/list.h>
#include <linux/coda.h>
/*
* coda fs inode data
*/
struct coda_inode_info {
struct CodaFid c_fid; /* Coda identifier */
u_short c_flags; /* flags (see below) */
struct list_head c_cilist; /* list of all coda inodes */
unsigned int c_mapcount; /* nr of times this inode is mapped */
unsigned int c_cached_epoch; /* epoch for cached permissions */
vuid_t c_uid; /* fsuid for cached permissions */
unsigned int c_cached_perm; /* cached access permissions */
struct inode vfs_inode;
};
/*
* coda fs file private data
*/
#define CODA_MAGIC 0xC0DAC0DA
struct coda_file_info {
int cfi_magic; /* magic number */
struct file *cfi_container; /* container file for this cnode */
unsigned int cfi_mapcount; /* nr of times this file is mapped */
};
#define CODA_FTOC(file) ((struct coda_file_info *)((file)->private_data))
/* flags */
#define C_VATTR 0x1 /* Validity of vattr in inode */
#define C_FLUSH 0x2 /* used after a flush */
#define C_DYING 0x4 /* from venus (which died) */
#define C_PURGE 0x8
int coda_cnode_make(struct inode **, struct CodaFid *, struct super_block *);
struct inode *coda_iget(struct super_block *sb, struct CodaFid *fid, struct coda_vattr *attr);
int coda_cnode_makectl(struct inode **inode, struct super_block *sb);
struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb);
void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *);
#endif
#endif

102
include/linux/coda_linux.h Normal file
View File

@@ -0,0 +1,102 @@
/*
* Coda File System, Linux Kernel module
*
* Original version, adapted from cfs_mach.c, (C) Carnegie Mellon University
* Linux modifications (C) 1996, Peter J. Braam
* Rewritten for Linux 2.1 (C) 1997 Carnegie Mellon University
*
* Carnegie Mellon University encourages users of this software to
* contribute improvements to the Coda project.
*/
#ifndef _LINUX_CODA_FS
#define _LINUX_CODA_FS
#include <linux/kernel.h>
#include <linux/param.h>
#include <linux/mm.h>
#include <linux/vmalloc.h>
#include <linux/slab.h>
#include <linux/wait.h>
#include <linux/types.h>
#include <linux/fs.h>
#include <linux/coda_fs_i.h>
/* operations */
extern struct inode_operations coda_dir_inode_operations;
extern struct inode_operations coda_file_inode_operations;
extern struct inode_operations coda_ioctl_inode_operations;
extern struct address_space_operations coda_file_aops;
extern struct address_space_operations coda_symlink_aops;
extern struct file_operations coda_dir_operations;
extern struct file_operations coda_file_operations;
extern struct file_operations coda_ioctl_operations;
/* operations shared over more than one file */
int coda_open(struct inode *i, struct file *f);
int coda_flush(struct file *f);
int coda_release(struct inode *i, struct file *f);
int coda_permission(struct inode *inode, int mask, struct nameidata *nd);
int coda_revalidate_inode(struct dentry *);
int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *);
int coda_setattr(struct dentry *, struct iattr *);
/* global variables */
extern int coda_fake_statfs;
/* this file: heloers */
static __inline__ struct CodaFid *coda_i2f(struct inode *);
static __inline__ char *coda_i2s(struct inode *);
static __inline__ void coda_flag_inode(struct inode *, int flag);
char *coda_f2s(struct CodaFid *f);
int coda_isroot(struct inode *i);
int coda_iscontrol(const char *name, size_t length);
void coda_vattr_to_iattr(struct inode *, struct coda_vattr *);
void coda_iattr_to_vattr(struct iattr *, struct coda_vattr *);
unsigned short coda_flags_to_cflags(unsigned short);
/* sysctl.h */
void coda_sysctl_init(void);
void coda_sysctl_clean(void);
#define CODA_ALLOC(ptr, cast, size) do { \
if (size < PAGE_SIZE) \
ptr = (cast)kmalloc((unsigned long) size, GFP_KERNEL); \
else \
ptr = (cast)vmalloc((unsigned long) size); \
if (!ptr) \
printk("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \
else memset( ptr, 0, size ); \
} while (0)
#define CODA_FREE(ptr,size) \
do { if (size < PAGE_SIZE) kfree((ptr)); else vfree((ptr)); } while (0)
/* inode to cnode access functions */
static inline struct coda_inode_info *ITOC(struct inode *inode)
{
return list_entry(inode, struct coda_inode_info, vfs_inode);
}
static __inline__ struct CodaFid *coda_i2f(struct inode *inode)
{
return &(ITOC(inode)->c_fid);
}
static __inline__ char *coda_i2s(struct inode *inode)
{
return coda_f2s(&(ITOC(inode)->c_fid));
}
/* this will not zap the inode away */
static __inline__ void coda_flag_inode(struct inode *inode, int flag)
{
ITOC(inode)->c_flags |= flag;
}
#endif

76
include/linux/coda_proc.h Normal file
View File

@@ -0,0 +1,76 @@
/*
* coda_statis.h
*
* CODA operation statistics
*
* (c) March, 1998
* by Michihiro Kuramochi, Zhenyu Xia and Zhanyong Wan
* zhanyong.wan@yale.edu
*
*/
#ifndef _CODA_PROC_H
#define _CODA_PROC_H
void coda_sysctl_init(void);
void coda_sysctl_clean(void);
#include <linux/sysctl.h>
#include <linux/coda_fs_i.h>
#include <linux/coda.h>
/* these four files are presented to show the result of the statistics:
*
* /proc/fs/coda/vfs_stats
* cache_inv_stats
*
* these four files are presented to reset the statistics to 0:
*
* /proc/sys/coda/vfs_stats
* cache_inv_stats
*/
/* VFS operation statistics */
struct coda_vfs_stats
{
/* file operations */
int open;
int flush;
int release;
int fsync;
/* dir operations */
int readdir;
/* inode operations */
int create;
int lookup;
int link;
int unlink;
int symlink;
int mkdir;
int rmdir;
int rename;
int permission;
/* symlink operatoins*/
int follow_link;
int readlink;
};
/* cache invalidation statistics */
struct coda_cache_inv_stats
{
int flush;
int purge_user;
int zap_dir;
int zap_file;
int zap_vnode;
int purge_fid;
int replace;
};
/* these global variables hold the actual statistics data */
extern struct coda_vfs_stats coda_vfs_stat;
#endif /* _CODA_PROC_H */

103
include/linux/coda_psdev.h Normal file
View File

@@ -0,0 +1,103 @@
#ifndef __CODA_PSDEV_H
#define __CODA_PSDEV_H
#define CODA_PSDEV_MAJOR 67
#define MAX_CODADEVS 5 /* how many do we allow */
#define CODA_SUPER_MAGIC 0x73757245
struct kstatfs;
struct coda_sb_info
{
struct venus_comm *sbi_vcomm;
};
/* communication pending/processing queues */
struct venus_comm {
u_long vc_seq;
wait_queue_head_t vc_waitq; /* Venus wait queue */
struct list_head vc_pending;
struct list_head vc_processing;
int vc_inuse;
struct super_block *vc_sb;
};
static inline struct coda_sb_info *coda_sbp(struct super_block *sb)
{
return ((struct coda_sb_info *)((sb)->s_fs_info));
}
/* upcalls */
int venus_rootfid(struct super_block *sb, struct CodaFid *fidp);
int venus_getattr(struct super_block *sb, struct CodaFid *fid,
struct coda_vattr *attr);
int venus_setattr(struct super_block *, struct CodaFid *, struct coda_vattr *);
int venus_lookup(struct super_block *sb, struct CodaFid *fid,
const char *name, int length, int *type,
struct CodaFid *resfid);
int venus_store(struct super_block *sb, struct CodaFid *fid, int flags,
vuid_t uid);
int venus_release(struct super_block *sb, struct CodaFid *fid, int flags);
int venus_close(struct super_block *sb, struct CodaFid *fid, int flags,
vuid_t uid);
int venus_open(struct super_block *sb, struct CodaFid *fid, int flags,
struct file **f);
int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid,
const char *name, int length,
struct CodaFid *newfid, struct coda_vattr *attrs);
int venus_create(struct super_block *sb, struct CodaFid *dirfid,
const char *name, int length, int excl, int mode,
struct CodaFid *newfid, struct coda_vattr *attrs) ;
int venus_rmdir(struct super_block *sb, struct CodaFid *dirfid,
const char *name, int length);
int venus_remove(struct super_block *sb, struct CodaFid *dirfid,
const char *name, int length);
int venus_readlink(struct super_block *sb, struct CodaFid *fid,
char *buffer, int *length);
int venus_rename(struct super_block *, struct CodaFid *new_fid,
struct CodaFid *old_fid, size_t old_length,
size_t new_length, const char *old_name,
const char *new_name);
int venus_link(struct super_block *sb, struct CodaFid *fid,
struct CodaFid *dirfid, const char *name, int len );
int venus_symlink(struct super_block *sb, struct CodaFid *fid,
const char *name, int len, const char *symname, int symlen);
int venus_access(struct super_block *sb, struct CodaFid *fid, int mask);
int venus_pioctl(struct super_block *sb, struct CodaFid *fid,
unsigned int cmd, struct PioctlData *data);
int coda_downcall(int opcode, union outputArgs *out, struct super_block *sb);
int venus_fsync(struct super_block *sb, struct CodaFid *fid);
int venus_statfs(struct super_block *sb, struct kstatfs *sfs);
/* messages between coda filesystem in kernel and Venus */
extern int coda_hard;
extern unsigned long coda_timeout;
struct upc_req {
struct list_head uc_chain;
caddr_t uc_data;
u_short uc_flags;
u_short uc_inSize; /* Size is at most 5000 bytes */
u_short uc_outSize;
u_short uc_opcode; /* copied from data to save lookup */
int uc_unique;
wait_queue_head_t uc_sleep; /* process' wait queue */
unsigned long uc_posttime;
};
#define REQ_ASYNC 0x1
#define REQ_READ 0x2
#define REQ_WRITE 0x4
#define REQ_ABORT 0x8
/*
* Statistics
*/
extern struct venus_comm coda_comms[];
#endif

351
include/linux/coff.h Normal file
View File

@@ -0,0 +1,351 @@
/* This file is derived from the GAS 2.1.4 assembler control file.
The GAS product is under the GNU General Public License, version 2 or later.
As such, this file is also under that license.
If the file format changes in the COFF object, this file should be
subsequently updated to reflect the changes.
The actual loader module only uses a few of these structures. The full
set is documented here because I received the full set. If you wish
more information about COFF, then O'Reilly has a very excellent book.
*/
#define E_SYMNMLEN 8 /* Number of characters in a symbol name */
#define E_FILNMLEN 14 /* Number of characters in a file name */
#define E_DIMNUM 4 /* Number of array dimensions in auxiliary entry */
/*
* These defines are byte order independent. There is no alignment of fields
* permitted in the structures. Therefore they are declared as characters
* and the values loaded from the character positions. It also makes it
* nice to have it "endian" independent.
*/
/* Load a short int from the following tables with little-endian formats */
#define COFF_SHORT_L(ps) ((short)(((unsigned short)((unsigned char)ps[1])<<8)|\
((unsigned short)((unsigned char)ps[0]))))
/* Load a long int from the following tables with little-endian formats */
#define COFF_LONG_L(ps) (((long)(((unsigned long)((unsigned char)ps[3])<<24) |\
((unsigned long)((unsigned char)ps[2])<<16) |\
((unsigned long)((unsigned char)ps[1])<<8) |\
((unsigned long)((unsigned char)ps[0])))))
/* Load a short int from the following tables with big-endian formats */
#define COFF_SHORT_H(ps) ((short)(((unsigned short)((unsigned char)ps[0])<<8)|\
((unsigned short)((unsigned char)ps[1]))))
/* Load a long int from the following tables with big-endian formats */
#define COFF_LONG_H(ps) (((long)(((unsigned long)((unsigned char)ps[0])<<24) |\
((unsigned long)((unsigned char)ps[1])<<16) |\
((unsigned long)((unsigned char)ps[2])<<8) |\
((unsigned long)((unsigned char)ps[3])))))
/* These may be overridden later by brain dead implementations which generate
a big-endian header with little-endian data. In that case, generate a
replacement macro which tests a flag and uses either of the two above
as appropriate. */
#define COFF_LONG(v) COFF_LONG_L(v)
#define COFF_SHORT(v) COFF_SHORT_L(v)
/*** coff information for Intel 386/486. */
/********************** FILE HEADER **********************/
struct COFF_filehdr {
char f_magic[2]; /* magic number */
char f_nscns[2]; /* number of sections */
char f_timdat[4]; /* time & date stamp */
char f_symptr[4]; /* file pointer to symtab */
char f_nsyms[4]; /* number of symtab entries */
char f_opthdr[2]; /* sizeof(optional hdr) */
char f_flags[2]; /* flags */
};
/*
* Bits for f_flags:
*
* F_RELFLG relocation info stripped from file
* F_EXEC file is executable (i.e. no unresolved external
* references)
* F_LNNO line numbers stripped from file
* F_LSYMS local symbols stripped from file
* F_MINMAL this is a minimal object file (".m") output of fextract
* F_UPDATE this is a fully bound update file, output of ogen
* F_SWABD this file has had its bytes swabbed (in names)
* F_AR16WR this file has the byte ordering of an AR16WR
* (e.g. 11/70) machine
* F_AR32WR this file has the byte ordering of an AR32WR machine
* (e.g. vax and iNTEL 386)
* F_AR32W this file has the byte ordering of an AR32W machine
* (e.g. 3b,maxi)
* F_PATCH file contains "patch" list in optional header
* F_NODF (minimal file only) no decision functions for
* replaced functions
*/
#define COFF_F_RELFLG 0000001
#define COFF_F_EXEC 0000002
#define COFF_F_LNNO 0000004
#define COFF_F_LSYMS 0000010
#define COFF_F_MINMAL 0000020
#define COFF_F_UPDATE 0000040
#define COFF_F_SWABD 0000100
#define COFF_F_AR16WR 0000200
#define COFF_F_AR32WR 0000400
#define COFF_F_AR32W 0001000
#define COFF_F_PATCH 0002000
#define COFF_F_NODF 0002000
#define COFF_I386MAGIC 0x14c /* Linux's system */
#if 0 /* Perhaps, someday, these formats may be used. */
#define COFF_I386PTXMAGIC 0x154
#define COFF_I386AIXMAGIC 0x175 /* IBM's AIX system */
#define COFF_I386BADMAG(x) ((COFF_SHORT((x).f_magic) != COFF_I386MAGIC) \
&& COFF_SHORT((x).f_magic) != COFF_I386PTXMAGIC \
&& COFF_SHORT((x).f_magic) != COFF_I386AIXMAGIC)
#else
#define COFF_I386BADMAG(x) (COFF_SHORT((x).f_magic) != COFF_I386MAGIC)
#endif
#define COFF_FILHDR struct COFF_filehdr
#define COFF_FILHSZ sizeof(COFF_FILHDR)
/********************** AOUT "OPTIONAL HEADER" **********************/
/* Linux COFF must have this "optional" header. Standard COFF has no entry
location for the "entry" point. They normally would start with the first
location of the .text section. This is not a good idea for linux. So,
the use of this "optional" header is not optional. It is required.
Do not be tempted to assume that the size of the optional header is
a constant and simply index the next byte by the size of this structure.
Use the 'f_opthdr' field in the main coff header for the size of the
structure actually written to the file!!
*/
typedef struct
{
char magic[2]; /* type of file */
char vstamp[2]; /* version stamp */
char tsize[4]; /* text size in bytes, padded to FW bdry */
char dsize[4]; /* initialized data " " */
char bsize[4]; /* uninitialized data " " */
char entry[4]; /* entry pt. */
char text_start[4]; /* base of text used for this file */
char data_start[4]; /* base of data used for this file */
}
COFF_AOUTHDR;
#define COFF_AOUTSZ (sizeof(COFF_AOUTHDR))
#define COFF_STMAGIC 0401
#define COFF_OMAGIC 0404
#define COFF_JMAGIC 0407 /* dirty text and data image, can't share */
#define COFF_DMAGIC 0410 /* dirty text segment, data aligned */
#define COFF_ZMAGIC 0413 /* The proper magic number for executables */
#define COFF_SHMAGIC 0443 /* shared library header */
/********************** SECTION HEADER **********************/
struct COFF_scnhdr {
char s_name[8]; /* section name */
char s_paddr[4]; /* physical address, aliased s_nlib */
char s_vaddr[4]; /* virtual address */
char s_size[4]; /* section size */
char s_scnptr[4]; /* file ptr to raw data for section */
char s_relptr[4]; /* file ptr to relocation */
char s_lnnoptr[4]; /* file ptr to line numbers */
char s_nreloc[2]; /* number of relocation entries */
char s_nlnno[2]; /* number of line number entries */
char s_flags[4]; /* flags */
};
#define COFF_SCNHDR struct COFF_scnhdr
#define COFF_SCNHSZ sizeof(COFF_SCNHDR)
/*
* names of "special" sections
*/
#define COFF_TEXT ".text"
#define COFF_DATA ".data"
#define COFF_BSS ".bss"
#define COFF_COMMENT ".comment"
#define COFF_LIB ".lib"
#define COFF_SECT_TEXT 0 /* Section for instruction code */
#define COFF_SECT_DATA 1 /* Section for initialized globals */
#define COFF_SECT_BSS 2 /* Section for un-initialized globals */
#define COFF_SECT_REQD 3 /* Minimum number of sections for good file */
#define COFF_STYP_REG 0x00 /* regular segment */
#define COFF_STYP_DSECT 0x01 /* dummy segment */
#define COFF_STYP_NOLOAD 0x02 /* no-load segment */
#define COFF_STYP_GROUP 0x04 /* group segment */
#define COFF_STYP_PAD 0x08 /* .pad segment */
#define COFF_STYP_COPY 0x10 /* copy section */
#define COFF_STYP_TEXT 0x20 /* .text segment */
#define COFF_STYP_DATA 0x40 /* .data segment */
#define COFF_STYP_BSS 0x80 /* .bss segment */
#define COFF_STYP_INFO 0x200 /* .comment section */
#define COFF_STYP_OVER 0x400 /* overlay section */
#define COFF_STYP_LIB 0x800 /* library section */
/*
* Shared libraries have the following section header in the data field for
* each library.
*/
struct COFF_slib {
char sl_entsz[4]; /* Size of this entry */
char sl_pathndx[4]; /* size of the header field */
};
#define COFF_SLIBHD struct COFF_slib
#define COFF_SLIBSZ sizeof(COFF_SLIBHD)
/********************** LINE NUMBERS **********************/
/* 1 line number entry for every "breakpointable" source line in a section.
* Line numbers are grouped on a per function basis; first entry in a function
* grouping will have l_lnno = 0 and in place of physical address will be the
* symbol table index of the function name.
*/
struct COFF_lineno {
union {
char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
char l_paddr[4]; /* (physical) address of line number */
} l_addr;
char l_lnno[2]; /* line number */
};
#define COFF_LINENO struct COFF_lineno
#define COFF_LINESZ 6
/********************** SYMBOLS **********************/
#define COFF_E_SYMNMLEN 8 /* # characters in a short symbol name */
#define COFF_E_FILNMLEN 14 /* # characters in a file name */
#define COFF_E_DIMNUM 4 /* # array dimensions in auxiliary entry */
/*
* All symbols and sections have the following definition
*/
struct COFF_syment
{
union {
char e_name[E_SYMNMLEN]; /* Symbol name (first 8 characters) */
struct {
char e_zeroes[4]; /* Leading zeros */
char e_offset[4]; /* Offset if this is a header section */
} e;
} e;
char e_value[4]; /* Value (address) of the segment */
char e_scnum[2]; /* Section number */
char e_type[2]; /* Type of section */
char e_sclass[1]; /* Loader class */
char e_numaux[1]; /* Number of auxiliary entries which follow */
};
#define COFF_N_BTMASK (0xf) /* Mask for important class bits */
#define COFF_N_TMASK (0x30) /* Mask for important type bits */
#define COFF_N_BTSHFT (4) /* # bits to shift class field */
#define COFF_N_TSHIFT (2) /* # bits to shift type field */
/*
* Auxiliary entries because the main table is too limiting.
*/
union COFF_auxent {
/*
* Debugger information
*/
struct {
char x_tagndx[4]; /* str, un, or enum tag indx */
union {
struct {
char x_lnno[2]; /* declaration line number */
char x_size[2]; /* str/union/array size */
} x_lnsz;
char x_fsize[4]; /* size of function */
} x_misc;
union {
struct { /* if ISFCN, tag, or .bb */
char x_lnnoptr[4]; /* ptr to fcn line # */
char x_endndx[4]; /* entry ndx past block end */
} x_fcn;
struct { /* if ISARY, up to 4 dimen. */
char x_dimen[E_DIMNUM][2];
} x_ary;
} x_fcnary;
char x_tvndx[2]; /* tv index */
} x_sym;
/*
* Source file names (debugger information)
*/
union {
char x_fname[E_FILNMLEN];
struct {
char x_zeroes[4];
char x_offset[4];
} x_n;
} x_file;
/*
* Section information
*/
struct {
char x_scnlen[4]; /* section length */
char x_nreloc[2]; /* # relocation entries */
char x_nlinno[2]; /* # line numbers */
} x_scn;
/*
* Transfer vector (branch table)
*/
struct {
char x_tvfill[4]; /* tv fill value */
char x_tvlen[2]; /* length of .tv */
char x_tvran[2][2]; /* tv range */
} x_tv; /* info about .tv section (in auxent of symbol .tv)) */
};
#define COFF_SYMENT struct COFF_syment
#define COFF_SYMESZ 18
#define COFF_AUXENT union COFF_auxent
#define COFF_AUXESZ 18
#define COFF_ETEXT "etext"
/********************** RELOCATION DIRECTIVES **********************/
struct COFF_reloc {
char r_vaddr[4]; /* Virtual address of item */
char r_symndx[4]; /* Symbol index in the symtab */
char r_type[2]; /* Relocation type */
};
#define COFF_RELOC struct COFF_reloc
#define COFF_RELSZ 10
#define COFF_DEF_DATA_SECTION_ALIGNMENT 4
#define COFF_DEF_BSS_SECTION_ALIGNMENT 4
#define COFF_DEF_TEXT_SECTION_ALIGNMENT 4
/* For new sections we haven't heard of before */
#define COFF_DEF_SECTION_ALIGNMENT 4

115
include/linux/com20020.h Normal file
View File

@@ -0,0 +1,115 @@
/*
* Linux ARCnet driver - COM20020 chipset support - function declarations
*
* Written 1997 by David Woodhouse.
* Written 1994-1999 by Avery Pennarun.
* Derived from skeleton.c by Donald Becker.
*
* Special thanks to Contemporary Controls, Inc. (www.ccontrols.com)
* for sponsoring the further development of this driver.
*
* **********************
*
* The original copyright of skeleton.c was as follows:
*
* skeleton.c Written 1993 by Donald Becker.
* Copyright 1993 United States Government as represented by the
* Director, National Security Agency. This software may only be used
* and distributed according to the terms of the GNU General Public License as
* modified by SRC, incorporated herein by reference.
*
* **********************
*
* For more details, see drivers/net/arcnet.c
*
* **********************
*/
#ifndef __COM20020_H
#define __COM20020_H
int com20020_check(struct net_device *dev);
int com20020_found(struct net_device *dev, int shared);
/* The number of low I/O ports used by the card. */
#define ARCNET_TOTAL_SIZE 8
/* various register addresses */
#ifdef CONFIG_SA1100_CT6001
#define BUS_ALIGN 2 /* 8 bit device on a 16 bit bus - needs padding */
#else
#define BUS_ALIGN 1
#endif
#define _INTMASK (ioaddr+BUS_ALIGN*0) /* writable */
#define _STATUS (ioaddr+BUS_ALIGN*0) /* readable */
#define _COMMAND (ioaddr+BUS_ALIGN*1) /* standard arcnet commands */
#define _DIAGSTAT (ioaddr+BUS_ALIGN*1) /* diagnostic status register */
#define _ADDR_HI (ioaddr+BUS_ALIGN*2) /* control registers for IO-mapped memory */
#define _ADDR_LO (ioaddr+BUS_ALIGN*3)
#define _MEMDATA (ioaddr+BUS_ALIGN*4) /* data port for IO-mapped memory */
#define _SUBADR (ioaddr+BUS_ALIGN*5) /* the extended port _XREG refers to */
#define _CONFIG (ioaddr+BUS_ALIGN*6) /* configuration register */
#define _XREG (ioaddr+BUS_ALIGN*7) /* extra registers (indexed by _CONFIG
or _SUBADR) */
/* in the ADDR_HI register */
#define RDDATAflag 0x80 /* next access is a read (not a write) */
/* in the DIAGSTAT register */
#define NEWNXTIDflag 0x02 /* ID to which token is passed has changed */
/* in the CONFIG register */
#define RESETcfg 0x80 /* put card in reset state */
#define TXENcfg 0x20 /* enable TX */
/* in SETUP register */
#define PROMISCset 0x10 /* enable RCV_ALL */
#define P1MODE 0x80 /* enable P1-MODE for Backplane */
#define SLOWARB 0x01 /* enable Slow Arbitration for >=5Mbps */
/* COM2002x */
#define SUB_TENTATIVE 0 /* tentative node ID */
#define SUB_NODE 1 /* node ID */
#define SUB_SETUP1 2 /* various options */
#define SUB_TEST 3 /* test/diag register */
/* COM20022 only */
#define SUB_SETUP2 4 /* sundry options */
#define SUB_BUSCTL 5 /* bus control options */
#define SUB_DMACOUNT 6 /* DMA count options */
#define SET_SUBADR(x) do { \
if ((x) < 4) \
{ \
lp->config = (lp->config & ~0x03) | (x); \
SETCONF; \
} \
else \
{ \
outb(x, _SUBADR); \
} \
} while (0)
#undef ARCRESET
#undef ASTATUS
#undef ACOMMAND
#undef AINTMASK
#define ARCRESET { outb(lp->config | 0x80, _CONFIG); \
udelay(5); \
outb(lp->config , _CONFIG); \
}
#define ARCRESET0 { outb(0x18 | 0x80, _CONFIG); \
udelay(5); \
outb(0x18 , _CONFIG); \
}
#define ASTATUS() inb(_STATUS)
#define ADIAGSTATUS() inb(_DIAGSTAT)
#define ACOMMAND(cmd) outb((cmd),_COMMAND)
#define AINTMASK(msk) outb((msk),_INTMASK)
#define SETCONF outb(lp->config, _CONFIG)
#endif /* __COM20020_H */

162
include/linux/compat.h Normal file
View File

@@ -0,0 +1,162 @@
#ifndef _LINUX_COMPAT_H
#define _LINUX_COMPAT_H
/*
* These are the type definitions for the architecture specific
* syscall compatibility layer.
*/
#include <linux/config.h>
#ifdef CONFIG_COMPAT
#include <linux/stat.h>
#include <linux/param.h> /* for HZ */
#include <linux/sem.h>
#include <asm/compat.h>
#include <asm/siginfo.h>
#define compat_jiffies_to_clock_t(x) \
(((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
struct rusage;
struct compat_itimerspec {
struct compat_timespec it_interval;
struct compat_timespec it_value;
};
struct compat_utimbuf {
compat_time_t actime;
compat_time_t modtime;
};
struct compat_itimerval {
struct compat_timeval it_interval;
struct compat_timeval it_value;
};
struct compat_tms {
compat_clock_t tms_utime;
compat_clock_t tms_stime;
compat_clock_t tms_cutime;
compat_clock_t tms_cstime;
};
#define _COMPAT_NSIG_WORDS (_COMPAT_NSIG / _COMPAT_NSIG_BPW)
typedef struct {
compat_sigset_word sig[_COMPAT_NSIG_WORDS];
} compat_sigset_t;
extern int cp_compat_stat(struct kstat *, struct compat_stat __user *);
extern int get_compat_timespec(struct timespec *, const struct compat_timespec __user *);
extern int put_compat_timespec(const struct timespec *, struct compat_timespec __user *);
struct compat_iovec {
compat_uptr_t iov_base;
compat_size_t iov_len;
};
struct compat_rlimit {
compat_ulong_t rlim_cur;
compat_ulong_t rlim_max;
};
struct compat_rusage {
struct compat_timeval ru_utime;
struct compat_timeval ru_stime;
compat_long_t ru_maxrss;
compat_long_t ru_ixrss;
compat_long_t ru_idrss;
compat_long_t ru_isrss;
compat_long_t ru_minflt;
compat_long_t ru_majflt;
compat_long_t ru_nswap;
compat_long_t ru_inblock;
compat_long_t ru_oublock;
compat_long_t ru_msgsnd;
compat_long_t ru_msgrcv;
compat_long_t ru_nsignals;
compat_long_t ru_nvcsw;
compat_long_t ru_nivcsw;
};
extern int put_compat_rusage(const struct rusage *, struct compat_rusage __user *);
struct compat_siginfo;
extern asmlinkage long compat_sys_waitid(int, compat_pid_t,
struct compat_siginfo __user *, int,
struct compat_rusage __user *);
struct compat_dirent {
u32 d_ino;
compat_off_t d_off;
u16 d_reclen;
char d_name[256];
};
typedef union compat_sigval {
compat_int_t sival_int;
compat_uptr_t sival_ptr;
} compat_sigval_t;
#define COMPAT_SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
typedef struct compat_sigevent {
compat_sigval_t sigev_value;
compat_int_t sigev_signo;
compat_int_t sigev_notify;
union {
compat_int_t _pad[COMPAT_SIGEV_PAD_SIZE];
compat_int_t _tid;
struct {
compat_uptr_t _function;
compat_uptr_t _attribute;
} _sigev_thread;
} _sigev_un;
} compat_sigevent_t;
long compat_sys_semctl(int first, int second, int third, void __user *uptr);
long compat_sys_msgsnd(int first, int second, int third, void __user *uptr);
long compat_sys_msgrcv(int first, int second, int msgtyp, int third,
int version, void __user *uptr);
long compat_sys_msgctl(int first, int second, void __user *uptr);
long compat_sys_shmat(int first, int second, compat_uptr_t third, int version,
void __user *uptr);
long compat_sys_shmctl(int first, int second, void __user *uptr);
long compat_sys_semtimedop(int semid, struct sembuf __user *tsems,
unsigned nsems, const struct compat_timespec __user *timeout);
asmlinkage long compat_sys_keyctl(u32 option,
u32 arg2, u32 arg3, u32 arg4, u32 arg5);
asmlinkage ssize_t compat_sys_readv(unsigned long fd,
const struct compat_iovec __user *vec, unsigned long vlen);
asmlinkage ssize_t compat_sys_writev(unsigned long fd,
const struct compat_iovec __user *vec, unsigned long vlen);
int compat_do_execve(char * filename, compat_uptr_t __user *argv,
compat_uptr_t __user *envp, struct pt_regs * regs);
asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
compat_ulong_t __user *outp, compat_ulong_t __user *exp,
struct compat_timeval __user *tvp);
#define BITS_PER_COMPAT_LONG (8*sizeof(compat_long_t))
#define BITS_TO_COMPAT_LONGS(bits) \
(((bits)+BITS_PER_COMPAT_LONG-1)/BITS_PER_COMPAT_LONG)
long compat_get_bitmap(unsigned long *mask, compat_ulong_t __user *umask,
unsigned long bitmap_size);
long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,
unsigned long bitmap_size);
int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from);
int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from);
int get_compat_sigevent(struct sigevent *event,
const struct compat_sigevent __user *u_event);
#endif /* CONFIG_COMPAT */
#endif /* _LINUX_COMPAT_H */

View File

@@ -0,0 +1,771 @@
/* List here explicitly which ioctl's are known to have
* compatible types passed or none at all... Please include
* only stuff that is compatible on *all architectures*.
*/
#ifndef COMPATIBLE_IOCTL /* pointer to compatible structure or no argument */
#define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),(ioctl_trans_handler_t)sys_ioctl)
#endif
#ifndef ULONG_IOCTL /* argument is an unsigned long integer, not a pointer */
#define ULONG_IOCTL(cmd) HANDLE_IOCTL((cmd),(ioctl_trans_handler_t)sys_ioctl)
#endif
/* Big T */
COMPATIBLE_IOCTL(TCGETA)
COMPATIBLE_IOCTL(TCSETA)
COMPATIBLE_IOCTL(TCSETAW)
COMPATIBLE_IOCTL(TCSETAF)
COMPATIBLE_IOCTL(TCSBRK)
ULONG_IOCTL(TCSBRKP)
COMPATIBLE_IOCTL(TCXONC)
COMPATIBLE_IOCTL(TCFLSH)
COMPATIBLE_IOCTL(TCGETS)
COMPATIBLE_IOCTL(TCSETS)
COMPATIBLE_IOCTL(TCSETSW)
COMPATIBLE_IOCTL(TCSETSF)
COMPATIBLE_IOCTL(TIOCLINUX)
COMPATIBLE_IOCTL(TIOCSBRK)
COMPATIBLE_IOCTL(TIOCCBRK)
ULONG_IOCTL(TIOCMIWAIT)
COMPATIBLE_IOCTL(TIOCGICOUNT)
/* Little t */
COMPATIBLE_IOCTL(TIOCGETD)
COMPATIBLE_IOCTL(TIOCSETD)
COMPATIBLE_IOCTL(TIOCEXCL)
COMPATIBLE_IOCTL(TIOCNXCL)
COMPATIBLE_IOCTL(TIOCCONS)
COMPATIBLE_IOCTL(TIOCGSOFTCAR)
COMPATIBLE_IOCTL(TIOCSSOFTCAR)
COMPATIBLE_IOCTL(TIOCSWINSZ)
COMPATIBLE_IOCTL(TIOCGWINSZ)
COMPATIBLE_IOCTL(TIOCMGET)
COMPATIBLE_IOCTL(TIOCMBIC)
COMPATIBLE_IOCTL(TIOCMBIS)
COMPATIBLE_IOCTL(TIOCMSET)
COMPATIBLE_IOCTL(TIOCPKT)
COMPATIBLE_IOCTL(TIOCNOTTY)
COMPATIBLE_IOCTL(TIOCSTI)
COMPATIBLE_IOCTL(TIOCOUTQ)
COMPATIBLE_IOCTL(TIOCSPGRP)
COMPATIBLE_IOCTL(TIOCGPGRP)
ULONG_IOCTL(TIOCSCTTY)
COMPATIBLE_IOCTL(TIOCGPTN)
COMPATIBLE_IOCTL(TIOCSPTLCK)
COMPATIBLE_IOCTL(TIOCSERGETLSR)
/* Big F */
COMPATIBLE_IOCTL(FBIOBLANK)
COMPATIBLE_IOCTL(FBIOGET_VSCREENINFO)
COMPATIBLE_IOCTL(FBIOPUT_VSCREENINFO)
COMPATIBLE_IOCTL(FBIOPAN_DISPLAY)
COMPATIBLE_IOCTL(FBIOGET_CON2FBMAP)
COMPATIBLE_IOCTL(FBIOPUT_CON2FBMAP)
/* Little f */
COMPATIBLE_IOCTL(FIOCLEX)
COMPATIBLE_IOCTL(FIONCLEX)
COMPATIBLE_IOCTL(FIOASYNC)
COMPATIBLE_IOCTL(FIONBIO)
COMPATIBLE_IOCTL(FIONREAD) /* This is also TIOCINQ */
/* 0x00 */
COMPATIBLE_IOCTL(FIBMAP)
COMPATIBLE_IOCTL(FIGETBSZ)
/* 0x03 -- HD/IDE ioctl's used by hdparm and friends.
* Some need translations, these do not.
*/
COMPATIBLE_IOCTL(HDIO_GET_IDENTITY)
COMPATIBLE_IOCTL(HDIO_SET_DMA)
COMPATIBLE_IOCTL(HDIO_SET_UNMASKINTR)
COMPATIBLE_IOCTL(HDIO_SET_NOWERR)
COMPATIBLE_IOCTL(HDIO_SET_32BIT)
COMPATIBLE_IOCTL(HDIO_SET_MULTCOUNT)
COMPATIBLE_IOCTL(HDIO_DRIVE_CMD)
COMPATIBLE_IOCTL(HDIO_DRIVE_TASK)
COMPATIBLE_IOCTL(HDIO_SET_PIO_MODE)
COMPATIBLE_IOCTL(HDIO_SET_NICE)
/* 0x02 -- Floppy ioctls */
COMPATIBLE_IOCTL(FDMSGON)
COMPATIBLE_IOCTL(FDMSGOFF)
COMPATIBLE_IOCTL(FDSETEMSGTRESH)
COMPATIBLE_IOCTL(FDFLUSH)
COMPATIBLE_IOCTL(FDWERRORCLR)
COMPATIBLE_IOCTL(FDSETMAXERRS)
COMPATIBLE_IOCTL(FDGETMAXERRS)
COMPATIBLE_IOCTL(FDGETDRVTYP)
COMPATIBLE_IOCTL(FDEJECT)
COMPATIBLE_IOCTL(FDCLRPRM)
COMPATIBLE_IOCTL(FDFMTBEG)
COMPATIBLE_IOCTL(FDFMTEND)
COMPATIBLE_IOCTL(FDRESET)
COMPATIBLE_IOCTL(FDTWADDLE)
COMPATIBLE_IOCTL(FDFMTTRK)
COMPATIBLE_IOCTL(FDRAWCMD)
/* 0x12 */
COMPATIBLE_IOCTL(BLKROSET)
COMPATIBLE_IOCTL(BLKROGET)
COMPATIBLE_IOCTL(BLKRRPART)
COMPATIBLE_IOCTL(BLKFLSBUF)
COMPATIBLE_IOCTL(BLKSECTSET)
COMPATIBLE_IOCTL(BLKSSZGET)
ULONG_IOCTL(BLKRASET)
ULONG_IOCTL(BLKFRASET)
/* RAID */
COMPATIBLE_IOCTL(RAID_VERSION)
COMPATIBLE_IOCTL(GET_ARRAY_INFO)
COMPATIBLE_IOCTL(GET_DISK_INFO)
COMPATIBLE_IOCTL(PRINT_RAID_DEBUG)
COMPATIBLE_IOCTL(RAID_AUTORUN)
COMPATIBLE_IOCTL(CLEAR_ARRAY)
COMPATIBLE_IOCTL(ADD_NEW_DISK)
ULONG_IOCTL(HOT_REMOVE_DISK)
COMPATIBLE_IOCTL(SET_ARRAY_INFO)
COMPATIBLE_IOCTL(SET_DISK_INFO)
COMPATIBLE_IOCTL(WRITE_RAID_INFO)
COMPATIBLE_IOCTL(UNPROTECT_ARRAY)
COMPATIBLE_IOCTL(PROTECT_ARRAY)
ULONG_IOCTL(HOT_ADD_DISK)
ULONG_IOCTL(SET_DISK_FAULTY)
COMPATIBLE_IOCTL(RUN_ARRAY)
ULONG_IOCTL(START_ARRAY)
COMPATIBLE_IOCTL(STOP_ARRAY)
COMPATIBLE_IOCTL(STOP_ARRAY_RO)
COMPATIBLE_IOCTL(RESTART_ARRAY_RW)
/* DM */
COMPATIBLE_IOCTL(DM_VERSION_32)
COMPATIBLE_IOCTL(DM_REMOVE_ALL_32)
COMPATIBLE_IOCTL(DM_LIST_DEVICES_32)
COMPATIBLE_IOCTL(DM_DEV_CREATE_32)
COMPATIBLE_IOCTL(DM_DEV_REMOVE_32)
COMPATIBLE_IOCTL(DM_DEV_RENAME_32)
COMPATIBLE_IOCTL(DM_DEV_SUSPEND_32)
COMPATIBLE_IOCTL(DM_DEV_STATUS_32)
COMPATIBLE_IOCTL(DM_DEV_WAIT_32)
COMPATIBLE_IOCTL(DM_TABLE_LOAD_32)
COMPATIBLE_IOCTL(DM_TABLE_CLEAR_32)
COMPATIBLE_IOCTL(DM_TABLE_DEPS_32)
COMPATIBLE_IOCTL(DM_TABLE_STATUS_32)
COMPATIBLE_IOCTL(DM_LIST_VERSIONS_32)
COMPATIBLE_IOCTL(DM_TARGET_MSG_32)
COMPATIBLE_IOCTL(DM_VERSION)
COMPATIBLE_IOCTL(DM_REMOVE_ALL)
COMPATIBLE_IOCTL(DM_LIST_DEVICES)
COMPATIBLE_IOCTL(DM_DEV_CREATE)
COMPATIBLE_IOCTL(DM_DEV_REMOVE)
COMPATIBLE_IOCTL(DM_DEV_RENAME)
COMPATIBLE_IOCTL(DM_DEV_SUSPEND)
COMPATIBLE_IOCTL(DM_DEV_STATUS)
COMPATIBLE_IOCTL(DM_DEV_WAIT)
COMPATIBLE_IOCTL(DM_TABLE_LOAD)
COMPATIBLE_IOCTL(DM_TABLE_CLEAR)
COMPATIBLE_IOCTL(DM_TABLE_DEPS)
COMPATIBLE_IOCTL(DM_TABLE_STATUS)
COMPATIBLE_IOCTL(DM_LIST_VERSIONS)
COMPATIBLE_IOCTL(DM_TARGET_MSG)
/* Big K */
COMPATIBLE_IOCTL(PIO_FONT)
COMPATIBLE_IOCTL(GIO_FONT)
ULONG_IOCTL(KDSIGACCEPT)
COMPATIBLE_IOCTL(KDGETKEYCODE)
COMPATIBLE_IOCTL(KDSETKEYCODE)
ULONG_IOCTL(KIOCSOUND)
ULONG_IOCTL(KDMKTONE)
COMPATIBLE_IOCTL(KDGKBTYPE)
ULONG_IOCTL(KDSETMODE)
COMPATIBLE_IOCTL(KDGETMODE)
ULONG_IOCTL(KDSKBMODE)
COMPATIBLE_IOCTL(KDGKBMODE)
ULONG_IOCTL(KDSKBMETA)
COMPATIBLE_IOCTL(KDGKBMETA)
COMPATIBLE_IOCTL(KDGKBENT)
COMPATIBLE_IOCTL(KDSKBENT)
COMPATIBLE_IOCTL(KDGKBSENT)
COMPATIBLE_IOCTL(KDSKBSENT)
COMPATIBLE_IOCTL(KDGKBDIACR)
COMPATIBLE_IOCTL(KDSKBDIACR)
COMPATIBLE_IOCTL(KDKBDREP)
COMPATIBLE_IOCTL(KDGKBLED)
ULONG_IOCTL(KDSKBLED)
COMPATIBLE_IOCTL(KDGETLED)
ULONG_IOCTL(KDSETLED)
COMPATIBLE_IOCTL(GIO_SCRNMAP)
COMPATIBLE_IOCTL(PIO_SCRNMAP)
COMPATIBLE_IOCTL(GIO_UNISCRNMAP)
COMPATIBLE_IOCTL(PIO_UNISCRNMAP)
COMPATIBLE_IOCTL(PIO_FONTRESET)
COMPATIBLE_IOCTL(PIO_UNIMAPCLR)
/* Big S */
COMPATIBLE_IOCTL(SCSI_IOCTL_GET_IDLUN)
COMPATIBLE_IOCTL(SCSI_IOCTL_DOORLOCK)
COMPATIBLE_IOCTL(SCSI_IOCTL_DOORUNLOCK)
COMPATIBLE_IOCTL(SCSI_IOCTL_TEST_UNIT_READY)
COMPATIBLE_IOCTL(SCSI_IOCTL_GET_BUS_NUMBER)
COMPATIBLE_IOCTL(SCSI_IOCTL_SEND_COMMAND)
COMPATIBLE_IOCTL(SCSI_IOCTL_PROBE_HOST)
COMPATIBLE_IOCTL(SCSI_IOCTL_GET_PCI)
/* Big T */
COMPATIBLE_IOCTL(TUNSETNOCSUM)
COMPATIBLE_IOCTL(TUNSETDEBUG)
COMPATIBLE_IOCTL(TUNSETPERSIST)
COMPATIBLE_IOCTL(TUNSETOWNER)
/* Big V */
COMPATIBLE_IOCTL(VT_SETMODE)
COMPATIBLE_IOCTL(VT_GETMODE)
COMPATIBLE_IOCTL(VT_GETSTATE)
COMPATIBLE_IOCTL(VT_OPENQRY)
ULONG_IOCTL(VT_ACTIVATE)
ULONG_IOCTL(VT_WAITACTIVE)
ULONG_IOCTL(VT_RELDISP)
ULONG_IOCTL(VT_DISALLOCATE)
COMPATIBLE_IOCTL(VT_RESIZE)
COMPATIBLE_IOCTL(VT_RESIZEX)
COMPATIBLE_IOCTL(VT_LOCKSWITCH)
COMPATIBLE_IOCTL(VT_UNLOCKSWITCH)
/* Little v */
/* Little v, the video4linux ioctls (conflict?) */
COMPATIBLE_IOCTL(VIDIOCGCAP)
COMPATIBLE_IOCTL(VIDIOCGCHAN)
COMPATIBLE_IOCTL(VIDIOCSCHAN)
COMPATIBLE_IOCTL(VIDIOCGPICT)
COMPATIBLE_IOCTL(VIDIOCSPICT)
COMPATIBLE_IOCTL(VIDIOCCAPTURE)
COMPATIBLE_IOCTL(VIDIOCKEY)
COMPATIBLE_IOCTL(VIDIOCGAUDIO)
COMPATIBLE_IOCTL(VIDIOCSAUDIO)
COMPATIBLE_IOCTL(VIDIOCSYNC)
COMPATIBLE_IOCTL(VIDIOCMCAPTURE)
COMPATIBLE_IOCTL(VIDIOCGMBUF)
COMPATIBLE_IOCTL(VIDIOCGUNIT)
COMPATIBLE_IOCTL(VIDIOCGCAPTURE)
COMPATIBLE_IOCTL(VIDIOCSCAPTURE)
/* BTTV specific... */
COMPATIBLE_IOCTL(_IOW('v', BASE_VIDIOCPRIVATE+0, char [256]))
COMPATIBLE_IOCTL(_IOR('v', BASE_VIDIOCPRIVATE+1, char [256]))
COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+2, unsigned int))
COMPATIBLE_IOCTL(_IOW('v' , BASE_VIDIOCPRIVATE+3, char [16])) /* struct bttv_pll_info */
COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+4, int))
COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+5, int))
COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+6, int))
COMPATIBLE_IOCTL(_IOR('v' , BASE_VIDIOCPRIVATE+7, int))
/* Little p (/dev/rtc, /dev/envctrl, etc.) */
COMPATIBLE_IOCTL(RTC_AIE_ON)
COMPATIBLE_IOCTL(RTC_AIE_OFF)
COMPATIBLE_IOCTL(RTC_UIE_ON)
COMPATIBLE_IOCTL(RTC_UIE_OFF)
COMPATIBLE_IOCTL(RTC_PIE_ON)
COMPATIBLE_IOCTL(RTC_PIE_OFF)
COMPATIBLE_IOCTL(RTC_WIE_ON)
COMPATIBLE_IOCTL(RTC_WIE_OFF)
COMPATIBLE_IOCTL(RTC_ALM_SET)
COMPATIBLE_IOCTL(RTC_ALM_READ)
COMPATIBLE_IOCTL(RTC_RD_TIME)
COMPATIBLE_IOCTL(RTC_SET_TIME)
COMPATIBLE_IOCTL(RTC_WKALM_SET)
COMPATIBLE_IOCTL(RTC_WKALM_RD)
/* Little m */
COMPATIBLE_IOCTL(MTIOCTOP)
/* Socket level stuff */
COMPATIBLE_IOCTL(FIOSETOWN)
COMPATIBLE_IOCTL(SIOCSPGRP)
COMPATIBLE_IOCTL(FIOGETOWN)
COMPATIBLE_IOCTL(SIOCGPGRP)
COMPATIBLE_IOCTL(SIOCATMARK)
COMPATIBLE_IOCTL(SIOCSIFLINK)
COMPATIBLE_IOCTL(SIOCSIFENCAP)
COMPATIBLE_IOCTL(SIOCGIFENCAP)
COMPATIBLE_IOCTL(SIOCSIFNAME)
COMPATIBLE_IOCTL(SIOCSARP)
COMPATIBLE_IOCTL(SIOCGARP)
COMPATIBLE_IOCTL(SIOCDARP)
COMPATIBLE_IOCTL(SIOCSRARP)
COMPATIBLE_IOCTL(SIOCGRARP)
COMPATIBLE_IOCTL(SIOCDRARP)
COMPATIBLE_IOCTL(SIOCADDDLCI)
COMPATIBLE_IOCTL(SIOCDELDLCI)
COMPATIBLE_IOCTL(SIOCGMIIPHY)
COMPATIBLE_IOCTL(SIOCGMIIREG)
COMPATIBLE_IOCTL(SIOCSMIIREG)
COMPATIBLE_IOCTL(SIOCGIFVLAN)
COMPATIBLE_IOCTL(SIOCSIFVLAN)
COMPATIBLE_IOCTL(SIOCBRADDBR)
COMPATIBLE_IOCTL(SIOCBRDELBR)
/* SG stuff */
COMPATIBLE_IOCTL(SG_SET_TIMEOUT)
COMPATIBLE_IOCTL(SG_GET_TIMEOUT)
COMPATIBLE_IOCTL(SG_EMULATED_HOST)
ULONG_IOCTL(SG_SET_TRANSFORM)
COMPATIBLE_IOCTL(SG_GET_TRANSFORM)
COMPATIBLE_IOCTL(SG_SET_RESERVED_SIZE)
COMPATIBLE_IOCTL(SG_GET_RESERVED_SIZE)
COMPATIBLE_IOCTL(SG_GET_SCSI_ID)
COMPATIBLE_IOCTL(SG_SET_FORCE_LOW_DMA)
COMPATIBLE_IOCTL(SG_GET_LOW_DMA)
COMPATIBLE_IOCTL(SG_SET_FORCE_PACK_ID)
COMPATIBLE_IOCTL(SG_GET_PACK_ID)
COMPATIBLE_IOCTL(SG_GET_NUM_WAITING)
COMPATIBLE_IOCTL(SG_SET_DEBUG)
COMPATIBLE_IOCTL(SG_GET_SG_TABLESIZE)
COMPATIBLE_IOCTL(SG_GET_COMMAND_Q)
COMPATIBLE_IOCTL(SG_SET_COMMAND_Q)
COMPATIBLE_IOCTL(SG_GET_VERSION_NUM)
COMPATIBLE_IOCTL(SG_NEXT_CMD_LEN)
COMPATIBLE_IOCTL(SG_SCSI_RESET)
COMPATIBLE_IOCTL(SG_GET_REQUEST_TABLE)
COMPATIBLE_IOCTL(SG_SET_KEEP_ORPHAN)
COMPATIBLE_IOCTL(SG_GET_KEEP_ORPHAN)
/* PPP stuff */
COMPATIBLE_IOCTL(PPPIOCGFLAGS)
COMPATIBLE_IOCTL(PPPIOCSFLAGS)
COMPATIBLE_IOCTL(PPPIOCGASYNCMAP)
COMPATIBLE_IOCTL(PPPIOCSASYNCMAP)
COMPATIBLE_IOCTL(PPPIOCGUNIT)
COMPATIBLE_IOCTL(PPPIOCGRASYNCMAP)
COMPATIBLE_IOCTL(PPPIOCSRASYNCMAP)
COMPATIBLE_IOCTL(PPPIOCGMRU)
COMPATIBLE_IOCTL(PPPIOCSMRU)
COMPATIBLE_IOCTL(PPPIOCSMAXCID)
COMPATIBLE_IOCTL(PPPIOCGXASYNCMAP)
COMPATIBLE_IOCTL(PPPIOCSXASYNCMAP)
COMPATIBLE_IOCTL(PPPIOCXFERUNIT)
/* PPPIOCSCOMPRESS is translated */
COMPATIBLE_IOCTL(PPPIOCGNPMODE)
COMPATIBLE_IOCTL(PPPIOCSNPMODE)
COMPATIBLE_IOCTL(PPPIOCGDEBUG)
COMPATIBLE_IOCTL(PPPIOCSDEBUG)
/* PPPIOCSPASS is translated */
/* PPPIOCSACTIVE is translated */
/* PPPIOCGIDLE is translated */
COMPATIBLE_IOCTL(PPPIOCNEWUNIT)
COMPATIBLE_IOCTL(PPPIOCATTACH)
COMPATIBLE_IOCTL(PPPIOCDETACH)
COMPATIBLE_IOCTL(PPPIOCSMRRU)
COMPATIBLE_IOCTL(PPPIOCCONNECT)
COMPATIBLE_IOCTL(PPPIOCDISCONN)
COMPATIBLE_IOCTL(PPPIOCATTCHAN)
COMPATIBLE_IOCTL(PPPIOCGCHAN)
/* PPPOX */
COMPATIBLE_IOCTL(PPPOEIOCSFWD)
COMPATIBLE_IOCTL(PPPOEIOCDFWD)
/* LP */
COMPATIBLE_IOCTL(LPGETSTATUS)
/* ppdev */
COMPATIBLE_IOCTL(PPCLAIM)
COMPATIBLE_IOCTL(PPRELEASE)
COMPATIBLE_IOCTL(PPEXCL)
COMPATIBLE_IOCTL(PPYIELD)
/* CDROM stuff */
COMPATIBLE_IOCTL(CDROMPAUSE)
COMPATIBLE_IOCTL(CDROMRESUME)
COMPATIBLE_IOCTL(CDROMPLAYMSF)
COMPATIBLE_IOCTL(CDROMPLAYTRKIND)
COMPATIBLE_IOCTL(CDROMREADTOCHDR)
COMPATIBLE_IOCTL(CDROMREADTOCENTRY)
COMPATIBLE_IOCTL(CDROMSTOP)
COMPATIBLE_IOCTL(CDROMSTART)
COMPATIBLE_IOCTL(CDROMEJECT)
COMPATIBLE_IOCTL(CDROMVOLCTRL)
COMPATIBLE_IOCTL(CDROMSUBCHNL)
ULONG_IOCTL(CDROMEJECT_SW)
COMPATIBLE_IOCTL(CDROMMULTISESSION)
COMPATIBLE_IOCTL(CDROM_GET_MCN)
COMPATIBLE_IOCTL(CDROMRESET)
COMPATIBLE_IOCTL(CDROMVOLREAD)
COMPATIBLE_IOCTL(CDROMSEEK)
COMPATIBLE_IOCTL(CDROMPLAYBLK)
COMPATIBLE_IOCTL(CDROMCLOSETRAY)
ULONG_IOCTL(CDROM_SET_OPTIONS)
ULONG_IOCTL(CDROM_CLEAR_OPTIONS)
ULONG_IOCTL(CDROM_SELECT_SPEED)
ULONG_IOCTL(CDROM_SELECT_DISC)
ULONG_IOCTL(CDROM_MEDIA_CHANGED)
ULONG_IOCTL(CDROM_DRIVE_STATUS)
COMPATIBLE_IOCTL(CDROM_DISC_STATUS)
COMPATIBLE_IOCTL(CDROM_CHANGER_NSLOTS)
ULONG_IOCTL(CDROM_LOCKDOOR)
ULONG_IOCTL(CDROM_DEBUG)
COMPATIBLE_IOCTL(CDROM_GET_CAPABILITY)
/* Ignore cdrom.h about these next 5 ioctls, they absolutely do
* not take a struct cdrom_read, instead they take a struct cdrom_msf
* which is compatible.
*/
COMPATIBLE_IOCTL(CDROMREADMODE2)
COMPATIBLE_IOCTL(CDROMREADMODE1)
COMPATIBLE_IOCTL(CDROMREADRAW)
COMPATIBLE_IOCTL(CDROMREADCOOKED)
COMPATIBLE_IOCTL(CDROMREADALL)
/* DVD ioctls */
COMPATIBLE_IOCTL(DVD_READ_STRUCT)
COMPATIBLE_IOCTL(DVD_WRITE_STRUCT)
COMPATIBLE_IOCTL(DVD_AUTH)
/* pktcdvd */
COMPATIBLE_IOCTL(PACKET_CTRL_CMD)
/* Big L */
ULONG_IOCTL(LOOP_SET_FD)
ULONG_IOCTL(LOOP_CHANGE_FD)
COMPATIBLE_IOCTL(LOOP_CLR_FD)
COMPATIBLE_IOCTL(LOOP_GET_STATUS64)
COMPATIBLE_IOCTL(LOOP_SET_STATUS64)
/* Big A */
/* sparc only */
/* Big Q for sound/OSS */
COMPATIBLE_IOCTL(SNDCTL_SEQ_RESET)
COMPATIBLE_IOCTL(SNDCTL_SEQ_SYNC)
COMPATIBLE_IOCTL(SNDCTL_SYNTH_INFO)
COMPATIBLE_IOCTL(SNDCTL_SEQ_CTRLRATE)
COMPATIBLE_IOCTL(SNDCTL_SEQ_GETOUTCOUNT)
COMPATIBLE_IOCTL(SNDCTL_SEQ_GETINCOUNT)
COMPATIBLE_IOCTL(SNDCTL_SEQ_PERCMODE)
COMPATIBLE_IOCTL(SNDCTL_FM_LOAD_INSTR)
COMPATIBLE_IOCTL(SNDCTL_SEQ_TESTMIDI)
COMPATIBLE_IOCTL(SNDCTL_SEQ_RESETSAMPLES)
COMPATIBLE_IOCTL(SNDCTL_SEQ_NRSYNTHS)
COMPATIBLE_IOCTL(SNDCTL_SEQ_NRMIDIS)
COMPATIBLE_IOCTL(SNDCTL_MIDI_INFO)
COMPATIBLE_IOCTL(SNDCTL_SEQ_THRESHOLD)
COMPATIBLE_IOCTL(SNDCTL_SYNTH_MEMAVL)
COMPATIBLE_IOCTL(SNDCTL_FM_4OP_ENABLE)
COMPATIBLE_IOCTL(SNDCTL_SEQ_PANIC)
COMPATIBLE_IOCTL(SNDCTL_SEQ_OUTOFBAND)
COMPATIBLE_IOCTL(SNDCTL_SEQ_GETTIME)
COMPATIBLE_IOCTL(SNDCTL_SYNTH_ID)
COMPATIBLE_IOCTL(SNDCTL_SYNTH_CONTROL)
COMPATIBLE_IOCTL(SNDCTL_SYNTH_REMOVESAMPLE)
/* Big T for sound/OSS */
COMPATIBLE_IOCTL(SNDCTL_TMR_TIMEBASE)
COMPATIBLE_IOCTL(SNDCTL_TMR_START)
COMPATIBLE_IOCTL(SNDCTL_TMR_STOP)
COMPATIBLE_IOCTL(SNDCTL_TMR_CONTINUE)
COMPATIBLE_IOCTL(SNDCTL_TMR_TEMPO)
COMPATIBLE_IOCTL(SNDCTL_TMR_SOURCE)
COMPATIBLE_IOCTL(SNDCTL_TMR_METRONOME)
COMPATIBLE_IOCTL(SNDCTL_TMR_SELECT)
/* Little m for sound/OSS */
COMPATIBLE_IOCTL(SNDCTL_MIDI_PRETIME)
COMPATIBLE_IOCTL(SNDCTL_MIDI_MPUMODE)
COMPATIBLE_IOCTL(SNDCTL_MIDI_MPUCMD)
/* Big P for sound/OSS */
COMPATIBLE_IOCTL(SNDCTL_DSP_RESET)
COMPATIBLE_IOCTL(SNDCTL_DSP_SYNC)
COMPATIBLE_IOCTL(SNDCTL_DSP_SPEED)
COMPATIBLE_IOCTL(SNDCTL_DSP_STEREO)
COMPATIBLE_IOCTL(SNDCTL_DSP_GETBLKSIZE)
COMPATIBLE_IOCTL(SNDCTL_DSP_CHANNELS)
COMPATIBLE_IOCTL(SOUND_PCM_WRITE_FILTER)
COMPATIBLE_IOCTL(SNDCTL_DSP_POST)
COMPATIBLE_IOCTL(SNDCTL_DSP_SUBDIVIDE)
COMPATIBLE_IOCTL(SNDCTL_DSP_SETFRAGMENT)
COMPATIBLE_IOCTL(SNDCTL_DSP_GETFMTS)
COMPATIBLE_IOCTL(SNDCTL_DSP_SETFMT)
COMPATIBLE_IOCTL(SNDCTL_DSP_GETOSPACE)
COMPATIBLE_IOCTL(SNDCTL_DSP_GETISPACE)
COMPATIBLE_IOCTL(SNDCTL_DSP_NONBLOCK)
COMPATIBLE_IOCTL(SNDCTL_DSP_GETCAPS)
COMPATIBLE_IOCTL(SNDCTL_DSP_GETTRIGGER)
COMPATIBLE_IOCTL(SNDCTL_DSP_SETTRIGGER)
COMPATIBLE_IOCTL(SNDCTL_DSP_GETIPTR)
COMPATIBLE_IOCTL(SNDCTL_DSP_GETOPTR)
/* SNDCTL_DSP_MAPINBUF, XXX needs translation */
/* SNDCTL_DSP_MAPOUTBUF, XXX needs translation */
COMPATIBLE_IOCTL(SNDCTL_DSP_SETSYNCRO)
COMPATIBLE_IOCTL(SNDCTL_DSP_SETDUPLEX)
COMPATIBLE_IOCTL(SNDCTL_DSP_GETODELAY)
COMPATIBLE_IOCTL(SNDCTL_DSP_PROFILE)
COMPATIBLE_IOCTL(SOUND_PCM_READ_RATE)
COMPATIBLE_IOCTL(SOUND_PCM_READ_CHANNELS)
COMPATIBLE_IOCTL(SOUND_PCM_READ_BITS)
COMPATIBLE_IOCTL(SOUND_PCM_READ_FILTER)
/* Big C for sound/OSS */
COMPATIBLE_IOCTL(SNDCTL_COPR_RESET)
COMPATIBLE_IOCTL(SNDCTL_COPR_LOAD)
COMPATIBLE_IOCTL(SNDCTL_COPR_RDATA)
COMPATIBLE_IOCTL(SNDCTL_COPR_RCODE)
COMPATIBLE_IOCTL(SNDCTL_COPR_WDATA)
COMPATIBLE_IOCTL(SNDCTL_COPR_WCODE)
COMPATIBLE_IOCTL(SNDCTL_COPR_RUN)
COMPATIBLE_IOCTL(SNDCTL_COPR_HALT)
COMPATIBLE_IOCTL(SNDCTL_COPR_SENDMSG)
COMPATIBLE_IOCTL(SNDCTL_COPR_RCVMSG)
/* Big M for sound/OSS */
COMPATIBLE_IOCTL(SOUND_MIXER_READ_VOLUME)
COMPATIBLE_IOCTL(SOUND_MIXER_READ_BASS)
COMPATIBLE_IOCTL(SOUND_MIXER_READ_TREBLE)
COMPATIBLE_IOCTL(SOUND_MIXER_READ_SYNTH)
COMPATIBLE_IOCTL(SOUND_MIXER_READ_PCM)
COMPATIBLE_IOCTL(SOUND_MIXER_READ_SPEAKER)
COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE)
COMPATIBLE_IOCTL(SOUND_MIXER_READ_MIC)
COMPATIBLE_IOCTL(SOUND_MIXER_READ_CD)
COMPATIBLE_IOCTL(SOUND_MIXER_READ_IMIX)
COMPATIBLE_IOCTL(SOUND_MIXER_READ_ALTPCM)
COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECLEV)
COMPATIBLE_IOCTL(SOUND_MIXER_READ_IGAIN)
COMPATIBLE_IOCTL(SOUND_MIXER_READ_OGAIN)
COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE1)
COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE2)
COMPATIBLE_IOCTL(SOUND_MIXER_READ_LINE3)
COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL1))
COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL2))
COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_DIGITAL3))
COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_PHONEIN))
COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_PHONEOUT))
COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_VIDEO))
COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_RADIO))
COMPATIBLE_IOCTL(MIXER_READ(SOUND_MIXER_MONITOR))
COMPATIBLE_IOCTL(SOUND_MIXER_READ_MUTE)
/* SOUND_MIXER_READ_ENHANCE, same value as READ_MUTE */
/* SOUND_MIXER_READ_LOUD, same value as READ_MUTE */
COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECSRC)
COMPATIBLE_IOCTL(SOUND_MIXER_READ_DEVMASK)
COMPATIBLE_IOCTL(SOUND_MIXER_READ_RECMASK)
COMPATIBLE_IOCTL(SOUND_MIXER_READ_STEREODEVS)
COMPATIBLE_IOCTL(SOUND_MIXER_READ_CAPS)
COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_VOLUME)
COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_BASS)
COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_TREBLE)
COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_SYNTH)
COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_PCM)
COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_SPEAKER)
COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE)
COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_MIC)
COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_CD)
COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_IMIX)
COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_ALTPCM)
COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_RECLEV)
COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_IGAIN)
COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_OGAIN)
COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE1)
COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE2)
COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_LINE3)
COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL1))
COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL2))
COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_DIGITAL3))
COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_PHONEIN))
COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_PHONEOUT))
COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_VIDEO))
COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_RADIO))
COMPATIBLE_IOCTL(MIXER_WRITE(SOUND_MIXER_MONITOR))
COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_MUTE)
/* SOUND_MIXER_WRITE_ENHANCE, same value as WRITE_MUTE */
/* SOUND_MIXER_WRITE_LOUD, same value as WRITE_MUTE */
COMPATIBLE_IOCTL(SOUND_MIXER_WRITE_RECSRC)
COMPATIBLE_IOCTL(SOUND_MIXER_INFO)
COMPATIBLE_IOCTL(SOUND_OLD_MIXER_INFO)
COMPATIBLE_IOCTL(SOUND_MIXER_ACCESS)
COMPATIBLE_IOCTL(SOUND_MIXER_AGC)
COMPATIBLE_IOCTL(SOUND_MIXER_3DSE)
COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE1)
COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE2)
COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE3)
COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE4)
COMPATIBLE_IOCTL(SOUND_MIXER_PRIVATE5)
COMPATIBLE_IOCTL(SOUND_MIXER_GETLEVELS)
COMPATIBLE_IOCTL(SOUND_MIXER_SETLEVELS)
COMPATIBLE_IOCTL(OSS_GETVERSION)
/* AUTOFS */
ULONG_IOCTL(AUTOFS_IOC_READY)
ULONG_IOCTL(AUTOFS_IOC_FAIL)
COMPATIBLE_IOCTL(AUTOFS_IOC_CATATONIC)
COMPATIBLE_IOCTL(AUTOFS_IOC_PROTOVER)
COMPATIBLE_IOCTL(AUTOFS_IOC_EXPIRE)
COMPATIBLE_IOCTL(AUTOFS_IOC_EXPIRE_MULTI)
COMPATIBLE_IOCTL(AUTOFS_IOC_PROTOSUBVER)
COMPATIBLE_IOCTL(AUTOFS_IOC_ASKREGHOST)
COMPATIBLE_IOCTL(AUTOFS_IOC_TOGGLEREGHOST)
COMPATIBLE_IOCTL(AUTOFS_IOC_ASKUMOUNT)
/* DEVFS */
COMPATIBLE_IOCTL(DEVFSDIOC_GET_PROTO_REV)
COMPATIBLE_IOCTL(DEVFSDIOC_SET_EVENT_MASK)
COMPATIBLE_IOCTL(DEVFSDIOC_RELEASE_EVENT_QUEUE)
COMPATIBLE_IOCTL(DEVFSDIOC_SET_DEBUG_MASK)
/* Raw devices */
COMPATIBLE_IOCTL(RAW_SETBIND)
COMPATIBLE_IOCTL(RAW_GETBIND)
/* SMB ioctls which do not need any translations */
COMPATIBLE_IOCTL(SMB_IOC_NEWCONN)
/* NCP ioctls which do not need any translations */
COMPATIBLE_IOCTL(NCP_IOC_CONN_LOGGED_IN)
COMPATIBLE_IOCTL(NCP_IOC_SIGN_INIT)
COMPATIBLE_IOCTL(NCP_IOC_SIGN_WANTED)
COMPATIBLE_IOCTL(NCP_IOC_SET_SIGN_WANTED)
COMPATIBLE_IOCTL(NCP_IOC_LOCKUNLOCK)
COMPATIBLE_IOCTL(NCP_IOC_GETROOT)
COMPATIBLE_IOCTL(NCP_IOC_SETROOT)
COMPATIBLE_IOCTL(NCP_IOC_GETCHARSETS)
COMPATIBLE_IOCTL(NCP_IOC_SETCHARSETS)
COMPATIBLE_IOCTL(NCP_IOC_GETDENTRYTTL)
COMPATIBLE_IOCTL(NCP_IOC_SETDENTRYTTL)
/* Little a */
COMPATIBLE_IOCTL(ATMSIGD_CTRL)
COMPATIBLE_IOCTL(ATMARPD_CTRL)
COMPATIBLE_IOCTL(ATMLEC_CTRL)
COMPATIBLE_IOCTL(ATMLEC_MCAST)
COMPATIBLE_IOCTL(ATMLEC_DATA)
COMPATIBLE_IOCTL(ATM_SETSC)
COMPATIBLE_IOCTL(SIOCSIFATMTCP)
COMPATIBLE_IOCTL(SIOCMKCLIP)
COMPATIBLE_IOCTL(ATMARP_MKIP)
COMPATIBLE_IOCTL(ATMARP_SETENTRY)
COMPATIBLE_IOCTL(ATMARP_ENCAP)
COMPATIBLE_IOCTL(ATMTCP_CREATE)
COMPATIBLE_IOCTL(ATMTCP_REMOVE)
COMPATIBLE_IOCTL(ATMMPC_CTRL)
COMPATIBLE_IOCTL(ATMMPC_DATA)
/* Watchdog */
COMPATIBLE_IOCTL(WDIOC_GETSUPPORT)
COMPATIBLE_IOCTL(WDIOC_GETSTATUS)
COMPATIBLE_IOCTL(WDIOC_GETBOOTSTATUS)
COMPATIBLE_IOCTL(WDIOC_GETTEMP)
COMPATIBLE_IOCTL(WDIOC_SETOPTIONS)
COMPATIBLE_IOCTL(WDIOC_KEEPALIVE)
COMPATIBLE_IOCTL(WDIOC_SETTIMEOUT)
COMPATIBLE_IOCTL(WDIOC_GETTIMEOUT)
/* Big R */
COMPATIBLE_IOCTL(RNDGETENTCNT)
COMPATIBLE_IOCTL(RNDADDTOENTCNT)
COMPATIBLE_IOCTL(RNDGETPOOL)
COMPATIBLE_IOCTL(RNDADDENTROPY)
COMPATIBLE_IOCTL(RNDZAPENTCNT)
COMPATIBLE_IOCTL(RNDCLEARPOOL)
/* Bluetooth */
COMPATIBLE_IOCTL(HCIDEVUP)
COMPATIBLE_IOCTL(HCIDEVDOWN)
COMPATIBLE_IOCTL(HCIDEVRESET)
COMPATIBLE_IOCTL(HCIDEVRESTAT)
COMPATIBLE_IOCTL(HCIGETDEVLIST)
COMPATIBLE_IOCTL(HCIGETDEVINFO)
COMPATIBLE_IOCTL(HCIGETCONNLIST)
COMPATIBLE_IOCTL(HCIGETCONNINFO)
COMPATIBLE_IOCTL(HCISETRAW)
COMPATIBLE_IOCTL(HCISETSCAN)
COMPATIBLE_IOCTL(HCISETAUTH)
COMPATIBLE_IOCTL(HCISETENCRYPT)
COMPATIBLE_IOCTL(HCISETPTYPE)
COMPATIBLE_IOCTL(HCISETLINKPOL)
COMPATIBLE_IOCTL(HCISETLINKMODE)
COMPATIBLE_IOCTL(HCISETACLMTU)
COMPATIBLE_IOCTL(HCISETSCOMTU)
COMPATIBLE_IOCTL(HCIINQUIRY)
COMPATIBLE_IOCTL(HCIUARTSETPROTO)
COMPATIBLE_IOCTL(HCIUARTGETPROTO)
COMPATIBLE_IOCTL(RFCOMMCREATEDEV)
COMPATIBLE_IOCTL(RFCOMMRELEASEDEV)
COMPATIBLE_IOCTL(RFCOMMGETDEVLIST)
COMPATIBLE_IOCTL(RFCOMMGETDEVINFO)
COMPATIBLE_IOCTL(RFCOMMSTEALDLC)
COMPATIBLE_IOCTL(BNEPCONNADD)
COMPATIBLE_IOCTL(BNEPCONNDEL)
COMPATIBLE_IOCTL(BNEPGETCONNLIST)
COMPATIBLE_IOCTL(BNEPGETCONNINFO)
COMPATIBLE_IOCTL(CMTPCONNADD)
COMPATIBLE_IOCTL(CMTPCONNDEL)
COMPATIBLE_IOCTL(CMTPGETCONNLIST)
COMPATIBLE_IOCTL(CMTPGETCONNINFO)
COMPATIBLE_IOCTL(HIDPCONNADD)
COMPATIBLE_IOCTL(HIDPCONNDEL)
COMPATIBLE_IOCTL(HIDPGETCONNLIST)
COMPATIBLE_IOCTL(HIDPGETCONNINFO)
/* CAPI */
COMPATIBLE_IOCTL(CAPI_REGISTER)
COMPATIBLE_IOCTL(CAPI_GET_MANUFACTURER)
COMPATIBLE_IOCTL(CAPI_GET_VERSION)
COMPATIBLE_IOCTL(CAPI_GET_SERIAL)
COMPATIBLE_IOCTL(CAPI_GET_PROFILE)
COMPATIBLE_IOCTL(CAPI_MANUFACTURER_CMD)
COMPATIBLE_IOCTL(CAPI_GET_ERRCODE)
COMPATIBLE_IOCTL(CAPI_INSTALLED)
COMPATIBLE_IOCTL(CAPI_GET_FLAGS)
COMPATIBLE_IOCTL(CAPI_SET_FLAGS)
COMPATIBLE_IOCTL(CAPI_CLR_FLAGS)
COMPATIBLE_IOCTL(CAPI_NCCI_OPENCOUNT)
COMPATIBLE_IOCTL(CAPI_NCCI_GETUNIT)
/* Misc. */
COMPATIBLE_IOCTL(0x41545900) /* ATYIO_CLKR */
COMPATIBLE_IOCTL(0x41545901) /* ATYIO_CLKW */
COMPATIBLE_IOCTL(PCIIOC_CONTROLLER)
COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_IO)
COMPATIBLE_IOCTL(PCIIOC_MMAP_IS_MEM)
COMPATIBLE_IOCTL(PCIIOC_WRITE_COMBINE)
/* USB */
COMPATIBLE_IOCTL(USBDEVFS_RESETEP)
COMPATIBLE_IOCTL(USBDEVFS_SETINTERFACE)
COMPATIBLE_IOCTL(USBDEVFS_SETCONFIGURATION)
COMPATIBLE_IOCTL(USBDEVFS_GETDRIVER)
COMPATIBLE_IOCTL(USBDEVFS_DISCARDURB)
COMPATIBLE_IOCTL(USBDEVFS_CLAIMINTERFACE)
COMPATIBLE_IOCTL(USBDEVFS_RELEASEINTERFACE)
COMPATIBLE_IOCTL(USBDEVFS_CONNECTINFO)
COMPATIBLE_IOCTL(USBDEVFS_HUB_PORTINFO)
COMPATIBLE_IOCTL(USBDEVFS_RESET)
COMPATIBLE_IOCTL(USBDEVFS_SUBMITURB32)
COMPATIBLE_IOCTL(USBDEVFS_REAPURB32)
COMPATIBLE_IOCTL(USBDEVFS_REAPURBNDELAY32)
COMPATIBLE_IOCTL(USBDEVFS_CLEAR_HALT)
/* MTD */
COMPATIBLE_IOCTL(MEMGETINFO)
COMPATIBLE_IOCTL(MEMERASE)
COMPATIBLE_IOCTL(MEMLOCK)
COMPATIBLE_IOCTL(MEMUNLOCK)
COMPATIBLE_IOCTL(MEMGETREGIONCOUNT)
COMPATIBLE_IOCTL(MEMGETREGIONINFO)
/* NBD */
ULONG_IOCTL(NBD_SET_SOCK)
ULONG_IOCTL(NBD_SET_BLKSIZE)
ULONG_IOCTL(NBD_SET_SIZE)
COMPATIBLE_IOCTL(NBD_DO_IT)
COMPATIBLE_IOCTL(NBD_CLEAR_SOCK)
COMPATIBLE_IOCTL(NBD_CLEAR_QUE)
COMPATIBLE_IOCTL(NBD_PRINT_DEBUG)
ULONG_IOCTL(NBD_SET_SIZE_BLOCKS)
COMPATIBLE_IOCTL(NBD_DISCONNECT)
/* i2c */
COMPATIBLE_IOCTL(I2C_SLAVE)
COMPATIBLE_IOCTL(I2C_SLAVE_FORCE)
COMPATIBLE_IOCTL(I2C_TENBIT)
COMPATIBLE_IOCTL(I2C_PEC)
COMPATIBLE_IOCTL(I2C_RETRIES)
COMPATIBLE_IOCTL(I2C_TIMEOUT)
/* wireless */
COMPATIBLE_IOCTL(SIOCSIWCOMMIT)
COMPATIBLE_IOCTL(SIOCGIWNAME)
COMPATIBLE_IOCTL(SIOCSIWNWID)
COMPATIBLE_IOCTL(SIOCGIWNWID)
COMPATIBLE_IOCTL(SIOCSIWFREQ)
COMPATIBLE_IOCTL(SIOCGIWFREQ)
COMPATIBLE_IOCTL(SIOCSIWMODE)
COMPATIBLE_IOCTL(SIOCGIWMODE)
COMPATIBLE_IOCTL(SIOCSIWSENS)
COMPATIBLE_IOCTL(SIOCGIWSENS)
COMPATIBLE_IOCTL(SIOCSIWRANGE)
COMPATIBLE_IOCTL(SIOCSIWPRIV)
COMPATIBLE_IOCTL(SIOCGIWPRIV)
COMPATIBLE_IOCTL(SIOCSIWSTATS)
COMPATIBLE_IOCTL(SIOCGIWSTATS)
COMPATIBLE_IOCTL(SIOCSIWAP)
COMPATIBLE_IOCTL(SIOCGIWAP)
COMPATIBLE_IOCTL(SIOCSIWSCAN)
COMPATIBLE_IOCTL(SIOCSIWRATE)
COMPATIBLE_IOCTL(SIOCGIWRATE)
COMPATIBLE_IOCTL(SIOCSIWRTS)
COMPATIBLE_IOCTL(SIOCGIWRTS)
COMPATIBLE_IOCTL(SIOCSIWFRAG)
COMPATIBLE_IOCTL(SIOCGIWFRAG)
COMPATIBLE_IOCTL(SIOCSIWTXPOW)
COMPATIBLE_IOCTL(SIOCGIWTXPOW)
COMPATIBLE_IOCTL(SIOCSIWRETRY)
COMPATIBLE_IOCTL(SIOCGIWRETRY)
COMPATIBLE_IOCTL(SIOCSIWPOWER)
COMPATIBLE_IOCTL(SIOCGIWPOWER)
/* hiddev */
COMPATIBLE_IOCTL(HIDIOCGVERSION)
COMPATIBLE_IOCTL(HIDIOCAPPLICATION)
COMPATIBLE_IOCTL(HIDIOCGDEVINFO)
COMPATIBLE_IOCTL(HIDIOCGSTRING)
COMPATIBLE_IOCTL(HIDIOCINITREPORT)
COMPATIBLE_IOCTL(HIDIOCGREPORT)
COMPATIBLE_IOCTL(HIDIOCSREPORT)
COMPATIBLE_IOCTL(HIDIOCGREPORTINFO)
COMPATIBLE_IOCTL(HIDIOCGFIELDINFO)
COMPATIBLE_IOCTL(HIDIOCGUSAGE)
COMPATIBLE_IOCTL(HIDIOCSUSAGE)
COMPATIBLE_IOCTL(HIDIOCGUCODE)
COMPATIBLE_IOCTL(HIDIOCGFLAG)
COMPATIBLE_IOCTL(HIDIOCSFLAG)
COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINDEX)
COMPATIBLE_IOCTL(HIDIOCGCOLLECTIONINFO)

View File

@@ -0,0 +1,17 @@
/* Never include this file directly. Include <linux/compiler.h> instead. */
/*
* Common definitions for all gcc versions go here.
*/
/* Optimization barrier */
/* The "volatile" is due to gcc bugs */
#define barrier() __asm__ __volatile__("": : :"memory")
/* This macro obfuscates arithmetic on a variable address so that gcc
shouldn't recognize the original var, and make assumptions about it */
#define RELOC_HIDE(ptr, off) \
({ unsigned long __ptr; \
__asm__ ("" : "=g"(__ptr) : "0"(ptr)); \
(typeof(ptr)) (__ptr + (off)); })

View File

@@ -0,0 +1,24 @@
/* Never include this file directly. Include <linux/compiler.h> instead. */
/* These definitions are for GCC v2.x. */
/* Somewhere in the middle of the GCC 2.96 development cycle, we implemented
a mechanism by which the user can annotate likely branch directions and
expect the blocks to be reordered appropriately. Define __builtin_expect
to nothing for earlier compilers. */
#include <linux/compiler-gcc.h>
#if __GNUC_MINOR__ < 96
# define __builtin_expect(x, expected_value) (x)
#endif
#define __attribute_used__ __attribute__((__unused__))
/*
* The attribute `pure' is not implemented in GCC versions earlier
* than 2.96.
*/
#if __GNUC_MINOR__ >= 96
# define __attribute_pure__ __attribute__((pure))
# define __attribute_const__ __attribute__((__const__))
#endif

View File

@@ -0,0 +1,32 @@
/* Never include this file directly. Include <linux/compiler.h> instead. */
/* These definitions are for GCC v3.x. */
#include <linux/compiler-gcc.h>
#if __GNUC_MINOR__ >= 1
# define inline inline __attribute__((always_inline))
# define __inline__ __inline__ __attribute__((always_inline))
# define __inline __inline __attribute__((always_inline))
#endif
#if __GNUC_MINOR__ > 0
# define __deprecated __attribute__((deprecated))
#endif
#if __GNUC_MINOR__ >= 3
# define __attribute_used__ __attribute__((__used__))
#else
# define __attribute_used__ __attribute__((__unused__))
#endif
#define __attribute_pure__ __attribute__((pure))
#define __attribute_const__ __attribute__((__const__))
#if __GNUC_MINOR__ >= 1
#define noinline __attribute__((noinline))
#endif
#if __GNUC_MINOR__ >= 4
#define __must_check __attribute__((warn_unused_result))
#endif

View File

@@ -0,0 +1,16 @@
/* Never include this file directly. Include <linux/compiler.h> instead. */
/* These definitions are for GCC v4.x. */
#include <linux/compiler-gcc.h>
#define inline inline __attribute__((always_inline))
#define __inline__ __inline__ __attribute__((always_inline))
#define __inline __inline __attribute__((always_inline))
#define __deprecated __attribute__((deprecated))
#define __attribute_used__ __attribute__((__used__))
#define __attribute_pure__ __attribute__((pure))
#define __attribute_const__ __attribute__((__const__))
#define noinline __attribute__((noinline))
#define __must_check __attribute__((warn_unused_result))
#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)

View File

@@ -0,0 +1,24 @@
/* Never include this file directly. Include <linux/compiler.h> instead. */
#ifdef __ECC
/* Some compiler specific definitions are overwritten here
* for Intel ECC compiler
*/
#include <asm/intrinsics.h>
/* Intel ECC compiler doesn't support gcc specific asm stmts.
* It uses intrinsics to do the equivalent things.
*/
#undef barrier
#undef RELOC_HIDE
#define barrier() __memory_barrier()
#define RELOC_HIDE(ptr, off) \
({ unsigned long __ptr; \
__ptr = (unsigned long) (ptr); \
(typeof(ptr)) (__ptr + (off)); })
#endif

152
include/linux/compiler.h Normal file
View File

@@ -0,0 +1,152 @@
#ifndef __LINUX_COMPILER_H
#define __LINUX_COMPILER_H
#ifndef __ASSEMBLY__
#ifdef __CHECKER__
# define __user __attribute__((noderef, address_space(1)))
# define __kernel /* default address space */
# define __safe __attribute__((safe))
# define __force __attribute__((force))
# define __nocast __attribute__((nocast))
# define __iomem __attribute__((noderef, address_space(2)))
# define __acquires(x) __attribute__((context(0,1)))
# define __releases(x) __attribute__((context(1,0)))
# define __acquire(x) __context__(1)
# define __release(x) __context__(-1)
# define __cond_lock(x) ((x) ? ({ __context__(1); 1; }) : 0)
extern void __chk_user_ptr(void __user *);
extern void __chk_io_ptr(void __iomem *);
#else
# define __user
# define __kernel
# define __safe
# define __force
# define __nocast
# define __iomem
# define __chk_user_ptr(x) (void)0
# define __chk_io_ptr(x) (void)0
# define __builtin_warning(x, y...) (1)
# define __acquires(x)
# define __releases(x)
# define __acquire(x) (void)0
# define __release(x) (void)0
# define __cond_lock(x) (x)
#endif
#ifdef __KERNEL__
#if __GNUC__ > 4
#error no compiler-gcc.h file for this gcc version
#elif __GNUC__ == 4
# include <linux/compiler-gcc4.h>
#elif __GNUC__ == 3
# include <linux/compiler-gcc3.h>
#elif __GNUC__ == 2
# include <linux/compiler-gcc2.h>
#else
# error Sorry, your compiler is too old/not recognized.
#endif
/* Intel compiler defines __GNUC__. So we will overwrite implementations
* coming from above header files here
*/
#ifdef __INTEL_COMPILER
# include <linux/compiler-intel.h>
#endif
/*
* Generic compiler-dependent macros required for kernel
* build go below this comment. Actual compiler/compiler version
* specific implementations come from the above header files
*/
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
/* Optimization barrier */
#ifndef barrier
# define barrier() __memory_barrier()
#endif
#ifndef RELOC_HIDE
# define RELOC_HIDE(ptr, off) \
({ unsigned long __ptr; \
__ptr = (unsigned long) (ptr); \
(typeof(ptr)) (__ptr + (off)); })
#endif
#endif /* __KERNEL__ */
#endif /* __ASSEMBLY__ */
/*
* Allow us to mark functions as 'deprecated' and have gcc emit a nice
* warning for each use, in hopes of speeding the functions removal.
* Usage is:
* int __deprecated foo(void)
*/
#ifndef __deprecated
# define __deprecated /* unimplemented */
#endif
#ifndef __must_check
#define __must_check
#endif
/*
* Allow us to avoid 'defined but not used' warnings on functions and data,
* as well as force them to be emitted to the assembly file.
*
* As of gcc 3.3, static functions that are not marked with attribute((used))
* may be elided from the assembly file. As of gcc 3.3, static data not so
* marked will not be elided, but this may change in a future gcc version.
*
* In prior versions of gcc, such functions and data would be emitted, but
* would be warned about except with attribute((unused)).
*/
#ifndef __attribute_used__
# define __attribute_used__ /* unimplemented */
#endif
/*
* From the GCC manual:
*
* Many functions have no effects except the return value and their
* return value depends only on the parameters and/or global
* variables. Such a function can be subject to common subexpression
* elimination and loop optimization just as an arithmetic operator
* would be.
* [...]
*/
#ifndef __attribute_pure__
# define __attribute_pure__ /* unimplemented */
#endif
/*
* From the GCC manual:
*
* Many functions do not examine any values except their arguments,
* and have no effects except the return value. Basically this is
* just slightly more strict class than the `pure' attribute above,
* since function is not allowed to read global memory.
*
* Note that a function that has pointer arguments and examines the
* data pointed to must _not_ be declared `const'. Likewise, a
* function that calls a non-`const' function usually must not be
* `const'. It does not make sense for a `const' function to return
* `void'.
*/
#ifndef __attribute_const__
# define __attribute_const__ /* unimplemented */
#endif
#ifndef noinline
#define noinline
#endif
#ifndef __always_inline
#define __always_inline inline
#endif
#endif /* __LINUX_COMPILER_H */

View File

@@ -0,0 +1,42 @@
#ifndef __LINUX_COMPLETION_H
#define __LINUX_COMPLETION_H
/*
* (C) Copyright 2001 Linus Torvalds
*
* Atomic wait-for-completion handler data structures.
* See kernel/sched.c for details.
*/
#include <linux/wait.h>
struct completion {
unsigned int done;
wait_queue_head_t wait;
};
#define COMPLETION_INITIALIZER(work) \
{ 0, __WAIT_QUEUE_HEAD_INITIALIZER((work).wait) }
#define DECLARE_COMPLETION(work) \
struct completion work = COMPLETION_INITIALIZER(work)
static inline void init_completion(struct completion *x)
{
x->done = 0;
init_waitqueue_head(&x->wait);
}
extern void FASTCALL(wait_for_completion(struct completion *));
extern int FASTCALL(wait_for_completion_interruptible(struct completion *x));
extern unsigned long FASTCALL(wait_for_completion_timeout(struct completion *x,
unsigned long timeout));
extern unsigned long FASTCALL(wait_for_completion_interruptible_timeout(
struct completion *x, unsigned long timeout));
extern void FASTCALL(complete(struct completion *));
extern void FASTCALL(complete_all(struct completion *));
#define INIT_COMPLETION(x) ((x).done = 0)
#endif

119
include/linux/comstats.h Normal file
View File

@@ -0,0 +1,119 @@
/*****************************************************************************/
/*
* comstats.h -- Serial Port Stats.
*
* Copyright (C) 1996-1998 Stallion Technologies
* Copyright (C) 1994-1996 Greg Ungerer.
*
* 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 of the License, 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; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*****************************************************************************/
#ifndef _COMSTATS_H
#define _COMSTATS_H
/*****************************************************************************/
/*
* Serial port stats structure. The structure itself is UART
* independent, but some fields may be UART/driver specific (for
* example state).
*/
typedef struct {
unsigned long brd;
unsigned long panel;
unsigned long port;
unsigned long hwid;
unsigned long type;
unsigned long txtotal;
unsigned long rxtotal;
unsigned long txbuffered;
unsigned long rxbuffered;
unsigned long rxoverrun;
unsigned long rxparity;
unsigned long rxframing;
unsigned long rxlost;
unsigned long txbreaks;
unsigned long rxbreaks;
unsigned long txxon;
unsigned long txxoff;
unsigned long rxxon;
unsigned long rxxoff;
unsigned long txctson;
unsigned long txctsoff;
unsigned long rxrtson;
unsigned long rxrtsoff;
unsigned long modem;
unsigned long state;
unsigned long flags;
unsigned long ttystate;
unsigned long cflags;
unsigned long iflags;
unsigned long oflags;
unsigned long lflags;
unsigned long signals;
} comstats_t;
/*
* Board stats structure. Returns useful info about the board.
*/
#define COM_MAXPANELS 8
typedef struct {
unsigned long panel;
unsigned long type;
unsigned long hwid;
unsigned long nrports;
} companel_t;
typedef struct {
unsigned long brd;
unsigned long type;
unsigned long hwid;
unsigned long state;
unsigned long ioaddr;
unsigned long ioaddr2;
unsigned long memaddr;
unsigned long irq;
unsigned long nrpanels;
unsigned long nrports;
companel_t panels[COM_MAXPANELS];
} combrd_t;
/*
* Define the ioctl operations for stats stuff.
*/
#include <linux/ioctl.h>
#define COM_GETPORTSTATS _IO('c',30)
#define COM_CLRPORTSTATS _IO('c',31)
#define COM_GETBRDSTATS _IO('c',32)
/*
* Define the set of ioctls that give user level access to the
* private port, panel and board structures. The argument required
* will be driver dependent!
*/
#define COM_READPORT _IO('c',40)
#define COM_READBOARD _IO('c',41)
#define COM_READPANEL _IO('c',42)
/*****************************************************************************/
#endif

113
include/linux/concap.h Normal file
View File

@@ -0,0 +1,113 @@
/* $Id: concap.h,v 1.3.2.2 2004/01/12 23:08:35 keil Exp $
*
* Copyright 1997 by Henner Eisen <eis@baty.hanse.de>
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*/
#ifndef _LINUX_CONCAP_H
#define _LINUX_CONCAP_H
#ifdef __KERNEL__
#include <linux/skbuff.h>
#include <linux/netdevice.h>
/* Stuff to support encapsulation protocols genericly. The encapsulation
protocol is processed at the uppermost layer of the network interface.
Based on a ideas developed in a 'synchronous device' thread in the
linux-x25 mailing list contributed by Alan Cox, Thomasz Motylewski
and Jonathan Naylor.
For more documetation on this refer to Documentation/isdn/README.concap
*/
struct concap_proto_ops;
struct concap_device_ops;
/* this manages all data needed by the encapsulation protocol
*/
struct concap_proto{
struct net_device *net_dev; /* net device using our service */
struct concap_device_ops *dops; /* callbacks provided by device */
struct concap_proto_ops *pops; /* callbacks provided by us */
spinlock_t lock;
int flags;
void *proto_data; /* protocol specific private data, to
be accessed via *pops methods only*/
/*
:
whatever
:
*/
};
/* Operations to be supported by the net device. Called by the encapsulation
* protocol entity. No receive method is offered because the encapsulation
* protocol directly calls netif_rx().
*/
struct concap_device_ops{
/* to request data is submitted by device*/
int (*data_req)(struct concap_proto *, struct sk_buff *);
/* Control methods must be set to NULL by devices which do not
support connection control.*/
/* to request a connection is set up */
int (*connect_req)(struct concap_proto *);
/* to request a connection is released */
int (*disconn_req)(struct concap_proto *);
};
/* Operations to be supported by the encapsulation protocol. Called by
* device driver.
*/
struct concap_proto_ops{
/* create a new encapsulation protocol instance of same type */
struct concap_proto * (*proto_new) (void);
/* delete encapsulation protocol instance and free all its resources.
cprot may no loger be referenced after calling this */
void (*proto_del)(struct concap_proto *cprot);
/* initialize the protocol's data. To be called at interface startup
or when the device driver resets the interface. All services of the
encapsulation protocol may be used after this*/
int (*restart)(struct concap_proto *cprot,
struct net_device *ndev,
struct concap_device_ops *dops);
/* inactivate an encapsulation protocol instance. The encapsulation
protocol may not call any *dops methods after this. */
int (*close)(struct concap_proto *cprot);
/* process a frame handed down to us by upper layer */
int (*encap_and_xmit)(struct concap_proto *cprot, struct sk_buff *skb);
/* to be called for each data entity received from lower layer*/
int (*data_ind)(struct concap_proto *cprot, struct sk_buff *skb);
/* to be called when a connection was set up/down.
Protocols that don't process these primitives might fill in
dummy methods here */
int (*connect_ind)(struct concap_proto *cprot);
int (*disconn_ind)(struct concap_proto *cprot);
/*
Some network device support functions, like net_header(), rebuild_header(),
and others, that depend solely on the encapsulation protocol, might
be provided here, too. The net device would just fill them in its
corresponding fields when it is opened.
*/
};
/* dummy restart/close/connect/reset/disconn methods
*/
extern int concap_nop(struct concap_proto *cprot);
/* dummy submit method
*/
extern int concap_drop_skb(struct concap_proto *cprot, struct sk_buff *skb);
#endif
#endif

6
include/linux/config.h Normal file
View File

@@ -0,0 +1,6 @@
#ifndef _LINUX_CONFIG_H
#define _LINUX_CONFIG_H
#include <linux/autoconf.h>
#endif

Some files were not shown because too many files have changed in this diff Show More