mirror of https://github.com/hak5/openwrt.git
parent
2524718a9a
commit
c2bf14deb9
|
@ -19,9 +19,6 @@ endif
|
|||
ifeq ($(LINUX_VERSION),2.6.23.17)
|
||||
LINUX_KERNEL_MD5SUM:=a0300a393ac91ce9c64bf31522b45e2e
|
||||
endif
|
||||
ifeq ($(LINUX_VERSION),2.6.24.7)
|
||||
LINUX_KERNEL_MD5SUM:=40a73780d51525d28d36dec852c680c4
|
||||
endif
|
||||
ifeq ($(LINUX_VERSION),2.6.25.20)
|
||||
LINUX_KERNEL_MD5SUM:=0da698edccf03e2235abc2830a495114
|
||||
endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,788 +0,0 @@
|
|||
--- /dev/null
|
||||
+++ b/include/linux/LzmaDecode.h
|
||||
@@ -0,0 +1,100 @@
|
||||
+/*
|
||||
+ LzmaDecode.h
|
||||
+ LZMA Decoder interface
|
||||
+
|
||||
+ LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25)
|
||||
+ http://www.7-zip.org/
|
||||
+
|
||||
+ LZMA SDK is licensed under two licenses:
|
||||
+ 1) GNU Lesser General Public License (GNU LGPL)
|
||||
+ 2) Common Public License (CPL)
|
||||
+ It means that you can select one of these two licenses and
|
||||
+ follow rules of that license.
|
||||
+
|
||||
+ SPECIAL EXCEPTION:
|
||||
+ Igor Pavlov, as the author of this code, expressly permits you to
|
||||
+ statically or dynamically link your code (or bind by name) to the
|
||||
+ interfaces of this file without subjecting your linked code to the
|
||||
+ terms of the CPL or GNU LGPL. Any modifications or additions
|
||||
+ to this file, however, are subject to the LGPL or CPL terms.
|
||||
+*/
|
||||
+
|
||||
+#ifndef __LZMADECODE_H
|
||||
+#define __LZMADECODE_H
|
||||
+
|
||||
+/* #define _LZMA_IN_CB */
|
||||
+/* Use callback for input data */
|
||||
+
|
||||
+/* #define _LZMA_OUT_READ */
|
||||
+/* Use read function for output data */
|
||||
+
|
||||
+/* #define _LZMA_PROB32 */
|
||||
+/* It can increase speed on some 32-bit CPUs,
|
||||
+ but memory usage will be doubled in that case */
|
||||
+
|
||||
+/* #define _LZMA_LOC_OPT */
|
||||
+/* Enable local speed optimizations inside code */
|
||||
+
|
||||
+#ifndef UInt32
|
||||
+#ifdef _LZMA_UINT32_IS_ULONG
|
||||
+#define UInt32 unsigned long
|
||||
+#else
|
||||
+#define UInt32 unsigned int
|
||||
+#endif
|
||||
+#endif
|
||||
+
|
||||
+#ifdef _LZMA_PROB32
|
||||
+#define CProb UInt32
|
||||
+#else
|
||||
+#define CProb unsigned short
|
||||
+#endif
|
||||
+
|
||||
+#define LZMA_RESULT_OK 0
|
||||
+#define LZMA_RESULT_DATA_ERROR 1
|
||||
+#define LZMA_RESULT_NOT_ENOUGH_MEM 2
|
||||
+
|
||||
+#ifdef _LZMA_IN_CB
|
||||
+typedef struct _ILzmaInCallback
|
||||
+{
|
||||
+ int (*Read)(void *object, unsigned char **buffer, UInt32 *bufferSize);
|
||||
+} ILzmaInCallback;
|
||||
+#endif
|
||||
+
|
||||
+#define LZMA_BASE_SIZE 1846
|
||||
+#define LZMA_LIT_SIZE 768
|
||||
+
|
||||
+/*
|
||||
+bufferSize = (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << (lc + lp)))* sizeof(CProb)
|
||||
+bufferSize += 100 in case of _LZMA_OUT_READ
|
||||
+by default CProb is unsigned short,
|
||||
+but if specify _LZMA_PROB_32, CProb will be UInt32(unsigned int)
|
||||
+*/
|
||||
+
|
||||
+#ifdef _LZMA_OUT_READ
|
||||
+int LzmaDecoderInit(
|
||||
+ unsigned char *buffer, UInt32 bufferSize,
|
||||
+ int lc, int lp, int pb,
|
||||
+ unsigned char *dictionary, UInt32 dictionarySize,
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ ILzmaInCallback *inCallback
|
||||
+ #else
|
||||
+ unsigned char *inStream, UInt32 inSize
|
||||
+ #endif
|
||||
+);
|
||||
+#endif
|
||||
+
|
||||
+int LzmaDecode(
|
||||
+ unsigned char *buffer,
|
||||
+ #ifndef _LZMA_OUT_READ
|
||||
+ UInt32 bufferSize,
|
||||
+ int lc, int lp, int pb,
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ ILzmaInCallback *inCallback,
|
||||
+ #else
|
||||
+ unsigned char *inStream, UInt32 inSize,
|
||||
+ #endif
|
||||
+ #endif
|
||||
+ unsigned char *outStream, UInt32 outSize,
|
||||
+ UInt32 *outSizeProcessed);
|
||||
+
|
||||
+#endif
|
||||
--- /dev/null
|
||||
+++ b/lib/LzmaDecode.c
|
||||
@@ -0,0 +1,663 @@
|
||||
+/*
|
||||
+ LzmaDecode.c
|
||||
+ LZMA Decoder
|
||||
+
|
||||
+ LZMA SDK 4.05 Copyright (c) 1999-2004 Igor Pavlov (2004-08-25)
|
||||
+ http://www.7-zip.org/
|
||||
+
|
||||
+ LZMA SDK is licensed under two licenses:
|
||||
+ 1) GNU Lesser General Public License (GNU LGPL)
|
||||
+ 2) Common Public License (CPL)
|
||||
+ It means that you can select one of these two licenses and
|
||||
+ follow rules of that license.
|
||||
+
|
||||
+ SPECIAL EXCEPTION:
|
||||
+ Igor Pavlov, as the author of this code, expressly permits you to
|
||||
+ statically or dynamically link your code (or bind by name) to the
|
||||
+ interfaces of this file without subjecting your linked code to the
|
||||
+ terms of the CPL or GNU LGPL. Any modifications or additions
|
||||
+ to this file, however, are subject to the LGPL or CPL terms.
|
||||
+*/
|
||||
+
|
||||
+#include <linux/LzmaDecode.h>
|
||||
+
|
||||
+#ifndef Byte
|
||||
+#define Byte unsigned char
|
||||
+#endif
|
||||
+
|
||||
+#define kNumTopBits 24
|
||||
+#define kTopValue ((UInt32)1 << kNumTopBits)
|
||||
+
|
||||
+#define kNumBitModelTotalBits 11
|
||||
+#define kBitModelTotal (1 << kNumBitModelTotalBits)
|
||||
+#define kNumMoveBits 5
|
||||
+
|
||||
+typedef struct _CRangeDecoder
|
||||
+{
|
||||
+ Byte *Buffer;
|
||||
+ Byte *BufferLim;
|
||||
+ UInt32 Range;
|
||||
+ UInt32 Code;
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ ILzmaInCallback *InCallback;
|
||||
+ int Result;
|
||||
+ #endif
|
||||
+ int ExtraBytes;
|
||||
+} CRangeDecoder;
|
||||
+
|
||||
+Byte RangeDecoderReadByte(CRangeDecoder *rd)
|
||||
+{
|
||||
+ if (rd->Buffer == rd->BufferLim)
|
||||
+ {
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ UInt32 size;
|
||||
+ rd->Result = rd->InCallback->Read(rd->InCallback, &rd->Buffer, &size);
|
||||
+ rd->BufferLim = rd->Buffer + size;
|
||||
+ if (size == 0)
|
||||
+ #endif
|
||||
+ {
|
||||
+ rd->ExtraBytes = 1;
|
||||
+ return 0xFF;
|
||||
+ }
|
||||
+ }
|
||||
+ return (*rd->Buffer++);
|
||||
+}
|
||||
+
|
||||
+/* #define ReadByte (*rd->Buffer++) */
|
||||
+#define ReadByte (RangeDecoderReadByte(rd))
|
||||
+
|
||||
+void RangeDecoderInit(CRangeDecoder *rd,
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ ILzmaInCallback *inCallback
|
||||
+ #else
|
||||
+ Byte *stream, UInt32 bufferSize
|
||||
+ #endif
|
||||
+ )
|
||||
+{
|
||||
+ int i;
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ rd->InCallback = inCallback;
|
||||
+ rd->Buffer = rd->BufferLim = 0;
|
||||
+ #else
|
||||
+ rd->Buffer = stream;
|
||||
+ rd->BufferLim = stream + bufferSize;
|
||||
+ #endif
|
||||
+ rd->ExtraBytes = 0;
|
||||
+ rd->Code = 0;
|
||||
+ rd->Range = (0xFFFFFFFF);
|
||||
+ for(i = 0; i < 5; i++)
|
||||
+ rd->Code = (rd->Code << 8) | ReadByte;
|
||||
+}
|
||||
+
|
||||
+#define RC_INIT_VAR UInt32 range = rd->Range; UInt32 code = rd->Code;
|
||||
+#define RC_FLUSH_VAR rd->Range = range; rd->Code = code;
|
||||
+#define RC_NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | ReadByte; }
|
||||
+
|
||||
+UInt32 RangeDecoderDecodeDirectBits(CRangeDecoder *rd, int numTotalBits)
|
||||
+{
|
||||
+ RC_INIT_VAR
|
||||
+ UInt32 result = 0;
|
||||
+ int i;
|
||||
+ for (i = numTotalBits; i > 0; i--)
|
||||
+ {
|
||||
+ /* UInt32 t; */
|
||||
+ range >>= 1;
|
||||
+
|
||||
+ result <<= 1;
|
||||
+ if (code >= range)
|
||||
+ {
|
||||
+ code -= range;
|
||||
+ result |= 1;
|
||||
+ }
|
||||
+ /*
|
||||
+ t = (code - range) >> 31;
|
||||
+ t &= 1;
|
||||
+ code -= range & (t - 1);
|
||||
+ result = (result + result) | (1 - t);
|
||||
+ */
|
||||
+ RC_NORMALIZE
|
||||
+ }
|
||||
+ RC_FLUSH_VAR
|
||||
+ return result;
|
||||
+}
|
||||
+
|
||||
+int RangeDecoderBitDecode(CProb *prob, CRangeDecoder *rd)
|
||||
+{
|
||||
+ UInt32 bound = (rd->Range >> kNumBitModelTotalBits) * *prob;
|
||||
+ if (rd->Code < bound)
|
||||
+ {
|
||||
+ rd->Range = bound;
|
||||
+ *prob += (kBitModelTotal - *prob) >> kNumMoveBits;
|
||||
+ if (rd->Range < kTopValue)
|
||||
+ {
|
||||
+ rd->Code = (rd->Code << 8) | ReadByte;
|
||||
+ rd->Range <<= 8;
|
||||
+ }
|
||||
+ return 0;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ rd->Range -= bound;
|
||||
+ rd->Code -= bound;
|
||||
+ *prob -= (*prob) >> kNumMoveBits;
|
||||
+ if (rd->Range < kTopValue)
|
||||
+ {
|
||||
+ rd->Code = (rd->Code << 8) | ReadByte;
|
||||
+ rd->Range <<= 8;
|
||||
+ }
|
||||
+ return 1;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+#define RC_GET_BIT2(prob, mi, A0, A1) \
|
||||
+ UInt32 bound = (range >> kNumBitModelTotalBits) * *prob; \
|
||||
+ if (code < bound) \
|
||||
+ { A0; range = bound; *prob += (kBitModelTotal - *prob) >> kNumMoveBits; mi <<= 1; } \
|
||||
+ else \
|
||||
+ { A1; range -= bound; code -= bound; *prob -= (*prob) >> kNumMoveBits; mi = (mi + mi) + 1; } \
|
||||
+ RC_NORMALIZE
|
||||
+
|
||||
+#define RC_GET_BIT(prob, mi) RC_GET_BIT2(prob, mi, ; , ;)
|
||||
+
|
||||
+int RangeDecoderBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)
|
||||
+{
|
||||
+ int mi = 1;
|
||||
+ int i;
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_INIT_VAR
|
||||
+ #endif
|
||||
+ for(i = numLevels; i > 0; i--)
|
||||
+ {
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ CProb *prob = probs + mi;
|
||||
+ RC_GET_BIT(prob, mi)
|
||||
+ #else
|
||||
+ mi = (mi + mi) + RangeDecoderBitDecode(probs + mi, rd);
|
||||
+ #endif
|
||||
+ }
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_FLUSH_VAR
|
||||
+ #endif
|
||||
+ return mi - (1 << numLevels);
|
||||
+}
|
||||
+
|
||||
+int RangeDecoderReverseBitTreeDecode(CProb *probs, int numLevels, CRangeDecoder *rd)
|
||||
+{
|
||||
+ int mi = 1;
|
||||
+ int i;
|
||||
+ int symbol = 0;
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_INIT_VAR
|
||||
+ #endif
|
||||
+ for(i = 0; i < numLevels; i++)
|
||||
+ {
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ CProb *prob = probs + mi;
|
||||
+ RC_GET_BIT2(prob, mi, ; , symbol |= (1 << i))
|
||||
+ #else
|
||||
+ int bit = RangeDecoderBitDecode(probs + mi, rd);
|
||||
+ mi = mi + mi + bit;
|
||||
+ symbol |= (bit << i);
|
||||
+ #endif
|
||||
+ }
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_FLUSH_VAR
|
||||
+ #endif
|
||||
+ return symbol;
|
||||
+}
|
||||
+
|
||||
+Byte LzmaLiteralDecode(CProb *probs, CRangeDecoder *rd)
|
||||
+{
|
||||
+ int symbol = 1;
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_INIT_VAR
|
||||
+ #endif
|
||||
+ do
|
||||
+ {
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ CProb *prob = probs + symbol;
|
||||
+ RC_GET_BIT(prob, symbol)
|
||||
+ #else
|
||||
+ symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd);
|
||||
+ #endif
|
||||
+ }
|
||||
+ while (symbol < 0x100);
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_FLUSH_VAR
|
||||
+ #endif
|
||||
+ return symbol;
|
||||
+}
|
||||
+
|
||||
+Byte LzmaLiteralDecodeMatch(CProb *probs, CRangeDecoder *rd, Byte matchByte)
|
||||
+{
|
||||
+ int symbol = 1;
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_INIT_VAR
|
||||
+ #endif
|
||||
+ do
|
||||
+ {
|
||||
+ int bit;
|
||||
+ int matchBit = (matchByte >> 7) & 1;
|
||||
+ matchByte <<= 1;
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ {
|
||||
+ CProb *prob = probs + ((1 + matchBit) << 8) + symbol;
|
||||
+ RC_GET_BIT2(prob, symbol, bit = 0, bit = 1)
|
||||
+ }
|
||||
+ #else
|
||||
+ bit = RangeDecoderBitDecode(probs + ((1 + matchBit) << 8) + symbol, rd);
|
||||
+ symbol = (symbol << 1) | bit;
|
||||
+ #endif
|
||||
+ if (matchBit != bit)
|
||||
+ {
|
||||
+ while (symbol < 0x100)
|
||||
+ {
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ CProb *prob = probs + symbol;
|
||||
+ RC_GET_BIT(prob, symbol)
|
||||
+ #else
|
||||
+ symbol = (symbol + symbol) | RangeDecoderBitDecode(probs + symbol, rd);
|
||||
+ #endif
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ while (symbol < 0x100);
|
||||
+ #ifdef _LZMA_LOC_OPT
|
||||
+ RC_FLUSH_VAR
|
||||
+ #endif
|
||||
+ return symbol;
|
||||
+}
|
||||
+
|
||||
+#define kNumPosBitsMax 4
|
||||
+#define kNumPosStatesMax (1 << kNumPosBitsMax)
|
||||
+
|
||||
+#define kLenNumLowBits 3
|
||||
+#define kLenNumLowSymbols (1 << kLenNumLowBits)
|
||||
+#define kLenNumMidBits 3
|
||||
+#define kLenNumMidSymbols (1 << kLenNumMidBits)
|
||||
+#define kLenNumHighBits 8
|
||||
+#define kLenNumHighSymbols (1 << kLenNumHighBits)
|
||||
+
|
||||
+#define LenChoice 0
|
||||
+#define LenChoice2 (LenChoice + 1)
|
||||
+#define LenLow (LenChoice2 + 1)
|
||||
+#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits))
|
||||
+#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits))
|
||||
+#define kNumLenProbs (LenHigh + kLenNumHighSymbols)
|
||||
+
|
||||
+int LzmaLenDecode(CProb *p, CRangeDecoder *rd, int posState)
|
||||
+{
|
||||
+ if(RangeDecoderBitDecode(p + LenChoice, rd) == 0)
|
||||
+ return RangeDecoderBitTreeDecode(p + LenLow +
|
||||
+ (posState << kLenNumLowBits), kLenNumLowBits, rd);
|
||||
+ if(RangeDecoderBitDecode(p + LenChoice2, rd) == 0)
|
||||
+ return kLenNumLowSymbols + RangeDecoderBitTreeDecode(p + LenMid +
|
||||
+ (posState << kLenNumMidBits), kLenNumMidBits, rd);
|
||||
+ return kLenNumLowSymbols + kLenNumMidSymbols +
|
||||
+ RangeDecoderBitTreeDecode(p + LenHigh, kLenNumHighBits, rd);
|
||||
+}
|
||||
+
|
||||
+#define kNumStates 12
|
||||
+
|
||||
+#define kStartPosModelIndex 4
|
||||
+#define kEndPosModelIndex 14
|
||||
+#define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
|
||||
+
|
||||
+#define kNumPosSlotBits 6
|
||||
+#define kNumLenToPosStates 4
|
||||
+
|
||||
+#define kNumAlignBits 4
|
||||
+#define kAlignTableSize (1 << kNumAlignBits)
|
||||
+
|
||||
+#define kMatchMinLen 2
|
||||
+
|
||||
+#define IsMatch 0
|
||||
+#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax))
|
||||
+#define IsRepG0 (IsRep + kNumStates)
|
||||
+#define IsRepG1 (IsRepG0 + kNumStates)
|
||||
+#define IsRepG2 (IsRepG1 + kNumStates)
|
||||
+#define IsRep0Long (IsRepG2 + kNumStates)
|
||||
+#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax))
|
||||
+#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits))
|
||||
+#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex)
|
||||
+#define LenCoder (Align + kAlignTableSize)
|
||||
+#define RepLenCoder (LenCoder + kNumLenProbs)
|
||||
+#define Literal (RepLenCoder + kNumLenProbs)
|
||||
+
|
||||
+#if Literal != LZMA_BASE_SIZE
|
||||
+StopCompilingDueBUG
|
||||
+#endif
|
||||
+
|
||||
+#ifdef _LZMA_OUT_READ
|
||||
+
|
||||
+typedef struct _LzmaVarState
|
||||
+{
|
||||
+ CRangeDecoder RangeDecoder;
|
||||
+ Byte *Dictionary;
|
||||
+ UInt32 DictionarySize;
|
||||
+ UInt32 DictionaryPos;
|
||||
+ UInt32 GlobalPos;
|
||||
+ UInt32 Reps[4];
|
||||
+ int lc;
|
||||
+ int lp;
|
||||
+ int pb;
|
||||
+ int State;
|
||||
+ int PreviousIsMatch;
|
||||
+ int RemainLen;
|
||||
+} LzmaVarState;
|
||||
+
|
||||
+int LzmaDecoderInit(
|
||||
+ unsigned char *buffer, UInt32 bufferSize,
|
||||
+ int lc, int lp, int pb,
|
||||
+ unsigned char *dictionary, UInt32 dictionarySize,
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ ILzmaInCallback *inCallback
|
||||
+ #else
|
||||
+ unsigned char *inStream, UInt32 inSize
|
||||
+ #endif
|
||||
+ )
|
||||
+{
|
||||
+ LzmaVarState *vs = (LzmaVarState *)buffer;
|
||||
+ CProb *p = (CProb *)(buffer + sizeof(LzmaVarState));
|
||||
+ UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + lp));
|
||||
+ UInt32 i;
|
||||
+ if (bufferSize < numProbs * sizeof(CProb) + sizeof(LzmaVarState))
|
||||
+ return LZMA_RESULT_NOT_ENOUGH_MEM;
|
||||
+ vs->Dictionary = dictionary;
|
||||
+ vs->DictionarySize = dictionarySize;
|
||||
+ vs->DictionaryPos = 0;
|
||||
+ vs->GlobalPos = 0;
|
||||
+ vs->Reps[0] = vs->Reps[1] = vs->Reps[2] = vs->Reps[3] = 1;
|
||||
+ vs->lc = lc;
|
||||
+ vs->lp = lp;
|
||||
+ vs->pb = pb;
|
||||
+ vs->State = 0;
|
||||
+ vs->PreviousIsMatch = 0;
|
||||
+ vs->RemainLen = 0;
|
||||
+ dictionary[dictionarySize - 1] = 0;
|
||||
+ for (i = 0; i < numProbs; i++)
|
||||
+ p[i] = kBitModelTotal >> 1;
|
||||
+ RangeDecoderInit(&vs->RangeDecoder,
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ inCallback
|
||||
+ #else
|
||||
+ inStream, inSize
|
||||
+ #endif
|
||||
+ );
|
||||
+ return LZMA_RESULT_OK;
|
||||
+}
|
||||
+
|
||||
+int LzmaDecode(unsigned char *buffer,
|
||||
+ unsigned char *outStream, UInt32 outSize,
|
||||
+ UInt32 *outSizeProcessed)
|
||||
+{
|
||||
+ LzmaVarState *vs = (LzmaVarState *)buffer;
|
||||
+ CProb *p = (CProb *)(buffer + sizeof(LzmaVarState));
|
||||
+ CRangeDecoder rd = vs->RangeDecoder;
|
||||
+ int state = vs->State;
|
||||
+ int previousIsMatch = vs->PreviousIsMatch;
|
||||
+ Byte previousByte;
|
||||
+ UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3];
|
||||
+ UInt32 nowPos = 0;
|
||||
+ UInt32 posStateMask = (1 << (vs->pb)) - 1;
|
||||
+ UInt32 literalPosMask = (1 << (vs->lp)) - 1;
|
||||
+ int lc = vs->lc;
|
||||
+ int len = vs->RemainLen;
|
||||
+ UInt32 globalPos = vs->GlobalPos;
|
||||
+
|
||||
+ Byte *dictionary = vs->Dictionary;
|
||||
+ UInt32 dictionarySize = vs->DictionarySize;
|
||||
+ UInt32 dictionaryPos = vs->DictionaryPos;
|
||||
+
|
||||
+ if (len == -1)
|
||||
+ {
|
||||
+ *outSizeProcessed = 0;
|
||||
+ return LZMA_RESULT_OK;
|
||||
+ }
|
||||
+
|
||||
+ while(len > 0 && nowPos < outSize)
|
||||
+ {
|
||||
+ UInt32 pos = dictionaryPos - rep0;
|
||||
+ if (pos >= dictionarySize)
|
||||
+ pos += dictionarySize;
|
||||
+ outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos];
|
||||
+ if (++dictionaryPos == dictionarySize)
|
||||
+ dictionaryPos = 0;
|
||||
+ len--;
|
||||
+ }
|
||||
+ if (dictionaryPos == 0)
|
||||
+ previousByte = dictionary[dictionarySize - 1];
|
||||
+ else
|
||||
+ previousByte = dictionary[dictionaryPos - 1];
|
||||
+#else
|
||||
+
|
||||
+int LzmaDecode(
|
||||
+ Byte *buffer, UInt32 bufferSize,
|
||||
+ int lc, int lp, int pb,
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ ILzmaInCallback *inCallback,
|
||||
+ #else
|
||||
+ unsigned char *inStream, UInt32 inSize,
|
||||
+ #endif
|
||||
+ unsigned char *outStream, UInt32 outSize,
|
||||
+ UInt32 *outSizeProcessed)
|
||||
+{
|
||||
+ UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + lp));
|
||||
+ CProb *p = (CProb *)buffer;
|
||||
+ CRangeDecoder rd;
|
||||
+ UInt32 i;
|
||||
+ int state = 0;
|
||||
+ int previousIsMatch = 0;
|
||||
+ Byte previousByte = 0;
|
||||
+ UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1;
|
||||
+ UInt32 nowPos = 0;
|
||||
+ UInt32 posStateMask = (1 << pb) - 1;
|
||||
+ UInt32 literalPosMask = (1 << lp) - 1;
|
||||
+ int len = 0;
|
||||
+ if (bufferSize < numProbs * sizeof(CProb))
|
||||
+ return LZMA_RESULT_NOT_ENOUGH_MEM;
|
||||
+ for (i = 0; i < numProbs; i++)
|
||||
+ p[i] = kBitModelTotal >> 1;
|
||||
+ RangeDecoderInit(&rd,
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ inCallback
|
||||
+ #else
|
||||
+ inStream, inSize
|
||||
+ #endif
|
||||
+ );
|
||||
+#endif
|
||||
+
|
||||
+ *outSizeProcessed = 0;
|
||||
+ while(nowPos < outSize)
|
||||
+ {
|
||||
+ int posState = (int)(
|
||||
+ (nowPos
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ + globalPos
|
||||
+ #endif
|
||||
+ )
|
||||
+ & posStateMask);
|
||||
+ #ifdef _LZMA_IN_CB
|
||||
+ if (rd.Result != LZMA_RESULT_OK)
|
||||
+ return rd.Result;
|
||||
+ #endif
|
||||
+ if (rd.ExtraBytes != 0)
|
||||
+ return LZMA_RESULT_DATA_ERROR;
|
||||
+ if (RangeDecoderBitDecode(p + IsMatch + (state << kNumPosBitsMax) + posState, &rd) == 0)
|
||||
+ {
|
||||
+ CProb *probs = p + Literal + (LZMA_LIT_SIZE *
|
||||
+ (((
|
||||
+ (nowPos
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ + globalPos
|
||||
+ #endif
|
||||
+ )
|
||||
+ & literalPosMask) << lc) + (previousByte >> (8 - lc))));
|
||||
+
|
||||
+ if (state < 4) state = 0;
|
||||
+ else if (state < 10) state -= 3;
|
||||
+ else state -= 6;
|
||||
+ if (previousIsMatch)
|
||||
+ {
|
||||
+ Byte matchByte;
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ UInt32 pos = dictionaryPos - rep0;
|
||||
+ if (pos >= dictionarySize)
|
||||
+ pos += dictionarySize;
|
||||
+ matchByte = dictionary[pos];
|
||||
+ #else
|
||||
+ matchByte = outStream[nowPos - rep0];
|
||||
+ #endif
|
||||
+ previousByte = LzmaLiteralDecodeMatch(probs, &rd, matchByte);
|
||||
+ previousIsMatch = 0;
|
||||
+ }
|
||||
+ else
|
||||
+ previousByte = LzmaLiteralDecode(probs, &rd);
|
||||
+ outStream[nowPos++] = previousByte;
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ dictionary[dictionaryPos] = previousByte;
|
||||
+ if (++dictionaryPos == dictionarySize)
|
||||
+ dictionaryPos = 0;
|
||||
+ #endif
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ previousIsMatch = 1;
|
||||
+ if (RangeDecoderBitDecode(p + IsRep + state, &rd) == 1)
|
||||
+ {
|
||||
+ if (RangeDecoderBitDecode(p + IsRepG0 + state, &rd) == 0)
|
||||
+ {
|
||||
+ if (RangeDecoderBitDecode(p + IsRep0Long + (state << kNumPosBitsMax) + posState, &rd) == 0)
|
||||
+ {
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ UInt32 pos;
|
||||
+ #endif
|
||||
+ if (
|
||||
+ (nowPos
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ + globalPos
|
||||
+ #endif
|
||||
+ )
|
||||
+ == 0)
|
||||
+ return LZMA_RESULT_DATA_ERROR;
|
||||
+ state = state < 7 ? 9 : 11;
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ pos = dictionaryPos - rep0;
|
||||
+ if (pos >= dictionarySize)
|
||||
+ pos += dictionarySize;
|
||||
+ previousByte = dictionary[pos];
|
||||
+ dictionary[dictionaryPos] = previousByte;
|
||||
+ if (++dictionaryPos == dictionarySize)
|
||||
+ dictionaryPos = 0;
|
||||
+ #else
|
||||
+ previousByte = outStream[nowPos - rep0];
|
||||
+ #endif
|
||||
+ outStream[nowPos++] = previousByte;
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ UInt32 distance;
|
||||
+ if(RangeDecoderBitDecode(p + IsRepG1 + state, &rd) == 0)
|
||||
+ distance = rep1;
|
||||
+ else
|
||||
+ {
|
||||
+ if(RangeDecoderBitDecode(p + IsRepG2 + state, &rd) == 0)
|
||||
+ distance = rep2;
|
||||
+ else
|
||||
+ {
|
||||
+ distance = rep3;
|
||||
+ rep3 = rep2;
|
||||
+ }
|
||||
+ rep2 = rep1;
|
||||
+ }
|
||||
+ rep1 = rep0;
|
||||
+ rep0 = distance;
|
||||
+ }
|
||||
+ len = LzmaLenDecode(p + RepLenCoder, &rd, posState);
|
||||
+ state = state < 7 ? 8 : 11;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ int posSlot;
|
||||
+ rep3 = rep2;
|
||||
+ rep2 = rep1;
|
||||
+ rep1 = rep0;
|
||||
+ state = state < 7 ? 7 : 10;
|
||||
+ len = LzmaLenDecode(p + LenCoder, &rd, posState);
|
||||
+ posSlot = RangeDecoderBitTreeDecode(p + PosSlot +
|
||||
+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) <<
|
||||
+ kNumPosSlotBits), kNumPosSlotBits, &rd);
|
||||
+ if (posSlot >= kStartPosModelIndex)
|
||||
+ {
|
||||
+ int numDirectBits = ((posSlot >> 1) - 1);
|
||||
+ rep0 = ((2 | ((UInt32)posSlot & 1)) << numDirectBits);
|
||||
+ if (posSlot < kEndPosModelIndex)
|
||||
+ {
|
||||
+ rep0 += RangeDecoderReverseBitTreeDecode(
|
||||
+ p + SpecPos + rep0 - posSlot - 1, numDirectBits, &rd);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ rep0 += RangeDecoderDecodeDirectBits(&rd,
|
||||
+ numDirectBits - kNumAlignBits) << kNumAlignBits;
|
||||
+ rep0 += RangeDecoderReverseBitTreeDecode(p + Align, kNumAlignBits, &rd);
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ rep0 = posSlot;
|
||||
+ rep0++;
|
||||
+ }
|
||||
+ if (rep0 == (UInt32)(0))
|
||||
+ {
|
||||
+ /* it's for stream version */
|
||||
+ len = -1;
|
||||
+ break;
|
||||
+ }
|
||||
+ if (rep0 > nowPos
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ + globalPos
|
||||
+ #endif
|
||||
+ )
|
||||
+ {
|
||||
+ return LZMA_RESULT_DATA_ERROR;
|
||||
+ }
|
||||
+ len += kMatchMinLen;
|
||||
+ do
|
||||
+ {
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ UInt32 pos = dictionaryPos - rep0;
|
||||
+ if (pos >= dictionarySize)
|
||||
+ pos += dictionarySize;
|
||||
+ previousByte = dictionary[pos];
|
||||
+ dictionary[dictionaryPos] = previousByte;
|
||||
+ if (++dictionaryPos == dictionarySize)
|
||||
+ dictionaryPos = 0;
|
||||
+ #else
|
||||
+ previousByte = outStream[nowPos - rep0];
|
||||
+ #endif
|
||||
+ outStream[nowPos++] = previousByte;
|
||||
+ len--;
|
||||
+ }
|
||||
+ while(len > 0 && nowPos < outSize);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ #ifdef _LZMA_OUT_READ
|
||||
+ vs->RangeDecoder = rd;
|
||||
+ vs->DictionaryPos = dictionaryPos;
|
||||
+ vs->GlobalPos = globalPos + nowPos;
|
||||
+ vs->Reps[0] = rep0;
|
||||
+ vs->Reps[1] = rep1;
|
||||
+ vs->Reps[2] = rep2;
|
||||
+ vs->Reps[3] = rep3;
|
||||
+ vs->State = state;
|
||||
+ vs->PreviousIsMatch = previousIsMatch;
|
||||
+ vs->RemainLen = len;
|
||||
+ #endif
|
||||
+
|
||||
+ *outSizeProcessed = nowPos;
|
||||
+ return LZMA_RESULT_OK;
|
||||
+}
|
||||
--- a/lib/Makefile
|
||||
+++ b/lib/Makefile
|
||||
@@ -14,7 +14,7 @@ lib-$(CONFIG_SMP) += cpumask.o
|
||||
lib-y += kobject.o kref.o klist.o
|
||||
|
||||
obj-y += div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \
|
||||
- bust_spinlocks.o hexdump.o kasprintf.o bitmap.o
|
||||
+ bust_spinlocks.o hexdump.o kasprintf.o bitmap.o LzmaDecode.o
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_KOBJECT),y)
|
||||
CFLAGS_kobject.o += -DDEBUG
|
||||
@@ -64,6 +64,7 @@ obj-$(CONFIG_SMP) += percpu_counter.o
|
||||
obj-$(CONFIG_AUDIT_GENERIC) += audit.o
|
||||
|
||||
obj-$(CONFIG_SWIOTLB) += swiotlb.o
|
||||
+
|
||||
obj-$(CONFIG_FAULT_INJECTION) += fault-inject.o
|
||||
|
||||
lib-$(CONFIG_GENERIC_BUG) += bug.o
|
|
@ -1,107 +0,0 @@
|
|||
--- a/fs/squashfs/inode.c
|
||||
+++ b/fs/squashfs/inode.c
|
||||
@@ -4,6 +4,9 @@
|
||||
* Copyright (c) 2002, 2003, 2004, 2005, 2006
|
||||
* Phillip Lougher <phillip@lougher.org.uk>
|
||||
*
|
||||
+ * LZMA decompressor support added by Oleg I. Vdovikin
|
||||
+ * Copyright (c) 2005 Oleg I.Vdovikin <oleg@cs.msu.su>
|
||||
+ *
|
||||
* 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,
|
||||
@@ -21,6 +24,7 @@
|
||||
* inode.c
|
||||
*/
|
||||
|
||||
+#define SQUASHFS_LZMA
|
||||
#include <linux/types.h>
|
||||
#include <linux/squashfs_fs.h>
|
||||
#include <linux/module.h>
|
||||
@@ -44,6 +48,19 @@
|
||||
|
||||
#include "squashfs.h"
|
||||
|
||||
+#ifdef SQUASHFS_LZMA
|
||||
+#include <linux/LzmaDecode.h>
|
||||
+
|
||||
+/* default LZMA settings, should be in sync with mksquashfs */
|
||||
+#define LZMA_LC 3
|
||||
+#define LZMA_LP 0
|
||||
+#define LZMA_PB 2
|
||||
+
|
||||
+#define LZMA_WORKSPACE_SIZE ((LZMA_BASE_SIZE + \
|
||||
+ (LZMA_LIT_SIZE << (LZMA_LC + LZMA_LP))) * sizeof(CProb))
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
static void squashfs_put_super(struct super_block *);
|
||||
static int squashfs_statfs(struct dentry *, struct kstatfs *);
|
||||
static int squashfs_symlink_readpage(struct file *file, struct page *page);
|
||||
@@ -64,7 +81,11 @@ static int squashfs_get_sb(struct file_s
|
||||
const char *, void *, struct vfsmount *);
|
||||
|
||||
|
||||
+#ifdef SQUASHFS_LZMA
|
||||
+static unsigned char lzma_workspace[LZMA_WORKSPACE_SIZE];
|
||||
+#else
|
||||
static z_stream stream;
|
||||
+#endif
|
||||
|
||||
static struct file_system_type squashfs_fs_type = {
|
||||
.owner = THIS_MODULE,
|
||||
@@ -249,6 +270,15 @@ SQSH_EXTERN unsigned int squashfs_read_d
|
||||
if (compressed) {
|
||||
int zlib_err;
|
||||
|
||||
+#ifdef SQUASHFS_LZMA
|
||||
+ if ((zlib_err = LzmaDecode(lzma_workspace,
|
||||
+ LZMA_WORKSPACE_SIZE, LZMA_LC, LZMA_LP, LZMA_PB,
|
||||
+ c_buffer, c_byte, buffer, msblk->read_size, &bytes)) != LZMA_RESULT_OK)
|
||||
+ {
|
||||
+ ERROR("lzma returned unexpected result 0x%x\n", zlib_err);
|
||||
+ bytes = 0;
|
||||
+ }
|
||||
+#else
|
||||
stream.next_in = c_buffer;
|
||||
stream.avail_in = c_byte;
|
||||
stream.next_out = buffer;
|
||||
@@ -263,7 +293,7 @@ SQSH_EXTERN unsigned int squashfs_read_d
|
||||
bytes = 0;
|
||||
} else
|
||||
bytes = stream.total_out;
|
||||
-
|
||||
+#endif
|
||||
up(&msblk->read_data_mutex);
|
||||
}
|
||||
|
||||
@@ -2045,15 +2075,19 @@ static int __init init_squashfs_fs(void)
|
||||
printk(KERN_INFO "squashfs: version 3.0 (2006/03/15) "
|
||||
"Phillip Lougher\n");
|
||||
|
||||
+#ifndef SQUASHFS_LZMA
|
||||
if (!(stream.workspace = vmalloc(zlib_inflate_workspacesize()))) {
|
||||
ERROR("Failed to allocate zlib workspace\n");
|
||||
destroy_inodecache();
|
||||
err = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
+#endif
|
||||
|
||||
if ((err = register_filesystem(&squashfs_fs_type))) {
|
||||
+#ifndef SQUASHFS_LZMA
|
||||
vfree(stream.workspace);
|
||||
+#endif
|
||||
destroy_inodecache();
|
||||
}
|
||||
|
||||
@@ -2064,7 +2098,9 @@ out:
|
||||
|
||||
static void __exit exit_squashfs_fs(void)
|
||||
{
|
||||
+#ifndef SQUASHFS_LZMA
|
||||
vfree(stream.workspace);
|
||||
+#endif
|
||||
unregister_filesystem(&squashfs_fs_type);
|
||||
destroy_inodecache();
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -527,6 +527,9 @@ KBUILD_CFLAGS += $(call cc-optio
|
||||
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
|
||||
CHECKFLAGS += $(NOSTDINC_FLAGS)
|
||||
|
||||
+# improve gcc optimization
|
||||
+CFLAGS += $(call cc-option,-funit-at-a-time,)
|
||||
+
|
||||
# warn about C99 declaration after statement
|
||||
KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
--- a/fs/squashfs/inode.c
|
||||
+++ b/fs/squashfs/inode.c
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <linux/fs.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/slab.h>
|
||||
+#include <linux/exportfs.h>
|
||||
#include <linux/squashfs_fs_sb.h>
|
||||
#include <linux/squashfs_fs_i.h>
|
||||
#include <linux/buffer_head.h>
|
||||
@@ -2125,7 +2126,7 @@ static void squashfs_destroy_inode(struc
|
||||
}
|
||||
|
||||
|
||||
-static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
|
||||
+static void init_once(struct kmem_cache * cachep, void *foo)
|
||||
{
|
||||
struct squashfs_inode_info *ei = foo;
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
--- a/include/asm-mips/system.h
|
||||
+++ b/include/asm-mips/system.h
|
||||
@@ -185,7 +185,7 @@ extern __u64 __xchg_u64_unsupported_on_3
|
||||
if something tries to do an invalid xchg(). */
|
||||
extern void __xchg_called_with_bad_pointer(void);
|
||||
|
||||
-static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
|
||||
+static __always_inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
|
||||
{
|
||||
switch (size) {
|
||||
case 4:
|
|
@ -1,36 +0,0 @@
|
|||
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
|
||||
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
|
||||
@@ -51,6 +51,7 @@
|
||||
#define SST49LF040B 0x0050
|
||||
#define SST49LF008A 0x005a
|
||||
#define AT49BV6416 0x00d6
|
||||
+#define MANUFACTURER_SAMSUNG 0x00ec
|
||||
|
||||
static int cfi_amdstd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
|
||||
static int cfi_amdstd_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
|
||||
@@ -294,12 +295,19 @@ struct mtd_info *cfi_cmdset_0002(struct
|
||||
|
||||
if (extp->MajorVersion != '1' ||
|
||||
(extp->MinorVersion < '0' || extp->MinorVersion > '4')) {
|
||||
- printk(KERN_ERR " Unknown Amd/Fujitsu Extended Query "
|
||||
- "version %c.%c.\n", extp->MajorVersion,
|
||||
- extp->MinorVersion);
|
||||
- kfree(extp);
|
||||
- kfree(mtd);
|
||||
- return NULL;
|
||||
+ if (cfi->mfr == MANUFACTURER_SAMSUNG &&
|
||||
+ (extp->MajorVersion == '3' && extp->MinorVersion == '3')) {
|
||||
+ printk(KERN_NOTICE " Newer Samsung flash detected, "
|
||||
+ "should be compatibile with Amd/Fujitsu.\n");
|
||||
+ }
|
||||
+ else {
|
||||
+ printk(KERN_ERR " Unknown Amd/Fujitsu Extended Query "
|
||||
+ "version %c.%c.\n", extp->MajorVersion,
|
||||
+ extp->MinorVersion);
|
||||
+ kfree(extp);
|
||||
+ kfree(mtd);
|
||||
+ return NULL;
|
||||
+ }
|
||||
}
|
||||
|
||||
/* Install our own private info structure */
|
|
@ -1,169 +0,0 @@
|
|||
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
|
||||
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
|
||||
@@ -944,7 +944,7 @@ static void __xipram xip_enable(struct m
|
||||
|
||||
static int __xipram xip_wait_for_operation(
|
||||
struct map_info *map, struct flchip *chip,
|
||||
- unsigned long adr, unsigned int chip_op_time )
|
||||
+ unsigned long adr, int *chip_op_time )
|
||||
{
|
||||
struct cfi_private *cfi = map->fldrv_priv;
|
||||
struct cfi_pri_intelext *cfip = cfi->cmdset_priv;
|
||||
@@ -953,7 +953,7 @@ static int __xipram xip_wait_for_operati
|
||||
flstate_t oldstate, newstate;
|
||||
|
||||
start = xip_currtime();
|
||||
- usec = chip_op_time * 8;
|
||||
+ usec = *chip_op_time * 8;
|
||||
if (usec == 0)
|
||||
usec = 500000;
|
||||
done = 0;
|
||||
@@ -1063,8 +1063,8 @@ static int __xipram xip_wait_for_operati
|
||||
#define XIP_INVAL_CACHED_RANGE(map, from, size) \
|
||||
INVALIDATE_CACHED_RANGE(map, from, size)
|
||||
|
||||
-#define INVAL_CACHE_AND_WAIT(map, chip, cmd_adr, inval_adr, inval_len, usec) \
|
||||
- xip_wait_for_operation(map, chip, cmd_adr, usec)
|
||||
+#define INVAL_CACHE_AND_WAIT(map, chip, cmd_adr, inval_adr, inval_len, p_usec) \
|
||||
+ xip_wait_for_operation(map, chip, cmd_adr, p_usec)
|
||||
|
||||
#else
|
||||
|
||||
@@ -1076,65 +1076,65 @@ static int __xipram xip_wait_for_operati
|
||||
static int inval_cache_and_wait_for_operation(
|
||||
struct map_info *map, struct flchip *chip,
|
||||
unsigned long cmd_adr, unsigned long inval_adr, int inval_len,
|
||||
- unsigned int chip_op_time)
|
||||
+ int *chip_op_time )
|
||||
{
|
||||
struct cfi_private *cfi = map->fldrv_priv;
|
||||
map_word status, status_OK = CMD(0x80);
|
||||
- int chip_state = chip->state;
|
||||
- unsigned int timeo, sleep_time;
|
||||
+ int z, chip_state = chip->state;
|
||||
+ unsigned long timeo;
|
||||
|
||||
spin_unlock(chip->mutex);
|
||||
if (inval_len)
|
||||
INVALIDATE_CACHED_RANGE(map, inval_adr, inval_len);
|
||||
+ if (*chip_op_time)
|
||||
+ cfi_udelay(*chip_op_time);
|
||||
spin_lock(chip->mutex);
|
||||
|
||||
- /* set our timeout to 8 times the expected delay */
|
||||
- timeo = chip_op_time * 8;
|
||||
- if (!timeo)
|
||||
- timeo = 500000;
|
||||
- sleep_time = chip_op_time / 2;
|
||||
+ timeo = *chip_op_time * 8 * HZ / 1000000;
|
||||
+ if (timeo < HZ/2)
|
||||
+ timeo = HZ/2;
|
||||
+ timeo += jiffies;
|
||||
|
||||
+ z = 0;
|
||||
for (;;) {
|
||||
+ if (chip->state != chip_state) {
|
||||
+ /* Someone's suspended the operation: sleep */
|
||||
+ DECLARE_WAITQUEUE(wait, current);
|
||||
+
|
||||
+ set_current_state(TASK_UNINTERRUPTIBLE);
|
||||
+ add_wait_queue(&chip->wq, &wait);
|
||||
+ spin_unlock(chip->mutex);
|
||||
+ schedule();
|
||||
+ remove_wait_queue(&chip->wq, &wait);
|
||||
+ timeo = jiffies + (HZ / 2); /* FIXME */
|
||||
+ spin_lock(chip->mutex);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
status = map_read(map, cmd_adr);
|
||||
if (map_word_andequal(map, status, status_OK, status_OK))
|
||||
break;
|
||||
|
||||
- if (!timeo) {
|
||||
+ /* OK Still waiting */
|
||||
+ if (time_after(jiffies, timeo)) {
|
||||
map_write(map, CMD(0x70), cmd_adr);
|
||||
chip->state = FL_STATUS;
|
||||
return -ETIME;
|
||||
}
|
||||
|
||||
- /* OK Still waiting. Drop the lock, wait a while and retry. */
|
||||
+ /* Latency issues. Drop the lock, wait a while and retry */
|
||||
+ z++;
|
||||
spin_unlock(chip->mutex);
|
||||
- if (sleep_time >= 1000000/HZ) {
|
||||
- /*
|
||||
- * Half of the normal delay still remaining
|
||||
- * can be performed with a sleeping delay instead
|
||||
- * of busy waiting.
|
||||
- */
|
||||
- msleep(sleep_time/1000);
|
||||
- timeo -= sleep_time;
|
||||
- sleep_time = 1000000/HZ;
|
||||
- } else {
|
||||
- udelay(1);
|
||||
- cond_resched();
|
||||
- timeo--;
|
||||
- }
|
||||
+ cfi_udelay(1);
|
||||
spin_lock(chip->mutex);
|
||||
-
|
||||
- while (chip->state != chip_state) {
|
||||
- /* Someone's suspended the operation: sleep */
|
||||
- DECLARE_WAITQUEUE(wait, current);
|
||||
- set_current_state(TASK_UNINTERRUPTIBLE);
|
||||
- add_wait_queue(&chip->wq, &wait);
|
||||
- spin_unlock(chip->mutex);
|
||||
- schedule();
|
||||
- remove_wait_queue(&chip->wq, &wait);
|
||||
- spin_lock(chip->mutex);
|
||||
- }
|
||||
}
|
||||
|
||||
+ if (!z) {
|
||||
+ if (!--(*chip_op_time))
|
||||
+ *chip_op_time = 1;
|
||||
+ } else if (z > 1)
|
||||
+ ++(*chip_op_time);
|
||||
+
|
||||
/* Done and happy. */
|
||||
chip->state = FL_STATUS;
|
||||
return 0;
|
||||
@@ -1143,7 +1143,8 @@ static int inval_cache_and_wait_for_oper
|
||||
#endif
|
||||
|
||||
#define WAIT_TIMEOUT(map, chip, adr, udelay) \
|
||||
- INVAL_CACHE_AND_WAIT(map, chip, adr, 0, 0, udelay);
|
||||
+ ({ int __udelay = (udelay); \
|
||||
+ INVAL_CACHE_AND_WAIT(map, chip, adr, 0, 0, &__udelay); })
|
||||
|
||||
|
||||
static int do_point_onechip (struct map_info *map, struct flchip *chip, loff_t adr, size_t len)
|
||||
@@ -1374,7 +1375,7 @@ static int __xipram do_write_oneword(str
|
||||
|
||||
ret = INVAL_CACHE_AND_WAIT(map, chip, adr,
|
||||
adr, map_bankwidth(map),
|
||||
- chip->word_write_time);
|
||||
+ &chip->word_write_time);
|
||||
if (ret) {
|
||||
xip_enable(map, chip, adr);
|
||||
printk(KERN_ERR "%s: word write error (status timeout)\n", map->name);
|
||||
@@ -1614,7 +1615,7 @@ static int __xipram do_write_buffer(stru
|
||||
|
||||
ret = INVAL_CACHE_AND_WAIT(map, chip, cmd_adr,
|
||||
initial_adr, initial_len,
|
||||
- chip->buffer_write_time);
|
||||
+ &chip->buffer_write_time);
|
||||
if (ret) {
|
||||
map_write(map, CMD(0x70), cmd_adr);
|
||||
chip->state = FL_STATUS;
|
||||
@@ -1749,7 +1750,7 @@ static int __xipram do_erase_oneblock(st
|
||||
|
||||
ret = INVAL_CACHE_AND_WAIT(map, chip, adr,
|
||||
adr, len,
|
||||
- chip->erase_time);
|
||||
+ &chip->erase_time);
|
||||
if (ret) {
|
||||
map_write(map, CMD(0x70), adr);
|
||||
chip->state = FL_STATUS;
|
|
@ -1,19 +0,0 @@
|
|||
--- a/fs/squashfs/Makefile
|
||||
+++ b/fs/squashfs/Makefile
|
||||
@@ -4,4 +4,3 @@
|
||||
|
||||
obj-$(CONFIG_SQUASHFS) += squashfs.o
|
||||
squashfs-y += inode.o
|
||||
-squashfs-y += squashfs2_0.o
|
||||
--- a/fs/squashfs/squashfs.h
|
||||
+++ b/fs/squashfs/squashfs.h
|
||||
@@ -24,6 +24,9 @@
|
||||
#ifdef CONFIG_SQUASHFS_1_0_COMPATIBILITY
|
||||
#undef CONFIG_SQUASHFS_1_0_COMPATIBILITY
|
||||
#endif
|
||||
+#ifdef CONFIG_SQUASHFS_2_0_COMPATIBILITY
|
||||
+#undef CONFIG_SQUASHFS_2_0_COMPATIBILITY
|
||||
+#endif
|
||||
|
||||
#ifdef SQUASHFS_TRACE
|
||||
#define TRACE(s, args...) printk(KERN_NOTICE "SQUASHFS: "s, ## args)
|
|
@ -1,11 +0,0 @@
|
|||
--- a/arch/mips/kernel/head.S
|
||||
+++ b/arch/mips/kernel/head.S
|
||||
@@ -120,6 +120,8 @@
|
||||
#endif
|
||||
.endm
|
||||
|
||||
+ j kernel_entry
|
||||
+ nop
|
||||
#ifndef CONFIG_NO_EXCEPT_FILL
|
||||
/*
|
||||
* Reserved space for exception handlers.
|
|
@ -1,18 +0,0 @@
|
|||
--- a/arch/mips/mm/tlbex.c
|
||||
+++ b/arch/mips/mm/tlbex.c
|
||||
@@ -902,7 +902,6 @@ static __init void build_tlb_write_entry
|
||||
case CPU_R10000:
|
||||
case CPU_R12000:
|
||||
case CPU_R14000:
|
||||
- case CPU_4KC:
|
||||
case CPU_SB1:
|
||||
case CPU_SB1A:
|
||||
case CPU_4KSC:
|
||||
@@ -935,6 +934,7 @@ static __init void build_tlb_write_entry
|
||||
tlbw(p);
|
||||
break;
|
||||
|
||||
+ case CPU_4KC:
|
||||
case CPU_4KEC:
|
||||
case CPU_24K:
|
||||
case CPU_34K:
|
|
@ -1,18 +0,0 @@
|
|||
--- a/arch/mips/kernel/gdb-stub.c
|
||||
+++ b/arch/mips/kernel/gdb-stub.c
|
||||
@@ -656,6 +656,7 @@ void set_async_breakpoint(unsigned long
|
||||
*epc = (unsigned long)async_breakpoint;
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_SMP
|
||||
static void kgdb_wait(void *arg)
|
||||
{
|
||||
unsigned flags;
|
||||
@@ -668,6 +669,7 @@ static void kgdb_wait(void *arg)
|
||||
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* GDB stub needs to call kgdb_wait on all processor with interrupts
|
|
@ -1,112 +0,0 @@
|
|||
--- a/drivers/mtd/devices/block2mtd.c
|
||||
+++ b/drivers/mtd/devices/block2mtd.c
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <linux/list.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/mtd/mtd.h>
|
||||
+#include <linux/mtd/partitions.h>
|
||||
#include <linux/buffer_head.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/mount.h>
|
||||
@@ -237,10 +238,11 @@ static void block2mtd_free_device(struct
|
||||
|
||||
|
||||
/* FIXME: ensure that mtd->size % erase_size == 0 */
|
||||
-static struct block2mtd_dev *add_device(char *devname, int erase_size)
|
||||
+static struct block2mtd_dev *add_device(char *devname, int erase_size, char *mtdname)
|
||||
{
|
||||
struct block_device *bdev;
|
||||
struct block2mtd_dev *dev;
|
||||
+ struct mtd_partition *part;
|
||||
|
||||
if (!devname)
|
||||
return NULL;
|
||||
@@ -279,14 +281,18 @@ static struct block2mtd_dev *add_device(
|
||||
|
||||
/* Setup the MTD structure */
|
||||
/* make the name contain the block device in */
|
||||
- dev->mtd.name = kmalloc(sizeof("block2mtd: ") + strlen(devname),
|
||||
- GFP_KERNEL);
|
||||
+
|
||||
+ if (!mtdname)
|
||||
+ mtdname = devname;
|
||||
+
|
||||
+ dev->mtd.name = kmalloc(strlen(mtdname) + 1, GFP_KERNEL);
|
||||
+
|
||||
if (!dev->mtd.name)
|
||||
goto devinit_err;
|
||||
+
|
||||
+ strcpy(dev->mtd.name, mtdname);
|
||||
|
||||
- sprintf(dev->mtd.name, "block2mtd: %s", devname);
|
||||
-
|
||||
- dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK;
|
||||
+ dev->mtd.size = dev->blkdev->bd_inode->i_size & PAGE_MASK & ~(erase_size - 1);
|
||||
dev->mtd.erasesize = erase_size;
|
||||
dev->mtd.writesize = 1;
|
||||
dev->mtd.type = MTD_RAM;
|
||||
@@ -298,15 +304,18 @@ static struct block2mtd_dev *add_device(
|
||||
dev->mtd.read = block2mtd_read;
|
||||
dev->mtd.priv = dev;
|
||||
dev->mtd.owner = THIS_MODULE;
|
||||
-
|
||||
- if (add_mtd_device(&dev->mtd)) {
|
||||
+
|
||||
+ part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL);
|
||||
+ part->name = dev->mtd.name;
|
||||
+ part->offset = 0;
|
||||
+ part->size = dev->mtd.size;
|
||||
+ if (add_mtd_partitions(&dev->mtd, part, 1)) {
|
||||
/* Device didnt get added, so free the entry */
|
||||
goto devinit_err;
|
||||
}
|
||||
list_add(&dev->list, &blkmtd_device_list);
|
||||
INFO("mtd%d: [%s] erase_size = %dKiB [%d]", dev->mtd.index,
|
||||
- dev->mtd.name + strlen("blkmtd: "),
|
||||
- dev->mtd.erasesize >> 10, dev->mtd.erasesize);
|
||||
+ mtdname, dev->mtd.erasesize >> 10, dev->mtd.erasesize);
|
||||
return dev;
|
||||
|
||||
devinit_err:
|
||||
@@ -379,9 +388,9 @@ static char block2mtd_paramline[80 + 12]
|
||||
|
||||
static int block2mtd_setup2(const char *val)
|
||||
{
|
||||
- char buf[80 + 12]; /* 80 for device, 12 for erase size */
|
||||
+ char buf[80 + 12 + 80]; /* 80 for device, 12 for erase size, 80 for name */
|
||||
char *str = buf;
|
||||
- char *token[2];
|
||||
+ char *token[3];
|
||||
char *name;
|
||||
size_t erase_size = PAGE_SIZE;
|
||||
int i, ret;
|
||||
@@ -392,7 +401,7 @@ static int block2mtd_setup2(const char *
|
||||
strcpy(str, val);
|
||||
kill_final_newline(str);
|
||||
|
||||
- for (i = 0; i < 2; i++)
|
||||
+ for (i = 0; i < 3; i++)
|
||||
token[i] = strsep(&str, ",");
|
||||
|
||||
if (str)
|
||||
@@ -411,8 +420,10 @@ static int block2mtd_setup2(const char *
|
||||
parse_err("illegal erase size");
|
||||
}
|
||||
}
|
||||
+ if (token[2] && (strlen(token[2]) + 1 > 80))
|
||||
+ parse_err("mtd device name too long");
|
||||
|
||||
- add_device(name, erase_size);
|
||||
+ add_device(name, erase_size, token[2]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -446,7 +457,7 @@ static int block2mtd_setup(const char *v
|
||||
|
||||
|
||||
module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200);
|
||||
-MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=<dev>[,<erasesize>]\"");
|
||||
+MODULE_PARM_DESC(block2mtd, "Device to use. \"block2mtd=<dev>[,<erasesize>[,<name>]]\"");
|
||||
|
||||
static int __init block2mtd_init(void)
|
||||
{
|
|
@ -1,944 +0,0 @@
|
|||
--- a/drivers/mtd/Kconfig
|
||||
+++ b/drivers/mtd/Kconfig
|
||||
@@ -47,6 +47,16 @@ config MTD_PARTITIONS
|
||||
devices. Partitioning on NFTL 'devices' is a different - that's the
|
||||
'normal' form of partitioning used on a block device.
|
||||
|
||||
+config MTD_ROOTFS_ROOT_DEV
|
||||
+ bool "Automatically set 'rootfs' partition to be root filesystem"
|
||||
+ depends on MTD_PARTITIONS
|
||||
+ default y
|
||||
+
|
||||
+config MTD_ROOTFS_SPLIT
|
||||
+ bool "Automatically split 'rootfs' partition for squashfs"
|
||||
+ depends on MTD_PARTITIONS
|
||||
+ default y
|
||||
+
|
||||
config MTD_REDBOOT_PARTS
|
||||
tristate "RedBoot partition table parsing"
|
||||
depends on MTD_PARTITIONS
|
||||
--- a/drivers/mtd/mtdpart.c
|
||||
+++ b/drivers/mtd/mtdpart.c
|
||||
@@ -20,6 +20,8 @@
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/mtd/compatmac.h>
|
||||
+#include <linux/squashfs_fs.h>
|
||||
+#include <linux/root_dev.h>
|
||||
|
||||
/* Our partition linked list */
|
||||
static LIST_HEAD(mtd_partitions);
|
||||
@@ -39,7 +41,7 @@ struct mtd_part {
|
||||
* the pointer to that structure with this macro.
|
||||
*/
|
||||
#define PART(x) ((struct mtd_part *)(x))
|
||||
-
|
||||
+#define IS_PART(mtd) (mtd->read == part_read)
|
||||
|
||||
/*
|
||||
* MTD methods which simply translate the effective address and pass through
|
||||
@@ -308,6 +310,312 @@ int del_mtd_partitions(struct mtd_info *
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static u_int32_t cur_offset = 0;
|
||||
+static int add_one_partition(struct mtd_info *master, const struct mtd_partition *part,
|
||||
+ int i, struct mtd_part **slp)
|
||||
+{
|
||||
+ struct mtd_part *slave;
|
||||
+
|
||||
+ /* allocate the partition structure */
|
||||
+ slave = kzalloc (sizeof(*slave), GFP_KERNEL);
|
||||
+ if (!slave) {
|
||||
+ printk ("memory allocation error while creating partitions for \"%s\"\n",
|
||||
+ master->name);
|
||||
+ del_mtd_partitions(master);
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+ list_add(&slave->list, &mtd_partitions);
|
||||
+
|
||||
+ /* set up the MTD object for this partition */
|
||||
+ slave->mtd.type = master->type;
|
||||
+ slave->mtd.flags = master->flags & ~part->mask_flags;
|
||||
+ slave->mtd.size = part->size;
|
||||
+ slave->mtd.writesize = master->writesize;
|
||||
+ slave->mtd.oobsize = master->oobsize;
|
||||
+ slave->mtd.oobavail = master->oobavail;
|
||||
+ slave->mtd.subpage_sft = master->subpage_sft;
|
||||
+
|
||||
+ slave->mtd.name = part->name;
|
||||
+ slave->mtd.owner = master->owner;
|
||||
+
|
||||
+ slave->mtd.read = part_read;
|
||||
+ slave->mtd.write = part_write;
|
||||
+ slave->mtd.refresh_device = part->refresh_partition;
|
||||
+
|
||||
+ if(master->point && master->unpoint){
|
||||
+ slave->mtd.point = part_point;
|
||||
+ slave->mtd.unpoint = part_unpoint;
|
||||
+ }
|
||||
+
|
||||
+ if (master->read_oob)
|
||||
+ slave->mtd.read_oob = part_read_oob;
|
||||
+ if (master->write_oob)
|
||||
+ slave->mtd.write_oob = part_write_oob;
|
||||
+ if(master->read_user_prot_reg)
|
||||
+ slave->mtd.read_user_prot_reg = part_read_user_prot_reg;
|
||||
+ if(master->read_fact_prot_reg)
|
||||
+ slave->mtd.read_fact_prot_reg = part_read_fact_prot_reg;
|
||||
+ if(master->write_user_prot_reg)
|
||||
+ slave->mtd.write_user_prot_reg = part_write_user_prot_reg;
|
||||
+ if(master->lock_user_prot_reg)
|
||||
+ slave->mtd.lock_user_prot_reg = part_lock_user_prot_reg;
|
||||
+ if(master->get_user_prot_info)
|
||||
+ slave->mtd.get_user_prot_info = part_get_user_prot_info;
|
||||
+ if(master->get_fact_prot_info)
|
||||
+ slave->mtd.get_fact_prot_info = part_get_fact_prot_info;
|
||||
+ if (master->sync)
|
||||
+ slave->mtd.sync = part_sync;
|
||||
+ if (!i && master->suspend && master->resume) {
|
||||
+ slave->mtd.suspend = part_suspend;
|
||||
+ slave->mtd.resume = part_resume;
|
||||
+ }
|
||||
+ if (master->writev)
|
||||
+ slave->mtd.writev = part_writev;
|
||||
+ if (master->lock)
|
||||
+ slave->mtd.lock = part_lock;
|
||||
+ if (master->unlock)
|
||||
+ slave->mtd.unlock = part_unlock;
|
||||
+ if (master->block_isbad)
|
||||
+ slave->mtd.block_isbad = part_block_isbad;
|
||||
+ if (master->block_markbad)
|
||||
+ slave->mtd.block_markbad = part_block_markbad;
|
||||
+ slave->mtd.erase = part_erase;
|
||||
+ slave->master = master;
|
||||
+ slave->offset = part->offset;
|
||||
+ slave->index = i;
|
||||
+
|
||||
+ if (slave->offset == MTDPART_OFS_APPEND)
|
||||
+ slave->offset = cur_offset;
|
||||
+ if (slave->offset == MTDPART_OFS_NXTBLK) {
|
||||
+ slave->offset = cur_offset;
|
||||
+ if ((cur_offset % master->erasesize) != 0) {
|
||||
+ /* Round up to next erasesize */
|
||||
+ slave->offset = ((cur_offset / master->erasesize) + 1) * master->erasesize;
|
||||
+ printk(KERN_NOTICE "Moving partition %d: "
|
||||
+ "0x%08x -> 0x%08x\n", i,
|
||||
+ cur_offset, slave->offset);
|
||||
+ }
|
||||
+ }
|
||||
+ if (slave->mtd.size == MTDPART_SIZ_FULL)
|
||||
+ slave->mtd.size = master->size - slave->offset;
|
||||
+ cur_offset = slave->offset + slave->mtd.size;
|
||||
+
|
||||
+ printk (KERN_NOTICE "0x%08x-0x%08x : \"%s\"\n", slave->offset,
|
||||
+ slave->offset + slave->mtd.size, slave->mtd.name);
|
||||
+
|
||||
+ /* let's do some sanity checks */
|
||||
+ if (slave->offset >= master->size) {
|
||||
+ /* let's register it anyway to preserve ordering */
|
||||
+ slave->offset = 0;
|
||||
+ slave->mtd.size = 0;
|
||||
+ printk ("mtd: partition \"%s\" is out of reach -- disabled\n",
|
||||
+ part->name);
|
||||
+ }
|
||||
+ if (slave->offset + slave->mtd.size > master->size) {
|
||||
+ slave->mtd.size = master->size - slave->offset;
|
||||
+ printk ("mtd: partition \"%s\" extends beyond the end of device \"%s\" -- size truncated to %#x\n",
|
||||
+ part->name, master->name, slave->mtd.size);
|
||||
+ }
|
||||
+ if (master->numeraseregions>1) {
|
||||
+ /* Deal with variable erase size stuff */
|
||||
+ int i;
|
||||
+ struct mtd_erase_region_info *regions = master->eraseregions;
|
||||
+
|
||||
+ /* Find the first erase regions which is part of this partition. */
|
||||
+ for (i=0; i < master->numeraseregions && slave->offset >= regions[i].offset; i++)
|
||||
+ ;
|
||||
+
|
||||
+ for (i--; i < master->numeraseregions && slave->offset + slave->mtd.size > regions[i].offset; i++) {
|
||||
+ if (slave->mtd.erasesize < regions[i].erasesize) {
|
||||
+ slave->mtd.erasesize = regions[i].erasesize;
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ /* Single erase size */
|
||||
+ slave->mtd.erasesize = master->erasesize;
|
||||
+ }
|
||||
+
|
||||
+ if ((slave->mtd.flags & MTD_WRITEABLE) &&
|
||||
+ (slave->offset % slave->mtd.erasesize)) {
|
||||
+ /* Doesn't start on a boundary of major erase size */
|
||||
+ /* FIXME: Let it be writable if it is on a boundary of _minor_ erase size though */
|
||||
+ slave->mtd.flags &= ~MTD_WRITEABLE;
|
||||
+ printk ("mtd: partition \"%s\" doesn't start on an erase block boundary -- force read-only\n",
|
||||
+ part->name);
|
||||
+ }
|
||||
+ if ((slave->mtd.flags & MTD_WRITEABLE) &&
|
||||
+ (slave->mtd.size % slave->mtd.erasesize)) {
|
||||
+ slave->mtd.flags &= ~MTD_WRITEABLE;
|
||||
+ printk ("mtd: partition \"%s\" doesn't end on an erase block -- force read-only\n",
|
||||
+ part->name);
|
||||
+ }
|
||||
+
|
||||
+ slave->mtd.ecclayout = master->ecclayout;
|
||||
+ if (master->block_isbad) {
|
||||
+ uint32_t offs = 0;
|
||||
+
|
||||
+ while(offs < slave->mtd.size) {
|
||||
+ if (master->block_isbad(master,
|
||||
+ offs + slave->offset))
|
||||
+ slave->mtd.ecc_stats.badblocks++;
|
||||
+ offs += slave->mtd.erasesize;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if(part->mtdp)
|
||||
+ { /* store the object pointer (caller may or may not register it */
|
||||
+ *part->mtdp = &slave->mtd;
|
||||
+ slave->registered = 0;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /* register our partition */
|
||||
+ add_mtd_device(&slave->mtd);
|
||||
+ slave->registered = 1;
|
||||
+ }
|
||||
+
|
||||
+ if (slp)
|
||||
+ *slp = slave;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#ifdef CONFIG_MTD_ROOTFS_SPLIT
|
||||
+#define ROOTFS_SPLIT_NAME "rootfs_data"
|
||||
+#define ROOTFS_REMOVED_NAME "<removed>"
|
||||
+static int split_squashfs(struct mtd_info *master, int offset, int *split_offset)
|
||||
+{
|
||||
+ char buf[512];
|
||||
+ struct squashfs_super_block *sb = (struct squashfs_super_block *) buf;
|
||||
+ int len, ret;
|
||||
+
|
||||
+ ret = master->read(master, offset, sizeof(*sb), &len, buf);
|
||||
+ if (ret || (len != sizeof(*sb))) {
|
||||
+ printk(KERN_ALERT "split_squashfs: error occured while reading "
|
||||
+ "from \"%s\"\n", master->name);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ if (*((u32 *) buf) != SQUASHFS_MAGIC) {
|
||||
+ printk(KERN_ALERT "split_squashfs: no squashfs found in \"%s\"\n",
|
||||
+ master->name);
|
||||
+ *split_offset = 0;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (sb->bytes_used <= 0) {
|
||||
+ printk(KERN_ALERT "split_squashfs: squashfs is empty in \"%s\"\n",
|
||||
+ master->name);
|
||||
+ *split_offset = 0;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ len = (u32) sb->bytes_used;
|
||||
+ len += (offset & 0x000fffff);
|
||||
+ len += (master->erasesize - 1);
|
||||
+ len &= ~(master->erasesize - 1);
|
||||
+ len -= (offset & 0x000fffff);
|
||||
+ *split_offset = offset + len;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int split_rootfs_data(struct mtd_info *master, struct mtd_info *rpart, struct mtd_partition *part,
|
||||
+ int index)
|
||||
+{
|
||||
+ struct mtd_partition *dpart;
|
||||
+ struct mtd_part *slave = NULL;
|
||||
+ int split_offset = 0;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = split_squashfs(master, part->offset, &split_offset);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ if (split_offset <= 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ dpart = kmalloc(sizeof(*part)+sizeof(ROOTFS_SPLIT_NAME)+1, GFP_KERNEL);
|
||||
+ if (dpart == NULL) {
|
||||
+ printk(KERN_INFO "split_squashfs: no memory for partition \"%s\"\n",
|
||||
+ ROOTFS_SPLIT_NAME);
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ memcpy(dpart, part, sizeof(*part));
|
||||
+ dpart->name = (unsigned char *)&dpart[1];
|
||||
+ strcpy(dpart->name, ROOTFS_SPLIT_NAME);
|
||||
+
|
||||
+ dpart->size -= split_offset - dpart->offset;
|
||||
+ dpart->offset = split_offset;
|
||||
+
|
||||
+ if (dpart == NULL)
|
||||
+ return 1;
|
||||
+
|
||||
+ printk(KERN_INFO "mtd: partition \"%s\" created automatically, ofs=%X, len=%X \n",
|
||||
+ ROOTFS_SPLIT_NAME, dpart->offset, dpart->size);
|
||||
+
|
||||
+ ret = add_one_partition(master, dpart, index, &slave);
|
||||
+ if (ret)
|
||||
+ kfree(dpart);
|
||||
+ else if (slave)
|
||||
+ rpart->split = &slave->mtd;
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int refresh_rootfs_split(struct mtd_info *mtd)
|
||||
+{
|
||||
+ struct mtd_partition tpart;
|
||||
+ struct mtd_part *part;
|
||||
+ int index = 0;
|
||||
+ int offset, size;
|
||||
+ int ret;
|
||||
+
|
||||
+ part = PART(mtd);
|
||||
+
|
||||
+ /* check for the new squashfs offset first */
|
||||
+ ret = split_squashfs(part->master, part->offset, &offset);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ if ((offset > 0) && !mtd->split) {
|
||||
+ printk(KERN_INFO "%s: creating new split partition for \"%s\"\n", __func__, mtd->name);
|
||||
+ /* if we don't have a rootfs split partition, create a new one */
|
||||
+ tpart.name = mtd->name;
|
||||
+ tpart.size = mtd->size;
|
||||
+ tpart.offset = part->offset;
|
||||
+
|
||||
+ /* find the index of the last partition */
|
||||
+ if (!list_empty(&mtd_partitions))
|
||||
+ index = list_first_entry(&mtd_partitions, struct mtd_part, list)->index + 1;
|
||||
+
|
||||
+ return split_rootfs_data(part->master, &part->mtd, &tpart, index);
|
||||
+ } else if ((offset > 0) && mtd->split) {
|
||||
+ /* update the offsets of the existing partition */
|
||||
+ size = mtd->size + part->offset - offset;
|
||||
+
|
||||
+ part = PART(mtd->split);
|
||||
+ part->offset = offset;
|
||||
+ part->mtd.size = size;
|
||||
+ printk(KERN_INFO "%s: %s partition \"" ROOTFS_SPLIT_NAME "\", offset: 0x%06x (0x%06x)\n",
|
||||
+ __func__, (!strcmp(part->mtd.name, ROOTFS_SPLIT_NAME) ? "updating" : "creating"),
|
||||
+ part->offset, part->mtd.size);
|
||||
+ strcpy(part->mtd.name, ROOTFS_SPLIT_NAME);
|
||||
+ } else if ((offset <= 0) && mtd->split) {
|
||||
+ printk(KERN_INFO "%s: removing partition \"%s\"\n", __func__, mtd->split->name);
|
||||
+
|
||||
+ /* mark existing partition as removed */
|
||||
+ part = PART(mtd->split);
|
||||
+ strcpy(part->mtd.name, ROOTFS_REMOVED_NAME);
|
||||
+ part->offset = 0;
|
||||
+ part->mtd.size = 0;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+#endif /* CONFIG_MTD_ROOTFS_SPLIT */
|
||||
+
|
||||
/*
|
||||
* This function, given a master MTD object and a partition table, creates
|
||||
* and registers slave MTD objects which are bound to the master according to
|
||||
@@ -320,168 +628,31 @@ int add_mtd_partitions(struct mtd_info *
|
||||
int nbparts)
|
||||
{
|
||||
struct mtd_part *slave;
|
||||
- u_int32_t cur_offset = 0;
|
||||
- int i;
|
||||
+ struct mtd_partition *part;
|
||||
+ int i, j, ret = 0;
|
||||
|
||||
printk (KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name);
|
||||
|
||||
- for (i = 0; i < nbparts; i++) {
|
||||
-
|
||||
- /* allocate the partition structure */
|
||||
- slave = kzalloc (sizeof(*slave), GFP_KERNEL);
|
||||
- if (!slave) {
|
||||
- printk ("memory allocation error while creating partitions for \"%s\"\n",
|
||||
- master->name);
|
||||
- del_mtd_partitions(master);
|
||||
- return -ENOMEM;
|
||||
- }
|
||||
- list_add(&slave->list, &mtd_partitions);
|
||||
-
|
||||
- /* set up the MTD object for this partition */
|
||||
- slave->mtd.type = master->type;
|
||||
- slave->mtd.flags = master->flags & ~parts[i].mask_flags;
|
||||
- slave->mtd.size = parts[i].size;
|
||||
- slave->mtd.writesize = master->writesize;
|
||||
- slave->mtd.oobsize = master->oobsize;
|
||||
- slave->mtd.oobavail = master->oobavail;
|
||||
- slave->mtd.subpage_sft = master->subpage_sft;
|
||||
-
|
||||
- slave->mtd.name = parts[i].name;
|
||||
- slave->mtd.owner = master->owner;
|
||||
-
|
||||
- slave->mtd.read = part_read;
|
||||
- slave->mtd.write = part_write;
|
||||
-
|
||||
- if(master->point && master->unpoint){
|
||||
- slave->mtd.point = part_point;
|
||||
- slave->mtd.unpoint = part_unpoint;
|
||||
- }
|
||||
-
|
||||
- if (master->read_oob)
|
||||
- slave->mtd.read_oob = part_read_oob;
|
||||
- if (master->write_oob)
|
||||
- slave->mtd.write_oob = part_write_oob;
|
||||
- if(master->read_user_prot_reg)
|
||||
- slave->mtd.read_user_prot_reg = part_read_user_prot_reg;
|
||||
- if(master->read_fact_prot_reg)
|
||||
- slave->mtd.read_fact_prot_reg = part_read_fact_prot_reg;
|
||||
- if(master->write_user_prot_reg)
|
||||
- slave->mtd.write_user_prot_reg = part_write_user_prot_reg;
|
||||
- if(master->lock_user_prot_reg)
|
||||
- slave->mtd.lock_user_prot_reg = part_lock_user_prot_reg;
|
||||
- if(master->get_user_prot_info)
|
||||
- slave->mtd.get_user_prot_info = part_get_user_prot_info;
|
||||
- if(master->get_fact_prot_info)
|
||||
- slave->mtd.get_fact_prot_info = part_get_fact_prot_info;
|
||||
- if (master->sync)
|
||||
- slave->mtd.sync = part_sync;
|
||||
- if (!i && master->suspend && master->resume) {
|
||||
- slave->mtd.suspend = part_suspend;
|
||||
- slave->mtd.resume = part_resume;
|
||||
- }
|
||||
- if (master->writev)
|
||||
- slave->mtd.writev = part_writev;
|
||||
- if (master->lock)
|
||||
- slave->mtd.lock = part_lock;
|
||||
- if (master->unlock)
|
||||
- slave->mtd.unlock = part_unlock;
|
||||
- if (master->block_isbad)
|
||||
- slave->mtd.block_isbad = part_block_isbad;
|
||||
- if (master->block_markbad)
|
||||
- slave->mtd.block_markbad = part_block_markbad;
|
||||
- slave->mtd.erase = part_erase;
|
||||
- slave->master = master;
|
||||
- slave->offset = parts[i].offset;
|
||||
- slave->index = i;
|
||||
-
|
||||
- if (slave->offset == MTDPART_OFS_APPEND)
|
||||
- slave->offset = cur_offset;
|
||||
- if (slave->offset == MTDPART_OFS_NXTBLK) {
|
||||
- slave->offset = cur_offset;
|
||||
- if ((cur_offset % master->erasesize) != 0) {
|
||||
- /* Round up to next erasesize */
|
||||
- slave->offset = ((cur_offset / master->erasesize) + 1) * master->erasesize;
|
||||
- printk(KERN_NOTICE "Moving partition %d: "
|
||||
- "0x%08x -> 0x%08x\n", i,
|
||||
- cur_offset, slave->offset);
|
||||
- }
|
||||
- }
|
||||
- if (slave->mtd.size == MTDPART_SIZ_FULL)
|
||||
- slave->mtd.size = master->size - slave->offset;
|
||||
- cur_offset = slave->offset + slave->mtd.size;
|
||||
-
|
||||
- printk (KERN_NOTICE "0x%08x-0x%08x : \"%s\"\n", slave->offset,
|
||||
- slave->offset + slave->mtd.size, slave->mtd.name);
|
||||
-
|
||||
- /* let's do some sanity checks */
|
||||
- if (slave->offset >= master->size) {
|
||||
- /* let's register it anyway to preserve ordering */
|
||||
- slave->offset = 0;
|
||||
- slave->mtd.size = 0;
|
||||
- printk ("mtd: partition \"%s\" is out of reach -- disabled\n",
|
||||
- parts[i].name);
|
||||
- }
|
||||
- if (slave->offset + slave->mtd.size > master->size) {
|
||||
- slave->mtd.size = master->size - slave->offset;
|
||||
- printk ("mtd: partition \"%s\" extends beyond the end of device \"%s\" -- size truncated to %#x\n",
|
||||
- parts[i].name, master->name, slave->mtd.size);
|
||||
- }
|
||||
- if (master->numeraseregions>1) {
|
||||
- /* Deal with variable erase size stuff */
|
||||
- int i;
|
||||
- struct mtd_erase_region_info *regions = master->eraseregions;
|
||||
-
|
||||
- /* Find the first erase regions which is part of this partition. */
|
||||
- for (i=0; i < master->numeraseregions && slave->offset >= regions[i].offset; i++)
|
||||
- ;
|
||||
-
|
||||
- for (i--; i < master->numeraseregions && slave->offset + slave->mtd.size > regions[i].offset; i++) {
|
||||
- if (slave->mtd.erasesize < regions[i].erasesize) {
|
||||
- slave->mtd.erasesize = regions[i].erasesize;
|
||||
- }
|
||||
+ for (i = 0, j = 0; i < nbparts; i++) {
|
||||
+ part = (struct mtd_partition *) &parts[i];
|
||||
+ ret = add_one_partition(master, part, j, &slave);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ j++;
|
||||
+
|
||||
+ if (strcmp(part->name, "rootfs") == 0 && slave->registered) {
|
||||
+#ifdef CONFIG_MTD_ROOTFS_ROOT_DEV
|
||||
+ if (ROOT_DEV == 0) {
|
||||
+ printk(KERN_NOTICE "mtd: partition \"rootfs\" "
|
||||
+ "set to be root filesystem\n");
|
||||
+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, slave->mtd.index);
|
||||
}
|
||||
- } else {
|
||||
- /* Single erase size */
|
||||
- slave->mtd.erasesize = master->erasesize;
|
||||
- }
|
||||
-
|
||||
- if ((slave->mtd.flags & MTD_WRITEABLE) &&
|
||||
- (slave->offset % slave->mtd.erasesize)) {
|
||||
- /* Doesn't start on a boundary of major erase size */
|
||||
- /* FIXME: Let it be writable if it is on a boundary of _minor_ erase size though */
|
||||
- slave->mtd.flags &= ~MTD_WRITEABLE;
|
||||
- printk ("mtd: partition \"%s\" doesn't start on an erase block boundary -- force read-only\n",
|
||||
- parts[i].name);
|
||||
- }
|
||||
- if ((slave->mtd.flags & MTD_WRITEABLE) &&
|
||||
- (slave->mtd.size % slave->mtd.erasesize)) {
|
||||
- slave->mtd.flags &= ~MTD_WRITEABLE;
|
||||
- printk ("mtd: partition \"%s\" doesn't end on an erase block -- force read-only\n",
|
||||
- parts[i].name);
|
||||
- }
|
||||
-
|
||||
- slave->mtd.ecclayout = master->ecclayout;
|
||||
- if (master->block_isbad) {
|
||||
- uint32_t offs = 0;
|
||||
-
|
||||
- while(offs < slave->mtd.size) {
|
||||
- if (master->block_isbad(master,
|
||||
- offs + slave->offset))
|
||||
- slave->mtd.ecc_stats.badblocks++;
|
||||
- offs += slave->mtd.erasesize;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if(parts[i].mtdp)
|
||||
- { /* store the object pointer (caller may or may not register it */
|
||||
- *parts[i].mtdp = &slave->mtd;
|
||||
- slave->registered = 0;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- /* register our partition */
|
||||
- add_mtd_device(&slave->mtd);
|
||||
- slave->registered = 1;
|
||||
+#endif
|
||||
+#ifdef CONFIG_MTD_ROOTFS_SPLIT
|
||||
+ ret = split_rootfs_data(master, &slave->mtd, part, j);
|
||||
+ if (ret == 0)
|
||||
+ j++;
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -557,6 +728,32 @@ int parse_mtd_partitions(struct mtd_info
|
||||
return ret;
|
||||
}
|
||||
|
||||
+int refresh_mtd_partitions(struct mtd_info *mtd)
|
||||
+{
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ if (IS_PART(mtd)) {
|
||||
+ struct mtd_part *part;
|
||||
+ struct mtd_info *master;
|
||||
+
|
||||
+ part = PART(mtd);
|
||||
+ master = part->master;
|
||||
+ if (master->refresh_device)
|
||||
+ ret = master->refresh_device(master);
|
||||
+ }
|
||||
+
|
||||
+ if (!ret && mtd->refresh_device)
|
||||
+ ret = mtd->refresh_device(mtd);
|
||||
+
|
||||
+#ifdef CONFIG_MTD_ROOTFS_SPLIT
|
||||
+ if (!ret && IS_PART(mtd) && !strcmp(mtd->name, "rootfs"))
|
||||
+ refresh_rootfs_split(mtd);
|
||||
+#endif
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
EXPORT_SYMBOL_GPL(parse_mtd_partitions);
|
||||
+EXPORT_SYMBOL_GPL(refresh_mtd_partitions);
|
||||
EXPORT_SYMBOL_GPL(register_mtd_parser);
|
||||
EXPORT_SYMBOL_GPL(deregister_mtd_parser);
|
||||
--- a/drivers/mtd/devices/block2mtd.c
|
||||
+++ b/drivers/mtd/devices/block2mtd.c
|
||||
@@ -34,6 +34,8 @@ struct block2mtd_dev {
|
||||
struct block_device *blkdev;
|
||||
struct mtd_info mtd;
|
||||
struct mutex write_mutex;
|
||||
+ rwlock_t bdev_mutex;
|
||||
+ char devname[0];
|
||||
};
|
||||
|
||||
|
||||
@@ -86,6 +88,12 @@ static int block2mtd_erase(struct mtd_in
|
||||
size_t len = instr->len;
|
||||
int err;
|
||||
|
||||
+ read_lock(&dev->bdev_mutex);
|
||||
+ if (!dev->blkdev) {
|
||||
+ err = -EINVAL;
|
||||
+ goto done;
|
||||
+ }
|
||||
+
|
||||
instr->state = MTD_ERASING;
|
||||
mutex_lock(&dev->write_mutex);
|
||||
err = _block2mtd_erase(dev, from, len);
|
||||
@@ -98,6 +106,10 @@ static int block2mtd_erase(struct mtd_in
|
||||
|
||||
instr->state = MTD_ERASE_DONE;
|
||||
mtd_erase_callback(instr);
|
||||
+
|
||||
+done:
|
||||
+ read_unlock(&dev->bdev_mutex);
|
||||
+
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -109,10 +121,14 @@ static int block2mtd_read(struct mtd_inf
|
||||
struct page *page;
|
||||
int index = from >> PAGE_SHIFT;
|
||||
int offset = from & (PAGE_SIZE-1);
|
||||
- int cpylen;
|
||||
+ int cpylen, err = 0;
|
||||
+
|
||||
+ read_lock(&dev->bdev_mutex);
|
||||
+ if (!dev->blkdev || (from > mtd->size)) {
|
||||
+ err = -EINVAL;
|
||||
+ goto done;
|
||||
+ }
|
||||
|
||||
- if (from > mtd->size)
|
||||
- return -EINVAL;
|
||||
if (from + len > mtd->size)
|
||||
len = mtd->size - from;
|
||||
|
||||
@@ -127,10 +143,14 @@ static int block2mtd_read(struct mtd_inf
|
||||
len = len - cpylen;
|
||||
|
||||
page = page_read(dev->blkdev->bd_inode->i_mapping, index);
|
||||
- if (!page)
|
||||
- return -ENOMEM;
|
||||
- if (IS_ERR(page))
|
||||
- return PTR_ERR(page);
|
||||
+ if (!page) {
|
||||
+ err = -ENOMEM;
|
||||
+ goto done;
|
||||
+ }
|
||||
+ if (IS_ERR(page)) {
|
||||
+ err = PTR_ERR(page);
|
||||
+ goto done;
|
||||
+ }
|
||||
|
||||
memcpy(buf, page_address(page) + offset, cpylen);
|
||||
page_cache_release(page);
|
||||
@@ -141,7 +161,10 @@ static int block2mtd_read(struct mtd_inf
|
||||
offset = 0;
|
||||
index++;
|
||||
}
|
||||
- return 0;
|
||||
+
|
||||
+done:
|
||||
+ read_unlock(&dev->bdev_mutex);
|
||||
+ return err;
|
||||
}
|
||||
|
||||
|
||||
@@ -193,12 +216,22 @@ static int block2mtd_write(struct mtd_in
|
||||
size_t *retlen, const u_char *buf)
|
||||
{
|
||||
struct block2mtd_dev *dev = mtd->priv;
|
||||
- int err;
|
||||
+ int err = 0;
|
||||
+
|
||||
+ read_lock(&dev->bdev_mutex);
|
||||
+ if (!dev->blkdev) {
|
||||
+ err = -EINVAL;
|
||||
+ goto done;
|
||||
+ }
|
||||
|
||||
if (!len)
|
||||
- return 0;
|
||||
- if (to >= mtd->size)
|
||||
- return -ENOSPC;
|
||||
+ goto done;
|
||||
+
|
||||
+ if (to >= mtd->size) {
|
||||
+ err = -ENOSPC;
|
||||
+ goto done;
|
||||
+ }
|
||||
+
|
||||
if (to + len > mtd->size)
|
||||
len = mtd->size - to;
|
||||
|
||||
@@ -207,6 +240,9 @@ static int block2mtd_write(struct mtd_in
|
||||
mutex_unlock(&dev->write_mutex);
|
||||
if (err > 0)
|
||||
err = 0;
|
||||
+
|
||||
+done:
|
||||
+ read_unlock(&dev->bdev_mutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -215,51 +251,29 @@ static int block2mtd_write(struct mtd_in
|
||||
static void block2mtd_sync(struct mtd_info *mtd)
|
||||
{
|
||||
struct block2mtd_dev *dev = mtd->priv;
|
||||
- sync_blockdev(dev->blkdev);
|
||||
- return;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-static void block2mtd_free_device(struct block2mtd_dev *dev)
|
||||
-{
|
||||
- if (!dev)
|
||||
- return;
|
||||
-
|
||||
- kfree(dev->mtd.name);
|
||||
|
||||
- if (dev->blkdev) {
|
||||
- invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping,
|
||||
- 0, -1);
|
||||
- close_bdev_excl(dev->blkdev);
|
||||
- }
|
||||
+ read_lock(&dev->bdev_mutex);
|
||||
+ if (dev->blkdev)
|
||||
+ sync_blockdev(dev->blkdev);
|
||||
+ read_unlock(&dev->bdev_mutex);
|
||||
|
||||
- kfree(dev);
|
||||
+ return;
|
||||
}
|
||||
|
||||
|
||||
-/* FIXME: ensure that mtd->size % erase_size == 0 */
|
||||
-static struct block2mtd_dev *add_device(char *devname, int erase_size, char *mtdname)
|
||||
+static int _open_bdev(struct block2mtd_dev *dev)
|
||||
{
|
||||
struct block_device *bdev;
|
||||
- struct block2mtd_dev *dev;
|
||||
- struct mtd_partition *part;
|
||||
-
|
||||
- if (!devname)
|
||||
- return NULL;
|
||||
-
|
||||
- dev = kzalloc(sizeof(struct block2mtd_dev), GFP_KERNEL);
|
||||
- if (!dev)
|
||||
- return NULL;
|
||||
|
||||
/* Get a handle on the device */
|
||||
- bdev = open_bdev_excl(devname, O_RDWR, NULL);
|
||||
+ bdev = open_bdev_excl(dev->devname, O_RDWR, NULL);
|
||||
#ifndef MODULE
|
||||
if (IS_ERR(bdev)) {
|
||||
|
||||
/* We might not have rootfs mounted at this point. Try
|
||||
to resolve the device name by other means. */
|
||||
|
||||
- dev_t devt = name_to_dev_t(devname);
|
||||
+ dev_t devt = name_to_dev_t(dev->devname);
|
||||
if (devt) {
|
||||
bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ);
|
||||
}
|
||||
@@ -267,17 +281,96 @@ static struct block2mtd_dev *add_device(
|
||||
#endif
|
||||
|
||||
if (IS_ERR(bdev)) {
|
||||
- ERROR("error: cannot open device %s", devname);
|
||||
- goto devinit_err;
|
||||
+ ERROR("error: cannot open device %s", dev->devname);
|
||||
+ return 1;
|
||||
}
|
||||
dev->blkdev = bdev;
|
||||
|
||||
if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
|
||||
ERROR("attempting to use an MTD device as a block device");
|
||||
- goto devinit_err;
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void _close_bdev(struct block2mtd_dev *dev)
|
||||
+{
|
||||
+ struct block_device *bdev;
|
||||
+
|
||||
+ if (!dev->blkdev)
|
||||
+ return;
|
||||
+
|
||||
+ bdev = dev->blkdev;
|
||||
+ invalidate_mapping_pages(dev->blkdev->bd_inode->i_mapping, 0, -1);
|
||||
+ close_bdev_excl(dev->blkdev);
|
||||
+ dev->blkdev = NULL;
|
||||
+}
|
||||
+
|
||||
+static void block2mtd_free_device(struct block2mtd_dev *dev)
|
||||
+{
|
||||
+ if (!dev)
|
||||
+ return;
|
||||
+
|
||||
+ kfree(dev->mtd.name);
|
||||
+ _close_bdev(dev);
|
||||
+ kfree(dev);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int block2mtd_refresh(struct mtd_info *mtd)
|
||||
+{
|
||||
+ struct block2mtd_dev *dev = mtd->priv;
|
||||
+ struct block_device *bdev;
|
||||
+ dev_t devt;
|
||||
+ int err = 0;
|
||||
+
|
||||
+ /* no other mtd function can run at this point */
|
||||
+ write_lock(&dev->bdev_mutex);
|
||||
+
|
||||
+ /* get the device number for the whole disk */
|
||||
+ devt = MKDEV(MAJOR(dev->blkdev->bd_dev), 0);
|
||||
+
|
||||
+ /* close the old block device */
|
||||
+ _close_bdev(dev);
|
||||
+
|
||||
+ /* open the whole disk, issue a partition rescan, then */
|
||||
+ bdev = open_by_devnum(devt, FMODE_WRITE | FMODE_READ);
|
||||
+ if (!bdev || !bdev->bd_disk)
|
||||
+ err = -EINVAL;
|
||||
+ else {
|
||||
+ err = rescan_partitions(bdev->bd_disk, bdev);
|
||||
+ }
|
||||
+ if (bdev)
|
||||
+ close_bdev_excl(bdev);
|
||||
+
|
||||
+ /* try to open the partition block device again */
|
||||
+ _open_bdev(dev);
|
||||
+ write_unlock(&dev->bdev_mutex);
|
||||
+
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+/* FIXME: ensure that mtd->size % erase_size == 0 */
|
||||
+static struct block2mtd_dev *add_device(char *devname, int erase_size, char *mtdname)
|
||||
+{
|
||||
+ struct block2mtd_dev *dev;
|
||||
+ struct mtd_partition *part;
|
||||
+
|
||||
+ if (!devname)
|
||||
+ return NULL;
|
||||
+
|
||||
+ dev = kzalloc(sizeof(struct block2mtd_dev) + strlen(devname) + 1, GFP_KERNEL);
|
||||
+ if (!dev)
|
||||
+ return NULL;
|
||||
+
|
||||
+ strcpy(dev->devname, devname);
|
||||
+
|
||||
+ if (_open_bdev(dev))
|
||||
+ goto devinit_err;
|
||||
+
|
||||
mutex_init(&dev->write_mutex);
|
||||
+ rwlock_init(&dev->bdev_mutex);
|
||||
|
||||
/* Setup the MTD structure */
|
||||
/* make the name contain the block device in */
|
||||
@@ -304,6 +397,7 @@ static struct block2mtd_dev *add_device(
|
||||
dev->mtd.read = block2mtd_read;
|
||||
dev->mtd.priv = dev;
|
||||
dev->mtd.owner = THIS_MODULE;
|
||||
+ dev->mtd.refresh_device = block2mtd_refresh;
|
||||
|
||||
part = kzalloc(sizeof(struct mtd_partition), GFP_KERNEL);
|
||||
part->name = dev->mtd.name;
|
||||
--- a/drivers/mtd/mtdchar.c
|
||||
+++ b/drivers/mtd/mtdchar.c
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/compatmac.h>
|
||||
+#include <linux/mtd/partitions.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
@@ -754,6 +755,13 @@ static int mtd_ioctl(struct inode *inode
|
||||
file->f_pos = 0;
|
||||
break;
|
||||
}
|
||||
+#ifdef CONFIG_MTD_PARTITIONS
|
||||
+ case MTDREFRESH:
|
||||
+ {
|
||||
+ ret = refresh_mtd_partitions(mtd);
|
||||
+ break;
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
default:
|
||||
ret = -ENOTTY;
|
||||
--- a/include/linux/mtd/mtd.h
|
||||
+++ b/include/linux/mtd/mtd.h
|
||||
@@ -98,6 +98,7 @@ struct mtd_oob_ops {
|
||||
uint8_t *oobbuf;
|
||||
};
|
||||
|
||||
+struct mtd_info;
|
||||
struct mtd_info {
|
||||
u_char type;
|
||||
u_int32_t flags;
|
||||
@@ -202,6 +203,9 @@ struct mtd_info {
|
||||
struct module *owner;
|
||||
int usecount;
|
||||
|
||||
+ int (*refresh_device)(struct mtd_info *mtd);
|
||||
+ struct mtd_info *split;
|
||||
+
|
||||
/* If the driver is something smart, like UBI, it may need to maintain
|
||||
* its own reference counting. The below functions are only for driver.
|
||||
* The driver may register its callbacks. These callbacks are not
|
||||
--- a/include/linux/mtd/partitions.h
|
||||
+++ b/include/linux/mtd/partitions.h
|
||||
@@ -36,6 +36,7 @@
|
||||
* erasesize aligned (e.g. use MTDPART_OFS_NEXTBLK).
|
||||
*/
|
||||
|
||||
+struct mtd_partition;
|
||||
struct mtd_partition {
|
||||
char *name; /* identifier string */
|
||||
u_int32_t size; /* partition size */
|
||||
@@ -43,6 +44,7 @@ struct mtd_partition {
|
||||
u_int32_t mask_flags; /* master MTD flags to mask out for this partition */
|
||||
struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only)*/
|
||||
struct mtd_info **mtdp; /* pointer to store the MTD object */
|
||||
+ int (*refresh_partition)(struct mtd_info *);
|
||||
};
|
||||
|
||||
#define MTDPART_OFS_NXTBLK (-2)
|
||||
@@ -52,6 +54,7 @@ struct mtd_partition {
|
||||
|
||||
int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
|
||||
int del_mtd_partitions(struct mtd_info *);
|
||||
+int refresh_mtd_partitions(struct mtd_info *);
|
||||
|
||||
/*
|
||||
* Functions dealing with the various ways of partitioning the space
|
||||
--- a/include/mtd/mtd-abi.h
|
||||
+++ b/include/mtd/mtd-abi.h
|
||||
@@ -95,6 +95,7 @@ struct otp_info {
|
||||
#define ECCGETLAYOUT _IOR('M', 17, struct nand_ecclayout)
|
||||
#define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats)
|
||||
#define MTDFILEMODE _IO('M', 19)
|
||||
+#define MTDREFRESH _IO('M', 23)
|
||||
|
||||
/*
|
||||
* Obsolete legacy interface. Keep it in order not to break userspace
|
|
@ -1,30 +0,0 @@
|
|||
--- a/drivers/mtd/redboot.c
|
||||
+++ b/drivers/mtd/redboot.c
|
||||
@@ -236,14 +236,21 @@ static int parse_redboot_partitions(stru
|
||||
#endif
|
||||
names += strlen(names)+1;
|
||||
|
||||
-#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
|
||||
if(fl->next && fl->img->flash_base + fl->img->size + master->erasesize <= fl->next->img->flash_base) {
|
||||
- i++;
|
||||
- parts[i].offset = parts[i-1].size + parts[i-1].offset;
|
||||
- parts[i].size = fl->next->img->flash_base - parts[i].offset;
|
||||
- parts[i].name = nullname;
|
||||
- }
|
||||
+ if (!strcmp(parts[i].name, "rootfs")) {
|
||||
+ parts[i].size = fl->next->img->flash_base;
|
||||
+ parts[i].size &= ~(master->erasesize - 1);
|
||||
+ parts[i].size -= parts[i].offset;
|
||||
+#ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
|
||||
+ nrparts--;
|
||||
+ } else {
|
||||
+ i++;
|
||||
+ parts[i].offset = parts[i-1].size + parts[i-1].offset;
|
||||
+ parts[i].size = fl->next->img->flash_base - parts[i].offset;
|
||||
+ parts[i].name = nullname;
|
||||
#endif
|
||||
+ }
|
||||
+ }
|
||||
tmp_fl = fl;
|
||||
fl = fl->next;
|
||||
kfree(tmp_fl);
|
|
@ -1,32 +0,0 @@
|
|||
--- a/include/linux/mtd/nand.h
|
||||
+++ b/include/linux/mtd/nand.h
|
||||
@@ -573,6 +573,7 @@ struct platform_nand_chip {
|
||||
int chip_delay;
|
||||
unsigned int options;
|
||||
const char **part_probe_types;
|
||||
+ int (*chip_fixup)(struct mtd_info *mtd);
|
||||
void *priv;
|
||||
};
|
||||
|
||||
--- a/drivers/mtd/nand/plat_nand.c
|
||||
+++ b/drivers/mtd/nand/plat_nand.c
|
||||
@@ -70,7 +70,18 @@ static int __init plat_nand_probe(struct
|
||||
platform_set_drvdata(pdev, data);
|
||||
|
||||
/* Scan to find existance of the device */
|
||||
- if (nand_scan(&data->mtd, 1)) {
|
||||
+ if (nand_scan_ident(&data->mtd, 1)) {
|
||||
+ res = -ENXIO;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (pdata->chip.chip_fixup) {
|
||||
+ res = pdata->chip.chip_fixup(&data->mtd);
|
||||
+ if (res)
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (nand_scan_tail(&data->mtd)) {
|
||||
res = -ENXIO;
|
||||
goto out;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,109 +0,0 @@
|
|||
--- a/include/linux/netfilter/xt_layer7.h
|
||||
+++ b/include/linux/netfilter/xt_layer7.h
|
||||
@@ -8,6 +8,7 @@ struct xt_layer7_info {
|
||||
char protocol[MAX_PROTOCOL_LEN];
|
||||
char pattern[MAX_PATTERN_LEN];
|
||||
u_int8_t invert;
|
||||
+ u_int8_t pkt;
|
||||
};
|
||||
|
||||
#endif /* _XT_LAYER7_H */
|
||||
--- a/net/netfilter/xt_layer7.c
|
||||
+++ b/net/netfilter/xt_layer7.c
|
||||
@@ -297,34 +297,36 @@ static int match_no_append(struct nf_con
|
||||
}
|
||||
|
||||
/* add the new app data to the conntrack. Return number of bytes added. */
|
||||
-static int add_data(struct nf_conn * master_conntrack,
|
||||
- char * app_data, int appdatalen)
|
||||
+static int add_datastr(char *target, int offset, char *app_data, int len)
|
||||
{
|
||||
int length = 0, i;
|
||||
- int oldlength = master_conntrack->layer7.app_data_len;
|
||||
-
|
||||
- /* This is a fix for a race condition by Deti Fliegl. However, I'm not
|
||||
- clear on whether the race condition exists or whether this really
|
||||
- fixes it. I might just be being dense... Anyway, if it's not really
|
||||
- a fix, all it does is waste a very small amount of time. */
|
||||
- if(!master_conntrack->layer7.app_data) return 0;
|
||||
+
|
||||
+ if (!target) return 0;
|
||||
|
||||
/* Strip nulls. Make everything lower case (our regex lib doesn't
|
||||
do case insensitivity). Add it to the end of the current data. */
|
||||
- for(i = 0; i < maxdatalen-oldlength-1 &&
|
||||
- i < appdatalen; i++) {
|
||||
+ for(i = 0; i < maxdatalen-offset-1 && i < len; i++) {
|
||||
if(app_data[i] != '\0') {
|
||||
/* the kernel version of tolower mungs 'upper ascii' */
|
||||
- master_conntrack->layer7.app_data[length+oldlength] =
|
||||
+ target[length+offset] =
|
||||
isascii(app_data[i])?
|
||||
tolower(app_data[i]) : app_data[i];
|
||||
length++;
|
||||
}
|
||||
}
|
||||
+ target[length+offset] = '\0';
|
||||
+
|
||||
+ return length;
|
||||
+}
|
||||
|
||||
- master_conntrack->layer7.app_data[length+oldlength] = '\0';
|
||||
- master_conntrack->layer7.app_data_len = length + oldlength;
|
||||
+/* add the new app data to the conntrack. Return number of bytes added. */
|
||||
+static int add_data(struct nf_conn * master_conntrack,
|
||||
+ char * app_data, int appdatalen)
|
||||
+{
|
||||
+ int length;
|
||||
|
||||
+ length = add_datastr(master_conntrack->layer7.app_data, master_conntrack->layer7.app_data_len, app_data, appdatalen);
|
||||
+ master_conntrack->layer7.app_data_len += length;
|
||||
return length;
|
||||
}
|
||||
|
||||
@@ -411,7 +413,7 @@ match(const struct sk_buff *skbin,
|
||||
const struct xt_layer7_info * info = matchinfo;
|
||||
enum ip_conntrack_info master_ctinfo, ctinfo;
|
||||
struct nf_conn *master_conntrack, *conntrack;
|
||||
- unsigned char * app_data;
|
||||
+ unsigned char *app_data, *tmp_data;
|
||||
unsigned int pattern_result, appdatalen;
|
||||
regexp * comppattern;
|
||||
|
||||
@@ -439,8 +441,8 @@ match(const struct sk_buff *skbin,
|
||||
master_conntrack = master_ct(master_conntrack);
|
||||
|
||||
/* if we've classified it or seen too many packets */
|
||||
- if(TOTAL_PACKETS > num_packets ||
|
||||
- master_conntrack->layer7.app_proto) {
|
||||
+ if(!info->pkt && (TOTAL_PACKETS > num_packets ||
|
||||
+ master_conntrack->layer7.app_proto)) {
|
||||
|
||||
pattern_result = match_no_append(conntrack, master_conntrack,
|
||||
ctinfo, master_ctinfo, info);
|
||||
@@ -473,6 +475,25 @@ match(const struct sk_buff *skbin,
|
||||
/* the return value gets checked later, when we're ready to use it */
|
||||
comppattern = compile_and_cache(info->pattern, info->protocol);
|
||||
|
||||
+ if (info->pkt) {
|
||||
+ tmp_data = kmalloc(maxdatalen, GFP_ATOMIC);
|
||||
+ if(!tmp_data){
|
||||
+ if (net_ratelimit())
|
||||
+ printk(KERN_ERR "layer7: out of memory in match, bailing.\n");
|
||||
+ return info->invert;
|
||||
+ }
|
||||
+
|
||||
+ tmp_data[0] = '\0';
|
||||
+ add_datastr(tmp_data, 0, app_data, appdatalen);
|
||||
+ pattern_result = ((comppattern && regexec(comppattern, tmp_data)) ? 1 : 0);
|
||||
+
|
||||
+ kfree(tmp_data);
|
||||
+ tmp_data = NULL;
|
||||
+ spin_unlock_bh(&l7_lock);
|
||||
+
|
||||
+ return (pattern_result ^ info->invert);
|
||||
+ }
|
||||
+
|
||||
/* On the first packet of a connection, allocate space for app data */
|
||||
if(TOTAL_PACKETS == 1 && !skb->cb[0] &&
|
||||
!master_conntrack->layer7.app_data){
|
File diff suppressed because it is too large
Load Diff
|
@ -1,239 +0,0 @@
|
|||
--- /dev/null
|
||||
+++ b/include/linux/netfilter_ipv4/ipt_time.h
|
||||
@@ -0,0 +1,18 @@
|
||||
+#ifndef __ipt_time_h_included__
|
||||
+#define __ipt_time_h_included__
|
||||
+
|
||||
+
|
||||
+struct ipt_time_info {
|
||||
+ u_int8_t days_match; /* 1 bit per day. -SMTWTFS */
|
||||
+ u_int16_t time_start; /* 0 < time_start < 23*60+59 = 1439 */
|
||||
+ u_int16_t time_stop; /* 0:0 < time_stat < 23:59 */
|
||||
+
|
||||
+ /* FIXME: Keep this one for userspace iptables binary compability: */
|
||||
+ u_int8_t kerneltime; /* ignore skb time (and use kerneltime) or not. */
|
||||
+
|
||||
+ time_t date_start;
|
||||
+ time_t date_stop;
|
||||
+};
|
||||
+
|
||||
+
|
||||
+#endif /* __ipt_time_h_included__ */
|
||||
--- /dev/null
|
||||
+++ b/net/ipv4/netfilter/ipt_time.c
|
||||
@@ -0,0 +1,180 @@
|
||||
+/*
|
||||
+ This is a module which is used for time matching
|
||||
+ It is using some modified code from dietlibc (localtime() function)
|
||||
+ that you can find at http://www.fefe.de/dietlibc/
|
||||
+ This file is distributed under the terms of the GNU General Public
|
||||
+ License (GPL). Copies of the GPL can be obtained from: ftp://prep.ai.mit.edu/pub/gnu/GPL
|
||||
+ 2001-05-04 Fabrice MARIE <fabrice@netfilter.org> : initial development.
|
||||
+ 2001-21-05 Fabrice MARIE <fabrice@netfilter.org> : bug fix in the match code,
|
||||
+ thanks to "Zeng Yu" <zengy@capitel.com.cn> for bug report.
|
||||
+ 2001-26-09 Fabrice MARIE <fabrice@netfilter.org> : force the match to be in LOCAL_IN or PRE_ROUTING only.
|
||||
+ 2001-30-11 Fabrice : added the possibility to use the match in FORWARD/OUTPUT with a little hack,
|
||||
+ added Nguyen Dang Phuoc Dong <dongnd@tlnet.com.vn> patch to support timezones.
|
||||
+ 2004-05-02 Fabrice : added support for date matching, from an idea of Fabien COELHO.
|
||||
+*/
|
||||
+
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/skbuff.h>
|
||||
+#include <linux/netfilter_ipv4/ip_tables.h>
|
||||
+#include <linux/netfilter_ipv4/ipt_time.h>
|
||||
+#include <linux/time.h>
|
||||
+
|
||||
+MODULE_AUTHOR("Fabrice MARIE <fabrice@netfilter.org>");
|
||||
+MODULE_DESCRIPTION("Match arrival timestamp/date");
|
||||
+MODULE_LICENSE("GPL");
|
||||
+
|
||||
+struct tm
|
||||
+{
|
||||
+ int tm_sec; /* Seconds. [0-60] (1 leap second) */
|
||||
+ int tm_min; /* Minutes. [0-59] */
|
||||
+ int tm_hour; /* Hours. [0-23] */
|
||||
+ int tm_mday; /* Day. [1-31] */
|
||||
+ int tm_mon; /* Month. [0-11] */
|
||||
+ int tm_year; /* Year - 1900. */
|
||||
+ int tm_wday; /* Day of week. [0-6] */
|
||||
+ int tm_yday; /* Days in year.[0-365] */
|
||||
+ int tm_isdst; /* DST. [-1/0/1]*/
|
||||
+
|
||||
+ long int tm_gmtoff; /* we don't care, we count from GMT */
|
||||
+ const char *tm_zone; /* we don't care, we count from GMT */
|
||||
+};
|
||||
+
|
||||
+void
|
||||
+localtime(const u32 time, struct tm *r);
|
||||
+
|
||||
+static bool
|
||||
+match(const struct sk_buff *skb,
|
||||
+ const struct net_device *in,
|
||||
+ const struct net_device *out,
|
||||
+ const struct xt_match *match,
|
||||
+ const void *matchinfo,
|
||||
+ int offset,
|
||||
+ unsigned int protoff,
|
||||
+ bool *hotdrop)
|
||||
+{
|
||||
+ const struct ipt_time_info *info = matchinfo; /* match info for rule */
|
||||
+ struct timeval tv;
|
||||
+ struct tm currenttime; /* time human readable */
|
||||
+ u_int8_t days_of_week[7] = {64, 32, 16, 8, 4, 2, 1};
|
||||
+ u_int16_t packet_time;
|
||||
+
|
||||
+ /* We might not have a timestamp, get one */
|
||||
+ if (skb->tstamp.tv64 == 0)
|
||||
+ __net_timestamp((struct sk_buff *)skb);
|
||||
+
|
||||
+ skb_get_timestamp(skb, &tv);
|
||||
+ /* First we make sure we are in the date start-stop boundaries */
|
||||
+ if ((tv.tv_sec < info->date_start) || (tv.tv_sec > info->date_stop))
|
||||
+ return 0; /* We are outside the date boundaries */
|
||||
+
|
||||
+ /* Transform the timestamp of the packet, in a human readable form */
|
||||
+ localtime(tv.tv_sec, ¤ttime);
|
||||
+
|
||||
+ /* check if we match this timestamp, we start by the days... */
|
||||
+ if ((days_of_week[currenttime.tm_wday] & info->days_match) != days_of_week[currenttime.tm_wday])
|
||||
+ return 0; /* the day doesn't match */
|
||||
+
|
||||
+ /* ... check the time now */
|
||||
+ packet_time = (currenttime.tm_hour * 60) + currenttime.tm_min;
|
||||
+ if ((packet_time < info->time_start) || (packet_time > info->time_stop))
|
||||
+ return 0;
|
||||
+
|
||||
+ /* here we match ! */
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static bool
|
||||
+checkentry(const char *tablename,
|
||||
+ const void *ip,
|
||||
+ const struct xt_match *match,
|
||||
+ void *matchinfo,
|
||||
+ unsigned int hook_mask)
|
||||
+{
|
||||
+ struct ipt_time_info *info = matchinfo; /* match info for rule */
|
||||
+
|
||||
+ /* First, check that we are in the correct hooks */
|
||||
+ if (hook_mask
|
||||
+ & ~((1 << NF_IP_PRE_ROUTING) | (1 << NF_IP_LOCAL_IN) | (1 << NF_IP_FORWARD) | (1 << NF_IP_LOCAL_OUT)))
|
||||
+ {
|
||||
+ printk("ipt_time: error, only valid for PRE_ROUTING, LOCAL_IN, FORWARD and OUTPUT)\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ /* Now check the coherence of the data ... */
|
||||
+ if ((info->time_start > 1439) || /* 23*60+59 = 1439*/
|
||||
+ (info->time_stop > 1439))
|
||||
+ {
|
||||
+ printk(KERN_WARNING "ipt_time: invalid argument\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static struct ipt_match time_match = {
|
||||
+ .name = "time",
|
||||
+ .match = &match,
|
||||
+ .matchsize = sizeof(struct ipt_time_info),
|
||||
+ .checkentry = &checkentry,
|
||||
+ .me = THIS_MODULE
|
||||
+};
|
||||
+
|
||||
+static int __init init(void)
|
||||
+{
|
||||
+ printk("ipt_time loading\n");
|
||||
+ return xt_register_match(&time_match);
|
||||
+}
|
||||
+
|
||||
+static void __exit fini(void)
|
||||
+{
|
||||
+ xt_unregister_match(&time_match);
|
||||
+ printk("ipt_time unloaded\n");
|
||||
+}
|
||||
+
|
||||
+module_init(init);
|
||||
+module_exit(fini);
|
||||
+
|
||||
+
|
||||
+/* The part below is borowed and modified from dietlibc */
|
||||
+
|
||||
+/* seconds per day */
|
||||
+#define SPD 24*60*60
|
||||
+
|
||||
+void
|
||||
+localtime(const u32 time, struct tm *r) {
|
||||
+ u32 i, timep;
|
||||
+ extern struct timezone sys_tz;
|
||||
+ const unsigned int __spm[12] =
|
||||
+ { 0,
|
||||
+ (31),
|
||||
+ (31+28),
|
||||
+ (31+28+31),
|
||||
+ (31+28+31+30),
|
||||
+ (31+28+31+30+31),
|
||||
+ (31+28+31+30+31+30),
|
||||
+ (31+28+31+30+31+30+31),
|
||||
+ (31+28+31+30+31+30+31+31),
|
||||
+ (31+28+31+30+31+30+31+31+30),
|
||||
+ (31+28+31+30+31+30+31+31+30+31),
|
||||
+ (31+28+31+30+31+30+31+31+30+31+30),
|
||||
+ };
|
||||
+ register u32 work;
|
||||
+
|
||||
+ timep = time - (sys_tz.tz_minuteswest * 60);
|
||||
+ work=timep%(SPD);
|
||||
+ r->tm_sec=work%60; work/=60;
|
||||
+ r->tm_min=work%60; r->tm_hour=work/60;
|
||||
+ work=timep/(SPD);
|
||||
+ r->tm_wday=(4+work)%7;
|
||||
+ for (i=1970; ; ++i) {
|
||||
+ register time_t k= (!(i%4) && ((i%100) || !(i%400)))?366:365;
|
||||
+ if (work>k)
|
||||
+ work-=k;
|
||||
+ else
|
||||
+ break;
|
||||
+ }
|
||||
+ r->tm_year=i-1900;
|
||||
+ for (i=11; i && __spm[i]>work; --i) ;
|
||||
+ r->tm_mon=i;
|
||||
+ r->tm_mday=work-__spm[i]+1;
|
||||
+}
|
||||
--- a/net/ipv4/netfilter/Kconfig
|
||||
+++ b/net/ipv4/netfilter/Kconfig
|
||||
@@ -72,6 +72,22 @@ config IP_NF_MATCH_TOS
|
||||
|
||||
To compile it as a module, choose M here. If unsure, say N.
|
||||
|
||||
+
|
||||
+config IP_NF_MATCH_TIME
|
||||
+ tristate 'TIME match support'
|
||||
+ depends on IP_NF_IPTABLES
|
||||
+ help
|
||||
+ This option adds a `time' match, which allows you
|
||||
+ to match based on the packet arrival time/date
|
||||
+ (arrival time/date at the machine which netfilter is running on) or
|
||||
+ departure time/date (for locally generated packets).
|
||||
+
|
||||
+ If you say Y here, try iptables -m time --help for more information.
|
||||
+ If you want to compile it as a module, say M here and read
|
||||
+
|
||||
+ Documentation/modules.txt. If unsure, say `N'.
|
||||
+
|
||||
+
|
||||
config IP_NF_MATCH_RECENT
|
||||
tristate "recent match support"
|
||||
depends on IP_NF_IPTABLES
|
||||
--- a/net/ipv4/netfilter/Makefile
|
||||
+++ b/net/ipv4/netfilter/Makefile
|
||||
@@ -50,6 +50,7 @@ obj-$(CONFIG_IP_NF_MATCH_RECENT) += ipt_
|
||||
obj-$(CONFIG_IP_NF_MATCH_TOS) += ipt_tos.o
|
||||
obj-$(CONFIG_IP_NF_MATCH_TTL) += ipt_ttl.o
|
||||
obj-$(CONFIG_IP_NF_MATCH_SET) += ipt_set.o
|
||||
+obj-$(CONFIG_IP_NF_MATCH_TIME) += ipt_time.o
|
||||
|
||||
# targets
|
||||
obj-$(CONFIG_IP_NF_TARGET_CLUSTERIP) += ipt_CLUSTERIP.o
|
|
@ -1,858 +0,0 @@
|
|||
--- /dev/null
|
||||
+++ b/drivers/net/imq.c
|
||||
@@ -0,0 +1,409 @@
|
||||
+/*
|
||||
+ * Pseudo-driver for the intermediate queue device.
|
||||
+ *
|
||||
+ * 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.
|
||||
+ *
|
||||
+ * Authors: Patrick McHardy, <kaber@trash.net>
|
||||
+ *
|
||||
+ * The first version was written by Martin Devera, <devik@cdi.cz>
|
||||
+ *
|
||||
+ * Credits: Jan Rafaj <imq2t@cedric.vabo.cz>
|
||||
+ * - Update patch to 2.4.21
|
||||
+ * Sebastian Strollo <sstrollo@nortelnetworks.com>
|
||||
+ * - Fix "Dead-loop on netdevice imq"-issue
|
||||
+ * Marcel Sebek <sebek64@post.cz>
|
||||
+ * - Update to 2.6.2-rc1
|
||||
+ *
|
||||
+ * After some time of inactivity there is a group taking care
|
||||
+ * of IMQ again: http://www.linuximq.net
|
||||
+ *
|
||||
+ *
|
||||
+ * 2004/06/30 - New version of IMQ patch to kernels <=2.6.7 including
|
||||
+ * the following changes:
|
||||
+ *
|
||||
+ * - Correction of ipv6 support "+"s issue (Hasso Tepper)
|
||||
+ * - Correction of imq_init_devs() issue that resulted in
|
||||
+ * kernel OOPS unloading IMQ as module (Norbert Buchmuller)
|
||||
+ * - Addition of functionality to choose number of IMQ devices
|
||||
+ * during kernel config (Andre Correa)
|
||||
+ * - Addition of functionality to choose how IMQ hooks on
|
||||
+ * PRE and POSTROUTING (after or before NAT) (Andre Correa)
|
||||
+ * - Cosmetic corrections (Norbert Buchmuller) (Andre Correa)
|
||||
+ *
|
||||
+ *
|
||||
+ * 2005/12/16 - IMQ versions between 2.6.7 and 2.6.13 were
|
||||
+ * released with almost no problems. 2.6.14-x was released
|
||||
+ * with some important changes: nfcache was removed; After
|
||||
+ * some weeks of trouble we figured out that some IMQ fields
|
||||
+ * in skb were missing in skbuff.c - skb_clone and copy_skb_header.
|
||||
+ * These functions are correctly patched by this new patch version.
|
||||
+ *
|
||||
+ * Thanks for all who helped to figure out all the problems with
|
||||
+ * 2.6.14.x: Patrick McHardy, Rune Kock, VeNoMouS, Max CtRiX,
|
||||
+ * Kevin Shanahan, Richard Lucassen, Valery Dachev (hopefully
|
||||
+ * I didn't forget anybody). I apologize again for my lack of time.
|
||||
+ *
|
||||
+ * More info at: http://www.linuximq.net/ (Andre Correa)
|
||||
+ */
|
||||
+
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/moduleparam.h>
|
||||
+#include <linux/skbuff.h>
|
||||
+#include <linux/netdevice.h>
|
||||
+#include <linux/rtnetlink.h>
|
||||
+#include <linux/if_arp.h>
|
||||
+#include <linux/netfilter.h>
|
||||
+#include <linux/netfilter_ipv4.h>
|
||||
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
|
||||
+ #include <linux/netfilter_ipv6.h>
|
||||
+#endif
|
||||
+#include <linux/imq.h>
|
||||
+#include <net/pkt_sched.h>
|
||||
+
|
||||
+extern int qdisc_restart1(struct net_device *dev);
|
||||
+
|
||||
+static nf_hookfn imq_nf_hook;
|
||||
+
|
||||
+static struct nf_hook_ops imq_ingress_ipv4 = {
|
||||
+ .hook = imq_nf_hook,
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .pf = PF_INET,
|
||||
+ .hooknum = NF_IP_PRE_ROUTING,
|
||||
+#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB)
|
||||
+ .priority = NF_IP_PRI_MANGLE + 1
|
||||
+#else
|
||||
+ .priority = NF_IP_PRI_NAT_DST + 1
|
||||
+#endif
|
||||
+};
|
||||
+
|
||||
+static struct nf_hook_ops imq_egress_ipv4 = {
|
||||
+ .hook = imq_nf_hook,
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .pf = PF_INET,
|
||||
+ .hooknum = NF_IP_POST_ROUTING,
|
||||
+#if defined(CONFIG_IMQ_BEHAVIOR_AA) || defined(CONFIG_IMQ_BEHAVIOR_BA)
|
||||
+ .priority = NF_IP_PRI_LAST
|
||||
+#else
|
||||
+ .priority = NF_IP_PRI_NAT_SRC - 1
|
||||
+#endif
|
||||
+};
|
||||
+
|
||||
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
|
||||
+static struct nf_hook_ops imq_ingress_ipv6 = {
|
||||
+ .hook = imq_nf_hook,
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .pf = PF_INET6,
|
||||
+ .hooknum = NF_IP6_PRE_ROUTING,
|
||||
+#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB)
|
||||
+ .priority = NF_IP6_PRI_MANGLE + 1
|
||||
+#else
|
||||
+ .priority = NF_IP6_PRI_NAT_DST + 1
|
||||
+#endif
|
||||
+};
|
||||
+
|
||||
+static struct nf_hook_ops imq_egress_ipv6 = {
|
||||
+ .hook = imq_nf_hook,
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .pf = PF_INET6,
|
||||
+ .hooknum = NF_IP6_POST_ROUTING,
|
||||
+#if defined(CONFIG_IMQ_BEHAVIOR_AA) || defined(CONFIG_IMQ_BEHAVIOR_BA)
|
||||
+ .priority = NF_IP6_PRI_LAST
|
||||
+#else
|
||||
+ .priority = NF_IP6_PRI_NAT_SRC - 1
|
||||
+#endif
|
||||
+};
|
||||
+#endif
|
||||
+
|
||||
+#if defined(CONFIG_IMQ_NUM_DEVS)
|
||||
+static unsigned int numdevs = CONFIG_IMQ_NUM_DEVS;
|
||||
+#else
|
||||
+static unsigned int numdevs = 16;
|
||||
+#endif
|
||||
+
|
||||
+static struct net_device *imq_devs;
|
||||
+
|
||||
+static struct net_device_stats *imq_get_stats(struct net_device *dev)
|
||||
+{
|
||||
+ return (struct net_device_stats *)dev->priv;
|
||||
+}
|
||||
+
|
||||
+/* called for packets kfree'd in qdiscs at places other than enqueue */
|
||||
+static void imq_skb_destructor(struct sk_buff *skb)
|
||||
+{
|
||||
+ struct nf_info *info = skb->nf_info;
|
||||
+
|
||||
+ if (info) {
|
||||
+ if (info->indev)
|
||||
+ dev_put(info->indev);
|
||||
+ if (info->outdev)
|
||||
+ dev_put(info->outdev);
|
||||
+ kfree(info);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int imq_dev_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
+{
|
||||
+ struct net_device_stats *stats = (struct net_device_stats*) dev->priv;
|
||||
+
|
||||
+ stats->tx_bytes += skb->len;
|
||||
+ stats->tx_packets++;
|
||||
+
|
||||
+ skb->imq_flags = 0;
|
||||
+ skb->destructor = NULL;
|
||||
+
|
||||
+ dev->trans_start = jiffies;
|
||||
+ nf_reinject(skb, skb->nf_info, NF_ACCEPT);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int imq_nf_queue(struct sk_buff *skb, struct nf_info *info, unsigned queue_num, void *data)
|
||||
+{
|
||||
+ struct net_device *dev;
|
||||
+ struct net_device_stats *stats;
|
||||
+ struct sk_buff *skb2 = NULL;
|
||||
+ struct Qdisc *q;
|
||||
+ unsigned int index = skb->imq_flags&IMQ_F_IFMASK;
|
||||
+ int ret = -1;
|
||||
+
|
||||
+ if (index > numdevs)
|
||||
+ return -1;
|
||||
+
|
||||
+ dev = imq_devs + index;
|
||||
+ if (!(dev->flags & IFF_UP)) {
|
||||
+ skb->imq_flags = 0;
|
||||
+ nf_reinject(skb, info, NF_ACCEPT);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ dev->last_rx = jiffies;
|
||||
+
|
||||
+ if (skb->destructor) {
|
||||
+ skb2 = skb;
|
||||
+ skb = skb_clone(skb, GFP_ATOMIC);
|
||||
+ if (!skb)
|
||||
+ return -1;
|
||||
+ }
|
||||
+ skb->nf_info = info;
|
||||
+
|
||||
+ stats = (struct net_device_stats *)dev->priv;
|
||||
+ stats->rx_bytes+= skb->len;
|
||||
+ stats->rx_packets++;
|
||||
+
|
||||
+ spin_lock_bh(&dev->queue_lock);
|
||||
+ q = dev->qdisc;
|
||||
+ if (q->enqueue) {
|
||||
+ q->enqueue(skb_get(skb), q);
|
||||
+ if (skb_shared(skb)) {
|
||||
+ skb->destructor = imq_skb_destructor;
|
||||
+ kfree_skb(skb);
|
||||
+ ret = 0;
|
||||
+ }
|
||||
+ }
|
||||
+ if (spin_is_locked(&dev->_xmit_lock))
|
||||
+ netif_schedule(dev);
|
||||
+ else
|
||||
+ while (!netif_queue_stopped(dev) && qdisc_restart1(dev) < 0)
|
||||
+ /* NOTHING */;
|
||||
+
|
||||
+ spin_unlock_bh(&dev->queue_lock);
|
||||
+
|
||||
+ if (skb2)
|
||||
+ kfree_skb(ret ? skb : skb2);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static struct nf_queue_handler nfqh = {
|
||||
+ .name = "imq",
|
||||
+ .outfn = imq_nf_queue,
|
||||
+};
|
||||
+
|
||||
+static unsigned int imq_nf_hook(unsigned int hook, struct sk_buff *pskb,
|
||||
+ const struct net_device *indev,
|
||||
+ const struct net_device *outdev,
|
||||
+ int (*okfn)(struct sk_buff *))
|
||||
+{
|
||||
+ if (pskb->imq_flags & IMQ_F_ENQUEUE)
|
||||
+ return NF_QUEUE;
|
||||
+
|
||||
+ return NF_ACCEPT;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int __init imq_init_hooks(void)
|
||||
+{
|
||||
+ int err;
|
||||
+
|
||||
+ err = nf_register_queue_handler(PF_INET, &nfqh);
|
||||
+ if (err > 0)
|
||||
+ goto err1;
|
||||
+ if ((err = nf_register_hook(&imq_ingress_ipv4)))
|
||||
+ goto err2;
|
||||
+ if ((err = nf_register_hook(&imq_egress_ipv4)))
|
||||
+ goto err3;
|
||||
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
|
||||
+ if ((err = nf_register_queue_handler(PF_INET6, &nfqh)))
|
||||
+ goto err4;
|
||||
+ if ((err = nf_register_hook(&imq_ingress_ipv6)))
|
||||
+ goto err5;
|
||||
+ if ((err = nf_register_hook(&imq_egress_ipv6)))
|
||||
+ goto err6;
|
||||
+#endif
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
|
||||
+err6:
|
||||
+ nf_unregister_hook(&imq_ingress_ipv6);
|
||||
+err5:
|
||||
+ nf_unregister_queue_handler(PF_INET6, &nfqh);
|
||||
+err4:
|
||||
+ nf_unregister_hook(&imq_egress_ipv4);
|
||||
+#endif
|
||||
+err3:
|
||||
+ nf_unregister_hook(&imq_ingress_ipv4);
|
||||
+err2:
|
||||
+ nf_unregister_queue_handler(PF_INET, &nfqh);
|
||||
+err1:
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+static void __exit imq_unhook(void)
|
||||
+{
|
||||
+#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
|
||||
+ nf_unregister_hook(&imq_ingress_ipv6);
|
||||
+ nf_unregister_hook(&imq_egress_ipv6);
|
||||
+ nf_unregister_queue_handler(PF_INET6, &nfqh);
|
||||
+#endif
|
||||
+ nf_unregister_hook(&imq_ingress_ipv4);
|
||||
+ nf_unregister_hook(&imq_egress_ipv4);
|
||||
+ nf_unregister_queue_handler(PF_INET, &nfqh);
|
||||
+}
|
||||
+
|
||||
+static int __init imq_dev_init(struct net_device *dev)
|
||||
+{
|
||||
+ dev->hard_start_xmit = imq_dev_xmit;
|
||||
+ dev->type = ARPHRD_VOID;
|
||||
+ dev->mtu = 16000;
|
||||
+ dev->tx_queue_len = 11000;
|
||||
+ dev->flags = IFF_NOARP;
|
||||
+ dev->priv = kzalloc(sizeof(struct net_device_stats), GFP_KERNEL);
|
||||
+ if (dev->priv == NULL)
|
||||
+ return -ENOMEM;
|
||||
+ dev->get_stats = imq_get_stats;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void imq_dev_uninit(struct net_device *dev)
|
||||
+{
|
||||
+ kfree(dev->priv);
|
||||
+}
|
||||
+
|
||||
+static int __init imq_init_devs(struct net *net)
|
||||
+{
|
||||
+ struct net_device *dev;
|
||||
+ int i,j;
|
||||
+ j = numdevs;
|
||||
+
|
||||
+ if (!numdevs || numdevs > IMQ_MAX_DEVS) {
|
||||
+ printk(KERN_ERR "IMQ: numdevs has to be betweed 1 and %u\n",
|
||||
+ IMQ_MAX_DEVS);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ imq_devs = kzalloc(sizeof(struct net_device) * numdevs, GFP_KERNEL);
|
||||
+ if (!imq_devs)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ /* we start counting at zero */
|
||||
+ numdevs--;
|
||||
+
|
||||
+ for (i = 0, dev = imq_devs; i <= numdevs; i++, dev++) {
|
||||
+ strcpy(dev->name, "imq%d");
|
||||
+ dev->init = imq_dev_init;
|
||||
+ dev->uninit = imq_dev_uninit;
|
||||
+ dev->nd_net = net;
|
||||
+
|
||||
+ if (register_netdev(dev) < 0)
|
||||
+ goto err_register;
|
||||
+ }
|
||||
+ printk(KERN_INFO "IMQ starting with %u devices...\n", j);
|
||||
+ return 0;
|
||||
+
|
||||
+err_register:
|
||||
+ for (; i; i--)
|
||||
+ unregister_netdev(--dev);
|
||||
+ kfree(imq_devs);
|
||||
+ return -EIO;
|
||||
+}
|
||||
+
|
||||
+static void imq_cleanup_devs(void)
|
||||
+{
|
||||
+ int i;
|
||||
+ struct net_device *dev = imq_devs;
|
||||
+
|
||||
+ for (i = 0; i <= numdevs; i++)
|
||||
+ unregister_netdev(dev++);
|
||||
+
|
||||
+ kfree(imq_devs);
|
||||
+}
|
||||
+
|
||||
+static __net_init int imq_init_module(struct net *net)
|
||||
+{
|
||||
+ int err;
|
||||
+
|
||||
+ if ((err = imq_init_devs(net))) {
|
||||
+ printk(KERN_ERR "IMQ: Error trying imq_init_devs(net)\n");
|
||||
+ return err;
|
||||
+ }
|
||||
+ if ((err = imq_init_hooks())) {
|
||||
+ printk(KERN_ERR "IMQ: Error trying imq_init_hooks()\n");
|
||||
+ imq_cleanup_devs();
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ printk(KERN_INFO "IMQ driver loaded successfully.\n");
|
||||
+
|
||||
+#if defined(CONFIG_IMQ_BEHAVIOR_BA) || defined(CONFIG_IMQ_BEHAVIOR_BB)
|
||||
+ printk(KERN_INFO "\tHooking IMQ before NAT on PREROUTING.\n");
|
||||
+#else
|
||||
+ printk(KERN_INFO "\tHooking IMQ after NAT on PREROUTING.\n");
|
||||
+#endif
|
||||
+#if defined(CONFIG_IMQ_BEHAVIOR_AB) || defined(CONFIG_IMQ_BEHAVIOR_BB)
|
||||
+ printk(KERN_INFO "\tHooking IMQ before NAT on POSTROUTING.\n");
|
||||
+#else
|
||||
+ printk(KERN_INFO "\tHooking IMQ after NAT on POSTROUTING.\n");
|
||||
+#endif
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static __net_exit void imq_exit_module(struct net *net)
|
||||
+{
|
||||
+ imq_unhook();
|
||||
+ imq_cleanup_devs();
|
||||
+ printk(KERN_INFO "IMQ driver unloaded successfully.\n");
|
||||
+}
|
||||
+
|
||||
+static struct pernet_operations __net_initdata imq_net_ops = {
|
||||
+ .init = imq_init_module,
|
||||
+ .exit = imq_exit_module,
|
||||
+};
|
||||
+
|
||||
+static int __init imq_init(void)
|
||||
+{
|
||||
+ return register_pernet_device(&imq_net_ops);
|
||||
+}
|
||||
+
|
||||
+module_init(imq_init);
|
||||
+//module_exit(imq_cleanup_module);
|
||||
+
|
||||
+module_param(numdevs, int, 0);
|
||||
+MODULE_PARM_DESC(numdevs, "number of IMQ devices (how many imq* devices will be created)");
|
||||
+MODULE_AUTHOR("http://www.linuximq.net");
|
||||
+MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See http://www.linuximq.net/ for more information.");
|
||||
+MODULE_LICENSE("GPL");
|
||||
--- a/drivers/net/Kconfig
|
||||
+++ b/drivers/net/Kconfig
|
||||
@@ -112,6 +112,129 @@ config EQUALIZER
|
||||
To compile this driver as a module, choose M here: the module
|
||||
will be called eql. If unsure, say N.
|
||||
|
||||
+config IMQ
|
||||
+ tristate "IMQ (intermediate queueing device) support"
|
||||
+ depends on NETDEVICES && NETFILTER
|
||||
+ ---help---
|
||||
+ The IMQ device(s) is used as placeholder for QoS queueing
|
||||
+ disciplines. Every packet entering/leaving the IP stack can be
|
||||
+ directed through the IMQ device where it's enqueued/dequeued to the
|
||||
+ attached qdisc. This allows you to treat network devices as classes
|
||||
+ and distribute bandwidth among them. Iptables is used to specify
|
||||
+ through which IMQ device, if any, packets travel.
|
||||
+
|
||||
+ More information at: http://www.linuximq.net/
|
||||
+
|
||||
+ To compile this driver as a module, choose M here: the module
|
||||
+ will be called imq. If unsure, say N.
|
||||
+
|
||||
+choice
|
||||
+ prompt "IMQ behavior (PRE/POSTROUTING)"
|
||||
+ depends on IMQ
|
||||
+ default IMQ_BEHAVIOR_BB
|
||||
+ help
|
||||
+
|
||||
+ This settings defines how IMQ behaves in respect to its
|
||||
+ hooking in PREROUTING and POSTROUTING.
|
||||
+
|
||||
+ IMQ can work in any of the following ways:
|
||||
+
|
||||
+ PREROUTING | POSTROUTING
|
||||
+ -----------------|-------------------
|
||||
+ #1 After NAT | After NAT
|
||||
+ #2 After NAT | Before NAT
|
||||
+ #3 Before NAT | After NAT
|
||||
+ #4 Before NAT | Before NAT
|
||||
+
|
||||
+ The default behavior is to hook before NAT on PREROUTING
|
||||
+ and after NAT on POSTROUTING (#3).
|
||||
+
|
||||
+ This settings are specially usefull when trying to use IMQ
|
||||
+ to shape NATed clients.
|
||||
+
|
||||
+ More information can be found at: www.linuximq.net
|
||||
+
|
||||
+ If not sure leave the default settings alone.
|
||||
+
|
||||
+config IMQ_BEHAVIOR_AA
|
||||
+ bool "IMQ AA"
|
||||
+ help
|
||||
+ This settings defines how IMQ behaves in respect to its
|
||||
+ hooking in PREROUTING and POSTROUTING.
|
||||
+
|
||||
+ Choosing this option will make IMQ hook like this:
|
||||
+
|
||||
+ PREROUTING: After NAT
|
||||
+ POSTROUTING: After NAT
|
||||
+
|
||||
+ More information can be found at: www.linuximq.net
|
||||
+
|
||||
+ If not sure leave the default settings alone.
|
||||
+
|
||||
+config IMQ_BEHAVIOR_AB
|
||||
+ bool "IMQ AB"
|
||||
+ help
|
||||
+ This settings defines how IMQ behaves in respect to its
|
||||
+ hooking in PREROUTING and POSTROUTING.
|
||||
+
|
||||
+ Choosing this option will make IMQ hook like this:
|
||||
+
|
||||
+ PREROUTING: After NAT
|
||||
+ POSTROUTING: Before NAT
|
||||
+
|
||||
+ More information can be found at: www.linuximq.net
|
||||
+
|
||||
+ If not sure leave the default settings alone.
|
||||
+
|
||||
+config IMQ_BEHAVIOR_BA
|
||||
+ bool "IMQ BA"
|
||||
+ help
|
||||
+ This settings defines how IMQ behaves in respect to its
|
||||
+ hooking in PREROUTING and POSTROUTING.
|
||||
+
|
||||
+ Choosing this option will make IMQ hook like this:
|
||||
+
|
||||
+ PREROUTING: Before NAT
|
||||
+ POSTROUTING: After NAT
|
||||
+
|
||||
+ More information can be found at: www.linuximq.net
|
||||
+
|
||||
+ If not sure leave the default settings alone.
|
||||
+
|
||||
+config IMQ_BEHAVIOR_BB
|
||||
+ bool "IMQ BB"
|
||||
+ help
|
||||
+ This settings defines how IMQ behaves in respect to its
|
||||
+ hooking in PREROUTING and POSTROUTING.
|
||||
+
|
||||
+ Choosing this option will make IMQ hook like this:
|
||||
+
|
||||
+ PREROUTING: Before NAT
|
||||
+ POSTROUTING: Before NAT
|
||||
+
|
||||
+ More information can be found at: www.linuximq.net
|
||||
+
|
||||
+ If not sure leave the default settings alone.
|
||||
+
|
||||
+endchoice
|
||||
+
|
||||
+config IMQ_NUM_DEVS
|
||||
+
|
||||
+ int "Number of IMQ devices"
|
||||
+ range 2 16
|
||||
+ depends on IMQ
|
||||
+ default "16"
|
||||
+ help
|
||||
+
|
||||
+ This settings defines how many IMQ devices will be
|
||||
+ created.
|
||||
+
|
||||
+ The default value is 16.
|
||||
+
|
||||
+ More information can be found at: www.linuximq.net
|
||||
+
|
||||
+ If not sure leave the default settings alone.
|
||||
+
|
||||
config TUN
|
||||
tristate "Universal TUN/TAP device driver support"
|
||||
select CRC32
|
||||
--- a/drivers/net/Makefile
|
||||
+++ b/drivers/net/Makefile
|
||||
@@ -139,6 +139,7 @@ obj-$(CONFIG_SLHC) += slhc.o
|
||||
obj-$(CONFIG_XEN_NETDEV_FRONTEND) += xen-netfront.o
|
||||
|
||||
obj-$(CONFIG_DUMMY) += dummy.o
|
||||
+obj-$(CONFIG_IMQ) += imq.o
|
||||
obj-$(CONFIG_IFB) += ifb.o
|
||||
obj-$(CONFIG_MACVLAN) += macvlan.o
|
||||
obj-$(CONFIG_DE600) += de600.o
|
||||
--- /dev/null
|
||||
+++ b/include/linux/imq.h
|
||||
@@ -0,0 +1,9 @@
|
||||
+#ifndef _IMQ_H
|
||||
+#define _IMQ_H
|
||||
+
|
||||
+#define IMQ_MAX_DEVS 16
|
||||
+
|
||||
+#define IMQ_F_IFMASK 0x7f
|
||||
+#define IMQ_F_ENQUEUE 0x80
|
||||
+
|
||||
+#endif /* _IMQ_H */
|
||||
--- /dev/null
|
||||
+++ b/include/linux/netfilter_ipv4/ipt_IMQ.h
|
||||
@@ -0,0 +1,8 @@
|
||||
+#ifndef _IPT_IMQ_H
|
||||
+#define _IPT_IMQ_H
|
||||
+
|
||||
+struct ipt_imq_info {
|
||||
+ unsigned int todev; /* target imq device */
|
||||
+};
|
||||
+
|
||||
+#endif /* _IPT_IMQ_H */
|
||||
--- /dev/null
|
||||
+++ b/include/linux/netfilter_ipv6/ip6t_IMQ.h
|
||||
@@ -0,0 +1,8 @@
|
||||
+#ifndef _IP6T_IMQ_H
|
||||
+#define _IP6T_IMQ_H
|
||||
+
|
||||
+struct ip6t_imq_info {
|
||||
+ unsigned int todev; /* target imq device */
|
||||
+};
|
||||
+
|
||||
+#endif /* _IP6T_IMQ_H */
|
||||
--- a/include/linux/skbuff.h
|
||||
+++ b/include/linux/skbuff.h
|
||||
@@ -295,6 +295,10 @@ struct sk_buff {
|
||||
struct nf_conntrack *nfct;
|
||||
struct sk_buff *nfct_reasm;
|
||||
#endif
|
||||
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
|
||||
+ unsigned char imq_flags;
|
||||
+ struct nf_info *nf_info;
|
||||
+#endif
|
||||
#ifdef CONFIG_BRIDGE_NETFILTER
|
||||
struct nf_bridge_info *nf_bridge;
|
||||
#endif
|
||||
@@ -1728,6 +1732,10 @@ static inline void __nf_copy(struct sk_b
|
||||
dst->nfct_reasm = src->nfct_reasm;
|
||||
nf_conntrack_get_reasm(src->nfct_reasm);
|
||||
#endif
|
||||
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
|
||||
+ dst->imq_flags = src->imq_flags;
|
||||
+ dst->nf_info = src->nf_info;
|
||||
+#endif
|
||||
#ifdef CONFIG_BRIDGE_NETFILTER
|
||||
dst->nf_bridge = src->nf_bridge;
|
||||
nf_bridge_get(src->nf_bridge);
|
||||
--- a/net/core/dev.c
|
||||
+++ b/net/core/dev.c
|
||||
@@ -95,6 +95,9 @@
|
||||
#include <net/net_namespace.h>
|
||||
#include <net/sock.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
|
||||
+#include <linux/imq.h>
|
||||
+#endif
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/stat.h>
|
||||
@@ -1533,7 +1536,11 @@ static int dev_gso_segment(struct sk_buf
|
||||
int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
if (likely(!skb->next)) {
|
||||
- if (!list_empty(&ptype_all))
|
||||
+ if (!list_empty(&ptype_all)
|
||||
+#if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE)
|
||||
+ && !(skb->imq_flags & IMQ_F_ENQUEUE)
|
||||
+#endif
|
||||
+ )
|
||||
dev_queue_xmit_nit(skb, dev);
|
||||
|
||||
if (netif_needs_gso(dev, skb)) {
|
||||
--- /dev/null
|
||||
+++ b/net/ipv4/netfilter/ipt_IMQ.c
|
||||
@@ -0,0 +1,69 @@
|
||||
+/*
|
||||
+ * This target marks packets to be enqueued to an imq device
|
||||
+ */
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/skbuff.h>
|
||||
+#include <linux/netfilter_ipv4/ip_tables.h>
|
||||
+#include <linux/netfilter_ipv4/ipt_IMQ.h>
|
||||
+#include <linux/imq.h>
|
||||
+
|
||||
+static unsigned int imq_target(struct sk_buff *pskb,
|
||||
+ const struct net_device *in,
|
||||
+ const struct net_device *out,
|
||||
+ unsigned int hooknum,
|
||||
+ const struct xt_target *target,
|
||||
+ const void *targinfo)
|
||||
+{
|
||||
+ struct ipt_imq_info *mr = (struct ipt_imq_info*)targinfo;
|
||||
+
|
||||
+ pskb->imq_flags = mr->todev | IMQ_F_ENQUEUE;
|
||||
+
|
||||
+ return XT_CONTINUE;
|
||||
+}
|
||||
+
|
||||
+static bool imq_checkentry(const char *tablename,
|
||||
+ const void *e,
|
||||
+ const struct xt_target *target,
|
||||
+ void *targinfo,
|
||||
+ unsigned int hook_mask)
|
||||
+{
|
||||
+ struct ipt_imq_info *mr;
|
||||
+
|
||||
+ mr = (struct ipt_imq_info*)targinfo;
|
||||
+
|
||||
+ if (mr->todev > IMQ_MAX_DEVS) {
|
||||
+ printk(KERN_WARNING
|
||||
+ "IMQ: invalid device specified, highest is %u\n",
|
||||
+ IMQ_MAX_DEVS);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static struct xt_target ipt_imq_reg = {
|
||||
+ .name = "IMQ",
|
||||
+ .family = AF_INET,
|
||||
+ .target = imq_target,
|
||||
+ .targetsize = sizeof(struct ipt_imq_info),
|
||||
+ .checkentry = imq_checkentry,
|
||||
+ .me = THIS_MODULE,
|
||||
+ .table = "mangle"
|
||||
+};
|
||||
+
|
||||
+static int __init init(void)
|
||||
+{
|
||||
+ return xt_register_target(&ipt_imq_reg);
|
||||
+}
|
||||
+
|
||||
+static void __exit fini(void)
|
||||
+{
|
||||
+ xt_unregister_target(&ipt_imq_reg);
|
||||
+}
|
||||
+
|
||||
+module_init(init);
|
||||
+module_exit(fini);
|
||||
+
|
||||
+MODULE_AUTHOR("http://www.linuximq.net");
|
||||
+MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See http://www.linuximq.net/ for more information.");
|
||||
+MODULE_LICENSE("GPL");
|
||||
--- a/net/ipv4/netfilter/Kconfig
|
||||
+++ b/net/ipv4/netfilter/Kconfig
|
||||
@@ -327,6 +327,17 @@ config IP_NF_MANGLE
|
||||
|
||||
To compile it as a module, choose M here. If unsure, say N.
|
||||
|
||||
+config IP_NF_TARGET_IMQ
|
||||
+ tristate "IMQ target support"
|
||||
+ depends on IP_NF_MANGLE
|
||||
+ help
|
||||
+ This option adds a `IMQ' target which is used to specify if and
|
||||
+ to which IMQ device packets should get enqueued/dequeued.
|
||||
+
|
||||
+ For more information visit: http://www.linuximq.net/
|
||||
+
|
||||
+ To compile it as a module, choose M here. If unsure, say N.
|
||||
+
|
||||
config IP_NF_TARGET_TOS
|
||||
tristate "TOS target support"
|
||||
depends on IP_NF_MANGLE
|
||||
--- a/net/ipv4/netfilter/Makefile
|
||||
+++ b/net/ipv4/netfilter/Makefile
|
||||
@@ -56,6 +56,7 @@ obj-$(CONFIG_IP_NF_MATCH_TIME) += ipt_ti
|
||||
obj-$(CONFIG_IP_NF_TARGET_CLUSTERIP) += ipt_CLUSTERIP.o
|
||||
obj-$(CONFIG_IP_NF_TARGET_ECN) += ipt_ECN.o
|
||||
obj-$(CONFIG_IP_NF_TARGET_LOG) += ipt_LOG.o
|
||||
+obj-$(CONFIG_IP_NF_TARGET_IMQ) += ipt_IMQ.o
|
||||
obj-$(CONFIG_IP_NF_TARGET_MASQUERADE) += ipt_MASQUERADE.o
|
||||
obj-$(CONFIG_IP_NF_TARGET_NETMAP) += ipt_NETMAP.o
|
||||
obj-$(CONFIG_IP_NF_TARGET_REDIRECT) += ipt_REDIRECT.o
|
||||
--- /dev/null
|
||||
+++ b/net/ipv6/netfilter/ip6t_IMQ.c
|
||||
@@ -0,0 +1,69 @@
|
||||
+/*
|
||||
+ * This target marks packets to be enqueued to an imq device
|
||||
+ */
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/skbuff.h>
|
||||
+#include <linux/netfilter_ipv6/ip6_tables.h>
|
||||
+#include <linux/netfilter_ipv6/ip6t_IMQ.h>
|
||||
+#include <linux/imq.h>
|
||||
+
|
||||
+static unsigned int imq_target(struct sk_buff *pskb,
|
||||
+ const struct net_device *in,
|
||||
+ const struct net_device *out,
|
||||
+ unsigned int hooknum,
|
||||
+ const struct xt_target *target,
|
||||
+ const void *targinfo)
|
||||
+{
|
||||
+ struct ip6t_imq_info *mr = (struct ip6t_imq_info*)targinfo;
|
||||
+
|
||||
+ pskb->imq_flags = mr->todev | IMQ_F_ENQUEUE;
|
||||
+
|
||||
+ return XT_CONTINUE;
|
||||
+}
|
||||
+
|
||||
+static bool imq_checkentry(const char *tablename,
|
||||
+ const void *entry,
|
||||
+ const struct xt_target *target,
|
||||
+ void *targinfo,
|
||||
+ unsigned int hook_mask)
|
||||
+{
|
||||
+ struct ip6t_imq_info *mr;
|
||||
+
|
||||
+ mr = (struct ip6t_imq_info*)targinfo;
|
||||
+
|
||||
+ if (mr->todev > IMQ_MAX_DEVS) {
|
||||
+ printk(KERN_WARNING
|
||||
+ "IMQ: invalid device specified, highest is %u\n",
|
||||
+ IMQ_MAX_DEVS);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static struct xt_target ip6t_imq_reg = {
|
||||
+ .name = "IMQ",
|
||||
+ .family = AF_INET6,
|
||||
+ .target = imq_target,
|
||||
+ .targetsize = sizeof(struct ip6t_imq_info),
|
||||
+ .table = "mangle",
|
||||
+ .checkentry = imq_checkentry,
|
||||
+ .me = THIS_MODULE
|
||||
+};
|
||||
+
|
||||
+static int __init init(void)
|
||||
+{
|
||||
+ return xt_register_target(&ip6t_imq_reg);
|
||||
+}
|
||||
+
|
||||
+static void __exit fini(void)
|
||||
+{
|
||||
+ xt_unregister_target(&ip6t_imq_reg);
|
||||
+}
|
||||
+
|
||||
+module_init(init);
|
||||
+module_exit(fini);
|
||||
+
|
||||
+MODULE_AUTHOR("http://www.linuximq.net");
|
||||
+MODULE_DESCRIPTION("Pseudo-driver for the intermediate queue device. See http://www.linuximq.net/ for more information.");
|
||||
+MODULE_LICENSE("GPL");
|
||||
--- a/net/ipv6/netfilter/Kconfig
|
||||
+++ b/net/ipv6/netfilter/Kconfig
|
||||
@@ -173,6 +173,15 @@ config IP6_NF_MANGLE
|
||||
|
||||
To compile it as a module, choose M here. If unsure, say N.
|
||||
|
||||
+config IP6_NF_TARGET_IMQ
|
||||
+ tristate "IMQ target support"
|
||||
+ depends on IP6_NF_MANGLE
|
||||
+ help
|
||||
+ This option adds a `IMQ' target which is used to specify if and
|
||||
+ to which imq device packets should get enqueued/dequeued.
|
||||
+
|
||||
+ To compile it as a module, choose M here. If unsure, say N.
|
||||
+
|
||||
config IP6_NF_TARGET_HL
|
||||
tristate 'HL (hoplimit) target support'
|
||||
depends on IP6_NF_MANGLE
|
||||
--- a/net/ipv6/netfilter/Makefile
|
||||
+++ b/net/ipv6/netfilter/Makefile
|
||||
@@ -6,6 +6,7 @@
|
||||
obj-$(CONFIG_IP6_NF_IPTABLES) += ip6_tables.o
|
||||
obj-$(CONFIG_IP6_NF_FILTER) += ip6table_filter.o
|
||||
obj-$(CONFIG_IP6_NF_MANGLE) += ip6table_mangle.o
|
||||
+obj-$(CONFIG_IP6_NF_TARGET_IMQ) += ip6t_IMQ.o
|
||||
obj-$(CONFIG_IP6_NF_QUEUE) += ip6_queue.o
|
||||
obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o
|
||||
|
||||
--- a/net/sched/sch_generic.c
|
||||
+++ b/net/sched/sch_generic.c
|
||||
@@ -176,6 +176,11 @@ static inline int qdisc_restart(struct n
|
||||
return ret;
|
||||
}
|
||||
|
||||
+int qdisc_restart1(struct net_device *dev)
|
||||
+{
|
||||
+ return qdisc_restart(dev);
|
||||
+}
|
||||
+
|
||||
void __qdisc_run(struct net_device *dev)
|
||||
{
|
||||
unsigned long start_time = jiffies;
|
||||
@@ -650,3 +655,4 @@ EXPORT_SYMBOL(qdisc_destroy);
|
||||
EXPORT_SYMBOL(qdisc_reset);
|
||||
EXPORT_SYMBOL(qdisc_lock_tree);
|
||||
EXPORT_SYMBOL(qdisc_unlock_tree);
|
||||
+EXPORT_SYMBOL(qdisc_restart1);
|
|
@ -1,20 +0,0 @@
|
|||
--- a/net/netfilter/Kconfig
|
||||
+++ b/net/netfilter/Kconfig
|
||||
@@ -143,7 +143,7 @@ config NF_CONNTRACK_FTP
|
||||
|
||||
config NF_CONNTRACK_H323
|
||||
tristate "H.323 protocol support (EXPERIMENTAL)"
|
||||
- depends on EXPERIMENTAL && NF_CONNTRACK && (IPV6 || IPV6=n)
|
||||
+ depends on EXPERIMENTAL && NF_CONNTRACK
|
||||
help
|
||||
H.323 is a VoIP signalling protocol from ITU-T. As one of the most
|
||||
important VoIP protocols, it is widely used by voice hardware and
|
||||
@@ -387,7 +387,7 @@ config NETFILTER_XT_TARGET_CONNSECMARK
|
||||
|
||||
config NETFILTER_XT_TARGET_TCPMSS
|
||||
tristate '"TCPMSS" target support'
|
||||
- depends on NETFILTER_XTABLES && (IPV6 || IPV6=n)
|
||||
+ depends on NETFILTER_XTABLES
|
||||
---help---
|
||||
This option adds a `TCPMSS' target, which allows you to alter the
|
||||
MSS value of TCP SYN packets, to control the maximum size for that
|
File diff suppressed because it is too large
Load Diff
|
@ -1,795 +0,0 @@
|
|||
--- a/include/linux/pkt_sched.h
|
||||
+++ b/include/linux/pkt_sched.h
|
||||
@@ -155,8 +155,37 @@ struct tc_sfq_qopt
|
||||
*
|
||||
* The only reason for this is efficiency, it is possible
|
||||
* to change these parameters in compile time.
|
||||
+ *
|
||||
+ * If you need to play with these values, use esfq instead.
|
||||
*/
|
||||
|
||||
+/* ESFQ section */
|
||||
+
|
||||
+enum
|
||||
+{
|
||||
+ /* traditional */
|
||||
+ TCA_SFQ_HASH_CLASSIC,
|
||||
+ TCA_SFQ_HASH_DST,
|
||||
+ TCA_SFQ_HASH_SRC,
|
||||
+ TCA_SFQ_HASH_FWMARK,
|
||||
+ /* conntrack */
|
||||
+ TCA_SFQ_HASH_CTORIGDST,
|
||||
+ TCA_SFQ_HASH_CTORIGSRC,
|
||||
+ TCA_SFQ_HASH_CTREPLDST,
|
||||
+ TCA_SFQ_HASH_CTREPLSRC,
|
||||
+ TCA_SFQ_HASH_CTNATCHG,
|
||||
+};
|
||||
+
|
||||
+struct tc_esfq_qopt
|
||||
+{
|
||||
+ unsigned quantum; /* Bytes per round allocated to flow */
|
||||
+ int perturb_period; /* Period of hash perturbation */
|
||||
+ __u32 limit; /* Maximal packets in queue */
|
||||
+ unsigned divisor; /* Hash divisor */
|
||||
+ unsigned flows; /* Maximal number of flows */
|
||||
+ unsigned hash_kind; /* Hash function to use for flow identification */
|
||||
+};
|
||||
+
|
||||
/* RED section */
|
||||
|
||||
enum
|
||||
--- a/net/sched/Kconfig
|
||||
+++ b/net/sched/Kconfig
|
||||
@@ -139,6 +139,37 @@ config NET_SCH_SFQ
|
||||
To compile this code as a module, choose M here: the
|
||||
module will be called sch_sfq.
|
||||
|
||||
+config NET_SCH_ESFQ
|
||||
+ tristate "Enhanced Stochastic Fairness Queueing (ESFQ)"
|
||||
+ ---help---
|
||||
+ Say Y here if you want to use the Enhanced Stochastic Fairness
|
||||
+ Queueing (ESFQ) packet scheduling algorithm for some of your network
|
||||
+ devices or as a leaf discipline for a classful qdisc such as HTB or
|
||||
+ CBQ (see the top of <file:net/sched/sch_esfq.c> for details and
|
||||
+ references to the SFQ algorithm).
|
||||
+
|
||||
+ This is an enchanced SFQ version which allows you to control some
|
||||
+ hardcoded values in the SFQ scheduler.
|
||||
+
|
||||
+ ESFQ also adds control of the hash function used to identify packet
|
||||
+ flows. The original SFQ discipline hashes by connection; ESFQ add
|
||||
+ several other hashing methods, such as by src IP or by dst IP, which
|
||||
+ can be more fair to users in some networking situations.
|
||||
+
|
||||
+ To compile this code as a module, choose M here: the
|
||||
+ module will be called sch_esfq.
|
||||
+
|
||||
+config NET_SCH_ESFQ_NFCT
|
||||
+ bool "Connection Tracking Hash Types"
|
||||
+ depends on NET_SCH_ESFQ && NF_CONNTRACK
|
||||
+ ---help---
|
||||
+ Say Y here to enable support for hashing based on netfilter connection
|
||||
+ tracking information. This is useful for a router that is also using
|
||||
+ NAT to connect privately-addressed hosts to the Internet. If you want
|
||||
+ to provide fair distribution of upstream bandwidth, ESFQ must use
|
||||
+ connection tracking information, since all outgoing packets will share
|
||||
+ the same source address.
|
||||
+
|
||||
config NET_SCH_TEQL
|
||||
tristate "True Link Equalizer (TEQL)"
|
||||
---help---
|
||||
--- a/net/sched/Makefile
|
||||
+++ b/net/sched/Makefile
|
||||
@@ -23,6 +23,7 @@ obj-$(CONFIG_NET_SCH_GRED) += sch_gred.o
|
||||
obj-$(CONFIG_NET_SCH_INGRESS) += sch_ingress.o
|
||||
obj-$(CONFIG_NET_SCH_DSMARK) += sch_dsmark.o
|
||||
obj-$(CONFIG_NET_SCH_SFQ) += sch_sfq.o
|
||||
+obj-$(CONFIG_NET_SCH_ESFQ) += sch_esfq.o
|
||||
obj-$(CONFIG_NET_SCH_TBF) += sch_tbf.o
|
||||
obj-$(CONFIG_NET_SCH_TEQL) += sch_teql.o
|
||||
obj-$(CONFIG_NET_SCH_PRIO) += sch_prio.o
|
||||
--- /dev/null
|
||||
+++ b/net/sched/sch_esfq.c
|
||||
@@ -0,0 +1,702 @@
|
||||
+/*
|
||||
+ * net/sched/sch_esfq.c Extended Stochastic Fairness Queueing discipline.
|
||||
+ *
|
||||
+ * 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.
|
||||
+ *
|
||||
+ * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
|
||||
+ *
|
||||
+ * Changes: Alexander Atanasov, <alex@ssi.bg>
|
||||
+ * Added dynamic depth,limit,divisor,hash_kind options.
|
||||
+ * Added dst and src hashes.
|
||||
+ *
|
||||
+ * Alexander Clouter, <alex@digriz.org.uk>
|
||||
+ * Ported ESFQ to Linux 2.6.
|
||||
+ *
|
||||
+ * Corey Hickey, <bugfood-c@fatooh.org>
|
||||
+ * Maintenance of the Linux 2.6 port.
|
||||
+ * Added fwmark hash (thanks to Robert Kurjata).
|
||||
+ * Added usage of jhash.
|
||||
+ * Added conntrack support.
|
||||
+ * Added ctnatchg hash (thanks to Ben Pfountz).
|
||||
+ */
|
||||
+
|
||||
+#include <linux/module.h>
|
||||
+#include <asm/uaccess.h>
|
||||
+#include <asm/system.h>
|
||||
+#include <linux/bitops.h>
|
||||
+#include <linux/types.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/jiffies.h>
|
||||
+#include <linux/string.h>
|
||||
+#include <linux/mm.h>
|
||||
+#include <linux/socket.h>
|
||||
+#include <linux/sockios.h>
|
||||
+#include <linux/in.h>
|
||||
+#include <linux/errno.h>
|
||||
+#include <linux/interrupt.h>
|
||||
+#include <linux/if_ether.h>
|
||||
+#include <linux/inet.h>
|
||||
+#include <linux/netdevice.h>
|
||||
+#include <linux/etherdevice.h>
|
||||
+#include <linux/notifier.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <net/ip.h>
|
||||
+#include <linux/ipv6.h>
|
||||
+#include <net/route.h>
|
||||
+#include <linux/skbuff.h>
|
||||
+#include <net/sock.h>
|
||||
+#include <net/pkt_sched.h>
|
||||
+#include <linux/jhash.h>
|
||||
+#include <net/netfilter/nf_conntrack.h>
|
||||
+
|
||||
+/* Stochastic Fairness Queuing algorithm.
|
||||
+ For more comments look at sch_sfq.c.
|
||||
+ The difference is that you can change limit, depth,
|
||||
+ hash table size and choose alternate hash types.
|
||||
+
|
||||
+ classic: same as in sch_sfq.c
|
||||
+ dst: destination IP address
|
||||
+ src: source IP address
|
||||
+ fwmark: netfilter mark value
|
||||
+ ctorigdst: original destination IP address
|
||||
+ ctorigsrc: original source IP address
|
||||
+ ctrepldst: reply destination IP address
|
||||
+ ctreplsrc: reply source IP
|
||||
+
|
||||
+*/
|
||||
+
|
||||
+#define ESFQ_HEAD 0
|
||||
+#define ESFQ_TAIL 1
|
||||
+
|
||||
+/* This type should contain at least SFQ_DEPTH*2 values */
|
||||
+typedef unsigned int esfq_index;
|
||||
+
|
||||
+struct esfq_head
|
||||
+{
|
||||
+ esfq_index next;
|
||||
+ esfq_index prev;
|
||||
+};
|
||||
+
|
||||
+struct esfq_sched_data
|
||||
+{
|
||||
+/* Parameters */
|
||||
+ int perturb_period;
|
||||
+ unsigned quantum; /* Allotment per round: MUST BE >= MTU */
|
||||
+ int limit;
|
||||
+ unsigned depth;
|
||||
+ unsigned hash_divisor;
|
||||
+ unsigned hash_kind;
|
||||
+/* Variables */
|
||||
+ struct timer_list perturb_timer;
|
||||
+ int perturbation;
|
||||
+ esfq_index tail; /* Index of current slot in round */
|
||||
+ esfq_index max_depth; /* Maximal depth */
|
||||
+
|
||||
+ esfq_index *ht; /* Hash table */
|
||||
+ esfq_index *next; /* Active slots link */
|
||||
+ short *allot; /* Current allotment per slot */
|
||||
+ unsigned short *hash; /* Hash value indexed by slots */
|
||||
+ struct sk_buff_head *qs; /* Slot queue */
|
||||
+ struct esfq_head *dep; /* Linked list of slots, indexed by depth */
|
||||
+};
|
||||
+
|
||||
+/* This contains the info we will hash. */
|
||||
+struct esfq_packet_info
|
||||
+{
|
||||
+ u32 proto; /* protocol or port */
|
||||
+ u32 src; /* source from packet header */
|
||||
+ u32 dst; /* destination from packet header */
|
||||
+ u32 ctorigsrc; /* original source from conntrack */
|
||||
+ u32 ctorigdst; /* original destination from conntrack */
|
||||
+ u32 ctreplsrc; /* reply source from conntrack */
|
||||
+ u32 ctrepldst; /* reply destination from conntrack */
|
||||
+ u32 mark; /* netfilter mark (fwmark) */
|
||||
+};
|
||||
+
|
||||
+static __inline__ unsigned esfq_jhash_1word(struct esfq_sched_data *q,u32 a)
|
||||
+{
|
||||
+ return jhash_1word(a, q->perturbation) & (q->hash_divisor-1);
|
||||
+}
|
||||
+
|
||||
+static __inline__ unsigned esfq_jhash_2words(struct esfq_sched_data *q, u32 a, u32 b)
|
||||
+{
|
||||
+ return jhash_2words(a, b, q->perturbation) & (q->hash_divisor-1);
|
||||
+}
|
||||
+
|
||||
+static __inline__ unsigned esfq_jhash_3words(struct esfq_sched_data *q, u32 a, u32 b, u32 c)
|
||||
+{
|
||||
+ return jhash_3words(a, b, c, q->perturbation) & (q->hash_divisor-1);
|
||||
+}
|
||||
+
|
||||
+static unsigned esfq_hash(struct esfq_sched_data *q, struct sk_buff *skb)
|
||||
+{
|
||||
+ struct esfq_packet_info info;
|
||||
+#ifdef CONFIG_NET_SCH_ESFQ_NFCT
|
||||
+ enum ip_conntrack_info ctinfo;
|
||||
+ struct nf_conn *ct = nf_ct_get(skb, &ctinfo);
|
||||
+#endif
|
||||
+
|
||||
+ switch (skb->protocol) {
|
||||
+ case __constant_htons(ETH_P_IP):
|
||||
+ {
|
||||
+ struct iphdr *iph = ip_hdr(skb);
|
||||
+ info.dst = iph->daddr;
|
||||
+ info.src = iph->saddr;
|
||||
+ if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) &&
|
||||
+ (iph->protocol == IPPROTO_TCP ||
|
||||
+ iph->protocol == IPPROTO_UDP ||
|
||||
+ iph->protocol == IPPROTO_SCTP ||
|
||||
+ iph->protocol == IPPROTO_DCCP ||
|
||||
+ iph->protocol == IPPROTO_ESP))
|
||||
+ info.proto = *(((u32*)iph) + iph->ihl);
|
||||
+ else
|
||||
+ info.proto = iph->protocol;
|
||||
+ break;
|
||||
+ }
|
||||
+ case __constant_htons(ETH_P_IPV6):
|
||||
+ {
|
||||
+ struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||
+ /* Hash ipv6 addresses into a u32. This isn't ideal,
|
||||
+ * but the code is simple. */
|
||||
+ info.dst = jhash2(iph->daddr.s6_addr32, 4, q->perturbation);
|
||||
+ info.src = jhash2(iph->saddr.s6_addr32, 4, q->perturbation);
|
||||
+ if (iph->nexthdr == IPPROTO_TCP ||
|
||||
+ iph->nexthdr == IPPROTO_UDP ||
|
||||
+ iph->nexthdr == IPPROTO_SCTP ||
|
||||
+ iph->nexthdr == IPPROTO_DCCP ||
|
||||
+ iph->nexthdr == IPPROTO_ESP)
|
||||
+ info.proto = *(u32*)&iph[1];
|
||||
+ else
|
||||
+ info.proto = iph->nexthdr;
|
||||
+ break;
|
||||
+ }
|
||||
+ default:
|
||||
+ info.dst = (u32)(unsigned long)skb->dst;
|
||||
+ info.src = (u32)(unsigned long)skb->sk;
|
||||
+ info.proto = skb->protocol;
|
||||
+ }
|
||||
+
|
||||
+ info.mark = skb->mark;
|
||||
+
|
||||
+#ifdef CONFIG_NET_SCH_ESFQ_NFCT
|
||||
+ /* defaults if there is no conntrack info */
|
||||
+ info.ctorigsrc = info.src;
|
||||
+ info.ctorigdst = info.dst;
|
||||
+ info.ctreplsrc = info.dst;
|
||||
+ info.ctrepldst = info.src;
|
||||
+ /* collect conntrack info */
|
||||
+ if (ct && ct != &nf_conntrack_untracked) {
|
||||
+ if (skb->protocol == __constant_htons(ETH_P_IP)) {
|
||||
+ info.ctorigsrc = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip;
|
||||
+ info.ctorigdst = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u3.ip;
|
||||
+ info.ctreplsrc = ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3.ip;
|
||||
+ info.ctrepldst = ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip;
|
||||
+ }
|
||||
+ else if (skb->protocol == __constant_htons(ETH_P_IPV6)) {
|
||||
+ /* Again, hash ipv6 addresses into a single u32. */
|
||||
+ info.ctorigsrc = jhash2(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.u3.ip6, 4, q->perturbation);
|
||||
+ info.ctorigdst = jhash2(ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.u3.ip6, 4, q->perturbation);
|
||||
+ info.ctreplsrc = jhash2(ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3.ip6, 4, q->perturbation);
|
||||
+ info.ctrepldst = jhash2(ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip6, 4, q->perturbation);
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ switch(q->hash_kind) {
|
||||
+ case TCA_SFQ_HASH_CLASSIC:
|
||||
+ return esfq_jhash_3words(q, info.dst, info.src, info.proto);
|
||||
+ case TCA_SFQ_HASH_DST:
|
||||
+ return esfq_jhash_1word(q, info.dst);
|
||||
+ case TCA_SFQ_HASH_SRC:
|
||||
+ return esfq_jhash_1word(q, info.src);
|
||||
+ case TCA_SFQ_HASH_FWMARK:
|
||||
+ return esfq_jhash_1word(q, info.mark);
|
||||
+#ifdef CONFIG_NET_SCH_ESFQ_NFCT
|
||||
+ case TCA_SFQ_HASH_CTORIGDST:
|
||||
+ return esfq_jhash_1word(q, info.ctorigdst);
|
||||
+ case TCA_SFQ_HASH_CTORIGSRC:
|
||||
+ return esfq_jhash_1word(q, info.ctorigsrc);
|
||||
+ case TCA_SFQ_HASH_CTREPLDST:
|
||||
+ return esfq_jhash_1word(q, info.ctrepldst);
|
||||
+ case TCA_SFQ_HASH_CTREPLSRC:
|
||||
+ return esfq_jhash_1word(q, info.ctreplsrc);
|
||||
+ case TCA_SFQ_HASH_CTNATCHG:
|
||||
+ {
|
||||
+ if (info.ctorigdst == info.ctreplsrc)
|
||||
+ return esfq_jhash_1word(q, info.ctorigsrc);
|
||||
+ return esfq_jhash_1word(q, info.ctreplsrc);
|
||||
+ }
|
||||
+#endif
|
||||
+ default:
|
||||
+ if (net_ratelimit())
|
||||
+ printk(KERN_WARNING "ESFQ: Unknown hash method. Falling back to classic.\n");
|
||||
+ }
|
||||
+ return esfq_jhash_3words(q, info.dst, info.src, info.proto);
|
||||
+}
|
||||
+
|
||||
+static inline void esfq_link(struct esfq_sched_data *q, esfq_index x)
|
||||
+{
|
||||
+ esfq_index p, n;
|
||||
+ int d = q->qs[x].qlen + q->depth;
|
||||
+
|
||||
+ p = d;
|
||||
+ n = q->dep[d].next;
|
||||
+ q->dep[x].next = n;
|
||||
+ q->dep[x].prev = p;
|
||||
+ q->dep[p].next = q->dep[n].prev = x;
|
||||
+}
|
||||
+
|
||||
+static inline void esfq_dec(struct esfq_sched_data *q, esfq_index x)
|
||||
+{
|
||||
+ esfq_index p, n;
|
||||
+
|
||||
+ n = q->dep[x].next;
|
||||
+ p = q->dep[x].prev;
|
||||
+ q->dep[p].next = n;
|
||||
+ q->dep[n].prev = p;
|
||||
+
|
||||
+ if (n == p && q->max_depth == q->qs[x].qlen + 1)
|
||||
+ q->max_depth--;
|
||||
+
|
||||
+ esfq_link(q, x);
|
||||
+}
|
||||
+
|
||||
+static inline void esfq_inc(struct esfq_sched_data *q, esfq_index x)
|
||||
+{
|
||||
+ esfq_index p, n;
|
||||
+ int d;
|
||||
+
|
||||
+ n = q->dep[x].next;
|
||||
+ p = q->dep[x].prev;
|
||||
+ q->dep[p].next = n;
|
||||
+ q->dep[n].prev = p;
|
||||
+ d = q->qs[x].qlen;
|
||||
+ if (q->max_depth < d)
|
||||
+ q->max_depth = d;
|
||||
+
|
||||
+ esfq_link(q, x);
|
||||
+}
|
||||
+
|
||||
+static unsigned int esfq_drop(struct Qdisc *sch)
|
||||
+{
|
||||
+ struct esfq_sched_data *q = qdisc_priv(sch);
|
||||
+ esfq_index d = q->max_depth;
|
||||
+ struct sk_buff *skb;
|
||||
+ unsigned int len;
|
||||
+
|
||||
+ /* Queue is full! Find the longest slot and
|
||||
+ drop a packet from it */
|
||||
+
|
||||
+ if (d > 1) {
|
||||
+ esfq_index x = q->dep[d+q->depth].next;
|
||||
+ skb = q->qs[x].prev;
|
||||
+ len = skb->len;
|
||||
+ __skb_unlink(skb, &q->qs[x]);
|
||||
+ kfree_skb(skb);
|
||||
+ esfq_dec(q, x);
|
||||
+ sch->q.qlen--;
|
||||
+ sch->qstats.drops++;
|
||||
+ sch->qstats.backlog -= len;
|
||||
+ return len;
|
||||
+ }
|
||||
+
|
||||
+ if (d == 1) {
|
||||
+ /* It is difficult to believe, but ALL THE SLOTS HAVE LENGTH 1. */
|
||||
+ d = q->next[q->tail];
|
||||
+ q->next[q->tail] = q->next[d];
|
||||
+ q->allot[q->next[d]] += q->quantum;
|
||||
+ skb = q->qs[d].prev;
|
||||
+ len = skb->len;
|
||||
+ __skb_unlink(skb, &q->qs[d]);
|
||||
+ kfree_skb(skb);
|
||||
+ esfq_dec(q, d);
|
||||
+ sch->q.qlen--;
|
||||
+ q->ht[q->hash[d]] = q->depth;
|
||||
+ sch->qstats.drops++;
|
||||
+ sch->qstats.backlog -= len;
|
||||
+ return len;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void esfq_q_enqueue(struct sk_buff *skb, struct esfq_sched_data *q, unsigned int end)
|
||||
+{
|
||||
+ unsigned hash = esfq_hash(q, skb);
|
||||
+ unsigned depth = q->depth;
|
||||
+ esfq_index x;
|
||||
+
|
||||
+ x = q->ht[hash];
|
||||
+ if (x == depth) {
|
||||
+ q->ht[hash] = x = q->dep[depth].next;
|
||||
+ q->hash[x] = hash;
|
||||
+ }
|
||||
+
|
||||
+ if (end == ESFQ_TAIL)
|
||||
+ __skb_queue_tail(&q->qs[x], skb);
|
||||
+ else
|
||||
+ __skb_queue_head(&q->qs[x], skb);
|
||||
+
|
||||
+ esfq_inc(q, x);
|
||||
+ if (q->qs[x].qlen == 1) { /* The flow is new */
|
||||
+ if (q->tail == depth) { /* It is the first flow */
|
||||
+ q->tail = x;
|
||||
+ q->next[x] = x;
|
||||
+ q->allot[x] = q->quantum;
|
||||
+ } else {
|
||||
+ q->next[x] = q->next[q->tail];
|
||||
+ q->next[q->tail] = x;
|
||||
+ q->tail = x;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int esfq_enqueue(struct sk_buff *skb, struct Qdisc* sch)
|
||||
+{
|
||||
+ struct esfq_sched_data *q = qdisc_priv(sch);
|
||||
+ esfq_q_enqueue(skb, q, ESFQ_TAIL);
|
||||
+ sch->qstats.backlog += skb->len;
|
||||
+ if (++sch->q.qlen < q->limit-1) {
|
||||
+ sch->bstats.bytes += skb->len;
|
||||
+ sch->bstats.packets++;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ sch->qstats.drops++;
|
||||
+ esfq_drop(sch);
|
||||
+ return NET_XMIT_CN;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int esfq_requeue(struct sk_buff *skb, struct Qdisc* sch)
|
||||
+{
|
||||
+ struct esfq_sched_data *q = qdisc_priv(sch);
|
||||
+ esfq_q_enqueue(skb, q, ESFQ_HEAD);
|
||||
+ sch->qstats.backlog += skb->len;
|
||||
+ if (++sch->q.qlen < q->limit - 1) {
|
||||
+ sch->qstats.requeues++;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ sch->qstats.drops++;
|
||||
+ esfq_drop(sch);
|
||||
+ return NET_XMIT_CN;
|
||||
+}
|
||||
+
|
||||
+static struct sk_buff *esfq_q_dequeue(struct esfq_sched_data *q)
|
||||
+{
|
||||
+ struct sk_buff *skb;
|
||||
+ unsigned depth = q->depth;
|
||||
+ esfq_index a, old_a;
|
||||
+
|
||||
+ /* No active slots */
|
||||
+ if (q->tail == depth)
|
||||
+ return NULL;
|
||||
+
|
||||
+ a = old_a = q->next[q->tail];
|
||||
+
|
||||
+ /* Grab packet */
|
||||
+ skb = __skb_dequeue(&q->qs[a]);
|
||||
+ esfq_dec(q, a);
|
||||
+
|
||||
+ /* Is the slot empty? */
|
||||
+ if (q->qs[a].qlen == 0) {
|
||||
+ q->ht[q->hash[a]] = depth;
|
||||
+ a = q->next[a];
|
||||
+ if (a == old_a) {
|
||||
+ q->tail = depth;
|
||||
+ return skb;
|
||||
+ }
|
||||
+ q->next[q->tail] = a;
|
||||
+ q->allot[a] += q->quantum;
|
||||
+ } else if ((q->allot[a] -= skb->len) <= 0) {
|
||||
+ q->tail = a;
|
||||
+ a = q->next[a];
|
||||
+ q->allot[a] += q->quantum;
|
||||
+ }
|
||||
+
|
||||
+ return skb;
|
||||
+}
|
||||
+
|
||||
+static struct sk_buff *esfq_dequeue(struct Qdisc* sch)
|
||||
+{
|
||||
+ struct esfq_sched_data *q = qdisc_priv(sch);
|
||||
+ struct sk_buff *skb;
|
||||
+
|
||||
+ skb = esfq_q_dequeue(q);
|
||||
+ if (skb == NULL)
|
||||
+ return NULL;
|
||||
+ sch->q.qlen--;
|
||||
+ sch->qstats.backlog -= skb->len;
|
||||
+ return skb;
|
||||
+}
|
||||
+
|
||||
+static void esfq_q_destroy(struct esfq_sched_data *q)
|
||||
+{
|
||||
+ del_timer(&q->perturb_timer);
|
||||
+ if(q->ht)
|
||||
+ kfree(q->ht);
|
||||
+ if(q->dep)
|
||||
+ kfree(q->dep);
|
||||
+ if(q->next)
|
||||
+ kfree(q->next);
|
||||
+ if(q->allot)
|
||||
+ kfree(q->allot);
|
||||
+ if(q->hash)
|
||||
+ kfree(q->hash);
|
||||
+ if(q->qs)
|
||||
+ kfree(q->qs);
|
||||
+}
|
||||
+
|
||||
+static void esfq_destroy(struct Qdisc *sch)
|
||||
+{
|
||||
+ struct esfq_sched_data *q = qdisc_priv(sch);
|
||||
+ esfq_q_destroy(q);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static void esfq_reset(struct Qdisc* sch)
|
||||
+{
|
||||
+ struct sk_buff *skb;
|
||||
+
|
||||
+ while ((skb = esfq_dequeue(sch)) != NULL)
|
||||
+ kfree_skb(skb);
|
||||
+}
|
||||
+
|
||||
+static void esfq_perturbation(unsigned long arg)
|
||||
+{
|
||||
+ struct Qdisc *sch = (struct Qdisc*)arg;
|
||||
+ struct esfq_sched_data *q = qdisc_priv(sch);
|
||||
+
|
||||
+ q->perturbation = net_random()&0x1F;
|
||||
+
|
||||
+ if (q->perturb_period) {
|
||||
+ q->perturb_timer.expires = jiffies + q->perturb_period;
|
||||
+ add_timer(&q->perturb_timer);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static unsigned int esfq_check_hash(unsigned int kind)
|
||||
+{
|
||||
+ switch (kind) {
|
||||
+ case TCA_SFQ_HASH_CTORIGDST:
|
||||
+ case TCA_SFQ_HASH_CTORIGSRC:
|
||||
+ case TCA_SFQ_HASH_CTREPLDST:
|
||||
+ case TCA_SFQ_HASH_CTREPLSRC:
|
||||
+ case TCA_SFQ_HASH_CTNATCHG:
|
||||
+#ifndef CONFIG_NET_SCH_ESFQ_NFCT
|
||||
+ {
|
||||
+ if (net_ratelimit())
|
||||
+ printk(KERN_WARNING "ESFQ: Conntrack hash types disabled in kernel config. Falling back to classic.\n");
|
||||
+ return TCA_SFQ_HASH_CLASSIC;
|
||||
+ }
|
||||
+#endif
|
||||
+ case TCA_SFQ_HASH_CLASSIC:
|
||||
+ case TCA_SFQ_HASH_DST:
|
||||
+ case TCA_SFQ_HASH_SRC:
|
||||
+ case TCA_SFQ_HASH_FWMARK:
|
||||
+ return kind;
|
||||
+ default:
|
||||
+ {
|
||||
+ if (net_ratelimit())
|
||||
+ printk(KERN_WARNING "ESFQ: Unknown hash type. Falling back to classic.\n");
|
||||
+ return TCA_SFQ_HASH_CLASSIC;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int esfq_q_init(struct esfq_sched_data *q, struct rtattr *opt)
|
||||
+{
|
||||
+ struct tc_esfq_qopt *ctl = RTA_DATA(opt);
|
||||
+ esfq_index p = ~0U/2;
|
||||
+ int i;
|
||||
+
|
||||
+ if (opt && opt->rta_len < RTA_LENGTH(sizeof(*ctl)))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ q->perturbation = 0;
|
||||
+ q->hash_kind = TCA_SFQ_HASH_CLASSIC;
|
||||
+ q->max_depth = 0;
|
||||
+ if (opt == NULL) {
|
||||
+ q->perturb_period = 0;
|
||||
+ q->hash_divisor = 1024;
|
||||
+ q->tail = q->limit = q->depth = 128;
|
||||
+
|
||||
+ } else {
|
||||
+ struct tc_esfq_qopt *ctl = RTA_DATA(opt);
|
||||
+ if (ctl->quantum)
|
||||
+ q->quantum = ctl->quantum;
|
||||
+ q->perturb_period = ctl->perturb_period*HZ;
|
||||
+ q->hash_divisor = ctl->divisor ? : 1024;
|
||||
+ q->tail = q->limit = q->depth = ctl->flows ? : 128;
|
||||
+
|
||||
+ if ( q->depth > p - 1 )
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (ctl->limit)
|
||||
+ q->limit = min_t(u32, ctl->limit, q->depth);
|
||||
+
|
||||
+ if (ctl->hash_kind) {
|
||||
+ q->hash_kind = esfq_check_hash(ctl->hash_kind);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ q->ht = kmalloc(q->hash_divisor*sizeof(esfq_index), GFP_KERNEL);
|
||||
+ if (!q->ht)
|
||||
+ goto err_case;
|
||||
+ q->dep = kmalloc((1+q->depth*2)*sizeof(struct esfq_head), GFP_KERNEL);
|
||||
+ if (!q->dep)
|
||||
+ goto err_case;
|
||||
+ q->next = kmalloc(q->depth*sizeof(esfq_index), GFP_KERNEL);
|
||||
+ if (!q->next)
|
||||
+ goto err_case;
|
||||
+ q->allot = kmalloc(q->depth*sizeof(short), GFP_KERNEL);
|
||||
+ if (!q->allot)
|
||||
+ goto err_case;
|
||||
+ q->hash = kmalloc(q->depth*sizeof(unsigned short), GFP_KERNEL);
|
||||
+ if (!q->hash)
|
||||
+ goto err_case;
|
||||
+ q->qs = kmalloc(q->depth*sizeof(struct sk_buff_head), GFP_KERNEL);
|
||||
+ if (!q->qs)
|
||||
+ goto err_case;
|
||||
+
|
||||
+ for (i=0; i< q->hash_divisor; i++)
|
||||
+ q->ht[i] = q->depth;
|
||||
+ for (i=0; i<q->depth; i++) {
|
||||
+ skb_queue_head_init(&q->qs[i]);
|
||||
+ q->dep[i+q->depth].next = i+q->depth;
|
||||
+ q->dep[i+q->depth].prev = i+q->depth;
|
||||
+ }
|
||||
+
|
||||
+ for (i=0; i<q->depth; i++)
|
||||
+ esfq_link(q, i);
|
||||
+ return 0;
|
||||
+err_case:
|
||||
+ esfq_q_destroy(q);
|
||||
+ return -ENOBUFS;
|
||||
+}
|
||||
+
|
||||
+static int esfq_init(struct Qdisc *sch, struct rtattr *opt)
|
||||
+{
|
||||
+ struct esfq_sched_data *q = qdisc_priv(sch);
|
||||
+ int err;
|
||||
+
|
||||
+ q->quantum = psched_mtu(sch->dev); /* default */
|
||||
+ if ((err = esfq_q_init(q, opt)))
|
||||
+ return err;
|
||||
+
|
||||
+ init_timer(&q->perturb_timer);
|
||||
+ q->perturb_timer.data = (unsigned long)sch;
|
||||
+ q->perturb_timer.function = esfq_perturbation;
|
||||
+ if (q->perturb_period) {
|
||||
+ q->perturb_timer.expires = jiffies + q->perturb_period;
|
||||
+ add_timer(&q->perturb_timer);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int esfq_change(struct Qdisc *sch, struct rtattr *opt)
|
||||
+{
|
||||
+ struct esfq_sched_data *q = qdisc_priv(sch);
|
||||
+ struct esfq_sched_data new;
|
||||
+ struct sk_buff *skb;
|
||||
+ int err;
|
||||
+
|
||||
+ /* set up new queue */
|
||||
+ memset(&new, 0, sizeof(struct esfq_sched_data));
|
||||
+ new.quantum = psched_mtu(sch->dev); /* default */
|
||||
+ if ((err = esfq_q_init(&new, opt)))
|
||||
+ return err;
|
||||
+
|
||||
+ /* copy all packets from the old queue to the new queue */
|
||||
+ sch_tree_lock(sch);
|
||||
+ while ((skb = esfq_q_dequeue(q)) != NULL)
|
||||
+ esfq_q_enqueue(skb, &new, ESFQ_TAIL);
|
||||
+
|
||||
+ /* clean up the old queue */
|
||||
+ esfq_q_destroy(q);
|
||||
+
|
||||
+ /* copy elements of the new queue into the old queue */
|
||||
+ q->perturb_period = new.perturb_period;
|
||||
+ q->quantum = new.quantum;
|
||||
+ q->limit = new.limit;
|
||||
+ q->depth = new.depth;
|
||||
+ q->hash_divisor = new.hash_divisor;
|
||||
+ q->hash_kind = new.hash_kind;
|
||||
+ q->tail = new.tail;
|
||||
+ q->max_depth = new.max_depth;
|
||||
+ q->ht = new.ht;
|
||||
+ q->dep = new.dep;
|
||||
+ q->next = new.next;
|
||||
+ q->allot = new.allot;
|
||||
+ q->hash = new.hash;
|
||||
+ q->qs = new.qs;
|
||||
+
|
||||
+ /* finish up */
|
||||
+ if (q->perturb_period) {
|
||||
+ q->perturb_timer.expires = jiffies + q->perturb_period;
|
||||
+ add_timer(&q->perturb_timer);
|
||||
+ } else {
|
||||
+ q->perturbation = 0;
|
||||
+ }
|
||||
+ sch_tree_unlock(sch);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int esfq_dump(struct Qdisc *sch, struct sk_buff *skb)
|
||||
+{
|
||||
+ struct esfq_sched_data *q = qdisc_priv(sch);
|
||||
+ unsigned char *b = skb->tail;
|
||||
+ struct tc_esfq_qopt opt;
|
||||
+
|
||||
+ opt.quantum = q->quantum;
|
||||
+ opt.perturb_period = q->perturb_period/HZ;
|
||||
+
|
||||
+ opt.limit = q->limit;
|
||||
+ opt.divisor = q->hash_divisor;
|
||||
+ opt.flows = q->depth;
|
||||
+ opt.hash_kind = q->hash_kind;
|
||||
+
|
||||
+ RTA_PUT(skb, TCA_OPTIONS, sizeof(opt), &opt);
|
||||
+
|
||||
+ return skb->len;
|
||||
+
|
||||
+rtattr_failure:
|
||||
+ skb_trim(skb, b - skb->data);
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+static struct Qdisc_ops esfq_qdisc_ops =
|
||||
+{
|
||||
+ .next = NULL,
|
||||
+ .cl_ops = NULL,
|
||||
+ .id = "esfq",
|
||||
+ .priv_size = sizeof(struct esfq_sched_data),
|
||||
+ .enqueue = esfq_enqueue,
|
||||
+ .dequeue = esfq_dequeue,
|
||||
+ .requeue = esfq_requeue,
|
||||
+ .drop = esfq_drop,
|
||||
+ .init = esfq_init,
|
||||
+ .reset = esfq_reset,
|
||||
+ .destroy = esfq_destroy,
|
||||
+ .change = esfq_change,
|
||||
+ .dump = esfq_dump,
|
||||
+ .owner = THIS_MODULE,
|
||||
+};
|
||||
+
|
||||
+static int __init esfq_module_init(void)
|
||||
+{
|
||||
+ return register_qdisc(&esfq_qdisc_ops);
|
||||
+}
|
||||
+static void __exit esfq_module_exit(void)
|
||||
+{
|
||||
+ unregister_qdisc(&esfq_qdisc_ops);
|
||||
+}
|
||||
+module_init(esfq_module_init)
|
||||
+module_exit(esfq_module_exit)
|
||||
+MODULE_LICENSE("GPL");
|
|
@ -1,12 +0,0 @@
|
|||
--- a/arch/mips/Makefile
|
||||
+++ b/arch/mips/Makefile
|
||||
@@ -576,6 +576,9 @@ core-$(CONFIG_TOSHIBA_RBTX4938) += arch/
|
||||
cflags-$(CONFIG_TOSHIBA_RBTX4938) += -Iinclude/asm-mips/mach-tx49xx
|
||||
load-$(CONFIG_TOSHIBA_RBTX4938) += 0xffffffff80100000
|
||||
|
||||
+# temporary until string.h is fixed
|
||||
+cflags-y += -ffreestanding
|
||||
+
|
||||
cflags-y += -Iinclude/asm-mips/mach-generic
|
||||
drivers-$(CONFIG_PCI) += arch/mips/pci/
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
--- a/fs/jffs2/build.c
|
||||
+++ b/fs/jffs2/build.c
|
||||
@@ -105,6 +105,17 @@ static int jffs2_build_filesystem(struct
|
||||
dbg_fsbuild("scanned flash completely\n");
|
||||
jffs2_dbg_dump_block_lists_nolock(c);
|
||||
|
||||
+ if (c->flags & (1 << 7)) {
|
||||
+ printk("%s(): unlocking the mtd device... ", __func__);
|
||||
+ if (c->mtd->unlock)
|
||||
+ c->mtd->unlock(c->mtd, 0, c->mtd->size);
|
||||
+ printk("done.\n");
|
||||
+
|
||||
+ printk("%s(): erasing all blocks after the end marker... ", __func__);
|
||||
+ jffs2_erase_pending_blocks(c, -1);
|
||||
+ printk("done.\n");
|
||||
+ }
|
||||
+
|
||||
dbg_fsbuild("pass 1 starting\n");
|
||||
c->flags |= JFFS2_SB_FLAG_BUILDING;
|
||||
/* Now scan the directory tree, increasing nlink according to every dirent found. */
|
||||
--- a/fs/jffs2/scan.c
|
||||
+++ b/fs/jffs2/scan.c
|
||||
@@ -142,9 +142,12 @@ int jffs2_scan_medium(struct jffs2_sb_in
|
||||
|
||||
/* reset summary info for next eraseblock scan */
|
||||
jffs2_sum_reset_collected(s);
|
||||
-
|
||||
- ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
|
||||
- buf_size, s);
|
||||
+
|
||||
+ if (c->flags & (1 << 7))
|
||||
+ ret = BLK_STATE_ALLFF;
|
||||
+ else
|
||||
+ ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset),
|
||||
+ buf_size, s);
|
||||
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
@@ -545,6 +548,17 @@ static int jffs2_scan_eraseblock (struct
|
||||
return err;
|
||||
}
|
||||
|
||||
+ if ((buf[0] == 0xde) &&
|
||||
+ (buf[1] == 0xad) &&
|
||||
+ (buf[2] == 0xc0) &&
|
||||
+ (buf[3] == 0xde)) {
|
||||
+ /* end of filesystem. erase everything after this point */
|
||||
+ printk("%s(): End of filesystem marker found at 0x%x\n", __func__, jeb->offset);
|
||||
+ c->flags |= (1 << 7);
|
||||
+
|
||||
+ return BLK_STATE_ALLFF;
|
||||
+ }
|
||||
+
|
||||
/* We temporarily use 'ofs' as a pointer into the buffer/jeb */
|
||||
ofs = 0;
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
--- /dev/null
|
||||
+++ b/include/asm-powerpc/segment.h
|
||||
@@ -0,0 +1,6 @@
|
||||
+#ifndef _ASM_SEGMENT_H
|
||||
+#define _ASM_SEGMENT_H
|
||||
+
|
||||
+/* Only here because we have some old header files that expect it.. */
|
||||
+
|
||||
+#endif /* _ASM_SEGMENT_H */
|
|
@ -1,42 +0,0 @@
|
|||
--- a/drivers/net/r8169.c
|
||||
+++ b/drivers/net/r8169.c
|
||||
@@ -1537,7 +1537,7 @@ static const struct rtl_cfg_info {
|
||||
.hw_start = rtl_hw_start_8169,
|
||||
.region = 1,
|
||||
.align = 0,
|
||||
- .intr_event = SYSErr | LinkChg | RxOverflow |
|
||||
+ .intr_event = LinkChg | RxOverflow |
|
||||
RxFIFOOver | TxErr | TxOK | RxOK | RxErr,
|
||||
.napi_event = RxFIFOOver | TxErr | TxOK | RxOK | RxOverflow,
|
||||
.msi = 0
|
||||
@@ -1546,7 +1546,7 @@ static const struct rtl_cfg_info {
|
||||
.hw_start = rtl_hw_start_8168,
|
||||
.region = 2,
|
||||
.align = 8,
|
||||
- .intr_event = SYSErr | LinkChg | RxOverflow |
|
||||
+ .intr_event = LinkChg | RxOverflow |
|
||||
TxErr | TxOK | RxOK | RxErr,
|
||||
.napi_event = TxErr | TxOK | RxOK | RxOverflow,
|
||||
.msi = RTL_FEATURE_MSI
|
||||
@@ -1555,7 +1555,7 @@ static const struct rtl_cfg_info {
|
||||
.hw_start = rtl_hw_start_8101,
|
||||
.region = 2,
|
||||
.align = 8,
|
||||
- .intr_event = SYSErr | LinkChg | RxOverflow | PCSTimeout |
|
||||
+ .intr_event = LinkChg | RxOverflow | PCSTimeout |
|
||||
RxFIFOOver | TxErr | TxOK | RxOK | RxErr,
|
||||
.napi_event = RxFIFOOver | TxErr | TxOK | RxOK | RxOverflow,
|
||||
.msi = RTL_FEATURE_MSI
|
||||
@@ -2903,10 +2903,12 @@ static irqreturn_t rtl8169_interrupt(int
|
||||
break;
|
||||
}
|
||||
|
||||
+#if 0
|
||||
if (unlikely(status & SYSErr)) {
|
||||
rtl8169_pcierr_interrupt(dev);
|
||||
break;
|
||||
}
|
||||
+#endif
|
||||
|
||||
if (status & LinkChg)
|
||||
rtl8169_check_link_status(dev, tp, ioaddr);
|
File diff suppressed because it is too large
Load Diff
|
@ -1,42 +0,0 @@
|
|||
--- a/lib/kobject_uevent.c
|
||||
+++ b/lib/kobject_uevent.c
|
||||
@@ -27,7 +27,8 @@ u64 uevent_seqnum;
|
||||
char uevent_helper[UEVENT_HELPER_PATH_LEN] = CONFIG_UEVENT_HELPER_PATH;
|
||||
static DEFINE_SPINLOCK(sequence_lock);
|
||||
#if defined(CONFIG_NET)
|
||||
-static struct sock *uevent_sock;
|
||||
+struct sock *uevent_sock = NULL;
|
||||
+EXPORT_SYMBOL_GPL(uevent_sock);
|
||||
#endif
|
||||
|
||||
/* the strings here must match the enum in include/linux/kobject.h */
|
||||
@@ -40,6 +41,18 @@ static const char *kobject_actions[] = {
|
||||
[KOBJ_OFFLINE] = "offline",
|
||||
};
|
||||
|
||||
+u64 uevent_next_seqnum(void)
|
||||
+{
|
||||
+ u64 seq;
|
||||
+
|
||||
+ spin_lock(&sequence_lock);
|
||||
+ seq = ++uevent_seqnum;
|
||||
+ spin_unlock(&sequence_lock);
|
||||
+
|
||||
+ return seq;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(uevent_next_seqnum);
|
||||
+
|
||||
/**
|
||||
* kobject_action_type - translate action string to numeric type
|
||||
*
|
||||
@@ -173,9 +186,7 @@ int kobject_uevent_env(struct kobject *k
|
||||
}
|
||||
|
||||
/* we will send an event, so request a new sequence number */
|
||||
- spin_lock(&sequence_lock);
|
||||
- seq = ++uevent_seqnum;
|
||||
- spin_unlock(&sequence_lock);
|
||||
+ seq = uevent_next_seqnum();
|
||||
retval = add_uevent_var(env, "SEQNUM=%llu", (unsigned long long)seq);
|
||||
if (retval)
|
||||
goto exit;
|
|
@ -1,11 +0,0 @@
|
|||
--- a/sound/core/Kconfig
|
||||
+++ b/sound/core/Kconfig
|
||||
@@ -9,7 +9,7 @@ config SND_PCM
|
||||
depends on SND
|
||||
|
||||
config SND_HWDEP
|
||||
- tristate
|
||||
+ tristate "Sound hardware support"
|
||||
depends on SND
|
||||
|
||||
config SND_RAWMIDI
|
|
@ -1,18 +0,0 @@
|
|||
--- a/drivers/leds/Kconfig
|
||||
+++ b/drivers/leds/Kconfig
|
||||
@@ -146,4 +146,8 @@ config LEDS_TRIGGER_HEARTBEAT
|
||||
load average.
|
||||
If unsure, say Y.
|
||||
|
||||
+config LEDS_TRIGGER_MORSE
|
||||
+ tristate "LED Morse Trigger"
|
||||
+ depends on LEDS_TRIGGERS
|
||||
+
|
||||
endif # NEW_LEDS
|
||||
--- a/drivers/leds/Makefile
|
||||
+++ b/drivers/leds/Makefile
|
||||
@@ -24,3 +24,4 @@ obj-$(CONFIG_LEDS_CM_X270)
|
||||
obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o
|
||||
obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK) += ledtrig-ide-disk.o
|
||||
obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += ledtrig-heartbeat.o
|
||||
+obj-$(CONFIG_LEDS_TRIGGER_MORSE) += ledtrig-morse.o
|
|
@ -1,25 +0,0 @@
|
|||
--- a/drivers/leds/Kconfig
|
||||
+++ b/drivers/leds/Kconfig
|
||||
@@ -81,6 +81,12 @@ config LEDS_WRAP
|
||||
help
|
||||
This option enables support for the PCEngines WRAP programmable LEDs.
|
||||
|
||||
+config LEDS_ALIX
|
||||
+ tristate "LED Support for the ALIX 2/3 boards"
|
||||
+ depends on LEDS_CLASS
|
||||
+ help
|
||||
+ This option enables support for the three LEDs on the PCEngines ALIX 2/3 boards.
|
||||
+
|
||||
config LEDS_H1940
|
||||
tristate "LED Support for iPAQ H1940 device"
|
||||
depends on LEDS_CLASS && ARCH_H1940
|
||||
--- a/drivers/leds/Makefile
|
||||
+++ b/drivers/leds/Makefile
|
||||
@@ -14,6 +14,7 @@ obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c2
|
||||
obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o
|
||||
obj-$(CONFIG_LEDS_NET48XX) += leds-net48xx.o
|
||||
obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o
|
||||
+obj-$(CONFIG_LEDS_ALIX) += leds-alix.o
|
||||
obj-$(CONFIG_LEDS_H1940) += leds-h1940.o
|
||||
obj-$(CONFIG_LEDS_COBALT_QUBE) += leds-cobalt-qube.o
|
||||
obj-$(CONFIG_LEDS_COBALT_RAQ) += leds-cobalt-raq.o
|
|
@ -1,21 +0,0 @@
|
|||
--- a/drivers/leds/Kconfig
|
||||
+++ b/drivers/leds/Kconfig
|
||||
@@ -156,4 +156,11 @@ config LEDS_TRIGGER_MORSE
|
||||
tristate "LED Morse Trigger"
|
||||
depends on LEDS_TRIGGERS
|
||||
|
||||
+config LEDS_TRIGGER_DEFAULT_ON
|
||||
+ tristate "LED Default ON Trigger"
|
||||
+ depends on LEDS_TRIGGERS
|
||||
+ help
|
||||
+ This allows LEDs to be initialised in the ON state.
|
||||
+ If unsure, say Y.
|
||||
+
|
||||
endif # NEW_LEDS
|
||||
--- a/drivers/leds/Makefile
|
||||
+++ b/drivers/leds/Makefile
|
||||
@@ -26,3 +26,4 @@ obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledt
|
||||
obj-$(CONFIG_LEDS_TRIGGER_IDE_DISK) += ledtrig-ide-disk.o
|
||||
obj-$(CONFIG_LEDS_TRIGGER_HEARTBEAT) += ledtrig-heartbeat.o
|
||||
obj-$(CONFIG_LEDS_TRIGGER_MORSE) += ledtrig-morse.o
|
||||
+obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o
|
|
@ -1,16 +0,0 @@
|
|||
--- a/drivers/rtc/rtc-ds1672.c
|
||||
+++ b/drivers/rtc/rtc-ds1672.c
|
||||
@@ -13,10 +13,10 @@
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/rtc.h>
|
||||
|
||||
-#define DRV_VERSION "0.3"
|
||||
+#define DRV_VERSION "0.4"
|
||||
|
||||
-/* Addresses to scan: none. This chip cannot be detected. */
|
||||
-static unsigned short normal_i2c[] = { I2C_CLIENT_END };
|
||||
+/* Addresses to scan: 0x68 */
|
||||
+static unsigned short normal_i2c[] = { 0x68, I2C_CLIENT_END };
|
||||
|
||||
/* Insmod parameters */
|
||||
I2C_CLIENT_INSMOD;
|
|
@ -1,30 +0,0 @@
|
|||
--- a/drivers/input/misc/Kconfig
|
||||
+++ b/drivers/input/misc/Kconfig
|
||||
@@ -183,4 +183,20 @@ config HP_SDC_RTC
|
||||
Say Y here if you want to support the built-in real time clock
|
||||
of the HP SDC controller.
|
||||
|
||||
+config INPUT_GPIO_BUTTONS
|
||||
+ tristate "Polled GPIO buttons interface"
|
||||
+ depends on GENERIC_GPIO
|
||||
+ select INPUT_POLLDEV
|
||||
+ help
|
||||
+ This driver implements support for buttons connected
|
||||
+ to GPIO pins of various CPUs (and some other chips).
|
||||
+
|
||||
+ Say Y here if your device has buttons connected
|
||||
+ directly to such GPIO pins. Your board-specific
|
||||
+ setup logic must also provide a platform device,
|
||||
+ with configuration data saying which GPIOs are used.
|
||||
+
|
||||
+ To compile this driver as a module, choose M here: the
|
||||
+ module will be called gpio-buttons.
|
||||
+
|
||||
endif
|
||||
--- a/drivers/input/misc/Makefile
|
||||
+++ b/drivers/input/misc/Makefile
|
||||
@@ -18,3 +18,4 @@ obj-$(CONFIG_INPUT_POWERMATE) += powerm
|
||||
obj-$(CONFIG_INPUT_YEALINK) += yealink.o
|
||||
obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o
|
||||
obj-$(CONFIG_INPUT_UINPUT) += uinput.o
|
||||
+obj-$(CONFIG_INPUT_GPIO_BUTTONS) += gpio_buttons.o
|
|
@ -1,26 +0,0 @@
|
|||
--- a/drivers/char/Kconfig
|
||||
+++ b/drivers/char/Kconfig
|
||||
@@ -946,6 +946,13 @@ config CS5535_GPIO
|
||||
|
||||
If compiled as a module, it will be called cs5535_gpio.
|
||||
|
||||
+config GPIO_DEVICE
|
||||
+ tristate "GPIO device support"
|
||||
+ depends on GENERIC_GPIO
|
||||
+ help
|
||||
+ Say Y to enable Linux GPIO device support. This allows control of
|
||||
+ GPIO pins using a character device
|
||||
+
|
||||
config GPIO_VR41XX
|
||||
tristate "NEC VR4100 series General-purpose I/O Unit support"
|
||||
depends on CPU_VR41XX
|
||||
--- a/drivers/char/Makefile
|
||||
+++ b/drivers/char/Makefile
|
||||
@@ -93,6 +93,7 @@ obj-$(CONFIG_SCx200_GPIO) += scx200_gpio
|
||||
obj-$(CONFIG_PC8736x_GPIO) += pc8736x_gpio.o
|
||||
obj-$(CONFIG_NSC_GPIO) += nsc_gpio.o
|
||||
obj-$(CONFIG_CS5535_GPIO) += cs5535_gpio.o
|
||||
+obj-$(CONFIG_GPIO_DEVICE) += gpio_dev.o
|
||||
obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.o
|
||||
obj-$(CONFIG_GPIO_TB0219) += tb0219.o
|
||||
obj-$(CONFIG_TELCLOCK) += tlclk.o
|
|
@ -1,17 +0,0 @@
|
|||
--- a/fs/Kconfig
|
||||
+++ b/fs/Kconfig
|
||||
@@ -420,6 +420,7 @@ config FS_POSIX_ACL
|
||||
|
||||
source "fs/xfs/Kconfig"
|
||||
source "fs/gfs2/Kconfig"
|
||||
+source "fs/yaffs2/Kconfig"
|
||||
|
||||
config OCFS2_FS
|
||||
tristate "OCFS2 file system support"
|
||||
--- a/fs/Makefile
|
||||
+++ b/fs/Makefile
|
||||
@@ -120,3 +120,4 @@ obj-$(CONFIG_HPPFS) += hppfs/
|
||||
obj-$(CONFIG_DEBUG_FS) += debugfs/
|
||||
obj-$(CONFIG_OCFS2_FS) += ocfs2/
|
||||
obj-$(CONFIG_GFS2_FS) += gfs2/
|
||||
+obj-$(CONFIG_YAFFS_FS) += yaffs2/
|
|
@ -1,63 +0,0 @@
|
|||
--- a/drivers/net/phy/phy.c
|
||||
+++ b/drivers/net/phy/phy.c
|
||||
@@ -345,6 +345,50 @@ int phy_ethtool_gset(struct phy_device *
|
||||
}
|
||||
EXPORT_SYMBOL(phy_ethtool_gset);
|
||||
|
||||
+int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr)
|
||||
+{
|
||||
+ u32 cmd;
|
||||
+ int tmp;
|
||||
+ struct ethtool_cmd ecmd = { ETHTOOL_GSET };
|
||||
+ struct ethtool_value edata = { ETHTOOL_GLINK };
|
||||
+
|
||||
+ if (get_user(cmd, (u32 *) useraddr))
|
||||
+ return -EFAULT;
|
||||
+
|
||||
+ switch (cmd) {
|
||||
+ case ETHTOOL_GSET:
|
||||
+ phy_ethtool_gset(phydev, &ecmd);
|
||||
+ if (copy_to_user(useraddr, &ecmd, sizeof(ecmd)))
|
||||
+ return -EFAULT;
|
||||
+ return 0;
|
||||
+
|
||||
+ case ETHTOOL_SSET:
|
||||
+ if (copy_from_user(&ecmd, useraddr, sizeof(ecmd)))
|
||||
+ return -EFAULT;
|
||||
+ return phy_ethtool_sset(phydev, &ecmd);
|
||||
+
|
||||
+ case ETHTOOL_NWAY_RST:
|
||||
+ /* if autoneg is off, it's an error */
|
||||
+ tmp = phy_read(phydev, MII_BMCR);
|
||||
+ if (tmp & BMCR_ANENABLE) {
|
||||
+ tmp |= (BMCR_ANRESTART);
|
||||
+ phy_write(phydev, MII_BMCR, tmp);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ case ETHTOOL_GLINK:
|
||||
+ edata.data = (phy_read(phydev,
|
||||
+ MII_BMSR) & BMSR_LSTATUS) ? 1 : 0;
|
||||
+ if (copy_to_user(useraddr, &edata, sizeof(edata)))
|
||||
+ return -EFAULT;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return -EOPNOTSUPP;
|
||||
+}
|
||||
+EXPORT_SYMBOL(phy_ethtool_ioctl);
|
||||
+
|
||||
/**
|
||||
* phy_mii_ioctl - generic PHY MII ioctl interface
|
||||
* @phydev: the phy_device struct
|
||||
--- a/include/linux/phy.h
|
||||
+++ b/include/linux/phy.h
|
||||
@@ -398,6 +398,7 @@ void phy_start_machine(struct phy_device
|
||||
void phy_stop_machine(struct phy_device *phydev);
|
||||
int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd);
|
||||
int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd);
|
||||
+int phy_ethtool_ioctl(struct phy_device *phydev, void *useraddr);
|
||||
int phy_mii_ioctl(struct phy_device *phydev,
|
||||
struct mii_ioctl_data *mii_data, int cmd);
|
||||
int phy_start_interrupts(struct phy_device *phydev);
|
|
@ -1,728 +0,0 @@
|
|||
--- a/include/linux/atmbr2684.h
|
||||
+++ b/include/linux/atmbr2684.h
|
||||
@@ -14,6 +14,9 @@
|
||||
#define BR2684_MEDIA_FDDI (3)
|
||||
#define BR2684_MEDIA_802_6 (4) /* 802.6 */
|
||||
|
||||
+ /* used only at device creation: */
|
||||
+#define BR2684_FLAG_ROUTED (1<<16) /* payload is routed, not bridged */
|
||||
+
|
||||
/*
|
||||
* Is there FCS inbound on this VC? This currently isn't supported.
|
||||
*/
|
||||
@@ -36,15 +39,22 @@
|
||||
#define BR2684_ENCAPS_AUTODETECT (2) /* Unsuported */
|
||||
|
||||
/*
|
||||
+ * Is this VC bridged or routed?
|
||||
+ */
|
||||
+
|
||||
+#define BR2684_PAYLOAD_ROUTED (0)
|
||||
+#define BR2684_PAYLOAD_BRIDGED (1)
|
||||
+
|
||||
+/*
|
||||
* 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;
|
||||
+ atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */
|
||||
+ int media; /* BR2684_MEDIA_*, flags in upper bits */
|
||||
+ char ifname[IFNAMSIZ];
|
||||
+ int mtu;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -55,10 +65,10 @@ struct atm_newif_br2684 {
|
||||
#define BR2684_FIND_BYNUM (1)
|
||||
#define BR2684_FIND_BYIFNAME (2)
|
||||
struct br2684_if_spec {
|
||||
- int method; /* BR2684_FIND_* */
|
||||
+ int method; /* BR2684_FIND_* */
|
||||
union {
|
||||
- char ifname[IFNAMSIZ];
|
||||
- int devnum;
|
||||
+ char ifname[IFNAMSIZ];
|
||||
+ int devnum;
|
||||
} spec;
|
||||
};
|
||||
|
||||
@@ -68,16 +78,16 @@ struct br2684_if_spec {
|
||||
* is per-backend specific
|
||||
*/
|
||||
struct atm_backend_br2684 {
|
||||
- atm_backend_t backend_num; /* 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 */
|
||||
+ 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 */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -86,8 +96,8 @@ struct atm_backend_br2684 {
|
||||
* efficient per-if in/out filters, this support will be removed
|
||||
*/
|
||||
struct br2684_filter {
|
||||
- __be32 prefix; /* network byte order */
|
||||
- __be32 netmask; /* 0 = disable filter */
|
||||
+ __be32 prefix; /* network byte order */
|
||||
+ __be32 netmask; /* 0 = disable filter */
|
||||
};
|
||||
|
||||
struct br2684_filter_set {
|
||||
@@ -95,7 +105,13 @@ struct br2684_filter_set {
|
||||
struct br2684_filter filter;
|
||||
};
|
||||
|
||||
+enum br2684_payload {
|
||||
+ p_routed = BR2684_PAYLOAD_ROUTED,
|
||||
+ p_bridged = BR2684_PAYLOAD_BRIDGED,
|
||||
+};
|
||||
+
|
||||
#define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \
|
||||
struct br2684_filter_set)
|
||||
|
||||
#endif /* _LINUX_ATMBR2684_H */
|
||||
+
|
||||
--- a/net/atm/br2684.c
|
||||
+++ b/net/atm/br2684.c
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
-Experimental ethernet netdevice using ATM AAL5 as underlying carrier
|
||||
-(RFC1483 obsoleted by RFC2684) for Linux 2.4
|
||||
-Author: Marcell GAL, 2000, XDSL Ltd, Hungary
|
||||
-*/
|
||||
+ * Ethernet netdevice using ATM AAL5 as underlying carrier
|
||||
+ * (RFC1483 obsoleted by RFC2684) for Linux
|
||||
+ *
|
||||
+ * Authors: Marcell GAL, 2000, XDSL Ltd, Hungary
|
||||
+ * Eric Kinzie, 2006-2007, US Naval Research Laboratory
|
||||
+ */
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
@@ -39,21 +41,35 @@ static void skb_debug(const struct sk_bu
|
||||
#define skb_debug(skb) do {} while (0)
|
||||
#endif
|
||||
|
||||
+#define BR2684_ETHERTYPE_LEN 2
|
||||
+#define BR2684_PAD_LEN 2
|
||||
+
|
||||
+#define LLC 0xaa, 0xaa, 0x03
|
||||
+#define SNAP_BRIDGED 0x00, 0x80, 0xc2
|
||||
+#define SNAP_ROUTED 0x00, 0x00, 0x00
|
||||
+#define PID_ETHERNET 0x00, 0x07
|
||||
+#define ETHERTYPE_IPV4 0x08, 0x00
|
||||
+#define ETHERTYPE_IPV6 0x86, 0xdd
|
||||
+#define PAD_BRIDGED 0x00, 0x00
|
||||
+
|
||||
+static unsigned char ethertype_ipv4[] = { ETHERTYPE_IPV4 };
|
||||
+static unsigned char ethertype_ipv6[] = { ETHERTYPE_IPV6 };
|
||||
static unsigned char llc_oui_pid_pad[] =
|
||||
- { 0xAA, 0xAA, 0x03, 0x00, 0x80, 0xC2, 0x00, 0x07, 0x00, 0x00 };
|
||||
-#define PADLEN (2)
|
||||
+ { LLC, SNAP_BRIDGED, PID_ETHERNET, PAD_BRIDGED };
|
||||
+static unsigned char llc_oui_ipv4[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV4 };
|
||||
+static unsigned char llc_oui_ipv6[] = { LLC, SNAP_ROUTED, ETHERTYPE_IPV6 };
|
||||
|
||||
enum br2684_encaps {
|
||||
- e_vc = BR2684_ENCAPS_VC,
|
||||
+ e_vc = BR2684_ENCAPS_VC,
|
||||
e_llc = BR2684_ENCAPS_LLC,
|
||||
};
|
||||
|
||||
struct br2684_vcc {
|
||||
- struct atm_vcc *atmvcc;
|
||||
+ struct atm_vcc *atmvcc;
|
||||
struct net_device *device;
|
||||
- /* keep old push,pop functions for chaining */
|
||||
- void (*old_push)(struct atm_vcc *vcc,struct sk_buff *skb);
|
||||
- /* void (*old_pop)(struct atm_vcc *vcc,struct sk_buff *skb); */
|
||||
+ /* keep old push, pop functions for chaining */
|
||||
+ void (*old_push) (struct atm_vcc * vcc, struct sk_buff * skb);
|
||||
+ /* void (*old_pop)(struct atm_vcc *vcc, struct sk_buff *skb); */
|
||||
enum br2684_encaps encaps;
|
||||
struct list_head brvccs;
|
||||
#ifdef CONFIG_ATM_BR2684_IPFILTER
|
||||
@@ -66,9 +82,10 @@ struct br2684_dev {
|
||||
struct net_device *net_dev;
|
||||
struct list_head br2684_devs;
|
||||
int number;
|
||||
- struct list_head brvccs; /* one device <=> one vcc (before xmas) */
|
||||
+ struct list_head brvccs; /* one device <=> one vcc (before xmas) */
|
||||
struct net_device_stats stats;
|
||||
int mac_was_set;
|
||||
+ enum br2684_payload payload;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -84,7 +101,7 @@ static LIST_HEAD(br2684_devs);
|
||||
|
||||
static inline struct br2684_dev *BRPRIV(const struct net_device *net_dev)
|
||||
{
|
||||
- return (struct br2684_dev *) net_dev->priv;
|
||||
+ return (struct br2684_dev *)net_dev->priv;
|
||||
}
|
||||
|
||||
static inline struct net_device *list_entry_brdev(const struct list_head *le)
|
||||
@@ -94,7 +111,7 @@ static inline struct net_device *list_en
|
||||
|
||||
static inline struct br2684_vcc *BR2684_VCC(const struct atm_vcc *atmvcc)
|
||||
{
|
||||
- return (struct br2684_vcc *) (atmvcc->user_back);
|
||||
+ return (struct br2684_vcc *)(atmvcc->user_back);
|
||||
}
|
||||
|
||||
static inline struct br2684_vcc *list_entry_brvcc(const struct list_head *le)
|
||||
@@ -132,10 +149,11 @@ static struct net_device *br2684_find_de
|
||||
* otherwise false
|
||||
*/
|
||||
static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev,
|
||||
- struct br2684_vcc *brvcc)
|
||||
+ struct br2684_vcc *brvcc)
|
||||
{
|
||||
struct atm_vcc *atmvcc;
|
||||
int minheadroom = (brvcc->encaps == e_llc) ? 10 : 2;
|
||||
+
|
||||
if (skb_headroom(skb) < minheadroom) {
|
||||
struct sk_buff *skb2 = skb_realloc_headroom(skb, minheadroom);
|
||||
brvcc->copies_needed++;
|
||||
@@ -146,23 +164,48 @@ static int br2684_xmit_vcc(struct sk_buf
|
||||
}
|
||||
skb = skb2;
|
||||
}
|
||||
- skb_push(skb, minheadroom);
|
||||
- if (brvcc->encaps == e_llc)
|
||||
- skb_copy_to_linear_data(skb, llc_oui_pid_pad, 10);
|
||||
- else
|
||||
- memset(skb->data, 0, 2);
|
||||
+
|
||||
+ if (brvcc->encaps == e_llc) {
|
||||
+ if (brdev->payload == p_bridged) {
|
||||
+ skb_push(skb, sizeof(llc_oui_pid_pad));
|
||||
+ skb_copy_to_linear_data(skb, llc_oui_pid_pad,
|
||||
+ sizeof(llc_oui_pid_pad));
|
||||
+ } else if (brdev->payload == p_routed) {
|
||||
+ unsigned short prot = ntohs(skb->protocol);
|
||||
+
|
||||
+ skb_push(skb, sizeof(llc_oui_ipv4));
|
||||
+ switch (prot) {
|
||||
+ case ETH_P_IP:
|
||||
+ skb_copy_to_linear_data(skb, llc_oui_ipv4,
|
||||
+ sizeof(llc_oui_ipv4));
|
||||
+ break;
|
||||
+ case ETH_P_IPV6:
|
||||
+ skb_copy_to_linear_data(skb, llc_oui_ipv6,
|
||||
+ sizeof(llc_oui_ipv6));
|
||||
+ break;
|
||||
+ default:
|
||||
+ dev_kfree_skb(skb);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ skb_push(skb, 2);
|
||||
+ if (brdev->payload == p_bridged)
|
||||
+ memset(skb->data, 0, 2);
|
||||
+ }
|
||||
skb_debug(skb);
|
||||
|
||||
ATM_SKB(skb)->vcc = atmvcc = brvcc->atmvcc;
|
||||
pr_debug("atm_skb(%p)->vcc(%p)->dev(%p)\n", skb, atmvcc, atmvcc->dev);
|
||||
if (!atm_may_send(atmvcc, skb->truesize)) {
|
||||
- /* we free this here for now, because we cannot know in a higher
|
||||
- layer whether the skb point it supplied wasn't freed yet.
|
||||
- now, it always is.
|
||||
- */
|
||||
+ /*
|
||||
+ * We free this here for now, because we cannot know in a higher
|
||||
+ * layer whether the skb pointer it supplied wasn't freed yet.
|
||||
+ * Now, it always is.
|
||||
+ */
|
||||
dev_kfree_skb(skb);
|
||||
return 0;
|
||||
- }
|
||||
+ }
|
||||
atomic_add(skb->truesize, &sk_atm(atmvcc)->sk_wmem_alloc);
|
||||
ATM_SKB(skb)->atm_options = atmvcc->atm_options;
|
||||
brdev->stats.tx_packets++;
|
||||
@@ -172,10 +215,9 @@ static int br2684_xmit_vcc(struct sk_buf
|
||||
}
|
||||
|
||||
static inline struct br2684_vcc *pick_outgoing_vcc(struct sk_buff *skb,
|
||||
- struct br2684_dev *brdev)
|
||||
+ struct br2684_dev *brdev)
|
||||
{
|
||||
- return list_empty(&brdev->brvccs) ? NULL :
|
||||
- list_entry_brvcc(brdev->brvccs.next); /* 1 vcc/dev right now */
|
||||
+ return list_empty(&brdev->brvccs) ? NULL : list_entry_brvcc(brdev->brvccs.next); /* 1 vcc/dev right now */
|
||||
}
|
||||
|
||||
static int br2684_start_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||
@@ -199,11 +241,10 @@ static int br2684_start_xmit(struct sk_b
|
||||
/*
|
||||
* We should probably use netif_*_queue() here, but that
|
||||
* involves added complication. We need to walk before
|
||||
- * we can run
|
||||
+ * we can run.
|
||||
+ *
|
||||
+ * Don't free here! this pointer might be no longer valid!
|
||||
*/
|
||||
- /* don't free here! this pointer might be no longer valid!
|
||||
- dev_kfree_skb(skb);
|
||||
- */
|
||||
brdev->stats.tx_errors++;
|
||||
brdev->stats.tx_fifo_errors++;
|
||||
}
|
||||
@@ -217,12 +258,11 @@ static struct net_device_stats *br2684_g
|
||||
return &BRPRIV(dev)->stats;
|
||||
}
|
||||
|
||||
-
|
||||
/*
|
||||
* We remember when the MAC gets set, so we don't override it later with
|
||||
* the ESI of the ATM card of the first VC
|
||||
*/
|
||||
-static int (*my_eth_mac_addr)(struct net_device *, void *);
|
||||
+static int (*my_eth_mac_addr) (struct net_device *, void *);
|
||||
static int br2684_mac_addr(struct net_device *dev, void *p)
|
||||
{
|
||||
int err = my_eth_mac_addr(dev, p);
|
||||
@@ -233,7 +273,7 @@ static int br2684_mac_addr(struct net_de
|
||||
|
||||
#ifdef CONFIG_ATM_BR2684_IPFILTER
|
||||
/* this IOCTL is experimental. */
|
||||
-static int br2684_setfilt(struct atm_vcc *atmvcc, void __user *arg)
|
||||
+static int br2684_setfilt(struct atm_vcc *atmvcc, void __user * arg)
|
||||
{
|
||||
struct br2684_vcc *brvcc;
|
||||
struct br2684_filter_set fs;
|
||||
@@ -243,13 +283,12 @@ static int br2684_setfilt(struct atm_vcc
|
||||
if (fs.ifspec.method != BR2684_FIND_BYNOTHING) {
|
||||
/*
|
||||
* This is really a per-vcc thing, but we can also search
|
||||
- * by device
|
||||
+ * by device.
|
||||
*/
|
||||
struct br2684_dev *brdev;
|
||||
read_lock(&devs_lock);
|
||||
brdev = BRPRIV(br2684_find_dev(&fs.ifspec));
|
||||
- if (brdev == NULL || list_empty(&brdev->brvccs) ||
|
||||
- brdev->brvccs.next != brdev->brvccs.prev) /* >1 VCC */
|
||||
+ if (brdev == NULL || list_empty(&brdev->brvccs) || brdev->brvccs.next != brdev->brvccs.prev) /* >1 VCC */
|
||||
brvcc = NULL;
|
||||
else
|
||||
brvcc = list_entry_brvcc(brdev->brvccs.next);
|
||||
@@ -267,15 +306,16 @@ static inline int
|
||||
packet_fails_filter(__be16 type, struct br2684_vcc *brvcc, struct sk_buff *skb)
|
||||
{
|
||||
if (brvcc->filter.netmask == 0)
|
||||
- return 0; /* no filter in place */
|
||||
+ return 0; /* no filter in place */
|
||||
if (type == htons(ETH_P_IP) &&
|
||||
- (((struct iphdr *) (skb->data))->daddr & brvcc->filter.
|
||||
+ (((struct iphdr *)(skb->data))->daddr & brvcc->filter.
|
||||
netmask) == brvcc->filter.prefix)
|
||||
return 0;
|
||||
if (type == htons(ETH_P_ARP))
|
||||
return 0;
|
||||
- /* TODO: we should probably filter ARPs too.. don't want to have
|
||||
- * them returning values that don't make sense, or is that ok?
|
||||
+ /*
|
||||
+ * TODO: we should probably filter ARPs too.. don't want to have
|
||||
+ * them returning values that don't make sense, or is that ok?
|
||||
*/
|
||||
return 1; /* drop */
|
||||
}
|
||||
@@ -299,7 +339,6 @@ static void br2684_push(struct atm_vcc *
|
||||
struct br2684_vcc *brvcc = BR2684_VCC(atmvcc);
|
||||
struct net_device *net_dev = brvcc->device;
|
||||
struct br2684_dev *brdev = BRPRIV(net_dev);
|
||||
- int plen = sizeof(llc_oui_pid_pad) + ETH_HLEN;
|
||||
|
||||
pr_debug("br2684_push\n");
|
||||
|
||||
@@ -320,35 +359,58 @@ static void br2684_push(struct atm_vcc *
|
||||
atm_return(atmvcc, skb->truesize);
|
||||
pr_debug("skb from brdev %p\n", brdev);
|
||||
if (brvcc->encaps == e_llc) {
|
||||
- /* let us waste some time for checking the encapsulation.
|
||||
- Note, that only 7 char is checked so frames with a valid FCS
|
||||
- are also accepted (but FCS is not checked of course) */
|
||||
- if (memcmp(skb->data, llc_oui_pid_pad, 7)) {
|
||||
+
|
||||
+ if (skb->len > 7 && skb->data[7] == 0x01)
|
||||
+ __skb_trim(skb, skb->len - 4);
|
||||
+
|
||||
+ /* accept packets that have "ipv[46]" in the snap header */
|
||||
+ if ((skb->len >= (sizeof(llc_oui_ipv4)))
|
||||
+ &&
|
||||
+ (memcmp
|
||||
+ (skb->data, llc_oui_ipv4,
|
||||
+ sizeof(llc_oui_ipv4) - BR2684_ETHERTYPE_LEN) == 0)) {
|
||||
+ if (memcmp
|
||||
+ (skb->data + 6, ethertype_ipv6,
|
||||
+ sizeof(ethertype_ipv6)) == 0)
|
||||
+ skb->protocol = __constant_htons(ETH_P_IPV6);
|
||||
+ else if (memcmp
|
||||
+ (skb->data + 6, ethertype_ipv4,
|
||||
+ sizeof(ethertype_ipv4)) == 0)
|
||||
+ skb->protocol = __constant_htons(ETH_P_IP);
|
||||
+ else {
|
||||
+ brdev->stats.rx_errors++;
|
||||
+ dev_kfree_skb(skb);
|
||||
+ return;
|
||||
+ }
|
||||
+ skb_pull(skb, sizeof(llc_oui_ipv4));
|
||||
+ skb_reset_network_header(skb);
|
||||
+ skb->pkt_type = PACKET_HOST;
|
||||
+ /*
|
||||
+ * Let us waste some time for checking the encapsulation.
|
||||
+ * Note, that only 7 char is checked so frames with a valid FCS
|
||||
+ * are also accepted (but FCS is not checked of course).
|
||||
+ */
|
||||
+ } else if ((skb->len >= sizeof(llc_oui_pid_pad)) &&
|
||||
+ (memcmp(skb->data, llc_oui_pid_pad, 7) == 0)) {
|
||||
+ skb_pull(skb, sizeof(llc_oui_pid_pad));
|
||||
+ skb->protocol = eth_type_trans(skb, net_dev);
|
||||
+ } else {
|
||||
brdev->stats.rx_errors++;
|
||||
dev_kfree_skb(skb);
|
||||
return;
|
||||
}
|
||||
|
||||
- /* Strip FCS if present */
|
||||
- if (skb->len > 7 && skb->data[7] == 0x01)
|
||||
- __skb_trim(skb, skb->len - 4);
|
||||
} else {
|
||||
- plen = PADLEN + ETH_HLEN; /* pad, dstmac,srcmac, ethtype */
|
||||
/* first 2 chars should be 0 */
|
||||
if (*((u16 *) (skb->data)) != 0) {
|
||||
brdev->stats.rx_errors++;
|
||||
dev_kfree_skb(skb);
|
||||
return;
|
||||
}
|
||||
- }
|
||||
- if (skb->len < plen) {
|
||||
- brdev->stats.rx_errors++;
|
||||
- dev_kfree_skb(skb); /* dev_ not needed? */
|
||||
- return;
|
||||
+ skb_pull(skb, BR2684_PAD_LEN + ETH_HLEN); /* pad, dstmac, srcmac, ethtype */
|
||||
+ skb->protocol = eth_type_trans(skb, net_dev);
|
||||
}
|
||||
|
||||
- skb_pull(skb, plen - ETH_HLEN);
|
||||
- skb->protocol = eth_type_trans(skb, net_dev);
|
||||
#ifdef CONFIG_ATM_BR2684_IPFILTER
|
||||
if (unlikely(packet_fails_filter(skb->protocol, brvcc, skb))) {
|
||||
brdev->stats.rx_dropped++;
|
||||
@@ -372,11 +434,12 @@ static void br2684_push(struct atm_vcc *
|
||||
netif_rx(skb);
|
||||
}
|
||||
|
||||
-static int br2684_regvcc(struct atm_vcc *atmvcc, void __user *arg)
|
||||
+/*
|
||||
+ * Assign a vcc to a dev
|
||||
+ * Note: we do not have explicit unassign, but look at _push()
|
||||
+ */
|
||||
+static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg)
|
||||
{
|
||||
-/* assign a vcc to a dev
|
||||
-Note: we do not have explicit unassign, but look at _push()
|
||||
-*/
|
||||
int err;
|
||||
struct br2684_vcc *brvcc;
|
||||
struct sk_buff *skb;
|
||||
@@ -395,7 +458,7 @@ Note: we do not have explicit unassign,
|
||||
net_dev = br2684_find_dev(&be.ifspec);
|
||||
if (net_dev == NULL) {
|
||||
printk(KERN_ERR
|
||||
- "br2684: tried to attach to non-existant device\n");
|
||||
+ "br2684: tried to attach to non-existant device\n");
|
||||
err = -ENXIO;
|
||||
goto error;
|
||||
}
|
||||
@@ -411,13 +474,15 @@ Note: we do not have explicit unassign,
|
||||
}
|
||||
if (be.fcs_in != BR2684_FCSIN_NO || be.fcs_out != BR2684_FCSOUT_NO ||
|
||||
be.fcs_auto || be.has_vpiid || be.send_padding || (be.encaps !=
|
||||
- BR2684_ENCAPS_VC && be.encaps != BR2684_ENCAPS_LLC) ||
|
||||
- be.min_size != 0) {
|
||||
+ BR2684_ENCAPS_VC
|
||||
+ && be.encaps !=
|
||||
+ BR2684_ENCAPS_LLC)
|
||||
+ || be.min_size != 0) {
|
||||
err = -EINVAL;
|
||||
goto error;
|
||||
}
|
||||
- pr_debug("br2684_regvcc vcc=%p, encaps=%d, brvcc=%p\n", atmvcc, be.encaps,
|
||||
- brvcc);
|
||||
+ pr_debug("br2684_regvcc vcc=%p, encaps=%d, brvcc=%p\n", atmvcc,
|
||||
+ be.encaps, brvcc);
|
||||
if (list_empty(&brdev->brvccs) && !brdev->mac_was_set) {
|
||||
unsigned char *esi = atmvcc->dev->esi;
|
||||
if (esi[0] | esi[1] | esi[2] | esi[3] | esi[4] | esi[5])
|
||||
@@ -430,7 +495,7 @@ Note: we do not have explicit unassign,
|
||||
brvcc->device = net_dev;
|
||||
brvcc->atmvcc = atmvcc;
|
||||
atmvcc->user_back = brvcc;
|
||||
- brvcc->encaps = (enum br2684_encaps) be.encaps;
|
||||
+ brvcc->encaps = (enum br2684_encaps)be.encaps;
|
||||
brvcc->old_push = atmvcc->push;
|
||||
barrier();
|
||||
atmvcc->push = br2684_push;
|
||||
@@ -461,7 +526,7 @@ Note: we do not have explicit unassign,
|
||||
}
|
||||
__module_get(THIS_MODULE);
|
||||
return 0;
|
||||
- error:
|
||||
+ error:
|
||||
write_unlock_irq(&devs_lock);
|
||||
kfree(brvcc);
|
||||
return err;
|
||||
@@ -482,25 +547,52 @@ static void br2684_setup(struct net_devi
|
||||
INIT_LIST_HEAD(&brdev->brvccs);
|
||||
}
|
||||
|
||||
-static int br2684_create(void __user *arg)
|
||||
+static void br2684_setup_routed(struct net_device *netdev)
|
||||
+{
|
||||
+ struct br2684_dev *brdev = BRPRIV(netdev);
|
||||
+ brdev->net_dev = netdev;
|
||||
+
|
||||
+ netdev->hard_header_len = 0;
|
||||
+ my_eth_mac_addr = netdev->set_mac_address;
|
||||
+ netdev->set_mac_address = br2684_mac_addr;
|
||||
+ netdev->hard_start_xmit = br2684_start_xmit;
|
||||
+ netdev->get_stats = br2684_get_stats;
|
||||
+ netdev->addr_len = 0;
|
||||
+ netdev->mtu = 1500;
|
||||
+ netdev->type = ARPHRD_PPP;
|
||||
+ netdev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
|
||||
+ netdev->tx_queue_len = 100;
|
||||
+ INIT_LIST_HEAD(&brdev->brvccs);
|
||||
+}
|
||||
+
|
||||
+static int br2684_create(void __user * arg)
|
||||
{
|
||||
int err;
|
||||
struct net_device *netdev;
|
||||
struct br2684_dev *brdev;
|
||||
struct atm_newif_br2684 ni;
|
||||
+ enum br2684_payload payload;
|
||||
|
||||
pr_debug("br2684_create\n");
|
||||
|
||||
if (copy_from_user(&ni, arg, sizeof ni)) {
|
||||
return -EFAULT;
|
||||
}
|
||||
+
|
||||
+ if (ni.media & BR2684_FLAG_ROUTED)
|
||||
+ payload = p_routed;
|
||||
+ else
|
||||
+ payload = p_bridged;
|
||||
+ ni.media &= 0xffff; /* strip flags */
|
||||
+
|
||||
if (ni.media != BR2684_MEDIA_ETHERNET || ni.mtu != 1500) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
netdev = alloc_netdev(sizeof(struct br2684_dev),
|
||||
ni.ifname[0] ? ni.ifname : "nas%d",
|
||||
- br2684_setup);
|
||||
+ (payload == p_routed) ?
|
||||
+ br2684_setup_routed : br2684_setup);
|
||||
if (!netdev)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -516,6 +608,7 @@ static int br2684_create(void __user *ar
|
||||
}
|
||||
|
||||
write_lock_irq(&devs_lock);
|
||||
+ brdev->payload = payload;
|
||||
brdev->number = list_empty(&br2684_devs) ? 1 :
|
||||
BRPRIV(list_entry_brdev(br2684_devs.prev))->number + 1;
|
||||
list_add_tail(&brdev->br2684_devs, &br2684_devs);
|
||||
@@ -528,16 +621,16 @@ static int br2684_create(void __user *ar
|
||||
* -ENOIOCTLCMD for any unrecognized ioctl
|
||||
*/
|
||||
static int br2684_ioctl(struct socket *sock, unsigned int cmd,
|
||||
- unsigned long arg)
|
||||
+ unsigned long arg)
|
||||
{
|
||||
struct atm_vcc *atmvcc = ATM_SD(sock);
|
||||
void __user *argp = (void __user *)arg;
|
||||
+ atm_backend_t b;
|
||||
|
||||
int err;
|
||||
- switch(cmd) {
|
||||
+ switch (cmd) {
|
||||
case ATM_SETBACKEND:
|
||||
- case ATM_NEWBACKENDIF: {
|
||||
- atm_backend_t b;
|
||||
+ case ATM_NEWBACKENDIF:
|
||||
err = get_user(b, (atm_backend_t __user *) argp);
|
||||
if (err)
|
||||
return -EFAULT;
|
||||
@@ -549,7 +642,6 @@ static int br2684_ioctl(struct socket *s
|
||||
return br2684_regvcc(atmvcc, argp);
|
||||
else
|
||||
return br2684_create(argp);
|
||||
- }
|
||||
#ifdef CONFIG_ATM_BR2684_IPFILTER
|
||||
case BR2684_SETFILT:
|
||||
if (atmvcc->push != br2684_push)
|
||||
@@ -557,6 +649,7 @@ static int br2684_ioctl(struct socket *s
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
err = br2684_setfilt(atmvcc, argp);
|
||||
+
|
||||
return err;
|
||||
#endif /* CONFIG_ATM_BR2684_IPFILTER */
|
||||
}
|
||||
@@ -564,24 +657,25 @@ static int br2684_ioctl(struct socket *s
|
||||
}
|
||||
|
||||
static struct atm_ioctl br2684_ioctl_ops = {
|
||||
- .owner = THIS_MODULE,
|
||||
- .ioctl = br2684_ioctl,
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .ioctl = br2684_ioctl,
|
||||
};
|
||||
|
||||
-
|
||||
#ifdef CONFIG_PROC_FS
|
||||
-static void *br2684_seq_start(struct seq_file *seq, loff_t *pos)
|
||||
+static void *br2684_seq_start(struct seq_file *seq, loff_t * pos)
|
||||
+ __acquires(devs_lock)
|
||||
{
|
||||
read_lock(&devs_lock);
|
||||
return seq_list_start(&br2684_devs, *pos);
|
||||
}
|
||||
|
||||
-static void *br2684_seq_next(struct seq_file *seq, void *v, loff_t *pos)
|
||||
+static void *br2684_seq_next(struct seq_file *seq, void *v, loff_t * pos)
|
||||
{
|
||||
return seq_list_next(v, &br2684_devs, pos);
|
||||
}
|
||||
|
||||
static void br2684_seq_stop(struct seq_file *seq, void *v)
|
||||
+ __releases(devs_lock)
|
||||
{
|
||||
read_unlock(&devs_lock);
|
||||
}
|
||||
@@ -589,7 +683,7 @@ static void br2684_seq_stop(struct seq_f
|
||||
static int br2684_seq_show(struct seq_file *seq, void *v)
|
||||
{
|
||||
const struct br2684_dev *brdev = list_entry(v, struct br2684_dev,
|
||||
- br2684_devs);
|
||||
+ br2684_devs);
|
||||
const struct net_device *net_dev = brdev->net_dev;
|
||||
const struct br2684_vcc *brvcc;
|
||||
DECLARE_MAC_BUF(mac);
|
||||
@@ -601,21 +695,19 @@ static int br2684_seq_show(struct seq_fi
|
||||
brdev->mac_was_set ? "set" : "auto");
|
||||
|
||||
list_for_each_entry(brvcc, &brdev->brvccs, brvccs) {
|
||||
- seq_printf(seq, " vcc %d.%d.%d: encaps=%s"
|
||||
- ", failed copies %u/%u"
|
||||
- "\n", brvcc->atmvcc->dev->number,
|
||||
- brvcc->atmvcc->vpi, brvcc->atmvcc->vci,
|
||||
- (brvcc->encaps == e_llc) ? "LLC" : "VC"
|
||||
- , brvcc->copies_failed
|
||||
- , brvcc->copies_needed
|
||||
- );
|
||||
+ seq_printf(seq, " vcc %d.%d.%d: encaps=%s payload=%s"
|
||||
+ ", failed copies %u/%u"
|
||||
+ "\n", brvcc->atmvcc->dev->number,
|
||||
+ brvcc->atmvcc->vpi, brvcc->atmvcc->vci,
|
||||
+ (brvcc->encaps == e_llc) ? "LLC" : "VC",
|
||||
+ (brdev->payload == p_bridged) ? "bridged" : "routed",
|
||||
+ brvcc->copies_failed, brvcc->copies_needed);
|
||||
#ifdef CONFIG_ATM_BR2684_IPFILTER
|
||||
#define b1(var, byte) ((u8 *) &brvcc->filter.var)[byte]
|
||||
#define bs(var) b1(var, 0), b1(var, 1), b1(var, 2), b1(var, 3)
|
||||
- if (brvcc->filter.netmask != 0)
|
||||
- seq_printf(seq, " filter=%d.%d.%d.%d/"
|
||||
- "%d.%d.%d.%d\n",
|
||||
- bs(prefix), bs(netmask));
|
||||
+ if (brvcc->filter.netmask != 0)
|
||||
+ seq_printf(seq, " filter=%d.%d.%d.%d/"
|
||||
+ "%d.%d.%d.%d\n", bs(prefix), bs(netmask));
|
||||
#undef bs
|
||||
#undef b1
|
||||
#endif /* CONFIG_ATM_BR2684_IPFILTER */
|
||||
@@ -625,9 +717,9 @@ static int br2684_seq_show(struct seq_fi
|
||||
|
||||
static const struct seq_operations br2684_seq_ops = {
|
||||
.start = br2684_seq_start,
|
||||
- .next = br2684_seq_next,
|
||||
- .stop = br2684_seq_stop,
|
||||
- .show = br2684_seq_show,
|
||||
+ .next = br2684_seq_next,
|
||||
+ .stop = br2684_seq_stop,
|
||||
+ .show = br2684_seq_show,
|
||||
};
|
||||
|
||||
static int br2684_proc_open(struct inode *inode, struct file *file)
|
||||
@@ -636,26 +728,28 @@ static int br2684_proc_open(struct inode
|
||||
}
|
||||
|
||||
static const struct file_operations br2684_proc_ops = {
|
||||
- .owner = THIS_MODULE,
|
||||
- .open = br2684_proc_open,
|
||||
- .read = seq_read,
|
||||
- .llseek = seq_lseek,
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .open = br2684_proc_open,
|
||||
+ .read = seq_read,
|
||||
+ .llseek = seq_lseek,
|
||||
.release = seq_release,
|
||||
};
|
||||
|
||||
extern struct proc_dir_entry *atm_proc_root; /* from proc.c */
|
||||
-#endif
|
||||
+#endif /* CONFIG_PROC_FS */
|
||||
|
||||
static int __init br2684_init(void)
|
||||
{
|
||||
#ifdef CONFIG_PROC_FS
|
||||
struct proc_dir_entry *p;
|
||||
+
|
||||
if ((p = create_proc_entry("br2684", 0, atm_proc_root)) == NULL)
|
||||
- return -ENOMEM;
|
||||
- p->proc_fops = &br2684_proc_ops;
|
||||
+ return -ENOMEM;
|
||||
+ p->proc_fops = &br2684_proc_ops;
|
||||
#endif
|
||||
- register_atm_ioctl(&br2684_ioctl_ops);
|
||||
- return 0;
|
||||
+ register_atm_ioctl(&br2684_ioctl_ops);
|
||||
+ return 0;
|
||||
+
|
||||
}
|
||||
|
||||
static void __exit br2684_exit(void)
|
||||
@@ -689,3 +783,4 @@ module_exit(br2684_exit);
|
||||
MODULE_AUTHOR("Marcell GAL");
|
||||
MODULE_DESCRIPTION("RFC2684 bridged protocols over ATM/AAL5");
|
||||
MODULE_LICENSE("GPL");
|
||||
+
|
File diff suppressed because it is too large
Load Diff
|
@ -1,25 +0,0 @@
|
|||
--- a/drivers/usb/serial/usb-serial.c
|
||||
+++ b/drivers/usb/serial/usb-serial.c
|
||||
@@ -58,6 +58,7 @@ static struct usb_driver usb_serial_driv
|
||||
drivers depend on it.
|
||||
*/
|
||||
|
||||
+static ushort maxSize = 0;
|
||||
static int debug;
|
||||
static struct usb_serial *serial_table[SERIAL_TTY_MINORS]; /* initially all NULL */
|
||||
static DEFINE_MUTEX(table_lock);
|
||||
@@ -894,7 +895,7 @@ int usb_serial_probe(struct usb_interfac
|
||||
dev_err(&interface->dev, "No free urbs available\n");
|
||||
goto probe_error;
|
||||
}
|
||||
- buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
|
||||
+ buffer_size = (endpoint->wMaxPacketSize > maxSize) ? endpoint->wMaxPacketSize : maxSize;
|
||||
port->bulk_in_size = buffer_size;
|
||||
port->bulk_in_endpointAddress = endpoint->bEndpointAddress;
|
||||
port->bulk_in_buffer = kmalloc (buffer_size, GFP_KERNEL);
|
||||
@@ -1306,3 +1307,5 @@ MODULE_LICENSE("GPL");
|
||||
|
||||
module_param(debug, bool, S_IRUGO | S_IWUSR);
|
||||
MODULE_PARM_DESC(debug, "Debug enabled or not");
|
||||
+module_param(maxSize, ushort,0);
|
||||
+MODULE_PARM_DESC(maxSize,"User specified USB endpoint size");
|
|
@ -1,11 +0,0 @@
|
|||
--- a/init/main.c
|
||||
+++ b/init/main.c
|
||||
@@ -773,7 +773,7 @@ static int noinline init_post(void)
|
||||
numa_default_policy();
|
||||
|
||||
if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
|
||||
- printk(KERN_WARNING "Warning: unable to open an initial console.\n");
|
||||
+ printk(KERN_WARNING "Please be patient, while OpenWrt loads ...\n");
|
||||
|
||||
(void) sys_dup(0);
|
||||
(void) sys_dup(0);
|
|
@ -1,23 +0,0 @@
|
|||
--- a/fs/jffs2/erase.c
|
||||
+++ b/fs/jffs2/erase.c
|
||||
@@ -35,6 +35,8 @@ static void jffs2_erase_block(struct jff
|
||||
{
|
||||
int ret;
|
||||
uint32_t bad_offset;
|
||||
+ static char s[]="|/-\\", *p=s;
|
||||
+
|
||||
#ifdef __ECOS
|
||||
ret = jffs2_flash_erase(c, jeb);
|
||||
if (!ret) {
|
||||
@@ -47,6 +49,11 @@ static void jffs2_erase_block(struct jff
|
||||
|
||||
D1(printk(KERN_DEBUG "jffs2_erase_block(): erase block %#08x (range %#08x-%#08x)\n",
|
||||
jeb->offset, jeb->offset, jeb->offset + c->sector_size));
|
||||
+
|
||||
+ printk("%c\b", *p);
|
||||
+ if (*++p==0)
|
||||
+ p=s;
|
||||
+
|
||||
instr = kmalloc(sizeof(struct erase_info) + sizeof(struct erase_priv_struct), GFP_KERNEL);
|
||||
if (!instr) {
|
||||
printk(KERN_WARNING "kmalloc for struct erase_info in jffs2_erase_block failed. Refiling block for later\n");
|
|
@ -1,46 +0,0 @@
|
|||
--- a/include/linux/time.h
|
||||
+++ b/include/linux/time.h
|
||||
@@ -1,6 +1,10 @@
|
||||
#ifndef _LINUX_TIME_H
|
||||
#define _LINUX_TIME_H
|
||||
|
||||
+#ifndef __KERNEL__
|
||||
+#include <time.h>
|
||||
+#else
|
||||
+
|
||||
#include <linux/types.h>
|
||||
|
||||
#ifdef __KERNEL__
|
||||
@@ -231,4 +235,6 @@ struct itimerval {
|
||||
*/
|
||||
#define TIMER_ABSTIME 0x01
|
||||
|
||||
+#endif /* __KERNEL__ DEBIAN */
|
||||
+
|
||||
#endif
|
||||
--- a/include/linux/types.h
|
||||
+++ b/include/linux/types.h
|
||||
@@ -1,6 +1,14 @@
|
||||
#ifndef _LINUX_TYPES_H
|
||||
#define _LINUX_TYPES_H
|
||||
|
||||
+/* Debian: Use userland types instead. */
|
||||
+#ifndef __KERNEL__
|
||||
+# include <sys/types.h>
|
||||
+/* For other kernel headers. */
|
||||
+# include <linux/posix_types.h>
|
||||
+# include <asm/types.h>
|
||||
+#else
|
||||
+
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#define DECLARE_BITMAP(name,bits) \
|
||||
@@ -161,6 +169,8 @@ typedef unsigned long blkcnt_t;
|
||||
|
||||
#endif /* __KERNEL_STRICT_NAMES */
|
||||
|
||||
+#endif /* __KERNEL__ DEBIAN */
|
||||
+
|
||||
/*
|
||||
* Below are truly Linux-specific types that should never collide with
|
||||
* any application/library that wants linux/types.h.
|
|
@ -1,102 +0,0 @@
|
|||
--- a/scripts/genksyms/parse.c_shipped
|
||||
+++ b/scripts/genksyms/parse.c_shipped
|
||||
@@ -160,7 +160,9 @@
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
+#ifndef __APPLE__
|
||||
#include <malloc.h>
|
||||
+#endif
|
||||
#include "genksyms.h"
|
||||
|
||||
static int is_typedef;
|
||||
--- a/scripts/genksyms/parse.y
|
||||
+++ b/scripts/genksyms/parse.y
|
||||
@@ -24,7 +24,9 @@
|
||||
%{
|
||||
|
||||
#include <assert.h>
|
||||
+#ifndef __APPLE__
|
||||
#include <malloc.h>
|
||||
+#endif
|
||||
#include "genksyms.h"
|
||||
|
||||
static int is_typedef;
|
||||
--- a/scripts/kallsyms.c
|
||||
+++ b/scripts/kallsyms.c
|
||||
@@ -28,6 +28,35 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
+#ifdef __APPLE__
|
||||
+/* Darwin has no memmem implementation, this one is ripped of the uClibc-0.9.28 source */
|
||||
+void *memmem (const void *haystack, size_t haystack_len,
|
||||
+ const void *needle, size_t needle_len)
|
||||
+{
|
||||
+ const char *begin;
|
||||
+ const char *const last_possible
|
||||
+ = (const char *) haystack + haystack_len - needle_len;
|
||||
+
|
||||
+ if (needle_len == 0)
|
||||
+ /* The first occurrence of the empty string is deemed to occur at
|
||||
+ the beginning of the string. */
|
||||
+ return (void *) haystack;
|
||||
+
|
||||
+ /* Sanity check, otherwise the loop might search through the whole
|
||||
+ memory. */
|
||||
+ if (__builtin_expect (haystack_len < needle_len, 0))
|
||||
+ return NULL;
|
||||
+
|
||||
+ for (begin = (const char *) haystack; begin <= last_possible; ++begin)
|
||||
+ if (begin[0] == ((const char *) needle)[0] &&
|
||||
+ !memcmp ((const void *) &begin[1],
|
||||
+ (const void *) ((const char *) needle + 1),
|
||||
+ needle_len - 1))
|
||||
+ return (void *) begin;
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+#endif
|
||||
|
||||
#define KSYM_NAME_LEN 128
|
||||
|
||||
--- a/scripts/kconfig/Makefile
|
||||
+++ b/scripts/kconfig/Makefile
|
||||
@@ -90,6 +90,9 @@ check-lxdialog := $(srctree)/$(src)/lxd
|
||||
# we really need to do so. (Do not call gcc as part of make mrproper)
|
||||
HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
|
||||
HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
|
||||
+ifeq ($(shell uname -s),Darwin)
|
||||
+HOST_LOADLIBES += -lncurses
|
||||
+endif
|
||||
|
||||
HOST_EXTRACFLAGS += -DLOCALE
|
||||
|
||||
--- a/scripts/mod/mk_elfconfig.c
|
||||
+++ b/scripts/mod/mk_elfconfig.c
|
||||
@@ -1,7 +1,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
+#ifndef __APPLE__
|
||||
#include <elf.h>
|
||||
+#else
|
||||
+#include "../../../../../tools/sstrip/include/elf.h"
|
||||
+#endif
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
--- a/scripts/mod/modpost.h
|
||||
+++ b/scripts/mod/modpost.h
|
||||
@@ -7,7 +7,11 @@
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
+#ifndef __APPLE__
|
||||
#include <elf.h>
|
||||
+#else
|
||||
+#include "../../../../../tools/sstrip/include/elf.h"
|
||||
+#endif
|
||||
|
||||
#include "elfconfig.h"
|
||||
|
|
@ -1,154 +0,0 @@
|
|||
--- a/drivers/net/wireless/hostap/hostap_ap.c
|
||||
+++ b/drivers/net/wireless/hostap/hostap_ap.c
|
||||
@@ -2358,13 +2358,13 @@ int prism2_ap_get_sta_qual(local_info_t
|
||||
addr[count].sa_family = ARPHRD_ETHER;
|
||||
memcpy(addr[count].sa_data, sta->addr, ETH_ALEN);
|
||||
if (sta->last_rx_silence == 0)
|
||||
- qual[count].qual = sta->last_rx_signal < 27 ?
|
||||
- 0 : (sta->last_rx_signal - 27) * 92 / 127;
|
||||
+ qual[count].qual = (sta->last_rx_signal - 156) == 0 ?
|
||||
+ 0 : (sta->last_rx_signal - 156) * 92 / 64;
|
||||
else
|
||||
- qual[count].qual = sta->last_rx_signal -
|
||||
- sta->last_rx_silence - 35;
|
||||
- qual[count].level = HFA384X_LEVEL_TO_dBm(sta->last_rx_signal);
|
||||
- qual[count].noise = HFA384X_LEVEL_TO_dBm(sta->last_rx_silence);
|
||||
+ qual[count].qual = (sta->last_rx_signal -
|
||||
+ sta->last_rx_silence) * 92 / 64;
|
||||
+ qual[count].level = sta->last_rx_signal;
|
||||
+ qual[count].noise = sta->last_rx_silence;
|
||||
qual[count].updated = sta->last_rx_updated;
|
||||
|
||||
sta->last_rx_updated = IW_QUAL_DBM;
|
||||
@@ -2429,13 +2429,13 @@ int prism2_ap_translate_scan(struct net_
|
||||
memset(&iwe, 0, sizeof(iwe));
|
||||
iwe.cmd = IWEVQUAL;
|
||||
if (sta->last_rx_silence == 0)
|
||||
- iwe.u.qual.qual = sta->last_rx_signal < 27 ?
|
||||
- 0 : (sta->last_rx_signal - 27) * 92 / 127;
|
||||
+ iwe.u.qual.qual = (sta->last_rx_signal -156) == 0 ?
|
||||
+ 0 : (sta->last_rx_signal - 156) * 92 / 64;
|
||||
else
|
||||
- iwe.u.qual.qual = sta->last_rx_signal -
|
||||
- sta->last_rx_silence - 35;
|
||||
- iwe.u.qual.level = HFA384X_LEVEL_TO_dBm(sta->last_rx_signal);
|
||||
- iwe.u.qual.noise = HFA384X_LEVEL_TO_dBm(sta->last_rx_silence);
|
||||
+ iwe.u.qual.qual = (sta->last_rx_signal -
|
||||
+ sta->last_rx_silence) * 92 / 64;
|
||||
+ iwe.u.qual.level = sta->last_rx_signal;
|
||||
+ iwe.u.qual.noise = sta->last_rx_silence;
|
||||
iwe.u.qual.updated = sta->last_rx_updated;
|
||||
iwe.len = IW_EV_QUAL_LEN;
|
||||
current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe,
|
||||
--- a/drivers/net/wireless/hostap/hostap_config.h
|
||||
+++ b/drivers/net/wireless/hostap/hostap_config.h
|
||||
@@ -45,4 +45,9 @@
|
||||
*/
|
||||
/* #define PRISM2_NO_STATION_MODES */
|
||||
|
||||
+/* Enable TX power Setting functions
|
||||
+ * (min att = -128 , max att = 127)
|
||||
+ */
|
||||
+#define RAW_TXPOWER_SETTING
|
||||
+
|
||||
#endif /* HOSTAP_CONFIG_H */
|
||||
--- a/drivers/net/wireless/hostap/hostap.h
|
||||
+++ b/drivers/net/wireless/hostap/hostap.h
|
||||
@@ -89,6 +89,7 @@ extern const struct iw_handler_def hosta
|
||||
extern const struct ethtool_ops prism2_ethtool_ops;
|
||||
|
||||
int hostap_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
|
||||
+int hostap_restore_power(struct net_device *dev);
|
||||
|
||||
|
||||
#endif /* HOSTAP_H */
|
||||
--- a/drivers/net/wireless/hostap/hostap_hw.c
|
||||
+++ b/drivers/net/wireless/hostap/hostap_hw.c
|
||||
@@ -933,6 +933,7 @@ static int hfa384x_set_rid(struct net_de
|
||||
prism2_hw_reset(dev);
|
||||
}
|
||||
|
||||
+ hostap_restore_power(dev);
|
||||
return res;
|
||||
}
|
||||
|
||||
--- a/drivers/net/wireless/hostap/hostap_info.c
|
||||
+++ b/drivers/net/wireless/hostap/hostap_info.c
|
||||
@@ -433,6 +433,11 @@ static void handle_info_queue_linkstatus
|
||||
}
|
||||
|
||||
/* Get BSSID if we have a valid AP address */
|
||||
+
|
||||
+ if ( val == HFA384X_LINKSTATUS_CONNECTED ||
|
||||
+ val == HFA384X_LINKSTATUS_DISCONNECTED )
|
||||
+ hostap_restore_power(local->dev);
|
||||
+
|
||||
if (connected) {
|
||||
netif_carrier_on(local->dev);
|
||||
netif_carrier_on(local->ddev);
|
||||
--- a/drivers/net/wireless/hostap/hostap_ioctl.c
|
||||
+++ b/drivers/net/wireless/hostap/hostap_ioctl.c
|
||||
@@ -1501,23 +1501,20 @@ static int prism2_txpower_hfa386x_to_dBm
|
||||
val = 255;
|
||||
|
||||
tmp = val;
|
||||
- tmp >>= 2;
|
||||
|
||||
- return -12 - tmp;
|
||||
+ return tmp;
|
||||
}
|
||||
|
||||
static u16 prism2_txpower_dBm_to_hfa386x(int val)
|
||||
{
|
||||
signed char tmp;
|
||||
|
||||
- if (val > 20)
|
||||
- return 128;
|
||||
- else if (val < -43)
|
||||
+ if (val > 127)
|
||||
return 127;
|
||||
+ else if (val < -128)
|
||||
+ return 128;
|
||||
|
||||
tmp = val;
|
||||
- tmp = -12 - tmp;
|
||||
- tmp <<= 2;
|
||||
|
||||
return (unsigned char) tmp;
|
||||
}
|
||||
@@ -4077,3 +4074,35 @@ int hostap_ioctl(struct net_device *dev,
|
||||
|
||||
return ret;
|
||||
}
|
||||
+
|
||||
+/* BUG FIX: Restore power setting value when lost due to F/W bug */
|
||||
+
|
||||
+int hostap_restore_power(struct net_device *dev)
|
||||
+{
|
||||
+ struct hostap_interface *iface = dev->priv;
|
||||
+ local_info_t *local = iface->local;
|
||||
+
|
||||
+ u16 val;
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ if (local->txpower_type == PRISM2_TXPOWER_OFF) {
|
||||
+ val = 0xff; /* use all standby and sleep modes */
|
||||
+ ret = local->func->cmd(dev, HFA384X_CMDCODE_WRITEMIF,
|
||||
+ HFA386X_CR_A_D_TEST_MODES2,
|
||||
+ &val, NULL);
|
||||
+ }
|
||||
+
|
||||
+#ifdef RAW_TXPOWER_SETTING
|
||||
+ if (local->txpower_type == PRISM2_TXPOWER_FIXED) {
|
||||
+ val = HFA384X_TEST_CFG_BIT_ALC;
|
||||
+ local->func->cmd(dev, HFA384X_CMDCODE_TEST |
|
||||
+ (HFA384X_TEST_CFG_BITS << 8), 0, &val, NULL);
|
||||
+ val = prism2_txpower_dBm_to_hfa386x(local->txpower);
|
||||
+ ret = (local->func->cmd(dev, HFA384X_CMDCODE_WRITEMIF,
|
||||
+ HFA386X_CR_MANUAL_TX_POWER, &val, NULL));
|
||||
+ }
|
||||
+#endif /* RAW_TXPOWER_SETTING */
|
||||
+ return (ret ? -EOPNOTSUPP : 0);
|
||||
+}
|
||||
+
|
||||
+EXPORT_SYMBOL(hostap_restore_power);
|
|
@ -1,17 +0,0 @@
|
|||
--- a/include/linux/stddef.h
|
||||
+++ b/include/linux/stddef.h
|
||||
@@ -16,6 +16,7 @@ enum {
|
||||
false = 0,
|
||||
true = 1
|
||||
};
|
||||
+#endif /* __KERNEL__ */
|
||||
|
||||
#undef offsetof
|
||||
#ifdef __compiler_offsetof
|
||||
@@ -23,6 +24,5 @@ enum {
|
||||
#else
|
||||
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
||||
#endif
|
||||
-#endif /* __KERNEL__ */
|
||||
|
||||
#endif
|
|
@ -1,20 +0,0 @@
|
|||
--- a/scripts/gen_initramfs_list.sh
|
||||
+++ b/scripts/gen_initramfs_list.sh
|
||||
@@ -125,7 +125,7 @@ parse() {
|
||||
str="${ftype} ${name} ${location} ${str}"
|
||||
;;
|
||||
"nod")
|
||||
- local dev=`LC_ALL=C ls -l "${location}"`
|
||||
+ local dev=`LC_ALL=C ls -l --time-style=locale "${location}"`
|
||||
local maj=`field 5 ${dev}`
|
||||
local min=`field 6 ${dev}`
|
||||
maj=${maj%,}
|
||||
@@ -135,7 +135,7 @@ parse() {
|
||||
str="${ftype} ${name} ${str} ${dev} ${maj} ${min}"
|
||||
;;
|
||||
"slink")
|
||||
- local target=`field 11 $(LC_ALL=C ls -l "${location}")`
|
||||
+ local target=`field 11 $(LC_ALL=C ls -l --time-style=locale "${location}")`
|
||||
str="${ftype} ${name} ${target} ${str}"
|
||||
;;
|
||||
*)
|
|
@ -1,10 +0,0 @@
|
|||
--- a/arch/x86/boot/tools/build.c
|
||||
+++ b/arch/x86/boot/tools/build.c
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <stdarg.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
-#include <sys/sysmacros.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
|
@ -1,24 +0,0 @@
|
|||
--- a/drivers/spi/Kconfig
|
||||
+++ b/drivers/spi/Kconfig
|
||||
@@ -100,6 +100,11 @@ config SPI_BUTTERFLY
|
||||
inexpensive battery powered microcontroller evaluation board.
|
||||
This same cable can be used to flash new firmware.
|
||||
|
||||
+config SPI_GPIO
|
||||
+ tristate "GPIO API based bitbanging SPI controller"
|
||||
+ depends on SPI_MASTER && GENERIC_GPIO && EXPERIMENTAL
|
||||
+ select SPI_BITBANG
|
||||
+
|
||||
config SPI_IMX
|
||||
tristate "Freescale iMX SPI controller"
|
||||
depends on SPI_MASTER && ARCH_IMX && EXPERIMENTAL
|
||||
--- a/drivers/spi/Makefile
|
||||
+++ b/drivers/spi/Makefile
|
||||
@@ -16,6 +16,7 @@ obj-$(CONFIG_SPI_BFIN) += spi_bfin5xx.
|
||||
obj-$(CONFIG_SPI_BITBANG) += spi_bitbang.o
|
||||
obj-$(CONFIG_SPI_AU1550) += au1550_spi.o
|
||||
obj-$(CONFIG_SPI_BUTTERFLY) += spi_butterfly.o
|
||||
+obj-$(CONFIG_SPI_GPIO) += spi_gpio.o
|
||||
obj-$(CONFIG_SPI_IMX) += spi_imx.o
|
||||
obj-$(CONFIG_SPI_LM70_LLP) += spi_lm70llp.o
|
||||
obj-$(CONFIG_SPI_PXA2XX) += pxa2xx_spi.o
|
|
@ -1,178 +0,0 @@
|
|||
--- a/drivers/w1/masters/Kconfig
|
||||
+++ b/drivers/w1/masters/Kconfig
|
||||
@@ -42,5 +42,15 @@ config W1_MASTER_DS1WM
|
||||
in HP iPAQ devices like h5xxx, h2200, and ASIC3-based like
|
||||
hx4700.
|
||||
|
||||
+config W1_MASTER_GPIO
|
||||
+ tristate "GPIO 1-wire busmaster"
|
||||
+ depends on GENERIC_GPIO
|
||||
+ help
|
||||
+ Say Y here if you want to communicate with your 1-wire devices using
|
||||
+ GPIO pins. This driver uses the GPIO API to control the wire.
|
||||
+
|
||||
+ This support is also available as a module. If so, the module
|
||||
+ will be called w1-gpio.ko.
|
||||
+
|
||||
endmenu
|
||||
|
||||
--- a/drivers/w1/masters/Makefile
|
||||
+++ b/drivers/w1/masters/Makefile
|
||||
@@ -6,3 +6,4 @@ obj-$(CONFIG_W1_MASTER_MATROX) += matro
|
||||
obj-$(CONFIG_W1_MASTER_DS2490) += ds2490.o
|
||||
obj-$(CONFIG_W1_MASTER_DS2482) += ds2482.o
|
||||
obj-$(CONFIG_W1_MASTER_DS1WM) += ds1wm.o
|
||||
+obj-$(CONFIG_W1_MASTER_GPIO) += w1-gpio.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/w1/masters/w1-gpio.c
|
||||
@@ -0,0 +1,124 @@
|
||||
+/*
|
||||
+ * w1-gpio - GPIO w1 bus master driver
|
||||
+ *
|
||||
+ * Copyright (C) 2007 Ville Syrjala <syrjala@sci.fi>
|
||||
+ *
|
||||
+ * 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.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/w1-gpio.h>
|
||||
+
|
||||
+#include "../w1.h"
|
||||
+#include "../w1_int.h"
|
||||
+
|
||||
+#include <asm/gpio.h>
|
||||
+
|
||||
+static void w1_gpio_write_bit_dir(void *data, u8 bit)
|
||||
+{
|
||||
+ struct w1_gpio_platform_data *pdata = data;
|
||||
+
|
||||
+ if (bit)
|
||||
+ gpio_direction_input(pdata->pin);
|
||||
+ else
|
||||
+ gpio_direction_output(pdata->pin, 0);
|
||||
+}
|
||||
+
|
||||
+static void w1_gpio_write_bit_val(void *data, u8 bit)
|
||||
+{
|
||||
+ struct w1_gpio_platform_data *pdata = data;
|
||||
+
|
||||
+ gpio_set_value(pdata->pin, bit);
|
||||
+}
|
||||
+
|
||||
+static u8 w1_gpio_read_bit(void *data)
|
||||
+{
|
||||
+ struct w1_gpio_platform_data *pdata = data;
|
||||
+
|
||||
+ return gpio_get_value(pdata->pin);
|
||||
+}
|
||||
+
|
||||
+static int __init w1_gpio_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct w1_bus_master *master;
|
||||
+ struct w1_gpio_platform_data *pdata = pdev->dev.platform_data;
|
||||
+ int err;
|
||||
+
|
||||
+ if (!pdata)
|
||||
+ return -ENXIO;
|
||||
+
|
||||
+ master = kzalloc(sizeof(struct w1_bus_master), GFP_KERNEL);
|
||||
+ if (!master)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ err = gpio_request(pdata->pin, "w1");
|
||||
+ if (err)
|
||||
+ goto free_master;
|
||||
+
|
||||
+ master->data = pdata;
|
||||
+ master->read_bit = w1_gpio_read_bit;
|
||||
+
|
||||
+ if (pdata->is_open_drain) {
|
||||
+ gpio_direction_output(pdata->pin, 1);
|
||||
+ master->write_bit = w1_gpio_write_bit_val;
|
||||
+ } else {
|
||||
+ gpio_direction_input(pdata->pin);
|
||||
+ master->write_bit = w1_gpio_write_bit_dir;
|
||||
+ }
|
||||
+
|
||||
+ err = w1_add_master_device(master);
|
||||
+ if (err)
|
||||
+ goto free_gpio;
|
||||
+
|
||||
+ platform_set_drvdata(pdev, master);
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+ free_gpio:
|
||||
+ gpio_free(pdata->pin);
|
||||
+ free_master:
|
||||
+ kfree(master);
|
||||
+
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+static int __exit w1_gpio_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct w1_bus_master *master = platform_get_drvdata(pdev);
|
||||
+ struct w1_gpio_platform_data *pdata = pdev->dev.platform_data;
|
||||
+
|
||||
+ w1_remove_master_device(master);
|
||||
+ gpio_free(pdata->pin);
|
||||
+ kfree(master);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct platform_driver w1_gpio_driver = {
|
||||
+ .driver = {
|
||||
+ .name = "w1-gpio",
|
||||
+ .owner = THIS_MODULE,
|
||||
+ },
|
||||
+ .remove = __exit_p(w1_gpio_remove),
|
||||
+};
|
||||
+
|
||||
+static int __init w1_gpio_init(void)
|
||||
+{
|
||||
+ return platform_driver_probe(&w1_gpio_driver, w1_gpio_probe);
|
||||
+}
|
||||
+
|
||||
+static void __exit w1_gpio_exit(void)
|
||||
+{
|
||||
+ platform_driver_unregister(&w1_gpio_driver);
|
||||
+}
|
||||
+
|
||||
+module_init(w1_gpio_init);
|
||||
+module_exit(w1_gpio_exit);
|
||||
+
|
||||
+MODULE_DESCRIPTION("GPIO w1 bus master driver");
|
||||
+MODULE_AUTHOR("Ville Syrjala <syrjala@sci.fi>");
|
||||
+MODULE_LICENSE("GPL");
|
||||
--- /dev/null
|
||||
+++ b/include/linux/w1-gpio.h
|
||||
@@ -0,0 +1,23 @@
|
||||
+/*
|
||||
+ * w1-gpio interface to platform code
|
||||
+ *
|
||||
+ * Copyright (C) 2007 Ville Syrjala <syrjala@sci.fi>
|
||||
+ *
|
||||
+ * 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.
|
||||
+ */
|
||||
+#ifndef _LINUX_W1_GPIO_H
|
||||
+#define _LINUX_W1_GPIO_H
|
||||
+
|
||||
+/**
|
||||
+ * struct w1_gpio_platform_data - Platform-dependent data for w1-gpio
|
||||
+ * @pin: GPIO pin to use
|
||||
+ * @is_open_drain: GPIO pin is configured as open drain
|
||||
+ */
|
||||
+struct w1_gpio_platform_data {
|
||||
+ unsigned int pin;
|
||||
+ unsigned int is_open_drain:1;
|
||||
+};
|
||||
+
|
||||
+#endif /* _LINUX_W1_GPIO_H */
|
|
@ -1,78 +0,0 @@
|
|||
From a.othieno@bluewin.ch Tue Oct 11 07:50:21 2005
|
||||
From: Arthur Othieno <a.othieno@bluewin.ch>
|
||||
Subject: Big-endian I/O memory accessors.
|
||||
Date: Tue, 11 Oct 2005 07:50:21 +1000
|
||||
X-Patchwork-ID: 2759
|
||||
|
||||
From: Arthur Othieno <a.othieno@bluewin.ch>
|
||||
|
||||
I/O memory accessors. Big endian version. For those busses/devices
|
||||
that do export big-endian I/O memory.
|
||||
|
||||
Of notable relevance/reference:
|
||||
|
||||
http://lwn.net/Articles/132804/
|
||||
http://ozlabs.org/pipermail/linuxppc-embedded/2005-August/019798.html
|
||||
http://ozlabs.org/pipermail/linuxppc-embedded/2005-August/019752.html
|
||||
|
||||
Signed-off-by: Arthur Othieno <a.othieno@bluewin.ch>
|
||||
---
|
||||
|
||||
Paulus,
|
||||
|
||||
A similar patch for ppc64 made it upstream with your big ppc64 merge.
|
||||
This one is still sitting in http://patchwork.ozlabs.org/linuxppc/
|
||||
and didn't make it with the ppc32 equivalent. Thanks.
|
||||
|
||||
|
||||
include/asm-ppc/io.h | 20 ++++++++++++++++++++
|
||||
1 file changed, 20 insertions(+)
|
||||
|
||||
|
||||
---
|
||||
--- a/include/asm-ppc/io.h
|
||||
+++ b/include/asm-ppc/io.h
|
||||
@@ -413,11 +413,21 @@ static inline unsigned int ioread16(void
|
||||
return readw(addr);
|
||||
}
|
||||
|
||||
+static inline unsigned int ioread16be(void __iomem *addr)
|
||||
+{
|
||||
+ return in_be16(addr);
|
||||
+}
|
||||
+
|
||||
static inline unsigned int ioread32(void __iomem *addr)
|
||||
{
|
||||
return readl(addr);
|
||||
}
|
||||
|
||||
+static inline unsigned int ioread32be(void __iomem *addr)
|
||||
+{
|
||||
+ return in_be32(addr);
|
||||
+}
|
||||
+
|
||||
static inline void iowrite8(u8 val, void __iomem *addr)
|
||||
{
|
||||
writeb(val, addr);
|
||||
@@ -428,11 +438,21 @@ static inline void iowrite16(u16 val, vo
|
||||
writew(val, addr);
|
||||
}
|
||||
|
||||
+static inline void iowrite16be(u16 val, void __iomem *addr)
|
||||
+{
|
||||
+ out_be16(addr, val);
|
||||
+}
|
||||
+
|
||||
static inline void iowrite32(u32 val, void __iomem *addr)
|
||||
{
|
||||
writel(val, addr);
|
||||
}
|
||||
|
||||
+static inline void iowrite32be(u32 val, void __iomem *addr)
|
||||
+{
|
||||
+ out_be32(addr, val);
|
||||
+}
|
||||
+
|
||||
static inline void ioread8_rep(void __iomem *addr, void *dst, unsigned long count)
|
||||
{
|
||||
_insb(addr, dst, count);
|
|
@ -1,426 +0,0 @@
|
|||
--- a/arch/arm/tools/mach-types
|
||||
+++ b/arch/arm/tools/mach-types
|
||||
@@ -12,7 +12,7 @@
|
||||
#
|
||||
# http://www.arm.linux.org.uk/developer/machines/?action=new
|
||||
#
|
||||
-# Last update: Fri May 11 19:53:41 2007
|
||||
+# Last update: Wed Apr 9 13:26:57 2008
|
||||
#
|
||||
# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
|
||||
#
|
||||
@@ -266,7 +266,7 @@ stork_egg ARCH_STORK_EGG STORK_EGG 24
|
||||
wismo SA1100_WISMO WISMO 249
|
||||
ezlinx ARCH_EZLINX EZLINX 250
|
||||
at91rm9200 ARCH_AT91RM9200 AT91RM9200 251
|
||||
-orion ARCH_ORION ORION 252
|
||||
+adtech_orion ARCH_ADTECH_ORION ADTECH_ORION 252
|
||||
neptune ARCH_NEPTUNE NEPTUNE 253
|
||||
hackkit SA1100_HACKKIT HACKKIT 254
|
||||
pxa_wins30 ARCH_PXA_WINS30 PXA_WINS30 255
|
||||
@@ -381,13 +381,13 @@ ks8695p ARCH_KS8695P KS8695P 363
|
||||
se4000 ARCH_SE4000 SE4000 364
|
||||
quadriceps ARCH_QUADRICEPS QUADRICEPS 365
|
||||
bronco ARCH_BRONCO BRONCO 366
|
||||
-esl_wireless_tab ARCH_ESL_WIRELESS_TABLETESL_WIRELESS_TABLET 367
|
||||
+esl_wireless_tab ARCH_ESL_WIRELESS_TAB ESL_WIRELESS_TAB 367
|
||||
esl_sofcomp ARCH_ESL_SOFCOMP ESL_SOFCOMP 368
|
||||
s5c7375 ARCH_S5C7375 S5C7375 369
|
||||
spearhead ARCH_SPEARHEAD SPEARHEAD 370
|
||||
pantera ARCH_PANTERA PANTERA 371
|
||||
prayoglite ARCH_PRAYOGLITE PRAYOGLITE 372
|
||||
-gumstix ARCH_GUMSTIK GUMSTIK 373
|
||||
+gumstix ARCH_GUMSTIX GUMSTIX 373
|
||||
rcube ARCH_RCUBE RCUBE 374
|
||||
rea_olv ARCH_REA_OLV REA_OLV 375
|
||||
pxa_iphone ARCH_PXA_IPHONE PXA_IPHONE 376
|
||||
@@ -661,7 +661,6 @@ a9200ec MACH_A9200EC A9200EC 645
|
||||
pnx0105 MACH_PNX0105 PNX0105 646
|
||||
adcpoecpu MACH_ADCPOECPU ADCPOECPU 647
|
||||
csb637 MACH_CSB637 CSB637 648
|
||||
-ml69q6203 MACH_ML69Q6203 ML69Q6203 649
|
||||
mb9200 MACH_MB9200 MB9200 650
|
||||
kulun MACH_KULUN KULUN 651
|
||||
snapper MACH_SNAPPER SNAPPER 652
|
||||
@@ -953,7 +952,6 @@ fred_jack MACH_FRED_JACK FRED_JACK 93
|
||||
ttg_color1 MACH_TTG_COLOR1 TTG_COLOR1 940
|
||||
nxeb500hmi MACH_NXEB500HMI NXEB500HMI 941
|
||||
netdcu8 MACH_NETDCU8 NETDCU8 942
|
||||
-ml675050_cpu_boa MACH_ML675050_CPU_BOA ML675050_CPU_BOA 943
|
||||
ng_fvx538 MACH_NG_FVX538 NG_FVX538 944
|
||||
ng_fvs338 MACH_NG_FVS338 NG_FVS338 945
|
||||
pnx4103 MACH_PNX4103 PNX4103 946
|
||||
@@ -1148,7 +1146,7 @@ aidx270 MACH_AIDX270 AIDX270 1134
|
||||
rema MACH_REMA REMA 1135
|
||||
bps1000 MACH_BPS1000 BPS1000 1136
|
||||
hw90350 MACH_HW90350 HW90350 1137
|
||||
-omap_sdp3430 MACH_OMAP_SDP3430 OMAP_SDP3430 1138
|
||||
+omap_3430sdp MACH_OMAP_3430SDP OMAP_3430SDP 1138
|
||||
bluetouch MACH_BLUETOUCH BLUETOUCH 1139
|
||||
vstms MACH_VSTMS VSTMS 1140
|
||||
xsbase270 MACH_XSBASE270 XSBASE270 1141
|
||||
@@ -1214,7 +1212,7 @@ osstbox MACH_OSSTBOX OSSTBOX 1203
|
||||
kbat9261 MACH_KBAT9261 KBAT9261 1204
|
||||
ct1100 MACH_CT1100 CT1100 1205
|
||||
akcppxa MACH_AKCPPXA AKCPPXA 1206
|
||||
-zevio_1020 MACH_ZEVIO_1020 ZEVIO_1020 1207
|
||||
+ochaya1020 MACH_OCHAYA1020 OCHAYA1020 1207
|
||||
hitrack MACH_HITRACK HITRACK 1208
|
||||
syme1 MACH_SYME1 SYME1 1209
|
||||
syhl1 MACH_SYHL1 SYHL1 1210
|
||||
@@ -1299,7 +1297,7 @@ xp179 MACH_XP179 XP179 1290
|
||||
h4300 MACH_H4300 H4300 1291
|
||||
goramo_mlr MACH_GORAMO_MLR GORAMO_MLR 1292
|
||||
mxc30020evb MACH_MXC30020EVB MXC30020EVB 1293
|
||||
-adsbitsymx MACH_ADSBITSIMX ADSBITSIMX 1294
|
||||
+adsbitsyg5 MACH_ADSBITSYG5 ADSBITSYG5 1294
|
||||
adsportalplus MACH_ADSPORTALPLUS ADSPORTALPLUS 1295
|
||||
mmsp2plus MACH_MMSP2PLUS MMSP2PLUS 1296
|
||||
em_x270 MACH_EM_X270 EM_X270 1297
|
||||
@@ -1367,3 +1365,346 @@ db88f5281 MACH_DB88F5281 DB88F5281 13
|
||||
csb726 MACH_CSB726 CSB726 1359
|
||||
tik27 MACH_TIK27 TIK27 1360
|
||||
mx_uc7420 MACH_MX_UC7420 MX_UC7420 1361
|
||||
+rirm3 MACH_RIRM3 RIRM3 1362
|
||||
+pelco_odyssey MACH_PELCO_ODYSSEY PELCO_ODYSSEY 1363
|
||||
+adx_abox MACH_ADX_ABOX ADX_ABOX 1365
|
||||
+adx_tpid MACH_ADX_TPID ADX_TPID 1366
|
||||
+minicheck MACH_MINICHECK MINICHECK 1367
|
||||
+idam MACH_IDAM IDAM 1368
|
||||
+mario_mx MACH_MARIO_MX MARIO_MX 1369
|
||||
+vi1888 MACH_VI1888 VI1888 1370
|
||||
+zr4230 MACH_ZR4230 ZR4230 1371
|
||||
+t1_ix_blue MACH_T1_IX_BLUE T1_IX_BLUE 1372
|
||||
+syhq2 MACH_SYHQ2 SYHQ2 1373
|
||||
+computime_r3 MACH_COMPUTIME_R3 COMPUTIME_R3 1374
|
||||
+oratis MACH_ORATIS ORATIS 1375
|
||||
+mikko MACH_MIKKO MIKKO 1376
|
||||
+holon MACH_HOLON HOLON 1377
|
||||
+olip8 MACH_OLIP8 OLIP8 1378
|
||||
+ghi270hg MACH_GHI270HG GHI270HG 1379
|
||||
+davinci_dm6467_evm MACH_DAVINCI_DM6467_EVM DAVINCI_DM6467_EVM 1380
|
||||
+davinci_dm355_evm MACH_DAVINCI_DM350_EVM DAVINCI_DM350_EVM 1381
|
||||
+ocearm MACH_OCEARMTEST OCEARMTEST 1382
|
||||
+blackriver MACH_BLACKRIVER BLACKRIVER 1383
|
||||
+sandgate_wp MACH_SANDGATEWP SANDGATEWP 1384
|
||||
+cdotbwsg MACH_CDOTBWSG CDOTBWSG 1385
|
||||
+quark963 MACH_QUARK963 QUARK963 1386
|
||||
+csb735 MACH_CSB735 CSB735 1387
|
||||
+littleton MACH_LITTLETON LITTLETON 1388
|
||||
+mio_p550 MACH_MIO_P550 MIO_P550 1389
|
||||
+motion2440 MACH_MOTION2440 MOTION2440 1390
|
||||
+imm500 MACH_IMM500 IMM500 1391
|
||||
+homematic MACH_HOMEMATIC HOMEMATIC 1392
|
||||
+ermine MACH_ERMINE ERMINE 1393
|
||||
+kb9202b MACH_KB9202B KB9202B 1394
|
||||
+hs1xx MACH_HS1XX HS1XX 1395
|
||||
+studentmate2440 MACH_STUDENTMATE2440 STUDENTMATE2440 1396
|
||||
+arvoo_l1_z1 MACH_ARVOO_L1_Z1 ARVOO_L1_Z1 1397
|
||||
+dep2410k MACH_DEP2410K DEP2410K 1398
|
||||
+xxsvideo MACH_XXSVIDEO XXSVIDEO 1399
|
||||
+im4004 MACH_IM4004 IM4004 1400
|
||||
+ochaya1050 MACH_OCHAYA1050 OCHAYA1050 1401
|
||||
+lep9261 MACH_LEP9261 LEP9261 1402
|
||||
+svenmeb MACH_SVENMEB SVENMEB 1403
|
||||
+fortunet2ne MACH_FORTUNET2NE FORTUNET2NE 1404
|
||||
+nxhx MACH_NXHX NXHX 1406
|
||||
+realview_pb11mp MACH_REALVIEW_PB11MP REALVIEW_PB11MP 1407
|
||||
+ids500 MACH_IDS500 IDS500 1408
|
||||
+ors_n725 MACH_ORS_N725 ORS_N725 1409
|
||||
+hsdarm MACH_HSDARM HSDARM 1410
|
||||
+sha_pon003 MACH_SHA_PON003 SHA_PON003 1411
|
||||
+sha_pon004 MACH_SHA_PON004 SHA_PON004 1412
|
||||
+sha_pon007 MACH_SHA_PON007 SHA_PON007 1413
|
||||
+sha_pon011 MACH_SHA_PON011 SHA_PON011 1414
|
||||
+h6042 MACH_H6042 H6042 1415
|
||||
+h6043 MACH_H6043 H6043 1416
|
||||
+looxc550 MACH_LOOXC550 LOOXC550 1417
|
||||
+cnty_titan MACH_CNTY_TITAN CNTY_TITAN 1418
|
||||
+app3xx MACH_APP3XX APP3XX 1419
|
||||
+sideoatsgrama MACH_SIDEOATSGRAMA SIDEOATSGRAMA 1420
|
||||
+xscale_palmt700p MACH_XSCALE_PALMT700P XSCALE_PALMT700P 1421
|
||||
+xscale_palmt700w MACH_XSCALE_PALMT700W XSCALE_PALMT700W 1422
|
||||
+xscale_palmt750 MACH_XSCALE_PALMT750 XSCALE_PALMT750 1423
|
||||
+xscale_palmt755p MACH_XSCALE_PALMT755P XSCALE_PALMT755P 1424
|
||||
+ezreganut9200 MACH_EZREGANUT9200 EZREGANUT9200 1425
|
||||
+sarge MACH_SARGE SARGE 1426
|
||||
+a696 MACH_A696 A696 1427
|
||||
+turtle1916 MACH_TURTLE TURTLE 1428
|
||||
+mx27_3ds MACH_MX27_3DS MX27_3DS 1430
|
||||
+bishop MACH_BISHOP BISHOP 1431
|
||||
+pxx MACH_PXX PXX 1432
|
||||
+redwood MACH_REDWOOD REDWOOD 1433
|
||||
+omap_2430dlp MACH_OMAP_2430DLP OMAP_2430DLP 1436
|
||||
+omap_2430osk MACH_OMAP_2430OSK OMAP_2430OSK 1437
|
||||
+sardine MACH_SARDINE SARDINE 1438
|
||||
+halibut MACH_HALIBUT HALIBUT 1439
|
||||
+trout MACH_TROUT TROUT 1440
|
||||
+goldfish MACH_GOLDFISH GOLDFISH 1441
|
||||
+gesbc2440 MACH_GESBC2440 GESBC2440 1442
|
||||
+nomad MACH_NOMAD NOMAD 1443
|
||||
+rosalind MACH_ROSALIND ROSALIND 1444
|
||||
+cc9p9215 MACH_CC9P9215 CC9P9215 1445
|
||||
+cc9p9210 MACH_CC9P9210 CC9P9210 1446
|
||||
+cc9p9215js MACH_CC9P9215JS CC9P9215JS 1447
|
||||
+cc9p9210js MACH_CC9P9210JS CC9P9210JS 1448
|
||||
+nasffe MACH_NASFFE NASFFE 1449
|
||||
+tn2x0bd MACH_TN2X0BD TN2X0BD 1450
|
||||
+gwmpxa MACH_GWMPXA GWMPXA 1451
|
||||
+exyplus MACH_EXYPLUS EXYPLUS 1452
|
||||
+jadoo21 MACH_JADOO21 JADOO21 1453
|
||||
+looxn560 MACH_LOOXN560 LOOXN560 1454
|
||||
+bonsai MACH_BONSAI BONSAI 1455
|
||||
+adsmilgato MACH_ADSMILGATO ADSMILGATO 1456
|
||||
+gba MACH_GBA GBA 1457
|
||||
+h6044 MACH_H6044 H6044 1458
|
||||
+app MACH_APP APP 1459
|
||||
+tct_hammer MACH_TCT_HAMMER TCT_HAMMER 1460
|
||||
+herald MACH_HERMES HERMES 1461
|
||||
+artemis MACH_ARTEMIS ARTEMIS 1462
|
||||
+htctitan MACH_HTCTITAN HTCTITAN 1463
|
||||
+qranium MACH_QRANIUM QRANIUM 1464
|
||||
+adx_wsc2 MACH_ADX_WSC2 ADX_WSC2 1465
|
||||
+adx_medcom MACH_ADX_MEDINET ADX_MEDINET 1466
|
||||
+bboard MACH_BBOARD BBOARD 1467
|
||||
+cambria MACH_CAMBRIA CAMBRIA 1468
|
||||
+mt7xxx MACH_MT7XXX MT7XXX 1469
|
||||
+matrix512 MACH_MATRIX512 MATRIX512 1470
|
||||
+matrix522 MACH_MATRIX522 MATRIX522 1471
|
||||
+ipac5010 MACH_IPAC5010 IPAC5010 1472
|
||||
+sakura MACH_SAKURA SAKURA 1473
|
||||
+grocx MACH_GROCX GROCX 1474
|
||||
+pm9263 MACH_PM9263 PM9263 1475
|
||||
+sim_one MACH_SIM_ONE SIM_ONE 1476
|
||||
+acq132 MACH_ACQ132 ACQ132 1477
|
||||
+datr MACH_DATR DATR 1478
|
||||
+actux1 MACH_ACTUX1 ACTUX1 1479
|
||||
+actux2 MACH_ACTUX2 ACTUX2 1480
|
||||
+actux3 MACH_ACTUX3 ACTUX3 1481
|
||||
+flexit MACH_FLEXIT FLEXIT 1482
|
||||
+bh2x0bd MACH_BH2X0BD BH2X0BD 1483
|
||||
+atb2002 MACH_ATB2002 ATB2002 1484
|
||||
+xenon MACH_XENON XENON 1485
|
||||
+fm607 MACH_FM607 FM607 1486
|
||||
+matrix514 MACH_MATRIX514 MATRIX514 1487
|
||||
+matrix524 MACH_MATRIX524 MATRIX524 1488
|
||||
+inpod MACH_INPOD INPOD 1489
|
||||
+jive MACH_JIVE JIVE 1490
|
||||
+tll_mx21 MACH_TLL_MX21 TLL_MX21 1491
|
||||
+sbc2800 MACH_SBC2800 SBC2800 1492
|
||||
+cc7ucamry MACH_CC7UCAMRY CC7UCAMRY 1493
|
||||
+ubisys_p9_sc15 MACH_UBISYS_P9_SC15 UBISYS_P9_SC15 1494
|
||||
+ubisys_p9_ssc2d10 MACH_UBISYS_P9_SSC2D10 UBISYS_P9_SSC2D10 1495
|
||||
+ubisys_p9_rcu3 MACH_UBISYS_P9_RCU3 UBISYS_P9_RCU3 1496
|
||||
+aml_m8000 MACH_AML_M8000 AML_M8000 1497
|
||||
+snapper_270 MACH_SNAPPER_270 SNAPPER_270 1498
|
||||
+omap_bbx MACH_OMAP_BBX OMAP_BBX 1499
|
||||
+ucn2410 MACH_UCN2410 UCN2410 1500
|
||||
+sam9_l9260 MACH_SAM9_L9260 SAM9_L9260 1501
|
||||
+eti_c2 MACH_ETI_C2 ETI_C2 1502
|
||||
+avalanche MACH_AVALANCHE AVALANCHE 1503
|
||||
+realview_pb1176 MACH_REALVIEW_PB1176 REALVIEW_PB1176 1504
|
||||
+dp1500 MACH_DP1500 DP1500 1505
|
||||
+apple_iphone MACH_APPLE_IPHONE APPLE_IPHONE 1506
|
||||
+yl9200 MACH_YL9200 YL9200 1507
|
||||
+rd88f5182 MACH_RD88F5182 RD88F5182 1508
|
||||
+kurobox_pro MACH_KUROBOX_PRO KUROBOX_PRO 1509
|
||||
+se_poet MACH_SE_POET SE_POET 1510
|
||||
+mx31_3ds MACH_MX31_3DS MX31_3DS 1511
|
||||
+r270 MACH_R270 R270 1512
|
||||
+armour21 MACH_ARMOUR21 ARMOUR21 1513
|
||||
+dt2 MACH_DT2 DT2 1514
|
||||
+vt4 MACH_VT4 VT4 1515
|
||||
+tyco320 MACH_TYCO320 TYCO320 1516
|
||||
+adma MACH_ADMA ADMA 1517
|
||||
+wp188 MACH_WP188 WP188 1518
|
||||
+corsica MACH_CORSICA CORSICA 1519
|
||||
+bigeye MACH_BIGEYE BIGEYE 1520
|
||||
+tll5000 MACH_TLL5000 TLL5000 1522
|
||||
+hni270 MACH_HNI_X270 HNI_X270 1523
|
||||
+qong MACH_QONG QONG 1524
|
||||
+tcompact MACH_TCOMPACT TCOMPACT 1525
|
||||
+puma5 MACH_PUMA5 PUMA5 1526
|
||||
+elara MACH_ELARA ELARA 1527
|
||||
+ellington MACH_ELLINGTON ELLINGTON 1528
|
||||
+xda_atom MACH_XDA_ATOM XDA_ATOM 1529
|
||||
+energizer2 MACH_ENERGIZER2 ENERGIZER2 1530
|
||||
+odin MACH_ODIN ODIN 1531
|
||||
+actux4 MACH_ACTUX4 ACTUX4 1532
|
||||
+esl_omap MACH_ESL_OMAP ESL_OMAP 1533
|
||||
+omap2evm MACH_OMAP2EVM OMAP2EVM 1534
|
||||
+omap3evm MACH_OMAP3EVM OMAP3EVM 1535
|
||||
+adx_pcu57 MACH_ADX_PCU57 ADX_PCU57 1536
|
||||
+monaco MACH_MONACO MONACO 1537
|
||||
+levante MACH_LEVANTE LEVANTE 1538
|
||||
+tmxipx425 MACH_TMXIPX425 TMXIPX425 1539
|
||||
+leep MACH_LEEP LEEP 1540
|
||||
+raad MACH_RAAD RAAD 1541
|
||||
+dns323 MACH_DNS323 DNS323 1542
|
||||
+ap1000 MACH_AP1000 AP1000 1543
|
||||
+a9sam6432 MACH_A9SAM6432 A9SAM6432 1544
|
||||
+shiny MACH_SHINY SHINY 1545
|
||||
+omap3_beagle MACH_OMAP3_BEAGLE OMAP3_BEAGLE 1546
|
||||
+csr_bdb2 MACH_CSR_BDB2 CSR_BDB2 1547
|
||||
+nokia_n810 MACH_NOKIA_N810 NOKIA_N810 1548
|
||||
+c270 MACH_C270 C270 1549
|
||||
+sentry MACH_SENTRY SENTRY 1550
|
||||
+pcm038 MACH_PCM038 PCM038 1551
|
||||
+anc300 MACH_ANC300 ANC300 1552
|
||||
+htckaiser MACH_HTCKAISER HTCKAISER 1553
|
||||
+sbat100 MACH_SBAT100 SBAT100 1554
|
||||
+modunorm MACH_MODUNORM MODUNORM 1555
|
||||
+pelos_twarm MACH_PELOS_TWARM PELOS_TWARM 1556
|
||||
+flank MACH_FLANK FLANK 1557
|
||||
+sirloin MACH_SIRLOIN SIRLOIN 1558
|
||||
+brisket MACH_BRISKET BRISKET 1559
|
||||
+chuck MACH_CHUCK CHUCK 1560
|
||||
+otter MACH_OTTER OTTER 1561
|
||||
+davinci_ldk MACH_DAVINCI_LDK DAVINCI_LDK 1562
|
||||
+phreedom MACH_PHREEDOM PHREEDOM 1563
|
||||
+sg310 MACH_SG310 SG310 1564
|
||||
+ts_x09 MACH_TS209 TS209 1565
|
||||
+at91cap9adk MACH_AT91CAP9ADK AT91CAP9ADK 1566
|
||||
+tion9315 MACH_TION9315 TION9315 1567
|
||||
+mast MACH_MAST MAST 1568
|
||||
+pfw MACH_PFW PFW 1569
|
||||
+yl_p2440 MACH_YL_P2440 YL_P2440 1570
|
||||
+zsbc32 MACH_ZSBC32 ZSBC32 1571
|
||||
+omap_pace2 MACH_OMAP_PACE2 OMAP_PACE2 1572
|
||||
+imx_pace2 MACH_IMX_PACE2 IMX_PACE2 1573
|
||||
+mx31moboard MACH_MX31MOBOARD MX31MOBOARD 1574
|
||||
+mx37_3ds MACH_MX37_3DS MX37_3DS 1575
|
||||
+rcc MACH_RCC RCC 1576
|
||||
+dmp MACH_ARM9 ARM9 1577
|
||||
+vision_ep9307 MACH_VISION_EP9307 VISION_EP9307 1578
|
||||
+scly1000 MACH_SCLY1000 SCLY1000 1579
|
||||
+fontel_ep MACH_FONTEL_EP FONTEL_EP 1580
|
||||
+voiceblue3g MACH_VOICEBLUE3G VOICEBLUE3G 1581
|
||||
+tt9200 MACH_TT9200 TT9200 1582
|
||||
+digi2410 MACH_DIGI2410 DIGI2410 1583
|
||||
+terastation_pro2 MACH_TERASTATION_PRO2 TERASTATION_PRO2 1584
|
||||
+linkstation_pro MACH_LINKSTATION_PRO LINKSTATION_PRO 1585
|
||||
+motorola_a780 MACH_MOTOROLA_A780 MOTOROLA_A780 1587
|
||||
+motorola_e6 MACH_MOTOROLA_E6 MOTOROLA_E6 1588
|
||||
+motorola_e2 MACH_MOTOROLA_E2 MOTOROLA_E2 1589
|
||||
+motorola_e680 MACH_MOTOROLA_E680 MOTOROLA_E680 1590
|
||||
+ur2410 MACH_UR2410 UR2410 1591
|
||||
+tas9261 MACH_TAS9261 TAS9261 1592
|
||||
+davinci_hermes_hd MACH_HERMES_HD HERMES_HD 1593
|
||||
+davinci_perseo_hd MACH_PERSEO_HD PERSEO_HD 1594
|
||||
+stargazer2 MACH_STARGAZER2 STARGAZER2 1595
|
||||
+e350 MACH_E350 E350 1596
|
||||
+wpcm450 MACH_WPCM450 WPCM450 1597
|
||||
+cartesio MACH_CARTESIO CARTESIO 1598
|
||||
+toybox MACH_TOYBOX TOYBOX 1599
|
||||
+tx27 MACH_TX27 TX27 1600
|
||||
+ts409 MACH_TS409 TS409 1601
|
||||
+p300 MACH_P300 P300 1602
|
||||
+xdacomet MACH_XDACOMET XDACOMET 1603
|
||||
+dexflex2 MACH_DEXFLEX2 DEXFLEX2 1604
|
||||
+ow MACH_OW OW 1605
|
||||
+armebs3 MACH_ARMEBS3 ARMEBS3 1606
|
||||
+u3 MACH_U3 U3 1607
|
||||
+smdk2450 MACH_SMDK2450 SMDK2450 1608
|
||||
+rsi_ews MACH_RSI_EWS RSI_EWS 1609
|
||||
+tnb MACH_TNB TNB 1610
|
||||
+toepath MACH_TOEPATH TOEPATH 1611
|
||||
+kb9263 MACH_KB9263 KB9263 1612
|
||||
+mt7108 MACH_MT7108 MT7108 1613
|
||||
+smtr2440 MACH_SMTR2440 SMTR2440 1614
|
||||
+manao MACH_MANAO MANAO 1615
|
||||
+cm_x300 MACH_CM_X300 CM_X300 1616
|
||||
+gulfstream_kp MACH_GULFSTREAM_KP GULFSTREAM_KP 1617
|
||||
+lanreadyfn522 MACH_LANREADYFN522 LANREADYFN522 1618
|
||||
+arma37 MACH_ARMA37 ARMA37 1619
|
||||
+mendel MACH_MENDEL MENDEL 1620
|
||||
+pelco_iliad MACH_PELCO_ILIAD PELCO_ILIAD 1621
|
||||
+unit2p MACH_UNIT2P UNIT2P 1622
|
||||
+inc20otter MACH_INC20OTTER INC20OTTER 1623
|
||||
+at91sam9g20ek MACH_AT91SAM9G20EK AT91SAM9G20EK 1624
|
||||
+sc_ge2 MACH_STORCENTER STORCENTER 1625
|
||||
+smdk6410 MACH_SMDK6410 SMDK6410 1626
|
||||
+u300 MACH_U300 U300 1627
|
||||
+u500 MACH_U500 U500 1628
|
||||
+ds9260 MACH_DS9260 DS9260 1629
|
||||
+riverrock MACH_RIVERROCK RIVERROCK 1630
|
||||
+scibath MACH_SCIBATH SCIBATH 1631
|
||||
+at91sam7se MACH_AT91SAM7SE512EK AT91SAM7SE512EK 1632
|
||||
+wrt350n_v2 MACH_WRT350N_V2 WRT350N_V2 1633
|
||||
+multimedia MACH_MULTIMEDIA MULTIMEDIA 1634
|
||||
+marvin MACH_MARVIN MARVIN 1635
|
||||
+x500 MACH_X500 X500 1636
|
||||
+awlug4lcu MACH_AWLUG4LCU AWLUG4LCU 1637
|
||||
+palermoc MACH_PALERMOC PALERMOC 1638
|
||||
+omap_zoom MACH_OMAP_3430LABRADOR OMAP_3430LABRADOR 1639
|
||||
+ip500 MACH_IP500 IP500 1640
|
||||
+mx35ads MACH_MACH_MX35ADS MACH_MX35ADS 1641
|
||||
+ase2 MACH_ASE2 ASE2 1642
|
||||
+mx35evb MACH_MX35EVB MX35EVB 1643
|
||||
+aml_m8050 MACH_AML_M8050 AML_M8050 1644
|
||||
+mx35_3ds MACH_MX35_3DS MX35_3DS 1645
|
||||
+mars MACH_MARS MARS 1646
|
||||
+ntosd_644xa MACH_NTOSD_644XA NTOSD_644XA 1647
|
||||
+badger MACH_BADGER BADGER 1648
|
||||
+trizeps4wl MACH_TRIZEPS4WL TRIZEPS4WL 1649
|
||||
+trizeps5 MACH_TRIZEPS5 TRIZEPS5 1650
|
||||
+marlin MACH_MARLIN MARLIN 1651
|
||||
+ts7800 MACH_TS7800 TS7800 1652
|
||||
+hpipaq214 MACH_HPIPAQ214 HPIPAQ214 1653
|
||||
+at572d940dcm MACH_AT572D940DCM AT572D940DCM 1654
|
||||
+ne1board MACH_NE1BOARD NE1BOARD 1655
|
||||
+zante MACH_ZANTE ZANTE 1656
|
||||
+sffsdr MACH_SFFSDR SFFSDR 1657
|
||||
+tw2662 MACH_TW2662 TW2662 1658
|
||||
+vf10xx MACH_VF10XX VF10XX 1659
|
||||
+zoran43xx MACH_ZORAN43XX ZORAN43XX 1660
|
||||
+sonix926 MACH_SONIX926 SONIX926 1661
|
||||
+celestialsemi MACH_CELESTIALSEMI CELESTIALSEMI 1662
|
||||
+cc9m2443 MACH_CC9M2443 CC9M2443 1663
|
||||
+tw5334 MACH_TW5334 TW5334 1664
|
||||
+omap_htcartemis MACH_HTCARTEMIS HTCARTEMIS 1665
|
||||
+nal_hlite MACH_NAL_HLITE NAL_HLITE 1666
|
||||
+htcvogue MACH_HTCVOGUE HTCVOGUE 1667
|
||||
+smartweb MACH_SMARTWEB SMARTWEB 1668
|
||||
+mv86xx MACH_MV86XX MV86XX 1669
|
||||
+mv87xx MACH_MV87XX MV87XX 1670
|
||||
+songyoungho MACH_SONGYOUNGHO SONGYOUNGHO 1671
|
||||
+younghotema MACH_YOUNGHOTEMA YOUNGHOTEMA 1672
|
||||
+pcm037 MACH_PCM037 PCM037 1673
|
||||
+mmvp MACH_MMVP MMVP 1674
|
||||
+mmap MACH_MMAP MMAP 1675
|
||||
+ptid2410 MACH_PTID2410 PTID2410 1676
|
||||
+james_926 MACH_JAMES_926 JAMES_926 1677
|
||||
+fm6000 MACH_FM6000 FM6000 1678
|
||||
+db88f6281_bp MACH_DB88F6281_BP DB88F6281_BP 1680
|
||||
+rd88f6192_nas MACH_RD88F6192_NAS RD88F6192_NAS 1681
|
||||
+rd88f6281 MACH_RD88F6281 RD88F6281 1682
|
||||
+db78x00_bp MACH_DB78X00_BP DB78X00_BP 1683
|
||||
+smdk2416 MACH_SMDK2416 SMDK2416 1685
|
||||
+oce_spider_si MACH_OCE_SPIDER_SI OCE_SPIDER_SI 1686
|
||||
+oce_spider_sk MACH_OCE_SPIDER_SK OCE_SPIDER_SK 1687
|
||||
+rovern6 MACH_ROVERN6 ROVERN6 1688
|
||||
+pelco_evolution MACH_PELCO_EVOLUTION PELCO_EVOLUTION 1689
|
||||
+wbd111 MACH_WBD111 WBD111 1690
|
||||
+elaracpe MACH_ELARACPE ELARACPE 1691
|
||||
+mabv3 MACH_MABV3 MABV3 1692
|
||||
+mv2120 MACH_MV2120 MV2120 1693
|
||||
+csb737 MACH_CSB737 CSB737 1695
|
||||
+mx51_3ds MACH_MX51_3DS MX51_3DS 1696
|
||||
+g900 MACH_G900 G900 1697
|
||||
+apf27 MACH_APF27 APF27 1698
|
||||
+ggus2000 MACH_GGUS2000 GGUS2000 1699
|
||||
+omap_2430_mimic MACH_OMAP_2430_MIMIC OMAP_2430_MIMIC 1700
|
||||
+imx27lite MACH_IMX27LITE IMX27LITE 1701
|
||||
+almex MACH_ALMEX ALMEX 1702
|
||||
+control MACH_CONTROL CONTROL 1703
|
||||
+mba2410 MACH_MBA2410 MBA2410 1704
|
||||
+volcano MACH_VOLCANO VOLCANO 1705
|
||||
+zenith MACH_ZENITH ZENITH 1706
|
||||
+muchip MACH_MUCHIP MUCHIP 1707
|
||||
+magellan MACH_MAGELLAN MAGELLAN 1708
|
||||
+usb_a9260 MACH_USB_A9260 USB_A9260 1709
|
||||
+usb_a9263 MACH_USB_A9263 USB_A9263 1710
|
||||
+qil_a9260 MACH_QIL_A9260 QIL_A9260 1711
|
||||
+cme9210 MACH_CME9210 CME9210 1712
|
||||
+hczh4 MACH_HCZH4 HCZH4 1713
|
||||
+spearbasic MACH_SPEARBASIC SPEARBASIC 1714
|
|
@ -1,11 +0,0 @@
|
|||
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
|
||||
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
|
||||
@@ -277,7 +277,7 @@ read_pri_intelext(struct map_info *map,
|
||||
return NULL;
|
||||
|
||||
if (extp->MajorVersion != '1' ||
|
||||
- (extp->MinorVersion < '0' || extp->MinorVersion > '4')) {
|
||||
+ (extp->MinorVersion < '0' || extp->MinorVersion > '5')) {
|
||||
printk(KERN_ERR " Unknown Intel/Sharp Extended Query "
|
||||
"version %c.%c.\n", extp->MajorVersion,
|
||||
extp->MinorVersion);
|
|
@ -1,30 +0,0 @@
|
|||
--- a/crypto/Kconfig
|
||||
+++ b/crypto/Kconfig
|
||||
@@ -20,7 +20,7 @@ menuconfig CRYPTO
|
||||
if CRYPTO
|
||||
|
||||
config CRYPTO_ALGAPI
|
||||
- tristate
|
||||
+ tristate "ALG API"
|
||||
help
|
||||
This option provides the API for cryptographic algorithms.
|
||||
|
||||
@@ -29,15 +29,15 @@ config CRYPTO_ABLKCIPHER
|
||||
select CRYPTO_BLKCIPHER
|
||||
|
||||
config CRYPTO_AEAD
|
||||
- tristate
|
||||
+ tristate "AEAD"
|
||||
select CRYPTO_ALGAPI
|
||||
|
||||
config CRYPTO_BLKCIPHER
|
||||
- tristate
|
||||
+ tristate "Block cipher"
|
||||
select CRYPTO_ALGAPI
|
||||
|
||||
config CRYPTO_HASH
|
||||
- tristate
|
||||
+ tristate "HASH"
|
||||
select CRYPTO_ALGAPI
|
||||
|
||||
config CRYPTO_MANAGER
|
Loading…
Reference in New Issue