diff --git a/hardware/disk/lvm2/pspec.xml b/hardware/disk/lvm2/pspec.xml index 218b5d32..86a385cc 100644 --- a/hardware/disk/lvm2/pspec.xml +++ b/hardware/disk/lvm2/pspec.xml @@ -12,10 +12,11 @@ app:console Userland logical volume management tools LVM2 includes all of the support for handling read/write operations physical and logical volumes. - ftp://sources.redhat.com/pub/lvm2/LVM2.2.02.142.tgz + ftp://sources.redhat.com/pub/lvm2/LVM2.2.02.167.tgz libutil-linux-devel eudev-devel + autoconf-archive 0x41) */ + -+ if (!(btInfo&BT_INFO_8723B_1ANT_B_CONNECTION)) -+ { ++ if (!(btInfo&BT_INFO_8723B_1ANT_B_CONNECTION)) { + pCoexDm->btStatus = BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Connected idle!!!\n")); -+ } -+ else if (btInfo == BT_INFO_8723B_1ANT_B_CONNECTION) /* connection exists but no busy */ -+ { ++ } else if (btInfo == BT_INFO_8723B_1ANT_B_CONNECTION) { ++ /* connection exists but no busy */ + pCoexDm->btStatus = BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n")); -+ } -+ else if ((btInfo&BT_INFO_8723B_1ANT_B_SCO_ESCO) || -+ (btInfo&BT_INFO_8723B_1ANT_B_SCO_BUSY)) -+ { ++ } else if ( ++ (btInfo&BT_INFO_8723B_1ANT_B_SCO_ESCO) || ++ (btInfo&BT_INFO_8723B_1ANT_B_SCO_BUSY) ++ ) { + pCoexDm->btStatus = BT_8723B_1ANT_BT_STATUS_SCO_BUSY; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT SCO busy!!!\n")); -+ } -+ else if (btInfo&BT_INFO_8723B_1ANT_B_ACL_BUSY) -+ { ++ } else if (btInfo&BT_INFO_8723B_1ANT_B_ACL_BUSY) { + if (BT_8723B_1ANT_BT_STATUS_ACL_BUSY != pCoexDm->btStatus) + pCoexDm->bAutoTdmaAdjust = false; ++ + pCoexDm->btStatus = BT_8723B_1ANT_BT_STATUS_ACL_BUSY; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT ACL busy!!!\n")); -+ } -+ else -+ { ++ } else { + pCoexDm->btStatus = BT_8723B_1ANT_BT_STATUS_MAX; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Defined state!!!\n")); + } + -+ if ((BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) || ++ if ( ++ (BT_8723B_1ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) || + (BT_8723B_1ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) || -+ (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus)) ++ (BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) ++ ) + bBtBusy = true; + else + bBtBusy = false; @@ -38645,10 +37517,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b1Ant.c linux-4.3-rtl8723b + halbtc8723b1ant_RunCoexistMechanism(pBtCoexist); +} + -+void -+EXhalbtc8723b1ant_HaltNotify( -+PBTC_COEXIST pBtCoexist -+ ) ++void EXhalbtc8723b1ant_HaltNotify(PBTC_COEXIST pBtCoexist) +{ + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n")); + @@ -38663,16 +37532,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b1Ant.c linux-4.3-rtl8723b + pBtCoexist->bStopCoexDm = true; +} + -+void -+EXhalbtc8723b1ant_PnpNotify( -+PBTC_COEXIST pBtCoexist, -+u8 pnpState -+ ) ++void EXhalbtc8723b1ant_PnpNotify(PBTC_COEXIST pBtCoexist, u8 pnpState) +{ + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Pnp notify\n")); + -+ if (BTC_WIFI_PNP_SLEEP == pnpState) -+ { ++ if (BTC_WIFI_PNP_SLEEP == pnpState) { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Pnp notify to SLEEP\n")); + + halbtc8723b1ant_PowerSaveState(pBtCoexist, BTC_PS_WIFI_NATIVE, 0x0, 0x0); @@ -38681,9 +37545,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b1Ant.c linux-4.3-rtl8723b + halbtc8723b1ant_SetAntPath(pBtCoexist, BTC_ANT_PATH_BT, false, true); + + pBtCoexist->bStopCoexDm = true; -+ } -+ else if (BTC_WIFI_PNP_WAKE_UP == pnpState) -+ { ++ } else if (BTC_WIFI_PNP_WAKE_UP == pnpState) { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Pnp notify to WAKE UP\n")); + pBtCoexist->bStopCoexDm = false; + halbtc8723b1ant_InitHwConfig(pBtCoexist, false, false); @@ -38692,18 +37554,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b1Ant.c linux-4.3-rtl8723b + } +} + -+void -+EXhalbtc8723b1ant_Periodical( -+PBTC_COEXIST pBtCoexist -+ ) ++void EXhalbtc8723b1ant_Periodical(PBTC_COEXIST pBtCoexist) +{ + static u8 disVerInfoCnt = 0; -+ u32 fwVer = 0, btPatchVer = 0; ++ u32 fwVer = 0, btPatchVer = 0; + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], ==========================Periodical ===========================\n")); + -+ if (disVerInfoCnt <= 5) -+ { ++ if (disVerInfoCnt <= 5) { + disVerInfoCnt += 1; + BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n")); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_BT_PATCH_VER, &btPatchVer); @@ -38716,19 +37574,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b1Ant.c linux-4.3-rtl8723b + halbtc8723b1ant_MonitorBtCtr(pBtCoexist); + halbtc8723b1ant_MonitorWiFiCtr(pBtCoexist); + -+ if (halbtc8723b1ant_IsWifiStatusChanged(pBtCoexist) || -+ pCoexDm->bAutoTdmaAdjust) -+ { -+ ++ if ( ++ halbtc8723b1ant_IsWifiStatusChanged(pBtCoexist) || ++ pCoexDm->bAutoTdmaAdjust ++ ) + halbtc8723b1ant_RunCoexistMechanism(pBtCoexist); -+ } + + pCoexSta->specialPktPeriodCnt++; +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b1Ant.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalBtc8723b1Ant.h ---- linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b1Ant.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalBtc8723b1Ant.h 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,243 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/HalBtc8723b1Ant.h linux/3rdparty/rtl8723bs/hal/HalBtc8723b1Ant.h +--- linux.old/3rdparty/rtl8723bs/hal/HalBtc8723b1Ant.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/HalBtc8723b1Ant.h 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,193 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. @@ -38754,20 +37611,20 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b1Ant.h linux-4.3-rtl8723b +#define BT_INFO_8723B_1ANT_B_CONNECTION BIT0 + +#define BT_INFO_8723B_1ANT_A2DP_BASIC_RATE(_BT_INFO_EXT_) \ -+ (((_BT_INFO_EXT_&BIT0))? true:false) ++ (((_BT_INFO_EXT_&BIT0)) ? true : false) + -+#define BTC_RSSI_COEX_THRESH_TOL_8723B_1ANT 2 ++#define BTC_RSSI_COEX_THRESH_TOL_8723B_1ANT 2 + -+#define BT_8723B_1ANT_WIFI_NOISY_THRESH 30 /* max: 255 */ ++#define BT_8723B_1ANT_WIFI_NOISY_THRESH 30 /* max: 255 */ + -+typedef enum _BT_INFO_SRC_8723B_1ANT{ ++typedef enum _BT_INFO_SRC_8723B_1ANT { + BT_INFO_SRC_8723B_1ANT_WIFI_FW = 0x0, + BT_INFO_SRC_8723B_1ANT_BT_RSP = 0x1, + BT_INFO_SRC_8723B_1ANT_BT_ACTIVE_SEND = 0x2, + BT_INFO_SRC_8723B_1ANT_MAX -+}BT_INFO_SRC_8723B_1ANT,*PBT_INFO_SRC_8723B_1ANT; ++} BT_INFO_SRC_8723B_1ANT, *PBT_INFO_SRC_8723B_1ANT; + -+typedef enum _BT_8723B_1ANT_BT_STATUS{ ++typedef enum _BT_8723B_1ANT_BT_STATUS { + BT_8723B_1ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0, + BT_8723B_1ANT_BT_STATUS_CONNECTED_IDLE = 0x1, + BT_8723B_1ANT_BT_STATUS_INQ_PAGE = 0x2, @@ -38775,67 +37632,67 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b1Ant.h linux-4.3-rtl8723b + BT_8723B_1ANT_BT_STATUS_SCO_BUSY = 0x4, + BT_8723B_1ANT_BT_STATUS_ACL_SCO_BUSY = 0x5, + BT_8723B_1ANT_BT_STATUS_MAX -+}BT_8723B_1ANT_BT_STATUS,*PBT_8723B_1ANT_BT_STATUS; ++} BT_8723B_1ANT_BT_STATUS, *PBT_8723B_1ANT_BT_STATUS; + -+typedef enum _BT_8723B_1ANT_WIFI_STATUS{ -+ BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0, -+ BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1, -+ BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2, -+ BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT = 0x3, -+ BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4, -+ BT_8723B_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5, ++typedef enum _BT_8723B_1ANT_WIFI_STATUS { ++ BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_IDLE = 0x0, ++ BT_8723B_1ANT_WIFI_STATUS_NON_CONNECTED_ASSO_AUTH_SCAN = 0x1, ++ BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SCAN = 0x2, ++ BT_8723B_1ANT_WIFI_STATUS_CONNECTED_SPECIAL_PKT = 0x3, ++ BT_8723B_1ANT_WIFI_STATUS_CONNECTED_IDLE = 0x4, ++ BT_8723B_1ANT_WIFI_STATUS_CONNECTED_BUSY = 0x5, + BT_8723B_1ANT_WIFI_STATUS_MAX -+}BT_8723B_1ANT_WIFI_STATUS,*PBT_8723B_1ANT_WIFI_STATUS; ++} BT_8723B_1ANT_WIFI_STATUS, *PBT_8723B_1ANT_WIFI_STATUS; + -+typedef enum _BT_8723B_1ANT_COEX_ALGO{ -+ BT_8723B_1ANT_COEX_ALGO_UNDEFINED = 0x0, ++typedef enum _BT_8723B_1ANT_COEX_ALGO { ++ BT_8723B_1ANT_COEX_ALGO_UNDEFINED = 0x0, + BT_8723B_1ANT_COEX_ALGO_SCO = 0x1, + BT_8723B_1ANT_COEX_ALGO_HID = 0x2, -+ BT_8723B_1ANT_COEX_ALGO_A2DP = 0x3, ++ BT_8723B_1ANT_COEX_ALGO_A2DP = 0x3, + BT_8723B_1ANT_COEX_ALGO_A2DP_PANHS = 0x4, + BT_8723B_1ANT_COEX_ALGO_PANEDR = 0x5, + BT_8723B_1ANT_COEX_ALGO_PANHS = 0x6, + BT_8723B_1ANT_COEX_ALGO_PANEDR_A2DP = 0x7, + BT_8723B_1ANT_COEX_ALGO_PANEDR_HID = 0x8, + BT_8723B_1ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9, -+ BT_8723B_1ANT_COEX_ALGO_HID_A2DP = 0xa, ++ BT_8723B_1ANT_COEX_ALGO_HID_A2DP = 0xa, + BT_8723B_1ANT_COEX_ALGO_MAX = 0xb, -+}BT_8723B_1ANT_COEX_ALGO,*PBT_8723B_1ANT_COEX_ALGO; ++} BT_8723B_1ANT_COEX_ALGO, *PBT_8723B_1ANT_COEX_ALGO; + -+typedef struct _COEX_DM_8723B_1ANT{ ++typedef struct _COEX_DM_8723B_1ANT { + /* fw mechanism */ -+ bool bCurIgnoreWlanAct; -+ bool bPreIgnoreWlanAct; ++ bool bCurIgnoreWlanAct; ++ bool bPreIgnoreWlanAct; + u8 prePsTdma; + u8 curPsTdma; + u8 psTdmaPara[5]; + u8 psTdmaDuAdjType; -+ bool bAutoTdmaAdjust; -+ bool bPrePsTdmaOn; -+ bool bCurPsTdmaOn; -+ bool bPreBtAutoReport; -+ bool bCurBtAutoReport; ++ bool bAutoTdmaAdjust; ++ bool bPrePsTdmaOn; ++ bool bCurPsTdmaOn; ++ bool bPreBtAutoReport; ++ bool bCurBtAutoReport; + u8 preLps; + u8 curLps; + u8 preRpwm; + u8 curRpwm; + + /* sw mechanism */ -+ bool bPreLowPenaltyRa; -+ bool bCurLowPenaltyRa; -+ u32 preVal0x6c0; -+ u32 curVal0x6c0; -+ u32 preVal0x6c4; -+ u32 curVal0x6c4; -+ u32 preVal0x6c8; -+ u32 curVal0x6c8; ++ bool bPreLowPenaltyRa; ++ bool bCurLowPenaltyRa; ++ u32 preVal0x6c0; ++ u32 curVal0x6c0; ++ u32 preVal0x6c4; ++ u32 curVal0x6c4; ++ u32 preVal0x6c8; ++ u32 curVal0x6c8; + u8 preVal0x6cc; + u8 curVal0x6cc; -+ bool bLimitedDig; ++ bool bLimitedDig; + -+ u32 backupArfrCnt1; /* Auto Rate Fallback Retry cnt */ -+ u32 backupArfrCnt2; /* Auto Rate Fallback Retry cnt */ -+ u16 backupRetryLimit; ++ u32 backupArfrCnt1; /* Auto Rate Fallback Retry cnt */ ++ u32 backupArfrCnt2; /* Auto Rate Fallback Retry cnt */ ++ u16 backupRetryLimit; + u8 backupAmpduMaxTime; + + /* algorithm related */ @@ -38844,138 +37701,88 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b1Ant.h linux-4.3-rtl8723b + u8 btStatus; + u8 wifiChnlInfo[3]; + -+ u32 preRaMask; -+ u32 curRaMask; ++ u32 preRaMask; ++ u32 curRaMask; + u8 preArfrType; + u8 curArfrType; + u8 preRetryLimitType; + u8 curRetryLimitType; + u8 preAmpduTimeType; + u8 curAmpduTimeType; -+ u32 nArpCnt; ++ u32 nArpCnt; + + u8 errorCondition; +} COEX_DM_8723B_1ANT, *PCOEX_DM_8723B_1ANT; + -+typedef struct _COEX_STA_8723B_1ANT{ -+ bool bBtLinkExist; -+ bool bScoExist; -+ bool bA2dpExist; -+ bool bHidExist; -+ bool bPanExist; ++typedef struct _COEX_STA_8723B_1ANT { ++ bool bBtLinkExist; ++ bool bScoExist; ++ bool bA2dpExist; ++ bool bHidExist; ++ bool bPanExist; + -+ bool bUnderLps; -+ bool bUnderIps; -+ u32 specialPktPeriodCnt; -+ u32 highPriorityTx; -+ u32 highPriorityRx; -+ u32 lowPriorityTx; -+ u32 lowPriorityRx; -+ s8 btRssi; -+ bool bBtTxRxMask; -+ u8 preBtRssiState; -+ u8 preWifiRssiState[4]; -+ bool bC2hBtInfoReqSent; -+ u8 btInfoC2h[BT_INFO_SRC_8723B_1ANT_MAX][10]; -+ u32 btInfoC2hCnt[BT_INFO_SRC_8723B_1ANT_MAX]; -+ bool bC2hBtInquiryPage; -+ bool bC2hBtPage; /* Add for win8.1 page out issue */ -+ bool bWiFiIsHighPriTask; /* Add for win8.1 page out issue */ -+ u8 btRetryCnt; -+ u8 btInfoExt; -+ u32 popEventCnt; -+ u8 nScanAPNum; ++ bool bUnderLps; ++ bool bUnderIps; ++ u32 specialPktPeriodCnt; ++ u32 highPriorityTx; ++ u32 highPriorityRx; ++ u32 lowPriorityTx; ++ u32 lowPriorityRx; ++ s8 btRssi; ++ bool bBtTxRxMask; ++ u8 preBtRssiState; ++ u8 preWifiRssiState[4]; ++ bool bC2hBtInfoReqSent; ++ u8 btInfoC2h[BT_INFO_SRC_8723B_1ANT_MAX][10]; ++ u32 btInfoC2hCnt[BT_INFO_SRC_8723B_1ANT_MAX]; ++ bool bC2hBtInquiryPage; ++ bool bC2hBtPage; /* Add for win8.1 page out issue */ ++ bool bWiFiIsHighPriTask; /* Add for win8.1 page out issue */ ++ u8 btRetryCnt; ++ u8 btInfoExt; ++ u32 popEventCnt; ++ u8 nScanAPNum; + -+ u32 nCRCOK_CCK; -+ u32 nCRCOK_11g; -+ u32 nCRCOK_11n; -+ u32 nCRCOK_11nAgg; ++ u32 nCRCOK_CCK; ++ u32 nCRCOK_11g; ++ u32 nCRCOK_11n; ++ u32 nCRCOK_11nAgg; + -+ u32 nCRCErr_CCK; -+ u32 nCRCErr_11g; -+ u32 nCRCErr_11n; -+ u32 nCRCErr_11nAgg; ++ u32 nCRCErr_CCK; ++ u32 nCRCErr_11g; ++ u32 nCRCErr_11n; ++ u32 nCRCErr_11nAgg; + -+ bool bCCKLock; -+ bool bPreCCKLock; -+ u8 nCoexTableType; ++ bool bCCKLock; ++ bool bPreCCKLock; ++ u8 nCoexTableType; + -+ bool bForceLpsOn; -+}COEX_STA_8723B_1ANT, *PCOEX_STA_8723B_1ANT; ++ bool bForceLpsOn; ++} COEX_STA_8723B_1ANT, *PCOEX_STA_8723B_1ANT; + +/* */ +/* The following is interface which will notify coex module. */ +/* */ -+void -+EXhalbtc8723b1ant_PowerOnSetting( -+PBTC_COEXIST pBtCoexist -+ ); -+void -+EXhalbtc8723b1ant_InitHwConfig( -+PBTC_COEXIST pBtCoexist, -+bool bWifiOnly -+ ); -+void -+EXhalbtc8723b1ant_InitCoexDm( -+PBTC_COEXIST pBtCoexist -+ ); -+void -+EXhalbtc8723b1ant_IpsNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ); -+void -+EXhalbtc8723b1ant_LpsNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ); -+void -+EXhalbtc8723b1ant_ScanNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ); -+void -+EXhalbtc8723b1ant_ConnectNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ); -+void -+EXhalbtc8723b1ant_MediaStatusNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ); -+void -+EXhalbtc8723b1ant_SpecialPacketNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ); -+void -+EXhalbtc8723b1ant_BtInfoNotify( -+PBTC_COEXIST pBtCoexist, -+u8 * tmpBuf, -+u8 length -+ ); -+void -+EXhalbtc8723b1ant_HaltNotify( -+PBTC_COEXIST pBtCoexist -+ ); -+void -+EXhalbtc8723b1ant_PnpNotify( -+PBTC_COEXIST pBtCoexist, -+u8 pnpState -+ ); -+void -+EXhalbtc8723b1ant_Periodical( -+PBTC_COEXIST pBtCoexist -+ ); -+void -+EXhalbtc8723b1ant_DisplayCoexInfo( -+PBTC_COEXIST pBtCoexist -+ ); -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c ---- linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,4077 @@ ++void EXhalbtc8723b1ant_PowerOnSetting(PBTC_COEXIST pBtCoexist); ++void EXhalbtc8723b1ant_InitHwConfig(PBTC_COEXIST pBtCoexist, bool bWifiOnly); ++void EXhalbtc8723b1ant_InitCoexDm(PBTC_COEXIST pBtCoexist); ++void EXhalbtc8723b1ant_IpsNotify(PBTC_COEXIST pBtCoexist, u8 type); ++void EXhalbtc8723b1ant_LpsNotify(PBTC_COEXIST pBtCoexist, u8 type); ++void EXhalbtc8723b1ant_ScanNotify(PBTC_COEXIST pBtCoexist, u8 type); ++void EXhalbtc8723b1ant_ConnectNotify(PBTC_COEXIST pBtCoexist, u8 type); ++void EXhalbtc8723b1ant_MediaStatusNotify(PBTC_COEXIST pBtCoexist, u8 type); ++void EXhalbtc8723b1ant_SpecialPacketNotify(PBTC_COEXIST pBtCoexist, u8 type); ++void EXhalbtc8723b1ant_BtInfoNotify( ++ PBTC_COEXIST pBtCoexist, u8 *tmpBuf, u8 length ++); ++void EXhalbtc8723b1ant_HaltNotify(PBTC_COEXIST pBtCoexist); ++void EXhalbtc8723b1ant_PnpNotify(PBTC_COEXIST pBtCoexist, u8 pnpState); ++void EXhalbtc8723b1ant_Periodical(PBTC_COEXIST pBtCoexist); ++void EXhalbtc8723b1ant_DisplayCoexInfo(PBTC_COEXIST pBtCoexist); +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c +--- linux.old/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,3729 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. @@ -38994,113 +37801,87 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b +#include "Mp_Precomp.h" + +/* Global variables, these are static variables */ -+static COEX_DM_8723B_2ANT GLCoexDm8723b2Ant; -+static PCOEX_DM_8723B_2ANT pCoexDm =&GLCoexDm8723b2Ant; -+static COEX_STA_8723B_2ANT GLCoexSta8723b2Ant; -+static PCOEX_STA_8723B_2ANT pCoexSta =&GLCoexSta8723b2Ant; ++static COEX_DM_8723B_2ANT GLCoexDm8723b2Ant; ++static PCOEX_DM_8723B_2ANT pCoexDm = &GLCoexDm8723b2Ant; ++static COEX_STA_8723B_2ANT GLCoexSta8723b2Ant; ++static PCOEX_STA_8723B_2ANT pCoexSta = &GLCoexSta8723b2Ant; + -+static const char *const GLBtInfoSrc8723b2Ant[]={ ++static const char *const GLBtInfoSrc8723b2Ant[] = { + "BT Info[wifi fw]", + "BT Info[bt rsp]", + "BT Info[bt auto report]", +}; + -+static u32 GLCoexVerDate8723b2Ant =20131211; ++static u32 GLCoexVerDate8723b2Ant = 20131211; +static u32 GLCoexVer8723b2Ant = 0x40; + +/* local function start with halbtc8723b2ant_ */ -+static u8 -+halbtc8723b2ant_BtRssiState( -+ u8 levelNum, -+ u8 rssiThresh, -+ u8 rssiThresh1 -+ ) ++static u8 halbtc8723b2ant_BtRssiState( ++ u8 levelNum, u8 rssiThresh, u8 rssiThresh1 ++) +{ -+ s32 btRssi = 0; -+ u8 btRssiState =pCoexSta->preBtRssiState; ++ s32 btRssi = 0; ++ u8 btRssiState = pCoexSta->preBtRssiState; + + btRssi = pCoexSta->btRssi; + -+ if (levelNum == 2) -+ { -+ if ((pCoexSta->preBtRssiState == BTC_RSSI_STATE_LOW) || -+ (pCoexSta->preBtRssiState == BTC_RSSI_STATE_STAY_LOW)) -+ { -+ if (btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT)) -+ { ++ if (levelNum == 2) { ++ if ( ++ (pCoexSta->preBtRssiState == BTC_RSSI_STATE_LOW) || ++ (pCoexSta->preBtRssiState == BTC_RSSI_STATE_STAY_LOW) ++ ) { ++ if (btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT)) { + btRssiState = BTC_RSSI_STATE_HIGH; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to High\n")); -+ } -+ else -+ { ++ } else { + btRssiState = BTC_RSSI_STATE_STAY_LOW; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at Low\n")); + } -+ } -+ else -+ { -+ if (btRssi < rssiThresh) -+ { ++ } else { ++ if (btRssi < rssiThresh) { + btRssiState = BTC_RSSI_STATE_LOW; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to Low\n")); -+ } -+ else -+ { ++ } else { + btRssiState = BTC_RSSI_STATE_STAY_HIGH; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at High\n")); + } + } -+ } -+ else if (levelNum == 3) -+ { -+ if (rssiThresh > rssiThresh1) -+ { ++ } else if (levelNum == 3) { ++ if (rssiThresh > rssiThresh1) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi thresh error!!\n")); + return pCoexSta->preBtRssiState; + } + -+ if ((pCoexSta->preBtRssiState == BTC_RSSI_STATE_LOW) || -+ (pCoexSta->preBtRssiState == BTC_RSSI_STATE_STAY_LOW)) -+ { -+ if (btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT)) -+ { ++ if ( ++ (pCoexSta->preBtRssiState == BTC_RSSI_STATE_LOW) || ++ (pCoexSta->preBtRssiState == BTC_RSSI_STATE_STAY_LOW) ++ ) { ++ if (btRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT)) { + btRssiState = BTC_RSSI_STATE_MEDIUM; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to Medium\n")); -+ } -+ else -+ { ++ } else { + btRssiState = BTC_RSSI_STATE_STAY_LOW; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at Low\n")); + } -+ } -+ else if ((pCoexSta->preBtRssiState == BTC_RSSI_STATE_MEDIUM) || -+ (pCoexSta->preBtRssiState == BTC_RSSI_STATE_STAY_MEDIUM)) -+ { -+ if (btRssi >= (rssiThresh1+BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT)) -+ { ++ } else if ( ++ (pCoexSta->preBtRssiState == BTC_RSSI_STATE_MEDIUM) || ++ (pCoexSta->preBtRssiState == BTC_RSSI_STATE_STAY_MEDIUM) ++ ) { ++ if (btRssi >= (rssiThresh1+BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT)) { + btRssiState = BTC_RSSI_STATE_HIGH; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to High\n")); -+ } -+ else if (btRssi < rssiThresh) -+ { ++ } else if (btRssi < rssiThresh) { + btRssiState = BTC_RSSI_STATE_LOW; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to Low\n")); -+ } -+ else -+ { ++ } else { + btRssiState = BTC_RSSI_STATE_STAY_MEDIUM; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at Medium\n")); + } -+ } -+ else -+ { -+ if (btRssi < rssiThresh1) -+ { ++ } else { ++ if (btRssi < rssiThresh1) { + btRssiState = BTC_RSSI_STATE_MEDIUM; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state switch to Medium\n")); -+ } -+ else -+ { ++ } else { + btRssiState = BTC_RSSI_STATE_STAY_HIGH; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_RSSI_STATE, ("[BTCoex], BT Rssi state stay at High\n")); + } @@ -39112,100 +37893,76 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + return btRssiState; +} + -+static u8 -+halbtc8723b2ant_WifiRssiState( -+PBTC_COEXIST pBtCoexist, -+u8 index, -+u8 levelNum, -+u8 rssiThresh, -+u8 rssiThresh1 -+ ) ++static u8 halbtc8723b2ant_WifiRssiState( ++ PBTC_COEXIST pBtCoexist, ++ u8 index, ++ u8 levelNum, ++ u8 rssiThresh, ++ u8 rssiThresh1 ++) +{ -+ s32 wifiRssi = 0; -+ u8 wifiRssiState =pCoexSta->preWifiRssiState[index]; ++ s32 wifiRssi = 0; ++ u8 wifiRssiState = pCoexSta->preWifiRssiState[index]; + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_WIFI_RSSI, &wifiRssi); + -+ if (levelNum == 2) -+ { -+ if ((pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_LOW) || -+ (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_STAY_LOW)) -+ { -+ if (wifiRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT)) -+ { ++ if (levelNum == 2) { ++ if ( ++ (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_LOW) || ++ (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_STAY_LOW) ++ ) { ++ if (wifiRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT)) { + wifiRssiState = BTC_RSSI_STATE_HIGH; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to High\n")); -+ } -+ else -+ { ++ } else { + wifiRssiState = BTC_RSSI_STATE_STAY_LOW; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at Low\n")); + } -+ } -+ else -+ { -+ if (wifiRssi < rssiThresh) -+ { ++ } else { ++ if (wifiRssi < rssiThresh) { + wifiRssiState = BTC_RSSI_STATE_LOW; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to Low\n")); -+ } -+ else -+ { ++ } else { + wifiRssiState = BTC_RSSI_STATE_STAY_HIGH; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at High\n")); + } + } -+ } -+ else if (levelNum == 3) -+ { -+ if (rssiThresh > rssiThresh1) -+ { ++ } else if (levelNum == 3) { ++ if (rssiThresh > rssiThresh1) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI thresh error!!\n")); + return pCoexSta->preWifiRssiState[index]; + } + -+ if ((pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_LOW) || -+ (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_STAY_LOW)) -+ { -+ if (wifiRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT)) -+ { ++ if ( ++ (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_LOW) || ++ (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_STAY_LOW) ++ ) { ++ if (wifiRssi >= (rssiThresh+BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT)) { + wifiRssiState = BTC_RSSI_STATE_MEDIUM; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to Medium\n")); -+ } -+ else -+ { ++ } else { + wifiRssiState = BTC_RSSI_STATE_STAY_LOW; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at Low\n")); + } -+ } -+ else if ((pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_MEDIUM) || -+ (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_STAY_MEDIUM)) -+ { -+ if (wifiRssi >= (rssiThresh1+BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT)) -+ { ++ } else if ( ++ (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_MEDIUM) || ++ (pCoexSta->preWifiRssiState[index] == BTC_RSSI_STATE_STAY_MEDIUM) ++ ) { ++ if (wifiRssi >= (rssiThresh1+BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT)) { + wifiRssiState = BTC_RSSI_STATE_HIGH; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to High\n")); -+ } -+ else if (wifiRssi < rssiThresh) -+ { ++ } else if (wifiRssi < rssiThresh) { + wifiRssiState = BTC_RSSI_STATE_LOW; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to Low\n")); -+ } -+ else -+ { ++ } else { + wifiRssiState = BTC_RSSI_STATE_STAY_MEDIUM; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at Medium\n")); + } -+ } -+ else -+ { -+ if (wifiRssi < rssiThresh1) -+ { ++ } else { ++ if (wifiRssi < rssiThresh1) { + wifiRssiState = BTC_RSSI_STATE_MEDIUM; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state switch to Medium\n")); -+ } -+ else -+ { ++ } else { + wifiRssiState = BTC_RSSI_STATE_STAY_HIGH; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_WIFI_RSSI_STATE, ("[BTCoex], wifi RSSI state stay at High\n")); + } @@ -39217,18 +37974,17 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + return wifiRssiState; +} + -+static void -+halbtc8723b2ant_LimitedRx( -+PBTC_COEXIST pBtCoexist, -+bool bForceExec, -+bool bRejApAggPkt, -+bool bBtCtrlAggBufSize, -+u8 aggBufSize -+ ) ++static void halbtc8723b2ant_LimitedRx( ++ PBTC_COEXIST pBtCoexist, ++ bool bForceExec, ++ bool bRejApAggPkt, ++ bool bBtCtrlAggBufSize, ++ u8 aggBufSize ++) +{ -+ bool bRejectRxAgg =bRejApAggPkt; -+ bool bBtCtrlRxAggSize =bBtCtrlAggBufSize; -+ u8 rxAggSize =aggBufSize; ++ bool bRejectRxAgg = bRejApAggPkt; ++ bool bBtCtrlRxAggSize = bBtCtrlAggBufSize; ++ u8 rxAggSize = aggBufSize; + + /* */ + /* Rx Aggregation related setting */ @@ -39242,13 +37998,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_AGGREGATE_CTRL, NULL); +} + -+static void -+halbtc8723b2ant_MonitorBtCtr( -+PBTC_COEXIST pBtCoexist -+ ) ++static void halbtc8723b2ant_MonitorBtCtr(PBTC_COEXIST pBtCoexist) +{ -+ u32 regHPTxRx, regLPTxRx, u4Tmp; -+ u32 regHPTx = 0, regHPRx = 0, regLPTx = 0, regLPRx = 0; ++ u32 regHPTxRx, regLPTxRx, u4Tmp; ++ u32 regHPTx = 0, regHPRx = 0, regLPTx = 0, regLPRx = 0; + + regHPTxRx = 0x770; + regLPTxRx = 0x774; @@ -39266,60 +38019,75 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pCoexSta->lowPriorityTx = regLPTx; + pCoexSta->lowPriorityRx = regLPRx; + -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], High Priority Tx/Rx (reg 0x%x) = 0x%x(%d)/0x%x(%d)\n", -+ regHPTxRx, regHPTx, regHPTx, regHPRx, regHPRx)); -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_BT_MONITOR, ("[BTCoex], Low Priority Tx/Rx (reg 0x%x) = 0x%x(%d)/0x%x(%d)\n", -+ regLPTxRx, regLPTx, regLPTx, regLPRx, regLPRx)); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_BT_MONITOR, ++ ( ++ "[BTCoex], High Priority Tx/Rx (reg 0x%x) = 0x%x(%d)/0x%x(%d)\n", ++ regHPTxRx, ++ regHPTx, ++ regHPTx, ++ regHPRx, ++ regHPRx ++ ) ++ ); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_BT_MONITOR, ++ ( ++ "[BTCoex], Low Priority Tx/Rx (reg 0x%x) = 0x%x(%d)/0x%x(%d)\n", ++ regLPTxRx, ++ regLPTx, ++ regLPTx, ++ regLPRx, ++ regLPRx ++ ) ++ ); + + /* reset counter */ + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x76e, 0xc); +} + -+static void -+halbtc8723b2ant_QueryBtInfo( -+PBTC_COEXIST pBtCoexist -+ ) ++static void halbtc8723b2ant_QueryBtInfo(PBTC_COEXIST pBtCoexist) +{ -+ u8 H2C_Parameter[1] ={0}; ++ u8 H2C_Parameter[1] = {0}; + + pCoexSta->bC2hBtInfoReqSent = true; + + H2C_Parameter[0] |= BIT0; /* trigger */ + -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], Query Bt Info, FW write 0x61 = 0x%x\n", -+ H2C_Parameter[0])); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_FW_EXEC, ++ ("[BTCoex], Query Bt Info, FW write 0x61 = 0x%x\n", H2C_Parameter[0]) ++ ); + + pBtCoexist->fBtcFillH2c(pBtCoexist, 0x61, 1, H2C_Parameter); +} + -+static bool -+halbtc8723b2ant_IsWifiStatusChanged( -+PBTC_COEXIST pBtCoexist -+ ) ++static bool halbtc8723b2ant_IsWifiStatusChanged(PBTC_COEXIST pBtCoexist) +{ -+ static bool bPreWifiBusy =false, bPreUnder4way =false, bPreBtHsOn =false; -+ bool bWifiBusy =false, bUnder4way =false, bBtHsOn =false; -+ bool bWifiConnected =false; ++ static bool bPreWifiBusy = false, bPreUnder4way = false, bPreBtHsOn = false; ++ bool bWifiBusy = false, bUnder4way = false, bBtHsOn = false; ++ bool bWifiConnected = false; + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_4_WAY_PROGRESS, &bUnder4way); + -+ if (bWifiConnected) -+ { -+ if (bWifiBusy != bPreWifiBusy) -+ { ++ if (bWifiConnected) { ++ if (bWifiBusy != bPreWifiBusy) { + bPreWifiBusy = bWifiBusy; + return true; + } -+ if (bUnder4way != bPreUnder4way) -+ { ++ ++ if (bUnder4way != bPreUnder4way) { + bPreUnder4way = bUnder4way; + return true; + } -+ if (bBtHsOn != bPreBtHsOn) -+ { ++ ++ if (bBtHsOn != bPreBtHsOn) { + bPreBtHsOn = bBtHsOn; + return true; + } @@ -39328,13 +38096,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + return false; +} + -+static void -+halbtc8723b2ant_UpdateBtLinkInfo( -+PBTC_COEXIST pBtCoexist -+ ) ++static void halbtc8723b2ant_UpdateBtLinkInfo(PBTC_COEXIST pBtCoexist) +{ -+ PBTC_BT_LINK_INFO pBtLinkInfo =&pBtCoexist->btLinkInfo; -+ bool bBtHsOn =false; ++ PBTC_BT_LINK_INFO pBtLinkInfo = &pBtCoexist->btLinkInfo; ++ bool bBtHsOn = false; + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); + @@ -39345,248 +38110,220 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pBtLinkInfo->bHidExist = pCoexSta->bHidExist; + + /* work around for HS mode. */ -+ if (bBtHsOn) -+ { ++ if (bBtHsOn) { + pBtLinkInfo->bPanExist = true; + pBtLinkInfo->bBtLinkExist = true; + } ++ + /* check if Sco only */ -+ if (pBtLinkInfo->bScoExist && ++ if ( ++ pBtLinkInfo->bScoExist && + !pBtLinkInfo->bA2dpExist && + !pBtLinkInfo->bPanExist && -+ !pBtLinkInfo->bHidExist) ++ !pBtLinkInfo->bHidExist ++ ) + pBtLinkInfo->bScoOnly = true; + else + pBtLinkInfo->bScoOnly = false; + + /* check if A2dp only */ -+ if (!pBtLinkInfo->bScoExist && ++ if ( ++ !pBtLinkInfo->bScoExist && + pBtLinkInfo->bA2dpExist && + !pBtLinkInfo->bPanExist && -+ !pBtLinkInfo->bHidExist) ++ !pBtLinkInfo->bHidExist ++ ) + pBtLinkInfo->bA2dpOnly = true; + else + pBtLinkInfo->bA2dpOnly = false; + + /* check if Pan only */ -+ if (!pBtLinkInfo->bScoExist && ++ if ( ++ !pBtLinkInfo->bScoExist && + !pBtLinkInfo->bA2dpExist && + pBtLinkInfo->bPanExist && -+ !pBtLinkInfo->bHidExist) ++ !pBtLinkInfo->bHidExist ++ ) + pBtLinkInfo->bPanOnly = true; + else + pBtLinkInfo->bPanOnly = false; + + /* check if Hid only */ -+ if (!pBtLinkInfo->bScoExist && ++ if ( ++ !pBtLinkInfo->bScoExist && + !pBtLinkInfo->bA2dpExist && + !pBtLinkInfo->bPanExist && -+ pBtLinkInfo->bHidExist) ++ pBtLinkInfo->bHidExist ++ ) + pBtLinkInfo->bHidOnly = true; + else + pBtLinkInfo->bHidOnly = false; +} + -+static u8 -+halbtc8723b2ant_ActionAlgorithm( -+PBTC_COEXIST pBtCoexist -+ ) ++static u8 halbtc8723b2ant_ActionAlgorithm(PBTC_COEXIST pBtCoexist) +{ -+ PBTC_BT_LINK_INFO pBtLinkInfo =&pBtCoexist->btLinkInfo; -+ bool bBtHsOn =false; -+ u8 algorithm =BT_8723B_2ANT_COEX_ALGO_UNDEFINED; -+ u8 numOfDiffProfile = 0; ++ PBTC_BT_LINK_INFO pBtLinkInfo = &pBtCoexist->btLinkInfo; ++ bool bBtHsOn = false; ++ u8 algorithm = BT_8723B_2ANT_COEX_ALGO_UNDEFINED; ++ u8 numOfDiffProfile = 0; + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); + -+ if (!pBtLinkInfo->bBtLinkExist) -+ { ++ if (!pBtLinkInfo->bBtLinkExist) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], No BT link exists!!!\n")); + return algorithm; + } + + if (pBtLinkInfo->bScoExist) + numOfDiffProfile++; ++ + if (pBtLinkInfo->bHidExist) + numOfDiffProfile++; ++ + if (pBtLinkInfo->bPanExist) + numOfDiffProfile++; ++ + if (pBtLinkInfo->bA2dpExist) + numOfDiffProfile++; + -+ if (numOfDiffProfile == 1) -+ { -+ if (pBtLinkInfo->bScoExist) -+ { ++ if (numOfDiffProfile == 1) { ++ if (pBtLinkInfo->bScoExist) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO only\n")); + algorithm = BT_8723B_2ANT_COEX_ALGO_SCO; -+ } -+ else -+ { -+ if (pBtLinkInfo->bHidExist) -+ { ++ } else { ++ if (pBtLinkInfo->bHidExist) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID only\n")); + algorithm = BT_8723B_2ANT_COEX_ALGO_HID; -+ } -+ else if (pBtLinkInfo->bA2dpExist) -+ { ++ } else if (pBtLinkInfo->bA2dpExist) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP only\n")); + algorithm = BT_8723B_2ANT_COEX_ALGO_A2DP; -+ } -+ else if (pBtLinkInfo->bPanExist) -+ { -+ if (bBtHsOn) -+ { ++ } else if (pBtLinkInfo->bPanExist) { ++ if (bBtHsOn) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(HS) only\n")); + algorithm = BT_8723B_2ANT_COEX_ALGO_PANHS; -+ } -+ else -+ { ++ } else { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], PAN(EDR) only\n")); + algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR; + } + } + } -+ } -+ else if (numOfDiffProfile == 2) -+ { -+ if (pBtLinkInfo->bScoExist) -+ { -+ if (pBtLinkInfo->bHidExist) -+ { ++ } else if (numOfDiffProfile == 2) { ++ if (pBtLinkInfo->bScoExist) { ++ if (pBtLinkInfo->bHidExist) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID\n")); + algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID; -+ } -+ else if (pBtLinkInfo->bA2dpExist) -+ { ++ } else if (pBtLinkInfo->bA2dpExist) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP ==> SCO\n")); + algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID; -+ } -+ else if (pBtLinkInfo->bPanExist) -+ { -+ if (bBtHsOn) -+ { ++ } else if (pBtLinkInfo->bPanExist) { ++ if (bBtHsOn) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(HS)\n")); + algorithm = BT_8723B_2ANT_COEX_ALGO_SCO; -+ } -+ else -+ { ++ } else { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + PAN(EDR)\n")); + algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID; + } + } -+ } -+ else -+ { -+ if (pBtLinkInfo->bHidExist && -+ pBtLinkInfo->bA2dpExist) -+ { ++ } else { ++ if ( ++ pBtLinkInfo->bHidExist && ++ pBtLinkInfo->bA2dpExist ++ ) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP\n")); + algorithm = BT_8723B_2ANT_COEX_ALGO_HID_A2DP; -+ } -+ else if (pBtLinkInfo->bHidExist && -+ pBtLinkInfo->bPanExist) -+ { -+ if (bBtHsOn) -+ { ++ } else if ( ++ pBtLinkInfo->bHidExist && ++ pBtLinkInfo->bPanExist ++ ) { ++ if (bBtHsOn) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(HS)\n")); + algorithm = BT_8723B_2ANT_COEX_ALGO_HID; -+ } -+ else -+ { ++ } else { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + PAN(EDR)\n")); + algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID; + } -+ } -+ else if (pBtLinkInfo->bPanExist && -+ pBtLinkInfo->bA2dpExist) -+ { -+ if (bBtHsOn) -+ { ++ } else if ( ++ pBtLinkInfo->bPanExist && ++ pBtLinkInfo->bA2dpExist ++ ) { ++ if (bBtHsOn) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(HS)\n")); + algorithm = BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS; -+ } -+ else -+ { ++ } else { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], A2DP + PAN(EDR)\n")); + algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP; + } + } + } -+ } -+ else if (numOfDiffProfile == 3) -+ { -+ if (pBtLinkInfo->bScoExist) -+ { -+ if (pBtLinkInfo->bHidExist && -+ pBtLinkInfo->bA2dpExist) -+ { -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + A2DP ==> HID\n")); ++ } else if (numOfDiffProfile == 3) { ++ if (pBtLinkInfo->bScoExist) { ++ if ( ++ pBtLinkInfo->bHidExist && ++ pBtLinkInfo->bA2dpExist ++ ) { ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE, ++ ("[BTCoex], SCO + HID + A2DP ==> HID\n") ++ ); + algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID; -+ } -+ else if (pBtLinkInfo->bHidExist && -+ pBtLinkInfo->bPanExist) -+ { -+ if (bBtHsOn) -+ { -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(HS)\n")); ++ } else if ( ++ pBtLinkInfo->bHidExist && ++ pBtLinkInfo->bPanExist ++ ) { ++ if (bBtHsOn) { ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE, ++ ("[BTCoex], SCO + HID + PAN(HS)\n") ++ ); ++ algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID; ++ } else { ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE, ++ ("[BTCoex], SCO + HID + PAN(EDR)\n") ++ ); + algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID; + } -+ else -+ { -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + PAN(EDR)\n")); -+ algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID; -+ } -+ } -+ else if (pBtLinkInfo->bPanExist && -+ pBtLinkInfo->bA2dpExist) -+ { -+ if (bBtHsOn) -+ { ++ } else if ( ++ pBtLinkInfo->bPanExist && ++ pBtLinkInfo->bA2dpExist ++ ) { ++ if (bBtHsOn) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(HS)\n")); + algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID; -+ } -+ else -+ { ++ } else { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + A2DP + PAN(EDR) ==> HID\n")); + algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID; + } + } -+ } -+ else -+ { -+ if (pBtLinkInfo->bHidExist && ++ } else { ++ if ( ++ pBtLinkInfo->bHidExist && + pBtLinkInfo->bPanExist && -+ pBtLinkInfo->bA2dpExist) -+ { -+ if (bBtHsOn) -+ { ++ pBtLinkInfo->bA2dpExist ++ ) { ++ if (bBtHsOn) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(HS)\n")); + algorithm = BT_8723B_2ANT_COEX_ALGO_HID_A2DP; -+ } -+ else -+ { ++ } else { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], HID + A2DP + PAN(EDR)\n")); + algorithm = BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR; + } + } + } -+ } -+ else if (numOfDiffProfile >= 3) -+ { -+ if (pBtLinkInfo->bScoExist) -+ { -+ if (pBtLinkInfo->bHidExist && ++ } else if (numOfDiffProfile >= 3) { ++ if (pBtLinkInfo->bScoExist) { ++ if ( ++ pBtLinkInfo->bHidExist && + pBtLinkInfo->bPanExist && -+ pBtLinkInfo->bA2dpExist) -+ { -+ if (bBtHsOn) -+ { ++ pBtLinkInfo->bA2dpExist ++ ) { ++ if (bBtHsOn) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Error!!! SCO + HID + A2DP + PAN(HS)\n")); + -+ } -+ else -+ { ++ } else { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], SCO + HID + A2DP + PAN(EDR) ==>PAN(EDR)+HID\n")); + algorithm = BT_8723B_2ANT_COEX_ALGO_PANEDR_HID; + } @@ -39597,55 +38334,76 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + return algorithm; +} + -+static void -+halbtc8723b2ant_SetFwDacSwingLevel( -+PBTC_COEXIST pBtCoexist, -+u8 dacSwingLvl -+ ) ++static void halbtc8723b2ant_SetFwDacSwingLevel( ++ PBTC_COEXIST pBtCoexist, u8 dacSwingLvl ++) +{ -+ u8 H2C_Parameter[1] ={0}; ++ u8 H2C_Parameter[1] = {0}; + + /* There are several type of dacswing */ + /* 0x18/ 0x10/ 0xc/ 0x8/ 0x4/ 0x6 */ + H2C_Parameter[0] = dacSwingLvl; + -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], Set Dac Swing Level = 0x%x\n", dacSwingLvl)); -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x64 = 0x%x\n", H2C_Parameter[0])); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_FW_EXEC, ++ ("[BTCoex], Set Dac Swing Level = 0x%x\n", dacSwingLvl) ++ ); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_FW_EXEC, ++ ("[BTCoex], FW write 0x64 = 0x%x\n", H2C_Parameter[0]) ++ ); + + pBtCoexist->fBtcFillH2c(pBtCoexist, 0x64, 1, H2C_Parameter); +} + -+static void -+halbtc8723b2ant_SetFwDecBtPwr( -+PBTC_COEXIST pBtCoexist, -+u8 decBtPwrLvl -+ ) ++static void halbtc8723b2ant_SetFwDecBtPwr( ++ PBTC_COEXIST pBtCoexist, u8 decBtPwrLvl ++) +{ -+ u8 H2C_Parameter[1] ={0}; ++ u8 H2C_Parameter[1] = {0}; + + H2C_Parameter[0] = decBtPwrLvl; + -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], decrease Bt Power level = %d, FW write 0x62 = 0x%x\n", -+ decBtPwrLvl, H2C_Parameter[0])); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_FW_EXEC, ++ ( ++ "[BTCoex], decrease Bt Power level = %d, FW write 0x62 = 0x%x\n", ++ decBtPwrLvl, ++ H2C_Parameter[0] ++ ) ++ ); + + pBtCoexist->fBtcFillH2c(pBtCoexist, 0x62, 1, H2C_Parameter); +} + -+static void -+halbtc8723b2ant_DecBtPwr( -+PBTC_COEXIST pBtCoexist, -+bool bForceExec, -+u8 decBtPwrLvl -+ ) ++static void halbtc8723b2ant_DecBtPwr( ++ PBTC_COEXIST pBtCoexist, bool bForceExec, u8 decBtPwrLvl ++) +{ -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s Dec BT power level = %d\n", -+ (bForceExec? "force to":""), decBtPwrLvl)); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_FW, ++ ( ++ "[BTCoex], %s Dec BT power level = %d\n", ++ (bForceExec ? "force to" : ""), ++ decBtPwrLvl ++ ) ++ ); + pCoexDm->curBtDecPwrLvl = decBtPwrLvl; + -+ if (!bForceExec) -+ { -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], preBtDecPwrLvl =%d, curBtDecPwrLvl =%d\n", -+ pCoexDm->preBtDecPwrLvl, pCoexDm->curBtDecPwrLvl)); ++ if (!bForceExec) { ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_FW_DETAIL, ++ ( ++ "[BTCoex], preBtDecPwrLvl =%d, curBtDecPwrLvl =%d\n", ++ pCoexDm->preBtDecPwrLvl, ++ pCoexDm->curBtDecPwrLvl ++ ) ++ ); + + if (pCoexDm->preBtDecPwrLvl == pCoexDm->curBtDecPwrLvl) + return; @@ -39655,21 +38413,31 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pCoexDm->preBtDecPwrLvl = pCoexDm->curBtDecPwrLvl; +} + -+static void -+halbtc8723b2ant_FwDacSwingLvl( -+PBTC_COEXIST pBtCoexist, -+bool bForceExec, -+u8 fwDacSwingLvl -+ ) ++static void halbtc8723b2ant_FwDacSwingLvl( ++ PBTC_COEXIST pBtCoexist, bool bForceExec, u8 fwDacSwingLvl ++) +{ -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s set FW Dac Swing level = %d\n", -+ (bForceExec? "force to":""), fwDacSwingLvl)); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_FW, ++ ( ++ "[BTCoex], %s set FW Dac Swing level = %d\n", ++ (bForceExec ? "force to" : ""), ++ fwDacSwingLvl ++ ) ++ ); + pCoexDm->curFwDacSwingLvl = fwDacSwingLvl; + -+ if (!bForceExec) -+ { -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], preFwDacSwingLvl =%d, curFwDacSwingLvl =%d\n", -+ pCoexDm->preFwDacSwingLvl, pCoexDm->curFwDacSwingLvl)); ++ if (!bForceExec) { ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_FW_DETAIL, ++ ( ++ "[BTCoex], preFwDacSwingLvl =%d, curFwDacSwingLvl =%d\n", ++ pCoexDm->preFwDacSwingLvl, ++ pCoexDm->curFwDacSwingLvl ++ ) ++ ); + + if (pCoexDm->preFwDacSwingLvl == pCoexDm->curFwDacSwingLvl) + return; @@ -39680,45 +38448,54 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pCoexDm->preFwDacSwingLvl = pCoexDm->curFwDacSwingLvl; +} + -+static void -+halbtc8723b2ant_SetSwRfRxLpfCorner( -+PBTC_COEXIST pBtCoexist, -+bool bRxRfShrinkOn -+ ) ++static void halbtc8723b2ant_SetSwRfRxLpfCorner( ++ PBTC_COEXIST pBtCoexist, ++ bool bRxRfShrinkOn ++) +{ -+ if (bRxRfShrinkOn) -+ { ++ if (bRxRfShrinkOn) { + /* Shrink RF Rx LPF corner */ -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Shrink RF Rx LPF corner!!\n")); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_SW_EXEC, ++ ("[BTCoex], Shrink RF Rx LPF corner!!\n") ++ ); + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff, 0xffffc); -+ } -+ else -+ { ++ } else { + /* Resume RF Rx LPF corner */ + /* After initialized, we can use pCoexDm->btRf0x1eBackup */ -+ if (pBtCoexist->bInitilized) -+ { ++ if (pBtCoexist->bInitilized) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Resume RF Rx LPF corner!!\n")); + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1e, 0xfffff, pCoexDm->btRf0x1eBackup); + } + } +} + -+static void -+halbtc8723b2ant_RfShrink( -+PBTC_COEXIST pBtCoexist, -+bool bForceExec, -+bool bRxRfShrinkOn -+ ) ++static void halbtc8723b2ant_RfShrink( ++ PBTC_COEXIST pBtCoexist, bool bForceExec, bool bRxRfShrinkOn ++) +{ -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s turn Rx RF Shrink = %s\n", -+ (bForceExec? "force to":""), ((bRxRfShrinkOn)? "ON":"OFF"))); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_SW, ++ ( ++ "[BTCoex], %s turn Rx RF Shrink = %s\n", ++ (bForceExec ? "force to" : ""), ++ (bRxRfShrinkOn ? "ON" : "OFF") ++ ) ++ ); + pCoexDm->bCurRfRxLpfShrink = bRxRfShrinkOn; + -+ if (!bForceExec) -+ { -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], bPreRfRxLpfShrink =%d, bCurRfRxLpfShrink =%d\n", -+ pCoexDm->bPreRfRxLpfShrink, pCoexDm->bCurRfRxLpfShrink)); ++ if (!bForceExec) { ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_SW_DETAIL, ++ ( ++ "[BTCoex], bPreRfRxLpfShrink =%d, bCurRfRxLpfShrink =%d\n", ++ pCoexDm->bPreRfRxLpfShrink, ++ pCoexDm->bCurRfRxLpfShrink ++ ) ++ ); + + if (pCoexDm->bPreRfRxLpfShrink == pCoexDm->bCurRfRxLpfShrink) + return; @@ -39728,18 +38505,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pCoexDm->bPreRfRxLpfShrink = pCoexDm->bCurRfRxLpfShrink; +} + -+static void -+halbtc8723b2ant_SetSwPenaltyTxRateAdaptive( -+PBTC_COEXIST pBtCoexist, -+bool bLowPenaltyRa -+ ) ++static void halbtc8723b2ant_SetSwPenaltyTxRateAdaptive( ++ PBTC_COEXIST pBtCoexist, bool bLowPenaltyRa ++) +{ -+ u8 H2C_Parameter[6] ={0}; ++ u8 H2C_Parameter[6] = {0}; + + H2C_Parameter[0] = 0x6; /* opCode, 0x6 = Retry_Penalty */ + -+ if (bLowPenaltyRa) -+ { ++ if (bLowPenaltyRa) { + H2C_Parameter[1] |= BIT0; + H2C_Parameter[2] = 0x00; /* normal rate except MCS7/6/5, OFDM54/48/36 */ + H2C_Parameter[3] = 0xf7; /* MCS7 or OFDM54 */ @@ -39747,28 +38521,44 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + H2C_Parameter[5] = 0xf9; /* MCS5 or OFDM36 */ + } + -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], set WiFi Low-Penalty Retry: %s", -+ (bLowPenaltyRa? "ON!!":"OFF!!"))); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_FW_EXEC, ++ ( ++ "[BTCoex], set WiFi Low-Penalty Retry: %s", ++ (bLowPenaltyRa ? "ON!!" : "OFF!!") ++ ) ++ ); + + pBtCoexist->fBtcFillH2c(pBtCoexist, 0x69, 6, H2C_Parameter); +} + -+static void -+halbtc8723b2ant_LowPenaltyRa( -+PBTC_COEXIST pBtCoexist, -+bool bForceExec, -+bool bLowPenaltyRa -+ ) ++static void halbtc8723b2ant_LowPenaltyRa( ++ PBTC_COEXIST pBtCoexist, bool bForceExec, bool bLowPenaltyRa ++) +{ + /* return; */ -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s turn LowPenaltyRA = %s\n", -+ (bForceExec? "force to":""), ((bLowPenaltyRa)? "ON":"OFF"))); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_SW, ++ ( ++ "[BTCoex], %s turn LowPenaltyRA = %s\n", ++ (bForceExec ? "force to" : ""), ++ (bLowPenaltyRa ? "ON" : "OFF") ++ ) ++ ); + pCoexDm->bCurLowPenaltyRa = bLowPenaltyRa; + -+ if (!bForceExec) -+ { -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], bPreLowPenaltyRa =%d, bCurLowPenaltyRa =%d\n", -+ pCoexDm->bPreLowPenaltyRa, pCoexDm->bCurLowPenaltyRa)); ++ if (!bForceExec) { ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_SW_DETAIL, ++ ( ++ "[BTCoex], bPreLowPenaltyRa =%d, bCurLowPenaltyRa =%d\n", ++ pCoexDm->bPreLowPenaltyRa, ++ pCoexDm->bCurLowPenaltyRa ++ ) ++ ); + + if (pCoexDm->bPreLowPenaltyRa == pCoexDm->bCurLowPenaltyRa) + return; @@ -39778,54 +38568,61 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pCoexDm->bPreLowPenaltyRa = pCoexDm->bCurLowPenaltyRa; +} + -+static void -+halbtc8723b2ant_SetDacSwingReg( -+PBTC_COEXIST pBtCoexist, -+u32 level -+ ) ++static void halbtc8723b2ant_SetDacSwingReg(PBTC_COEXIST pBtCoexist, u32 level) +{ -+ u8 val =(u8)level; ++ u8 val = (u8)level; + -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Write SwDacSwing = 0x%x\n", level)); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_SW_EXEC, ++ ("[BTCoex], Write SwDacSwing = 0x%x\n", level) ++ ); + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x883, 0x3e, val); +} + -+static void -+halbtc8723b2ant_SetSwFullTimeDacSwing( -+PBTC_COEXIST pBtCoexist, -+bool bSwDacSwingOn, -+u32 swDacSwingLvl -+ ) ++static void halbtc8723b2ant_SetSwFullTimeDacSwing( ++ PBTC_COEXIST pBtCoexist, bool bSwDacSwingOn, u32 swDacSwingLvl ++) +{ + if (bSwDacSwingOn) -+ { + halbtc8723b2ant_SetDacSwingReg(pBtCoexist, swDacSwingLvl); -+ } + else -+ { + halbtc8723b2ant_SetDacSwingReg(pBtCoexist, 0x18); -+ } +} + + -+static void -+halbtc8723b2ant_DacSwing( -+PBTC_COEXIST pBtCoexist, -+bool bForceExec, -+bool bDacSwingOn, -+u32 dacSwingLvl -+ ) ++static void halbtc8723b2ant_DacSwing( ++ PBTC_COEXIST pBtCoexist, ++ bool bForceExec, ++ bool bDacSwingOn, ++ u32 dacSwingLvl ++) +{ -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s turn DacSwing =%s, dacSwingLvl = 0x%x\n", -+ (bForceExec? "force to":""), ((bDacSwingOn)? "ON":"OFF"), dacSwingLvl)); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_SW, ++ ( ++ "[BTCoex], %s turn DacSwing =%s, dacSwingLvl = 0x%x\n", ++ (bForceExec ? "force to" : ""), ++ (bDacSwingOn ? "ON" : "OFF"), ++ dacSwingLvl ++ ) ++ ); + pCoexDm->bCurDacSwingOn = bDacSwingOn; + pCoexDm->curDacSwingLvl = dacSwingLvl; + -+ if (!bForceExec) -+ { -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], bPreDacSwingOn =%d, preDacSwingLvl = 0x%x, bCurDacSwingOn =%d, curDacSwingLvl = 0x%x\n", -+ pCoexDm->bPreDacSwingOn, pCoexDm->preDacSwingLvl, -+ pCoexDm->bCurDacSwingOn, pCoexDm->curDacSwingLvl)); ++ if (!bForceExec) { ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_SW_DETAIL, ++ ( ++ "[BTCoex], bPreDacSwingOn =%d, preDacSwingLvl = 0x%x, bCurDacSwingOn =%d, curDacSwingLvl = 0x%x\n", ++ pCoexDm->bPreDacSwingOn, ++ pCoexDm->preDacSwingLvl, ++ pCoexDm->bCurDacSwingOn, ++ pCoexDm->curDacSwingLvl ++ ) ++ ); + + if ((pCoexDm->bPreDacSwingOn == pCoexDm->bCurDacSwingOn) && + (pCoexDm->preDacSwingLvl == pCoexDm->curDacSwingLvl)) @@ -39838,17 +38635,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pCoexDm->preDacSwingLvl = pCoexDm->curDacSwingLvl; +} + -+static void -+halbtc8723b2ant_SetAgcTable( -+PBTC_COEXIST pBtCoexist, -+bool bAgcTableEn -+ ) ++static void halbtc8723b2ant_SetAgcTable( ++ PBTC_COEXIST pBtCoexist, bool bAgcTableEn ++) +{ + u8 rssiAdjustVal = 0; + + /* BB AGC Gain Table */ -+ if (bAgcTableEn) -+ { ++ if (bAgcTableEn) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB Agc Table On!\n")); + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6e1A0001); + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6d1B0001); @@ -39857,9 +38651,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x6a1E0001); + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x691F0001); + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0x68200001); -+ } -+ else -+ { ++ } else { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], BB Agc Table Off!\n")); + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xaa1A0001); + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0xc78, 0xa91B0001); @@ -39873,14 +38665,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + + /* RF Gain */ + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0xef, 0xfffff, 0x02000); -+ if (bAgcTableEn) -+ { ++ if (bAgcTableEn) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table On!\n")); + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x38fff); + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x38ffe); -+ } -+ else -+ { ++ } else { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n")); + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x380c3); + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x3b, 0xfffff, 0x28ce6); @@ -39888,14 +38677,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0xef, 0xfffff, 0x0); + + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0xed, 0xfffff, 0x1); -+ if (bAgcTableEn) -+ { ++ if (bAgcTableEn) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table On!\n")); + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x38fff); + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x38ffe); -+ } -+ else -+ { ++ } else { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], Agc Table Off!\n")); + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x380c3); + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x40, 0xfffff, 0x28ce6); @@ -39904,27 +38690,36 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + + /* set rssiAdjustVal for wifi module. */ + if (bAgcTableEn) -+ { + rssiAdjustVal = 8; -+ } ++ + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON, &rssiAdjustVal); +} + -+static void -+halbtc8723b2ant_AgcTable( -+PBTC_COEXIST pBtCoexist, -+bool bForceExec, -+bool bAgcTableEn -+ ) ++static void halbtc8723b2ant_AgcTable( ++ PBTC_COEXIST pBtCoexist, bool bForceExec, bool bAgcTableEn ++) +{ -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s %s Agc Table\n", -+ (bForceExec? "force to":""), ((bAgcTableEn)? "Enable":"Disable"))); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_SW, ++ ( ++ "[BTCoex], %s %s Agc Table\n", ++ (bForceExec ? "force to" : ""), ++ (bAgcTableEn ? "Enable" : "Disable") ++ ) ++ ); + pCoexDm->bCurAgcTableEn = bAgcTableEn; + -+ if (!bForceExec) -+ { -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], bPreAgcTableEn =%d, bCurAgcTableEn =%d\n", -+ pCoexDm->bPreAgcTableEn, pCoexDm->bCurAgcTableEn)); ++ if (!bForceExec) { ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_SW_DETAIL, ++ ( ++ "[BTCoex], bPreAgcTableEn =%d, bCurAgcTableEn =%d\n", ++ pCoexDm->bPreAgcTableEn, ++ pCoexDm->bCurAgcTableEn ++ ) ++ ); + + if (pCoexDm->bPreAgcTableEn == pCoexDm->bCurAgcTableEn) + return; @@ -39934,56 +38729,99 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pCoexDm->bPreAgcTableEn = pCoexDm->bCurAgcTableEn; +} + -+static void -+halbtc8723b2ant_SetCoexTable( -+PBTC_COEXIST pBtCoexist, -+u32 val0x6c0, -+u32 val0x6c4, -+u32 val0x6c8, -+u8 val0x6cc -+ ) ++static void halbtc8723b2ant_SetCoexTable( ++ PBTC_COEXIST pBtCoexist, ++ u32 val0x6c0, ++ u32 val0x6c4, ++ u32 val0x6c8, ++ u8 val0x6cc ++) +{ -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], set coex table, set 0x6c0 = 0x%x\n", val0x6c0)); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_SW_EXEC, ++ ("[BTCoex], set coex table, set 0x6c0 = 0x%x\n", val0x6c0) ++ ); + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c0, val0x6c0); + -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], set coex table, set 0x6c4 = 0x%x\n", val0x6c4)); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_SW_EXEC, ++ ("[BTCoex], set coex table, set 0x6c4 = 0x%x\n", val0x6c4) ++ ); + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c4, val0x6c4); + -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], set coex table, set 0x6c8 = 0x%x\n", val0x6c8)); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_SW_EXEC, ++ ("[BTCoex], set coex table, set 0x6c8 = 0x%x\n", val0x6c8) ++ ); + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x6c8, val0x6c8); + -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_EXEC, ("[BTCoex], set coex table, set 0x6cc = 0x%x\n", val0x6cc)); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_SW_EXEC, ++ ("[BTCoex], set coex table, set 0x6cc = 0x%x\n", val0x6cc) ++ ); + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x6cc, val0x6cc); +} + -+static void -+halbtc8723b2ant_CoexTable( -+PBTC_COEXIST pBtCoexist, -+bool bForceExec, -+u32 val0x6c0, -+u32 val0x6c4, -+u32 val0x6c8, -+u8 val0x6cc -+ ) ++static void halbtc8723b2ant_CoexTable( ++ PBTC_COEXIST pBtCoexist, ++ bool bForceExec, ++ u32 val0x6c0, ++ u32 val0x6c4, ++ u32 val0x6c8, ++ u8 val0x6cc ++) +{ -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW, ("[BTCoex], %s write Coex Table 0x6c0 = 0x%x, 0x6c4 = 0x%x, 0x6c8 = 0x%x, 0x6cc = 0x%x\n", -+ (bForceExec? "force to":""), val0x6c0, val0x6c4, val0x6c8, val0x6cc)); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_SW, ++ ( ++ "[BTCoex], %s write Coex Table 0x6c0 = 0x%x, 0x6c4 = 0x%x, 0x6c8 = 0x%x, 0x6cc = 0x%x\n", ++ (bForceExec ? "force to" : ""), ++ val0x6c0, ++ val0x6c4, ++ val0x6c8, ++ val0x6cc ++ ) ++ ); + pCoexDm->curVal0x6c0 = val0x6c0; + pCoexDm->curVal0x6c4 = val0x6c4; + pCoexDm->curVal0x6c8 = val0x6c8; + pCoexDm->curVal0x6cc = val0x6cc; + -+ if (!bForceExec) -+ { -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], preVal0x6c0 = 0x%x, preVal0x6c4 = 0x%x, preVal0x6c8 = 0x%x, preVal0x6cc = 0x%x !!\n", -+ pCoexDm->preVal0x6c0, pCoexDm->preVal0x6c4, pCoexDm->preVal0x6c8, pCoexDm->preVal0x6cc)); -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_SW_DETAIL, ("[BTCoex], curVal0x6c0 = 0x%x, curVal0x6c4 = 0x%x, curVal0x6c8 = 0x%x, curVal0x6cc = 0x%x !!\n", -+ pCoexDm->curVal0x6c0, pCoexDm->curVal0x6c4, pCoexDm->curVal0x6c8, pCoexDm->curVal0x6cc)); ++ if (!bForceExec) { ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_SW_DETAIL, ++ ( ++ "[BTCoex], preVal0x6c0 = 0x%x, preVal0x6c4 = 0x%x, preVal0x6c8 = 0x%x, preVal0x6cc = 0x%x !!\n", ++ pCoexDm->preVal0x6c0, ++ pCoexDm->preVal0x6c4, ++ pCoexDm->preVal0x6c8, ++ pCoexDm->preVal0x6cc ++ ) ++ ); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_SW_DETAIL, ++ ( ++ "[BTCoex], curVal0x6c0 = 0x%x, curVal0x6c4 = 0x%x, curVal0x6c8 = 0x%x, curVal0x6cc = 0x%x !!\n", ++ pCoexDm->curVal0x6c0, ++ pCoexDm->curVal0x6c4, ++ pCoexDm->curVal0x6c8, ++ pCoexDm->curVal0x6cc ++ ) ++ ); + -+ if ((pCoexDm->preVal0x6c0 == pCoexDm->curVal0x6c0) && ++ if ( ++ (pCoexDm->preVal0x6c0 == pCoexDm->curVal0x6c0) && + (pCoexDm->preVal0x6c4 == pCoexDm->curVal0x6c4) && + (pCoexDm->preVal0x6c8 == pCoexDm->curVal0x6c8) && -+ (pCoexDm->preVal0x6cc == pCoexDm->curVal0x6cc)) ++ (pCoexDm->preVal0x6cc == pCoexDm->curVal0x6cc) ++ ) + return; + } + halbtc8723b2ant_SetCoexTable(pBtCoexist, val0x6c0, val0x6c4, val0x6c8, val0x6cc); @@ -39994,91 +38832,93 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pCoexDm->preVal0x6cc = pCoexDm->curVal0x6cc; +} + -+static void -+halbtc8723b2ant_CoexTableWithType( -+PBTC_COEXIST pBtCoexist, -+bool bForceExec, -+u8 type -+ ) ++static void halbtc8723b2ant_CoexTableWithType( ++ PBTC_COEXIST pBtCoexist, bool bForceExec, u8 type ++) +{ -+ switch (type) -+ { -+ case 0: -+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x55555555, 0xffff, 0x3); -+ break; -+ case 1: -+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5afa5afa, 0xffff, 0x3); -+ break; -+ case 2: -+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0x5a5a5a5a, 0xffff, 0x3); -+ break; -+ case 3: -+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0xaaaaaaaa, 0xaaaaaaaa, 0xffff, 0x3); -+ break; -+ case 4: -+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0xffffffff, 0xffffffff, 0xffff, 0x3); -+ break; -+ case 5: -+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x5fff5fff, 0x5fff5fff, 0xffff, 0x3); -+ break; -+ case 6: -+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5a5a5a5a, 0xffff, 0x3); -+ break; -+ case 7: -+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0xfafafafa, 0xffff, 0x3); -+ break; -+ case 8: -+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x5aea5aea, 0x5aea5aea, 0xffff, 0x3); -+ break; -+ case 9: -+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5aea5aea, 0xffff, 0x3); -+ break; -+ case 10: -+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5aff5aff, 0xffff, 0x3); -+ break; -+ case 11: -+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5a5f5a5f, 0xffff, 0x3); -+ break; -+ case 12: -+ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5f5f5f5f, 0xffff, 0x3); -+ break; -+ default: -+ break; ++ switch (type) { ++ case 0: ++ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x55555555, 0xffff, 0x3); ++ break; ++ case 1: ++ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55555555, 0x5afa5afa, 0xffff, 0x3); ++ break; ++ case 2: ++ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x5a5a5a5a, 0x5a5a5a5a, 0xffff, 0x3); ++ break; ++ case 3: ++ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0xaaaaaaaa, 0xaaaaaaaa, 0xffff, 0x3); ++ break; ++ case 4: ++ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0xffffffff, 0xffffffff, 0xffff, 0x3); ++ break; ++ case 5: ++ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x5fff5fff, 0x5fff5fff, 0xffff, 0x3); ++ break; ++ case 6: ++ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5a5a5a5a, 0xffff, 0x3); ++ break; ++ case 7: ++ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0xfafafafa, 0xffff, 0x3); ++ break; ++ case 8: ++ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x5aea5aea, 0x5aea5aea, 0xffff, 0x3); ++ break; ++ case 9: ++ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5aea5aea, 0xffff, 0x3); ++ break; ++ case 10: ++ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5aff5aff, 0xffff, 0x3); ++ break; ++ case 11: ++ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5a5f5a5f, 0xffff, 0x3); ++ break; ++ case 12: ++ halbtc8723b2ant_CoexTable(pBtCoexist, bForceExec, 0x55ff55ff, 0x5f5f5f5f, 0xffff, 0x3); ++ break; ++ default: ++ break; + } +} + -+static void -+halbtc8723b2ant_SetFwIgnoreWlanAct( -+PBTC_COEXIST pBtCoexist, -+bool bEnable -+ ) ++static void halbtc8723b2ant_SetFwIgnoreWlanAct( ++ PBTC_COEXIST pBtCoexist, bool bEnable ++) +{ -+ u8 H2C_Parameter[1] ={0}; ++ u8 H2C_Parameter[1] = {0}; + + if (bEnable) -+ { + H2C_Parameter[0] |= BIT0; /* function enable */ -+ } + -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], set FW for BT Ignore Wlan_Act, FW write 0x63 = 0x%x\n", -+ H2C_Parameter[0])); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_FW_EXEC, ++ ( ++ "[BTCoex], set FW for BT Ignore Wlan_Act, FW write 0x63 = 0x%x\n", ++ H2C_Parameter[0] ++ ) ++ ); + + pBtCoexist->fBtcFillH2c(pBtCoexist, 0x63, 1, H2C_Parameter); +} + -+static void -+halbtc8723b2ant_IgnoreWlanAct( -+PBTC_COEXIST pBtCoexist, -+bool bForceExec, -+bool bEnable -+ ) ++static void halbtc8723b2ant_IgnoreWlanAct( ++ PBTC_COEXIST pBtCoexist, bool bForceExec, bool bEnable ++) +{ -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s turn Ignore WlanAct %s\n", -+ (bForceExec? "force to":""), (bEnable? "ON":"OFF"))); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_FW, ++ ( ++ "[BTCoex], %s turn Ignore WlanAct %s\n", ++ (bForceExec ? "force to" : ""), ++ (bEnable ? "ON" : "OFF") ++ ) ++ ); ++ + pCoexDm->bCurIgnoreWlanAct = bEnable; + -+ if (!bForceExec) -+ { ++ if (!bForceExec) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPreIgnoreWlanAct = %d, bCurIgnoreWlanAct = %d!!\n", + pCoexDm->bPreIgnoreWlanAct, pCoexDm->bCurIgnoreWlanAct)); + @@ -40090,17 +38930,16 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pCoexDm->bPreIgnoreWlanAct = pCoexDm->bCurIgnoreWlanAct; +} + -+static void -+halbtc8723b2ant_SetFwPstdma( -+PBTC_COEXIST pBtCoexist, -+u8 byte1, -+u8 byte2, -+u8 byte3, -+u8 byte4, -+u8 byte5 -+ ) ++static void halbtc8723b2ant_SetFwPstdma( ++ PBTC_COEXIST pBtCoexist, ++ u8 byte1, ++ u8 byte2, ++ u8 byte3, ++ u8 byte4, ++ u8 byte5 ++) +{ -+ u8 H2C_Parameter[5] ={0}; ++ u8 H2C_Parameter[5] = {0}; + + H2C_Parameter[0] = byte1; + H2C_Parameter[1] = byte2; @@ -40114,75 +38953,74 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pCoexDm->psTdmaPara[3] = byte4; + pCoexDm->psTdmaPara[4] = byte5; + -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x60(5bytes) = 0x%x%08x\n", -+ H2C_Parameter[0], -+ H2C_Parameter[1]<<24|H2C_Parameter[2]<<16|H2C_Parameter[3]<<8|H2C_Parameter[4])); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_FW_EXEC, ++ ( ++ "[BTCoex], FW write 0x60(5bytes) = 0x%x%08x\n", ++ H2C_Parameter[0], ++ H2C_Parameter[1]<<24| ++ H2C_Parameter[2]<<16| ++ H2C_Parameter[3]<<8| ++ H2C_Parameter[4] ++ ) ++ ); + + pBtCoexist->fBtcFillH2c(pBtCoexist, 0x60, 5, H2C_Parameter); +} + -+static void -+halbtc8723b2ant_SwMechanism1( -+PBTC_COEXIST pBtCoexist, -+bool bShrinkRxLPF, -+bool bLowPenaltyRA, -+bool bLimitedDIG, -+bool bBTLNAConstrain -+ ) ++static void halbtc8723b2ant_SwMechanism1( ++ PBTC_COEXIST pBtCoexist, ++ bool bShrinkRxLPF, ++ bool bLowPenaltyRA, ++ bool bLimitedDIG, ++ bool bBTLNAConstrain ++) +{ + halbtc8723b2ant_RfShrink(pBtCoexist, NORMAL_EXEC, bShrinkRxLPF); + halbtc8723b2ant_LowPenaltyRa(pBtCoexist, NORMAL_EXEC, bLowPenaltyRA); +} + -+static void -+halbtc8723b2ant_SwMechanism2( -+PBTC_COEXIST pBtCoexist, -+bool bAGCTableShift, -+bool bADCBackOff, -+bool bSWDACSwing, -+u32 dacSwingLvl -+ ) ++static void halbtc8723b2ant_SwMechanism2( ++ PBTC_COEXIST pBtCoexist, ++ bool bAGCTableShift, ++ bool bADCBackOff, ++ bool bSWDACSwing, ++ u32 dacSwingLvl ++) +{ + halbtc8723b2ant_AgcTable(pBtCoexist, NORMAL_EXEC, bAGCTableShift); + halbtc8723b2ant_DacSwing(pBtCoexist, NORMAL_EXEC, bSWDACSwing, dacSwingLvl); +} + -+static void -+halbtc8723b2ant_SetAntPath( -+PBTC_COEXIST pBtCoexist, -+u8 antPosType, -+bool bInitHwCfg, -+bool bWifiOff -+ ) ++static void halbtc8723b2ant_SetAntPath( ++ PBTC_COEXIST pBtCoexist, u8 antPosType, bool bInitHwCfg, bool bWifiOff ++) +{ -+ PBTC_BOARD_INFO pBoardInfo =&pBtCoexist->boardInfo; -+ u32 fwVer = 0, u4Tmp = 0; -+ bool bPgExtSwitch =false; -+ bool bUseExtSwitch =false; -+ u8 H2C_Parameter[2] ={0}; ++ PBTC_BOARD_INFO pBoardInfo = &pBtCoexist->boardInfo; ++ u32 fwVer = 0, u4Tmp = 0; ++ bool bPgExtSwitch = false; ++ bool bUseExtSwitch = false; ++ u8 H2C_Parameter[2] = {0}; + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_EXT_SWITCH, &bPgExtSwitch); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_FW_VER, &fwVer); /* [31:16]=fw ver, [15:0]=fw sub ver */ + -+ if ((fwVer>0 && fwVer<0xc0000) || bPgExtSwitch) ++ if ((fwVer > 0 && fwVer < 0xc0000) || bPgExtSwitch) + bUseExtSwitch = true; + -+ if (bInitHwCfg) -+ { ++ if (bInitHwCfg) { + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x39, 0x8, 0x1); + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x974, 0xff); + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x944, 0x3, 0x3); + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x930, 0x77); + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x67, 0x20, 0x1); + -+ if (fwVer >= 0x180000) -+ { -+ /* Use H2C to set GNT_BT to LOW */ -+ H2C_Parameter[0] = 0; -+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x6E, 1, H2C_Parameter); -+ } -+ else -+ { ++ if (fwVer >= 0x180000) { ++ /* Use H2C to set GNT_BT to LOW */ ++ H2C_Parameter[0] = 0; ++ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x6E, 1, H2C_Parameter); ++ } else { + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x765, 0x0); + } + @@ -40191,24 +39029,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); /* WiFi TRx Mask off */ + pBtCoexist->fBtcSetBtReg(pBtCoexist, BTC_BT_REG_RF, 0x3c, 0x01); /* BT TRx Mask off */ + -+ if (pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) -+ { ++ if (pBoardInfo->btdmAntPos == BTC_ANTENNA_AT_MAIN_PORT) { + /* tell firmware "no antenna inverse" */ + H2C_Parameter[0] = 0; -+ } -+ else -+ { ++ } else { + /* tell firmware "antenna inverse" */ + H2C_Parameter[0] = 1; + } + -+ if (bUseExtSwitch) -+ { ++ if (bUseExtSwitch) { + /* ext switch type */ + H2C_Parameter[1] = 1; -+ } -+ else -+ { ++ } else { + /* int switch type */ + H2C_Parameter[1] = 0; + } @@ -40216,163 +39048,170 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + } + + /* ext switch setting */ -+ if (bUseExtSwitch) -+ { -+ if (bInitHwCfg) -+ { ++ if (bUseExtSwitch) { ++ if (bInitHwCfg) { + /* 0x4c[23]= 0, 0x4c[24]= 1 Antenna control by WL/BT */ + u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c); -+ u4Tmp &=~BIT23; ++ u4Tmp &= ~BIT23; + u4Tmp |= BIT24; + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp); + } + + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x0); /* fixed internal switch S1->WiFi, S0->BT */ -+ switch (antPosType) -+ { -+ case BTC_ANT_WIFI_AT_MAIN: -+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x1); /* ext switch main at wifi */ -+ break; -+ case BTC_ANT_WIFI_AT_AUX: -+ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x2); /* ext switch aux at wifi */ -+ break; ++ switch (antPosType) { ++ case BTC_ANT_WIFI_AT_MAIN: ++ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x1); /* ext switch main at wifi */ ++ break; ++ case BTC_ANT_WIFI_AT_AUX: ++ pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x92c, 0x3, 0x2); /* ext switch aux at wifi */ ++ break; + } -+ } -+ else /* internal switch */ -+ { -+ if (bInitHwCfg) -+ { ++ } else { /* internal switch */ ++ if (bInitHwCfg) { + /* 0x4c[23]= 0, 0x4c[24]= 1 Antenna control by WL/BT */ + u4Tmp = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c); + u4Tmp |= BIT23; -+ u4Tmp &=~BIT24; ++ u4Tmp &= ~BIT24; + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x4c, u4Tmp); + } + + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x64, 0x1, 0x0); /* fixed external switch S1->Main, S0->Aux */ -+ switch (antPosType) -+ { -+ case BTC_ANT_WIFI_AT_MAIN: -+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x0); /* fixed internal switch S1->WiFi, S0->BT */ -+ break; -+ case BTC_ANT_WIFI_AT_AUX: -+ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x280); /* fixed internal switch S0->WiFi, S1->BT */ -+ break; ++ switch (antPosType) { ++ case BTC_ANT_WIFI_AT_MAIN: ++ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x0); /* fixed internal switch S1->WiFi, S0->BT */ ++ break; ++ case BTC_ANT_WIFI_AT_AUX: ++ pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x280); /* fixed internal switch S0->WiFi, S1->BT */ ++ break; + } + } +} + -+static void -+halbtc8723b2ant_PsTdma( -+PBTC_COEXIST pBtCoexist, -+bool bForceExec, -+bool bTurnOn, -+u8 type -+ ) ++static void halbtc8723b2ant_PsTdma( ++ PBTC_COEXIST pBtCoexist, bool bForceExec, bool bTurnOn, u8 type ++) +{ -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], %s turn %s PS TDMA, type =%d\n", -+ (bForceExec? "force to":""), (bTurnOn? "ON":"OFF"), type)); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_FW, ++ ( ++ "[BTCoex], %s turn %s PS TDMA, type =%d\n", ++ (bForceExec ? "force to" : ""), ++ (bTurnOn ? "ON" : "OFF"), ++ type ++ ) ++ ); + pCoexDm->bCurPsTdmaOn = bTurnOn; + pCoexDm->curPsTdma = type; + -+ if (!bForceExec) -+ { -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], bPrePsTdmaOn = %d, bCurPsTdmaOn = %d!!\n", -+ pCoexDm->bPrePsTdmaOn, pCoexDm->bCurPsTdmaOn)); -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], prePsTdma = %d, curPsTdma = %d!!\n", -+ pCoexDm->prePsTdma, pCoexDm->curPsTdma)); ++ if (!bForceExec) { ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_FW_DETAIL, ++ ( ++ "[BTCoex], bPrePsTdmaOn = %d, bCurPsTdmaOn = %d!!\n", ++ pCoexDm->bPrePsTdmaOn, ++ pCoexDm->bCurPsTdmaOn ++ ) ++ ); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_FW_DETAIL, ++ ( ++ "[BTCoex], prePsTdma = %d, curPsTdma = %d!!\n", ++ pCoexDm->prePsTdma, pCoexDm->curPsTdma ++ ) ++ ); + -+ if ((pCoexDm->bPrePsTdmaOn == pCoexDm->bCurPsTdmaOn) && -+ (pCoexDm->prePsTdma == pCoexDm->curPsTdma)) ++ if ( ++ (pCoexDm->bPrePsTdmaOn == pCoexDm->bCurPsTdmaOn) && ++ (pCoexDm->prePsTdma == pCoexDm->curPsTdma) ++ ) + return; + } -+ if (bTurnOn) -+ { -+ switch (type) -+ { -+ case 1: -+ default: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90); -+ break; -+ case 2: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x90); -+ break; -+ case 3: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0xf1, 0x90); -+ break; -+ case 4: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x03, 0xf1, 0x90); -+ break; -+ case 5: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x90); -+ break; -+ case 6: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x90); -+ break; -+ case 7: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0x70, 0x90); -+ break; -+ case 8: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x10, 0x3, 0x70, 0x90); -+ break; -+ case 9: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90); -+ break; -+ case 10: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x90); -+ break; -+ case 11: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0xe1, 0x90); -+ break; -+ case 12: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x90); -+ break; -+ case 13: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x90); -+ break; -+ case 14: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x90); -+ break; -+ case 15: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0x60, 0x90); -+ break; -+ case 16: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0x60, 0x90); -+ break; -+ case 17: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x2f, 0x2f, 0x60, 0x90); -+ break; -+ case 18: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x90); -+ break; -+ case 19: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0xe1, 0x90); -+ break; -+ case 20: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0x60, 0x90); -+ break; -+ case 21: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x03, 0x70, 0x90); -+ break; -+ case 71: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90); -+ break; ++ ++ if (bTurnOn) { ++ switch (type) { ++ case 1: ++ default: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90); ++ break; ++ case 2: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x90); ++ break; ++ case 3: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0xf1, 0x90); ++ break; ++ case 4: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x10, 0x03, 0xf1, 0x90); ++ break; ++ case 5: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x90); ++ break; ++ case 6: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x90); ++ break; ++ case 7: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1c, 0x3, 0x70, 0x90); ++ break; ++ case 8: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x10, 0x3, 0x70, 0x90); ++ break; ++ case 9: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90); ++ break; ++ case 10: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0xe1, 0x90); ++ break; ++ case 11: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0xe1, 0x90); ++ break; ++ case 12: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x90); ++ break; ++ case 13: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0x60, 0x90); ++ break; ++ case 14: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x12, 0x12, 0x60, 0x90); ++ break; ++ case 15: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0xa, 0xa, 0x60, 0x90); ++ break; ++ case 16: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0x60, 0x90); ++ break; ++ case 17: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xa3, 0x2f, 0x2f, 0x60, 0x90); ++ break; ++ case 18: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x5, 0x5, 0xe1, 0x90); ++ break; ++ case 19: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0xe1, 0x90); ++ break; ++ case 20: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x25, 0x25, 0x60, 0x90); ++ break; ++ case 21: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x15, 0x03, 0x70, 0x90); ++ break; ++ case 71: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0xe3, 0x1a, 0x1a, 0xe1, 0x90); ++ break; + } -+ } -+ else -+ { ++ } else { + /* disable PS tdma */ -+ switch (type) -+ { -+ case 0: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x40, 0x0); -+ break; -+ case 1: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x48, 0x0); -+ break; -+ default: -+ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x40, 0x0); -+ break; ++ switch (type) { ++ case 0: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x40, 0x0); ++ break; ++ case 1: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x48, 0x0); ++ break; ++ default: ++ halbtc8723b2ant_SetFwPstdma(pBtCoexist, 0x0, 0x0, 0x0, 0x40, 0x0); ++ break; + } + } + @@ -40381,10 +39220,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pCoexDm->prePsTdma = pCoexDm->curPsTdma; +} + -+static void -+halbtc8723b2ant_CoexAllOff( -+PBTC_COEXIST pBtCoexist -+ ) ++static void halbtc8723b2ant_CoexAllOff(PBTC_COEXIST pBtCoexist) +{ + /* fw all off */ + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, false, 1); @@ -40400,10 +39236,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0); +} + -+static void -+halbtc8723b2ant_InitCoexDm( -+PBTC_COEXIST pBtCoexist -+ ) ++static void halbtc8723b2ant_InitCoexDm(PBTC_COEXIST pBtCoexist) +{ + /* force to reset coex mechanism */ + @@ -40415,27 +39248,22 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); +} + -+static void -+halbtc8723b2ant_ActionBtInquiry( -+PBTC_COEXIST pBtCoexist -+ ) ++static void halbtc8723b2ant_ActionBtInquiry(PBTC_COEXIST pBtCoexist) +{ -+ bool bWifiConnected =false; -+ bool bLowPwrDisable =true; ++ bool bWifiConnected = false; ++ bool bLowPwrDisable = true; + + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected); + -+ if (bWifiConnected) -+ { ++ if (bWifiConnected) { + halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7); + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 0); + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, false, 1); + } ++ + halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, FORCE_EXEC, 6); + halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0); + @@ -40448,21 +39276,17 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + halbtc8723b2ant_SetAntPath(pBtCoexist, BTC_ANT_WIFI_AT_AUX, false, false); +} + -+static bool -+halbtc8723b2ant_IsCommonAction( -+PBTC_COEXIST pBtCoexist -+ ) ++static bool halbtc8723b2ant_IsCommonAction(PBTC_COEXIST pBtCoexist) +{ -+ u8 btRssiState =BTC_RSSI_STATE_HIGH; -+ bool bCommon =false, bWifiConnected =false, bWifiBusy =false; -+ bool bBtHsOn =false, bLowPwrDisable =false; ++ u8 btRssiState = BTC_RSSI_STATE_HIGH; ++ bool bCommon = false, bWifiConnected = false, bWifiBusy = false; ++ bool bBtHsOn = false, bLowPwrDisable = false; + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy); + -+ if (!bWifiConnected) -+ { ++ if (!bWifiConnected) { + bLowPwrDisable = false; + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable); + halbtc8723b2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, false, false, 0x8); @@ -40479,11 +39303,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + + bCommon = true; -+ } -+ else -+ { -+ if (BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus) -+ { ++ } else { ++ if (BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus) { + bLowPwrDisable = false; + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable); + halbtc8723b2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, false, false, 0x8); @@ -40500,14 +39321,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + + bCommon = true; -+ } -+ else if (BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) -+ { ++ } else if (BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) { + bLowPwrDisable = true; + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable); + + if (bBtHsOn) + return false; ++ + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi connected + BT connected-idle!!\n")); + halbtc8723b2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, false, false, 0x8); + @@ -40521,19 +39341,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + + bCommon = true; -+ } -+ else -+ { ++ } else { + bLowPwrDisable = true; + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_ACT_DISABLE_LOW_POWER, &bLowPwrDisable); + -+ if (bWifiBusy) -+ { ++ if (bWifiBusy) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Wifi Connected-Busy + BT Busy!!\n")); + bCommon = false; -+ } -+ else -+ { ++ } else { + if (bBtHsOn) + return false; + @@ -40545,10 +39360,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7); + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 21); + halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 0xb); ++ + if (BTC_RSSI_HIGH(btRssiState)) + halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2); + else + halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0); ++ + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + bCommon = true; @@ -40559,118 +39376,76 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + return bCommon; +} + -+static void -+halbtc8723b2ant_TdmaDurationAdjust( -+PBTC_COEXIST pBtCoexist, -+bool bScoHid, -+bool bTxPause, -+u8 maxInterval -+ ) ++static void halbtc8723b2ant_TdmaDurationAdjust( ++ PBTC_COEXIST pBtCoexist, bool bScoHid, bool bTxPause, u8 maxInterval ++) +{ -+ static s32 up, dn, m, n, WaitCount; -+ s32 result; /* 0: no change, +1: increase WiFi duration, -1: decrease WiFi duration */ -+ u8 retryCount = 0; ++ static s32 up, dn, m, n, WaitCount; ++ s32 result; /* 0: no change, +1: increase WiFi duration, -1: decrease WiFi duration */ ++ u8 retryCount = 0; + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW, ("[BTCoex], TdmaDurationAdjust()\n")); + -+ if (!pCoexDm->bAutoTdmaAdjust) -+ { ++ if (!pCoexDm->bAutoTdmaAdjust) { + pCoexDm->bAutoTdmaAdjust = true; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], first run TdmaDurationAdjust()!!\n")); + { -+ if (bScoHid) -+ { -+ if (bTxPause) -+ { -+ if (maxInterval == 1) -+ { ++ if (bScoHid) { ++ if (bTxPause) { ++ if (maxInterval == 1) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 13); + pCoexDm->psTdmaDuAdjType = 13; -+ } -+ else if (maxInterval == 2) -+ { ++ } else if (maxInterval == 2) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); + pCoexDm->psTdmaDuAdjType = 14; -+ } -+ else if (maxInterval == 3) -+ { ++ } else if (maxInterval == 3) { ++ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); ++ pCoexDm->psTdmaDuAdjType = 15; ++ } else { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); + pCoexDm->psTdmaDuAdjType = 15; + } -+ else -+ { -+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); -+ pCoexDm->psTdmaDuAdjType = 15; -+ } -+ } -+ else -+ { -+ if (maxInterval == 1) -+ { ++ } else { ++ if (maxInterval == 1) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 9); + pCoexDm->psTdmaDuAdjType = 9; -+ } -+ else if (maxInterval == 2) -+ { ++ } else if (maxInterval == 2) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); + pCoexDm->psTdmaDuAdjType = 10; -+ } -+ else if (maxInterval == 3) -+ { ++ } else if (maxInterval == 3) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); + pCoexDm->psTdmaDuAdjType = 11; -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); + pCoexDm->psTdmaDuAdjType = 11; + } + } -+ } -+ else -+ { -+ if (bTxPause) -+ { -+ if (maxInterval == 1) -+ { ++ } else { ++ if (bTxPause) { ++ if (maxInterval == 1) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 5); + pCoexDm->psTdmaDuAdjType = 5; -+ } -+ else if (maxInterval == 2) -+ { ++ } else if (maxInterval == 2) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); + pCoexDm->psTdmaDuAdjType = 6; -+ } -+ else if (maxInterval == 3) -+ { ++ } else if (maxInterval == 3) { ++ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); ++ pCoexDm->psTdmaDuAdjType = 7; ++ } else { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); + pCoexDm->psTdmaDuAdjType = 7; + } -+ else -+ { -+ halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); -+ pCoexDm->psTdmaDuAdjType = 7; -+ } -+ } -+ else -+ { -+ if (maxInterval == 1) -+ { ++ } else { ++ if (maxInterval == 1) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 1); + pCoexDm->psTdmaDuAdjType = 1; -+ } -+ else if (maxInterval == 2) -+ { ++ } else if (maxInterval == 2) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); + pCoexDm->psTdmaDuAdjType = 2; -+ } -+ else if (maxInterval == 3) -+ { ++ } else if (maxInterval == 3) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); + pCoexDm->psTdmaDuAdjType = 3; -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); + pCoexDm->psTdmaDuAdjType = 3; + } @@ -40684,27 +39459,29 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + n = 3; + result = 0; + WaitCount = 0; -+ } -+ else -+ { ++ } else { + /* accquire the BT TRx retry count from BT_Info byte2 */ + retryCount = pCoexSta->btRetryCnt; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], retryCount = %d\n", retryCount)); -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], up =%d, dn =%d, m =%d, n =%d, WaitCount =%d\n", -+ up, dn, m, n, WaitCount)); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_FW_DETAIL, ++ ( ++ "[BTCoex], up =%d, dn =%d, m =%d, n =%d, WaitCount =%d\n", ++ up, dn, m, n, WaitCount ++ ) ++ ); + result = 0; + WaitCount++; + -+ if (retryCount == 0) /* no retry in the last 2-second duration */ -+ { ++ if (retryCount == 0) { /* no retry in the last 2-second duration */ + up++; + dn--; + + if (dn <= 0) + dn = 0; + -+ if (up >= n) /* if 連續 n 個2秒 retry count為0, 則調寬WiFi duration */ -+ { ++ if (up >= n) { /* if 連續 n 個2秒 retry count為0, 則調寬WiFi duration */ + WaitCount = 0; + n = 3; + up = 0; @@ -40712,17 +39489,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + result = 1; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], Increase wifi duration!!\n")); + } -+ } -+ else if (retryCount <= 3) /* <=3 retry in the last 2-second duration */ -+ { ++ } else if (retryCount <= 3) { /* <=3 retry in the last 2-second duration */ + up--; + dn++; + + if (up <= 0) + up = 0; + -+ if (dn == 2) /* if 連續 2 個2秒 retry count< 3, 則調窄WiFi duration */ -+ { ++ if (dn == 2) { /* if 連續 2 個2秒 retry count< 3, 則調窄WiFi duration */ + if (WaitCount <= 2) + m++; /* 避免一直在兩個level中來回 */ + else @@ -40738,9 +39512,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + result = -1; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], Decrease wifi duration for retryCounter<3!!\n")); + } -+ } -+ else /* retry count > 3, 只要1次 retry count > 3, 則調窄WiFi duration */ -+ { ++ } else { /* retry count > 3, 只要1次 retry count > 3, 則調窄WiFi duration */ + if (WaitCount == 1) + m++; /* 避免一直在兩個level中來回 */ + else @@ -40758,687 +39530,443 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + } + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], max Interval = %d\n", maxInterval)); -+ if (maxInterval == 1) -+ { -+ if (bTxPause) -+ { ++ if (maxInterval == 1) { ++ if (bTxPause) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 1\n")); + -+ if (pCoexDm->curPsTdma == 71) -+ { ++ if (pCoexDm->curPsTdma == 71) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 5); + pCoexDm->psTdmaDuAdjType = 5; -+ } -+ else if (pCoexDm->curPsTdma == 1) -+ { ++ } else if (pCoexDm->curPsTdma == 1) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 5); + pCoexDm->psTdmaDuAdjType = 5; -+ } -+ else if (pCoexDm->curPsTdma == 2) -+ { ++ } else if (pCoexDm->curPsTdma == 2) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); + pCoexDm->psTdmaDuAdjType = 6; -+ } -+ else if (pCoexDm->curPsTdma == 3) -+ { ++ } else if (pCoexDm->curPsTdma == 3) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); + pCoexDm->psTdmaDuAdjType = 7; -+ } -+ else if (pCoexDm->curPsTdma == 4) -+ { ++ } else if (pCoexDm->curPsTdma == 4) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 8); + pCoexDm->psTdmaDuAdjType = 8; + } -+ if (pCoexDm->curPsTdma == 9) -+ { ++ ++ if (pCoexDm->curPsTdma == 9) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 13); + pCoexDm->psTdmaDuAdjType = 13; -+ } -+ else if (pCoexDm->curPsTdma == 10) -+ { ++ } else if (pCoexDm->curPsTdma == 10) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); + pCoexDm->psTdmaDuAdjType = 14; -+ } -+ else if (pCoexDm->curPsTdma == 11) -+ { ++ } else if (pCoexDm->curPsTdma == 11) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); + pCoexDm->psTdmaDuAdjType = 15; -+ } -+ else if (pCoexDm->curPsTdma == 12) -+ { ++ } else if (pCoexDm->curPsTdma == 12) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 16); + pCoexDm->psTdmaDuAdjType = 16; + } + -+ if (result == -1) -+ { -+ if (pCoexDm->curPsTdma == 5) -+ { ++ if (result == -1) { ++ if (pCoexDm->curPsTdma == 5) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); + pCoexDm->psTdmaDuAdjType = 6; -+ } -+ else if (pCoexDm->curPsTdma == 6) -+ { ++ } else if (pCoexDm->curPsTdma == 6) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); + pCoexDm->psTdmaDuAdjType = 7; -+ } -+ else if (pCoexDm->curPsTdma == 7) -+ { ++ } else if (pCoexDm->curPsTdma == 7) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 8); + pCoexDm->psTdmaDuAdjType = 8; -+ } -+ else if (pCoexDm->curPsTdma == 13) -+ { ++ } else if (pCoexDm->curPsTdma == 13) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); + pCoexDm->psTdmaDuAdjType = 14; -+ } -+ else if (pCoexDm->curPsTdma == 14) -+ { ++ } else if (pCoexDm->curPsTdma == 14) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); + pCoexDm->psTdmaDuAdjType = 15; -+ } -+ else if (pCoexDm->curPsTdma == 15) -+ { ++ } else if (pCoexDm->curPsTdma == 15) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 16); + pCoexDm->psTdmaDuAdjType = 16; + } -+ } -+ else if (result == 1) -+ { -+ if (pCoexDm->curPsTdma == 8) -+ { ++ } else if (result == 1) { ++ if (pCoexDm->curPsTdma == 8) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); + pCoexDm->psTdmaDuAdjType = 7; -+ } -+ else if (pCoexDm->curPsTdma == 7) -+ { ++ } else if (pCoexDm->curPsTdma == 7) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); + pCoexDm->psTdmaDuAdjType = 6; -+ } -+ else if (pCoexDm->curPsTdma == 6) -+ { ++ } else if (pCoexDm->curPsTdma == 6) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 5); + pCoexDm->psTdmaDuAdjType = 5; -+ } -+ else if (pCoexDm->curPsTdma == 16) -+ { ++ } else if (pCoexDm->curPsTdma == 16) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); + pCoexDm->psTdmaDuAdjType = 15; -+ } -+ else if (pCoexDm->curPsTdma == 15) -+ { ++ } else if (pCoexDm->curPsTdma == 15) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); + pCoexDm->psTdmaDuAdjType = 14; -+ } -+ else if (pCoexDm->curPsTdma == 14) -+ { ++ } else if (pCoexDm->curPsTdma == 14) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 13); + pCoexDm->psTdmaDuAdjType = 13; + } + } -+ } -+ else -+ { ++ } else { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 0\n")); -+ if (pCoexDm->curPsTdma == 5) -+ { ++ if (pCoexDm->curPsTdma == 5) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 71); + pCoexDm->psTdmaDuAdjType = 71; -+ } -+ else if (pCoexDm->curPsTdma == 6) -+ { ++ } else if (pCoexDm->curPsTdma == 6) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); + pCoexDm->psTdmaDuAdjType = 2; -+ } -+ else if (pCoexDm->curPsTdma == 7) -+ { ++ } else if (pCoexDm->curPsTdma == 7) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); + pCoexDm->psTdmaDuAdjType = 3; -+ } -+ else if (pCoexDm->curPsTdma == 8) -+ { ++ } else if (pCoexDm->curPsTdma == 8) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 4); + pCoexDm->psTdmaDuAdjType = 4; + } -+ if (pCoexDm->curPsTdma == 13) -+ { ++ ++ if (pCoexDm->curPsTdma == 13) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 9); + pCoexDm->psTdmaDuAdjType = 9; -+ } -+ else if (pCoexDm->curPsTdma == 14) -+ { ++ } else if (pCoexDm->curPsTdma == 14) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); + pCoexDm->psTdmaDuAdjType = 10; -+ } -+ else if (pCoexDm->curPsTdma == 15) -+ { ++ } else if (pCoexDm->curPsTdma == 15) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); + pCoexDm->psTdmaDuAdjType = 11; -+ } -+ else if (pCoexDm->curPsTdma == 16) -+ { ++ } else if (pCoexDm->curPsTdma == 16) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 12); + pCoexDm->psTdmaDuAdjType = 12; + } + -+ if (result == -1) -+ { -+ if (pCoexDm->curPsTdma == 71) -+ { ++ if (result == -1) { ++ if (pCoexDm->curPsTdma == 71) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 1); + pCoexDm->psTdmaDuAdjType = 1; -+ } -+ else if (pCoexDm->curPsTdma == 1) -+ { ++ } else if (pCoexDm->curPsTdma == 1) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); + pCoexDm->psTdmaDuAdjType = 2; -+ } -+ else if (pCoexDm->curPsTdma == 2) -+ { ++ } else if (pCoexDm->curPsTdma == 2) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); + pCoexDm->psTdmaDuAdjType = 3; -+ } -+ else if (pCoexDm->curPsTdma == 3) -+ { ++ } else if (pCoexDm->curPsTdma == 3) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 4); + pCoexDm->psTdmaDuAdjType = 4; -+ } -+ else if (pCoexDm->curPsTdma == 9) -+ { ++ } else if (pCoexDm->curPsTdma == 9) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); + pCoexDm->psTdmaDuAdjType = 10; -+ } -+ else if (pCoexDm->curPsTdma == 10) -+ { ++ } else if (pCoexDm->curPsTdma == 10) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); + pCoexDm->psTdmaDuAdjType = 11; -+ } -+ else if (pCoexDm->curPsTdma == 11) -+ { ++ } else if (pCoexDm->curPsTdma == 11) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 12); + pCoexDm->psTdmaDuAdjType = 12; + } -+ } -+ else if (result == 1) -+ { -+ if (pCoexDm->curPsTdma == 4) -+ { ++ } else if (result == 1) { ++ if (pCoexDm->curPsTdma == 4) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); + pCoexDm->psTdmaDuAdjType = 3; -+ } -+ else if (pCoexDm->curPsTdma == 3) -+ { ++ } else if (pCoexDm->curPsTdma == 3) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); + pCoexDm->psTdmaDuAdjType = 2; -+ } -+ else if (pCoexDm->curPsTdma == 2) -+ { ++ } else if (pCoexDm->curPsTdma == 2) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 1); + pCoexDm->psTdmaDuAdjType = 1; -+ } -+ else if (pCoexDm->curPsTdma == 1) -+ { ++ } else if (pCoexDm->curPsTdma == 1) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 71); + pCoexDm->psTdmaDuAdjType = 71; -+ } -+ else if (pCoexDm->curPsTdma == 12) -+ { ++ } else if (pCoexDm->curPsTdma == 12) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); + pCoexDm->psTdmaDuAdjType = 11; -+ } -+ else if (pCoexDm->curPsTdma == 11) -+ { ++ } else if (pCoexDm->curPsTdma == 11) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); + pCoexDm->psTdmaDuAdjType = 10; -+ } -+ else if (pCoexDm->curPsTdma == 10) -+ { ++ } else if (pCoexDm->curPsTdma == 10) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 9); + pCoexDm->psTdmaDuAdjType = 9; + } + } + } -+ } -+ else if (maxInterval == 2) -+ { -+ if (bTxPause) -+ { ++ } else if (maxInterval == 2) { ++ if (bTxPause) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 1\n")); -+ if (pCoexDm->curPsTdma == 1) -+ { ++ if (pCoexDm->curPsTdma == 1) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); + pCoexDm->psTdmaDuAdjType = 6; -+ } -+ else if (pCoexDm->curPsTdma == 2) -+ { ++ } else if (pCoexDm->curPsTdma == 2) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); + pCoexDm->psTdmaDuAdjType = 6; -+ } -+ else if (pCoexDm->curPsTdma == 3) -+ { ++ } else if (pCoexDm->curPsTdma == 3) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); + pCoexDm->psTdmaDuAdjType = 7; -+ } -+ else if (pCoexDm->curPsTdma == 4) -+ { ++ } else if (pCoexDm->curPsTdma == 4) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 8); + pCoexDm->psTdmaDuAdjType = 8; + } -+ if (pCoexDm->curPsTdma == 9) -+ { ++ ++ if (pCoexDm->curPsTdma == 9) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); + pCoexDm->psTdmaDuAdjType = 14; -+ } -+ else if (pCoexDm->curPsTdma == 10) -+ { ++ } else if (pCoexDm->curPsTdma == 10) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); + pCoexDm->psTdmaDuAdjType = 14; -+ } -+ else if (pCoexDm->curPsTdma == 11) -+ { ++ } else if (pCoexDm->curPsTdma == 11) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); + pCoexDm->psTdmaDuAdjType = 15; -+ } -+ else if (pCoexDm->curPsTdma == 12) -+ { ++ } else if (pCoexDm->curPsTdma == 12) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 16); + pCoexDm->psTdmaDuAdjType = 16; + } -+ if (result == -1) -+ { -+ if (pCoexDm->curPsTdma == 5) -+ { ++ ++ if (result == -1) { ++ if (pCoexDm->curPsTdma == 5) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); + pCoexDm->psTdmaDuAdjType = 6; -+ } -+ else if (pCoexDm->curPsTdma == 6) -+ { ++ } else if (pCoexDm->curPsTdma == 6) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); + pCoexDm->psTdmaDuAdjType = 7; -+ } -+ else if (pCoexDm->curPsTdma == 7) -+ { ++ } else if (pCoexDm->curPsTdma == 7) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 8); + pCoexDm->psTdmaDuAdjType = 8; -+ } -+ else if (pCoexDm->curPsTdma == 13) -+ { ++ } else if (pCoexDm->curPsTdma == 13) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); + pCoexDm->psTdmaDuAdjType = 14; -+ } -+ else if (pCoexDm->curPsTdma == 14) -+ { ++ } else if (pCoexDm->curPsTdma == 14) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); + pCoexDm->psTdmaDuAdjType = 15; -+ } -+ else if (pCoexDm->curPsTdma == 15) -+ { ++ } else if (pCoexDm->curPsTdma == 15) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 16); + pCoexDm->psTdmaDuAdjType = 16; + } -+ } -+ else if (result == 1) -+ { -+ if (pCoexDm->curPsTdma == 8) -+ { ++ } else if (result == 1) { ++ if (pCoexDm->curPsTdma == 8) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); + pCoexDm->psTdmaDuAdjType = 7; -+ } -+ else if (pCoexDm->curPsTdma == 7) -+ { ++ } else if (pCoexDm->curPsTdma == 7) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); + pCoexDm->psTdmaDuAdjType = 6; -+ } -+ else if (pCoexDm->curPsTdma == 6) -+ { ++ } else if (pCoexDm->curPsTdma == 6) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 6); + pCoexDm->psTdmaDuAdjType = 6; -+ } -+ else if (pCoexDm->curPsTdma == 16) -+ { ++ } else if (pCoexDm->curPsTdma == 16) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); + pCoexDm->psTdmaDuAdjType = 15; -+ } -+ else if (pCoexDm->curPsTdma == 15) -+ { ++ } else if (pCoexDm->curPsTdma == 15) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); + pCoexDm->psTdmaDuAdjType = 14; -+ } -+ else if (pCoexDm->curPsTdma == 14) -+ { ++ } else if (pCoexDm->curPsTdma == 14) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 14); + pCoexDm->psTdmaDuAdjType = 14; + } + } -+ } -+ else -+ { ++ } else { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 0\n")); -+ if (pCoexDm->curPsTdma == 5) -+ { ++ if (pCoexDm->curPsTdma == 5) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); + pCoexDm->psTdmaDuAdjType = 2; -+ } -+ else if (pCoexDm->curPsTdma == 6) -+ { ++ } else if (pCoexDm->curPsTdma == 6) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); + pCoexDm->psTdmaDuAdjType = 2; -+ } -+ else if (pCoexDm->curPsTdma == 7) -+ { ++ } else if (pCoexDm->curPsTdma == 7) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); + pCoexDm->psTdmaDuAdjType = 3; -+ } -+ else if (pCoexDm->curPsTdma == 8) -+ { ++ } else if (pCoexDm->curPsTdma == 8) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 4); + pCoexDm->psTdmaDuAdjType = 4; + } -+ if (pCoexDm->curPsTdma == 13) -+ { ++ ++ if (pCoexDm->curPsTdma == 13) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); + pCoexDm->psTdmaDuAdjType = 10; -+ } -+ else if (pCoexDm->curPsTdma == 14) -+ { ++ } else if (pCoexDm->curPsTdma == 14) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); + pCoexDm->psTdmaDuAdjType = 10; -+ } -+ else if (pCoexDm->curPsTdma == 15) -+ { ++ } else if (pCoexDm->curPsTdma == 15) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); + pCoexDm->psTdmaDuAdjType = 11; -+ } -+ else if (pCoexDm->curPsTdma == 16) -+ { ++ } else if (pCoexDm->curPsTdma == 16) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 12); + pCoexDm->psTdmaDuAdjType = 12; + } -+ if (result == -1) -+ { -+ if (pCoexDm->curPsTdma == 1) -+ { ++ ++ if (result == -1) { ++ if (pCoexDm->curPsTdma == 1) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); + pCoexDm->psTdmaDuAdjType = 2; -+ } -+ else if (pCoexDm->curPsTdma == 2) -+ { ++ } else if (pCoexDm->curPsTdma == 2) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); + pCoexDm->psTdmaDuAdjType = 3; -+ } -+ else if (pCoexDm->curPsTdma == 3) -+ { ++ } else if (pCoexDm->curPsTdma == 3) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 4); + pCoexDm->psTdmaDuAdjType = 4; -+ } -+ else if (pCoexDm->curPsTdma == 9) -+ { ++ } else if (pCoexDm->curPsTdma == 9) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); + pCoexDm->psTdmaDuAdjType = 10; -+ } -+ else if (pCoexDm->curPsTdma == 10) -+ { ++ } else if (pCoexDm->curPsTdma == 10) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); + pCoexDm->psTdmaDuAdjType = 11; -+ } -+ else if (pCoexDm->curPsTdma == 11) -+ { ++ } else if (pCoexDm->curPsTdma == 11) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 12); + pCoexDm->psTdmaDuAdjType = 12; + } -+ } -+ else if (result == 1) -+ { -+ if (pCoexDm->curPsTdma == 4) -+ { ++ } else if (result == 1) { ++ if (pCoexDm->curPsTdma == 4) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); + pCoexDm->psTdmaDuAdjType = 3; -+ } -+ else if (pCoexDm->curPsTdma == 3) -+ { ++ } else if (pCoexDm->curPsTdma == 3) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); + pCoexDm->psTdmaDuAdjType = 2; -+ } -+ else if (pCoexDm->curPsTdma == 2) -+ { ++ } else if (pCoexDm->curPsTdma == 2) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 2); + pCoexDm->psTdmaDuAdjType = 2; -+ } -+ else if (pCoexDm->curPsTdma == 12) -+ { ++ } else if (pCoexDm->curPsTdma == 12) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); + pCoexDm->psTdmaDuAdjType = 11; -+ } -+ else if (pCoexDm->curPsTdma == 11) -+ { ++ } else if (pCoexDm->curPsTdma == 11) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); + pCoexDm->psTdmaDuAdjType = 10; -+ } -+ else if (pCoexDm->curPsTdma == 10) -+ { ++ } else if (pCoexDm->curPsTdma == 10) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 10); + pCoexDm->psTdmaDuAdjType = 10; + } + } + } -+ } -+ else if (maxInterval == 3) -+ { -+ if (bTxPause) -+ { ++ } else if (maxInterval == 3) { ++ if (bTxPause) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 1\n")); -+ if (pCoexDm->curPsTdma == 1) -+ { ++ if (pCoexDm->curPsTdma == 1) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); + pCoexDm->psTdmaDuAdjType = 7; -+ } -+ else if (pCoexDm->curPsTdma == 2) -+ { ++ } else if (pCoexDm->curPsTdma == 2) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); + pCoexDm->psTdmaDuAdjType = 7; -+ } -+ else if (pCoexDm->curPsTdma == 3) -+ { ++ } else if (pCoexDm->curPsTdma == 3) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); + pCoexDm->psTdmaDuAdjType = 7; -+ } -+ else if (pCoexDm->curPsTdma == 4) -+ { ++ } else if (pCoexDm->curPsTdma == 4) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 8); + pCoexDm->psTdmaDuAdjType = 8; + } -+ if (pCoexDm->curPsTdma == 9) -+ { ++ ++ if (pCoexDm->curPsTdma == 9) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); + pCoexDm->psTdmaDuAdjType = 15; -+ } -+ else if (pCoexDm->curPsTdma == 10) -+ { ++ } else if (pCoexDm->curPsTdma == 10) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); + pCoexDm->psTdmaDuAdjType = 15; -+ } -+ else if (pCoexDm->curPsTdma == 11) -+ { ++ } else if (pCoexDm->curPsTdma == 11) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); + pCoexDm->psTdmaDuAdjType = 15; -+ } -+ else if (pCoexDm->curPsTdma == 12) -+ { ++ } else if (pCoexDm->curPsTdma == 12) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 16); + pCoexDm->psTdmaDuAdjType = 16; + } -+ if (result == -1) -+ { -+ if (pCoexDm->curPsTdma == 5) -+ { ++ ++ if (result == -1) { ++ if (pCoexDm->curPsTdma == 5) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); + pCoexDm->psTdmaDuAdjType = 7; -+ } -+ else if (pCoexDm->curPsTdma == 6) -+ { ++ } else if (pCoexDm->curPsTdma == 6) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); + pCoexDm->psTdmaDuAdjType = 7; -+ } -+ else if (pCoexDm->curPsTdma == 7) -+ { ++ } else if (pCoexDm->curPsTdma == 7) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 8); + pCoexDm->psTdmaDuAdjType = 8; -+ } -+ else if (pCoexDm->curPsTdma == 13) -+ { ++ } else if (pCoexDm->curPsTdma == 13) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); + pCoexDm->psTdmaDuAdjType = 15; -+ } -+ else if (pCoexDm->curPsTdma == 14) -+ { ++ } else if (pCoexDm->curPsTdma == 14) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); + pCoexDm->psTdmaDuAdjType = 15; -+ } -+ else if (pCoexDm->curPsTdma == 15) -+ { ++ } else if (pCoexDm->curPsTdma == 15) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 16); + pCoexDm->psTdmaDuAdjType = 16; + } -+ } -+ else if (result == 1) -+ { -+ if (pCoexDm->curPsTdma == 8) -+ { ++ } else if (result == 1) { ++ if (pCoexDm->curPsTdma == 8) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); + pCoexDm->psTdmaDuAdjType = 7; -+ } -+ else if (pCoexDm->curPsTdma == 7) -+ { ++ } else if (pCoexDm->curPsTdma == 7) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); + pCoexDm->psTdmaDuAdjType = 7; -+ } -+ else if (pCoexDm->curPsTdma == 6) -+ { ++ } else if (pCoexDm->curPsTdma == 6) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 7); + pCoexDm->psTdmaDuAdjType = 7; -+ } -+ else if (pCoexDm->curPsTdma == 16) -+ { ++ } else if (pCoexDm->curPsTdma == 16) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); + pCoexDm->psTdmaDuAdjType = 15; -+ } -+ else if (pCoexDm->curPsTdma == 15) -+ { ++ } else if (pCoexDm->curPsTdma == 15) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); + pCoexDm->psTdmaDuAdjType = 15; -+ } -+ else if (pCoexDm->curPsTdma == 14) -+ { ++ } else if (pCoexDm->curPsTdma == 14) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 15); + pCoexDm->psTdmaDuAdjType = 15; + } + } -+ } -+ else -+ { ++ } else { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], TxPause = 0\n")); -+ if (pCoexDm->curPsTdma == 5) -+ { ++ if (pCoexDm->curPsTdma == 5) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); + pCoexDm->psTdmaDuAdjType = 3; -+ } -+ else if (pCoexDm->curPsTdma == 6) -+ { ++ } else if (pCoexDm->curPsTdma == 6) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); + pCoexDm->psTdmaDuAdjType = 3; -+ } -+ else if (pCoexDm->curPsTdma == 7) -+ { ++ } else if (pCoexDm->curPsTdma == 7) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); + pCoexDm->psTdmaDuAdjType = 3; -+ } -+ else if (pCoexDm->curPsTdma == 8) -+ { ++ } else if (pCoexDm->curPsTdma == 8) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 4); + pCoexDm->psTdmaDuAdjType = 4; + } -+ if (pCoexDm->curPsTdma == 13) -+ { ++ ++ if (pCoexDm->curPsTdma == 13) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); + pCoexDm->psTdmaDuAdjType = 11; -+ } -+ else if (pCoexDm->curPsTdma == 14) -+ { ++ } else if (pCoexDm->curPsTdma == 14) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); + pCoexDm->psTdmaDuAdjType = 11; -+ } -+ else if (pCoexDm->curPsTdma == 15) -+ { ++ } else if (pCoexDm->curPsTdma == 15) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); + pCoexDm->psTdmaDuAdjType = 11; -+ } -+ else if (pCoexDm->curPsTdma == 16) -+ { ++ } else if (pCoexDm->curPsTdma == 16) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 12); + pCoexDm->psTdmaDuAdjType = 12; + } -+ if (result == -1) -+ { -+ if (pCoexDm->curPsTdma == 1) -+ { ++ ++ if (result == -1) { ++ if (pCoexDm->curPsTdma == 1) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); + pCoexDm->psTdmaDuAdjType = 3; -+ } -+ else if (pCoexDm->curPsTdma == 2) -+ { ++ } else if (pCoexDm->curPsTdma == 2) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); + pCoexDm->psTdmaDuAdjType = 3; -+ } -+ else if (pCoexDm->curPsTdma == 3) -+ { ++ } else if (pCoexDm->curPsTdma == 3) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 4); + pCoexDm->psTdmaDuAdjType = 4; -+ } -+ else if (pCoexDm->curPsTdma == 9) -+ { ++ } else if (pCoexDm->curPsTdma == 9) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); + pCoexDm->psTdmaDuAdjType = 11; -+ } -+ else if (pCoexDm->curPsTdma == 10) -+ { ++ } else if (pCoexDm->curPsTdma == 10) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); + pCoexDm->psTdmaDuAdjType = 11; -+ } -+ else if (pCoexDm->curPsTdma == 11) -+ { ++ } else if (pCoexDm->curPsTdma == 11) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 12); + pCoexDm->psTdmaDuAdjType = 12; + } -+ } -+ else if (result == 1) -+ { -+ if (pCoexDm->curPsTdma == 4) -+ { ++ } else if (result == 1) { ++ if (pCoexDm->curPsTdma == 4) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); + pCoexDm->psTdmaDuAdjType = 3; -+ } -+ else if (pCoexDm->curPsTdma == 3) -+ { ++ } else if (pCoexDm->curPsTdma == 3) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); + pCoexDm->psTdmaDuAdjType = 3; -+ } -+ else if (pCoexDm->curPsTdma == 2) -+ { ++ } else if (pCoexDm->curPsTdma == 2) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 3); + pCoexDm->psTdmaDuAdjType = 3; -+ } -+ else if (pCoexDm->curPsTdma == 12) -+ { ++ } else if (pCoexDm->curPsTdma == 12) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); + pCoexDm->psTdmaDuAdjType = 11; -+ } -+ else if (pCoexDm->curPsTdma == 11) -+ { ++ } else if (pCoexDm->curPsTdma == 11) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); + pCoexDm->psTdmaDuAdjType = 11; -+ } -+ else if (pCoexDm->curPsTdma == 10) -+ { ++ } else if (pCoexDm->curPsTdma == 10) { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 11); + pCoexDm->psTdmaDuAdjType = 11; + } @@ -41449,32 +39977,32 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + + /* if current PsTdma not match with the recorded one (when scan, dhcp...), */ + /* then we have to adjust it back to the previous record one. */ -+ if (pCoexDm->curPsTdma != pCoexDm->psTdmaDuAdjType) -+ { -+ bool bScan =false, bLink =false, bRoam =false; -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], PsTdma type dismatch!!!, curPsTdma =%d, recordPsTdma =%d\n", -+ pCoexDm->curPsTdma, pCoexDm->psTdmaDuAdjType)); ++ if (pCoexDm->curPsTdma != pCoexDm->psTdmaDuAdjType) { ++ bool bScan = false, bLink = false, bRoam = false; ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_FW_DETAIL, ++ ( ++ "[BTCoex], PsTdma type dismatch!!!, curPsTdma =%d, recordPsTdma =%d\n", ++ pCoexDm->curPsTdma, ++ pCoexDm->psTdmaDuAdjType ++ ) ++ ); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_SCAN, &bScan); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_LINK, &bLink); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_ROAM, &bRoam); + + if (!bScan && !bLink && !bRoam) -+ { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, pCoexDm->psTdmaDuAdjType); -+ } -+ else -+ { ++ else { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_DETAIL, ("[BTCoex], roaming/link/scan is under progress, will adjust next time!!!\n")); + } + } +} + +/* SCO only or SCO+PAN(HS) */ -+static void -+halbtc8723b2ant_ActionSco( -+PBTC_COEXIST pBtCoexist -+ ) ++static void halbtc8723b2ant_ActionSco(PBTC_COEXIST pBtCoexist) +{ + u8 wifiRssiState, btRssiState; + u32 wifiBw; @@ -41496,41 +40024,32 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); + + if (BTC_WIFI_BW_LEGACY == wifiBw) /* for SCO quality at 11b/g mode */ -+ { + halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 2); -+ } + else /* for SCO quality & wifi performance balance at 11n mode */ -+ { + halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 8); -+ } + + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, false, 0); /* for voice quality */ + + /* sw mechanism */ -+ if (BTC_WIFI_BW_HT40 == wifiBw) -+ { -+ if ((wifiRssiState == BTC_RSSI_STATE_HIGH) || -+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ if (BTC_WIFI_BW_HT40 == wifiBw) { ++ if ( ++ (wifiRssiState == BTC_RSSI_STATE_HIGH) || ++ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, true, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, true, 0x4); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, true, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, true, 0x4); + } -+ } -+ else -+ { -+ if ((wifiRssiState == BTC_RSSI_STATE_HIGH) || -+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ } else { ++ if ( ++ (wifiRssiState == BTC_RSSI_STATE_HIGH) || ++ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, true, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, true, 0x4); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, true, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, true, 0x4); + } @@ -41538,10 +40057,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b +} + + -+static void -+halbtc8723b2ant_ActionHid( -+PBTC_COEXIST pBtCoexist -+ ) ++static void halbtc8723b2ant_ActionHid(PBTC_COEXIST pBtCoexist) +{ + u8 wifiRssiState, btRssiState; + u32 wifiBw; @@ -41563,49 +40079,38 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); + + if (BTC_WIFI_BW_LEGACY == wifiBw) /* for HID at 11b/g mode */ -+ { + halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7); -+ } + else /* for HID quality & wifi performance balance at 11n mode */ -+ { + halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 9); -+ } + -+ if ((btRssiState == BTC_RSSI_STATE_HIGH) || -+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ if ( ++ (btRssiState == BTC_RSSI_STATE_HIGH) || ++ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 9); -+ } + else -+ { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 13); -+ } + + /* sw mechanism */ -+ if (BTC_WIFI_BW_HT40 == wifiBw) -+ { -+ if ((wifiRssiState == BTC_RSSI_STATE_HIGH) || -+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ if (BTC_WIFI_BW_HT40 == wifiBw) { ++ if ( ++ (wifiRssiState == BTC_RSSI_STATE_HIGH) || ++ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, true, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, false, 0x18); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, true, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + } -+ } -+ else -+ { -+ if ((wifiRssiState == BTC_RSSI_STATE_HIGH) || -+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ } else { ++ if ( ++ (wifiRssiState == BTC_RSSI_STATE_HIGH) || ++ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, true, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, false, 0x18); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, true, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + } @@ -41613,13 +40118,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b +} + +/* A2DP only / PAN(EDR) only/ A2DP+PAN(HS) */ -+static void -+halbtc8723b2ant_ActionA2dp( -+PBTC_COEXIST pBtCoexist -+ ) ++static void halbtc8723b2ant_ActionA2dp(PBTC_COEXIST pBtCoexist) +{ + u8 wifiRssiState, wifiRssiState1, btRssiState; -+ u32 wifiBw; ++ u32 wifiBw; + u8 apNum = 0; + + wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0); @@ -41629,8 +40131,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_AP_NUM, &apNum); + + /* define the office environment */ -+ if (apNum >= 10 && BTC_RSSI_HIGH(wifiRssiState1)) -+ { ++ if (apNum >= 10 && BTC_RSSI_HIGH(wifiRssiState1)) { + /* DbgPrint(" AP#>10(%d)\n", apNum); */ + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); + halbtc8723b2ant_LimitedRx(pBtCoexist, NORMAL_EXEC, false, false, 0x8); @@ -41641,13 +40142,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + + /* sw mechanism */ + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); -+ if (BTC_WIFI_BW_HT40 == wifiBw) -+ { ++ if (BTC_WIFI_BW_HT40 == wifiBw) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, true, 0x18); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, true, 0x18); + } @@ -41666,55 +40164,45 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + + halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7); + -+ if ((btRssiState == BTC_RSSI_STATE_HIGH) || -+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ if ( ++ (btRssiState == BTC_RSSI_STATE_HIGH) || ++ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) + halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, false, false, 1); -+ } + else -+ { + halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, false, true, 1); -+ } + + /* sw mechanism */ + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); -+ if (BTC_WIFI_BW_HT40 == wifiBw) -+ { -+ if ((wifiRssiState == BTC_RSSI_STATE_HIGH) || -+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ if (BTC_WIFI_BW_HT40 == wifiBw) { ++ if ( ++ (wifiRssiState == BTC_RSSI_STATE_HIGH) || ++ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, false, 0x18); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + } -+ } -+ else -+ { -+ if ((wifiRssiState == BTC_RSSI_STATE_HIGH) || -+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ } else { ++ if ( ++ (wifiRssiState == BTC_RSSI_STATE_HIGH) || ++ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, false, 0x18); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + } + } +} + -+static void -+halbtc8723b2ant_ActionA2dpPanHs( -+PBTC_COEXIST pBtCoexist -+ ) ++static void halbtc8723b2ant_ActionA2dpPanHs(PBTC_COEXIST pBtCoexist) +{ + u8 wifiRssiState, btRssiState; -+ u32 wifiBw; ++ u32 wifiBw; + + wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0); + btRssiState = halbtc8723b2ant_BtRssiState(2, 29, 0); @@ -41736,43 +40224,35 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + + /* sw mechanism */ + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); -+ if (BTC_WIFI_BW_HT40 == wifiBw) -+ { -+ if ((wifiRssiState == BTC_RSSI_STATE_HIGH) || -+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ if (BTC_WIFI_BW_HT40 == wifiBw) { ++ if ( ++ (wifiRssiState == BTC_RSSI_STATE_HIGH) || ++ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, false, 0x18); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + } -+ } -+ else -+ { -+ if ((wifiRssiState == BTC_RSSI_STATE_HIGH) || -+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ } else { ++ if ( ++ (wifiRssiState == BTC_RSSI_STATE_HIGH) || ++ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, false, 0x18); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + } + } +} + -+static void -+halbtc8723b2ant_ActionPanEdr( -+PBTC_COEXIST pBtCoexist -+ ) ++static void halbtc8723b2ant_ActionPanEdr(PBTC_COEXIST pBtCoexist) +{ + u8 wifiRssiState, btRssiState; -+ u32 wifiBw; ++ u32 wifiBw; + + wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0); + btRssiState = halbtc8723b2ant_BtRssiState(2, 29, 0); @@ -41790,42 +40270,35 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + + halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 10); + -+ if ((btRssiState == BTC_RSSI_STATE_HIGH) || -+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ if ( ++ (btRssiState == BTC_RSSI_STATE_HIGH) || ++ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 1); -+ } + else -+ { + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, true, 5); -+ } + + /* sw mechanism */ + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); -+ if (BTC_WIFI_BW_HT40 == wifiBw) -+ { -+ if ((wifiRssiState == BTC_RSSI_STATE_HIGH) || -+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ if (BTC_WIFI_BW_HT40 == wifiBw) { ++ if ( ++ (wifiRssiState == BTC_RSSI_STATE_HIGH) || ++ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, false, 0x18); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + } -+ } -+ else -+ { -+ if ((wifiRssiState == BTC_RSSI_STATE_HIGH) || -+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ } else { ++ if ( ++ (wifiRssiState == BTC_RSSI_STATE_HIGH) || ++ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, false, 0x18); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + } @@ -41834,13 +40307,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + + +/* PAN(HS) only */ -+static void -+halbtc8723b2ant_ActionPanHs( -+PBTC_COEXIST pBtCoexist -+ ) ++static void halbtc8723b2ant_ActionPanHs(PBTC_COEXIST pBtCoexist) +{ + u8 wifiRssiState, btRssiState; -+ u32 wifiBw; ++ u32 wifiBw; + + wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0); + btRssiState = halbtc8723b2ant_BtRssiState(2, 29, 0); @@ -41861,30 +40331,25 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + halbtc8723b2ant_PsTdma(pBtCoexist, NORMAL_EXEC, false, 1); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); -+ if (BTC_WIFI_BW_HT40 == wifiBw) -+ { -+ if ((wifiRssiState == BTC_RSSI_STATE_HIGH) || -+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ if (BTC_WIFI_BW_HT40 == wifiBw) { ++ if ( ++ (wifiRssiState == BTC_RSSI_STATE_HIGH) || ++ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, false, 0x18); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + } -+ } -+ else -+ { -+ if ((wifiRssiState == BTC_RSSI_STATE_HIGH) || -+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ } else { ++ if ( ++ (wifiRssiState == BTC_RSSI_STATE_HIGH) || ++ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, false, 0x18); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + } @@ -41892,13 +40357,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b +} + +/* PAN(EDR)+A2DP */ -+static void -+halbtc8723b2ant_ActionPanEdrA2dp( -+PBTC_COEXIST pBtCoexist -+ ) ++static void halbtc8723b2ant_ActionPanEdrA2dp(PBTC_COEXIST pBtCoexist) +{ + u8 wifiRssiState, btRssiState; -+ u32 wifiBw; ++ u32 wifiBw; + + wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0); + btRssiState = halbtc8723b2ant_BtRssiState(2, 29, 0); @@ -41916,59 +40378,50 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); + -+ if ((btRssiState == BTC_RSSI_STATE_HIGH) || -+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ if ( ++ (btRssiState == BTC_RSSI_STATE_HIGH) || ++ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 12); + if (BTC_WIFI_BW_HT40 == wifiBw) + halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, false, true, 3); + else + halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, false, false, 3); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7); + halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, false, true, 3); + } + + /* sw mechanism */ -+ if (BTC_WIFI_BW_HT40 == wifiBw) -+ { -+ if ((wifiRssiState == BTC_RSSI_STATE_HIGH) || -+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ if (BTC_WIFI_BW_HT40 == wifiBw) { ++ if ( ++ (wifiRssiState == BTC_RSSI_STATE_HIGH) || ++ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, false, 0x18); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + } -+ } -+ else -+ { -+ if ((wifiRssiState == BTC_RSSI_STATE_HIGH) || -+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ } else { ++ if ( ++ (wifiRssiState == BTC_RSSI_STATE_HIGH) || ++ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, false, 0x18); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, false, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + } + } +} + -+static void -+halbtc8723b2ant_ActionPanEdrHid( -+PBTC_COEXIST pBtCoexist -+ ) ++static void halbtc8723b2ant_ActionPanEdrHid(PBTC_COEXIST pBtCoexist) +{ + u8 wifiRssiState, btRssiState; -+ u32 wifiBw; ++ u32 wifiBw; + + wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0); + btRssiState = halbtc8723b2ant_BtRssiState(2, 29, 0); @@ -41981,25 +40434,21 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + else + halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0); + -+ if ((btRssiState == BTC_RSSI_STATE_HIGH) || -+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { -+ if (BTC_WIFI_BW_HT40 == wifiBw) -+ { ++ if ( ++ (btRssiState == BTC_RSSI_STATE_HIGH) || ++ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { ++ if (BTC_WIFI_BW_HT40 == wifiBw) { + halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 3); + halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 11); + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x780); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6); + halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7); + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); + } + halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, true, false, 2); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6); + halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 11); + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x0); @@ -42007,30 +40456,25 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + } + + /* sw mechanism */ -+ if (BTC_WIFI_BW_HT40 == wifiBw) -+ { -+ if ((wifiRssiState == BTC_RSSI_STATE_HIGH) || -+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ if (BTC_WIFI_BW_HT40 == wifiBw) { ++ if ( ++ (wifiRssiState == BTC_RSSI_STATE_HIGH) || ++ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, true, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, false, 0x18); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, true, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + } -+ } -+ else -+ { -+ if ((wifiRssiState == BTC_RSSI_STATE_HIGH) || -+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ } else { ++ if ( ++ (wifiRssiState == BTC_RSSI_STATE_HIGH) || ++ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, true, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, false, 0x18); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, true, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + } @@ -42038,13 +40482,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b +} + +/* HID+A2DP+PAN(EDR) */ -+static void -+halbtc8723b2ant_ActionHidA2dpPanEdr( -+PBTC_COEXIST pBtCoexist -+ ) ++static void halbtc8723b2ant_ActionHidA2dpPanEdr(PBTC_COEXIST pBtCoexist) +{ + u8 wifiRssiState, btRssiState; -+ u32 wifiBw; ++ u32 wifiBw; + + wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0); + btRssiState = halbtc8723b2ant_BtRssiState(2, 29, 0); @@ -42064,57 +40505,47 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + + halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7); + -+ if ((btRssiState == BTC_RSSI_STATE_HIGH) || -+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ if ( ++ (btRssiState == BTC_RSSI_STATE_HIGH) || ++ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + if (BTC_WIFI_BW_HT40 == wifiBw) + halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, true, true, 2); + else + halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, true, false, 3); -+ } -+ else -+ { ++ } else + halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, true, true, 3); -+ } + + /* sw mechanism */ -+ if (BTC_WIFI_BW_HT40 == wifiBw) -+ { -+ if ((wifiRssiState == BTC_RSSI_STATE_HIGH) || -+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ if (BTC_WIFI_BW_HT40 == wifiBw) { ++ if ( ++ (wifiRssiState == BTC_RSSI_STATE_HIGH) || ++ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, true, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, false, 0x18); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, true, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + } -+ } -+ else -+ { -+ if ((wifiRssiState == BTC_RSSI_STATE_HIGH) || -+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ } else { ++ if ( ++ (wifiRssiState == BTC_RSSI_STATE_HIGH) || ++ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, true, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, false, 0x18); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, true, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + } + } +} + -+static void -+halbtc8723b2ant_ActionHidA2dp( -+PBTC_COEXIST pBtCoexist -+ ) ++static void halbtc8723b2ant_ActionHidA2dp(PBTC_COEXIST pBtCoexist) +{ + u8 wifiRssiState, btRssiState; -+ u32 wifiBw; ++ u32 wifiBw; + u8 apNum = 0; + + wifiRssiState = halbtc8723b2ant_WifiRssiState(pBtCoexist, 0, 2, 15, 0); @@ -42128,27 +40559,23 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + halbtc8723b2ant_FwDacSwingLvl(pBtCoexist, NORMAL_EXEC, 6); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); -+ if (BTC_WIFI_BW_LEGACY == wifiBw) -+ { ++ if (BTC_WIFI_BW_LEGACY == wifiBw) { + if (BTC_RSSI_HIGH(btRssiState)) + halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2); + else if (BTC_RSSI_MEDIUM(btRssiState)) + halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2); -+ else ++ else + halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0); -+ } -+ else -+ { /* only 802.11N mode we have to dec bt power to 4 degree */ -+ if (BTC_RSSI_HIGH(btRssiState)) -+ { ++ } else { ++ /* only 802.11N mode we have to dec bt power to 4 degree */ ++ if (BTC_RSSI_HIGH(btRssiState)) { + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_AP_NUM, &apNum); + /* need to check ap Number of Not */ + if (apNum < 10) + halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 4); + else + halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2); -+ } -+ else if (BTC_RSSI_MEDIUM(btRssiState)) ++ } else if (BTC_RSSI_MEDIUM(btRssiState)) + halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 2); + else + halbtc8723b2ant_DecBtPwr(pBtCoexist, NORMAL_EXEC, 0); @@ -42156,79 +40583,63 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + + halbtc8723b2ant_CoexTableWithType(pBtCoexist, NORMAL_EXEC, 7); + -+ if ((btRssiState == BTC_RSSI_STATE_HIGH) || -+ (btRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ if ( ++ (btRssiState == BTC_RSSI_STATE_HIGH) || ++ (btRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) + halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, true, false, 2); -+ } + else -+ { + halbtc8723b2ant_TdmaDurationAdjust(pBtCoexist, true, true, 2); -+ } + + /* sw mechanism */ -+ if (BTC_WIFI_BW_HT40 == wifiBw) -+ { -+ if ((wifiRssiState == BTC_RSSI_STATE_HIGH) || -+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ if (BTC_WIFI_BW_HT40 == wifiBw) { ++ if ( ++ (wifiRssiState == BTC_RSSI_STATE_HIGH) || ++ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, true, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, false, 0x18); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, true, true, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + } -+ } -+ else -+ { -+ if ((wifiRssiState == BTC_RSSI_STATE_HIGH) || -+ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH)) -+ { ++ } else { ++ if ( ++ (wifiRssiState == BTC_RSSI_STATE_HIGH) || ++ (wifiRssiState == BTC_RSSI_STATE_STAY_HIGH) ++ ) { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, true, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, true, false, false, 0x18); -+ } -+ else -+ { ++ } else { + halbtc8723b2ant_SwMechanism1(pBtCoexist, false, true, false, false); + halbtc8723b2ant_SwMechanism2(pBtCoexist, false, false, false, 0x18); + } + } +} + -+static void -+halbtc8723b2ant_RunCoexistMechanism( -+PBTC_COEXIST pBtCoexist -+ ) ++static void halbtc8723b2ant_RunCoexistMechanism(PBTC_COEXIST pBtCoexist) +{ -+ u8 algorithm = 0; ++ u8 algorithm = 0; + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism() ===>\n")); + -+ if (pBtCoexist->bManualControl) -+ { ++ if (pBtCoexist->bManualControl) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], RunCoexistMechanism(), return for Manual CTRL <===\n")); + return; + } + -+ if (pCoexSta->bUnderIps) -+ { ++ if (pCoexSta->bUnderIps) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], wifi is under IPS !!!\n")); + return; + } + + algorithm = halbtc8723b2ant_ActionAlgorithm(pBtCoexist); -+ if (pCoexSta->bC2hBtInquiryPage && (BT_8723B_2ANT_COEX_ALGO_PANHS!=algorithm)) -+ { ++ if (pCoexSta->bC2hBtInquiryPage && (BT_8723B_2ANT_COEX_ALGO_PANHS != algorithm)) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT is under inquiry/page scan !!\n")); + halbtc8723b2ant_ActionBtInquiry(pBtCoexist); + return; -+ } -+ else -+ { -+ if (pCoexDm->bNeedRecover0x948) -+ { ++ } else { ++ if (pCoexDm->bNeedRecover0x948) { + pCoexDm->bNeedRecover0x948 = false; + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, pCoexDm->backup0x948); + } @@ -42237,77 +40648,78 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pCoexDm->curAlgorithm = algorithm; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Algorithm = %d\n", pCoexDm->curAlgorithm)); + -+ if (halbtc8723b2ant_IsCommonAction(pBtCoexist)) -+ { ++ if (halbtc8723b2ant_IsCommonAction(pBtCoexist)) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant common.\n")); + pCoexDm->bAutoTdmaAdjust = false; -+ } -+ else -+ { -+ if (pCoexDm->curAlgorithm != pCoexDm->preAlgorithm) -+ { -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], preAlgorithm =%d, curAlgorithm =%d\n", -+ pCoexDm->preAlgorithm, pCoexDm->curAlgorithm)); ++ } else { ++ if (pCoexDm->curAlgorithm != pCoexDm->preAlgorithm) { ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE, ++ ( ++ "[BTCoex], preAlgorithm =%d, curAlgorithm =%d\n", ++ pCoexDm->preAlgorithm, ++ pCoexDm->curAlgorithm ++ ) ++ ); + pCoexDm->bAutoTdmaAdjust = false; + } -+ switch (pCoexDm->curAlgorithm) -+ { -+ case BT_8723B_2ANT_COEX_ALGO_SCO: -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO.\n")); -+ halbtc8723b2ant_ActionSco(pBtCoexist); -+ break; -+ case BT_8723B_2ANT_COEX_ALGO_HID: -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID.\n")); -+ halbtc8723b2ant_ActionHid(pBtCoexist); -+ break; -+ case BT_8723B_2ANT_COEX_ALGO_A2DP: -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP.\n")); -+ halbtc8723b2ant_ActionA2dp(pBtCoexist); -+ break; -+ case BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS: -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP+PAN(HS).\n")); -+ halbtc8723b2ant_ActionA2dpPanHs(pBtCoexist); -+ break; -+ case BT_8723B_2ANT_COEX_ALGO_PANEDR: -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR).\n")); -+ halbtc8723b2ant_ActionPanEdr(pBtCoexist); -+ break; -+ case BT_8723B_2ANT_COEX_ALGO_PANHS: -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HS mode.\n")); -+ halbtc8723b2ant_ActionPanHs(pBtCoexist); -+ break; -+ case BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP: -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP.\n")); -+ halbtc8723b2ant_ActionPanEdrA2dp(pBtCoexist); -+ break; -+ case BT_8723B_2ANT_COEX_ALGO_PANEDR_HID: -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID.\n")); -+ halbtc8723b2ant_ActionPanEdrHid(pBtCoexist); -+ break; -+ case BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR: -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN.\n")); -+ halbtc8723b2ant_ActionHidA2dpPanEdr(pBtCoexist); -+ break; -+ case BT_8723B_2ANT_COEX_ALGO_HID_A2DP: -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP.\n")); -+ halbtc8723b2ant_ActionHidA2dp(pBtCoexist); -+ break; -+ default: -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = coexist All Off!!\n")); -+ halbtc8723b2ant_CoexAllOff(pBtCoexist); -+ break; ++ ++ ++ switch (pCoexDm->curAlgorithm) { ++ case BT_8723B_2ANT_COEX_ALGO_SCO: ++ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = SCO.\n")); ++ halbtc8723b2ant_ActionSco(pBtCoexist); ++ break; ++ case BT_8723B_2ANT_COEX_ALGO_HID: ++ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID.\n")); ++ halbtc8723b2ant_ActionHid(pBtCoexist); ++ break; ++ case BT_8723B_2ANT_COEX_ALGO_A2DP: ++ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP.\n")); ++ halbtc8723b2ant_ActionA2dp(pBtCoexist); ++ break; ++ case BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS: ++ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = A2DP+PAN(HS).\n")); ++ halbtc8723b2ant_ActionA2dpPanHs(pBtCoexist); ++ break; ++ case BT_8723B_2ANT_COEX_ALGO_PANEDR: ++ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR).\n")); ++ halbtc8723b2ant_ActionPanEdr(pBtCoexist); ++ break; ++ case BT_8723B_2ANT_COEX_ALGO_PANHS: ++ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HS mode.\n")); ++ halbtc8723b2ant_ActionPanHs(pBtCoexist); ++ break; ++ case BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP: ++ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN+A2DP.\n")); ++ halbtc8723b2ant_ActionPanEdrA2dp(pBtCoexist); ++ break; ++ case BT_8723B_2ANT_COEX_ALGO_PANEDR_HID: ++ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = PAN(EDR)+HID.\n")); ++ halbtc8723b2ant_ActionPanEdrHid(pBtCoexist); ++ break; ++ case BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR: ++ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP+PAN.\n")); ++ halbtc8723b2ant_ActionHidA2dpPanEdr(pBtCoexist); ++ break; ++ case BT_8723B_2ANT_COEX_ALGO_HID_A2DP: ++ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = HID+A2DP.\n")); ++ halbtc8723b2ant_ActionHidA2dp(pBtCoexist); ++ break; ++ default: ++ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Action 2-Ant, algorithm = coexist All Off!!\n")); ++ halbtc8723b2ant_CoexAllOff(pBtCoexist); ++ break; + } + pCoexDm->preAlgorithm = pCoexDm->curAlgorithm; + } +} + -+static void -+halbtc8723b2ant_WifiOffHwCfg( -+PBTC_COEXIST pBtCoexist -+ ) ++static void halbtc8723b2ant_WifiOffHwCfg(PBTC_COEXIST pBtCoexist) +{ -+ bool bIsInMpMode = false; -+ u8 H2C_Parameter[2] ={0}; ++ bool bIsInMpMode = false; ++ u8 H2C_Parameter[2] = {0}; + u32 fwVer = 0; + + /* set wlan_act to low */ @@ -42315,16 +40727,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + + pBtCoexist->fBtcSetRfReg(pBtCoexist, BTC_RF_A, 0x1, 0xfffff, 0x780); /* WiFi goto standby while GNT_BT 0-->1 */ + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_FW_VER, &fwVer); -+ if (fwVer >= 0x180000) -+ { -+ /* Use H2C to set GNT_BT to HIGH */ -+ H2C_Parameter[0] = 1; -+ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x6E, 1, H2C_Parameter); -+ } -+ else -+ { ++ if (fwVer >= 0x180000) { ++ /* Use H2C to set GNT_BT to HIGH */ ++ H2C_Parameter[0] = 1; ++ pBtCoexist->fBtcFillH2c(pBtCoexist, 0x6E, 1, H2C_Parameter); ++ } else + pBtCoexist->fBtcWrite1Byte(pBtCoexist, 0x765, 0x18); -+ } + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_IS_IN_MP_MODE, &bIsInMpMode); + if (!bIsInMpMode) @@ -42333,11 +40741,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pBtCoexist->fBtcWrite1ByteBitMask(pBtCoexist, 0x67, 0x20, 0x1); /* BT select s0/s1 is controlled by WiFi */ +} + -+static void -+halbtc8723b2ant_InitHwConfig( -+PBTC_COEXIST pBtCoexist, -+bool bBackUp -+ ) ++static void halbtc8723b2ant_InitHwConfig(PBTC_COEXIST pBtCoexist, bool bBackUp) +{ + u8 u1Tmp = 0; + @@ -42371,12 +40775,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b +/* */ +/* extern function start with EXhalbtc8723b2ant_ */ +/* */ -+void -+EXhalbtc8723b2ant_PowerOnSetting( -+PBTC_COEXIST pBtCoexist -+ ) ++void EXhalbtc8723b2ant_PowerOnSetting(PBTC_COEXIST pBtCoexist) +{ -+ PBTC_BOARD_INFO pBoardInfo =&pBtCoexist->boardInfo; ++ PBTC_BOARD_INFO pBoardInfo = &pBtCoexist->boardInfo; + u8 u1Tmp = 0x4; /* Set BIT2 by default since it's 2ant case */ + u16 u2Tmp = 0x0; + @@ -42398,8 +40799,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + /* BIT1: "0" for internal switch; "1" for external switch */ + /* BIT2: "0" for one antenna; "1" for two antenna */ + /* NOTE: here default all internal switch and 1-antenna ==> BIT1 = 0 and BIT2 = 0 */ -+ if (pBtCoexist->chipInterface == BTC_INTF_USB) -+ { ++ if (pBtCoexist->chipInterface == BTC_INTF_USB) { + /* fixed at S0 for USB interface */ + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x0); + @@ -42407,18 +40807,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pBtCoexist->fBtcWriteLocalReg1Byte(pBtCoexist, 0xfe08, u1Tmp); + + pBoardInfo->btdmAntPos = BTC_ANTENNA_AT_AUX_PORT; -+ } -+ else -+ { ++ } else { + /* for PCIE and SDIO interface, we check efuse 0xc3[6] */ -+ if (pBoardInfo->singleAntPath == 0) -+ { ++ if (pBoardInfo->singleAntPath == 0) { + /* set to S1 */ + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x280); + pBoardInfo->btdmAntPos = BTC_ANTENNA_AT_MAIN_PORT; -+ } -+ else if (pBoardInfo->singleAntPath == 1) -+ { ++ } else if (pBoardInfo->singleAntPath == 1) { + /* set to S0 */ + pBtCoexist->fBtcWrite4Byte(pBtCoexist, 0x948, 0x0); + u1Tmp |= 0x1; /* antenna inverse */ @@ -42426,71 +40821,66 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + } + + if (pBtCoexist->chipInterface == BTC_INTF_PCI) -+ { + pBtCoexist->fBtcWriteLocalReg1Byte(pBtCoexist, 0x384, u1Tmp); -+ } + else if (pBtCoexist->chipInterface == BTC_INTF_SDIO) -+ { + pBtCoexist->fBtcWriteLocalReg1Byte(pBtCoexist, 0x60, u1Tmp); -+ } + } +} + -+void -+EXhalbtc8723b2ant_InitHwConfig( -+PBTC_COEXIST pBtCoexist, -+bool bWifiOnly -+ ) ++void EXhalbtc8723b2ant_InitHwConfig(PBTC_COEXIST pBtCoexist, bool bWifiOnly) +{ + halbtc8723b2ant_InitHwConfig(pBtCoexist, true); +} + -+void -+EXhalbtc8723b2ant_InitCoexDm( -+PBTC_COEXIST pBtCoexist -+ ) ++void EXhalbtc8723b2ant_InitCoexDm(PBTC_COEXIST pBtCoexist) +{ + BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], Coex Mechanism Init!!\n")); + + halbtc8723b2ant_InitCoexDm(pBtCoexist); +} + -+void -+EXhalbtc8723b2ant_DisplayCoexInfo( -+PBTC_COEXIST pBtCoexist -+ ) ++void EXhalbtc8723b2ant_DisplayCoexInfo(PBTC_COEXIST pBtCoexist) +{ -+ PBTC_BOARD_INFO pBoardInfo =&pBtCoexist->boardInfo; -+ PBTC_STACK_INFO pStackInfo =&pBtCoexist->stackInfo; -+ PBTC_BT_LINK_INFO pBtLinkInfo =&pBtCoexist->btLinkInfo; -+ u8 * cliBuf =pBtCoexist->cliBuf; -+ u8 u1Tmp[4], i, btInfoExt, psTdmaCase = 0; -+ u32 u4Tmp[4]; -+ bool bRoam =false, bScan =false, bLink =false, bWifiUnder5G =false; -+ bool bBtHsOn =false, bWifiBusy =false; -+ s32 wifiRssi = 0, btHsRssi = 0; -+ u32 wifiBw, wifiTrafficDir, faOfdm, faCck; -+ u8 wifiDot11Chnl, wifiHsChnl; -+ u32 fwVer = 0, btPatchVer = 0; -+ u8 apNum = 0; ++ PBTC_BOARD_INFO pBoardInfo = &pBtCoexist->boardInfo; ++ PBTC_STACK_INFO pStackInfo = &pBtCoexist->stackInfo; ++ PBTC_BT_LINK_INFO pBtLinkInfo = &pBtCoexist->btLinkInfo; ++ u8 *cliBuf = pBtCoexist->cliBuf; ++ u8 u1Tmp[4], i, btInfoExt, psTdmaCase = 0; ++ u32 u4Tmp[4]; ++ bool bRoam = false, bScan = false, bLink = false, bWifiUnder5G = false; ++ bool bBtHsOn = false, bWifiBusy = false; ++ s32 wifiRssi = 0, btHsRssi = 0; ++ u32 wifiBw, wifiTrafficDir, faOfdm, faCck; ++ u8 wifiDot11Chnl, wifiHsChnl; ++ u32 fwVer = 0, btPatchVer = 0; ++ u8 apNum = 0; + + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[BT Coexist info]============"); + CL_PRINTF(cliBuf); + -+ if (pBtCoexist->bManualControl) -+ { ++ if (pBtCoexist->bManualControl) { + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n ============[Under Manual Control]============"); + CL_PRINTF(cliBuf); + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n =========================================="); + CL_PRINTF(cliBuf); + } + -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:", \ -+ pBoardInfo->pgAntNum, pBoardInfo->btdmAntNum); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = %d/ %d ", "Ant PG number/ Ant mechanism:", \ ++ pBoardInfo->pgAntNum, ++ pBoardInfo->btdmAntNum ++ ); + CL_PRINTF(cliBuf); + -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s / %d", "BT stack/ hci ext ver", \ -+ ((pStackInfo->bProfileNotified)? "Yes":"No"), pStackInfo->hciVersion); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = %s / %d", "BT stack/ hci ext ver", \ ++ (pStackInfo->bProfileNotified ? "Yes" : "No"), ++ pStackInfo->hciVersion ++ ); + CL_PRINTF(cliBuf); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_BT_PATCH_VER, &btPatchVer); @@ -42502,82 +40892,153 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_HS_OPERATION, &bBtHsOn); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_WIFI_DOT11_CHNL, &wifiDot11Chnl); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_WIFI_HS_CHNL, &wifiHsChnl); -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d(%d)", "Dot11 channel / HsChnl(HsMode)", \ -+ wifiDot11Chnl, wifiHsChnl, bBtHsOn); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = %d / %d(%d)", "Dot11 channel / HsChnl(HsMode)", \ ++ wifiDot11Chnl, ++ wifiHsChnl, ++ bBtHsOn ++ ); + CL_PRINTF(cliBuf); + -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x ", "H2C Wifi inform bt chnl Info", \ -+ pCoexDm->wifiChnlInfo[0], pCoexDm->wifiChnlInfo[1], -+ pCoexDm->wifiChnlInfo[2]); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = %02x %02x %02x ", "H2C Wifi inform bt chnl Info", \ ++ pCoexDm->wifiChnlInfo[0], ++ pCoexDm->wifiChnlInfo[1], ++ pCoexDm->wifiChnlInfo[2] ++ ); + CL_PRINTF(cliBuf); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_WIFI_RSSI, &wifiRssi); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_S4_HS_RSSI, &btHsRssi); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_AP_NUM, &apNum); -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d", "Wifi rssi/ HS rssi/ AP#", \ -+ wifiRssi, btHsRssi, apNum); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = %d/ %d/ %d", "Wifi rssi/ HS rssi/ AP#", \ ++ wifiRssi, ++ btHsRssi, ++ apNum ++ ); + CL_PRINTF(cliBuf); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_SCAN, &bScan); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_LINK, &bLink); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_ROAM, &bRoam); -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d ", "Wifi bLink/ bRoam/ bScan", \ -+ bLink, bRoam, bScan); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = %d/ %d/ %d ", "Wifi bLink/ bRoam/ bScan", \ ++ bLink, ++ bRoam, ++ bScan ++ ); + CL_PRINTF(cliBuf); + + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_UNDER_5G, &bWifiUnder5G); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_BUSY, &bWifiBusy); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION, &wifiTrafficDir); -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s / %s/ %s ", "Wifi status", \ -+ (bWifiUnder5G? "5G":"2.4G"), -+ ((BTC_WIFI_BW_LEGACY ==wifiBw)? "Legacy": (((BTC_WIFI_BW_HT40 ==wifiBw)? "HT40":"HT20"))), -+ ((!bWifiBusy)? "idle": ((BTC_WIFI_TRAFFIC_TX ==wifiTrafficDir)? "uplink":"downlink"))); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = %s / %s/ %s ", "Wifi status", \ ++ (bWifiUnder5G ? "5G" : "2.4G"), ++ ((BTC_WIFI_BW_LEGACY == wifiBw) ? "Legacy" : (((BTC_WIFI_BW_HT40 == wifiBw) ? "HT40" : "HT20"))), ++ ((!bWifiBusy) ? "idle" : ((BTC_WIFI_TRAFFIC_TX == wifiTrafficDir) ? "uplink" : "downlink")) ++ ); + CL_PRINTF(cliBuf); + -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = [%s/ %d/ %d] ", "BT [status/ rssi/ retryCnt]", \ -+ ((pBtCoexist->btInfo.bBtDisabled)? ("disabled"): ((pCoexSta->bC2hBtInquiryPage)?("inquiry/page scan"):((BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus)? "non-connected idle": -+ ((BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus)? "connected-idle":"busy")))), -+ pCoexSta->btRssi, pCoexSta->btRetryCnt); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = [%s/ %d/ %d] ", "BT [status/ rssi/ retryCnt]", \ ++ ((pBtCoexist->btInfo.bBtDisabled) ? ("disabled") : ((pCoexSta->bC2hBtInquiryPage) ? ("inquiry/page scan") : ((BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE == pCoexDm->btStatus) ? "non-connected idle" : ++ ((BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE == pCoexDm->btStatus) ? "connected-idle" : "busy")))), ++ pCoexSta->btRssi, ++ pCoexSta->btRetryCnt ++ ); + CL_PRINTF(cliBuf); + -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d / %d / %d / %d", "SCO/HID/PAN/A2DP", \ -+ pBtLinkInfo->bScoExist, pBtLinkInfo->bHidExist, pBtLinkInfo->bPanExist, pBtLinkInfo->bA2dpExist); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = %d / %d / %d / %d", "SCO/HID/PAN/A2DP", \ ++ pBtLinkInfo->bScoExist, ++ pBtLinkInfo->bHidExist, ++ pBtLinkInfo->bPanExist, ++ pBtLinkInfo->bA2dpExist ++ ); + CL_PRINTF(cliBuf); + pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_BT_LINK_INFO); + + btInfoExt = pCoexSta->btInfoExt; -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s", "BT Info A2DP rate", \ -+ (btInfoExt&BIT0)? "Basic rate":"EDR rate"); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = %s", "BT Info A2DP rate", \ ++ (btInfoExt&BIT0) ? "Basic rate" : "EDR rate" ++ ); + CL_PRINTF(cliBuf); + -+ for (i = 0; ibtInfoC2hCnt[i]) -+ { -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8723b2Ant[i], \ -+ pCoexSta->btInfoC2h[i][0], pCoexSta->btInfoC2h[i][1], -+ pCoexSta->btInfoC2h[i][2], pCoexSta->btInfoC2h[i][3], -+ pCoexSta->btInfoC2h[i][4], pCoexSta->btInfoC2h[i][5], -+ pCoexSta->btInfoC2h[i][6], pCoexSta->btInfoC2hCnt[i]); ++ for (i = 0; i < BT_INFO_SRC_8723B_2ANT_MAX; i++) { ++ if (pCoexSta->btInfoC2hCnt[i]) { ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = %02x %02x %02x %02x %02x %02x %02x(%d)", GLBtInfoSrc8723b2Ant[i], \ ++ pCoexSta->btInfoC2h[i][0], ++ pCoexSta->btInfoC2h[i][1], ++ pCoexSta->btInfoC2h[i][2], ++ pCoexSta->btInfoC2h[i][3], ++ pCoexSta->btInfoC2h[i][4], ++ pCoexSta->btInfoC2h[i][5], ++ pCoexSta->btInfoC2h[i][6], ++ pCoexSta->btInfoC2hCnt[i] ++ ); + CL_PRINTF(cliBuf); + } + } + -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %s/%s", "PS state, IPS/LPS", \ -+ ((pCoexSta->bUnderIps? "IPS ON":"IPS OFF")), -+ ((pCoexSta->bUnderLps? "LPS ON":"LPS OFF"))); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = %s/%s", "PS state, IPS/LPS", \ ++ ((pCoexSta->bUnderIps ? "IPS ON" : "IPS OFF")), ++ ((pCoexSta->bUnderLps ? "LPS ON" : "LPS OFF")) ++ ); + CL_PRINTF(cliBuf); + pBtCoexist->fBtcDispDbgMsg(pBtCoexist, BTC_DBG_DISP_FW_PWR_MODE_CMD); + + /* Sw mechanism */ -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Sw mechanism]============"); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s", "============[Sw mechanism]============" ++ ); + CL_PRINTF(cliBuf); -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d ", "SM1[ShRf/ LpRA/ LimDig]", \ -+ pCoexDm->bCurRfRxLpfShrink, pCoexDm->bCurLowPenaltyRa, pCoexDm->bLimitedDig); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = %d/ %d/ %d ", "SM1[ShRf/ LpRA/ LimDig]", \ ++ pCoexDm->bCurRfRxLpfShrink, ++ pCoexDm->bCurLowPenaltyRa, ++ pCoexDm->bLimitedDig ++ ); + CL_PRINTF(cliBuf); -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d/ %d(0x%x) ", "SM2[AgcT/ AdcB/ SwDacSwing(lvl)]", \ -+ pCoexDm->bCurAgcTableEn, pCoexDm->bCurAdcBackOff, pCoexDm->bCurDacSwingOn, pCoexDm->curDacSwingLvl); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = %d/ %d/ %d(0x%x) ", ++ "SM2[AgcT/ AdcB/ SwDacSwing(lvl)]", \ ++ pCoexDm->bCurAgcTableEn, ++ pCoexDm->bCurAdcBackOff, ++ pCoexDm->bCurDacSwingOn, ++ pCoexDm->curDacSwingLvl ++ ); + CL_PRINTF(cliBuf); + + /* Fw mechanism */ @@ -42585,43 +41046,76 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + CL_PRINTF(cliBuf); + + psTdmaCase = pCoexDm->curPsTdma; -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %02x %02x %02x %02x %02x case-%d (auto:%d)", "PS TDMA", \ -+ pCoexDm->psTdmaPara[0], pCoexDm->psTdmaPara[1], -+ pCoexDm->psTdmaPara[2], pCoexDm->psTdmaPara[3], -+ pCoexDm->psTdmaPara[4], psTdmaCase, pCoexDm->bAutoTdmaAdjust); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = %02x %02x %02x %02x %02x case-%d (auto:%d)", "PS TDMA", \ ++ pCoexDm->psTdmaPara[0], ++ pCoexDm->psTdmaPara[1], ++ pCoexDm->psTdmaPara[2], ++ pCoexDm->psTdmaPara[3], ++ pCoexDm->psTdmaPara[4], ++ psTdmaCase, pCoexDm->bAutoTdmaAdjust ++ ); + CL_PRINTF(cliBuf); + -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d ", "DecBtPwr/ IgnWlanAct", \ -+ pCoexDm->curBtDecPwrLvl, pCoexDm->bCurIgnoreWlanAct); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = %d/ %d ", "DecBtPwr/ IgnWlanAct", \ ++ pCoexDm->curBtDecPwrLvl, ++ pCoexDm->bCurIgnoreWlanAct ++ ); + CL_PRINTF(cliBuf); + + /* Hw setting */ + CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s", "============[Hw setting]============"); + CL_PRINTF(cliBuf); + -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x", "RF-A, 0x1e initVal", \ -+ pCoexDm->btRf0x1eBackup); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = 0x%x", "RF-A, 0x1e initVal", \ ++ pCoexDm->btRf0x1eBackup ++ ); + CL_PRINTF(cliBuf); + + u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x778); + u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x880); -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x778/0x880[29:25]", \ -+ u1Tmp[0], (u4Tmp[0]&0x3e000000) >> 25); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = 0x%x/ 0x%x", "0x778/0x880[29:25]", \ ++ u1Tmp[0], ++ (u4Tmp[0]&0x3e000000) >> 25 ++ ); + CL_PRINTF(cliBuf); + + + u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x948); + u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x67); + u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x765); -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x948/ 0x67[5] / 0x765", \ -+ u4Tmp[0], ((u1Tmp[0]&0x20)>> 5), u1Tmp[1]); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x948/ 0x67[5] / 0x765", \ ++ u4Tmp[0], ++ ((u1Tmp[0]&0x20)>>5), ++ u1Tmp[1] ++ ); + CL_PRINTF(cliBuf); + + u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x92c); + u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x930); + u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x944); -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x92c[1:0]/ 0x930[7:0]/0x944[1:0]", \ -+ u4Tmp[0]&0x3, u4Tmp[1]&0xff, u4Tmp[2]&0x3); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "0x92c[1:0]/ 0x930[7:0]/0x944[1:0]", \ ++ u4Tmp[0]&0x3, ++ u4Tmp[1]&0xff, ++ u4Tmp[2]&0x3 ++ ); + CL_PRINTF(cliBuf); + + @@ -42629,20 +41123,37 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x40); + u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x4c); + u1Tmp[2] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x64); -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0x38[11]/0x40/0x4c[24:23]/0x64[0]", \ -+ ((u1Tmp[0] & 0x8)>>3), u1Tmp[1], ((u4Tmp[0]&0x01800000)>>23), u1Tmp[2]&0x1); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0x38[11]/0x40/0x4c[24:23]/0x64[0]", \ ++ ((u1Tmp[0] & 0x8)>>3), ++ u1Tmp[1], ++ ((u4Tmp[0]&0x01800000)>>23), ++ u1Tmp[2]&0x1 ++ ); + CL_PRINTF(cliBuf); + + u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x550); + u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x522); -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0x550(bcn ctrl)/0x522", \ -+ u4Tmp[0], u1Tmp[0]); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = 0x%x/ 0x%x", "0x550(bcn ctrl)/0x522", \ ++ u4Tmp[0], ++ u1Tmp[0] ++ ); + CL_PRINTF(cliBuf); + + u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xc50); + u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x49c); -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x", "0xc50(dig)/0x49c(null-drop)", \ -+ u4Tmp[0]&0xff, u1Tmp[0]); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = 0x%x/ 0x%x", "0xc50(dig)/0x49c(null-drop)", \ ++ u4Tmp[0]&0xff, ++ u1Tmp[0] ++ ); + CL_PRINTF(cliBuf); + + u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0xda0); @@ -42653,27 +41164,55 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xa5b); + u1Tmp[1] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0xa5c); + -+ faOfdm = ((u4Tmp[0]&0xffff0000) >> 16) + ((u4Tmp[1]&0xffff0000) >> 16) + (u4Tmp[1] & 0xffff) + (u4Tmp[2] & 0xffff) + \ -+ ((u4Tmp[3]&0xffff0000) >> 16) + (u4Tmp[3] & 0xffff) ; ++ faOfdm = ++ ((u4Tmp[0]&0xffff0000) >> 16) + ++ ((u4Tmp[1]&0xffff0000) >> 16) + ++ (u4Tmp[1] & 0xffff) + (u4Tmp[2] & 0xffff) + \ ++ ((u4Tmp[3]&0xffff0000) >> 16) + ++ (u4Tmp[3] & 0xffff); ++ + faCck = (u1Tmp[0] << 8) + u1Tmp[1]; + -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "OFDM-CCA/OFDM-FA/CCK-FA", \ -+ u4Tmp[0]&0xffff, faOfdm, faCck); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = 0x%x/ 0x%x/ 0x%x", "OFDM-CCA/OFDM-FA/CCK-FA", \ ++ u4Tmp[0]&0xffff, ++ faOfdm, ++ faCck ++ ); + CL_PRINTF(cliBuf); + + u4Tmp[0] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c0); + u4Tmp[1] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c4); + u4Tmp[2] = pBtCoexist->fBtcRead4Byte(pBtCoexist, 0x6c8); + u1Tmp[0] = pBtCoexist->fBtcRead1Byte(pBtCoexist, 0x6cc); -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0x6c0/0x6c4/0x6c8/0x6cc(coexTable)", \ -+ u4Tmp[0], u4Tmp[1], u4Tmp[2], u1Tmp[0]); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = 0x%x/ 0x%x/ 0x%x/ 0x%x", "0x6c0/0x6c4/0x6c8/0x6cc(coexTable)", \ ++ u4Tmp[0], ++ u4Tmp[1], ++ u4Tmp[2], ++ u1Tmp[0] ++ ); + CL_PRINTF(cliBuf); + -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x770(high-pri rx/tx)", \ -+ pCoexSta->highPriorityRx, pCoexSta->highPriorityTx); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = %d/ %d", "0x770(high-pri rx/tx)", \ ++ pCoexSta->highPriorityRx, ++ pCoexSta->highPriorityTx ++ ); + CL_PRINTF(cliBuf); -+ CL_SPRINTF(cliBuf, BT_TMP_BUF_SIZE, "\r\n %-35s = %d/ %d", "0x774(low-pri rx/tx)", \ -+ pCoexSta->lowPriorityRx, pCoexSta->lowPriorityTx); ++ CL_SPRINTF( ++ cliBuf, ++ BT_TMP_BUF_SIZE, ++ "\r\n %-35s = %d/ %d", "0x774(low-pri rx/tx)", \ ++ pCoexSta->lowPriorityRx, ++ pCoexSta->lowPriorityTx ++ ); + CL_PRINTF(cliBuf); + + halbtc8723b2ant_MonitorBtCtr(pBtCoexist); @@ -42681,22 +41220,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b +} + + -+void -+EXhalbtc8723b2ant_IpsNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ) ++void EXhalbtc8723b2ant_IpsNotify(PBTC_COEXIST pBtCoexist, u8 type) +{ -+ if (BTC_IPS_ENTER == type) -+ { ++ if (BTC_IPS_ENTER == type) { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS ENTER notify\n")); + pCoexSta->bUnderIps = true; + halbtc8723b2ant_WifiOffHwCfg(pBtCoexist); + halbtc8723b2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, true); + halbtc8723b2ant_CoexAllOff(pBtCoexist); -+ } -+ else if (BTC_IPS_LEAVE == type) -+ { ++ } else if (BTC_IPS_LEAVE == type) { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], IPS LEAVE notify\n")); + pCoexSta->bUnderIps = false; + halbtc8723b2ant_InitHwConfig(pBtCoexist, false); @@ -42705,174 +41237,133 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + } +} + -+void -+EXhalbtc8723b2ant_LpsNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ) ++void EXhalbtc8723b2ant_LpsNotify(PBTC_COEXIST pBtCoexist, u8 type) +{ -+ if (BTC_LPS_ENABLE == type) -+ { ++ if (BTC_LPS_ENABLE == type) { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS ENABLE notify\n")); + pCoexSta->bUnderLps = true; -+ } -+ else if (BTC_LPS_DISABLE == type) -+ { ++ } else if (BTC_LPS_DISABLE == type) { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], LPS DISABLE notify\n")); + pCoexSta->bUnderLps = false; + } +} + -+void -+EXhalbtc8723b2ant_ScanNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ) ++void EXhalbtc8723b2ant_ScanNotify(PBTC_COEXIST pBtCoexist, u8 type) +{ -+ if (BTC_SCAN_START == type) -+ { ++ if (BTC_SCAN_START == type) { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN START notify\n")); -+ } -+ else if (BTC_SCAN_FINISH == type) -+ { ++ } else if (BTC_SCAN_FINISH == type) { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], SCAN FINISH notify\n")); + } +} + -+void -+EXhalbtc8723b2ant_ConnectNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ) ++void EXhalbtc8723b2ant_ConnectNotify(PBTC_COEXIST pBtCoexist, u8 type) +{ -+ if (BTC_ASSOCIATE_START == type) -+ { ++ if (BTC_ASSOCIATE_START == type) { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT START notify\n")); -+ } -+ else if (BTC_ASSOCIATE_FINISH == type) -+ { ++ } else if (BTC_ASSOCIATE_FINISH == type) { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], CONNECT FINISH notify\n")); + } +} + -+void -+EXhalbtc8723b2ant_MediaStatusNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ) ++void EXhalbtc8723b2ant_MediaStatusNotify(PBTC_COEXIST pBtCoexist, u8 type) +{ -+ u8 H2C_Parameter[3] ={0}; -+ u32 wifiBw; -+ u8 wifiCentralChnl; -+ u8 apNum = 0; ++ u8 H2C_Parameter[3] = {0}; ++ u32 wifiBw; ++ u8 wifiCentralChnl; ++ u8 apNum = 0; + -+ if (BTC_MEDIA_CONNECT == type) -+ { ++ if (BTC_MEDIA_CONNECT == type) { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], MEDIA connect notify\n")); -+ } -+ else -+ { ++ } else { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], MEDIA disconnect notify\n")); + } + + /* only 2.4G we need to inform bt the chnl mask */ + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_WIFI_CENTRAL_CHNL, &wifiCentralChnl); -+ if ((BTC_MEDIA_CONNECT == type) && -+ (wifiCentralChnl <= 14)) -+ { ++ if ((BTC_MEDIA_CONNECT == type) && (wifiCentralChnl <= 14)) { + H2C_Parameter[0] = 0x1; + H2C_Parameter[1] = wifiCentralChnl; + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_WIFI_BW, &wifiBw); + if (BTC_WIFI_BW_HT40 == wifiBw) + H2C_Parameter[2] = 0x30; -+ else -+ { ++ else { + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U1_AP_NUM, &apNum); + if (apNum < 10) + H2C_Parameter[2] = 0x30; + else + H2C_Parameter[2] = 0x20; -+ } ++ } + } + + pCoexDm->wifiChnlInfo[0] = H2C_Parameter[0]; + pCoexDm->wifiChnlInfo[1] = H2C_Parameter[1]; + pCoexDm->wifiChnlInfo[2] = H2C_Parameter[2]; + -+ BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE_FW_EXEC, ("[BTCoex], FW write 0x66 = 0x%x\n", -+ H2C_Parameter[0]<<16|H2C_Parameter[1]<<8|H2C_Parameter[2])); ++ BTC_PRINT( ++ BTC_MSG_ALGORITHM, ++ ALGO_TRACE_FW_EXEC, ++ ( ++ "[BTCoex], FW write 0x66 = 0x%x\n", ++ H2C_Parameter[0]<<16|H2C_Parameter[1]<<8|H2C_Parameter[2] ++ ) ++ ); + + pBtCoexist->fBtcFillH2c(pBtCoexist, 0x66, 3, H2C_Parameter); +} + -+void -+EXhalbtc8723b2ant_SpecialPacketNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ) ++void EXhalbtc8723b2ant_SpecialPacketNotify(PBTC_COEXIST pBtCoexist, u8 type) +{ -+ if (type == BTC_PACKET_DHCP) -+ { ++ if (type == BTC_PACKET_DHCP) { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], DHCP Packet notify\n")); + } +} + -+void -+EXhalbtc8723b2ant_BtInfoNotify( -+PBTC_COEXIST pBtCoexist, -+u8 * tmpBuf, -+u8 length -+ ) ++void EXhalbtc8723b2ant_BtInfoNotify( ++ PBTC_COEXIST pBtCoexist, u8 *tmpBuf, u8 length ++) +{ + u8 btInfo = 0; + u8 i, rspSource = 0; -+ bool bBtBusy =false, bLimitedDig =false; -+ bool bWifiConnected =false; ++ bool bBtBusy = false, bLimitedDig = false; ++ bool bWifiConnected = false; + + pCoexSta->bC2hBtInfoReqSent = false; + + rspSource = tmpBuf[0]&0xf; + if (rspSource >= BT_INFO_SRC_8723B_2ANT_MAX) + rspSource = BT_INFO_SRC_8723B_2ANT_WIFI_FW; ++ + pCoexSta->btInfoC2hCnt[rspSource]++; + + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Bt info[%d], length =%d, hex data =[", rspSource, length)); -+ for (i = 0; ibtInfoC2h[rspSource][i] = tmpBuf[i]; + if (i == 1) + btInfo = tmpBuf[i]; -+ if (i == length-1) -+ { ++ ++ if (i == length-1) { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x]\n", tmpBuf[i])); -+ } -+ else -+ { ++ } else { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("0x%02x, ", tmpBuf[i])); + } + } + -+ if (pBtCoexist->bManualControl) -+ { ++ if (pBtCoexist->bManualControl) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), return for Manual CTRL<===\n")); + return; + } + -+ if (BT_INFO_SRC_8723B_2ANT_WIFI_FW != rspSource) -+ { -+ pCoexSta->btRetryCnt = /* [3:0] */ -+ pCoexSta->btInfoC2h[rspSource][2]&0xf; ++ if (BT_INFO_SRC_8723B_2ANT_WIFI_FW != rspSource) { ++ pCoexSta->btRetryCnt = pCoexSta->btInfoC2h[rspSource][2]&0xf; /* [3:0] */ + -+ pCoexSta->btRssi = -+ pCoexSta->btInfoC2h[rspSource][3]*2+10; ++ pCoexSta->btRssi = pCoexSta->btInfoC2h[rspSource][3]*2+10; + -+ pCoexSta->btInfoExt = -+ pCoexSta->btInfoC2h[rspSource][4]; ++ pCoexSta->btInfoExt = pCoexSta->btInfoC2h[rspSource][4]; + + pCoexSta->bBtTxRxMask = (pCoexSta->btInfoC2h[rspSource][2]&0x40); + pBtCoexist->fBtcSet(pBtCoexist, BTC_SET_BL_BT_TX_RX_MASK, &pCoexSta->bBtTxRxMask); -+ if (pCoexSta->bBtTxRxMask) -+ { ++ if (pCoexSta->bBtTxRxMask) { + /* BT into is responded by BT FW and BT RF REG 0x3C != 0x01 => Need to switch BT TRx Mask */ + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], Switch BT TRx Mask since BT RF REG 0x3C != 0x01\n")); + pBtCoexist->fBtcSetBtReg(pBtCoexist, BTC_BT_REG_RF, 0x3c, 0x01); @@ -42880,27 +41371,20 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + + /* Here we need to resend some wifi info to BT */ + /* because bt is reset and loss of the info. */ -+ if ((pCoexSta->btInfoExt & BIT1)) -+ { ++ if ((pCoexSta->btInfoExt & BIT1)) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit1 check, send wifi BW&Chnl to BT!!\n")); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_BL_WIFI_CONNECTED, &bWifiConnected); ++ + if (bWifiConnected) -+ { + EXhalbtc8723b2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_CONNECT); -+ } + else -+ { + EXhalbtc8723b2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT); -+ } + } + -+ if ((pCoexSta->btInfoExt & BIT3)) -+ { ++ if ((pCoexSta->btInfoExt & BIT3)) { + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BT ext info bit3 check, set BT NOT to ignore Wlan active!!\n")); + halbtc8723b2ant_IgnoreWlanAct(pBtCoexist, FORCE_EXEC, false); -+ } -+ else -+ { ++ } else { + /* BT already NOT ignore Wlan active, do nothing here. */ + } + } @@ -42912,16 +41396,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + pCoexSta->bC2hBtInquiryPage = false; + + /* set link exist status */ -+ if (!(btInfo&BT_INFO_8723B_2ANT_B_CONNECTION)) -+ { ++ if (!(btInfo&BT_INFO_8723B_2ANT_B_CONNECTION)) { + pCoexSta->bBtLinkExist = false; + pCoexSta->bPanExist = false; + pCoexSta->bA2dpExist = false; + pCoexSta->bHidExist = false; + pCoexSta->bScoExist = false; -+ } -+ else /* connection exists */ -+ { ++ } else { /* connection exists */ + pCoexSta->bBtLinkExist = true; + if (btInfo & BT_INFO_8723B_2ANT_B_FTP) + pCoexSta->bPanExist = true; @@ -42943,42 +41424,34 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + + halbtc8723b2ant_UpdateBtLinkInfo(pBtCoexist); + -+ if (!(btInfo&BT_INFO_8723B_2ANT_B_CONNECTION)) -+ { ++ if (!(btInfo&BT_INFO_8723B_2ANT_B_CONNECTION)) { + pCoexDm->btStatus = BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Connected idle!!!\n")); -+ } -+ else if (btInfo == BT_INFO_8723B_2ANT_B_CONNECTION) /* connection exists but no busy */ -+ { ++ } else if (btInfo == BT_INFO_8723B_2ANT_B_CONNECTION) { /* connection exists but no busy */ + pCoexDm->btStatus = BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Connected-idle!!!\n")); -+ } -+ else if ((btInfo&BT_INFO_8723B_2ANT_B_SCO_ESCO) || -+ (btInfo&BT_INFO_8723B_2ANT_B_SCO_BUSY)) -+ { ++ } else if ( ++ (btInfo&BT_INFO_8723B_2ANT_B_SCO_ESCO) || ++ (btInfo&BT_INFO_8723B_2ANT_B_SCO_BUSY) ++ ) { + pCoexDm->btStatus = BT_8723B_2ANT_BT_STATUS_SCO_BUSY; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT SCO busy!!!\n")); -+ } -+ else if (btInfo&BT_INFO_8723B_2ANT_B_ACL_BUSY) -+ { ++ } else if (btInfo&BT_INFO_8723B_2ANT_B_ACL_BUSY) { + pCoexDm->btStatus = BT_8723B_2ANT_BT_STATUS_ACL_BUSY; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT ACL busy!!!\n")); -+ } -+ else -+ { ++ } else { + pCoexDm->btStatus = BT_8723B_2ANT_BT_STATUS_MAX; + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], BtInfoNotify(), BT Non-Defined state!!!\n")); + } + -+ if ((BT_8723B_2ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) || ++ if ( ++ (BT_8723B_2ANT_BT_STATUS_ACL_BUSY == pCoexDm->btStatus) || + (BT_8723B_2ANT_BT_STATUS_SCO_BUSY == pCoexDm->btStatus) || -+ (BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus)) -+ { ++ (BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY == pCoexDm->btStatus) ++ ) { + bBtBusy = true; + bLimitedDig = true; -+ } -+ else -+ { ++ } else { + bBtBusy = false; + bLimitedDig = false; + } @@ -42991,10 +41464,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + halbtc8723b2ant_RunCoexistMechanism(pBtCoexist); +} + -+void -+EXhalbtc8723b2ant_HaltNotify( -+PBTC_COEXIST pBtCoexist -+ ) ++void EXhalbtc8723b2ant_HaltNotify(PBTC_COEXIST pBtCoexist) +{ + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Halt notify\n")); + @@ -43005,20 +41475,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + EXhalbtc8723b2ant_MediaStatusNotify(pBtCoexist, BTC_MEDIA_DISCONNECT); +} + -+void -+EXhalbtc8723b2ant_PnpNotify( -+PBTC_COEXIST pBtCoexist, -+u8 pnpState -+ ) ++void EXhalbtc8723b2ant_PnpNotify(PBTC_COEXIST pBtCoexist, u8 pnpState) +{ + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Pnp notify\n")); + -+ if (BTC_WIFI_PNP_SLEEP == pnpState) -+ { ++ if (BTC_WIFI_PNP_SLEEP == pnpState) { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Pnp notify to SLEEP\n")); -+ } -+ else if (BTC_WIFI_PNP_WAKE_UP == pnpState) -+ { ++ } else if (BTC_WIFI_PNP_WAKE_UP == pnpState) { + BTC_PRINT(BTC_MSG_INTERFACE, INTF_NOTIFY, ("[BTCoex], Pnp notify to WAKE UP\n")); + halbtc8723b2ant_InitHwConfig(pBtCoexist, false); + halbtc8723b2ant_InitCoexDm(pBtCoexist); @@ -43026,18 +41489,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + } +} + -+void -+EXhalbtc8723b2ant_Periodical( -+PBTC_COEXIST pBtCoexist -+ ) ++void EXhalbtc8723b2ant_Periodical(PBTC_COEXIST pBtCoexist) +{ + static u8 disVerInfoCnt = 0; -+ u32 fwVer = 0, btPatchVer = 0; ++ u32 fwVer = 0, btPatchVer = 0; + + BTC_PRINT(BTC_MSG_ALGORITHM, ALGO_TRACE, ("[BTCoex], ==========================Periodical ===========================\n")); + -+ if (disVerInfoCnt <= 5) -+ { ++ if (disVerInfoCnt <= 5) { + disVerInfoCnt += 1; + BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n")); + pBtCoexist->fBtcGet(pBtCoexist, BTC_GET_U4_BT_PATCH_VER, &btPatchVer); @@ -43047,16 +41506,16 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.c linux-4.3-rtl8723b + BTC_PRINT(BTC_MSG_INTERFACE, INTF_INIT, ("[BTCoex], ****************************************************************\n")); + } + -+ if (halbtc8723b2ant_IsWifiStatusChanged(pBtCoexist) || -+ pCoexDm->bAutoTdmaAdjust) -+ { ++ if ( ++ halbtc8723b2ant_IsWifiStatusChanged(pBtCoexist) || ++ pCoexDm->bAutoTdmaAdjust ++ ) + halbtc8723b2ant_RunCoexistMechanism(pBtCoexist); -+ } +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.h ---- linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.h 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,205 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.h linux/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.h +--- linux.old/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.h 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,155 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. @@ -43083,80 +41542,80 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.h linux-4.3-rtl8723b + +#define BTC_RSSI_COEX_THRESH_TOL_8723B_2ANT 2 + -+typedef enum _BT_INFO_SRC_8723B_2ANT{ -+ BT_INFO_SRC_8723B_2ANT_WIFI_FW = 0x0, -+ BT_INFO_SRC_8723B_2ANT_BT_RSP = 0x1, -+ BT_INFO_SRC_8723B_2ANT_BT_ACTIVE_SEND = 0x2, ++typedef enum _BT_INFO_SRC_8723B_2ANT { ++ BT_INFO_SRC_8723B_2ANT_WIFI_FW = 0x0, ++ BT_INFO_SRC_8723B_2ANT_BT_RSP = 0x1, ++ BT_INFO_SRC_8723B_2ANT_BT_ACTIVE_SEND = 0x2, + BT_INFO_SRC_8723B_2ANT_MAX -+}BT_INFO_SRC_8723B_2ANT,*PBT_INFO_SRC_8723B_2ANT; ++} BT_INFO_SRC_8723B_2ANT, *PBT_INFO_SRC_8723B_2ANT; + -+typedef enum _BT_8723B_2ANT_BT_STATUS{ -+ BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0, -+ BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1, -+ BT_8723B_2ANT_BT_STATUS_INQ_PAGE = 0x2, -+ BT_8723B_2ANT_BT_STATUS_ACL_BUSY = 0x3, -+ BT_8723B_2ANT_BT_STATUS_SCO_BUSY = 0x4, -+ BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5, ++typedef enum _BT_8723B_2ANT_BT_STATUS { ++ BT_8723B_2ANT_BT_STATUS_NON_CONNECTED_IDLE = 0x0, ++ BT_8723B_2ANT_BT_STATUS_CONNECTED_IDLE = 0x1, ++ BT_8723B_2ANT_BT_STATUS_INQ_PAGE = 0x2, ++ BT_8723B_2ANT_BT_STATUS_ACL_BUSY = 0x3, ++ BT_8723B_2ANT_BT_STATUS_SCO_BUSY = 0x4, ++ BT_8723B_2ANT_BT_STATUS_ACL_SCO_BUSY = 0x5, + BT_8723B_2ANT_BT_STATUS_MAX -+}BT_8723B_2ANT_BT_STATUS,*PBT_8723B_2ANT_BT_STATUS; ++} BT_8723B_2ANT_BT_STATUS, *PBT_8723B_2ANT_BT_STATUS; + -+typedef enum _BT_8723B_2ANT_COEX_ALGO{ -+ BT_8723B_2ANT_COEX_ALGO_UNDEFINED = 0x0, -+ BT_8723B_2ANT_COEX_ALGO_SCO = 0x1, -+ BT_8723B_2ANT_COEX_ALGO_HID = 0x2, -+ BT_8723B_2ANT_COEX_ALGO_A2DP = 0x3, -+ BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS = 0x4, -+ BT_8723B_2ANT_COEX_ALGO_PANEDR = 0x5, -+ BT_8723B_2ANT_COEX_ALGO_PANHS = 0x6, -+ BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7, -+ BT_8723B_2ANT_COEX_ALGO_PANEDR_HID = 0x8, ++typedef enum _BT_8723B_2ANT_COEX_ALGO { ++ BT_8723B_2ANT_COEX_ALGO_UNDEFINED = 0x0, ++ BT_8723B_2ANT_COEX_ALGO_SCO = 0x1, ++ BT_8723B_2ANT_COEX_ALGO_HID = 0x2, ++ BT_8723B_2ANT_COEX_ALGO_A2DP = 0x3, ++ BT_8723B_2ANT_COEX_ALGO_A2DP_PANHS = 0x4, ++ BT_8723B_2ANT_COEX_ALGO_PANEDR = 0x5, ++ BT_8723B_2ANT_COEX_ALGO_PANHS = 0x6, ++ BT_8723B_2ANT_COEX_ALGO_PANEDR_A2DP = 0x7, ++ BT_8723B_2ANT_COEX_ALGO_PANEDR_HID = 0x8, + BT_8723B_2ANT_COEX_ALGO_HID_A2DP_PANEDR = 0x9, -+ BT_8723B_2ANT_COEX_ALGO_HID_A2DP = 0xa, -+ BT_8723B_2ANT_COEX_ALGO_MAX = 0xb, -+}BT_8723B_2ANT_COEX_ALGO,*PBT_8723B_2ANT_COEX_ALGO; ++ BT_8723B_2ANT_COEX_ALGO_HID_A2DP = 0xa, ++ BT_8723B_2ANT_COEX_ALGO_MAX = 0xb, ++} BT_8723B_2ANT_COEX_ALGO, *PBT_8723B_2ANT_COEX_ALGO; + -+typedef struct _COEX_DM_8723B_2ANT{ ++typedef struct _COEX_DM_8723B_2ANT { + /* fw mechanism */ + u8 preBtDecPwrLvl; + u8 curBtDecPwrLvl; + u8 preFwDacSwingLvl; + u8 curFwDacSwingLvl; -+ bool bCurIgnoreWlanAct; -+ bool bPreIgnoreWlanAct; ++ bool bCurIgnoreWlanAct; ++ bool bPreIgnoreWlanAct; + u8 prePsTdma; + u8 curPsTdma; + u8 psTdmaPara[5]; + u8 psTdmaDuAdjType; -+ bool bResetTdmaAdjust; -+ bool bAutoTdmaAdjust; -+ bool bPrePsTdmaOn; -+ bool bCurPsTdmaOn; -+ bool bPreBtAutoReport; -+ bool bCurBtAutoReport; ++ bool bResetTdmaAdjust; ++ bool bAutoTdmaAdjust; ++ bool bPrePsTdmaOn; ++ bool bCurPsTdmaOn; ++ bool bPreBtAutoReport; ++ bool bCurBtAutoReport; + + /* sw mechanism */ -+ bool bPreRfRxLpfShrink; -+ bool bCurRfRxLpfShrink; -+ u32 btRf0x1eBackup; -+ bool bPreLowPenaltyRa; -+ bool bCurLowPenaltyRa; -+ bool bPreDacSwingOn; -+ u32 preDacSwingLvl; -+ bool bCurDacSwingOn; -+ u32 curDacSwingLvl; -+ bool bPreAdcBackOff; -+ bool bCurAdcBackOff; -+ bool bPreAgcTableEn; -+ bool bCurAgcTableEn; -+ u32 preVal0x6c0; -+ u32 curVal0x6c0; -+ u32 preVal0x6c4; -+ u32 curVal0x6c4; -+ u32 preVal0x6c8; -+ u32 curVal0x6c8; ++ bool bPreRfRxLpfShrink; ++ bool bCurRfRxLpfShrink; ++ u32 btRf0x1eBackup; ++ bool bPreLowPenaltyRa; ++ bool bCurLowPenaltyRa; ++ bool bPreDacSwingOn; ++ u32 preDacSwingLvl; ++ bool bCurDacSwingOn; ++ u32 curDacSwingLvl; ++ bool bPreAdcBackOff; ++ bool bCurAdcBackOff; ++ bool bPreAgcTableEn; ++ bool bCurAgcTableEn; ++ u32 preVal0x6c0; ++ u32 curVal0x6c0; ++ u32 preVal0x6c4; ++ u32 curVal0x6c4; ++ u32 preVal0x6c8; ++ u32 curVal0x6c8; + u8 preVal0x6cc; + u8 curVal0x6cc; -+ bool bLimitedDig; ++ bool bLimitedDig; + + /* algorithm related */ + u8 preAlgorithm; @@ -43164,108 +41623,58 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtc8723b2Ant.h linux-4.3-rtl8723b + u8 btStatus; + u8 wifiChnlInfo[3]; + -+ bool bNeedRecover0x948; -+ u32 backup0x948; ++ bool bNeedRecover0x948; ++ u32 backup0x948; +} COEX_DM_8723B_2ANT, *PCOEX_DM_8723B_2ANT; + -+typedef struct _COEX_STA_8723B_2ANT{ -+ bool bBtLinkExist; -+ bool bScoExist; -+ bool bA2dpExist; -+ bool bHidExist; -+ bool bPanExist; ++typedef struct _COEX_STA_8723B_2ANT { ++ bool bBtLinkExist; ++ bool bScoExist; ++ bool bA2dpExist; ++ bool bHidExist; ++ bool bPanExist; + -+ bool bUnderLps; -+ bool bUnderIps; -+ u32 highPriorityTx; -+ u32 highPriorityRx; -+ u32 lowPriorityTx; -+ u32 lowPriorityRx; -+ u8 btRssi; -+ bool bBtTxRxMask; -+ u8 preBtRssiState; -+ u8 preWifiRssiState[4]; -+ bool bC2hBtInfoReqSent; -+ u8 btInfoC2h[BT_INFO_SRC_8723B_2ANT_MAX][10]; -+ u32 btInfoC2hCnt[BT_INFO_SRC_8723B_2ANT_MAX]; -+ bool bC2hBtInquiryPage; -+ u8 btRetryCnt; -+ u8 btInfoExt; -+}COEX_STA_8723B_2ANT, *PCOEX_STA_8723B_2ANT; ++ bool bUnderLps; ++ bool bUnderIps; ++ u32 highPriorityTx; ++ u32 highPriorityRx; ++ u32 lowPriorityTx; ++ u32 lowPriorityRx; ++ u8 btRssi; ++ bool bBtTxRxMask; ++ u8 preBtRssiState; ++ u8 preWifiRssiState[4]; ++ bool bC2hBtInfoReqSent; ++ u8 btInfoC2h[BT_INFO_SRC_8723B_2ANT_MAX][10]; ++ u32 btInfoC2hCnt[BT_INFO_SRC_8723B_2ANT_MAX]; ++ bool bC2hBtInquiryPage; ++ u8 btRetryCnt; ++ u8 btInfoExt; ++} COEX_STA_8723B_2ANT, *PCOEX_STA_8723B_2ANT; + +/* */ +/* The following is interface which will notify coex module. */ +/* */ -+void -+EXhalbtc8723b2ant_PowerOnSetting( -+PBTC_COEXIST pBtCoexist -+ ); -+void -+EXhalbtc8723b2ant_InitHwConfig( -+PBTC_COEXIST pBtCoexist, -+bool bWifiOnly -+ ); -+void -+EXhalbtc8723b2ant_InitCoexDm( -+PBTC_COEXIST pBtCoexist -+ ); -+void -+EXhalbtc8723b2ant_IpsNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ); -+void -+EXhalbtc8723b2ant_LpsNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ); -+void -+EXhalbtc8723b2ant_ScanNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ); -+void -+EXhalbtc8723b2ant_ConnectNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ); -+void -+EXhalbtc8723b2ant_MediaStatusNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ); -+void -+EXhalbtc8723b2ant_SpecialPacketNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ); -+void -+EXhalbtc8723b2ant_BtInfoNotify( -+PBTC_COEXIST pBtCoexist, -+u8 * tmpBuf, -+u8 length -+ ); -+void -+EXhalbtc8723b2ant_HaltNotify( -+PBTC_COEXIST pBtCoexist -+ ); -+void -+EXhalbtc8723b2ant_PnpNotify( -+PBTC_COEXIST pBtCoexist, -+u8 pnpState -+ ); -+void -+EXhalbtc8723b2ant_Periodical( -+PBTC_COEXIST pBtCoexist -+ ); -+void -+EXhalbtc8723b2ant_DisplayCoexInfo( -+PBTC_COEXIST pBtCoexist -+ ); -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/hal_btcoex.c ---- linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/hal_btcoex.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,1754 @@ ++void EXhalbtc8723b2ant_PowerOnSetting(PBTC_COEXIST pBtCoexist); ++void EXhalbtc8723b2ant_InitHwConfig(PBTC_COEXIST pBtCoexist, bool bWifiOnly); ++void EXhalbtc8723b2ant_InitCoexDm(PBTC_COEXIST pBtCoexist); ++void EXhalbtc8723b2ant_IpsNotify(PBTC_COEXIST pBtCoexist, u8 type); ++void EXhalbtc8723b2ant_LpsNotify(PBTC_COEXIST pBtCoexist, u8 type); ++void EXhalbtc8723b2ant_ScanNotify(PBTC_COEXIST pBtCoexist, u8 type); ++void EXhalbtc8723b2ant_ConnectNotify(PBTC_COEXIST pBtCoexist, u8 type); ++void EXhalbtc8723b2ant_MediaStatusNotify(PBTC_COEXIST pBtCoexist, u8 type); ++void EXhalbtc8723b2ant_SpecialPacketNotify(PBTC_COEXIST pBtCoexist, u8 type); ++void EXhalbtc8723b2ant_BtInfoNotify( ++ PBTC_COEXIST pBtCoexist, u8 *tmpBuf, u8 length ++); ++void EXhalbtc8723b2ant_HaltNotify(PBTC_COEXIST pBtCoexist); ++void EXhalbtc8723b2ant_PnpNotify(PBTC_COEXIST pBtCoexist, u8 pnpState); ++void EXhalbtc8723b2ant_Periodical(PBTC_COEXIST pBtCoexist); ++void EXhalbtc8723b2ant_DisplayCoexInfo(PBTC_COEXIST pBtCoexist); +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/hal_btcoex.c linux/3rdparty/rtl8723bs/hal/hal_btcoex.c +--- linux.old/3rdparty/rtl8723bs/hal/hal_btcoex.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/hal_btcoex.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,1720 @@ +/****************************************************************************** + * + * Copyright(c) 2013 Realtek Corporation. All rights reserved. @@ -43288,8 +41697,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd +#include + +/* Global variables */ -+static const char *const BtProfileString[] = -+{ ++static const char *const BtProfileString[] = { + "NONE", + "A2DP", + "PAN", @@ -43297,8 +41705,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd + "SCO", +}; + -+static const char *const BtSpecString[] = -+{ ++static const char *const BtSpecString[] = { + "1.0b", + "1.1", + "1.2", @@ -43308,22 +41715,19 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd + "4.0", +}; + -+static const char *const BtLinkRoleString[] = -+{ ++static const char *const BtLinkRoleString[] = { + "Master", + "Slave", +}; + -+static const char *const h2cStaString[] = -+{ ++static const char *const h2cStaString[] = { + "successful", + "h2c busy", + "rf off", + "fw not read", +}; + -+static const char *const ioStaString[] = -+{ ++static const char *const ioStaString[] = { + "success", + "can not IO", + "rf off", @@ -43344,8 +41748,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd +u32 GLBtcDbgType[BTC_MSG_MAX]; +static u8 GLBtcDbgBuf[BT_TMP_BUF_SIZE]; + -+typedef struct _btcoexdbginfo -+{ ++typedef struct _btcoexdbginfo { + u8 *info; + u32 size; /* buffer total size */ + u32 len; /* now used length */ @@ -43357,7 +41760,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd + +static void DBG_BT_INFO_INIT(PBTCDBGINFO pinfo, u8 *pbuf, u32 size) +{ -+ if (NULL == pinfo) return; ++ if (NULL == pinfo) ++ return; + + memset(pinfo, 0, sizeof(BTCDBGINFO)); + @@ -43394,8 +41798,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd +static u8 halbtcoutsrc_IsBtCoexistAvailable(PBTC_COEXIST pBtCoexist) +{ + if (!pBtCoexist->bBinded || -+ NULL == pBtCoexist->Adapter) -+ { ++ NULL == pBtCoexist->Adapter){ + return false; + } + return true; @@ -43405,7 +41808,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd +{ + u8 i; + -+ for (i = 0; iAdapter; + -+ if (pBtCoexist->btInfo.bBtCtrlLps) -+ { ++ if (pBtCoexist->btInfo.bBtCtrlLps) { + pBtCoexist->btInfo.bBtLpsOn = false; + rtw_btcoex_LPS_Leave(padapter); + pBtCoexist->btInfo.bBtCtrlLps = false; @@ -43542,27 +41944,24 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd + + if (pBtCoexist->btInfo.bRejectAggPkt) + rtw_btcoex_RejectApAggregatedPacket(padapter, true); -+ else -+ { ++ else{ ++ + if (pBtCoexist->btInfo.bPreBtCtrlAggBufSize != -+ pBtCoexist->btInfo.bBtCtrlAggBufSize) -+ { ++ pBtCoexist->btInfo.bBtCtrlAggBufSize){ ++ + bNeedToAct = true; + pBtCoexist->btInfo.bPreBtCtrlAggBufSize = pBtCoexist->btInfo.bBtCtrlAggBufSize; + } + -+ if (pBtCoexist->btInfo.bBtCtrlAggBufSize) -+ { ++ if (pBtCoexist->btInfo.bBtCtrlAggBufSize) { + if (pBtCoexist->btInfo.preAggBufSize != -+ pBtCoexist->btInfo.aggBufSize) -+ { ++ pBtCoexist->btInfo.aggBufSize){ + bNeedToAct = true; + } + pBtCoexist->btInfo.preAggBufSize = pBtCoexist->btInfo.aggBufSize; + } + -+ if (bNeedToAct) -+ { ++ if (bNeedToAct) { + rtw_btcoex_RejectApAggregatedPacket(padapter, true); + rtw_btcoex_RejectApAggregatedPacket(padapter, false); + } @@ -43576,8 +41975,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd + + pmlmepriv = &padapter->mlmepriv; + -+ if (check_fwstate(pmlmepriv, WIFI_ASOC_STATE) == true) -+ { ++ if (check_fwstate(pmlmepriv, WIFI_ASOC_STATE) == true) { + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) + return true; + if (true == pmlmepriv->LinkDetectInfo.bBusyTraffic) @@ -43598,17 +41996,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd + bp2p = false; + portConnectedStatus = 0; + -+ if (check_fwstate(pmlmepriv, WIFI_ASOC_STATE) == true) -+ { -+ if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) -+ { ++ if (check_fwstate(pmlmepriv, WIFI_ASOC_STATE) == true) { ++ if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) { + if (true == bp2p) + portConnectedStatus |= WIFI_P2P_GO_CONNECTED; + else + portConnectedStatus |= WIFI_AP_CONNECTED; -+ } -+ else -+ { ++ } else { + if (true == bp2p) + portConnectedStatus |= WIFI_P2P_GC_CONNECTED; + else @@ -43637,8 +42031,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd + numOfConnectedPort = 0; + + retVal = _halbtcoutsrc_GetWifiLinkStatus(padapter); -+ if (retVal) -+ { ++ if (retVal) { + portConnectedStatus |= retVal; + numOfConnectedPort++; + } @@ -43704,153 +42097,152 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd + pHalData = GET_HAL_DATA(padapter); + mlmeext = &padapter->mlmeextpriv; + pu8 = (u8 *)pOutBuf; -+ pS4Tmp = (s32*)pOutBuf; -+ pU4Tmp = (u32*)pOutBuf; ++ pS4Tmp = (s32 *)pOutBuf; ++ pU4Tmp = (u32 *)pOutBuf; + pU1Tmp = (u8 *)pOutBuf; + ret = true; + -+ switch (getType) -+ { -+ case BTC_GET_BL_HS_OPERATION: ++ switch (getType) { ++ case BTC_GET_BL_HS_OPERATION: ++ *pu8 = false; ++ ret = false; ++ break; ++ ++ case BTC_GET_BL_HS_CONNECTING: ++ *pu8 = false; ++ ret = false; ++ break; ++ ++ case BTC_GET_BL_WIFI_CONNECTED: ++ *pu8 = check_fwstate(&padapter->mlmepriv, WIFI_ASOC_STATE); ++ break; ++ ++ case BTC_GET_BL_WIFI_BUSY: ++ *pu8 = halbtcoutsrc_IsWifiBusy(padapter); ++ break; ++ ++ case BTC_GET_BL_WIFI_SCAN: ++ /* Use the value of the new variable GLBtcWiFiInScanState to judge whether WiFi is in scan state or not, since the originally used flag ++ WIFI_SITE_MONITOR in fwstate may not be cleared in time */ ++ *pu8 = GLBtcWiFiInScanState; ++ break; ++ ++ case BTC_GET_BL_WIFI_LINK: ++ *pu8 = check_fwstate(&padapter->mlmepriv, WIFI_UNDER_LINKING); ++ break; ++ ++ case BTC_GET_BL_WIFI_ROAM: ++ *pu8 = check_fwstate(&padapter->mlmepriv, WIFI_UNDER_LINKING); ++ break; ++ ++ case BTC_GET_BL_WIFI_4_WAY_PROGRESS: ++ *pu8 = false; ++ break; ++ ++ case BTC_GET_BL_WIFI_UNDER_5G: ++ *pu8 = (pHalData->CurrentBandType == 1) ? true : false; ++ break; ++ ++ case BTC_GET_BL_WIFI_AP_MODE_ENABLE: ++ *pu8 = check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE); ++ break; ++ ++ case BTC_GET_BL_WIFI_ENABLE_ENCRYPTION: ++ *pu8 = padapter->securitypriv.dot11PrivacyAlgrthm == 0 ? false : true; ++ break; ++ ++ case BTC_GET_BL_WIFI_UNDER_B_MODE: ++ if (mlmeext->cur_wireless_mode == WIRELESS_11B) ++ *pu8 = true; ++ else + *pu8 = false; -+ ret = false; -+ break; ++ break; + -+ case BTC_GET_BL_HS_CONNECTING: -+ *pu8 = false; -+ ret = false; -+ break; ++ case BTC_GET_BL_WIFI_IS_IN_MP_MODE: ++ *pu8 = false; ++ break; + -+ case BTC_GET_BL_WIFI_CONNECTED: -+ *pu8 = check_fwstate(&padapter->mlmepriv, WIFI_ASOC_STATE); -+ break; ++ case BTC_GET_BL_EXT_SWITCH: ++ *pu8 = false; ++ break; + -+ case BTC_GET_BL_WIFI_BUSY: -+ *pu8 = halbtcoutsrc_IsWifiBusy(padapter); -+ break; ++ case BTC_GET_S4_WIFI_RSSI: ++ *pS4Tmp = halbtcoutsrc_GetWifiRssi(padapter); ++ break; + -+ case BTC_GET_BL_WIFI_SCAN: -+ /* Use the value of the new variable GLBtcWiFiInScanState to judge whether WiFi is in scan state or not, since the originally used flag -+ WIFI_SITE_MONITOR in fwstate may not be cleared in time */ -+ *pu8 = GLBtcWiFiInScanState; -+ break; ++ case BTC_GET_S4_HS_RSSI: ++ *pS4Tmp = 0; ++ ret = false; ++ break; + -+ case BTC_GET_BL_WIFI_LINK: -+ *pu8 = check_fwstate(&padapter->mlmepriv, WIFI_UNDER_LINKING); -+ break; ++ case BTC_GET_U4_WIFI_BW: ++ if (IsLegacyOnly(mlmeext->cur_wireless_mode)) ++ *pU4Tmp = BTC_WIFI_BW_LEGACY; ++ else if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_20) ++ *pU4Tmp = BTC_WIFI_BW_HT20; ++ else if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_40) ++ *pU4Tmp = BTC_WIFI_BW_HT40; ++ else ++ *pU4Tmp = BTC_WIFI_BW_HT40; /* todo */ ++ break; + -+ case BTC_GET_BL_WIFI_ROAM: -+ *pu8 = check_fwstate(&padapter->mlmepriv, WIFI_UNDER_LINKING); -+ break; ++ case BTC_GET_U4_WIFI_TRAFFIC_DIRECTION: ++ { ++ PRT_LINK_DETECT_T plinkinfo; ++ plinkinfo = &padapter->mlmepriv.LinkDetectInfo; + -+ case BTC_GET_BL_WIFI_4_WAY_PROGRESS: -+ *pu8 = false; -+ break; -+ -+ case BTC_GET_BL_WIFI_UNDER_5G: -+ *pu8 = (pHalData->CurrentBandType == 1)? true : false; -+ break; -+ -+ case BTC_GET_BL_WIFI_AP_MODE_ENABLE: -+ *pu8 = check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE); -+ break; -+ -+ case BTC_GET_BL_WIFI_ENABLE_ENCRYPTION: -+ *pu8 = padapter->securitypriv.dot11PrivacyAlgrthm == 0? false: true; -+ break; -+ -+ case BTC_GET_BL_WIFI_UNDER_B_MODE: -+ if (mlmeext->cur_wireless_mode == WIRELESS_11B) -+ *pu8 = true; ++ if (plinkinfo->NumTxOkInPeriod > plinkinfo->NumRxOkInPeriod) ++ *pU4Tmp = BTC_WIFI_TRAFFIC_TX; + else -+ *pu8 = false; -+ break; ++ *pU4Tmp = BTC_WIFI_TRAFFIC_RX; ++ } ++ break; + -+ case BTC_GET_BL_WIFI_IS_IN_MP_MODE: -+ *pu8 = false; -+ break; ++ case BTC_GET_U4_WIFI_FW_VER: ++ *pU4Tmp = pHalData->FirmwareVersion << 16; ++ *pU4Tmp |= pHalData->FirmwareSubVersion; ++ break; + -+ case BTC_GET_BL_EXT_SWITCH: -+ *pu8 = false; -+ break; ++ case BTC_GET_U4_WIFI_LINK_STATUS: ++ *pU4Tmp = halbtcoutsrc_GetWifiLinkStatus(pBtCoexist); ++ break; + -+ case BTC_GET_S4_WIFI_RSSI: -+ *pS4Tmp = halbtcoutsrc_GetWifiRssi(padapter); -+ break; ++ case BTC_GET_U4_BT_PATCH_VER: ++ *pU4Tmp = halbtcoutsrc_GetBtPatchVer(pBtCoexist); ++ break; + -+ case BTC_GET_S4_HS_RSSI: -+ *pS4Tmp = 0; -+ ret = false; -+ break; ++ case BTC_GET_U1_WIFI_DOT11_CHNL: ++ *pU1Tmp = padapter->mlmeextpriv.cur_channel; ++ break; + -+ case BTC_GET_U4_WIFI_BW: -+ if (IsLegacyOnly(mlmeext->cur_wireless_mode)) -+ *pU4Tmp = BTC_WIFI_BW_LEGACY; -+ else if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_20) -+ *pU4Tmp = BTC_WIFI_BW_HT20; -+ else if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_40) -+ *pU4Tmp = BTC_WIFI_BW_HT40; -+ else -+ *pU4Tmp = BTC_WIFI_BW_HT40; /* todo */ -+ break; ++ case BTC_GET_U1_WIFI_CENTRAL_CHNL: ++ *pU1Tmp = pHalData->CurrentChannel; ++ break; + -+ case BTC_GET_U4_WIFI_TRAFFIC_DIRECTION: -+ { -+ PRT_LINK_DETECT_T plinkinfo; -+ plinkinfo = &padapter->mlmepriv.LinkDetectInfo; ++ case BTC_GET_U1_WIFI_HS_CHNL: ++ *pU1Tmp = 0; ++ ret = false; ++ break; + -+ if (plinkinfo->NumTxOkInPeriod > plinkinfo->NumRxOkInPeriod) -+ *pU4Tmp = BTC_WIFI_TRAFFIC_TX; -+ else -+ *pU4Tmp = BTC_WIFI_TRAFFIC_RX; -+ } -+ break; -+ -+ case BTC_GET_U4_WIFI_FW_VER: -+ *pU4Tmp = pHalData->FirmwareVersion << 16; -+ *pU4Tmp |= pHalData->FirmwareSubVersion; -+ break; -+ -+ case BTC_GET_U4_WIFI_LINK_STATUS: -+ *pU4Tmp = halbtcoutsrc_GetWifiLinkStatus(pBtCoexist); -+ break; -+ -+ case BTC_GET_U4_BT_PATCH_VER: -+ *pU4Tmp = halbtcoutsrc_GetBtPatchVer(pBtCoexist); -+ break; -+ -+ case BTC_GET_U1_WIFI_DOT11_CHNL: -+ *pU1Tmp = padapter->mlmeextpriv.cur_channel; -+ break; -+ -+ case BTC_GET_U1_WIFI_CENTRAL_CHNL: -+ *pU1Tmp = pHalData->CurrentChannel; -+ break; -+ -+ case BTC_GET_U1_WIFI_HS_CHNL: -+ *pU1Tmp = 0; -+ ret = false; -+ break; -+ -+ case BTC_GET_U1_MAC_PHY_MODE: -+ *pU1Tmp = BTC_SMSP; ++ case BTC_GET_U1_MAC_PHY_MODE: ++ *pU1Tmp = BTC_SMSP; +/* *pU1Tmp = BTC_DMSP; */ +/* *pU1Tmp = BTC_DMDP; */ +/* *pU1Tmp = BTC_MP_UNKNOWN; */ -+ break; ++ break; + -+ case BTC_GET_U1_AP_NUM: -+ *pU1Tmp = halbtcoutsrc_GetWifiScanAPNum(padapter); -+ break; ++ case BTC_GET_U1_AP_NUM: ++ *pU1Tmp = halbtcoutsrc_GetWifiScanAPNum(padapter); ++ break; + -+ /* 1Ant =========== */ -+ case BTC_GET_U1_LPS_MODE: -+ *pU1Tmp = padapter->dvobj->pwrctl_priv.pwr_mode; -+ break; ++ /* 1Ant =========== */ ++ case BTC_GET_U1_LPS_MODE: ++ *pU1Tmp = padapter->dvobj->pwrctl_priv.pwr_mode; ++ break; + -+ default: -+ ret = false; -+ break; ++ default: ++ ret = false; ++ break; + } + + return ret; @@ -43872,128 +42264,126 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd + pHalData = GET_HAL_DATA(padapter); + pu8 = (u8 *)pInBuf; + pU1Tmp = (u8 *)pInBuf; -+ pU4Tmp = (u32*)pInBuf; ++ pU4Tmp = (u32 *)pInBuf; + ret = true; + + if (!halbtcoutsrc_IsBtCoexistAvailable(pBtCoexist)) + return false; + -+ switch (setType) -+ { -+ /* set some u8 type variables. */ -+ case BTC_SET_BL_BT_DISABLE: -+ pBtCoexist->btInfo.bBtDisabled = *pu8; -+ break; ++ switch (setType) { ++ /* set some u8 type variables. */ ++ case BTC_SET_BL_BT_DISABLE: ++ pBtCoexist->btInfo.bBtDisabled = *pu8; ++ break; + -+ case BTC_SET_BL_BT_TRAFFIC_BUSY: -+ pBtCoexist->btInfo.bBtBusy = *pu8; -+ break; ++ case BTC_SET_BL_BT_TRAFFIC_BUSY: ++ pBtCoexist->btInfo.bBtBusy = *pu8; ++ break; + -+ case BTC_SET_BL_BT_LIMITED_DIG: -+ pBtCoexist->btInfo.bLimitedDig = *pu8; -+ break; ++ case BTC_SET_BL_BT_LIMITED_DIG: ++ pBtCoexist->btInfo.bLimitedDig = *pu8; ++ break; + -+ case BTC_SET_BL_FORCE_TO_ROAM: -+ pBtCoexist->btInfo.bForceToRoam = *pu8; -+ break; ++ case BTC_SET_BL_FORCE_TO_ROAM: ++ pBtCoexist->btInfo.bForceToRoam = *pu8; ++ break; + -+ case BTC_SET_BL_TO_REJ_AP_AGG_PKT: -+ pBtCoexist->btInfo.bRejectAggPkt = *pu8; -+ break; ++ case BTC_SET_BL_TO_REJ_AP_AGG_PKT: ++ pBtCoexist->btInfo.bRejectAggPkt = *pu8; ++ break; + -+ case BTC_SET_BL_BT_CTRL_AGG_SIZE: -+ pBtCoexist->btInfo.bBtCtrlAggBufSize = *pu8; -+ break; ++ case BTC_SET_BL_BT_CTRL_AGG_SIZE: ++ pBtCoexist->btInfo.bBtCtrlAggBufSize = *pu8; ++ break; + -+ case BTC_SET_BL_INC_SCAN_DEV_NUM: -+ pBtCoexist->btInfo.bIncreaseScanDevNum = *pu8; -+ break; ++ case BTC_SET_BL_INC_SCAN_DEV_NUM: ++ pBtCoexist->btInfo.bIncreaseScanDevNum = *pu8; ++ break; + -+ case BTC_SET_BL_BT_TX_RX_MASK: -+ pBtCoexist->btInfo.bBtTxRxMask = *pu8; -+ break; ++ case BTC_SET_BL_BT_TX_RX_MASK: ++ pBtCoexist->btInfo.bBtTxRxMask = *pu8; ++ break; + -+ /* set some u8 type variables. */ -+ case BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON: -+ pBtCoexist->btInfo.rssiAdjustForAgcTableOn = *pU1Tmp; -+ break; ++ /* set some u8 type variables. */ ++ case BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON: ++ pBtCoexist->btInfo.rssiAdjustForAgcTableOn = *pU1Tmp; ++ break; + -+ case BTC_SET_U1_AGG_BUF_SIZE: -+ pBtCoexist->btInfo.aggBufSize = *pU1Tmp; -+ break; ++ case BTC_SET_U1_AGG_BUF_SIZE: ++ pBtCoexist->btInfo.aggBufSize = *pU1Tmp; ++ break; + -+ /* the following are some action which will be triggered */ -+ case BTC_SET_ACT_GET_BT_RSSI: -+ ret = false; -+ break; ++ /* the following are some action which will be triggered */ ++ case BTC_SET_ACT_GET_BT_RSSI: ++ ret = false; ++ break; + -+ case BTC_SET_ACT_AGGREGATE_CTRL: -+ halbtcoutsrc_AggregationCheck(pBtCoexist); -+ break; ++ case BTC_SET_ACT_AGGREGATE_CTRL: ++ halbtcoutsrc_AggregationCheck(pBtCoexist); ++ break; + -+ /* 1Ant =========== */ -+ /* set some u8 type variables. */ -+ case BTC_SET_U1_RSSI_ADJ_VAL_FOR_1ANT_COEX_TYPE: -+ pBtCoexist->btInfo.rssiAdjustFor1AntCoexType = *pU1Tmp; -+ break; ++ /* 1Ant =========== */ ++ /* set some u8 type variables. */ ++ case BTC_SET_U1_RSSI_ADJ_VAL_FOR_1ANT_COEX_TYPE: ++ pBtCoexist->btInfo.rssiAdjustFor1AntCoexType = *pU1Tmp; ++ break; + -+ case BTC_SET_U1_LPS_VAL: -+ pBtCoexist->btInfo.lpsVal = *pU1Tmp; -+ break; ++ case BTC_SET_U1_LPS_VAL: ++ pBtCoexist->btInfo.lpsVal = *pU1Tmp; ++ break; + -+ case BTC_SET_U1_RPWM_VAL: -+ pBtCoexist->btInfo.rpwmVal = *pU1Tmp; -+ break; ++ case BTC_SET_U1_RPWM_VAL: ++ pBtCoexist->btInfo.rpwmVal = *pU1Tmp; ++ break; + -+ /* the following are some action which will be triggered */ -+ case BTC_SET_ACT_LEAVE_LPS: -+ halbtcoutsrc_LeaveLps(pBtCoexist); -+ break; ++ /* the following are some action which will be triggered */ ++ case BTC_SET_ACT_LEAVE_LPS: ++ halbtcoutsrc_LeaveLps(pBtCoexist); ++ break; + -+ case BTC_SET_ACT_ENTER_LPS: -+ halbtcoutsrc_EnterLps(pBtCoexist); -+ break; ++ case BTC_SET_ACT_ENTER_LPS: ++ halbtcoutsrc_EnterLps(pBtCoexist); ++ break; + -+ case BTC_SET_ACT_NORMAL_LPS: -+ halbtcoutsrc_NormalLps(pBtCoexist); -+ break; ++ case BTC_SET_ACT_NORMAL_LPS: ++ halbtcoutsrc_NormalLps(pBtCoexist); ++ break; + -+ case BTC_SET_ACT_DISABLE_LOW_POWER: -+ halbtcoutsrc_DisableLowPower(pBtCoexist, *pu8); -+ break; ++ case BTC_SET_ACT_DISABLE_LOW_POWER: ++ halbtcoutsrc_DisableLowPower(pBtCoexist, *pu8); ++ break; + -+ case BTC_SET_ACT_UPDATE_RAMASK: -+ pBtCoexist->btInfo.raMask = *pU4Tmp; ++ case BTC_SET_ACT_UPDATE_RAMASK: ++ pBtCoexist->btInfo.raMask = *pU4Tmp; + -+ if (check_fwstate(&padapter->mlmepriv, WIFI_ASOC_STATE) == true) -+ { -+ struct sta_info *psta; -+ struct wlan_bssid_ex * cur_network; ++ if (check_fwstate(&padapter->mlmepriv, WIFI_ASOC_STATE) == true) { ++ struct sta_info *psta; ++ struct wlan_bssid_ex *cur_network; + -+ cur_network = &padapter->mlmeextpriv.mlmext_info.network; -+ psta = rtw_get_stainfo(&padapter->stapriv, cur_network->MacAddress); -+ rtw_hal_update_ra_mask(psta, 0); -+ } -+ break; ++ cur_network = &padapter->mlmeextpriv.mlmext_info.network; ++ psta = rtw_get_stainfo(&padapter->stapriv, cur_network->MacAddress); ++ rtw_hal_update_ra_mask(psta, 0); ++ } ++ break; + -+ case BTC_SET_ACT_SEND_MIMO_PS: -+ ret = false; -+ break; ++ case BTC_SET_ACT_SEND_MIMO_PS: ++ ret = false; ++ break; + -+ case BTC_SET_ACT_CTRL_BT_INFO: -+ ret = false; -+ break; ++ case BTC_SET_ACT_CTRL_BT_INFO: ++ ret = false; ++ break; + -+ case BTC_SET_ACT_CTRL_BT_COEX: -+ ret = false; -+ break; -+ case BTC_SET_ACT_CTRL_8723B_ANT: -+ ret = false; -+ break; -+ /* */ -+ default: -+ ret = false; -+ break; ++ case BTC_SET_ACT_CTRL_BT_COEX: ++ ret = false; ++ break; ++ case BTC_SET_ACT_CTRL_8723B_ANT: ++ ret = false; ++ break; ++ /* */ ++ default: ++ ret = false; ++ break; + } + + return ret; @@ -44074,12 +42464,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd + originalValue = 0; + bitShift = 0; + -+ if (bitMask != 0xFF) -+ { ++ if (bitMask != 0xFF) { + originalValue = rtw_read8(padapter, regAddr); + -+ for (i = 0; i<=7; i++) -+ { ++ for (i = 0; i <= 7; i++) { + if ((bitMask>>i)&0x1) + break; + } @@ -44117,15 +42505,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd + +static void halbtcoutsrc_WriteLocalReg1Byte(void *pBtcContext, u32 RegAddr, u8 Data) +{ -+ PBTC_COEXIST pBtCoexist =(PBTC_COEXIST)pBtcContext; -+ struct adapter * Adapter =pBtCoexist->Adapter; ++ PBTC_COEXIST pBtCoexist = (PBTC_COEXIST)pBtcContext; ++ struct adapter *Adapter = pBtCoexist->Adapter; + -+ if (BTC_INTF_SDIO == pBtCoexist->chipInterface) -+ { ++ if (BTC_INTF_SDIO == pBtCoexist->chipInterface) { + rtw_write8(Adapter, SDIO_LOCAL_BASE | RegAddr, Data); -+ } -+ else -+ { ++ } else { + rtw_write8(Adapter, RegAddr, Data); + } +} @@ -44233,17 +42618,16 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd + + + pBtCoexist = (PBTC_COEXIST)pBtcContext; -+ switch (dispType) -+ { -+ case BTC_DBG_DISP_COEX_STATISTICS: -+ break; -+ case BTC_DBG_DISP_BT_LINK_INFO: -+ break; -+ case BTC_DBG_DISP_FW_PWR_MODE_CMD: -+ halbtcoutsrc_DisplayFwPwrModeCmd(pBtCoexist); -+ break; -+ default: -+ break; ++ switch (dispType) { ++ case BTC_DBG_DISP_COEX_STATISTICS: ++ break; ++ case BTC_DBG_DISP_BT_LINK_INFO: ++ break; ++ case BTC_DBG_DISP_FW_PWR_MODE_CMD: ++ halbtcoutsrc_DisplayFwPwrModeCmd(pBtCoexist); ++ break; ++ default: ++ break; + } +} + @@ -44252,7 +42636,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd +/* */ +static u8 EXhalbtcoutsrc_BindBtCoexWithAdapter(void *padapter) +{ -+ PBTC_COEXIST pBtCoexist =&GLBtCoexist; ++ PBTC_COEXIST pBtCoexist = &GLBtCoexist; + + if (pBtCoexist->bBinded) + return false; @@ -44422,13 +42806,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd + if (pBtCoexist->bManualControl) + return; + -+ if (type) -+ { ++ if (type) { + scanType = BTC_SCAN_START; + GLBtcWiFiInScanState = true; -+ } -+ else -+ { ++ } else { + scanType = BTC_SCAN_FINISH; + GLBtcWiFiInScanState = false; + } @@ -44513,8 +42894,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd + packetType = BTC_PACKET_EAPOL; + else if (PACKET_ARP == pktType) + packetType = BTC_PACKET_ARP; -+ else -+ { ++ else{ + packetType = BTC_PACKET_UNKNOWN; + return; + } @@ -44602,18 +42982,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd + +void EXhalbtcoutsrc_SetAntNum(u8 type, u8 antNum) +{ -+ if (BT_COEX_ANT_TYPE_PG == type) -+ { ++ if (BT_COEX_ANT_TYPE_PG == type) { + GLBtCoexist.boardInfo.pgAntNum = antNum; + GLBtCoexist.boardInfo.btdmAntNum = antNum; -+ } -+ else if (BT_COEX_ANT_TYPE_ANTDIV == type) -+ { ++ } else if (BT_COEX_ANT_TYPE_ANTDIV == type) { + GLBtCoexist.boardInfo.btdmAntNum = antNum; + /* GLBtCoexist.boardInfo.btdmAntPos = BTC_ANTENNA_AT_MAIN_PORT; */ -+ } -+ else if (BT_COEX_ANT_TYPE_DETECTED == type) -+ { ++ } else if (BT_COEX_ANT_TYPE_DETECTED == type) { + GLBtCoexist.boardInfo.btdmAntNum = antNum; + /* GLBtCoexist.boardInfo.btdmAntPos = BTC_ANTENNA_AT_MAIN_PORT; */ + } @@ -44718,8 +43093,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd + + + memset(&GLBtCoexist, 0, sizeof(GLBtCoexist)); -+ ret1 = EXhalbtcoutsrc_InitlizeVariables((void*)padapter); -+ ret2 = (ret1 ==true) ? true : false; ++ ret1 = EXhalbtcoutsrc_InitlizeVariables((void *)padapter); ++ ret2 = (ret1 == true) ? true : false; + + return ret2; +} @@ -44891,7 +43266,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_btcoex.c linux-4.3-rtl8723bs/3rd + if (NULL == pDbgModule) + return; + -+ for (i = 0; is0, 0 =>s1 */ ++ u8 btChipType; ++ u8 pgAntNum; /* pg ant number */ ++ u8 btdmAntNum; /* ant number for btdm */ ++ u8 btdmAntPos; /* Bryant Add to indicate Antenna Position for (pgAntNum = 2) && (btdmAntNum = 1) (DPDT+1Ant case) */ ++ u8 singleAntPath; /* current used for 8723b only, 1 =>s0, 0 =>s1 */ + /* bool bBtExist; */ +} BTC_BOARD_INFO, *PBTC_BOARD_INFO; + -+typedef enum _BTC_DBG_OPCODE{ -+ BTC_DBG_SET_COEX_NORMAL = 0x0, -+ BTC_DBG_SET_COEX_WIFI_ONLY = 0x1, -+ BTC_DBG_SET_COEX_BT_ONLY = 0x2, -+ BTC_DBG_SET_COEX_DEC_BT_PWR = 0x3, -+ BTC_DBG_SET_COEX_BT_AFH_MAP = 0x4, ++typedef enum _BTC_DBG_OPCODE { ++ BTC_DBG_SET_COEX_NORMAL = 0x0, ++ BTC_DBG_SET_COEX_WIFI_ONLY = 0x1, ++ BTC_DBG_SET_COEX_BT_ONLY = 0x2, ++ BTC_DBG_SET_COEX_DEC_BT_PWR = 0x3, ++ BTC_DBG_SET_COEX_BT_AFH_MAP = 0x4, + BTC_DBG_SET_COEX_BT_IGNORE_WLAN_ACT = 0x5, + BTC_DBG_MAX -+}BTC_DBG_OPCODE,*PBTC_DBG_OPCODE; ++} BTC_DBG_OPCODE, *PBTC_DBG_OPCODE; + -+typedef enum _BTC_RSSI_STATE{ -+ BTC_RSSI_STATE_HIGH = 0x0, ++typedef enum _BTC_RSSI_STATE { ++ BTC_RSSI_STATE_HIGH = 0x0, + BTC_RSSI_STATE_MEDIUM = 0x1, -+ BTC_RSSI_STATE_LOW = 0x2, ++ BTC_RSSI_STATE_LOW = 0x2, + BTC_RSSI_STATE_STAY_HIGH = 0x3, + BTC_RSSI_STATE_STAY_MEDIUM = 0x4, + BTC_RSSI_STATE_STAY_LOW = 0x5, + BTC_RSSI_MAX -+}BTC_RSSI_STATE,*PBTC_RSSI_STATE; -+#define BTC_RSSI_HIGH(_rssi_) ((_rssi_==BTC_RSSI_STATE_HIGH||_rssi_==BTC_RSSI_STATE_STAY_HIGH)? true:false) -+#define BTC_RSSI_MEDIUM(_rssi_) ((_rssi_==BTC_RSSI_STATE_MEDIUM||_rssi_==BTC_RSSI_STATE_STAY_MEDIUM)? true:false) -+#define BTC_RSSI_LOW(_rssi_) ((_rssi_==BTC_RSSI_STATE_LOW||_rssi_==BTC_RSSI_STATE_STAY_LOW)? true:false) ++} BTC_RSSI_STATE, *PBTC_RSSI_STATE; ++#define BTC_RSSI_HIGH(_rssi_) ((_rssi_ == BTC_RSSI_STATE_HIGH || _rssi_ == BTC_RSSI_STATE_STAY_HIGH) ? true : false) ++#define BTC_RSSI_MEDIUM(_rssi_) ((_rssi_ == BTC_RSSI_STATE_MEDIUM || _rssi_ == BTC_RSSI_STATE_STAY_MEDIUM) ? true : false) ++#define BTC_RSSI_LOW(_rssi_) ((_rssi_ == BTC_RSSI_STATE_LOW || _rssi_ == BTC_RSSI_STATE_STAY_LOW) ? true : false) + -+typedef enum _BTC_WIFI_ROLE{ ++typedef enum _BTC_WIFI_ROLE { + BTC_ROLE_STATION = 0x0, -+ BTC_ROLE_AP = 0x1, ++ BTC_ROLE_AP = 0x1, + BTC_ROLE_IBSS = 0x2, + BTC_ROLE_HS_MODE = 0x3, + BTC_ROLE_MAX -+}BTC_WIFI_ROLE,*PBTC_WIFI_ROLE; ++} BTC_WIFI_ROLE, *PBTC_WIFI_ROLE; + -+typedef enum _BTC_WIFI_BW_MODE{ ++typedef enum _BTC_WIFI_BW_MODE { + BTC_WIFI_BW_LEGACY = 0x0, + BTC_WIFI_BW_HT20 = 0x1, + BTC_WIFI_BW_HT40 = 0x2, + BTC_WIFI_BW_MAX -+}BTC_WIFI_BW_MODE,*PBTC_WIFI_BW_MODE; ++} BTC_WIFI_BW_MODE, *PBTC_WIFI_BW_MODE; + -+typedef enum _BTC_WIFI_TRAFFIC_DIR{ ++typedef enum _BTC_WIFI_TRAFFIC_DIR { + BTC_WIFI_TRAFFIC_TX = 0x0, + BTC_WIFI_TRAFFIC_RX = 0x1, + BTC_WIFI_TRAFFIC_MAX -+}BTC_WIFI_TRAFFIC_DIR,*PBTC_WIFI_TRAFFIC_DIR; ++} BTC_WIFI_TRAFFIC_DIR, *PBTC_WIFI_TRAFFIC_DIR; + -+typedef enum _BTC_WIFI_PNP{ -+ BTC_WIFI_PNP_WAKE_UP = 0x0, ++typedef enum _BTC_WIFI_PNP { ++ BTC_WIFI_PNP_WAKE_UP = 0x0, + BTC_WIFI_PNP_SLEEP = 0x1, + BTC_WIFI_PNP_MAX -+}BTC_WIFI_PNP,*PBTC_WIFI_PNP; ++} BTC_WIFI_PNP, *PBTC_WIFI_PNP; + +/* for 8723b-d cut large current issue */ -+typedef enum _BT_WIFI_COEX_STATE{ ++typedef enum _BT_WIFI_COEX_STATE { + BTC_WIFI_STAT_INIT, + BTC_WIFI_STAT_IQK, + BTC_WIFI_STAT_NORMAL_OFF, @@ -45271,10 +43641,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtcOutSrc.h linux-4.3-rtl8723bs/3 + BTC_WIFI_STAT_NORMAL, + BTC_WIFI_STAT_ANT_DIV, + BTC_WIFI_STAT_MAX -+}BT_WIFI_COEX_STATE,*PBT_WIFI_COEX_STATE; ++} BT_WIFI_COEX_STATE, *PBT_WIFI_COEX_STATE; + +/* defined for BFP_BTC_GET */ -+typedef enum _BTC_GET_TYPE{ ++typedef enum _BTC_GET_TYPE { + /* type bool */ + BTC_GET_BL_HS_OPERATION, + BTC_GET_BL_HS_CONNECTING, @@ -45313,10 +43683,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtcOutSrc.h linux-4.3-rtl8723bs/3 + BTC_GET_U1_LPS_MODE, + + BTC_GET_MAX -+}BTC_GET_TYPE,*PBTC_GET_TYPE; ++} BTC_GET_TYPE, *PBTC_GET_TYPE; + +/* defined for BFP_BTC_SET */ -+typedef enum _BTC_SET_TYPE{ ++typedef enum _BTC_SET_TYPE { + /* type bool */ + BTC_SET_BL_BT_DISABLE, + BTC_SET_BL_BT_TRAFFIC_BUSY, @@ -45354,386 +43724,250 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalBtcOutSrc.h linux-4.3-rtl8723bs/3 + BTC_SET_ACT_CTRL_8723B_ANT, + /* */ + BTC_SET_MAX -+}BTC_SET_TYPE,*PBTC_SET_TYPE; ++} BTC_SET_TYPE, *PBTC_SET_TYPE; + -+typedef enum _BTC_DBG_DISP_TYPE{ -+ BTC_DBG_DISP_COEX_STATISTICS = 0x0, -+ BTC_DBG_DISP_BT_LINK_INFO = 0x1, -+ BTC_DBG_DISP_FW_PWR_MODE_CMD = 0x2, ++typedef enum _BTC_DBG_DISP_TYPE { ++ BTC_DBG_DISP_COEX_STATISTICS = 0x0, ++ BTC_DBG_DISP_BT_LINK_INFO = 0x1, ++ BTC_DBG_DISP_FW_PWR_MODE_CMD = 0x2, + BTC_DBG_DISP_MAX -+}BTC_DBG_DISP_TYPE,*PBTC_DBG_DISP_TYPE; ++} BTC_DBG_DISP_TYPE, *PBTC_DBG_DISP_TYPE; + -+typedef enum _BTC_NOTIFY_TYPE_IPS{ -+ BTC_IPS_LEAVE = 0x0, -+ BTC_IPS_ENTER = 0x1, ++typedef enum _BTC_NOTIFY_TYPE_IPS { ++ BTC_IPS_LEAVE = 0x0, ++ BTC_IPS_ENTER = 0x1, + BTC_IPS_MAX -+}BTC_NOTIFY_TYPE_IPS,*PBTC_NOTIFY_TYPE_IPS; -+typedef enum _BTC_NOTIFY_TYPE_LPS{ -+ BTC_LPS_DISABLE = 0x0, -+ BTC_LPS_ENABLE = 0x1, ++} BTC_NOTIFY_TYPE_IPS, *PBTC_NOTIFY_TYPE_IPS; ++ ++typedef enum _BTC_NOTIFY_TYPE_LPS { ++ BTC_LPS_DISABLE = 0x0, ++ BTC_LPS_ENABLE = 0x1, + BTC_LPS_MAX -+}BTC_NOTIFY_TYPE_LPS,*PBTC_NOTIFY_TYPE_LPS; -+typedef enum _BTC_NOTIFY_TYPE_SCAN{ -+ BTC_SCAN_FINISH = 0x0, -+ BTC_SCAN_START = 0x1, ++} BTC_NOTIFY_TYPE_LPS, *PBTC_NOTIFY_TYPE_LPS; ++ ++typedef enum _BTC_NOTIFY_TYPE_SCAN { ++ BTC_SCAN_FINISH = 0x0, ++ BTC_SCAN_START = 0x1, + BTC_SCAN_MAX -+}BTC_NOTIFY_TYPE_SCAN,*PBTC_NOTIFY_TYPE_SCAN; -+typedef enum _BTC_NOTIFY_TYPE_ASSOCIATE{ -+ BTC_ASSOCIATE_FINISH = 0x0, -+ BTC_ASSOCIATE_START = 0x1, ++} BTC_NOTIFY_TYPE_SCAN, *PBTC_NOTIFY_TYPE_SCAN; ++ ++typedef enum _BTC_NOTIFY_TYPE_ASSOCIATE { ++ BTC_ASSOCIATE_FINISH = 0x0, ++ BTC_ASSOCIATE_START = 0x1, + BTC_ASSOCIATE_MAX -+}BTC_NOTIFY_TYPE_ASSOCIATE,*PBTC_NOTIFY_TYPE_ASSOCIATE; -+typedef enum _BTC_NOTIFY_TYPE_MEDIA_STATUS{ -+ BTC_MEDIA_DISCONNECT = 0x0, -+ BTC_MEDIA_CONNECT = 0x1, ++} BTC_NOTIFY_TYPE_ASSOCIATE, *PBTC_NOTIFY_TYPE_ASSOCIATE; ++ ++typedef enum _BTC_NOTIFY_TYPE_MEDIA_STATUS { ++ BTC_MEDIA_DISCONNECT = 0x0, ++ BTC_MEDIA_CONNECT = 0x1, + BTC_MEDIA_MAX -+}BTC_NOTIFY_TYPE_MEDIA_STATUS,*PBTC_NOTIFY_TYPE_MEDIA_STATUS; -+typedef enum _BTC_NOTIFY_TYPE_SPECIAL_PACKET{ ++} BTC_NOTIFY_TYPE_MEDIA_STATUS, *PBTC_NOTIFY_TYPE_MEDIA_STATUS; ++ ++typedef enum _BTC_NOTIFY_TYPE_SPECIAL_PACKET { + BTC_PACKET_UNKNOWN = 0x0, -+ BTC_PACKET_DHCP = 0x1, -+ BTC_PACKET_ARP = 0x2, -+ BTC_PACKET_EAPOL = 0x3, ++ BTC_PACKET_DHCP = 0x1, ++ BTC_PACKET_ARP = 0x2, ++ BTC_PACKET_EAPOL = 0x3, + BTC_PACKET_MAX -+}BTC_NOTIFY_TYPE_SPECIAL_PACKET,*PBTC_NOTIFY_TYPE_SPECIAL_PACKET; -+typedef enum _BTC_NOTIFY_TYPE_STACK_OPERATION{ ++} BTC_NOTIFY_TYPE_SPECIAL_PACKET, *PBTC_NOTIFY_TYPE_SPECIAL_PACKET; ++ ++typedef enum _BTC_NOTIFY_TYPE_STACK_OPERATION { + BTC_STACK_OP_NONE = 0x0, -+ BTC_STACK_OP_INQ_PAGE_PAIR_START = 0x1, ++ BTC_STACK_OP_INQ_PAGE_PAIR_START = 0x1, + BTC_STACK_OP_INQ_PAGE_PAIR_FINISH = 0x2, + BTC_STACK_OP_MAX -+}BTC_NOTIFY_TYPE_STACK_OPERATION,*PBTC_NOTIFY_TYPE_STACK_OPERATION; ++} BTC_NOTIFY_TYPE_STACK_OPERATION, *PBTC_NOTIFY_TYPE_STACK_OPERATION; + +/* Bryant Add */ -+typedef enum _BTC_ANTENNA_POS{ -+ BTC_ANTENNA_AT_MAIN_PORT = 0x1, -+ BTC_ANTENNA_AT_AUX_PORT = 0x2, -+}BTC_ANTENNA_POS,*PBTC_ANTENNA_POS; ++typedef enum _BTC_ANTENNA_POS { ++ BTC_ANTENNA_AT_MAIN_PORT = 0x1, ++ BTC_ANTENNA_AT_AUX_PORT = 0x2, ++} BTC_ANTENNA_POS, *PBTC_ANTENNA_POS; + -+typedef u8 -+(*BFP_BTC_R1)( -+void * pBtcContext, -+u32 RegAddr -+ ); -+typedef u16 -+(*BFP_BTC_R2)( -+void * pBtcContext, -+u32 RegAddr -+ ); -+typedef u32 -+(*BFP_BTC_R4)( -+void * pBtcContext, -+u32 RegAddr -+ ); -+typedef void -+(*BFP_BTC_W1)( -+void * pBtcContext, -+u32 RegAddr, -+u8 Data -+ ); -+typedef void -+(*BFP_BTC_W1_BIT_MASK)( -+void * pBtcContext, -+u32 regAddr, -+u8 bitMask, -+u8 data1b -+ ); -+typedef void -+(*BFP_BTC_W2)( -+void * pBtcContext, -+u32 RegAddr, -+u16 Data -+ ); -+typedef void -+(*BFP_BTC_W4)( -+void * pBtcContext, -+u32 RegAddr, -+u32 Data -+ ); -+typedef void -+(*BFP_BTC_LOCAL_REG_W1)( -+void * pBtcContext, -+u32 RegAddr, -+u8 Data -+ ); -+typedef void -+(*BFP_BTC_SET_BB_REG)( -+void * pBtcContext, -+u32 RegAddr, -+u32 BitMask, -+u32 Data -+ ); -+typedef u32 -+(*BFP_BTC_GET_BB_REG)( -+void * pBtcContext, -+u32 RegAddr, -+u32 BitMask -+ ); -+typedef void -+(*BFP_BTC_SET_RF_REG)( -+void * pBtcContext, -+u8 eRFPath, -+u32 RegAddr, -+u32 BitMask, -+u32 Data -+ ); -+typedef u32 -+(*BFP_BTC_GET_RF_REG)( -+void * pBtcContext, -+u8 eRFPath, -+u32 RegAddr, -+u32 BitMask -+ ); -+typedef void -+(*BFP_BTC_FILL_H2C)( -+void * pBtcContext, -+u8 elementId, -+u32 cmdLen, -+u8 * pCmdBuffer -+ ); ++typedef u8 (*BFP_BTC_R1)(void *pBtcContext, u32 RegAddr); ++typedef u16(*BFP_BTC_R2)(void *pBtcContext, u32 RegAddr); ++typedef u32 (*BFP_BTC_R4)(void *pBtcContext, u32 RegAddr); ++typedef void (*BFP_BTC_W1)(void *pBtcContext, u32 RegAddr, u8 Data); ++typedef void(*BFP_BTC_W1_BIT_MASK)( ++ void *pBtcContext, u32 regAddr, u8 bitMask, u8 data1b ++); ++typedef void (*BFP_BTC_W2)(void *pBtcContext, u32 RegAddr, u16 Data); ++typedef void (*BFP_BTC_W4)(void *pBtcContext, u32 RegAddr, u32 Data); ++typedef void (*BFP_BTC_LOCAL_REG_W1)(void *pBtcContext, u32 RegAddr, u8 Data); ++typedef void (*BFP_BTC_SET_BB_REG)( ++ void *pBtcContext, u32 RegAddr, u32 BitMask, u32 Data ++); ++typedef u32 (*BFP_BTC_GET_BB_REG)(void *pBtcContext, u32 RegAddr, u32 BitMask); ++typedef void (*BFP_BTC_SET_RF_REG)( ++ void *pBtcContext, u8 eRFPath, u32 RegAddr, u32 BitMask, u32 Data ++); ++typedef u32 (*BFP_BTC_GET_RF_REG)( ++ void *pBtcContext, u8 eRFPath, u32 RegAddr, u32 BitMask ++); ++typedef void (*BFP_BTC_FILL_H2C)( ++ void *pBtcContext, u8 elementId, u32 cmdLen, u8 *pCmdBuffer ++); + -+typedef u8 -+(*BFP_BTC_GET)( -+void * pBtCoexist, -+u8 getType, -+ void * pOutBuf -+ ); ++typedef u8 (*BFP_BTC_GET)(void *pBtCoexist, u8 getType, void *pOutBuf); + -+typedef u8 -+(*BFP_BTC_SET)( -+void * pBtCoexist, -+u8 setType, -+ void * pInBuf -+ ); -+typedef void -+(*BFP_BTC_SET_BT_REG)( -+void * pBtcContext, -+u8 regType, -+u32 offset, -+u32 value -+ ); -+typedef u32 -+(*BFP_BTC_GET_BT_REG)( -+void * pBtcContext, -+u8 regType, -+u32 offset -+ ); -+typedef void -+(*BFP_BTC_DISP_DBG_MSG)( -+void * pBtCoexist, -+u8 dispType -+ ); ++typedef u8 (*BFP_BTC_SET)(void *pBtCoexist, u8 setType, void *pInBuf); ++typedef void (*BFP_BTC_SET_BT_REG)( ++ void *pBtcContext, u8 regType, u32 offset, u32 value ++); ++typedef u32 (*BFP_BTC_GET_BT_REG)(void *pBtcContext, u8 regType, u32 offset); ++typedef void (*BFP_BTC_DISP_DBG_MSG)(void *pBtCoexist, u8 dispType); + -+typedef struct _BTC_BT_INFO{ -+ bool bBtDisabled; -+ u8 rssiAdjustForAgcTableOn; -+ u8 rssiAdjustFor1AntCoexType; -+ bool bPreBtCtrlAggBufSize; -+ bool bBtCtrlAggBufSize; -+ bool bRejectAggPkt; -+ bool bIncreaseScanDevNum; -+ bool bBtTxRxMask; -+ u8 preAggBufSize; -+ u8 aggBufSize; -+ bool bBtBusy; -+ bool bLimitedDig; -+ u16 btHciVer; -+ u16 btRealFwVer; -+ u8 btFwVer; -+ u32 getBtFwVerCnt; ++typedef struct _BTC_BT_INFO { ++ bool bBtDisabled; ++ u8 rssiAdjustForAgcTableOn; ++ u8 rssiAdjustFor1AntCoexType; ++ bool bPreBtCtrlAggBufSize; ++ bool bBtCtrlAggBufSize; ++ bool bRejectAggPkt; ++ bool bIncreaseScanDevNum; ++ bool bBtTxRxMask; ++ u8 preAggBufSize; ++ u8 aggBufSize; ++ bool bBtBusy; ++ bool bLimitedDig; ++ u16 btHciVer; ++ u16 btRealFwVer; ++ u8 btFwVer; ++ u32 getBtFwVerCnt; + -+ bool bBtDisableLowPwr; ++ bool bBtDisableLowPwr; + -+ bool bBtCtrlLps; -+ bool bBtLpsOn; -+ bool bForceToRoam; /* for 1Ant solution */ -+ u8 lpsVal; -+ u8 rpwmVal; -+ u32 raMask; ++ bool bBtCtrlLps; ++ bool bBtLpsOn; ++ bool bForceToRoam; /* for 1Ant solution */ ++ u8 lpsVal; ++ u8 rpwmVal; ++ u32 raMask; +} BTC_BT_INFO, *PBTC_BT_INFO; + -+typedef struct _BTC_STACK_INFO{ -+ bool bProfileNotified; -+ u16 hciVersion; /* stack hci version */ -+ u8 numOfLink; -+ bool bBtLinkExist; -+ bool bScoExist; -+ bool bAclExist; -+ bool bA2dpExist; -+ bool bHidExist; -+ u8 numOfHid; -+ bool bPanExist; -+ bool bUnknownAclExist; -+ s8 minBtRssi; ++typedef struct _BTC_STACK_INFO { ++ bool bProfileNotified; ++ u16 hciVersion; /* stack hci version */ ++ u8 numOfLink; ++ bool bBtLinkExist; ++ bool bScoExist; ++ bool bAclExist; ++ bool bA2dpExist; ++ bool bHidExist; ++ u8 numOfHid; ++ bool bPanExist; ++ bool bUnknownAclExist; ++ s8 minBtRssi; +} BTC_STACK_INFO, *PBTC_STACK_INFO; + -+typedef struct _BTC_BT_LINK_INFO{ -+ bool bBtLinkExist; -+ bool bScoExist; -+ bool bScoOnly; -+ bool bA2dpExist; -+ bool bA2dpOnly; -+ bool bHidExist; -+ bool bHidOnly; -+ bool bPanExist; -+ bool bPanOnly; -+ bool bSlaveRole; ++typedef struct _BTC_BT_LINK_INFO { ++ bool bBtLinkExist; ++ bool bScoExist; ++ bool bScoOnly; ++ bool bA2dpExist; ++ bool bA2dpOnly; ++ bool bHidExist; ++ bool bHidOnly; ++ bool bPanExist; ++ bool bPanOnly; ++ bool bSlaveRole; +} BTC_BT_LINK_INFO, *PBTC_BT_LINK_INFO; + -+typedef struct _BTC_STATISTICS{ -+ u32 cntBind; -+ u32 cntPowerOn; -+ u32 cntInitHwConfig; -+ u32 cntInitCoexDm; -+ u32 cntIpsNotify; -+ u32 cntLpsNotify; -+ u32 cntScanNotify; -+ u32 cntConnectNotify; -+ u32 cntMediaStatusNotify; -+ u32 cntSpecialPacketNotify; -+ u32 cntBtInfoNotify; -+ u32 cntRfStatusNotify; -+ u32 cntPeriodical; -+ u32 cntCoexDmSwitch; -+ u32 cntStackOperationNotify; -+ u32 cntDbgCtrl; ++typedef struct _BTC_STATISTICS { ++ u32 cntBind; ++ u32 cntPowerOn; ++ u32 cntInitHwConfig; ++ u32 cntInitCoexDm; ++ u32 cntIpsNotify; ++ u32 cntLpsNotify; ++ u32 cntScanNotify; ++ u32 cntConnectNotify; ++ u32 cntMediaStatusNotify; ++ u32 cntSpecialPacketNotify; ++ u32 cntBtInfoNotify; ++ u32 cntRfStatusNotify; ++ u32 cntPeriodical; ++ u32 cntCoexDmSwitch; ++ u32 cntStackOperationNotify; ++ u32 cntDbgCtrl; +} BTC_STATISTICS, *PBTC_STATISTICS; + -+typedef struct _BTC_COEXIST{ -+ bool bBinded; /* make sure only one adapter can bind the data context */ -+ void * Adapter; /* default adapter */ -+ BTC_BOARD_INFO boardInfo; -+ BTC_BT_INFO btInfo; /* some bt info referenced by non-bt module */ -+ BTC_STACK_INFO stackInfo; -+ BTC_BT_LINK_INFO btLinkInfo; -+ BTC_CHIP_INTERFACE chipInterface; ++typedef struct _BTC_COEXIST { ++ bool bBinded; /* make sure only one adapter can bind the data context */ ++ void *Adapter; /* default adapter */ ++ BTC_BOARD_INFO boardInfo; ++ BTC_BT_INFO btInfo; /* some bt info referenced by non-bt module */ ++ BTC_STACK_INFO stackInfo; ++ BTC_BT_LINK_INFO btLinkInfo; ++ BTC_CHIP_INTERFACE chipInterface; + -+ bool bInitilized; -+ bool bStopCoexDm; -+ bool bManualControl; -+ u8 * cliBuf; -+ BTC_STATISTICS statistics; -+ u8 pwrModeVal[10]; ++ bool bInitilized; ++ bool bStopCoexDm; ++ bool bManualControl; ++ u8 *cliBuf; ++ BTC_STATISTICS statistics; ++ u8 pwrModeVal[10]; + + /* function pointers */ + /* io related */ -+ BFP_BTC_R1 fBtcRead1Byte; -+ BFP_BTC_W1 fBtcWrite1Byte; -+ BFP_BTC_W1_BIT_MASK fBtcWrite1ByteBitMask; -+ BFP_BTC_R2 fBtcRead2Byte; -+ BFP_BTC_W2 fBtcWrite2Byte; -+ BFP_BTC_R4 fBtcRead4Byte; -+ BFP_BTC_W4 fBtcWrite4Byte; -+ BFP_BTC_LOCAL_REG_W1 fBtcWriteLocalReg1Byte; ++ BFP_BTC_R1 fBtcRead1Byte; ++ BFP_BTC_W1 fBtcWrite1Byte; ++ BFP_BTC_W1_BIT_MASK fBtcWrite1ByteBitMask; ++ BFP_BTC_R2 fBtcRead2Byte; ++ BFP_BTC_W2 fBtcWrite2Byte; ++ BFP_BTC_R4 fBtcRead4Byte; ++ BFP_BTC_W4 fBtcWrite4Byte; ++ BFP_BTC_LOCAL_REG_W1 fBtcWriteLocalReg1Byte; + /* read/write bb related */ -+ BFP_BTC_SET_BB_REG fBtcSetBbReg; -+ BFP_BTC_GET_BB_REG fBtcGetBbReg; ++ BFP_BTC_SET_BB_REG fBtcSetBbReg; ++ BFP_BTC_GET_BB_REG fBtcGetBbReg; + + /* read/write rf related */ -+ BFP_BTC_SET_RF_REG fBtcSetRfReg; -+ BFP_BTC_GET_RF_REG fBtcGetRfReg; ++ BFP_BTC_SET_RF_REG fBtcSetRfReg; ++ BFP_BTC_GET_RF_REG fBtcGetRfReg; + + /* fill h2c related */ -+ BFP_BTC_FILL_H2C fBtcFillH2c; ++ BFP_BTC_FILL_H2C fBtcFillH2c; + /* other */ -+ BFP_BTC_DISP_DBG_MSG fBtcDispDbgMsg; ++ BFP_BTC_DISP_DBG_MSG fBtcDispDbgMsg; + /* normal get/set related */ -+ BFP_BTC_GET fBtcGet; -+ BFP_BTC_SET fBtcSet; ++ BFP_BTC_GET fBtcGet; ++ BFP_BTC_SET fBtcSet; + -+ BFP_BTC_GET_BT_REG fBtcGetBtReg; -+ BFP_BTC_SET_BT_REG fBtcSetBtReg; ++ BFP_BTC_GET_BT_REG fBtcGetBtReg; ++ BFP_BTC_SET_BT_REG fBtcSetBtReg; +} BTC_COEXIST, *PBTC_COEXIST; + -+extern BTC_COEXIST GLBtCoexist; ++extern BTC_COEXIST GLBtCoexist; + -+u8 -+EXhalbtcoutsrc_InitlizeVariables( -+void * Adapter -+ ); -+void -+EXhalbtcoutsrc_PowerOnSetting( -+PBTC_COEXIST pBtCoexist -+ ); -+void -+EXhalbtcoutsrc_InitHwConfig( -+PBTC_COEXIST pBtCoexist, -+u8 bWifiOnly -+ ); -+void -+EXhalbtcoutsrc_InitCoexDm( -+PBTC_COEXIST pBtCoexist -+ ); -+void -+EXhalbtcoutsrc_IpsNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ); -+void -+EXhalbtcoutsrc_LpsNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ); -+void -+EXhalbtcoutsrc_ScanNotify( -+PBTC_COEXIST pBtCoexist, -+u8 type -+ ); -+void -+EXhalbtcoutsrc_ConnectNotify( -+PBTC_COEXIST pBtCoexist, -+u8 action -+ ); -+void -+EXhalbtcoutsrc_MediaStatusNotify( -+PBTC_COEXIST pBtCoexist, -+RT_MEDIA_STATUS mediaStatus -+ ); -+void -+EXhalbtcoutsrc_SpecialPacketNotify( -+PBTC_COEXIST pBtCoexist, -+u8 pktType -+ ); -+void -+EXhalbtcoutsrc_BtInfoNotify( -+PBTC_COEXIST pBtCoexist, -+u8 * tmpBuf, -+u8 length -+ ); -+void -+EXhalbtcoutsrc_HaltNotify( -+PBTC_COEXIST pBtCoexist -+ ); -+void -+EXhalbtcoutsrc_PnpNotify( -+PBTC_COEXIST pBtCoexist, -+u8 pnpState -+ ); -+void -+EXhalbtcoutsrc_Periodical( -+PBTC_COEXIST pBtCoexist -+ ); -+void -+EXhalbtcoutsrc_SetChipType( -+u8 chipType -+ ); -+void -+EXhalbtcoutsrc_SetAntNum( -+u8 type, -+u8 antNum -+ ); -+void -+EXhalbtcoutsrc_SetSingleAntPath( -+u8 singleAntPath -+ ); -+void -+EXhalbtcoutsrc_DisplayBtCoexInfo( -+PBTC_COEXIST pBtCoexist -+ ); ++u8 EXhalbtcoutsrc_InitlizeVariables(void *Adapter); ++void EXhalbtcoutsrc_PowerOnSetting(PBTC_COEXIST pBtCoexist); ++void EXhalbtcoutsrc_InitHwConfig(PBTC_COEXIST pBtCoexist, u8 bWifiOnly); ++void EXhalbtcoutsrc_InitCoexDm(PBTC_COEXIST pBtCoexist); ++void EXhalbtcoutsrc_IpsNotify(PBTC_COEXIST pBtCoexist, u8 type); ++void EXhalbtcoutsrc_LpsNotify(PBTC_COEXIST pBtCoexist, u8 type); ++void EXhalbtcoutsrc_ScanNotify(PBTC_COEXIST pBtCoexist, u8 type); ++void EXhalbtcoutsrc_ConnectNotify(PBTC_COEXIST pBtCoexist, u8 action); ++void EXhalbtcoutsrc_MediaStatusNotify( ++ PBTC_COEXIST pBtCoexist, RT_MEDIA_STATUS mediaStatus ++); ++void EXhalbtcoutsrc_SpecialPacketNotify(PBTC_COEXIST pBtCoexist, u8 pktType); ++void EXhalbtcoutsrc_BtInfoNotify( ++ PBTC_COEXIST pBtCoexist, u8 *tmpBuf, u8 length ++); ++void EXhalbtcoutsrc_HaltNotify(PBTC_COEXIST pBtCoexist); ++void EXhalbtcoutsrc_PnpNotify(PBTC_COEXIST pBtCoexist, u8 pnpState); ++void EXhalbtcoutsrc_Periodical(PBTC_COEXIST pBtCoexist); ++void EXhalbtcoutsrc_SetChipType(u8 chipType); ++void EXhalbtcoutsrc_SetAntNum(u8 type, u8 antNum); ++void EXhalbtcoutsrc_SetSingleAntPath(u8 singleAntPath); ++void EXhalbtcoutsrc_DisplayBtCoexInfo(PBTC_COEXIST pBtCoexist); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/hal_com.c ---- linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/hal_com.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,1464 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/hal_com.c linux/3rdparty/rtl8723bs/hal/hal_com.c +--- linux.old/3rdparty/rtl8723bs/hal/hal_com.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/hal_com.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,1753 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -45758,8 +43992,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + +u8 rtw_hal_data_init(struct adapter *padapter) +{ -+ if (is_primary_adapter(padapter)) /* if (padapter->isprimary) */ -+ { ++ if (is_primary_adapter(padapter)) { /* if (padapter->isprimary) */ + padapter->hal_data_sz = sizeof(struct hal_com_data); + padapter->HalData = vzalloc(padapter->hal_data_sz); + if (padapter->HalData == NULL) { @@ -45772,10 +44005,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + +void rtw_hal_data_deinit(struct adapter *padapter) +{ -+ if (is_primary_adapter(padapter)) /* if (padapter->isprimary) */ -+ { -+ if (padapter->HalData) -+ { ++ if (is_primary_adapter(padapter)) { /* if (padapter->isprimary) */ ++ if (padapter->HalData) { + #ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE + phy_free_filebuf(padapter); + #endif @@ -45793,28 +44024,41 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + u8 buf[128]; + + cnt += sprintf((buf+cnt), "Chip Version Info: CHIP_8723B_"); -+ cnt += sprintf((buf+cnt), "%s_", IS_NORMAL_CHIP(ChipVersion)?"Normal_Chip":"Test_Chip"); ++ cnt += sprintf((buf+cnt), "%s_", IS_NORMAL_CHIP(ChipVersion) ? "Normal_Chip" : "Test_Chip"); + if (IS_CHIP_VENDOR_TSMC(ChipVersion)) -+ cnt += sprintf((buf+cnt), "%s_","TSMC"); ++ cnt += sprintf((buf+cnt), "%s_", "TSMC"); + else if (IS_CHIP_VENDOR_UMC(ChipVersion)) -+ cnt += sprintf((buf+cnt), "%s_","UMC"); ++ cnt += sprintf((buf+cnt), "%s_", "UMC"); + else if (IS_CHIP_VENDOR_SMIC(ChipVersion)) -+ cnt += sprintf((buf+cnt), "%s_","SMIC"); ++ cnt += sprintf((buf+cnt), "%s_", "SMIC"); + -+ if (IS_A_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "A_CUT_"); -+ else if (IS_B_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "B_CUT_"); -+ else if (IS_C_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "C_CUT_"); -+ else if (IS_D_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "D_CUT_"); -+ else if (IS_E_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "E_CUT_"); -+ else if (IS_I_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "I_CUT_"); -+ else if (IS_J_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "J_CUT_"); -+ else if (IS_K_CUT(ChipVersion)) cnt += sprintf((buf+cnt), "K_CUT_"); -+ else cnt += sprintf((buf+cnt), "UNKNOWN_CUT(%d)_", ChipVersion.CUTVersion); ++ if (IS_A_CUT(ChipVersion)) ++ cnt += sprintf((buf+cnt), "A_CUT_"); ++ else if (IS_B_CUT(ChipVersion)) ++ cnt += sprintf((buf+cnt), "B_CUT_"); ++ else if (IS_C_CUT(ChipVersion)) ++ cnt += sprintf((buf+cnt), "C_CUT_"); ++ else if (IS_D_CUT(ChipVersion)) ++ cnt += sprintf((buf+cnt), "D_CUT_"); ++ else if (IS_E_CUT(ChipVersion)) ++ cnt += sprintf((buf+cnt), "E_CUT_"); ++ else if (IS_I_CUT(ChipVersion)) ++ cnt += sprintf((buf+cnt), "I_CUT_"); ++ else if (IS_J_CUT(ChipVersion)) ++ cnt += sprintf((buf+cnt), "J_CUT_"); ++ else if (IS_K_CUT(ChipVersion)) ++ cnt += sprintf((buf+cnt), "K_CUT_"); ++ else ++ cnt += sprintf((buf+cnt), "UNKNOWN_CUT(%d)_", ChipVersion.CUTVersion); + -+ if (IS_1T1R(ChipVersion)) cnt += sprintf((buf+cnt), "1T1R_"); -+ else if (IS_1T2R(ChipVersion)) cnt += sprintf((buf+cnt), "1T2R_"); -+ else if (IS_2T2R(ChipVersion)) cnt += sprintf((buf+cnt), "2T2R_"); -+ else cnt += sprintf((buf+cnt), "UNKNOWN_RFTYPE(%d)_", ChipVersion.RFType); ++ if (IS_1T1R(ChipVersion)) ++ cnt += sprintf((buf+cnt), "1T1R_"); ++ else if (IS_1T2R(ChipVersion)) ++ cnt += sprintf((buf+cnt), "1T2R_"); ++ else if (IS_2T2R(ChipVersion)) ++ cnt += sprintf((buf+cnt), "2T2R_"); ++ else ++ cnt += sprintf((buf+cnt), "UNKNOWN_RFTYPE(%d)_", ChipVersion.RFType); + + cnt += sprintf((buf+cnt), "RomVer(%d)\n", ChipVersion.ROMVer); + @@ -45842,14 +44086,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + *Final channel plan decision + * + */ -+u8 -+hal_com_config_channel_plan( -+struct adapter *padapter, -+u8 hw_channel_plan, -+u8 sw_channel_plan, -+u8 def_channel_plan, -+bool AutoLoadFail -+ ) ++u8 hal_com_config_channel_plan( ++ struct adapter *padapter, ++ u8 hw_channel_plan, ++ u8 sw_channel_plan, ++ u8 def_channel_plan, ++ bool AutoLoadFail ++) +{ + struct hal_com_data *pHalData; + u8 chnlPlan; @@ -45861,13 +44104,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + if (0xFF == hw_channel_plan) + AutoLoadFail = true; + -+ if (false == AutoLoadFail) -+ { ++ if (false == AutoLoadFail) { + u8 hw_chnlPlan; + + hw_chnlPlan = hw_channel_plan & (~EEPROM_CHANNEL_PLAN_BY_HW_MASK); -+ if (rtw_is_channel_plan_valid(hw_chnlPlan)) -+ { ++ if (rtw_is_channel_plan_valid(hw_chnlPlan)) { +#ifndef CONFIG_SW_CHANNEL_PLAN + if (hw_channel_plan & EEPROM_CHANNEL_PLAN_BY_HW_MASK) + pHalData->bDisableSWChannelPlan = true; @@ -45877,20 +44118,16 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + } + } + -+ if ((false == pHalData->bDisableSWChannelPlan) -+ && rtw_is_channel_plan_valid(sw_channel_plan)) -+ { ++ if ( ++ (false == pHalData->bDisableSWChannelPlan) && ++ rtw_is_channel_plan_valid(sw_channel_plan) ++ ) + chnlPlan = sw_channel_plan; -+ } + + return chnlPlan; +} + -+bool -+HAL_IsLegalChannel( -+struct adapter *Adapter, -+u32 Channel -+ ) ++bool HAL_IsLegalChannel(struct adapter *Adapter, u32 Channel) +{ + bool bLegalChannel = true; + @@ -45914,95 +44151,261 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar +{ + u8 ret = DESC_RATE1M; + -+ switch (rate) -+ { -+ case MGN_1M: ret = DESC_RATE1M; break; -+ case MGN_2M: ret = DESC_RATE2M; break; -+ case MGN_5_5M: ret = DESC_RATE5_5M; break; -+ case MGN_11M: ret = DESC_RATE11M; break; -+ case MGN_6M: ret = DESC_RATE6M; break; -+ case MGN_9M: ret = DESC_RATE9M; break; -+ case MGN_12M: ret = DESC_RATE12M; break; -+ case MGN_18M: ret = DESC_RATE18M; break; -+ case MGN_24M: ret = DESC_RATE24M; break; -+ case MGN_36M: ret = DESC_RATE36M; break; -+ case MGN_48M: ret = DESC_RATE48M; break; -+ case MGN_54M: ret = DESC_RATE54M; break; -+ -+ case MGN_MCS0: ret = DESC_RATEMCS0; break; -+ case MGN_MCS1: ret = DESC_RATEMCS1; break; -+ case MGN_MCS2: ret = DESC_RATEMCS2; break; -+ case MGN_MCS3: ret = DESC_RATEMCS3; break; -+ case MGN_MCS4: ret = DESC_RATEMCS4; break; -+ case MGN_MCS5: ret = DESC_RATEMCS5; break; -+ case MGN_MCS6: ret = DESC_RATEMCS6; break; -+ case MGN_MCS7: ret = DESC_RATEMCS7; break; -+ case MGN_MCS8: ret = DESC_RATEMCS8; break; -+ case MGN_MCS9: ret = DESC_RATEMCS9; break; -+ case MGN_MCS10: ret = DESC_RATEMCS10; break; -+ case MGN_MCS11: ret = DESC_RATEMCS11; break; -+ case MGN_MCS12: ret = DESC_RATEMCS12; break; -+ case MGN_MCS13: ret = DESC_RATEMCS13; break; -+ case MGN_MCS14: ret = DESC_RATEMCS14; break; -+ case MGN_MCS15: ret = DESC_RATEMCS15; break; -+ case MGN_MCS16: ret = DESC_RATEMCS16; break; -+ case MGN_MCS17: ret = DESC_RATEMCS17; break; -+ case MGN_MCS18: ret = DESC_RATEMCS18; break; -+ case MGN_MCS19: ret = DESC_RATEMCS19; break; -+ case MGN_MCS20: ret = DESC_RATEMCS20; break; -+ case MGN_MCS21: ret = DESC_RATEMCS21; break; -+ case MGN_MCS22: ret = DESC_RATEMCS22; break; -+ case MGN_MCS23: ret = DESC_RATEMCS23; break; -+ case MGN_MCS24: ret = DESC_RATEMCS24; break; -+ case MGN_MCS25: ret = DESC_RATEMCS25; break; -+ case MGN_MCS26: ret = DESC_RATEMCS26; break; -+ case MGN_MCS27: ret = DESC_RATEMCS27; break; -+ case MGN_MCS28: ret = DESC_RATEMCS28; break; -+ case MGN_MCS29: ret = DESC_RATEMCS29; break; -+ case MGN_MCS30: ret = DESC_RATEMCS30; break; -+ case MGN_MCS31: ret = DESC_RATEMCS31; break; -+ -+ case MGN_VHT1SS_MCS0: ret = DESC_RATEVHTSS1MCS0; break; -+ case MGN_VHT1SS_MCS1: ret = DESC_RATEVHTSS1MCS1; break; -+ case MGN_VHT1SS_MCS2: ret = DESC_RATEVHTSS1MCS2; break; -+ case MGN_VHT1SS_MCS3: ret = DESC_RATEVHTSS1MCS3; break; -+ case MGN_VHT1SS_MCS4: ret = DESC_RATEVHTSS1MCS4; break; -+ case MGN_VHT1SS_MCS5: ret = DESC_RATEVHTSS1MCS5; break; -+ case MGN_VHT1SS_MCS6: ret = DESC_RATEVHTSS1MCS6; break; -+ case MGN_VHT1SS_MCS7: ret = DESC_RATEVHTSS1MCS7; break; -+ case MGN_VHT1SS_MCS8: ret = DESC_RATEVHTSS1MCS8; break; -+ case MGN_VHT1SS_MCS9: ret = DESC_RATEVHTSS1MCS9; break; -+ case MGN_VHT2SS_MCS0: ret = DESC_RATEVHTSS2MCS0; break; -+ case MGN_VHT2SS_MCS1: ret = DESC_RATEVHTSS2MCS1; break; -+ case MGN_VHT2SS_MCS2: ret = DESC_RATEVHTSS2MCS2; break; -+ case MGN_VHT2SS_MCS3: ret = DESC_RATEVHTSS2MCS3; break; -+ case MGN_VHT2SS_MCS4: ret = DESC_RATEVHTSS2MCS4; break; -+ case MGN_VHT2SS_MCS5: ret = DESC_RATEVHTSS2MCS5; break; -+ case MGN_VHT2SS_MCS6: ret = DESC_RATEVHTSS2MCS6; break; -+ case MGN_VHT2SS_MCS7: ret = DESC_RATEVHTSS2MCS7; break; -+ case MGN_VHT2SS_MCS8: ret = DESC_RATEVHTSS2MCS8; break; -+ case MGN_VHT2SS_MCS9: ret = DESC_RATEVHTSS2MCS9; break; -+ case MGN_VHT3SS_MCS0: ret = DESC_RATEVHTSS3MCS0; break; -+ case MGN_VHT3SS_MCS1: ret = DESC_RATEVHTSS3MCS1; break; -+ case MGN_VHT3SS_MCS2: ret = DESC_RATEVHTSS3MCS2; break; -+ case MGN_VHT3SS_MCS3: ret = DESC_RATEVHTSS3MCS3; break; -+ case MGN_VHT3SS_MCS4: ret = DESC_RATEVHTSS3MCS4; break; -+ case MGN_VHT3SS_MCS5: ret = DESC_RATEVHTSS3MCS5; break; -+ case MGN_VHT3SS_MCS6: ret = DESC_RATEVHTSS3MCS6; break; -+ case MGN_VHT3SS_MCS7: ret = DESC_RATEVHTSS3MCS7; break; -+ case MGN_VHT3SS_MCS8: ret = DESC_RATEVHTSS3MCS8; break; -+ case MGN_VHT3SS_MCS9: ret = DESC_RATEVHTSS3MCS9; break; -+ case MGN_VHT4SS_MCS0: ret = DESC_RATEVHTSS4MCS0; break; -+ case MGN_VHT4SS_MCS1: ret = DESC_RATEVHTSS4MCS1; break; -+ case MGN_VHT4SS_MCS2: ret = DESC_RATEVHTSS4MCS2; break; -+ case MGN_VHT4SS_MCS3: ret = DESC_RATEVHTSS4MCS3; break; -+ case MGN_VHT4SS_MCS4: ret = DESC_RATEVHTSS4MCS4; break; -+ case MGN_VHT4SS_MCS5: ret = DESC_RATEVHTSS4MCS5; break; -+ case MGN_VHT4SS_MCS6: ret = DESC_RATEVHTSS4MCS6; break; -+ case MGN_VHT4SS_MCS7: ret = DESC_RATEVHTSS4MCS7; break; -+ case MGN_VHT4SS_MCS8: ret = DESC_RATEVHTSS4MCS8; break; -+ case MGN_VHT4SS_MCS9: ret = DESC_RATEVHTSS4MCS9; break; -+ default: break; ++ switch (rate) { ++ case MGN_1M: ++ ret = DESC_RATE1M; ++ break; ++ case MGN_2M: ++ ret = DESC_RATE2M; ++ break; ++ case MGN_5_5M: ++ ret = DESC_RATE5_5M; ++ break; ++ case MGN_11M: ++ ret = DESC_RATE11M; ++ break; ++ case MGN_6M: ++ ret = DESC_RATE6M; ++ break; ++ case MGN_9M: ++ ret = DESC_RATE9M; ++ break; ++ case MGN_12M: ++ ret = DESC_RATE12M; ++ break; ++ case MGN_18M: ++ ret = DESC_RATE18M; ++ break; ++ case MGN_24M: ++ ret = DESC_RATE24M; ++ break; ++ case MGN_36M: ++ ret = DESC_RATE36M; ++ break; ++ case MGN_48M: ++ ret = DESC_RATE48M; ++ break; ++ case MGN_54M: ++ ret = DESC_RATE54M; ++ break; ++ case MGN_MCS0: ++ ret = DESC_RATEMCS0; ++ break; ++ case MGN_MCS1: ++ ret = DESC_RATEMCS1; ++ break; ++ case MGN_MCS2: ++ ret = DESC_RATEMCS2; ++ break; ++ case MGN_MCS3: ++ ret = DESC_RATEMCS3; ++ break; ++ case MGN_MCS4: ++ ret = DESC_RATEMCS4; ++ break; ++ case MGN_MCS5: ++ ret = DESC_RATEMCS5; ++ break; ++ case MGN_MCS6: ++ ret = DESC_RATEMCS6; ++ break; ++ case MGN_MCS7: ++ ret = DESC_RATEMCS7; ++ break; ++ case MGN_MCS8: ++ ret = DESC_RATEMCS8; ++ break; ++ case MGN_MCS9: ++ ret = DESC_RATEMCS9; ++ break; ++ case MGN_MCS10: ++ ret = DESC_RATEMCS10; ++ break; ++ case MGN_MCS11: ++ ret = DESC_RATEMCS11; ++ break; ++ case MGN_MCS12: ++ ret = DESC_RATEMCS12; ++ break; ++ case MGN_MCS13: ++ ret = DESC_RATEMCS13; ++ break; ++ case MGN_MCS14: ++ ret = DESC_RATEMCS14; ++ break; ++ case MGN_MCS15: ++ ret = DESC_RATEMCS15; ++ break; ++ case MGN_MCS16: ++ ret = DESC_RATEMCS16; ++ break; ++ case MGN_MCS17: ++ ret = DESC_RATEMCS17; ++ break; ++ case MGN_MCS18: ++ ret = DESC_RATEMCS18; ++ break; ++ case MGN_MCS19: ++ ret = DESC_RATEMCS19; ++ break; ++ case MGN_MCS20: ++ ret = DESC_RATEMCS20; ++ break; ++ case MGN_MCS21: ++ ret = DESC_RATEMCS21; ++ break; ++ case MGN_MCS22: ++ ret = DESC_RATEMCS22; ++ break; ++ case MGN_MCS23: ++ ret = DESC_RATEMCS23; ++ break; ++ case MGN_MCS24: ++ ret = DESC_RATEMCS24; ++ break; ++ case MGN_MCS25: ++ ret = DESC_RATEMCS25; ++ break; ++ case MGN_MCS26: ++ ret = DESC_RATEMCS26; ++ break; ++ case MGN_MCS27: ++ ret = DESC_RATEMCS27; ++ break; ++ case MGN_MCS28: ++ ret = DESC_RATEMCS28; ++ break; ++ case MGN_MCS29: ++ ret = DESC_RATEMCS29; ++ break; ++ case MGN_MCS30: ++ ret = DESC_RATEMCS30; ++ break; ++ case MGN_MCS31: ++ ret = DESC_RATEMCS31; ++ break; ++ case MGN_VHT1SS_MCS0: ++ ret = DESC_RATEVHTSS1MCS0; ++ break; ++ case MGN_VHT1SS_MCS1: ++ ret = DESC_RATEVHTSS1MCS1; ++ break; ++ case MGN_VHT1SS_MCS2: ++ ret = DESC_RATEVHTSS1MCS2; ++ break; ++ case MGN_VHT1SS_MCS3: ++ ret = DESC_RATEVHTSS1MCS3; ++ break; ++ case MGN_VHT1SS_MCS4: ++ ret = DESC_RATEVHTSS1MCS4; ++ break; ++ case MGN_VHT1SS_MCS5: ++ ret = DESC_RATEVHTSS1MCS5; ++ break; ++ case MGN_VHT1SS_MCS6: ++ ret = DESC_RATEVHTSS1MCS6; ++ break; ++ case MGN_VHT1SS_MCS7: ++ ret = DESC_RATEVHTSS1MCS7; ++ break; ++ case MGN_VHT1SS_MCS8: ++ ret = DESC_RATEVHTSS1MCS8; ++ break; ++ case MGN_VHT1SS_MCS9: ++ ret = DESC_RATEVHTSS1MCS9; ++ break; ++ case MGN_VHT2SS_MCS0: ++ ret = DESC_RATEVHTSS2MCS0; ++ break; ++ case MGN_VHT2SS_MCS1: ++ ret = DESC_RATEVHTSS2MCS1; ++ break; ++ case MGN_VHT2SS_MCS2: ++ ret = DESC_RATEVHTSS2MCS2; ++ break; ++ case MGN_VHT2SS_MCS3: ++ ret = DESC_RATEVHTSS2MCS3; ++ break; ++ case MGN_VHT2SS_MCS4: ++ ret = DESC_RATEVHTSS2MCS4; ++ break; ++ case MGN_VHT2SS_MCS5: ++ ret = DESC_RATEVHTSS2MCS5; ++ break; ++ case MGN_VHT2SS_MCS6: ++ ret = DESC_RATEVHTSS2MCS6; ++ break; ++ case MGN_VHT2SS_MCS7: ++ ret = DESC_RATEVHTSS2MCS7; ++ break; ++ case MGN_VHT2SS_MCS8: ++ ret = DESC_RATEVHTSS2MCS8; ++ break; ++ case MGN_VHT2SS_MCS9: ++ ret = DESC_RATEVHTSS2MCS9; ++ break; ++ case MGN_VHT3SS_MCS0: ++ ret = DESC_RATEVHTSS3MCS0; ++ break; ++ case MGN_VHT3SS_MCS1: ++ ret = DESC_RATEVHTSS3MCS1; ++ break; ++ case MGN_VHT3SS_MCS2: ++ ret = DESC_RATEVHTSS3MCS2; ++ break; ++ case MGN_VHT3SS_MCS3: ++ ret = DESC_RATEVHTSS3MCS3; ++ break; ++ case MGN_VHT3SS_MCS4: ++ ret = DESC_RATEVHTSS3MCS4; ++ break; ++ case MGN_VHT3SS_MCS5: ++ ret = DESC_RATEVHTSS3MCS5; ++ break; ++ case MGN_VHT3SS_MCS6: ++ ret = DESC_RATEVHTSS3MCS6; ++ break; ++ case MGN_VHT3SS_MCS7: ++ ret = DESC_RATEVHTSS3MCS7; ++ break; ++ case MGN_VHT3SS_MCS8: ++ ret = DESC_RATEVHTSS3MCS8; ++ break; ++ case MGN_VHT3SS_MCS9: ++ ret = DESC_RATEVHTSS3MCS9; ++ break; ++ case MGN_VHT4SS_MCS0: ++ ret = DESC_RATEVHTSS4MCS0; ++ break; ++ case MGN_VHT4SS_MCS1: ++ ret = DESC_RATEVHTSS4MCS1; ++ break; ++ case MGN_VHT4SS_MCS2: ++ ret = DESC_RATEVHTSS4MCS2; ++ break; ++ case MGN_VHT4SS_MCS3: ++ ret = DESC_RATEVHTSS4MCS3; ++ break; ++ case MGN_VHT4SS_MCS4: ++ ret = DESC_RATEVHTSS4MCS4; ++ break; ++ case MGN_VHT4SS_MCS5: ++ ret = DESC_RATEVHTSS4MCS5; ++ break; ++ case MGN_VHT4SS_MCS6: ++ ret = DESC_RATEVHTSS4MCS6; ++ break; ++ case MGN_VHT4SS_MCS7: ++ ret = DESC_RATEVHTSS4MCS7; ++ break; ++ case MGN_VHT4SS_MCS8: ++ ret = DESC_RATEVHTSS4MCS8; ++ break; ++ case MGN_VHT4SS_MCS9: ++ ret = DESC_RATEVHTSS4MCS9; ++ break; ++ default: ++ break; + } + + return ret; @@ -46012,97 +44415,263 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar +{ + u8 ret_rate = MGN_1M; + -+ switch (rate) -+ { ++ switch (rate) { ++ case DESC_RATE1M: ++ ret_rate = MGN_1M; ++ break; ++ case DESC_RATE2M: ++ ret_rate = MGN_2M; ++ break; ++ case DESC_RATE5_5M: ++ ret_rate = MGN_5_5M; ++ break; ++ case DESC_RATE11M: ++ ret_rate = MGN_11M; ++ break; ++ case DESC_RATE6M: ++ ret_rate = MGN_6M; ++ break; ++ case DESC_RATE9M: ++ ret_rate = MGN_9M; ++ break; ++ case DESC_RATE12M: ++ ret_rate = MGN_12M; ++ break; ++ case DESC_RATE18M: ++ ret_rate = MGN_18M; ++ break; ++ case DESC_RATE24M: ++ ret_rate = MGN_24M; ++ break; ++ case DESC_RATE36M: ++ ret_rate = MGN_36M; ++ break; ++ case DESC_RATE48M: ++ ret_rate = MGN_48M; ++ break; ++ case DESC_RATE54M: ++ ret_rate = MGN_54M; ++ break; ++ case DESC_RATEMCS0: ++ ret_rate = MGN_MCS0; ++ break; ++ case DESC_RATEMCS1: ++ ret_rate = MGN_MCS1; ++ break; ++ case DESC_RATEMCS2: ++ ret_rate = MGN_MCS2; ++ break; ++ case DESC_RATEMCS3: ++ ret_rate = MGN_MCS3; ++ break; ++ case DESC_RATEMCS4: ++ ret_rate = MGN_MCS4; ++ break; ++ case DESC_RATEMCS5: ++ ret_rate = MGN_MCS5; ++ break; ++ case DESC_RATEMCS6: ++ ret_rate = MGN_MCS6; ++ break; ++ case DESC_RATEMCS7: ++ ret_rate = MGN_MCS7; ++ break; ++ case DESC_RATEMCS8: ++ ret_rate = MGN_MCS8; ++ break; ++ case DESC_RATEMCS9: ++ ret_rate = MGN_MCS9; ++ break; ++ case DESC_RATEMCS10: ++ ret_rate = MGN_MCS10; ++ break; ++ case DESC_RATEMCS11: ++ ret_rate = MGN_MCS11; ++ break; ++ case DESC_RATEMCS12: ++ ret_rate = MGN_MCS12; ++ break; ++ case DESC_RATEMCS13: ++ ret_rate = MGN_MCS13; ++ break; ++ case DESC_RATEMCS14: ++ ret_rate = MGN_MCS14; ++ break; ++ case DESC_RATEMCS15: ++ ret_rate = MGN_MCS15; ++ break; ++ case DESC_RATEMCS16: ++ ret_rate = MGN_MCS16; ++ break; ++ case DESC_RATEMCS17: ++ ret_rate = MGN_MCS17; ++ break; ++ case DESC_RATEMCS18: ++ ret_rate = MGN_MCS18; ++ break; ++ case DESC_RATEMCS19: ++ ret_rate = MGN_MCS19; ++ break; ++ case DESC_RATEMCS20: ++ ret_rate = MGN_MCS20; ++ break; ++ case DESC_RATEMCS21: ++ ret_rate = MGN_MCS21; ++ break; ++ case DESC_RATEMCS22: ++ ret_rate = MGN_MCS22; ++ break; ++ case DESC_RATEMCS23: ++ ret_rate = MGN_MCS23; ++ break; ++ case DESC_RATEMCS24: ++ ret_rate = MGN_MCS24; ++ break; ++ case DESC_RATEMCS25: ++ ret_rate = MGN_MCS25; ++ break; ++ case DESC_RATEMCS26: ++ ret_rate = MGN_MCS26; ++ break; ++ case DESC_RATEMCS27: ++ ret_rate = MGN_MCS27; ++ break; ++ case DESC_RATEMCS28: ++ ret_rate = MGN_MCS28; ++ break; ++ case DESC_RATEMCS29: ++ ret_rate = MGN_MCS29; ++ break; ++ case DESC_RATEMCS30: ++ ret_rate = MGN_MCS30; ++ break; ++ case DESC_RATEMCS31: ++ ret_rate = MGN_MCS31; ++ break; ++ case DESC_RATEVHTSS1MCS0: ++ ret_rate = MGN_VHT1SS_MCS0; ++ break; ++ case DESC_RATEVHTSS1MCS1: ++ ret_rate = MGN_VHT1SS_MCS1; ++ break; ++ case DESC_RATEVHTSS1MCS2: ++ ret_rate = MGN_VHT1SS_MCS2; ++ break; ++ case DESC_RATEVHTSS1MCS3: ++ ret_rate = MGN_VHT1SS_MCS3; ++ break; ++ case DESC_RATEVHTSS1MCS4: ++ ret_rate = MGN_VHT1SS_MCS4; ++ break; ++ case DESC_RATEVHTSS1MCS5: ++ ret_rate = MGN_VHT1SS_MCS5; ++ break; ++ case DESC_RATEVHTSS1MCS6: ++ ret_rate = MGN_VHT1SS_MCS6; ++ break; ++ case DESC_RATEVHTSS1MCS7: ++ ret_rate = MGN_VHT1SS_MCS7; ++ break; ++ case DESC_RATEVHTSS1MCS8: ++ ret_rate = MGN_VHT1SS_MCS8; ++ break; ++ case DESC_RATEVHTSS1MCS9: ++ ret_rate = MGN_VHT1SS_MCS9; ++ break; ++ case DESC_RATEVHTSS2MCS0: ++ ret_rate = MGN_VHT2SS_MCS0; ++ break; ++ case DESC_RATEVHTSS2MCS1: ++ ret_rate = MGN_VHT2SS_MCS1; ++ break; ++ case DESC_RATEVHTSS2MCS2: ++ ret_rate = MGN_VHT2SS_MCS2; ++ break; ++ case DESC_RATEVHTSS2MCS3: ++ ret_rate = MGN_VHT2SS_MCS3; ++ break; ++ case DESC_RATEVHTSS2MCS4: ++ ret_rate = MGN_VHT2SS_MCS4; ++ break; ++ case DESC_RATEVHTSS2MCS5: ++ ret_rate = MGN_VHT2SS_MCS5; ++ break; ++ case DESC_RATEVHTSS2MCS6: ++ ret_rate = MGN_VHT2SS_MCS6; ++ break; ++ case DESC_RATEVHTSS2MCS7: ++ ret_rate = MGN_VHT2SS_MCS7; ++ break; ++ case DESC_RATEVHTSS2MCS8: ++ ret_rate = MGN_VHT2SS_MCS8; ++ break; ++ case DESC_RATEVHTSS2MCS9: ++ ret_rate = MGN_VHT2SS_MCS9; ++ break; ++ case DESC_RATEVHTSS3MCS0: ++ ret_rate = MGN_VHT3SS_MCS0; ++ break; ++ case DESC_RATEVHTSS3MCS1: ++ ret_rate = MGN_VHT3SS_MCS1; ++ break; ++ case DESC_RATEVHTSS3MCS2: ++ ret_rate = MGN_VHT3SS_MCS2; ++ break; ++ case DESC_RATEVHTSS3MCS3: ++ ret_rate = MGN_VHT3SS_MCS3; ++ break; ++ case DESC_RATEVHTSS3MCS4: ++ ret_rate = MGN_VHT3SS_MCS4; ++ break; ++ case DESC_RATEVHTSS3MCS5: ++ ret_rate = MGN_VHT3SS_MCS5; ++ break; ++ case DESC_RATEVHTSS3MCS6: ++ ret_rate = MGN_VHT3SS_MCS6; ++ break; ++ case DESC_RATEVHTSS3MCS7: ++ ret_rate = MGN_VHT3SS_MCS7; ++ break; ++ case DESC_RATEVHTSS3MCS8: ++ ret_rate = MGN_VHT3SS_MCS8; ++ break; ++ case DESC_RATEVHTSS3MCS9: ++ ret_rate = MGN_VHT3SS_MCS9; ++ break; ++ case DESC_RATEVHTSS4MCS0: ++ ret_rate = MGN_VHT4SS_MCS0; ++ break; ++ case DESC_RATEVHTSS4MCS1: ++ ret_rate = MGN_VHT4SS_MCS1; ++ break; ++ case DESC_RATEVHTSS4MCS2: ++ ret_rate = MGN_VHT4SS_MCS2; ++ break; ++ case DESC_RATEVHTSS4MCS3: ++ ret_rate = MGN_VHT4SS_MCS3; ++ break; ++ case DESC_RATEVHTSS4MCS4: ++ ret_rate = MGN_VHT4SS_MCS4; ++ break; ++ case DESC_RATEVHTSS4MCS5: ++ ret_rate = MGN_VHT4SS_MCS5; ++ break; ++ case DESC_RATEVHTSS4MCS6: ++ ret_rate = MGN_VHT4SS_MCS6; ++ break; ++ case DESC_RATEVHTSS4MCS7: ++ ret_rate = MGN_VHT4SS_MCS7; ++ break; ++ case DESC_RATEVHTSS4MCS8: ++ ret_rate = MGN_VHT4SS_MCS8; ++ break; ++ case DESC_RATEVHTSS4MCS9: ++ ret_rate = MGN_VHT4SS_MCS9; ++ break; + -+ case DESC_RATE1M: ret_rate = MGN_1M; break; -+ case DESC_RATE2M: ret_rate = MGN_2M; break; -+ case DESC_RATE5_5M: ret_rate = MGN_5_5M; break; -+ case DESC_RATE11M: ret_rate = MGN_11M; break; -+ case DESC_RATE6M: ret_rate = MGN_6M; break; -+ case DESC_RATE9M: ret_rate = MGN_9M; break; -+ case DESC_RATE12M: ret_rate = MGN_12M; break; -+ case DESC_RATE18M: ret_rate = MGN_18M; break; -+ case DESC_RATE24M: ret_rate = MGN_24M; break; -+ case DESC_RATE36M: ret_rate = MGN_36M; break; -+ case DESC_RATE48M: ret_rate = MGN_48M; break; -+ case DESC_RATE54M: ret_rate = MGN_54M; break; -+ case DESC_RATEMCS0: ret_rate = MGN_MCS0; break; -+ case DESC_RATEMCS1: ret_rate = MGN_MCS1; break; -+ case DESC_RATEMCS2: ret_rate = MGN_MCS2; break; -+ case DESC_RATEMCS3: ret_rate = MGN_MCS3; break; -+ case DESC_RATEMCS4: ret_rate = MGN_MCS4; break; -+ case DESC_RATEMCS5: ret_rate = MGN_MCS5; break; -+ case DESC_RATEMCS6: ret_rate = MGN_MCS6; break; -+ case DESC_RATEMCS7: ret_rate = MGN_MCS7; break; -+ case DESC_RATEMCS8: ret_rate = MGN_MCS8; break; -+ case DESC_RATEMCS9: ret_rate = MGN_MCS9; break; -+ case DESC_RATEMCS10: ret_rate = MGN_MCS10; break; -+ case DESC_RATEMCS11: ret_rate = MGN_MCS11; break; -+ case DESC_RATEMCS12: ret_rate = MGN_MCS12; break; -+ case DESC_RATEMCS13: ret_rate = MGN_MCS13; break; -+ case DESC_RATEMCS14: ret_rate = MGN_MCS14; break; -+ case DESC_RATEMCS15: ret_rate = MGN_MCS15; break; -+ case DESC_RATEMCS16: ret_rate = MGN_MCS16; break; -+ case DESC_RATEMCS17: ret_rate = MGN_MCS17; break; -+ case DESC_RATEMCS18: ret_rate = MGN_MCS18; break; -+ case DESC_RATEMCS19: ret_rate = MGN_MCS19; break; -+ case DESC_RATEMCS20: ret_rate = MGN_MCS20; break; -+ case DESC_RATEMCS21: ret_rate = MGN_MCS21; break; -+ case DESC_RATEMCS22: ret_rate = MGN_MCS22; break; -+ case DESC_RATEMCS23: ret_rate = MGN_MCS23; break; -+ case DESC_RATEMCS24: ret_rate = MGN_MCS24; break; -+ case DESC_RATEMCS25: ret_rate = MGN_MCS25; break; -+ case DESC_RATEMCS26: ret_rate = MGN_MCS26; break; -+ case DESC_RATEMCS27: ret_rate = MGN_MCS27; break; -+ case DESC_RATEMCS28: ret_rate = MGN_MCS28; break; -+ case DESC_RATEMCS29: ret_rate = MGN_MCS29; break; -+ case DESC_RATEMCS30: ret_rate = MGN_MCS30; break; -+ case DESC_RATEMCS31: ret_rate = MGN_MCS31; break; -+ case DESC_RATEVHTSS1MCS0: ret_rate = MGN_VHT1SS_MCS0; break; -+ case DESC_RATEVHTSS1MCS1: ret_rate = MGN_VHT1SS_MCS1; break; -+ case DESC_RATEVHTSS1MCS2: ret_rate = MGN_VHT1SS_MCS2; break; -+ case DESC_RATEVHTSS1MCS3: ret_rate = MGN_VHT1SS_MCS3; break; -+ case DESC_RATEVHTSS1MCS4: ret_rate = MGN_VHT1SS_MCS4; break; -+ case DESC_RATEVHTSS1MCS5: ret_rate = MGN_VHT1SS_MCS5; break; -+ case DESC_RATEVHTSS1MCS6: ret_rate = MGN_VHT1SS_MCS6; break; -+ case DESC_RATEVHTSS1MCS7: ret_rate = MGN_VHT1SS_MCS7; break; -+ case DESC_RATEVHTSS1MCS8: ret_rate = MGN_VHT1SS_MCS8; break; -+ case DESC_RATEVHTSS1MCS9: ret_rate = MGN_VHT1SS_MCS9; break; -+ case DESC_RATEVHTSS2MCS0: ret_rate = MGN_VHT2SS_MCS0; break; -+ case DESC_RATEVHTSS2MCS1: ret_rate = MGN_VHT2SS_MCS1; break; -+ case DESC_RATEVHTSS2MCS2: ret_rate = MGN_VHT2SS_MCS2; break; -+ case DESC_RATEVHTSS2MCS3: ret_rate = MGN_VHT2SS_MCS3; break; -+ case DESC_RATEVHTSS2MCS4: ret_rate = MGN_VHT2SS_MCS4; break; -+ case DESC_RATEVHTSS2MCS5: ret_rate = MGN_VHT2SS_MCS5; break; -+ case DESC_RATEVHTSS2MCS6: ret_rate = MGN_VHT2SS_MCS6; break; -+ case DESC_RATEVHTSS2MCS7: ret_rate = MGN_VHT2SS_MCS7; break; -+ case DESC_RATEVHTSS2MCS8: ret_rate = MGN_VHT2SS_MCS8; break; -+ case DESC_RATEVHTSS2MCS9: ret_rate = MGN_VHT2SS_MCS9; break; -+ case DESC_RATEVHTSS3MCS0: ret_rate = MGN_VHT3SS_MCS0; break; -+ case DESC_RATEVHTSS3MCS1: ret_rate = MGN_VHT3SS_MCS1; break; -+ case DESC_RATEVHTSS3MCS2: ret_rate = MGN_VHT3SS_MCS2; break; -+ case DESC_RATEVHTSS3MCS3: ret_rate = MGN_VHT3SS_MCS3; break; -+ case DESC_RATEVHTSS3MCS4: ret_rate = MGN_VHT3SS_MCS4; break; -+ case DESC_RATEVHTSS3MCS5: ret_rate = MGN_VHT3SS_MCS5; break; -+ case DESC_RATEVHTSS3MCS6: ret_rate = MGN_VHT3SS_MCS6; break; -+ case DESC_RATEVHTSS3MCS7: ret_rate = MGN_VHT3SS_MCS7; break; -+ case DESC_RATEVHTSS3MCS8: ret_rate = MGN_VHT3SS_MCS8; break; -+ case DESC_RATEVHTSS3MCS9: ret_rate = MGN_VHT3SS_MCS9; break; -+ case DESC_RATEVHTSS4MCS0: ret_rate = MGN_VHT4SS_MCS0; break; -+ case DESC_RATEVHTSS4MCS1: ret_rate = MGN_VHT4SS_MCS1; break; -+ case DESC_RATEVHTSS4MCS2: ret_rate = MGN_VHT4SS_MCS2; break; -+ case DESC_RATEVHTSS4MCS3: ret_rate = MGN_VHT4SS_MCS3; break; -+ case DESC_RATEVHTSS4MCS4: ret_rate = MGN_VHT4SS_MCS4; break; -+ case DESC_RATEVHTSS4MCS5: ret_rate = MGN_VHT4SS_MCS5; break; -+ case DESC_RATEVHTSS4MCS6: ret_rate = MGN_VHT4SS_MCS6; break; -+ case DESC_RATEVHTSS4MCS7: ret_rate = MGN_VHT4SS_MCS7; break; -+ case DESC_RATEVHTSS4MCS8: ret_rate = MGN_VHT4SS_MCS8; break; -+ case DESC_RATEVHTSS4MCS9: ret_rate = MGN_VHT4SS_MCS9; break; -+ -+ default: -+ DBG_871X("HwRateToMRate(): Non supported Rate [%x]!!!\n", rate); -+ break; ++ default: ++ DBG_871X("HwRateToMRate(): Non supported Rate [%x]!!!\n", rate); ++ break; + } + + return ret_rate; @@ -46112,7 +44681,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar +{ + u8 i, is_brate, brate; + -+ for (i = 0;i < NDIS_802_11_LENGTH_RATES_EX; i++) { ++ for (i = 0; i < NDIS_802_11_LENGTH_RATES_EX; i++) { ++ + is_brate = mBratesOS[i] & IEEE80211_BASIC_RATE_MASK; + brate = mBratesOS[i] & 0x7f; + @@ -46174,11 +44744,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */ +} + -+static void -+_TwoOutPipeMapping( -+struct adapter *padapter, -+bool bWIFICfg -+ ) ++static void _TwoOutPipeMapping(struct adapter *padapter, bool bWIFICfg) +{ + struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); + @@ -46198,8 +44764,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];/* HIGH */ + pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */ + -+ } -+ else {/* typical setting */ ++ } else { /* typical setting */ + + + /* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */ @@ -46220,14 +44785,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + +} + -+static void _ThreeOutPipeMapping( -+struct adapter *padapter, -+bool bWIFICfg -+ ) ++static void _ThreeOutPipeMapping(struct adapter *padapter, bool bWIFICfg) +{ + struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); + -+ if (bWIFICfg) {/* for WMM */ ++ if (bWIFICfg) { /* for WMM */ + + /* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */ + /* 1, 2, 1, 0, 0, 0, 0, 0, 0 }; */ @@ -46243,8 +44805,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + pdvobjpriv->Queue2Pipe[6] = pdvobjpriv->RtOutPipe[0];/* HIGH */ + pdvobjpriv->Queue2Pipe[7] = pdvobjpriv->RtOutPipe[0];/* TXCMD */ + -+ } -+ else {/* typical setting */ ++ } else { /* typical setting */ + + + /* BK, BE, VI, VO, BCN, CMD, MGT, HIGH, HCCA */ @@ -46264,33 +44825,28 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + +} + -+bool -+Hal_MappingOutPipe( -+struct adapter *padapter, -+u8 NumOutPipe -+ ) ++bool Hal_MappingOutPipe(struct adapter *padapter, u8 NumOutPipe) +{ + struct registry_priv *pregistrypriv = &padapter->registrypriv; + -+ bool bWIFICfg = (pregistrypriv->wifi_spec) ?true:false; ++ bool bWIFICfg = (pregistrypriv->wifi_spec) ? true : false; + + bool result = true; + -+ switch (NumOutPipe) -+ { -+ case 2: -+ _TwoOutPipeMapping(padapter, bWIFICfg); -+ break; -+ case 3: -+ case 4: -+ _ThreeOutPipeMapping(padapter, bWIFICfg); -+ break; -+ case 1: -+ _OneOutPipeMapping(padapter); -+ break; -+ default: -+ result = false; -+ break; ++ switch (NumOutPipe) { ++ case 2: ++ _TwoOutPipeMapping(padapter, bWIFICfg); ++ break; ++ case 3: ++ case 4: ++ _ThreeOutPipeMapping(padapter, bWIFICfg); ++ break; ++ case 1: ++ _OneOutPipeMapping(padapter); ++ break; ++ default: ++ result = false; ++ break; + } + + return result; @@ -46302,7 +44858,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + rtw_hal_set_hwreg(adapter, HW_VAR_MAC_ADDR, adapter->eeprompriv.mac_addr); +} + -+void rtw_init_hal_com_default_value(struct adapter * Adapter) ++void rtw_init_hal_com_default_value(struct adapter *Adapter) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + @@ -46337,11 +44893,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + + trigger = rtw_read8(adapter, REG_C2HEVT_CLEAR); + -+ if (trigger == C2H_EVT_HOST_CLOSE) { ++ if (trigger == C2H_EVT_HOST_CLOSE) + goto exit; /* Not ready */ -+ } else if (trigger != C2H_EVT_FW_CLOSE) { ++ else if (trigger != C2H_EVT_FW_CLOSE) + goto clear_evt; /* Not a valid value */ -+ } + + c2h_evt = (struct c2h_evt_hdr_88xx *)buf; + @@ -46351,11 +44906,22 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + c2h_evt->seq = rtw_read8(adapter, REG_C2HEVT_CMD_SEQ_88XX); + c2h_evt->plen = rtw_read8(adapter, REG_C2HEVT_CMD_LEN_88XX); + -+ RT_PRINT_DATA(_module_hal_init_c_, _drv_info_, "c2h_evt_read(): ", -+ &c2h_evt , sizeof(c2h_evt)); ++ RT_PRINT_DATA( ++ _module_hal_init_c_, ++ _drv_info_, ++ "c2h_evt_read(): ", ++ &c2h_evt, ++ sizeof(c2h_evt) ++ ); + -+ DBG_871X("%s id:%u, len:%u, seq:%u, trigger:0x%02x\n", __func__ -+ , c2h_evt->id, c2h_evt->plen, c2h_evt->seq, trigger); ++ DBG_871X( ++ "%s id:%u, len:%u, seq:%u, trigger:0x%02x\n", ++ __func__, ++ c2h_evt->id, ++ c2h_evt->plen, ++ c2h_evt->seq, ++ trigger ++ ); + + /* Read the content */ + for (i = 0; i < c2h_evt->plen; i++) @@ -46381,12 +44947,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar +{ + return networktype_to_raid_ex(adapter, psta); +} ++ +u8 rtw_get_mgntframe_raid(struct adapter *adapter, unsigned char network_type) +{ + + u8 raid; -+ raid = (network_type & WIRELESS_11B) ?RATEID_IDX_B -+ :RATEID_IDX_G; ++ raid = (network_type & WIRELESS_11B) ? RATEID_IDX_B : RATEID_IDX_G; + return raid; +} + @@ -46396,29 +44962,25 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + u32 tx_ra_bitmap; + + if (psta == NULL) -+ { + return; -+ } + + tx_ra_bitmap = 0; + + /* b/g mode ra_bitmap */ -+ for (i = 0; ibssrateset); i++) -+ { ++ for (i = 0; i < sizeof(psta->bssrateset); i++) { + if (psta->bssrateset[i]) + tx_ra_bitmap |= rtw_get_bit_value_from_ieee_value(psta->bssrateset[i]&0x7f); + } + + /* n mode ra_bitmap */ -+ if (psta->htpriv.ht_option) -+ { ++ if (psta->htpriv.ht_option) { + rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); + if (rf_type == RF_2T2R) -+ limit = 16;/* 2R */ ++ limit = 16; /* 2R */ + else -+ limit =8;/* 1R */ ++ limit = 8; /* 1R */ + -+ for (i = 0; ihtpriv.ht_cap.supp_mcs_set[i/8] & BIT(i%8)) + tx_ra_bitmap |= BIT(i+12); + } @@ -46428,7 +44990,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + psta->init_rate = get_highest_rate_idx(tx_ra_bitmap)&0x3f; +} + -+void hw_var_port_switch (struct adapter *adapter) ++void hw_var_port_switch(struct adapter *adapter) +{ +} + @@ -46439,7 +45001,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + + switch (variable) { + case HW_VAR_PORT_SWITCH: -+ hw_var_port_switch (adapter); ++ hw_var_port_switch(adapter); + break; + case HW_VAR_INIT_RTS_RATE: + rtw_warn_on(1); @@ -46457,22 +45019,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + struct security_priv *sec = &adapter->securitypriv; + u8 reg_scr = rtw_read8(adapter, REG_SECCFG); + -+ if (val) /* Enable default key related setting */ -+ { ++ if (val) { /* Enable default key related setting */ + reg_scr |= SCR_TXBCUSEDK; + if (sec->dot11AuthAlgrthm != dot11AuthAlgrthm_8021X) + reg_scr |= (SCR_RxUseDK|SCR_TxUseDK); -+ } -+ else /* Disable default key related setting */ -+ { ++ } else /* Disable default key related setting */ + reg_scr &= ~(SCR_RXBCUSEDK|SCR_TXBCUSEDK|SCR_RxUseDK|SCR_TxUseDK); -+ } + + rtw_write8(adapter, REG_SECCFG, reg_scr); + } + break; + case HW_VAR_DM_FLAG: -+ odm->SupportAbility = *((u32*)val); ++ odm->SupportAbility = *((u32 *)val); + break; + case HW_VAR_DM_FUNC_OP: + if (*((u8 *)val) == true) { @@ -46484,7 +45042,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + } + break; + case HW_VAR_DM_FUNC_SET: -+ if (*((u32*)val) == DYNAMIC_ALL_FUNC_ENABLE) { ++ if (*((u32 *)val) == DYNAMIC_ALL_FUNC_ENABLE) { + struct dm_priv *dm = &hal_data->dmpriv; + dm->DMFlag = dm->InitDMFlag; + odm->SupportAbility = dm->InitODMFlag; @@ -46506,8 +45064,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + /* TODO - Is something needed here? */ + break; + default: -+ DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" variable(%d) not defined!\n", -+ FUNC_ADPT_ARG(adapter), variable); ++ DBG_871X_LEVEL( ++ _drv_always_, ++ FUNC_ADPT_FMT" variable(%d) not defined!\n", ++ FUNC_ADPT_ARG(adapter), ++ variable ++ ); + break; + } +} @@ -46519,17 +45081,21 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + + switch (variable) { + case HW_VAR_BASIC_RATE: -+ *((u16*)val) = hal_data->BasicRateSet; ++ *((u16 *)val) = hal_data->BasicRateSet; + break; + case HW_VAR_DM_FLAG: -+ *((u32*)val) = odm->SupportAbility; ++ *((u32 *)val) = odm->SupportAbility; + break; + case HW_VAR_RF_TYPE: + *((u8 *)val) = hal_data->rf_type; + break; + default: -+ DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" variable(%d) not defined!\n", -+ FUNC_ADPT_ARG(adapter), variable); ++ DBG_871X_LEVEL( ++ _drv_always_, ++ FUNC_ADPT_FMT" variable(%d) not defined!\n", ++ FUNC_ADPT_ARG(adapter), ++ variable ++ ); + break; + } +} @@ -46537,8 +45103,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + + + -+u8 -+SetHalDefVar(struct adapter *adapter, enum HAL_DEF_VARIABLE variable, void *value) ++u8 SetHalDefVar( ++ struct adapter *adapter, enum HAL_DEF_VARIABLE variable, void *value ++) +{ + struct hal_com_data *hal_data = GET_HAL_DATA(adapter); + DM_ODM_T *odm = &(hal_data->odmpriv); @@ -46548,9 +45115,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + case HW_DEF_FA_CNT_DUMP: + /* ODM_COMP_COMMON */ + if (*((u8 *)value)) -+ odm->DebugComponents |= (ODM_COMP_DIG |ODM_COMP_FA_CNT); ++ odm->DebugComponents |= (ODM_COMP_DIG | ODM_COMP_FA_CNT); + else -+ odm->DebugComponents &= ~(ODM_COMP_DIG |ODM_COMP_FA_CNT); ++ odm->DebugComponents &= ~(ODM_COMP_DIG | ODM_COMP_FA_CNT); + break; + case HAL_DEF_DBG_RX_INFO_DUMP: + DBG_871X("============ Rx Info dump ===================\n"); @@ -46567,10 +45134,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + } + break; + case HW_DEF_ODM_DBG_FLAG: -+ ODM_CmnInfoUpdate(odm, ODM_CMNINFO_DBG_COMP, *((u64*)value)); ++ ODM_CmnInfoUpdate(odm, ODM_CMNINFO_DBG_COMP, *((u64 *)value)); + break; + case HW_DEF_ODM_DBG_LEVEL: -+ ODM_CmnInfoUpdate(odm, ODM_CMNINFO_DBG_LEVEL, *((u32*)value)); ++ ODM_CmnInfoUpdate(odm, ODM_CMNINFO_DBG_LEVEL, *((u32 *)value)); + break; + case HAL_DEF_DBG_DM_FUNC: + { @@ -46580,25 +45147,19 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + if (dm_func == 0) { /* disable all dynamic func */ + odm->SupportAbility = DYNAMIC_FUNC_DISABLE; + DBG_8192C("==> Disable all dynamic function...\n"); -+ } -+ else if (dm_func == 1) {/* disable DIG */ ++ } else if (dm_func == 1) {/* disable DIG */ + odm->SupportAbility &= (~DYNAMIC_BB_DIG); + DBG_8192C("==> Disable DIG...\n"); -+ } -+ else if (dm_func == 2) {/* disable High power */ ++ } else if (dm_func == 2) {/* disable High power */ + odm->SupportAbility &= (~DYNAMIC_BB_DYNAMIC_TXPWR); -+ } -+ else if (dm_func == 3) {/* disable tx power tracking */ ++ } else if (dm_func == 3) {/* disable tx power tracking */ + odm->SupportAbility &= (~DYNAMIC_RF_CALIBRATION); + DBG_8192C("==> Disable tx power tracking...\n"); -+ } -+ else if (dm_func == 4) {/* disable BT coexistence */ ++ } else if (dm_func == 4) {/* disable BT coexistence */ + dm->DMFlag &= (~DYNAMIC_FUNC_BT); -+ } -+ else if (dm_func == 5) {/* disable antenna diversity */ ++ } else if (dm_func == 5) {/* disable antenna diversity */ + odm->SupportAbility &= (~DYNAMIC_BB_ANT_DIV); -+ } -+ else if (dm_func == 6) {/* turn on all dynamic func */ ++ } else if (dm_func == 6) {/* turn on all dynamic func */ + if (!(odm->SupportAbility & DYNAMIC_BB_DIG)) { + DIG_T *pDigTable = &odm->DM_DigTable; + pDigTable->CurIGValue = rtw_read8(adapter, 0xc50); @@ -46627,67 +45188,67 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + return bResult; +} + -+u8 -+GetHalDefVar(struct adapter *adapter, enum HAL_DEF_VARIABLE variable, void *value) ++u8 GetHalDefVar( ++ struct adapter *adapter, enum HAL_DEF_VARIABLE variable, void *value ++) +{ + struct hal_com_data *hal_data = GET_HAL_DATA(adapter); + DM_ODM_T *odm = &(hal_data->odmpriv); + u8 bResult = _SUCCESS; + + switch (variable) { -+ case HAL_DEF_UNDERCORATEDSMOOTHEDPWDB: -+ { -+ struct mlme_priv *pmlmepriv; -+ struct sta_priv *pstapriv; -+ struct sta_info *psta; ++ case HAL_DEF_UNDERCORATEDSMOOTHEDPWDB: ++ { ++ struct mlme_priv *pmlmepriv; ++ struct sta_priv *pstapriv; ++ struct sta_info *psta; + -+ pmlmepriv = &adapter->mlmepriv; -+ pstapriv = &adapter->stapriv; -+ psta = rtw_get_stainfo(pstapriv, pmlmepriv->cur_network.network.MacAddress); -+ if (psta) -+ { -+ *((int*)value) = psta->rssi_stat.UndecoratedSmoothedPWDB; -+ } -+ } -+ break; -+ case HW_DEF_ODM_DBG_FLAG: -+ *((u64*)value) = odm->DebugComponents; -+ break; -+ case HW_DEF_ODM_DBG_LEVEL: -+ *((u32*)value) = odm->DebugLevel; -+ break; -+ case HAL_DEF_DBG_DM_FUNC: -+ *((u32*)value) =hal_data->odmpriv.SupportAbility; -+ break; -+ case HAL_DEF_DBG_DUMP_RXPKT: -+ *((u8 *)value) = hal_data->bDumpRxPkt; -+ break; -+ case HAL_DEF_DBG_DUMP_TXPKT: -+ *((u8 *)value) = hal_data->bDumpTxPkt; -+ break; -+ case HAL_DEF_ANT_DETECT: -+ *((u8 *)value) = hal_data->AntDetection; -+ break; -+ case HAL_DEF_MACID_SLEEP: -+ *(u8 *)value = false; -+ break; -+ case HAL_DEF_TX_PAGE_SIZE: -+ *((u32*)value) = PAGE_SIZE_128; -+ break; -+ default: -+ DBG_871X_LEVEL(_drv_always_, "%s: [WARNING] HAL_DEF_VARIABLE(%d) not defined!\n", __func__, variable); -+ bResult = _FAIL; -+ break; ++ pmlmepriv = &adapter->mlmepriv; ++ pstapriv = &adapter->stapriv; ++ psta = rtw_get_stainfo(pstapriv, pmlmepriv->cur_network.network.MacAddress); ++ if (psta) ++ *((int *)value) = psta->rssi_stat.UndecoratedSmoothedPWDB; ++ } ++ break; ++ case HW_DEF_ODM_DBG_FLAG: ++ *((u64 *)value) = odm->DebugComponents; ++ break; ++ case HW_DEF_ODM_DBG_LEVEL: ++ *((u32 *)value) = odm->DebugLevel; ++ break; ++ case HAL_DEF_DBG_DM_FUNC: ++ *((u32 *)value) = hal_data->odmpriv.SupportAbility; ++ break; ++ case HAL_DEF_DBG_DUMP_RXPKT: ++ *((u8 *)value) = hal_data->bDumpRxPkt; ++ break; ++ case HAL_DEF_DBG_DUMP_TXPKT: ++ *((u8 *)value) = hal_data->bDumpTxPkt; ++ break; ++ case HAL_DEF_ANT_DETECT: ++ *((u8 *)value) = hal_data->AntDetection; ++ break; ++ case HAL_DEF_MACID_SLEEP: ++ *(u8 *)value = false; ++ break; ++ case HAL_DEF_TX_PAGE_SIZE: ++ *((u32 *)value) = PAGE_SIZE_128; ++ break; ++ default: ++ DBG_871X_LEVEL(_drv_always_, "%s: [WARNING] HAL_DEF_VARIABLE(%d) not defined!\n", __func__, variable); ++ bResult = _FAIL; ++ break; + } + + return bResult; +} + +void GetHalODMVar( -+ struct adapter * Adapter, -+ enum HAL_ODM_VARIABLE eVariable, ++ struct adapter *Adapter, ++ enum HAL_ODM_VARIABLE eVariable, + void *pValue1, -+ void *pValue2) ++ void *pValue2 ++) +{ + switch (eVariable) { +#if defined(CONFIG_SIGNAL_DISPLAY_DBM) && defined(CONFIG_BACKGROUND_NOISE_MONITOR) @@ -46710,10 +45271,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar +} + +void SetHalODMVar( -+ struct adapter * Adapter, -+ enum HAL_ODM_VARIABLE eVariable, -+ void * pValue1, -+ bool bSet) ++ struct adapter *Adapter, ++ enum HAL_ODM_VARIABLE eVariable, ++ void *pValue1, ++ bool bSet ++) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + PDM_ODM_T podmpriv = &pHalData->odmpriv; @@ -46725,14 +45287,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + if (bSet) { + DBG_8192C("### Set STA_(%d) info ###\n", psta->mac_id); + ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, psta); -+ } -+ else { ++ } else { + DBG_8192C("### Clean STA_(%d) info ###\n", psta->mac_id); + /* spin_lock_bh(&pHalData->odm_stainfo_lock); */ + ODM_CmnInfoPtrArrayHook(podmpriv, ODM_CMNINFO_STA_STATUS, psta->mac_id, NULL); + + /* spin_unlock_bh(&pHalData->odm_stainfo_lock); */ -+ } ++ } + } + break; + case HAL_ODM_P2P_STATE: @@ -46769,19 +45330,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar +} + + -+bool -+eqNByte( -+ u8*str1, -+ u8*str2, -+ u32 num -+ ) ++bool eqNByte(u8 *str1, u8 *str2, u32 num) +{ + if (num == 0) + return false; -+ while (num>0) -+ { ++ while (num > 0) { + num--; -+ if (str1[num]!=str2[num]) ++ if (str1[num] != str2[num]) + return false; + } + return true; @@ -46793,21 +45348,16 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar +/* false otherwise. */ +/* */ +/* */ -+bool -+IsHexDigit( -+ char chTmp -+) ++bool IsHexDigit(char chTmp) +{ -+ if ((chTmp >= '0' && chTmp <= '9') || ++ if ( ++ (chTmp >= '0' && chTmp <= '9') || + (chTmp >= 'a' && chTmp <= 'f') || -+ (chTmp >= 'A' && chTmp <= 'F')) -+ { ++ (chTmp >= 'A' && chTmp <= 'F') ++ ) + return true; -+ } + else -+ { + return false; -+ } +} + + @@ -46815,10 +45365,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar +/* Description: */ +/* Translate a character to hex digit. */ +/* */ -+u32 -+MapCharToHexDigit( -+ char chTmp -+) ++u32 MapCharToHexDigit(char chTmp) +{ + if (chTmp >= '0' && chTmp <= '9') + return (chTmp - '0'); @@ -46836,11 +45383,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar +/* Parse hex number from the string pucStr. */ +bool GetHexValueFromString(char *szStr, u32 *pu4bVal, u32 *pu4bMove) +{ -+ char* szScan = szStr; ++ char *szScan = szStr; + + /* Check input parameter. */ -+ if (szStr == NULL || pu4bVal == NULL || pu4bMove == NULL) -+ { ++ if (szStr == NULL || pu4bVal == NULL || pu4bMove == NULL) { + DBG_871X("GetHexValueFromString(): Invalid inpur argumetns! szStr: %p, pu4bVal: %p, pu4bMove: %p\n", szStr, pu4bVal, pu4bMove); + return false; + } @@ -46850,16 +45396,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + *pu4bVal = 0; + + /* Skip leading space. */ -+ while (*szScan != '\0' && -+ (*szScan == ' ' || *szScan == '\t')) -+ { ++ while (*szScan != '\0' && (*szScan == ' ' || *szScan == '\t')) { + szScan++; + (*pu4bMove)++; + } + + /* Skip leading '0x' or '0X'. */ -+ if (*szScan == '0' && (*(szScan+1) == 'x' || *(szScan+1) == 'X')) -+ { ++ if (*szScan == '0' && (*(szScan+1) == 'x' || *(szScan+1) == 'X')) { + szScan += 2; + (*pu4bMove) += 2; + } @@ -46867,13 +45410,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + /* Check if szScan is now pointer to a character for hex digit, */ + /* if not, it means this is not a valid hex number. */ + if (!IsHexDigit(*szScan)) -+ { + return false; -+ } + + /* Parse each digit. */ -+ do -+ { ++ do { + (*pu4bVal) <<= 4; + *pu4bVal += MapCharToHexDigit(*szScan); + @@ -46884,8 +45424,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + return true; +} + -+bool GetFractionValueFromString(char *szStr, u8 *pInteger, u8 *pFraction, -+ u32 *pu4bMove) ++bool GetFractionValueFromString( ++ char *szStr, u8 *pInteger, u8 *pFraction, u32 *pu4bMove ++) +{ + char *szScan = szStr; + @@ -46908,8 +45449,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + ++szScan; + ++(*pu4bMove); + -+ if (*szScan == '.') -+ { ++ if (*szScan == '.') { + ++szScan; + ++(*pu4bMove); + @@ -46931,41 +45471,26 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar +/* Description: */ +/* Return true if szStr is comment out with leading "//". */ +/* */ -+bool -+IsCommentString( -+ char *szStr -+) ++bool IsCommentString(char *szStr) +{ + if (*szStr == '/' && *(szStr+1) == '/') -+ { + return true; -+ } + else -+ { + return false; -+ } +} + -+bool -+GetU1ByteIntegerFromStringInDecimal( -+ char*Str, -+ u8* pInt -+ ) ++bool GetU1ByteIntegerFromStringInDecimal(char *Str, u8 *pInt) +{ + u16 i = 0; + *pInt = 0; + -+ while (Str[i] != '\0') -+ { -+ if (Str[i] >= '0' && Str[i] <= '9') -+ { ++ while (Str[i] != '\0') { ++ if (Str[i] >= '0' && Str[i] <= '9') { + *pInt *= 10; + *pInt += (Str[i] - '0'); -+ } -+ else -+ { ++ } else + return false; -+ } ++ + ++i; + } + @@ -46977,8 +45502,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + * a string "Hello [Kordan]". + * If RightQualifier does not exist, it will hang in the while loop + */ -+bool ParseQualifiedString(char *In, u32 *Start, char *Out, char LeftQualifier, -+ char RightQualifier) ++bool ParseQualifiedString( ++ char *In, u32 *Start, char *Out, char LeftQualifier, char RightQualifier ++) +{ + u32 i = 0, j = 0; + char c = In[(*Start)++]; @@ -46990,21 +45516,16 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + while ((c = In[(*Start)++]) != RightQualifier) + ; /* find ']' */ + j = (*Start) - 2; -+ strncpy((char *)Out, (const char*)(In+i), j-i+1); ++ strncpy((char *)Out, (const char *)(In+i), j-i+1); + + return true; +} + -+bool -+isAllSpaceOrTab( -+ u8*data, -+ u8 size -+ ) ++bool isAllSpaceOrTab(u8 *data, u8 size) +{ + u8 cnt = 0, NumOfSpaceAndTab = 0; + -+ while (size > cnt) -+ { ++ while (size > cnt) { + if (data[cnt] == ' ' || data[cnt] == '\t' || data[cnt] == '\0') + ++NumOfSpaceAndTab; + @@ -47019,7 +45540,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar +{ + struct dvobj_priv *psdpriv = adapter->dvobj; + struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; -+ int save_cnt =false; ++ int save_cnt = false; + + /* switch counter to RX fifo */ + /* printk("8723b or 8192e , MAC_667 set 0xf0\n"); */ @@ -47027,8 +45548,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + save_cnt = true; + /* todo: other chips */ + -+ if (save_cnt) -+ { ++ if (save_cnt) { + /* rtw_write8(adapter, REG_RXERR_RPT+3, rtw_read8(adapter, REG_RXERR_RPT+3)|0xa0); */ + pdbgpriv->dbg_rx_fifo_last_overflow = pdbgpriv->dbg_rx_fifo_curr_overflow; + pdbgpriv->dbg_rx_fifo_curr_overflow = rtw_read16(adapter, REG_RXERR_RPT); @@ -47043,7 +45563,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + if (padapter->bLinkInfoDump == benable) + return; + -+ DBG_871X("%s %s\n", __func__, (benable)?"enable":"disable"); ++ DBG_871X("%s %s\n", __func__, (benable) ? "enable" : "disable"); + + if (benable) { + pwrctrlpriv->org_power_mgnt = pwrctrlpriv->power_mgnt;/* keep org value */ @@ -47051,37 +45571,48 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + + pwrctrlpriv->ips_org_mode = pwrctrlpriv->ips_mode;/* keep org value */ + rtw_pm_set_ips(padapter, IPS_NONE); -+ } -+ else { ++ } else { + rtw_pm_set_ips(padapter, pwrctrlpriv->ips_org_mode); + + rtw_pm_set_lps(padapter, pwrctrlpriv->ips_org_mode); + } -+ padapter->bLinkInfoDump = benable ; ++ padapter->bLinkInfoDump = benable; +} + +#ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA +void rtw_get_raw_rssi_info(void *sel, struct adapter *padapter) +{ + u8 isCCKrate, rf_path; -+ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); ++ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + struct rx_raw_rssi *psample_pkt_rssi = &padapter->recvpriv.raw_rssi_info; + -+ DBG_871X_SEL_NL(sel,"RxRate = %s, PWDBALL = %d(%%), rx_pwr_all = %d(dBm)\n", -+ HDATA_RATE(psample_pkt_rssi->data_rate), psample_pkt_rssi->pwdball, psample_pkt_rssi->pwr_all); -+ isCCKrate = (psample_pkt_rssi->data_rate <= DESC_RATE11M)?true :false; ++ DBG_871X_SEL_NL( ++ sel, ++ "RxRate = %s, PWDBALL = %d(%%), rx_pwr_all = %d(dBm)\n", ++ HDATA_RATE(psample_pkt_rssi->data_rate), ++ psample_pkt_rssi->pwdball, psample_pkt_rssi->pwr_all ++ ); ++ ++ isCCKrate = (psample_pkt_rssi->data_rate <= DESC_RATE11M) ? true : false; + + if (isCCKrate) + psample_pkt_rssi->mimo_singal_strength[0] = psample_pkt_rssi->pwdball; + -+ for (rf_path = 0;rf_pathNumTotalRFPath;rf_path++) -+ { -+ DBG_871X_SEL_NL(sel,"RF_PATH_%d =>singal_strength:%d(%%), singal_quality:%d(%%)\n" -+ , rf_path, psample_pkt_rssi->mimo_singal_strength[rf_path], psample_pkt_rssi->mimo_singal_quality[rf_path]); ++ for (rf_path = 0; rf_path < pHalData->NumTotalRFPath; rf_path++) { ++ DBG_871X_SEL_NL( ++ sel, ++ "RF_PATH_%d =>singal_strength:%d(%%), singal_quality:%d(%%)\n", ++ rf_path, psample_pkt_rssi->mimo_singal_strength[rf_path], ++ psample_pkt_rssi->mimo_singal_quality[rf_path] ++ ); + + if (!isCCKrate) { -+ DBG_871X_SEL_NL(sel,"\trx_ofdm_pwr:%d(dBm), rx_ofdm_snr:%d(dB)\n", -+ psample_pkt_rssi->ofdm_pwr[rf_path], psample_pkt_rssi->ofdm_snr[rf_path]); ++ DBG_871X_SEL_NL( ++ sel, ++ "\trx_ofdm_pwr:%d(dBm), rx_ofdm_snr:%d(dB)\n", ++ psample_pkt_rssi->ofdm_pwr[rf_path], ++ psample_pkt_rssi->ofdm_snr[rf_path] ++ ); + } + } +} @@ -47095,13 +45626,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + DBG_871X("RxRate = %s, PWDBALL = %d(%%), rx_pwr_all = %d(dBm)\n", + HDATA_RATE(psample_pkt_rssi->data_rate), psample_pkt_rssi->pwdball, psample_pkt_rssi->pwr_all); + -+ isCCKrate = (psample_pkt_rssi->data_rate <= DESC_RATE11M)?true :false; ++ isCCKrate = (psample_pkt_rssi->data_rate <= DESC_RATE11M) ? true : false; + + if (isCCKrate) + psample_pkt_rssi->mimo_singal_strength[0] = psample_pkt_rssi->pwdball; + -+ for (rf_path = 0;rf_pathNumTotalRFPath;rf_path++) -+ { ++ for (rf_path = 0; rf_path < pHalData->NumTotalRFPath; rf_path++) { + DBG_871X("RF_PATH_%d =>singal_strength:%d(%%), singal_quality:%d(%%)" + , rf_path, psample_pkt_rssi->mimo_singal_strength[rf_path], psample_pkt_rssi->mimo_singal_quality[rf_path]); + @@ -47124,13 +45654,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + struct rx_raw_rssi *psample_pkt_rssi = &padapter->recvpriv.raw_rssi_info; + + psample_pkt_rssi->data_rate = pattrib->data_rate; -+ isCCKrate = (pattrib->data_rate <= DESC_RATE11M)?true :false; ++ isCCKrate = (pattrib->data_rate <= DESC_RATE11M) ? true : false; + + psample_pkt_rssi->pwdball = pPhyInfo->RxPWDBAll; + psample_pkt_rssi->pwr_all = pPhyInfo->RecvSignalPower; + -+ for (rf_path = 0;rf_pathNumTotalRFPath;rf_path++) -+ { ++ for (rf_path = 0; rf_path < pHalData->NumTotalRFPath; rf_path++) { + psample_pkt_rssi->mimo_singal_strength[rf_path] = pPhyInfo->RxMIMOSignalStrength[rf_path]; + psample_pkt_rssi->mimo_singal_quality[rf_path] = pPhyInfo->RxMIMOSignalQuality[rf_path]; + if (!isCCKrate) { @@ -47142,24 +45671,24 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar +#endif + +static u32 Array_kfreemap[] = { -+0xf8, 0xe, -+0xf6, 0xc, -+0xf4, 0xa, -+0xf2, 0x8, -+0xf0, 0x6, -+0xf3, 0x4, -+0xf5, 0x2, -+0xf7, 0x0, -+0xf9, 0x0, -+0xfc, 0x0, ++ 0xf8, 0xe, ++ 0xf6, 0xc, ++ 0xf4, 0xa, ++ 0xf2, 0x8, ++ 0xf0, 0x6, ++ 0xf3, 0x4, ++ 0xf5, 0x2, ++ 0xf7, 0x0, ++ 0xf9, 0x0, ++ 0xfc, 0x0, +}; + +void rtw_bb_rf_gain_offset(struct adapter *padapter) +{ + u8 value = padapter->eeprompriv.EEPROMRFGainOffset; + u32 res, i = 0; -+ u32 ArrayLen = sizeof(Array_kfreemap)/sizeof(u32); -+ u32 * Array = Array_kfreemap; ++ u32 ArrayLen = sizeof(Array_kfreemap)/sizeof(u32); ++ u32 *Array = Array_kfreemap; + u32 v1 = 0, v2 = 0, target = 0; + /* DBG_871X("+%s value: 0x%02x+\n", __func__, value); */ + @@ -47171,14 +45700,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + res &= 0xfff87fff; + DBG_871X("Offset RF Gain. before reg 0x7f = 0x%08x\n", res); + /* res &= 0xfff87fff; */ -+ for (i = 0; i < ArrayLen; i += 2) -+ { ++ for (i = 0; i < ArrayLen; i += 2) { + v1 = Array[i]; + v2 = Array[i+1]; -+ if (v1 == padapter->eeprompriv.EEPROMRFGainVal) -+ { ++ if (v1 == padapter->eeprompriv.EEPROMRFGainVal) { + DBG_871X("Offset RF Gain. got v1 = 0x%x , v2 = 0x%x\n", v1, v2); -+ target =v2; ++ target = v2; + break; + } + } @@ -47189,19 +45716,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com.c linux-4.3-rtl8723bs/3rdpar + /* rtw_hal_write_rfreg(padapter, RF_PATH_A, REG_RF_BB_GAIN_OFFSET, RF_GAIN_OFFSET_MASK, res); */ + res = rtw_hal_read_rfreg(padapter, RF_PATH_A, 0x7f, 0xffffffff); + DBG_871X("Offset RF Gain. After reg 0x7f = 0x%08x\n", res); -+ } -+ else -+ { ++ } else + DBG_871X("Offset RF Gain. padapter->eeprompriv.EEPROMRFGainVal = 0x%x != 0xff, didn't run Kfree\n", padapter->eeprompriv.EEPROMRFGainVal); -+ } -+ } else { ++ } else + DBG_871X("Using the default RF gain.\n"); -+ } +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/hal_com_phycfg.c ---- linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/hal_com_phycfg.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,3582 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux/3rdparty/rtl8723bs/hal/hal_com_phycfg.c +--- linux.old/3rdparty/rtl8723bs/hal/hal_com_phycfg.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/hal_com_phycfg.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,3288 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -47226,195 +45749,181 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + u8 TxNum, enum RATE_SECTION RateSection) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); -+ u8 value = 0; ++ u8 value = 0; + -+ if (RfPath > ODM_RF_PATH_D) -+ { ++ if (RfPath > ODM_RF_PATH_D) { + DBG_871X("Invalid Rf Path %d in PHY_GetTxPowerByRateBase()\n", RfPath); + return 0; + } + -+ if (Band == BAND_ON_2_4G) -+ { ++ if (Band == BAND_ON_2_4G) { + switch (RateSection) { -+ case CCK: -+ value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][0]; -+ break; -+ case OFDM: -+ value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][1]; -+ break; -+ case HT_MCS0_MCS7: -+ value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][2]; -+ break; -+ case HT_MCS8_MCS15: -+ value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][3]; -+ break; -+ case HT_MCS16_MCS23: -+ value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][4]; -+ break; -+ case HT_MCS24_MCS31: -+ value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][5]; -+ break; -+ case VHT_1SSMCS0_1SSMCS9: -+ value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][6]; -+ break; -+ case VHT_2SSMCS0_2SSMCS9: -+ value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][7]; -+ break; -+ case VHT_3SSMCS0_3SSMCS9: -+ value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][8]; -+ break; -+ case VHT_4SSMCS0_4SSMCS9: -+ value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][9]; -+ break; -+ default: -+ DBG_871X("Invalid RateSection %d in Band 2.4G, Rf Path %d, %dTx in PHY_GetTxPowerByRateBase()\n", -+ RateSection, RfPath, TxNum); -+ break; ++ case CCK: ++ value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][0]; ++ break; ++ case OFDM: ++ value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][1]; ++ break; ++ case HT_MCS0_MCS7: ++ value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][2]; ++ break; ++ case HT_MCS8_MCS15: ++ value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][3]; ++ break; ++ case HT_MCS16_MCS23: ++ value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][4]; ++ break; ++ case HT_MCS24_MCS31: ++ value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][5]; ++ break; ++ case VHT_1SSMCS0_1SSMCS9: ++ value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][6]; ++ break; ++ case VHT_2SSMCS0_2SSMCS9: ++ value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][7]; ++ break; ++ case VHT_3SSMCS0_3SSMCS9: ++ value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][8]; ++ break; ++ case VHT_4SSMCS0_4SSMCS9: ++ value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][9]; ++ break; ++ default: ++ DBG_871X("Invalid RateSection %d in Band 2.4G, Rf Path %d, %dTx in PHY_GetTxPowerByRateBase()\n", ++ RateSection, RfPath, TxNum); ++ break; + + }; -+ } -+ else if (Band == BAND_ON_5G) -+ { ++ } else if (Band == BAND_ON_5G) { + switch (RateSection) { -+ case OFDM: -+ value = pHalData->TxPwrByRateBase5G[RfPath][TxNum][0]; -+ break; -+ case HT_MCS0_MCS7: -+ value = pHalData->TxPwrByRateBase5G[RfPath][TxNum][1]; -+ break; -+ case HT_MCS8_MCS15: -+ value = pHalData->TxPwrByRateBase5G[RfPath][TxNum][2]; -+ break; -+ case HT_MCS16_MCS23: -+ value = pHalData->TxPwrByRateBase5G[RfPath][TxNum][3]; -+ break; -+ case HT_MCS24_MCS31: -+ value = pHalData->TxPwrByRateBase5G[RfPath][TxNum][4]; -+ break; -+ case VHT_1SSMCS0_1SSMCS9: -+ value = pHalData->TxPwrByRateBase5G[RfPath][TxNum][5]; -+ break; -+ case VHT_2SSMCS0_2SSMCS9: -+ value = pHalData->TxPwrByRateBase5G[RfPath][TxNum][6]; -+ break; -+ case VHT_3SSMCS0_3SSMCS9: -+ value = pHalData->TxPwrByRateBase5G[RfPath][TxNum][7]; -+ break; -+ case VHT_4SSMCS0_4SSMCS9: -+ value = pHalData->TxPwrByRateBase5G[RfPath][TxNum][8]; -+ break; -+ default: -+ DBG_871X("Invalid RateSection %d in Band 5G, Rf Path %d, %dTx in PHY_GetTxPowerByRateBase()\n", -+ RateSection, RfPath, TxNum); -+ break; ++ case OFDM: ++ value = pHalData->TxPwrByRateBase5G[RfPath][TxNum][0]; ++ break; ++ case HT_MCS0_MCS7: ++ value = pHalData->TxPwrByRateBase5G[RfPath][TxNum][1]; ++ break; ++ case HT_MCS8_MCS15: ++ value = pHalData->TxPwrByRateBase5G[RfPath][TxNum][2]; ++ break; ++ case HT_MCS16_MCS23: ++ value = pHalData->TxPwrByRateBase5G[RfPath][TxNum][3]; ++ break; ++ case HT_MCS24_MCS31: ++ value = pHalData->TxPwrByRateBase5G[RfPath][TxNum][4]; ++ break; ++ case VHT_1SSMCS0_1SSMCS9: ++ value = pHalData->TxPwrByRateBase5G[RfPath][TxNum][5]; ++ break; ++ case VHT_2SSMCS0_2SSMCS9: ++ value = pHalData->TxPwrByRateBase5G[RfPath][TxNum][6]; ++ break; ++ case VHT_3SSMCS0_3SSMCS9: ++ value = pHalData->TxPwrByRateBase5G[RfPath][TxNum][7]; ++ break; ++ case VHT_4SSMCS0_4SSMCS9: ++ value = pHalData->TxPwrByRateBase5G[RfPath][TxNum][8]; ++ break; ++ default: ++ DBG_871X("Invalid RateSection %d in Band 5G, Rf Path %d, %dTx in PHY_GetTxPowerByRateBase()\n", ++ RateSection, RfPath, TxNum); ++ break; + }; -+ } -+ else -+ { ++ } else + DBG_871X("Invalid Band %d in PHY_GetTxPowerByRateBase()\n", Band); -+ } + + return value; +} + +static void +phy_SetTxPowerByRateBase( -+struct adapter * Adapter, -+u8 Band, -+u8 RfPath, -+enum RATE_SECTION RateSection, -+u8 TxNum, -+u8 Value -+ ) ++ struct adapter *Adapter, ++ u8 Band, ++ u8 RfPath, ++ enum RATE_SECTION RateSection, ++ u8 TxNum, ++ u8 Value ++) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + -+ if (RfPath > ODM_RF_PATH_D) -+ { ++ if (RfPath > ODM_RF_PATH_D) { + DBG_871X("Invalid Rf Path %d in phy_SetTxPowerByRatBase()\n", RfPath); + return; + } + -+ if (Band == BAND_ON_2_4G) -+ { ++ if (Band == BAND_ON_2_4G) { + switch (RateSection) { -+ case CCK: -+ pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][0] = Value; -+ break; -+ case OFDM: -+ pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][1] = Value; -+ break; -+ case HT_MCS0_MCS7: -+ pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][2] = Value; -+ break; -+ case HT_MCS8_MCS15: -+ pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][3] = Value; -+ break; -+ case HT_MCS16_MCS23: -+ pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][4] = Value; -+ break; -+ case HT_MCS24_MCS31: -+ pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][5] = Value; -+ break; -+ case VHT_1SSMCS0_1SSMCS9: -+ pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][6] = Value; -+ break; -+ case VHT_2SSMCS0_2SSMCS9: -+ pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][7] = Value; -+ break; -+ case VHT_3SSMCS0_3SSMCS9: -+ pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][8] = Value; -+ break; -+ case VHT_4SSMCS0_4SSMCS9: -+ pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][9] = Value; -+ break; -+ default: -+ DBG_871X("Invalid RateSection %d in Band 2.4G, Rf Path %d, %dTx in phy_SetTxPowerByRateBase()\n", -+ RateSection, RfPath, TxNum); -+ break; ++ case CCK: ++ pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][0] = Value; ++ break; ++ case OFDM: ++ pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][1] = Value; ++ break; ++ case HT_MCS0_MCS7: ++ pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][2] = Value; ++ break; ++ case HT_MCS8_MCS15: ++ pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][3] = Value; ++ break; ++ case HT_MCS16_MCS23: ++ pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][4] = Value; ++ break; ++ case HT_MCS24_MCS31: ++ pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][5] = Value; ++ break; ++ case VHT_1SSMCS0_1SSMCS9: ++ pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][6] = Value; ++ break; ++ case VHT_2SSMCS0_2SSMCS9: ++ pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][7] = Value; ++ break; ++ case VHT_3SSMCS0_3SSMCS9: ++ pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][8] = Value; ++ break; ++ case VHT_4SSMCS0_4SSMCS9: ++ pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][9] = Value; ++ break; ++ default: ++ DBG_871X("Invalid RateSection %d in Band 2.4G, Rf Path %d, %dTx in phy_SetTxPowerByRateBase()\n", ++ RateSection, RfPath, TxNum); ++ break; + }; -+ } -+ else if (Band == BAND_ON_5G) -+ { ++ } else if (Band == BAND_ON_5G) { + switch (RateSection) { -+ case OFDM: -+ pHalData->TxPwrByRateBase5G[RfPath][TxNum][0] = Value; -+ break; -+ case HT_MCS0_MCS7: -+ pHalData->TxPwrByRateBase5G[RfPath][TxNum][1] = Value; -+ break; -+ case HT_MCS8_MCS15: -+ pHalData->TxPwrByRateBase5G[RfPath][TxNum][2] = Value; -+ break; -+ case HT_MCS16_MCS23: -+ pHalData->TxPwrByRateBase5G[RfPath][TxNum][3] = Value; -+ break; -+ case HT_MCS24_MCS31: -+ pHalData->TxPwrByRateBase5G[RfPath][TxNum][4] = Value; -+ break; -+ case VHT_1SSMCS0_1SSMCS9: -+ pHalData->TxPwrByRateBase5G[RfPath][TxNum][5] = Value; -+ break; -+ case VHT_2SSMCS0_2SSMCS9: -+ pHalData->TxPwrByRateBase5G[RfPath][TxNum][6] = Value; -+ break; -+ case VHT_3SSMCS0_3SSMCS9: -+ pHalData->TxPwrByRateBase5G[RfPath][TxNum][7] = Value; -+ break; -+ case VHT_4SSMCS0_4SSMCS9: -+ pHalData->TxPwrByRateBase5G[RfPath][TxNum][8] = Value; -+ break; -+ default: -+ DBG_871X("Invalid RateSection %d in Band 5G, Rf Path %d, %dTx in phy_SetTxPowerByRateBase()\n", -+ RateSection, RfPath, TxNum); -+ break; ++ case OFDM: ++ pHalData->TxPwrByRateBase5G[RfPath][TxNum][0] = Value; ++ break; ++ case HT_MCS0_MCS7: ++ pHalData->TxPwrByRateBase5G[RfPath][TxNum][1] = Value; ++ break; ++ case HT_MCS8_MCS15: ++ pHalData->TxPwrByRateBase5G[RfPath][TxNum][2] = Value; ++ break; ++ case HT_MCS16_MCS23: ++ pHalData->TxPwrByRateBase5G[RfPath][TxNum][3] = Value; ++ break; ++ case HT_MCS24_MCS31: ++ pHalData->TxPwrByRateBase5G[RfPath][TxNum][4] = Value; ++ break; ++ case VHT_1SSMCS0_1SSMCS9: ++ pHalData->TxPwrByRateBase5G[RfPath][TxNum][5] = Value; ++ break; ++ case VHT_2SSMCS0_2SSMCS9: ++ pHalData->TxPwrByRateBase5G[RfPath][TxNum][6] = Value; ++ break; ++ case VHT_3SSMCS0_3SSMCS9: ++ pHalData->TxPwrByRateBase5G[RfPath][TxNum][7] = Value; ++ break; ++ case VHT_4SSMCS0_4SSMCS9: ++ pHalData->TxPwrByRateBase5G[RfPath][TxNum][8] = Value; ++ break; ++ default: ++ DBG_871X("Invalid RateSection %d in Band 5G, Rf Path %d, %dTx in phy_SetTxPowerByRateBase()\n", ++ RateSection, RfPath, TxNum); ++ break; + }; -+ } -+ else -+ { ++ } else + DBG_871X("Invalid Band %d in phy_SetTxPowerByRateBase()\n", Band); -+ } +} + +static void @@ -47426,8 +45935,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + + /* DBG_871X("===>%s\n", __func__); */ + -+ for (path = ODM_RF_PATH_A; path <= ODM_RF_PATH_B; ++path) -+ { ++ for (path = ODM_RF_PATH_A; path <= ODM_RF_PATH_B; ++path) { + base = PHY_GetTxPowerByRate(padapter, BAND_ON_2_4G, path, RF_1TX, MGN_11M); + phy_SetTxPowerByRateBase(padapter, BAND_ON_2_4G, path, CCK, RF_1TX, base); + /* DBG_871X("Power index base of 2.4G path %d 1Tx CCK = > 0x%x\n", path, base); */ @@ -47492,45 +46000,68 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + /* DBG_871X("<===%s\n", __func__); */ +} + -+u8 -+PHY_GetRateSectionIndexOfTxPowerByRate( -+struct adapter *padapter, -+u32 RegAddr, -+u32 BitMask -+ ) ++u8 PHY_GetRateSectionIndexOfTxPowerByRate( ++ struct adapter *padapter, u32 RegAddr, u32 BitMask ++) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; -+ u8 index = 0; ++ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; ++ u8 index = 0; + -+ if (pDM_Odm->PhyRegPgVersion == 0) -+ { -+ switch (RegAddr) -+ { -+ case rTxAGC_A_Rate18_06: index = 0; break; -+ case rTxAGC_A_Rate54_24: index = 1; break; -+ case rTxAGC_A_CCK1_Mcs32: index = 6; break; -+ case rTxAGC_B_CCK11_A_CCK2_11: -+ if (BitMask == bMaskH3Bytes) -+ index = 7; -+ else if (BitMask == 0x000000ff) -+ index = 15; -+ break; ++ if (pDM_Odm->PhyRegPgVersion == 0) { ++ switch (RegAddr) { ++ case rTxAGC_A_Rate18_06: ++ index = 0; ++ break; ++ case rTxAGC_A_Rate54_24: ++ index = 1; ++ break; ++ case rTxAGC_A_CCK1_Mcs32: ++ index = 6; ++ break; ++ case rTxAGC_B_CCK11_A_CCK2_11: ++ if (BitMask == bMaskH3Bytes) ++ index = 7; ++ else if (BitMask == 0x000000ff) ++ index = 15; ++ break; + -+ case rTxAGC_A_Mcs03_Mcs00: index = 2; break; -+ case rTxAGC_A_Mcs07_Mcs04: index = 3; break; -+ case rTxAGC_A_Mcs11_Mcs08: index = 4; break; -+ case rTxAGC_A_Mcs15_Mcs12: index = 5; break; -+ case rTxAGC_B_Rate18_06: index = 8; break; -+ case rTxAGC_B_Rate54_24: index = 9; break; -+ case rTxAGC_B_CCK1_55_Mcs32: index = 14; break; -+ case rTxAGC_B_Mcs03_Mcs00: index = 10; break; -+ case rTxAGC_B_Mcs07_Mcs04: index = 11; break; -+ case rTxAGC_B_Mcs11_Mcs08: index = 12; break; -+ case rTxAGC_B_Mcs15_Mcs12: index = 13; break; -+ default: -+ DBG_871X("Invalid RegAddr 0x3%x in PHY_GetRateSectionIndexOfTxPowerByRate()", RegAddr); -+ break; ++ case rTxAGC_A_Mcs03_Mcs00: ++ index = 2; ++ break; ++ case rTxAGC_A_Mcs07_Mcs04: ++ index = 3; ++ break; ++ case rTxAGC_A_Mcs11_Mcs08: ++ index = 4; ++ break; ++ case rTxAGC_A_Mcs15_Mcs12: ++ index = 5; ++ break; ++ case rTxAGC_B_Rate18_06: ++ index = 8; ++ break; ++ case rTxAGC_B_Rate54_24: ++ index = 9; ++ break; ++ case rTxAGC_B_CCK1_55_Mcs32: ++ index = 14; ++ break; ++ case rTxAGC_B_Mcs03_Mcs00: ++ index = 10; ++ break; ++ case rTxAGC_B_Mcs07_Mcs04: ++ index = 11; ++ break; ++ case rTxAGC_B_Mcs11_Mcs08: ++ index = 12; ++ break; ++ case rTxAGC_B_Mcs15_Mcs12: ++ index = 13; ++ break; ++ default: ++ DBG_871X("Invalid RegAddr 0x3%x in PHY_GetRateSectionIndexOfTxPowerByRate()", RegAddr); ++ break; + }; + } + @@ -47539,488 +46070,444 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + +void +PHY_GetRateValuesOfTxPowerByRate( -+struct adapter *padapter, -+u32 RegAddr, -+u32 BitMask, -+u32 Value, -+ u8 * RateIndex, -+ s8 * PwrByRateVal, -+ u8 * RateNum -+ ) ++ struct adapter *padapter, ++ u32 RegAddr, ++ u32 BitMask, ++ u32 Value, ++ u8 *RateIndex, ++ s8 *PwrByRateVal, ++ u8 *RateNum ++) +{ + u8 i = 0; + -+ switch (RegAddr) -+ { -+ case rTxAGC_A_Rate18_06: -+ case rTxAGC_B_Rate18_06: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_6M); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_9M); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_12M); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_18M); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; ++ switch (RegAddr) { ++ case rTxAGC_A_Rate18_06: ++ case rTxAGC_B_Rate18_06: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_6M); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_9M); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_12M); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_18M); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; + -+ case rTxAGC_A_Rate54_24: -+ case rTxAGC_B_Rate54_24: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_24M); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_36M); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_48M); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_54M); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; ++ case rTxAGC_A_Rate54_24: ++ case rTxAGC_B_Rate54_24: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_24M); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_36M); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_48M); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_54M); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; + -+ case rTxAGC_A_CCK1_Mcs32: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_1M); -+ PwrByRateVal[0] = (s8) ((((Value >> (8 + 4)) & 0xF)) * 10 + -+ ((Value >> 8) & 0xF)); -+ *RateNum = 1; -+ break; ++ case rTxAGC_A_CCK1_Mcs32: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_1M); ++ PwrByRateVal[0] = (s8) ((((Value >> (8 + 4)) & 0xF)) * 10 + ++ ((Value >> 8) & 0xF)); ++ *RateNum = 1; ++ break; + -+ case rTxAGC_B_CCK11_A_CCK2_11: -+ if (BitMask == 0xffffff00) -+ { -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_2M); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_5_5M); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_11M); -+ for (i = 1; i < 4; ++ i) -+ { -+ PwrByRateVal[i - 1] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 3; -+ } -+ else if (BitMask == 0x000000ff) -+ { -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_11M); -+ PwrByRateVal[0] = (s8) ((((Value >> 4) & 0xF)) * 10 + -+ (Value & 0xF)); -+ *RateNum = 1; -+ } -+ break; -+ -+ case rTxAGC_A_Mcs03_Mcs00: -+ case rTxAGC_B_Mcs03_Mcs00: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS0); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS1); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS2); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS3); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; -+ -+ case rTxAGC_A_Mcs07_Mcs04: -+ case rTxAGC_B_Mcs07_Mcs04: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS4); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS5); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS6); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS7); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; -+ -+ case rTxAGC_A_Mcs11_Mcs08: -+ case rTxAGC_B_Mcs11_Mcs08: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS8); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS9); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS10); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS11); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; -+ -+ case rTxAGC_A_Mcs15_Mcs12: -+ case rTxAGC_B_Mcs15_Mcs12: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS12); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS13); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS14); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS15); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ -+ break; -+ -+ case rTxAGC_B_CCK1_55_Mcs32: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_1M); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_2M); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_5_5M); -+ for (i = 1; i < 4; ++ i) -+ { ++ case rTxAGC_B_CCK11_A_CCK2_11: ++ if (BitMask == 0xffffff00) { ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_2M); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_5_5M); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_11M); ++ for (i = 1; i < 4; ++i) { + PwrByRateVal[i - 1] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + + ((Value >> (i * 8)) & 0xF)); + } + *RateNum = 3; -+ break; ++ } else if (BitMask == 0x000000ff) { ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_11M); ++ PwrByRateVal[0] = (s8) ((((Value >> 4) & 0xF)) * 10 + (Value & 0xF)); ++ *RateNum = 1; ++ } ++ break; + -+ case 0xC20: -+ case 0xE20: -+ case 0x1820: -+ case 0x1a20: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_1M); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_2M); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_5_5M); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_11M); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; ++ case rTxAGC_A_Mcs03_Mcs00: ++ case rTxAGC_B_Mcs03_Mcs00: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS0); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS1); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS2); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS3); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; + -+ case 0xC24: -+ case 0xE24: -+ case 0x1824: -+ case 0x1a24: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_6M); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_9M); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_12M); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_18M); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; ++ case rTxAGC_A_Mcs07_Mcs04: ++ case rTxAGC_B_Mcs07_Mcs04: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS4); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS5); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS6); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS7); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; + -+ case 0xC28: -+ case 0xE28: -+ case 0x1828: -+ case 0x1a28: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_24M); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_36M); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_48M); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_54M); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; ++ case rTxAGC_A_Mcs11_Mcs08: ++ case rTxAGC_B_Mcs11_Mcs08: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS8); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS9); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS10); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS11); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; + -+ case 0xC2C: -+ case 0xE2C: -+ case 0x182C: -+ case 0x1a2C: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS0); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS1); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS2); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS3); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; ++ case rTxAGC_A_Mcs15_Mcs12: ++ case rTxAGC_B_Mcs15_Mcs12: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS12); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS13); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS14); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS15); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; + -+ case 0xC30: -+ case 0xE30: -+ case 0x1830: -+ case 0x1a30: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS4); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS5); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS6); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS7); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; ++ break; + -+ case 0xC34: -+ case 0xE34: -+ case 0x1834: -+ case 0x1a34: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS8); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS9); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS10); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS11); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; ++ case rTxAGC_B_CCK1_55_Mcs32: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_1M); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_2M); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_5_5M); ++ for (i = 1; i < 4; ++i) { ++ PwrByRateVal[i - 1] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 3; ++ break; + -+ case 0xC38: -+ case 0xE38: -+ case 0x1838: -+ case 0x1a38: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS12); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS13); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS14); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS15); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; ++ case 0xC20: ++ case 0xE20: ++ case 0x1820: ++ case 0x1a20: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_1M); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_2M); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_5_5M); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_11M); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; + -+ case 0xC3C: -+ case 0xE3C: -+ case 0x183C: -+ case 0x1a3C: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT1SS_MCS0); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT1SS_MCS1); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT1SS_MCS2); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT1SS_MCS3); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; ++ case 0xC24: ++ case 0xE24: ++ case 0x1824: ++ case 0x1a24: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_6M); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_9M); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_12M); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_18M); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; + -+ case 0xC40: -+ case 0xE40: -+ case 0x1840: -+ case 0x1a40: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT1SS_MCS4); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT1SS_MCS5); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT1SS_MCS6); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT1SS_MCS7); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; ++ case 0xC28: ++ case 0xE28: ++ case 0x1828: ++ case 0x1a28: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_24M); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_36M); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_48M); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_54M); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; + -+ case 0xC44: -+ case 0xE44: -+ case 0x1844: -+ case 0x1a44: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT1SS_MCS8); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT1SS_MCS9); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS0); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS1); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; ++ case 0xC2C: ++ case 0xE2C: ++ case 0x182C: ++ case 0x1a2C: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS0); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS1); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS2); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS3); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; + -+ case 0xC48: -+ case 0xE48: -+ case 0x1848: -+ case 0x1a48: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS2); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS3); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS4); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS5); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; ++ case 0xC30: ++ case 0xE30: ++ case 0x1830: ++ case 0x1a30: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS4); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS5); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS6); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS7); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; + -+ case 0xC4C: -+ case 0xE4C: -+ case 0x184C: -+ case 0x1a4C: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS6); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS7); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS8); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS9); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; ++ case 0xC34: ++ case 0xE34: ++ case 0x1834: ++ case 0x1a34: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS8); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS9); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS10); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS11); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; + -+ case 0xCD8: -+ case 0xED8: -+ case 0x18D8: -+ case 0x1aD8: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS16); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS17); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS18); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS19); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; ++ case 0xC38: ++ case 0xE38: ++ case 0x1838: ++ case 0x1a38: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS12); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS13); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS14); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS15); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; + -+ case 0xCDC: -+ case 0xEDC: -+ case 0x18DC: -+ case 0x1aDC: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS20); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS21); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS22); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS23); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; ++ case 0xC3C: ++ case 0xE3C: ++ case 0x183C: ++ case 0x1a3C: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT1SS_MCS0); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT1SS_MCS1); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT1SS_MCS2); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT1SS_MCS3); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; + -+ case 0xCE0: -+ case 0xEE0: -+ case 0x18E0: -+ case 0x1aE0: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT3SS_MCS0); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT3SS_MCS1); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT3SS_MCS2); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT3SS_MCS3); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; ++ case 0xC40: ++ case 0xE40: ++ case 0x1840: ++ case 0x1a40: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT1SS_MCS4); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT1SS_MCS5); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT1SS_MCS6); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT1SS_MCS7); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; + -+ case 0xCE4: -+ case 0xEE4: -+ case 0x18E4: -+ case 0x1aE4: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT3SS_MCS4); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT3SS_MCS5); -+ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT3SS_MCS6); -+ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT3SS_MCS7); -+ for (i = 0; i < 4; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; ++ case 0xC44: ++ case 0xE44: ++ case 0x1844: ++ case 0x1a44: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT1SS_MCS8); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT1SS_MCS9); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS0); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS1); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; + -+ case 0xCE8: -+ case 0xEE8: -+ case 0x18E8: -+ case 0x1aE8: -+ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT3SS_MCS8); -+ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT3SS_MCS9); -+ for (i = 0; i < 2; ++ i) -+ { -+ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + -+ ((Value >> (i * 8)) & 0xF)); -+ } -+ *RateNum = 4; -+ break; ++ case 0xC48: ++ case 0xE48: ++ case 0x1848: ++ case 0x1a48: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS2); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS3); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS4); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS5); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; + -+ default: -+ DBG_871X("Invalid RegAddr 0x%x in %s()\n", RegAddr, __func__); -+ break; ++ case 0xC4C: ++ case 0xE4C: ++ case 0x184C: ++ case 0x1a4C: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS6); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS7); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS8); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS9); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; ++ ++ case 0xCD8: ++ case 0xED8: ++ case 0x18D8: ++ case 0x1aD8: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS16); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS17); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS18); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS19); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; ++ ++ case 0xCDC: ++ case 0xEDC: ++ case 0x18DC: ++ case 0x1aDC: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS20); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS21); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS22); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_MCS23); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; ++ ++ case 0xCE0: ++ case 0xEE0: ++ case 0x18E0: ++ case 0x1aE0: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT3SS_MCS0); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT3SS_MCS1); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT3SS_MCS2); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT3SS_MCS3); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; ++ ++ case 0xCE4: ++ case 0xEE4: ++ case 0x18E4: ++ case 0x1aE4: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT3SS_MCS4); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT3SS_MCS5); ++ RateIndex[2] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT3SS_MCS6); ++ RateIndex[3] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT3SS_MCS7); ++ for (i = 0; i < 4; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; ++ ++ case 0xCE8: ++ case 0xEE8: ++ case 0x18E8: ++ case 0x1aE8: ++ RateIndex[0] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT3SS_MCS8); ++ RateIndex[1] = PHY_GetRateIndexOfTxPowerByRate(MGN_VHT3SS_MCS9); ++ for (i = 0; i < 2; ++i) { ++ PwrByRateVal[i] = (s8) ((((Value >> (i * 8 + 4)) & 0xF)) * 10 + ++ ((Value >> (i * 8)) & 0xF)); ++ } ++ *RateNum = 4; ++ break; ++ ++ default: ++ DBG_871X("Invalid RegAddr 0x%x in %s()\n", RegAddr, __func__); ++ break; + }; +} + -+static void -+PHY_StoreTxPowerByRateNew( -+struct adapter *padapter, -+u32 Band, -+u32 RfPath, -+u32 TxNum, -+u32 RegAddr, -+u32 BitMask, -+u32 Data -+ ) ++static void PHY_StoreTxPowerByRateNew( ++ struct adapter *padapter, ++ u32 Band, ++ u32 RfPath, ++ u32 TxNum, ++ u32 RegAddr, ++ u32 BitMask, ++ u32 Data ++) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); ++ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + u8 i = 0, rateIndex[4] = {0}, rateNum = 0; + s8 PwrByRateVal[4] = {0}; + + PHY_GetRateValuesOfTxPowerByRate(padapter, RegAddr, BitMask, Data, rateIndex, PwrByRateVal, &rateNum); + -+ if (Band != BAND_ON_2_4G && Band != BAND_ON_5G) -+ { ++ if (Band != BAND_ON_2_4G && Band != BAND_ON_5G) { + DBG_871X("Invalid Band %d\n", Band); + return; + } + -+ if (RfPath > ODM_RF_PATH_D) -+ { ++ if (RfPath > ODM_RF_PATH_D) { + DBG_871X("Invalid RfPath %d\n", RfPath); + return; + } + -+ if (TxNum > ODM_RF_PATH_D) -+ { ++ if (TxNum > ODM_RF_PATH_D) { + DBG_871X("Invalid TxNum %d\n", TxNum); + return; + } + -+ for (i = 0; i < rateNum; ++i) -+ { ++ for (i = 0; i < rateNum; ++i) { + if (rateIndex[i] == PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS0) || + rateIndex[i] == PHY_GetRateIndexOfTxPowerByRate(MGN_VHT2SS_MCS1)) -+ { + TxNum = RF_2TX; -+ } + + pHalData->TxPwrByRateOffset[Band][RfPath][TxNum][rateIndex[i]] = PwrByRateVal[i]; + } +} + -+static void -+PHY_StoreTxPowerByRateOld( -+struct adapter * padapter, -+u32 RegAddr, -+u32 BitMask, -+u32 Data -+ ) ++static void PHY_StoreTxPowerByRateOld( ++ struct adapter *padapter, u32 RegAddr, u32 BitMask, u32 Data ++) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ u8 index = PHY_GetRateSectionIndexOfTxPowerByRate(padapter, RegAddr, BitMask); ++ u8 index = PHY_GetRateSectionIndexOfTxPowerByRate(padapter, RegAddr, BitMask); + + pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][index] = Data; + /* DBG_871X("MCSTxPowerLevelOriginalOffset[%d][0] = 0x%x\n", pHalData->pwrGroupCnt, */ -+ /* pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][0]); */ ++ /* pHalData->MCSTxPowerLevelOriginalOffset[pHalData->pwrGroupCnt][0]); */ +} + -+void -+PHY_InitTxPowerByRate( -+struct adapter *padapter -+ ) ++void PHY_InitTxPowerByRate(struct adapter *padapter) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + u8 band, rfPath, TxNum, rate; @@ -48032,34 +46519,29 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + pHalData->TxPwrByRateOffset[band][rfPath][TxNum][rate] = 0; +} + -+void -+PHY_StoreTxPowerByRate( -+struct adapter *padapter, -+u32 Band, -+u32 RfPath, -+u32 TxNum, -+u32 RegAddr, -+u32 BitMask, -+u32 Data -+ ) ++void PHY_StoreTxPowerByRate( ++ struct adapter *padapter, ++ u32 Band, ++ u32 RfPath, ++ u32 TxNum, ++ u32 RegAddr, ++ u32 BitMask, ++ u32 Data ++) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + + if (pDM_Odm->PhyRegPgVersion > 0) -+ { + PHY_StoreTxPowerByRateNew(padapter, Band, RfPath, TxNum, RegAddr, BitMask, Data); -+ } -+ else if (pDM_Odm->PhyRegPgVersion == 0) -+ { ++ else if (pDM_Odm->PhyRegPgVersion == 0) { + PHY_StoreTxPowerByRateOld(padapter, RegAddr, BitMask, Data); + + if (RegAddr == rTxAGC_A_Mcs15_Mcs12 && pHalData->rf_type == RF_1T1R) + pHalData->pwrGroupCnt++; + else if (RegAddr == rTxAGC_B_Mcs15_Mcs12 && pHalData->rf_type != RF_1T1R) + pHalData->pwrGroupCnt++; -+ } -+ else ++ } else + DBG_871X("Invalid PHY_REG_PG.txt version %d\n", pDM_Odm->PhyRegPgVersion); + +} @@ -48069,88 +46551,92 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs +struct adapter *padapter + ) +{ -+ u8 base = 0, i = 0, value = 0, -+ band = 0, path = 0, txNum = 0; -+ u8 cckRates[4] = {MGN_1M, MGN_2M, MGN_5_5M, MGN_11M}, -+ ofdmRates[8] = {MGN_6M, MGN_9M, MGN_12M, MGN_18M, MGN_24M, MGN_36M, MGN_48M, MGN_54M}, -+ mcs0_7Rates[8] = {MGN_MCS0, MGN_MCS1, MGN_MCS2, MGN_MCS3, MGN_MCS4, MGN_MCS5, MGN_MCS6, MGN_MCS7}, -+ mcs8_15Rates[8] = {MGN_MCS8, MGN_MCS9, MGN_MCS10, MGN_MCS11, MGN_MCS12, MGN_MCS13, MGN_MCS14, MGN_MCS15}, -+ mcs16_23Rates[8] = {MGN_MCS16, MGN_MCS17, MGN_MCS18, MGN_MCS19, MGN_MCS20, MGN_MCS21, MGN_MCS22, MGN_MCS23}, -+ vht1ssRates[10] = {MGN_VHT1SS_MCS0, MGN_VHT1SS_MCS1, MGN_VHT1SS_MCS2, MGN_VHT1SS_MCS3, MGN_VHT1SS_MCS4, -+ MGN_VHT1SS_MCS5, MGN_VHT1SS_MCS6, MGN_VHT1SS_MCS7, MGN_VHT1SS_MCS8, MGN_VHT1SS_MCS9}, -+ vht2ssRates[10] = {MGN_VHT2SS_MCS0, MGN_VHT2SS_MCS1, MGN_VHT2SS_MCS2, MGN_VHT2SS_MCS3, MGN_VHT2SS_MCS4, -+ MGN_VHT2SS_MCS5, MGN_VHT2SS_MCS6, MGN_VHT2SS_MCS7, MGN_VHT2SS_MCS8, MGN_VHT2SS_MCS9}, -+ vht3ssRates[10] = {MGN_VHT3SS_MCS0, MGN_VHT3SS_MCS1, MGN_VHT3SS_MCS2, MGN_VHT3SS_MCS3, MGN_VHT3SS_MCS4, -+ MGN_VHT3SS_MCS5, MGN_VHT3SS_MCS6, MGN_VHT3SS_MCS7, MGN_VHT3SS_MCS8, MGN_VHT3SS_MCS9}; ++ u8 base = 0, i = 0, value = 0, band = 0, path = 0, txNum = 0; ++ u8 cckRates[4] = { ++ MGN_1M, MGN_2M, MGN_5_5M, MGN_11M ++ }; ++ u8 ofdmRates[8] = { ++ MGN_6M, MGN_9M, MGN_12M, MGN_18M, MGN_24M, MGN_36M, MGN_48M, MGN_54M ++ }; ++ u8 mcs0_7Rates[8] = { ++ MGN_MCS0, MGN_MCS1, MGN_MCS2, MGN_MCS3, MGN_MCS4, MGN_MCS5, MGN_MCS6, MGN_MCS7 ++ }; ++ u8 mcs8_15Rates[8] = { ++ MGN_MCS8, MGN_MCS9, MGN_MCS10, MGN_MCS11, MGN_MCS12, MGN_MCS13, MGN_MCS14, MGN_MCS15 ++ }; ++ u8 mcs16_23Rates[8] = { ++ MGN_MCS16, MGN_MCS17, MGN_MCS18, MGN_MCS19, MGN_MCS20, MGN_MCS21, MGN_MCS22, MGN_MCS23 ++ }; ++ u8 vht1ssRates[10] = { ++ MGN_VHT1SS_MCS0, MGN_VHT1SS_MCS1, MGN_VHT1SS_MCS2, MGN_VHT1SS_MCS3, MGN_VHT1SS_MCS4, ++ MGN_VHT1SS_MCS5, MGN_VHT1SS_MCS6, MGN_VHT1SS_MCS7, MGN_VHT1SS_MCS8, MGN_VHT1SS_MCS9 ++ }; ++ u8 vht2ssRates[10] = { ++ MGN_VHT2SS_MCS0, MGN_VHT2SS_MCS1, MGN_VHT2SS_MCS2, MGN_VHT2SS_MCS3, MGN_VHT2SS_MCS4, ++ MGN_VHT2SS_MCS5, MGN_VHT2SS_MCS6, MGN_VHT2SS_MCS7, MGN_VHT2SS_MCS8, MGN_VHT2SS_MCS9 ++ }; ++ u8 vht3ssRates[10] = { ++ MGN_VHT3SS_MCS0, MGN_VHT3SS_MCS1, MGN_VHT3SS_MCS2, MGN_VHT3SS_MCS3, MGN_VHT3SS_MCS4, ++ MGN_VHT3SS_MCS5, MGN_VHT3SS_MCS6, MGN_VHT3SS_MCS7, MGN_VHT3SS_MCS8, MGN_VHT3SS_MCS9 ++ }; + + /* DBG_871X("===>PHY_ConvertTxPowerByRateInDbmToRelativeValues()\n"); */ + -+ for (band = BAND_ON_2_4G; band <= BAND_ON_5G; ++band) -+ { -+ for (path = ODM_RF_PATH_A; path <= ODM_RF_PATH_D; ++path) -+ { -+ for (txNum = RF_1TX; txNum < RF_MAX_TX_NUM; ++txNum) -+ { ++ for (band = BAND_ON_2_4G; band <= BAND_ON_5G; ++band) { ++ for (path = ODM_RF_PATH_A; path <= ODM_RF_PATH_D; ++path) { ++ for (txNum = RF_1TX; txNum < RF_MAX_TX_NUM; ++txNum) { + /* CCK */ + base = PHY_GetTxPowerByRate(padapter, band, path, txNum, MGN_11M); -+ for (i = 0; i < sizeof(cckRates); ++i) -+ { ++ for (i = 0; i < sizeof(cckRates); ++i) { + value = PHY_GetTxPowerByRate(padapter, band, path, txNum, cckRates[i]); + PHY_SetTxPowerByRate(padapter, band, path, txNum, cckRates[i], value - base); + } + + /* OFDM */ + base = PHY_GetTxPowerByRate(padapter, band, path, txNum, MGN_54M); -+ for (i = 0; i < sizeof(ofdmRates); ++i) -+ { ++ for (i = 0; i < sizeof(ofdmRates); ++i) { + value = PHY_GetTxPowerByRate(padapter, band, path, txNum, ofdmRates[i]); + PHY_SetTxPowerByRate(padapter, band, path, txNum, ofdmRates[i], value - base); + } + + /* HT MCS0~7 */ + base = PHY_GetTxPowerByRate(padapter, band, path, txNum, MGN_MCS7); -+ for (i = 0; i < sizeof(mcs0_7Rates); ++i) -+ { ++ for (i = 0; i < sizeof(mcs0_7Rates); ++i) { + value = PHY_GetTxPowerByRate(padapter, band, path, txNum, mcs0_7Rates[i]); + PHY_SetTxPowerByRate(padapter, band, path, txNum, mcs0_7Rates[i], value - base); + } + + /* HT MCS8~15 */ + base = PHY_GetTxPowerByRate(padapter, band, path, txNum, MGN_MCS15); -+ for (i = 0; i < sizeof(mcs8_15Rates); ++i) -+ { ++ for (i = 0; i < sizeof(mcs8_15Rates); ++i) { + value = PHY_GetTxPowerByRate(padapter, band, path, txNum, mcs8_15Rates[i]); + PHY_SetTxPowerByRate(padapter, band, path, txNum, mcs8_15Rates[i], value - base); + } + + /* HT MCS16~23 */ + base = PHY_GetTxPowerByRate(padapter, band, path, txNum, MGN_MCS23); -+ for (i = 0; i < sizeof(mcs16_23Rates); ++i) -+ { ++ for (i = 0; i < sizeof(mcs16_23Rates); ++i) { + value = PHY_GetTxPowerByRate(padapter, band, path, txNum, mcs16_23Rates[i]); + PHY_SetTxPowerByRate(padapter, band, path, txNum, mcs16_23Rates[i], value - base); + } + + /* VHT 1SS */ + base = PHY_GetTxPowerByRate(padapter, band, path, txNum, MGN_VHT1SS_MCS7); -+ for (i = 0; i < sizeof(vht1ssRates); ++i) -+ { ++ for (i = 0; i < sizeof(vht1ssRates); ++i) { + value = PHY_GetTxPowerByRate(padapter, band, path, txNum, vht1ssRates[i]); + PHY_SetTxPowerByRate(padapter, band, path, txNum, vht1ssRates[i], value - base); + } + + /* VHT 2SS */ + base = PHY_GetTxPowerByRate(padapter, band, path, txNum, MGN_VHT2SS_MCS7); -+ for (i = 0; i < sizeof(vht2ssRates); ++i) -+ { ++ for (i = 0; i < sizeof(vht2ssRates); ++i) { + value = PHY_GetTxPowerByRate(padapter, band, path, txNum, vht2ssRates[i]); + PHY_SetTxPowerByRate(padapter, band, path, txNum, vht2ssRates[i], value - base); + } + + /* VHT 3SS */ + base = PHY_GetTxPowerByRate(padapter, band, path, txNum, MGN_VHT3SS_MCS7); -+ for (i = 0; i < sizeof(vht3ssRates); ++i) -+ { ++ for (i = 0; i < sizeof(vht3ssRates); ++i) { + value = PHY_GetTxPowerByRate(padapter, band, path, txNum, vht3ssRates[i]); + PHY_SetTxPowerByRate(padapter, band, path, txNum, vht3ssRates[i], value - base); + } @@ -48165,130 +46651,95 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + * This function must be called if the value in the PHY_REG_PG.txt(or header) + * is exact dBm values + */ -+void -+PHY_TxPowerByRateConfiguration( -+ struct adapter * padapter -+ ) ++void PHY_TxPowerByRateConfiguration(struct adapter *padapter) +{ + phy_StoreTxPowerByRateBase(padapter); + phy_ConvertTxPowerByRateInDbmToRelativeValues(padapter); +} + -+void -+PHY_SetTxPowerIndexByRateSection( -+struct adapter * padapter, -+u8 RFPath, -+u8 Channel, -+u8 RateSection -+ ) ++void PHY_SetTxPowerIndexByRateSection( ++ struct adapter *padapter, u8 RFPath, u8 Channel, u8 RateSection ++) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + -+ if (RateSection == CCK) -+ { ++ if (RateSection == CCK) { + u8 cckRates[] = {MGN_1M, MGN_2M, MGN_5_5M, MGN_11M}; + if (pHalData->CurrentBandType == BAND_ON_2_4G) + PHY_SetTxPowerIndexByRateArray(padapter, RFPath, pHalData->CurrentChannelBW, Channel, + cckRates, sizeof(cckRates)/sizeof(u8)); + -+ } -+ else if (RateSection == OFDM) -+ { ++ } else if (RateSection == OFDM) { + u8 ofdmRates[] = {MGN_6M, MGN_9M, MGN_12M, MGN_18M, MGN_24M, MGN_36M, MGN_48M, MGN_54M}; + PHY_SetTxPowerIndexByRateArray(padapter, RFPath, pHalData->CurrentChannelBW, Channel, + ofdmRates, sizeof(ofdmRates)/sizeof(u8)); + -+ } -+ else if (RateSection == HT_MCS0_MCS7) -+ { ++ } else if (RateSection == HT_MCS0_MCS7) { + u8 htRates1T[] = {MGN_MCS0, MGN_MCS1, MGN_MCS2, MGN_MCS3, MGN_MCS4, MGN_MCS5, MGN_MCS6, MGN_MCS7}; + PHY_SetTxPowerIndexByRateArray(padapter, RFPath, pHalData->CurrentChannelBW, Channel, + htRates1T, sizeof(htRates1T)/sizeof(u8)); + -+ } -+ else if (RateSection == HT_MCS8_MCS15) -+ { ++ } else if (RateSection == HT_MCS8_MCS15) { + u8 htRates2T[] = {MGN_MCS8, MGN_MCS9, MGN_MCS10, MGN_MCS11, MGN_MCS12, MGN_MCS13, MGN_MCS14, MGN_MCS15}; + PHY_SetTxPowerIndexByRateArray(padapter, RFPath, pHalData->CurrentChannelBW, Channel, + htRates2T, sizeof(htRates2T)/sizeof(u8)); + -+ } -+ else if (RateSection == HT_MCS16_MCS23) -+ { ++ } else if (RateSection == HT_MCS16_MCS23) { + u8 htRates3T[] = {MGN_MCS16, MGN_MCS17, MGN_MCS18, MGN_MCS19, MGN_MCS20, MGN_MCS21, MGN_MCS22, MGN_MCS23}; + PHY_SetTxPowerIndexByRateArray(padapter, RFPath, pHalData->CurrentChannelBW, Channel, + htRates3T, sizeof(htRates3T)/sizeof(u8)); + -+ } -+ else if (RateSection == HT_MCS24_MCS31) -+ { ++ } else if (RateSection == HT_MCS24_MCS31) { + u8 htRates4T[] = {MGN_MCS24, MGN_MCS25, MGN_MCS26, MGN_MCS27, MGN_MCS28, MGN_MCS29, MGN_MCS30, MGN_MCS31}; + PHY_SetTxPowerIndexByRateArray(padapter, RFPath, pHalData->CurrentChannelBW, Channel, + htRates4T, sizeof(htRates4T)/sizeof(u8)); + -+ } -+ else if (RateSection == VHT_1SSMCS0_1SSMCS9) -+ { ++ } else if (RateSection == VHT_1SSMCS0_1SSMCS9) { + u8 vhtRates1T[] = {MGN_VHT1SS_MCS0, MGN_VHT1SS_MCS1, MGN_VHT1SS_MCS2, MGN_VHT1SS_MCS3, MGN_VHT1SS_MCS4, + MGN_VHT1SS_MCS5, MGN_VHT1SS_MCS6, MGN_VHT1SS_MCS7, MGN_VHT1SS_MCS8, MGN_VHT1SS_MCS9}; + PHY_SetTxPowerIndexByRateArray(padapter, RFPath, pHalData->CurrentChannelBW, Channel, + vhtRates1T, sizeof(vhtRates1T)/sizeof(u8)); + -+ } -+ else if (RateSection == VHT_2SSMCS0_2SSMCS9) -+ { ++ } else if (RateSection == VHT_2SSMCS0_2SSMCS9) { + u8 vhtRates2T[] = {MGN_VHT2SS_MCS0, MGN_VHT2SS_MCS1, MGN_VHT2SS_MCS2, MGN_VHT2SS_MCS3, MGN_VHT2SS_MCS4, + MGN_VHT2SS_MCS5, MGN_VHT2SS_MCS6, MGN_VHT2SS_MCS7, MGN_VHT2SS_MCS8, MGN_VHT2SS_MCS9}; + + PHY_SetTxPowerIndexByRateArray(padapter, RFPath, pHalData->CurrentChannelBW, Channel, + vhtRates2T, sizeof(vhtRates2T)/sizeof(u8)); -+ } -+ else if (RateSection == VHT_3SSMCS0_3SSMCS9) -+ { ++ } else if (RateSection == VHT_3SSMCS0_3SSMCS9) { + u8 vhtRates3T[] = {MGN_VHT3SS_MCS0, MGN_VHT3SS_MCS1, MGN_VHT3SS_MCS2, MGN_VHT3SS_MCS3, MGN_VHT3SS_MCS4, + MGN_VHT3SS_MCS5, MGN_VHT3SS_MCS6, MGN_VHT3SS_MCS7, MGN_VHT3SS_MCS8, MGN_VHT3SS_MCS9}; + + PHY_SetTxPowerIndexByRateArray(padapter, RFPath, pHalData->CurrentChannelBW, Channel, + vhtRates3T, sizeof(vhtRates3T)/sizeof(u8)); -+ } -+ else if (RateSection == VHT_4SSMCS0_4SSMCS9) -+ { ++ } else if (RateSection == VHT_4SSMCS0_4SSMCS9) { + u8 vhtRates4T[] = {MGN_VHT4SS_MCS0, MGN_VHT4SS_MCS1, MGN_VHT4SS_MCS2, MGN_VHT4SS_MCS3, MGN_VHT4SS_MCS4, + MGN_VHT4SS_MCS5, MGN_VHT4SS_MCS6, MGN_VHT4SS_MCS7, MGN_VHT4SS_MCS8, MGN_VHT4SS_MCS9}; + + PHY_SetTxPowerIndexByRateArray(padapter, RFPath, pHalData->CurrentChannelBW, Channel, + vhtRates4T, sizeof(vhtRates4T)/sizeof(u8)); -+ } -+ else -+ { ++ } else + DBG_871X("Invalid RateSection %d in %s", RateSection, __func__); -+ } +} + -+static bool -+phy_GetChnlIndex( -+u8 Channel, -+ u8 *ChannelIdx -+ ) ++static bool phy_GetChnlIndex(u8 Channel, u8 *ChannelIdx) +{ -+ u8 channel5G[CHANNEL_MAX_NUMBER_5G] = -+ {36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 100, 102, 104, 106, 108, 110, 112, -+ 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 149, 151, -+ 153, 155, 157, 159, 161, 163, 165, 167, 168, 169, 171, 173, 175, 177}; ++ u8 channel5G[CHANNEL_MAX_NUMBER_5G] = { ++ 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 100, 102, ++ 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, ++ 132, 134, 136, 138, 140, 142, 144, 149, 151, 153, 155, 157, 159, 161, ++ 163, 165, 167, 168, 169, 171, 173, 175, 177 ++ }; + u8 i = 0; -+ bool bIn24G =true; ++ bool bIn24G = true; + -+ if (Channel <= 14) -+ { -+ bIn24G =true; -+ *ChannelIdx = Channel -1; -+ } -+ else -+ { ++ if (Channel <= 14) { ++ bIn24G = true; ++ *ChannelIdx = Channel-1; ++ } else { + bIn24G = false; + -+ for (i = 0; i < sizeof(channel5G)/sizeof(u8); ++i) -+ { ++ for (i = 0; i < sizeof(channel5G)/sizeof(u8); ++i) { + if (channel5G[i] == Channel) { + *ChannelIdx = i; + return bIn24G; @@ -48299,23 +46750,21 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + return bIn24G; +} + -+u8 -+PHY_GetTxPowerIndexBase( -+struct adapter * padapter, -+u8 RFPath, -+u8 Rate, -+enum CHANNEL_WIDTH BandWidth, -+u8 Channel, -+ bool *bIn24G -+ ) ++u8 PHY_GetTxPowerIndexBase( ++ struct adapter *padapter, ++ u8 RFPath, ++ u8 Rate, ++ enum CHANNEL_WIDTH BandWidth, ++ u8 Channel, ++ bool *bIn24G ++) +{ -+ struct hal_com_data * pHalData = GET_HAL_DATA(padapter); -+ u8 i = 0; /* default set to 1S */ -+ u8 txPower = 0; -+ u8 chnlIdx = (Channel-1); ++ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); ++ u8 i = 0; /* default set to 1S */ ++ u8 txPower = 0; ++ u8 chnlIdx = (Channel-1); + -+ if (HAL_IsLegalChannel(padapter, Channel) == false) -+ { ++ if (HAL_IsLegalChannel(padapter, Channel) == false) { + chnlIdx = 0; + DBG_871X("Illegal channel!!\n"); + } @@ -48324,33 +46773,23 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + + /* DBG_871X("[%s] Channel Index: %d\n", (*bIn24G?"2.4G":"5G"), chnlIdx); */ + -+ if (*bIn24G) /* 3 ============================== 2.4 G ============================== */ -+ { ++ if (*bIn24G) { /* 3 ============================== 2.4 G ============================== */ + if (IS_CCK_RATE(Rate)) -+ { + txPower = pHalData->Index24G_CCK_Base[RFPath][chnlIdx]; -+ } + else if (MGN_6M <= Rate) -+ { + txPower = pHalData->Index24G_BW40_Base[RFPath][chnlIdx]; -+ } + else -+ { + DBG_871X("PHY_GetTxPowerIndexBase: INVALID Rate.\n"); -+ } + + /* DBG_871X("Base Tx power(RF-%c, Rate #%d, Channel Index %d) = 0x%X\n", */ -+ /* ((RFPath == 0)?'A':'B'), Rate, chnlIdx, txPower); */ ++ /* ((RFPath == 0)?'A':'B'), Rate, chnlIdx, txPower); */ + + /* OFDM-1T */ -+ if ((MGN_6M <= Rate && Rate <= MGN_54M) && ! IS_CCK_RATE(Rate)) -+ { ++ if ((MGN_6M <= Rate && Rate <= MGN_54M) && !IS_CCK_RATE(Rate)) { + txPower += pHalData->OFDM_24G_Diff[RFPath][TX_1S]; + /* DBG_871X("+PowerDiff 2.4G (RF-%c): (OFDM-1T) = (%d)\n", ((RFPath == 0)?'A':'B'), pHalData->OFDM_24G_Diff[RFPath][TX_1S]); */ + } -+ /* BW20-1S, BW20-2S */ -+ if (BandWidth == CHANNEL_WIDTH_20) -+ { ++ if (BandWidth == CHANNEL_WIDTH_20) { /* BW20-1S, BW20-2S */ + if ((MGN_MCS0 <= Rate && Rate <= MGN_MCS31) || (MGN_VHT1SS_MCS0 <= Rate && Rate <= MGN_VHT4SS_MCS9)) + txPower += pHalData->BW20_24G_Diff[RFPath][TX_1S]; + if ((MGN_MCS8 <= Rate && Rate <= MGN_MCS31) || (MGN_VHT2SS_MCS0 <= Rate && Rate <= MGN_VHT4SS_MCS9)) @@ -48361,12 +46800,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + txPower += pHalData->BW20_24G_Diff[RFPath][TX_4S]; + + /* DBG_871X("+PowerDiff 2.4G (RF-%c): (BW20-1S, BW20-2S, BW20-3S, BW20-4S) = (%d, %d, %d, %d)\n", ((RFPath == 0)?'A':(RFPath == 1)?'B':(RFPath ==2)?'C':'D'), */ -+ /* pHalData->BW20_24G_Diff[RFPath][TX_1S], pHalData->BW20_24G_Diff[RFPath][TX_2S], */ -+ /* pHalData->BW20_24G_Diff[RFPath][TX_3S], pHalData->BW20_24G_Diff[RFPath][TX_4S]); */ -+ } -+ /* BW40-1S, BW40-2S */ -+ else if (BandWidth == CHANNEL_WIDTH_40) -+ { ++ /* pHalData->BW20_24G_Diff[RFPath][TX_1S], pHalData->BW20_24G_Diff[RFPath][TX_2S], */ ++ /* pHalData->BW20_24G_Diff[RFPath][TX_3S], pHalData->BW20_24G_Diff[RFPath][TX_4S]); */ ++ } else if (BandWidth == CHANNEL_WIDTH_40) { /* BW40-1S, BW40-2S */ + if ((MGN_MCS0 <= Rate && Rate <= MGN_MCS31) || (MGN_VHT1SS_MCS0 <= Rate && Rate <= MGN_VHT4SS_MCS9)) + txPower += pHalData->BW40_24G_Diff[RFPath][TX_1S]; + if ((MGN_MCS8 <= Rate && Rate <= MGN_MCS31) || (MGN_VHT2SS_MCS0 <= Rate && Rate <= MGN_VHT4SS_MCS9)) @@ -48377,12 +46813,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + txPower += pHalData->BW40_24G_Diff[RFPath][TX_4S]; + + /* DBG_871X("+PowerDiff 2.4G (RF-%c): (BW40-1S, BW40-2S, BW40-3S, BW40-4S) = (%d, %d, %d, %d)\n", ((RFPath == 0)?'A':(RFPath == 1)?'B':(RFPath ==2)?'C':'D'), */ -+ /* pHalData->BW40_24G_Diff[RFPath][TX_1S], pHalData->BW40_24G_Diff[RFPath][TX_2S], */ -+ /* pHalData->BW40_24G_Diff[RFPath][TX_3S], pHalData->BW40_24G_Diff[RFPath][TX_4S]); */ ++ /* pHalData->BW40_24G_Diff[RFPath][TX_1S], pHalData->BW40_24G_Diff[RFPath][TX_2S], */ ++ /* pHalData->BW40_24G_Diff[RFPath][TX_3S], pHalData->BW40_24G_Diff[RFPath][TX_4S]); */ + } + /* Willis suggest adopt BW 40M power index while in BW 80 mode */ -+ else if (BandWidth == CHANNEL_WIDTH_80) -+ { ++ else if (BandWidth == CHANNEL_WIDTH_80) { + if ((MGN_MCS0 <= Rate && Rate <= MGN_MCS31) || (MGN_VHT1SS_MCS0 <= Rate && Rate <= MGN_VHT4SS_MCS9)) + txPower += pHalData->BW40_24G_Diff[RFPath][TX_1S]; + if ((MGN_MCS8 <= Rate && Rate <= MGN_MCS31) || (MGN_VHT2SS_MCS0 <= Rate && Rate <= MGN_VHT4SS_MCS9)) @@ -48393,34 +46828,26 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + txPower += pHalData->BW40_24G_Diff[RFPath][TX_4S]; + + /* DBG_871X("+PowerDiff 2.4G (RF-%c): (BW40-1S, BW40-2S, BW40-3S, BW40-4T) = (%d, %d, %d, %d) P.S. Current is in BW 80MHz\n", ((RFPath == 0)?'A':(RFPath == 1)?'B':(RFPath ==2)?'C':'D'), */ -+ /* pHalData->BW40_24G_Diff[RFPath][TX_1S], pHalData->BW40_24G_Diff[RFPath][TX_2S], */ -+ /* pHalData->BW40_24G_Diff[RFPath][TX_3S], pHalData->BW40_24G_Diff[RFPath][TX_4S]); */ ++ /* pHalData->BW40_24G_Diff[RFPath][TX_1S], pHalData->BW40_24G_Diff[RFPath][TX_2S], */ ++ /* pHalData->BW40_24G_Diff[RFPath][TX_3S], pHalData->BW40_24G_Diff[RFPath][TX_4S]); */ + } -+ } -+ else /* 3 ============================== 5 G ============================== */ -+ { ++ } else {/* 3 ============================== 5 G ============================== */ + if (MGN_6M <= Rate) -+ { + txPower = pHalData->Index5G_BW40_Base[RFPath][chnlIdx]; -+ } + else -+ { + DBG_871X("===> mpt_ProQueryCalTxPower_Jaguar: INVALID Rate.\n"); -+ } + + /* DBG_871X("Base Tx power(RF-%c, Rate #%d, Channel Index %d) = 0x%X\n", */ -+ /* ((RFPath == 0)?'A':'B'), Rate, chnlIdx, txPower); */ ++ /* ((RFPath == 0)?'A':'B'), Rate, chnlIdx, txPower); */ + + /* OFDM-1T */ -+ if ((MGN_6M <= Rate && Rate <= MGN_54M) && ! IS_CCK_RATE(Rate)) -+ { ++ if ((MGN_6M <= Rate && Rate <= MGN_54M) && !IS_CCK_RATE(Rate)) { + txPower += pHalData->OFDM_5G_Diff[RFPath][TX_1S]; + /* DBG_871X("+PowerDiff 5G (RF-%c): (OFDM-1T) = (%d)\n", ((RFPath == 0)?'A':'B'), pHalData->OFDM_5G_Diff[RFPath][TX_1S]); */ + } + + /* BW20-1S, BW20-2S */ -+ if (BandWidth == CHANNEL_WIDTH_20) -+ { ++ if (BandWidth == CHANNEL_WIDTH_20) { + if ((MGN_MCS0 <= Rate && Rate <= MGN_MCS31) || (MGN_VHT1SS_MCS0 <= Rate && Rate <= MGN_VHT4SS_MCS9)) + txPower += pHalData->BW20_5G_Diff[RFPath][TX_1S]; + if ((MGN_MCS8 <= Rate && Rate <= MGN_MCS31) || (MGN_VHT2SS_MCS0 <= Rate && Rate <= MGN_VHT4SS_MCS9)) @@ -48431,12 +46858,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + txPower += pHalData->BW20_5G_Diff[RFPath][TX_4S]; + + /* DBG_871X("+PowerDiff 5G (RF-%c): (BW20-1S, BW20-2S, BW20-3S, BW20-4S) = (%d, %d, %d, %d)\n", ((RFPath == 0)?'A':(RFPath == 1)?'B':(RFPath ==2)?'C':'D'), */ -+ /* pHalData->BW20_5G_Diff[RFPath][TX_1S], pHalData->BW20_5G_Diff[RFPath][TX_2S], */ -+ /* pHalData->BW20_5G_Diff[RFPath][TX_3S], pHalData->BW20_5G_Diff[RFPath][TX_4S]); */ -+ } -+ /* BW40-1S, BW40-2S */ -+ else if (BandWidth == CHANNEL_WIDTH_40) -+ { ++ /* pHalData->BW20_5G_Diff[RFPath][TX_1S], pHalData->BW20_5G_Diff[RFPath][TX_2S], */ ++ /* pHalData->BW20_5G_Diff[RFPath][TX_3S], pHalData->BW20_5G_Diff[RFPath][TX_4S]); */ ++ } else if (BandWidth == CHANNEL_WIDTH_40) { /* BW40-1S, BW40-2S */ + if ((MGN_MCS0 <= Rate && Rate <= MGN_MCS31) || (MGN_VHT1SS_MCS0 <= Rate && Rate <= MGN_VHT4SS_MCS9)) + txPower += pHalData->BW40_5G_Diff[RFPath][TX_1S]; + if ((MGN_MCS8 <= Rate && Rate <= MGN_MCS31) || (MGN_VHT2SS_MCS0 <= Rate && Rate <= MGN_VHT4SS_MCS9)) @@ -48447,12 +46871,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + txPower += pHalData->BW40_5G_Diff[RFPath][TX_4S]; + + /* DBG_871X("+PowerDiff 5G(RF-%c): (BW40-1S, BW40-2S) = (%d, %d, %d, %d)\n", ((RFPath == 0)?'A':(RFPath == 1)?'B':(RFPath ==2)?'C':'D'), */ -+ /* pHalData->BW40_5G_Diff[RFPath][TX_1S], pHalData->BW40_5G_Diff[RFPath][TX_2S], */ -+ /* pHalData->BW40_5G_Diff[RFPath][TX_3S], pHalData->BW40_5G_Diff[RFPath][TX_4S]); */ -+ } -+ /* BW80-1S, BW80-2S */ -+ else if (BandWidth == CHANNEL_WIDTH_80) -+ { ++ /* pHalData->BW40_5G_Diff[RFPath][TX_1S], pHalData->BW40_5G_Diff[RFPath][TX_2S], */ ++ /* pHalData->BW40_5G_Diff[RFPath][TX_3S], pHalData->BW40_5G_Diff[RFPath][TX_4S]); */ ++ } else if (BandWidth == CHANNEL_WIDTH_80) { /* BW80-1S, BW80-2S */ + /* <20121220, Kordan> Get the index of array "Index5G_BW80_Base". */ + u8 channel5G_80M[CHANNEL_MAX_NUMBER_5G_80M] = {42, 58, 106, 122, 138, 155, 171}; + for (i = 0; i < sizeof(channel5G_80M)/sizeof(u8); ++i) @@ -48471,35 +46892,27 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + txPower += pHalData->BW80_5G_Diff[RFPath][TX_4S]; + + /* DBG_871X("+PowerDiff 5G(RF-%c): (BW80-1S, BW80-2S, BW80-3S, BW80-4S) = (%d, %d, %d, %d)\n", ((RFPath == 0)?'A':(RFPath == 1)?'B':(RFPath ==2)?'C':'D'), */ -+ /* pHalData->BW80_5G_Diff[RFPath][TX_1S], pHalData->BW80_5G_Diff[RFPath][TX_2S], */ -+ /* pHalData->BW80_5G_Diff[RFPath][TX_3S], pHalData->BW80_5G_Diff[RFPath][TX_4S]); */ ++ /* pHalData->BW80_5G_Diff[RFPath][TX_1S], pHalData->BW80_5G_Diff[RFPath][TX_2S], */ ++ /* pHalData->BW80_5G_Diff[RFPath][TX_3S], pHalData->BW80_5G_Diff[RFPath][TX_4S]); */ + } + } + + return txPower; +} + -+s8 -+PHY_GetTxPowerTrackingOffset( -+ struct adapter *padapter, -+ u8 RFPath, -+ u8 Rate -+ ) ++s8 PHY_GetTxPowerTrackingOffset(struct adapter *padapter, u8 RFPath, u8 Rate) +{ -+ struct hal_com_data * pHalData = GET_HAL_DATA(padapter); -+ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; -+ s8 offset = 0; ++ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); ++ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; ++ s8 offset = 0; + + if (pDM_Odm->RFCalibrateInfo.TxPowerTrackControl == false) + return offset; + -+ if ((Rate == MGN_1M) ||(Rate == MGN_2M)||(Rate == MGN_5_5M)||(Rate == MGN_11M)) -+ { ++ if ((Rate == MGN_1M) || (Rate == MGN_2M) || (Rate == MGN_5_5M) || (Rate == MGN_11M)) { + offset = pDM_Odm->Remnant_CCKSwingIdx; + /* DBG_871X("+Remnant_CCKSwingIdx = 0x%x\n", RFPath, Rate, pDM_Odm->Remnant_CCKSwingIdx); */ -+ } -+ else -+ { ++ } else { + offset = pDM_Odm->Remnant_OFDMSwingIdx[RFPath]; + /* DBG_871X("+Remanant_OFDMSwingIdx[RFPath %u][Rate 0x%x] = 0x%x\n", RFPath, Rate, pDM_Odm->Remnant_OFDMSwingIdx[RFPath]); */ + @@ -48508,140 +46921,295 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + return offset; +} + -+u8 -+PHY_GetRateIndexOfTxPowerByRate( -+u8 Rate -+ ) ++u8 PHY_GetRateIndexOfTxPowerByRate(u8 Rate) +{ + u8 index = 0; -+ switch (Rate) -+ { -+ case MGN_1M: index = 0; break; -+ case MGN_2M: index = 1; break; -+ case MGN_5_5M: index = 2; break; -+ case MGN_11M: index = 3; break; -+ case MGN_6M: index = 4; break; -+ case MGN_9M: index = 5; break; -+ case MGN_12M: index = 6; break; -+ case MGN_18M: index = 7; break; -+ case MGN_24M: index = 8; break; -+ case MGN_36M: index = 9; break; -+ case MGN_48M: index = 10; break; -+ case MGN_54M: index = 11; break; -+ case MGN_MCS0: index = 12; break; -+ case MGN_MCS1: index = 13; break; -+ case MGN_MCS2: index = 14; break; -+ case MGN_MCS3: index = 15; break; -+ case MGN_MCS4: index = 16; break; -+ case MGN_MCS5: index = 17; break; -+ case MGN_MCS6: index = 18; break; -+ case MGN_MCS7: index = 19; break; -+ case MGN_MCS8: index = 20; break; -+ case MGN_MCS9: index = 21; break; -+ case MGN_MCS10: index = 22; break; -+ case MGN_MCS11: index = 23; break; -+ case MGN_MCS12: index = 24; break; -+ case MGN_MCS13: index = 25; break; -+ case MGN_MCS14: index = 26; break; -+ case MGN_MCS15: index = 27; break; -+ case MGN_MCS16: index = 28; break; -+ case MGN_MCS17: index = 29; break; -+ case MGN_MCS18: index = 30; break; -+ case MGN_MCS19: index = 31; break; -+ case MGN_MCS20: index = 32; break; -+ case MGN_MCS21: index = 33; break; -+ case MGN_MCS22: index = 34; break; -+ case MGN_MCS23: index = 35; break; -+ case MGN_MCS24: index = 36; break; -+ case MGN_MCS25: index = 37; break; -+ case MGN_MCS26: index = 38; break; -+ case MGN_MCS27: index = 39; break; -+ case MGN_MCS28: index = 40; break; -+ case MGN_MCS29: index = 41; break; -+ case MGN_MCS30: index = 42; break; -+ case MGN_MCS31: index = 43; break; -+ case MGN_VHT1SS_MCS0: index = 44; break; -+ case MGN_VHT1SS_MCS1: index = 45; break; -+ case MGN_VHT1SS_MCS2: index = 46; break; -+ case MGN_VHT1SS_MCS3: index = 47; break; -+ case MGN_VHT1SS_MCS4: index = 48; break; -+ case MGN_VHT1SS_MCS5: index = 49; break; -+ case MGN_VHT1SS_MCS6: index = 50; break; -+ case MGN_VHT1SS_MCS7: index = 51; break; -+ case MGN_VHT1SS_MCS8: index = 52; break; -+ case MGN_VHT1SS_MCS9: index = 53; break; -+ case MGN_VHT2SS_MCS0: index = 54; break; -+ case MGN_VHT2SS_MCS1: index = 55; break; -+ case MGN_VHT2SS_MCS2: index = 56; break; -+ case MGN_VHT2SS_MCS3: index = 57; break; -+ case MGN_VHT2SS_MCS4: index = 58; break; -+ case MGN_VHT2SS_MCS5: index = 59; break; -+ case MGN_VHT2SS_MCS6: index = 60; break; -+ case MGN_VHT2SS_MCS7: index = 61; break; -+ case MGN_VHT2SS_MCS8: index = 62; break; -+ case MGN_VHT2SS_MCS9: index = 63; break; -+ case MGN_VHT3SS_MCS0: index = 64; break; -+ case MGN_VHT3SS_MCS1: index = 65; break; -+ case MGN_VHT3SS_MCS2: index = 66; break; -+ case MGN_VHT3SS_MCS3: index = 67; break; -+ case MGN_VHT3SS_MCS4: index = 68; break; -+ case MGN_VHT3SS_MCS5: index = 69; break; -+ case MGN_VHT3SS_MCS6: index = 70; break; -+ case MGN_VHT3SS_MCS7: index = 71; break; -+ case MGN_VHT3SS_MCS8: index = 72; break; -+ case MGN_VHT3SS_MCS9: index = 73; break; -+ case MGN_VHT4SS_MCS0: index = 74; break; -+ case MGN_VHT4SS_MCS1: index = 75; break; -+ case MGN_VHT4SS_MCS2: index = 76; break; -+ case MGN_VHT4SS_MCS3: index = 77; break; -+ case MGN_VHT4SS_MCS4: index = 78; break; -+ case MGN_VHT4SS_MCS5: index = 79; break; -+ case MGN_VHT4SS_MCS6: index = 80; break; -+ case MGN_VHT4SS_MCS7: index = 81; break; -+ case MGN_VHT4SS_MCS8: index = 82; break; -+ case MGN_VHT4SS_MCS9: index = 83; break; -+ default: -+ DBG_871X("Invalid rate 0x%x in %s\n", Rate, __func__); -+ break; ++ switch (Rate) { ++ case MGN_1M: ++ index = 0; ++ break; ++ case MGN_2M: ++ index = 1; ++ break; ++ case MGN_5_5M: ++ index = 2; ++ break; ++ case MGN_11M: ++ index = 3; ++ break; ++ case MGN_6M: ++ index = 4; ++ break; ++ case MGN_9M: ++ index = 5; ++ break; ++ case MGN_12M: ++ index = 6; ++ break; ++ case MGN_18M: ++ index = 7; ++ break; ++ case MGN_24M: ++ index = 8; ++ break; ++ case MGN_36M: ++ index = 9; ++ break; ++ case MGN_48M: ++ index = 10; ++ break; ++ case MGN_54M: ++ index = 11; ++ break; ++ case MGN_MCS0: ++ index = 12; ++ break; ++ case MGN_MCS1: ++ index = 13; ++ break; ++ case MGN_MCS2: ++ index = 14; ++ break; ++ case MGN_MCS3: ++ index = 15; ++ break; ++ case MGN_MCS4: ++ index = 16; ++ break; ++ case MGN_MCS5: ++ index = 17; ++ break; ++ case MGN_MCS6: ++ index = 18; ++ break; ++ case MGN_MCS7: ++ index = 19; ++ break; ++ case MGN_MCS8: ++ index = 20; ++ break; ++ case MGN_MCS9: ++ index = 21; ++ break; ++ case MGN_MCS10: ++ index = 22; ++ break; ++ case MGN_MCS11: ++ index = 23; ++ break; ++ case MGN_MCS12: ++ index = 24; ++ break; ++ case MGN_MCS13: ++ index = 25; ++ break; ++ case MGN_MCS14: ++ index = 26; ++ break; ++ case MGN_MCS15: ++ index = 27; ++ break; ++ case MGN_MCS16: ++ index = 28; ++ break; ++ case MGN_MCS17: ++ index = 29; ++ break; ++ case MGN_MCS18: ++ index = 30; ++ break; ++ case MGN_MCS19: ++ index = 31; ++ break; ++ case MGN_MCS20: ++ index = 32; ++ break; ++ case MGN_MCS21: ++ index = 33; ++ break; ++ case MGN_MCS22: ++ index = 34; ++ break; ++ case MGN_MCS23: ++ index = 35; ++ break; ++ case MGN_MCS24: ++ index = 36; ++ break; ++ case MGN_MCS25: ++ index = 37; ++ break; ++ case MGN_MCS26: ++ index = 38; ++ break; ++ case MGN_MCS27: ++ index = 39; ++ break; ++ case MGN_MCS28: ++ index = 40; ++ break; ++ case MGN_MCS29: ++ index = 41; ++ break; ++ case MGN_MCS30: ++ index = 42; ++ break; ++ case MGN_MCS31: ++ index = 43; ++ break; ++ case MGN_VHT1SS_MCS0: ++ index = 44; ++ break; ++ case MGN_VHT1SS_MCS1: ++ index = 45; ++ break; ++ case MGN_VHT1SS_MCS2: ++ index = 46; ++ break; ++ case MGN_VHT1SS_MCS3: ++ index = 47; ++ break; ++ case MGN_VHT1SS_MCS4: ++ index = 48; ++ break; ++ case MGN_VHT1SS_MCS5: ++ index = 49; ++ break; ++ case MGN_VHT1SS_MCS6: ++ index = 50; ++ break; ++ case MGN_VHT1SS_MCS7: ++ index = 51; ++ break; ++ case MGN_VHT1SS_MCS8: ++ index = 52; ++ break; ++ case MGN_VHT1SS_MCS9: ++ index = 53; ++ break; ++ case MGN_VHT2SS_MCS0: ++ index = 54; ++ break; ++ case MGN_VHT2SS_MCS1: ++ index = 55; ++ break; ++ case MGN_VHT2SS_MCS2: ++ index = 56; ++ break; ++ case MGN_VHT2SS_MCS3: ++ index = 57; ++ break; ++ case MGN_VHT2SS_MCS4: ++ index = 58; ++ break; ++ case MGN_VHT2SS_MCS5: ++ index = 59; ++ break; ++ case MGN_VHT2SS_MCS6: ++ index = 60; ++ break; ++ case MGN_VHT2SS_MCS7: ++ index = 61; ++ break; ++ case MGN_VHT2SS_MCS8: ++ index = 62; ++ break; ++ case MGN_VHT2SS_MCS9: ++ index = 63; ++ break; ++ case MGN_VHT3SS_MCS0: ++ index = 64; ++ break; ++ case MGN_VHT3SS_MCS1: ++ index = 65; ++ break; ++ case MGN_VHT3SS_MCS2: ++ index = 66; ++ break; ++ case MGN_VHT3SS_MCS3: ++ index = 67; ++ break; ++ case MGN_VHT3SS_MCS4: ++ index = 68; ++ break; ++ case MGN_VHT3SS_MCS5: ++ index = 69; ++ break; ++ case MGN_VHT3SS_MCS6: ++ index = 70; ++ break; ++ case MGN_VHT3SS_MCS7: ++ index = 71; ++ break; ++ case MGN_VHT3SS_MCS8: ++ index = 72; ++ break; ++ case MGN_VHT3SS_MCS9: ++ index = 73; ++ break; ++ case MGN_VHT4SS_MCS0: ++ index = 74; ++ break; ++ case MGN_VHT4SS_MCS1: ++ index = 75; ++ break; ++ case MGN_VHT4SS_MCS2: ++ index = 76; ++ break; ++ case MGN_VHT4SS_MCS3: ++ index = 77; ++ break; ++ case MGN_VHT4SS_MCS4: ++ index = 78; ++ break; ++ case MGN_VHT4SS_MCS5: ++ index = 79; ++ break; ++ case MGN_VHT4SS_MCS6: ++ index = 80; ++ break; ++ case MGN_VHT4SS_MCS7: ++ index = 81; ++ break; ++ case MGN_VHT4SS_MCS8: ++ index = 82; ++ break; ++ case MGN_VHT4SS_MCS9: ++ index = 83; ++ break; ++ default: ++ DBG_871X("Invalid rate 0x%x in %s\n", Rate, __func__); ++ break; + }; + + return index; +} + -+s8 -+PHY_GetTxPowerByRate( -+struct adapter *padapter, -+u8 Band, -+u8 RFPath, -+u8 TxNum, -+u8 Rate -+ ) ++s8 PHY_GetTxPowerByRate( ++ struct adapter *padapter, u8 Band, u8 RFPath, u8 TxNum, u8 Rate ++) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ s8 value = 0; -+ u8 rateIndex = PHY_GetRateIndexOfTxPowerByRate(Rate); ++ s8 value = 0; ++ u8 rateIndex = PHY_GetRateIndexOfTxPowerByRate(Rate); + + if ((padapter->registrypriv.RegEnableTxPowerByRate == 2 && pHalData->EEPROMRegulatory == 2) || + padapter->registrypriv.RegEnableTxPowerByRate == 0) + return 0; + -+ if (Band != BAND_ON_2_4G && Band != BAND_ON_5G) -+ { ++ if (Band != BAND_ON_2_4G && Band != BAND_ON_5G) { + DBG_871X("Invalid band %d in %s\n", Band, __func__); + return value; + } -+ if (RFPath > ODM_RF_PATH_D) -+ { ++ if (RFPath > ODM_RF_PATH_D) { + DBG_871X("Invalid RfPath %d in %s\n", RFPath, __func__); + return value; + } -+ if (TxNum >= RF_MAX_TX_NUM) -+ { ++ if (TxNum >= RF_MAX_TX_NUM) { + DBG_871X("Invalid TxNum %d in %s\n", TxNum, __func__); + return value; + } -+ if (rateIndex >= TX_PWR_BY_RATE_NUM_RATE) -+ { ++ if (rateIndex >= TX_PWR_BY_RATE_NUM_RATE) { + DBG_871X("Invalid RateIndex %d in %s\n", rateIndex, __func__); + return value; + } @@ -48652,36 +47220,31 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + +} + -+void -+PHY_SetTxPowerByRate( -+struct adapter *padapter, -+u8 Band, -+u8 RFPath, -+u8 TxNum, -+u8 Rate, -+s8 Value -+ ) ++void PHY_SetTxPowerByRate( ++ struct adapter *padapter, ++ u8 Band, ++ u8 RFPath, ++ u8 TxNum, ++ u8 Rate, ++ s8 Value ++) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + u8 rateIndex = PHY_GetRateIndexOfTxPowerByRate(Rate); + -+ if (Band != BAND_ON_2_4G && Band != BAND_ON_5G) -+ { ++ if (Band != BAND_ON_2_4G && Band != BAND_ON_5G) { + DBG_871X("Invalid band %d in %s\n", Band, __func__); + return; + } -+ if (RFPath > ODM_RF_PATH_D) -+ { ++ if (RFPath > ODM_RF_PATH_D) { + DBG_871X("Invalid RfPath %d in %s\n", RFPath, __func__); + return; + } -+ if (TxNum >= RF_MAX_TX_NUM) -+ { ++ if (TxNum >= RF_MAX_TX_NUM) { + DBG_871X("Invalid TxNum %d in %s\n", TxNum, __func__); + return; + } -+ if (rateIndex >= TX_PWR_BY_RATE_NUM_RATE) -+ { ++ if (rateIndex >= TX_PWR_BY_RATE_NUM_RATE) { + DBG_871X("Invalid RateIndex %d in %s\n", rateIndex, __func__); + return; + } @@ -48689,12 +47252,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + pHalData->TxPwrByRateOffset[Band][RFPath][TxNum][rateIndex] = Value; +} + -+void -+PHY_SetTxPowerLevelByPath( -+struct adapter *Adapter, -+u8 channel, -+u8 path -+ ) ++void PHY_SetTxPowerLevelByPath(struct adapter *Adapter, u8 channel, u8 path) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + bool bIsIn24G = (pHalData->CurrentBandType == BAND_ON_2_4G); @@ -48708,36 +47266,30 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + PHY_SetTxPowerIndexByRateSection(Adapter, path, channel, HT_MCS0_MCS7); + + if (pHalData->NumTotalRFPath >= 2) -+ { + PHY_SetTxPowerIndexByRateSection(Adapter, path, channel, HT_MCS8_MCS15); -+ } ++ + } +} + -+void -+PHY_SetTxPowerIndexByRateArray( -+struct adapter * padapter, -+u8 RFPath, -+enum CHANNEL_WIDTH BandWidth, -+u8 Channel, -+u8 * Rates, -+u8 RateArraySize -+ ) ++void PHY_SetTxPowerIndexByRateArray( ++ struct adapter *padapter, ++ u8 RFPath, ++ enum CHANNEL_WIDTH BandWidth, ++ u8 Channel, ++ u8 *Rates, ++ u8 RateArraySize ++) +{ + u32 powerIndex = 0; + int i = 0; + -+ for (i = 0; i < RateArraySize; ++i) -+ { ++ for (i = 0; i < RateArraySize; ++i) { + powerIndex = PHY_GetTxPowerIndex(padapter, RFPath, Rates[i], BandWidth, Channel); + PHY_SetTxPowerIndex(padapter, powerIndex, RFPath, Rates[i]); + } +} + -+static s8 -+phy_GetWorldWideLimit( -+ s8 * LimitTable -+) ++static s8 phy_GetWorldWideLimit(s8 *LimitTable) +{ + s8 min = LimitTable[0]; + u8 i = 0; @@ -48750,34 +47302,25 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + return min; +} + -+static s8 -+phy_GetChannelIndexOfTxPowerLimit( -+u8 Band, -+u8 Channel -+ ) ++static s8 phy_GetChannelIndexOfTxPowerLimit(u8 Band, u8 Channel) +{ + s8 channelIndex = -1; -+ u8 channel5G[CHANNEL_MAX_NUMBER_5G] = -+ {36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 100, 102, 104, 106, 108, 110, 112, -+ 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 149, 151, -+ 153, 155, 157, 159, 161, 163, 165, 167, 168, 169, 171, 173, 175, 177}; ++ u8 channel5G[CHANNEL_MAX_NUMBER_5G] = { ++ 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 100, 102, ++ 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, ++ 132, 134, 136, 138, 140, 142, 144, 149, 151, 153, 155, 157, 159, 161, ++ 163, 165, 167, 168, 169, 171, 173, 175, 177 ++ }; + u8 i = 0; + if (Band == BAND_ON_2_4G) -+ { + channelIndex = Channel - 1; -+ } -+ else if (Band == BAND_ON_5G) -+ { -+ for (i = 0; i < sizeof(channel5G)/sizeof(u8); ++i) -+ { ++ else if (Band == BAND_ON_5G) { ++ for (i = 0; i < sizeof(channel5G)/sizeof(u8); ++i) { + if (channel5G[i] == Channel) + channelIndex = i; + } -+ } -+ else -+ { ++ } else + DBG_871X("Invalid Band %d in %s", Band, __func__); -+ } + + if (channelIndex == -1) + DBG_871X("Invalid Channel %d of Band %d in %s", Channel, Band, __func__); @@ -48785,121 +47328,122 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + return channelIndex; +} + -+s8 -+PHY_GetTxPowerLimit( -+struct adapter * Adapter, -+u32 RegPwrTblSel, -+enum BAND_TYPE Band, -+enum CHANNEL_WIDTH Bandwidth, -+u8 RfPath, -+u8 DataRate, -+u8 Channel -+ ) ++s8 PHY_GetTxPowerLimit( ++ struct adapter *Adapter, ++ u32 RegPwrTblSel, ++ enum BAND_TYPE Band, ++ enum CHANNEL_WIDTH Bandwidth, ++ u8 RfPath, ++ u8 DataRate, ++ u8 Channel ++) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); -+ s16 band = -1, regulation = -1, bandwidth = -1, -+ rateSection = -1, channel = -1; -+ s8 powerLimit = MAX_POWER_INDEX; ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ s16 band = -1, regulation = -1, bandwidth = -1, rateSection = -1, channel = -1; ++ s8 powerLimit = MAX_POWER_INDEX; + + if ((Adapter->registrypriv.RegEnableTxPowerLimit == 2 && pHalData->EEPROMRegulatory != 1) || + Adapter->registrypriv.RegEnableTxPowerLimit == 0) + return MAX_POWER_INDEX; + -+ switch (Adapter->registrypriv.RegPwrTblSel) -+ { -+ case 1: -+ regulation = TXPWR_LMT_ETSI; -+ break; -+ case 2: -+ regulation = TXPWR_LMT_MKK; -+ break; -+ case 3: -+ regulation = TXPWR_LMT_FCC; -+ break; ++ switch (Adapter->registrypriv.RegPwrTblSel) { ++ case 1: ++ regulation = TXPWR_LMT_ETSI; ++ break; ++ case 2: ++ regulation = TXPWR_LMT_MKK; ++ break; ++ case 3: ++ regulation = TXPWR_LMT_FCC; ++ break; + -+ case 4: -+ regulation = TXPWR_LMT_WW; -+ break; ++ case 4: ++ regulation = TXPWR_LMT_WW; ++ break; + -+ default: -+ regulation = (Band == BAND_ON_2_4G) ? pHalData->Regulation2_4G -+ : pHalData->Regulation5G; -+ break; ++ default: ++ regulation = (Band == BAND_ON_2_4G) ? pHalData->Regulation2_4G : pHalData->Regulation5G; ++ break; + } + + /* DBG_871X("pMgntInfo->RegPwrTblSel %d, final regulation %d\n", Adapter->registrypriv.RegPwrTblSel, regulation); */ + + -+ if (Band == BAND_ON_2_4G) band = 0; -+ else if (Band == BAND_ON_5G) band = 1; ++ if (Band == BAND_ON_2_4G) ++ band = 0; ++ else if (Band == BAND_ON_5G) ++ band = 1; + -+ if (Bandwidth == CHANNEL_WIDTH_20) bandwidth = 0; -+ else if (Bandwidth == CHANNEL_WIDTH_40) bandwidth = 1; -+ else if (Bandwidth == CHANNEL_WIDTH_80) bandwidth = 2; -+ else if (Bandwidth == CHANNEL_WIDTH_160) bandwidth = 3; ++ if (Bandwidth == CHANNEL_WIDTH_20) ++ bandwidth = 0; ++ else if (Bandwidth == CHANNEL_WIDTH_40) ++ bandwidth = 1; ++ else if (Bandwidth == CHANNEL_WIDTH_80) ++ bandwidth = 2; ++ else if (Bandwidth == CHANNEL_WIDTH_160) ++ bandwidth = 3; + -+ switch (DataRate) -+ { -+ case MGN_1M: case MGN_2M: case MGN_5_5M: case MGN_11M: -+ rateSection = 0; -+ break; ++ switch (DataRate) { ++ case MGN_1M: case MGN_2M: case MGN_5_5M: case MGN_11M: ++ rateSection = 0; ++ break; + -+ case MGN_6M: case MGN_9M: case MGN_12M: case MGN_18M: -+ case MGN_24M: case MGN_36M: case MGN_48M: case MGN_54M: -+ rateSection = 1; -+ break; ++ case MGN_6M: case MGN_9M: case MGN_12M: case MGN_18M: ++ case MGN_24M: case MGN_36M: case MGN_48M: case MGN_54M: ++ rateSection = 1; ++ break; + -+ case MGN_MCS0: case MGN_MCS1: case MGN_MCS2: case MGN_MCS3: -+ case MGN_MCS4: case MGN_MCS5: case MGN_MCS6: case MGN_MCS7: -+ rateSection = 2; -+ break; ++ case MGN_MCS0: case MGN_MCS1: case MGN_MCS2: case MGN_MCS3: ++ case MGN_MCS4: case MGN_MCS5: case MGN_MCS6: case MGN_MCS7: ++ rateSection = 2; ++ break; + -+ case MGN_MCS8: case MGN_MCS9: case MGN_MCS10: case MGN_MCS11: -+ case MGN_MCS12: case MGN_MCS13: case MGN_MCS14: case MGN_MCS15: -+ rateSection = 3; -+ break; ++ case MGN_MCS8: case MGN_MCS9: case MGN_MCS10: case MGN_MCS11: ++ case MGN_MCS12: case MGN_MCS13: case MGN_MCS14: case MGN_MCS15: ++ rateSection = 3; ++ break; + -+ case MGN_MCS16: case MGN_MCS17: case MGN_MCS18: case MGN_MCS19: -+ case MGN_MCS20: case MGN_MCS21: case MGN_MCS22: case MGN_MCS23: -+ rateSection = 4; -+ break; ++ case MGN_MCS16: case MGN_MCS17: case MGN_MCS18: case MGN_MCS19: ++ case MGN_MCS20: case MGN_MCS21: case MGN_MCS22: case MGN_MCS23: ++ rateSection = 4; ++ break; + -+ case MGN_MCS24: case MGN_MCS25: case MGN_MCS26: case MGN_MCS27: -+ case MGN_MCS28: case MGN_MCS29: case MGN_MCS30: case MGN_MCS31: -+ rateSection = 5; -+ break; ++ case MGN_MCS24: case MGN_MCS25: case MGN_MCS26: case MGN_MCS27: ++ case MGN_MCS28: case MGN_MCS29: case MGN_MCS30: case MGN_MCS31: ++ rateSection = 5; ++ break; + -+ case MGN_VHT1SS_MCS0: case MGN_VHT1SS_MCS1: case MGN_VHT1SS_MCS2: -+ case MGN_VHT1SS_MCS3: case MGN_VHT1SS_MCS4: case MGN_VHT1SS_MCS5: -+ case MGN_VHT1SS_MCS6: case MGN_VHT1SS_MCS7: case MGN_VHT1SS_MCS8: -+ case MGN_VHT1SS_MCS9: -+ rateSection = 6; -+ break; ++ case MGN_VHT1SS_MCS0: case MGN_VHT1SS_MCS1: case MGN_VHT1SS_MCS2: ++ case MGN_VHT1SS_MCS3: case MGN_VHT1SS_MCS4: case MGN_VHT1SS_MCS5: ++ case MGN_VHT1SS_MCS6: case MGN_VHT1SS_MCS7: case MGN_VHT1SS_MCS8: ++ case MGN_VHT1SS_MCS9: ++ rateSection = 6; ++ break; + -+ case MGN_VHT2SS_MCS0: case MGN_VHT2SS_MCS1: case MGN_VHT2SS_MCS2: -+ case MGN_VHT2SS_MCS3: case MGN_VHT2SS_MCS4: case MGN_VHT2SS_MCS5: -+ case MGN_VHT2SS_MCS6: case MGN_VHT2SS_MCS7: case MGN_VHT2SS_MCS8: -+ case MGN_VHT2SS_MCS9: -+ rateSection = 7; -+ break; ++ case MGN_VHT2SS_MCS0: case MGN_VHT2SS_MCS1: case MGN_VHT2SS_MCS2: ++ case MGN_VHT2SS_MCS3: case MGN_VHT2SS_MCS4: case MGN_VHT2SS_MCS5: ++ case MGN_VHT2SS_MCS6: case MGN_VHT2SS_MCS7: case MGN_VHT2SS_MCS8: ++ case MGN_VHT2SS_MCS9: ++ rateSection = 7; ++ break; + -+ case MGN_VHT3SS_MCS0: case MGN_VHT3SS_MCS1: case MGN_VHT3SS_MCS2: -+ case MGN_VHT3SS_MCS3: case MGN_VHT3SS_MCS4: case MGN_VHT3SS_MCS5: -+ case MGN_VHT3SS_MCS6: case MGN_VHT3SS_MCS7: case MGN_VHT3SS_MCS8: -+ case MGN_VHT3SS_MCS9: -+ rateSection = 8; -+ break; ++ case MGN_VHT3SS_MCS0: case MGN_VHT3SS_MCS1: case MGN_VHT3SS_MCS2: ++ case MGN_VHT3SS_MCS3: case MGN_VHT3SS_MCS4: case MGN_VHT3SS_MCS5: ++ case MGN_VHT3SS_MCS6: case MGN_VHT3SS_MCS7: case MGN_VHT3SS_MCS8: ++ case MGN_VHT3SS_MCS9: ++ rateSection = 8; ++ break; + -+ case MGN_VHT4SS_MCS0: case MGN_VHT4SS_MCS1: case MGN_VHT4SS_MCS2: -+ case MGN_VHT4SS_MCS3: case MGN_VHT4SS_MCS4: case MGN_VHT4SS_MCS5: -+ case MGN_VHT4SS_MCS6: case MGN_VHT4SS_MCS7: case MGN_VHT4SS_MCS8: -+ case MGN_VHT4SS_MCS9: -+ rateSection = 9; -+ break; ++ case MGN_VHT4SS_MCS0: case MGN_VHT4SS_MCS1: case MGN_VHT4SS_MCS2: ++ case MGN_VHT4SS_MCS3: case MGN_VHT4SS_MCS4: case MGN_VHT4SS_MCS5: ++ case MGN_VHT4SS_MCS6: case MGN_VHT4SS_MCS7: case MGN_VHT4SS_MCS8: ++ case MGN_VHT4SS_MCS9: ++ rateSection = 9; ++ break; + -+ default: -+ DBG_871X("Wrong rate 0x%x\n", DataRate); -+ break; ++ default: ++ DBG_871X("Wrong rate 0x%x\n", DataRate); ++ break; + } + + if (Band == BAND_ON_5G && rateSection == 0) @@ -48925,16 +47469,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + channel = phy_GetChannelIndexOfTxPowerLimit(BAND_ON_2_4G, Channel); + else if (Band == BAND_ON_5G) + channel = phy_GetChannelIndexOfTxPowerLimit(BAND_ON_5G, Channel); -+ else if (Band == BAND_ON_BOTH) -+ { ++ else if (Band == BAND_ON_BOTH) { + /* BAND_ON_BOTH don't care temporarily */ + } + + if (band == -1 || regulation == -1 || bandwidth == -1 || -+ rateSection == -1 || channel == -1) -+ { ++ rateSection == -1 || channel == -1) { + /* DBG_871X("Wrong index value to access power limit table [band %d][regulation %d][bandwidth %d][rf_path %d][rate_section %d][chnlGroup %d]\n", */ -+ /* band, regulation, bandwidth, RfPath, rateSection, channelGroup); */ ++ /* band, regulation, bandwidth, RfPath, rateSection, channelGroup); */ + + return MAX_POWER_INDEX; + } @@ -48945,7 +47487,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + limits[i] = pHalData->TxPwrLimit_2_4G[i][bandwidth][rateSection][channel][RfPath]; + + powerLimit = (regulation == TXPWR_LMT_WW) ? phy_GetWorldWideLimit(limits) : -+ pHalData->TxPwrLimit_2_4G[regulation][bandwidth][rateSection][channel][RfPath]; ++ pHalData->TxPwrLimit_2_4G[regulation][bandwidth][rateSection][channel][RfPath]; + + } else if (Band == BAND_ON_5G) { + s8 limits[10] = {0}; u8 i = 0; @@ -48953,7 +47495,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + limits[i] = pHalData->TxPwrLimit_5G[i][bandwidth][rateSection][channel][RfPath]; + + powerLimit = (regulation == TXPWR_LMT_WW) ? phy_GetWorldWideLimit(limits) : -+ pHalData->TxPwrLimit_5G[regulation][bandwidth][rateSection][channel][RfPath]; ++ pHalData->TxPwrLimit_5G[regulation][bandwidth][rateSection][channel][RfPath]; + } else + DBG_871X("No power limit table of the specified band\n"); + @@ -48980,72 +47522,49 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + } + */ + /* DBG_871X("TxPwrLmt[Regulation %d][Band %d][BW %d][RFPath %d][Rate 0x%x][Chnl %d] = %d\n", */ -+ /* regulation, pHalData->CurrentBandType, Bandwidth, RfPath, DataRate, Channel, powerLimit); */ ++ /* regulation, pHalData->CurrentBandType, Bandwidth, RfPath, DataRate, Channel, powerLimit); */ + return powerLimit; +} + -+static void -+phy_CrossReferenceHTAndVHTTxPowerLimit( -+struct adapter * padapter -+ ) ++static void phy_CrossReferenceHTAndVHTTxPowerLimit(struct adapter *padapter) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ u8 regulation, bw, channel, rateSection; -+ s8 tempPwrLmt = 0; ++ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); ++ u8 regulation, bw, channel, rateSection; ++ s8 tempPwrLmt = 0; + -+ for (regulation = 0; regulation < MAX_REGULATION_NUM; ++regulation) -+ { -+ for (bw = 0; bw < MAX_5G_BANDWITH_NUM; ++bw) -+ { -+ for (channel = 0; channel < CHANNEL_MAX_NUMBER_5G; ++channel) -+ { -+ for (rateSection = 0; rateSection < MAX_RATE_SECTION_NUM; ++rateSection) -+ { ++ for (regulation = 0; regulation < MAX_REGULATION_NUM; ++regulation) { ++ for (bw = 0; bw < MAX_5G_BANDWITH_NUM; ++bw) { ++ for (channel = 0; channel < CHANNEL_MAX_NUMBER_5G; ++channel) { ++ for (rateSection = 0; rateSection < MAX_RATE_SECTION_NUM; ++rateSection) { + tempPwrLmt = pHalData->TxPwrLimit_5G[regulation][bw][rateSection][channel][ODM_RF_PATH_A]; -+ if (tempPwrLmt == MAX_POWER_INDEX) -+ { ++ if (tempPwrLmt == MAX_POWER_INDEX) { + u8 baseSection = 2, refSection = 6; + if (bw == 0 || bw == 1) { /* 5G 20M 40M VHT and HT can cross reference */ + /* DBG_871X("No power limit table of the specified band %d, bandwidth %d, ratesection %d, channel %d, rf path %d\n", */ -+ /* 1, bw, rateSection, channel, ODM_RF_PATH_A); */ ++ /* 1, bw, rateSection, channel, ODM_RF_PATH_A); */ + if (rateSection >= 2 && rateSection <= 9) { -+ if (rateSection == 2) -+ { ++ if (rateSection == 2) { + baseSection = 2; + refSection = 6; -+ } -+ else if (rateSection == 3) -+ { ++ } else if (rateSection == 3) { + baseSection = 3; + refSection = 7; -+ } -+ else if (rateSection == 4) -+ { ++ } else if (rateSection == 4) { + baseSection = 4; + refSection = 8; -+ } -+ else if (rateSection == 5) -+ { ++ } else if (rateSection == 5) { + baseSection = 5; + refSection = 9; -+ } -+ else if (rateSection == 6) -+ { ++ } else if (rateSection == 6) { + baseSection = 6; + refSection = 2; -+ } -+ else if (rateSection == 7) -+ { ++ } else if (rateSection == 7) { + baseSection = 7; + refSection = 3; -+ } -+ else if (rateSection == 8) -+ { ++ } else if (rateSection == 8) { + baseSection = 8; + refSection = 4; -+ } -+ else if (rateSection == 9) -+ { ++ } else if (rateSection == 9) { + baseSection = 9; + refSection = 5; + } @@ -49062,35 +47581,26 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + } +} + -+void -+PHY_ConvertTxPowerLimitToPowerIndex( -+struct adapter * Adapter -+ ) ++void PHY_ConvertTxPowerLimitToPowerIndex(struct adapter *Adapter) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); -+ u8 BW40PwrBasedBm2_4G = 0x2E; -+ u8 regulation, bw, channel, rateSection; -+ s8 tempValue = 0, tempPwrLmt = 0; -+ u8 rfPath = 0; ++ u8 BW40PwrBasedBm2_4G = 0x2E; ++ u8 regulation, bw, channel, rateSection; ++ s8 tempValue = 0, tempPwrLmt = 0; ++ u8 rfPath = 0; + + /* DBG_871X("=====> PHY_ConvertTxPowerLimitToPowerIndex()\n"); */ + + phy_CrossReferenceHTAndVHTTxPowerLimit(Adapter); + -+ for (regulation = 0; regulation < MAX_REGULATION_NUM; ++regulation) -+ { -+ for (bw = 0; bw < MAX_2_4G_BANDWITH_NUM; ++bw) -+ { -+ for (channel = 0; channel < CHANNEL_MAX_NUMBER_2G; ++channel) -+ { -+ for (rateSection = 0; rateSection < MAX_RATE_SECTION_NUM; ++rateSection) -+ { ++ for (regulation = 0; regulation < MAX_REGULATION_NUM; ++regulation) { ++ for (bw = 0; bw < MAX_2_4G_BANDWITH_NUM; ++bw) { ++ for (channel = 0; channel < CHANNEL_MAX_NUMBER_2G; ++channel) { ++ for (rateSection = 0; rateSection < MAX_RATE_SECTION_NUM; ++rateSection) { + tempPwrLmt = pHalData->TxPwrLimit_2_4G[regulation][bw][rateSection][channel][ODM_RF_PATH_A]; + -+ for (rfPath = ODM_RF_PATH_A; rfPath < MAX_RF_PATH_NUM; ++rfPath) -+ { -+ if (pHalData->odmpriv.PhyRegPgValueType == PHY_REG_PG_EXACT_VALUE) -+ { ++ for (rfPath = ODM_RF_PATH_A; rfPath < MAX_RF_PATH_NUM; ++rfPath) { ++ if (pHalData->odmpriv.PhyRegPgValueType == PHY_REG_PG_EXACT_VALUE) { + if (rateSection == 5) /* HT 4T */ + BW40PwrBasedBm2_4G = PHY_GetTxPowerByRateBase(Adapter, BAND_ON_2_4G, rfPath, RF_4TX, HT_MCS24_MCS31); + else if (rateSection == 4) /* HT 3T */ @@ -49103,8 +47613,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + BW40PwrBasedBm2_4G = PHY_GetTxPowerByRateBase(Adapter, BAND_ON_2_4G, rfPath, RF_1TX, OFDM); + else if (rateSection == 0) /* CCK */ + BW40PwrBasedBm2_4G = PHY_GetTxPowerByRateBase(Adapter, BAND_ON_2_4G, rfPath, RF_1TX, CCK); -+ } -+ else ++ } else + BW40PwrBasedBm2_4G = Adapter->registrypriv.RegPowerBase * 2; + + if (tempPwrLmt != MAX_POWER_INDEX) { @@ -49120,18 +47629,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + /* DBG_871X("<===== PHY_ConvertTxPowerLimitToPowerIndex()\n"); */ +} + -+void -+PHY_InitTxPowerLimit( -+struct adapter * Adapter -+ ) ++void PHY_InitTxPowerLimit(struct adapter *Adapter) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); -+ u8 i, j, k, l, m; ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ u8 i, j, k, l, m; + + /* DBG_871X("=====> PHY_InitTxPowerLimit()!\n"); */ + -+ for (i = 0; i < MAX_REGULATION_NUM; ++i) -+ { ++ for (i = 0; i < MAX_REGULATION_NUM; ++i) { + for (j = 0; j < MAX_2_4G_BANDWITH_NUM; ++j) + for (k = 0; k < MAX_RATE_SECTION_NUM; ++k) + for (m = 0; m < CHANNEL_MAX_NUMBER_2G; ++m) @@ -49139,8 +47644,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + pHalData->TxPwrLimit_2_4G[i][j][k][m][l] = MAX_POWER_INDEX; + } + -+ for (i = 0; i < MAX_REGULATION_NUM; ++i) -+ { ++ for (i = 0; i < MAX_REGULATION_NUM; ++i) { + for (j = 0; j < MAX_5G_BANDWITH_NUM; ++j) + for (k = 0; k < MAX_RATE_SECTION_NUM; ++k) + for (m = 0; m < CHANNEL_MAX_NUMBER_5G; ++m) @@ -49151,38 +47655,38 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + /* DBG_871X("<===== PHY_InitTxPowerLimit()!\n"); */ +} + -+void -+PHY_SetTxPowerLimit( -+struct adapter * Adapter, -+u8 *Regulation, -+u8 *Band, -+u8 *Bandwidth, -+u8 *RateSection, -+u8 *RfPath, -+u8 *Channel, -+u8 *PowerLimit -+ ) ++void PHY_SetTxPowerLimit( ++ struct adapter *Adapter, ++ u8 *Regulation, ++ u8 *Band, ++ u8 *Bandwidth, ++ u8 *RateSection, ++ u8 *RfPath, ++ u8 *Channel, ++ u8 *PowerLimit ++) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); -+ u8 regulation = 0, bandwidth = 0, rateSection = 0, -+ channel; -+ s8 powerLimit = 0, prevPowerLimit, channelIndex; ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ u8 regulation = 0, bandwidth = 0, rateSection = 0, channel; ++ s8 powerLimit = 0, prevPowerLimit, channelIndex; + + /* DBG_871X("Index of power limit table [band %s][regulation %s][bw %s][rate section %s][rf path %s][chnl %s][val %s]\n", */ -+ /* Band, Regulation, Bandwidth, RateSection, RfPath, Channel, PowerLimit); */ ++ /* Band, Regulation, Bandwidth, RateSection, RfPath, Channel, PowerLimit); */ + + if (!GetU1ByteIntegerFromStringInDecimal((s8 *)Channel, &channel) || + !GetU1ByteIntegerFromStringInDecimal((s8 *)PowerLimit, &powerLimit)) -+ { + DBG_871X("Illegal index of power limit table [chnl %s][val %s]\n", Channel, PowerLimit); -+ } + + powerLimit = powerLimit > MAX_POWER_INDEX ? MAX_POWER_INDEX : powerLimit; + -+ if (eqNByte(Regulation, (u8 *)("FCC"), 3)) regulation = 0; -+ else if (eqNByte(Regulation, (u8 *)("MKK"), 3)) regulation = 1; -+ else if (eqNByte(Regulation, (u8 *)("ETSI"), 4)) regulation = 2; -+ else if (eqNByte(Regulation, (u8 *)("WW13"), 4)) regulation = 3; ++ if (eqNByte(Regulation, (u8 *)("FCC"), 3)) ++ regulation = 0; ++ else if (eqNByte(Regulation, (u8 *)("MKK"), 3)) ++ regulation = 1; ++ else if (eqNByte(Regulation, (u8 *)("ETSI"), 4)) ++ regulation = 2; ++ else if (eqNByte(Regulation, (u8 *)("WW13"), 4)) ++ regulation = 3; + + if (eqNByte(RateSection, (u8 *)("CCK"), 3) && eqNByte(RfPath, (u8 *)("1T"), 2)) + rateSection = 0; @@ -49204,20 +47708,22 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + rateSection = 8; + else if (eqNByte(RateSection, (u8 *)("VHT"), 3) && eqNByte(RfPath, (u8 *)("4T"), 2)) + rateSection = 9; -+ else -+ { ++ else { + DBG_871X("Wrong rate section!\n"); + return; + } + + -+ if (eqNByte(Bandwidth, (u8 *)("20M"), 3)) bandwidth = 0; -+ else if (eqNByte(Bandwidth, (u8 *)("40M"), 3)) bandwidth = 1; -+ else if (eqNByte(Bandwidth, (u8 *)("80M"), 3)) bandwidth = 2; -+ else if (eqNByte(Bandwidth, (u8 *)("160M"), 4)) bandwidth = 3; ++ if (eqNByte(Bandwidth, (u8 *)("20M"), 3)) ++ bandwidth = 0; ++ else if (eqNByte(Bandwidth, (u8 *)("40M"), 3)) ++ bandwidth = 1; ++ else if (eqNByte(Bandwidth, (u8 *)("80M"), 3)) ++ bandwidth = 2; ++ else if (eqNByte(Bandwidth, (u8 *)("160M"), 4)) ++ bandwidth = 3; + -+ if (eqNByte(Band, (u8 *)("2.4G"), 4)) -+ { ++ if (eqNByte(Band, (u8 *)("2.4G"), 4)) { + channelIndex = phy_GetChannelIndexOfTxPowerLimit(BAND_ON_2_4G, channel); + + if (channelIndex == -1) @@ -49229,10 +47735,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + pHalData->TxPwrLimit_2_4G[regulation][bandwidth][rateSection][channelIndex][ODM_RF_PATH_A] = powerLimit; + + /* DBG_871X("2.4G Band value : [regulation %d][bw %d][rate_section %d][chnl %d][val %d]\n", */ -+ /* regulation, bandwidth, rateSection, channelIndex, pHalData->TxPwrLimit_2_4G[regulation][bandwidth][rateSection][channelIndex][ODM_RF_PATH_A]); */ -+ } -+ else if (eqNByte(Band, (u8 *)("5G"), 2)) -+ { ++ /* regulation, bandwidth, rateSection, channelIndex, pHalData->TxPwrLimit_2_4G[regulation][bandwidth][rateSection][channelIndex][ODM_RF_PATH_A]); */ ++ } else if (eqNByte(Band, (u8 *)("5G"), 2)) { + channelIndex = phy_GetChannelIndexOfTxPowerLimit(BAND_ON_5G, channel); + + if (channelIndex == -1) @@ -49244,203 +47748,191 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + pHalData->TxPwrLimit_5G[regulation][bandwidth][rateSection][channelIndex][ODM_RF_PATH_A] = powerLimit; + + /* DBG_871X("5G Band value : [regulation %d][bw %d][rate_section %d][chnl %d][val %d]\n", */ -+ /* regulation, bandwidth, rateSection, channel, pHalData->TxPwrLimit_5G[regulation][bandwidth][rateSection][channelIndex][ODM_RF_PATH_A]); */ -+ } -+ else -+ { ++ /* regulation, bandwidth, rateSection, channel, pHalData->TxPwrLimit_5G[regulation][bandwidth][rateSection][channelIndex][ODM_RF_PATH_A]); */ ++ } else { + DBG_871X("Cannot recognize the band info in %s\n", Band); + return; + } +} + -+u8 -+PHY_GetTxPowerIndex( -+struct adapter * padapter, -+u8 RFPath, -+u8 Rate, -+enum CHANNEL_WIDTH BandWidth, -+u8 Channel -+ ) ++u8 PHY_GetTxPowerIndex( ++ struct adapter *padapter, ++ u8 RFPath, ++ u8 Rate, ++ enum CHANNEL_WIDTH BandWidth, ++ u8 Channel ++) +{ + return PHY_GetTxPowerIndex_8723B(padapter, RFPath, Rate, BandWidth, Channel); +} + -+void -+PHY_SetTxPowerIndex( -+struct adapter * padapter, -+u32 PowerIndex, -+u8 RFPath, -+u8 Rate -+ ) ++void PHY_SetTxPowerIndex( ++ struct adapter *padapter, u32 PowerIndex, u8 RFPath, u8 Rate ++) +{ + PHY_SetTxPowerIndex_8723B(padapter, PowerIndex, RFPath, Rate); +} + -+void -+Hal_ChannelPlanToRegulation( -+struct adapter * Adapter, -+u16 ChannelPlan -+ ) ++void Hal_ChannelPlanToRegulation(struct adapter *Adapter, u16 ChannelPlan) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + pHalData->Regulation2_4G = TXPWR_LMT_WW; + pHalData->Regulation5G = TXPWR_LMT_WW; + -+ switch (ChannelPlan) -+ { -+ case RT_CHANNEL_DOMAIN_WORLD_NULL: -+ pHalData->Regulation2_4G = TXPWR_LMT_WW; -+ break; -+ case RT_CHANNEL_DOMAIN_ETSI1_NULL: -+ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; -+ break; -+ case RT_CHANNEL_DOMAIN_FCC1_NULL: -+ pHalData->Regulation2_4G = TXPWR_LMT_FCC; -+ break; -+ case RT_CHANNEL_DOMAIN_MKK1_NULL: -+ pHalData->Regulation2_4G = TXPWR_LMT_MKK; -+ break; -+ case RT_CHANNEL_DOMAIN_ETSI2_NULL: -+ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; -+ break; -+ case RT_CHANNEL_DOMAIN_FCC1_FCC1: -+ pHalData->Regulation2_4G = TXPWR_LMT_FCC; -+ pHalData->Regulation5G = TXPWR_LMT_FCC; -+ break; -+ case RT_CHANNEL_DOMAIN_WORLD_ETSI1: -+ pHalData->Regulation2_4G = TXPWR_LMT_FCC; -+ pHalData->Regulation5G = TXPWR_LMT_ETSI; -+ break; -+ case RT_CHANNEL_DOMAIN_MKK1_MKK1: -+ pHalData->Regulation2_4G = TXPWR_LMT_MKK; -+ pHalData->Regulation5G = TXPWR_LMT_MKK; -+ break; -+ case RT_CHANNEL_DOMAIN_WORLD_KCC1: -+ pHalData->Regulation2_4G = TXPWR_LMT_FCC; -+ pHalData->Regulation5G = TXPWR_LMT_MKK; -+ break; -+ case RT_CHANNEL_DOMAIN_WORLD_FCC2: -+ pHalData->Regulation2_4G = TXPWR_LMT_FCC; -+ pHalData->Regulation5G = TXPWR_LMT_FCC; -+ break; -+ case RT_CHANNEL_DOMAIN_WORLD_FCC3: -+ pHalData->Regulation2_4G = TXPWR_LMT_FCC; -+ pHalData->Regulation5G = TXPWR_LMT_FCC; -+ break; -+ case RT_CHANNEL_DOMAIN_WORLD_FCC4: -+ pHalData->Regulation2_4G = TXPWR_LMT_FCC; -+ pHalData->Regulation5G = TXPWR_LMT_FCC; -+ break; -+ case RT_CHANNEL_DOMAIN_WORLD_FCC5: -+ pHalData->Regulation2_4G = TXPWR_LMT_FCC; -+ pHalData->Regulation5G = TXPWR_LMT_FCC; -+ break; -+ case RT_CHANNEL_DOMAIN_WORLD_FCC6: -+ pHalData->Regulation2_4G = TXPWR_LMT_FCC; -+ pHalData->Regulation5G = TXPWR_LMT_FCC; -+ break; -+ case RT_CHANNEL_DOMAIN_FCC1_FCC7: -+ pHalData->Regulation2_4G = TXPWR_LMT_FCC; -+ pHalData->Regulation5G = TXPWR_LMT_FCC; -+ break; -+ case RT_CHANNEL_DOMAIN_WORLD_ETSI2: -+ pHalData->Regulation2_4G = TXPWR_LMT_FCC; -+ pHalData->Regulation5G = TXPWR_LMT_FCC; -+ break; -+ case RT_CHANNEL_DOMAIN_WORLD_ETSI3: -+ pHalData->Regulation2_4G = TXPWR_LMT_FCC; -+ pHalData->Regulation5G = TXPWR_LMT_FCC; -+ break; -+ case RT_CHANNEL_DOMAIN_MKK1_MKK2: -+ pHalData->Regulation2_4G = TXPWR_LMT_MKK; -+ pHalData->Regulation5G = TXPWR_LMT_FCC; -+ break; -+ case RT_CHANNEL_DOMAIN_MKK1_MKK3: -+ pHalData->Regulation2_4G = TXPWR_LMT_MKK; -+ pHalData->Regulation5G = TXPWR_LMT_FCC; -+ break; -+ case RT_CHANNEL_DOMAIN_FCC1_NCC1: -+ pHalData->Regulation2_4G = TXPWR_LMT_FCC; -+ pHalData->Regulation5G = TXPWR_LMT_FCC; -+ break; -+ case RT_CHANNEL_DOMAIN_FCC1_NCC2: -+ pHalData->Regulation2_4G = TXPWR_LMT_FCC; -+ pHalData->Regulation5G = TXPWR_LMT_FCC; -+ break; -+ case RT_CHANNEL_DOMAIN_GLOBAL_NULL: -+ pHalData->Regulation2_4G = TXPWR_LMT_WW; -+ pHalData->Regulation5G = TXPWR_LMT_WW; -+ break; -+ case RT_CHANNEL_DOMAIN_ETSI1_ETSI4: -+ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; -+ pHalData->Regulation5G = TXPWR_LMT_ETSI; -+ break; -+ case RT_CHANNEL_DOMAIN_FCC1_FCC2: -+ pHalData->Regulation2_4G = TXPWR_LMT_FCC; -+ pHalData->Regulation5G = TXPWR_LMT_FCC; -+ break; -+ case RT_CHANNEL_DOMAIN_FCC1_NCC3: -+ pHalData->Regulation2_4G = TXPWR_LMT_FCC; -+ pHalData->Regulation5G = TXPWR_LMT_FCC; -+ break; -+ case RT_CHANNEL_DOMAIN_WORLD_ETSI5: -+ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; -+ pHalData->Regulation5G = TXPWR_LMT_ETSI; -+ break; -+ case RT_CHANNEL_DOMAIN_FCC1_FCC8: -+ pHalData->Regulation2_4G = TXPWR_LMT_FCC; -+ pHalData->Regulation5G = TXPWR_LMT_FCC; -+ break; -+ case RT_CHANNEL_DOMAIN_WORLD_ETSI6: -+ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; -+ pHalData->Regulation5G = TXPWR_LMT_ETSI; -+ break; -+ case RT_CHANNEL_DOMAIN_WORLD_ETSI7: -+ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; -+ pHalData->Regulation5G = TXPWR_LMT_ETSI; -+ break; -+ case RT_CHANNEL_DOMAIN_WORLD_ETSI8: -+ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; -+ pHalData->Regulation5G = TXPWR_LMT_ETSI; -+ break; -+ case RT_CHANNEL_DOMAIN_WORLD_ETSI9: -+ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; -+ pHalData->Regulation5G = TXPWR_LMT_ETSI; -+ break; -+ case RT_CHANNEL_DOMAIN_WORLD_ETSI10: -+ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; -+ pHalData->Regulation5G = TXPWR_LMT_ETSI; -+ break; -+ case RT_CHANNEL_DOMAIN_WORLD_ETSI11: -+ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; -+ pHalData->Regulation5G = TXPWR_LMT_ETSI; -+ break; -+ case RT_CHANNEL_DOMAIN_FCC1_NCC4: -+ pHalData->Regulation2_4G = TXPWR_LMT_FCC; -+ pHalData->Regulation5G = TXPWR_LMT_FCC; -+ break; -+ case RT_CHANNEL_DOMAIN_WORLD_ETSI12: -+ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; -+ pHalData->Regulation5G = TXPWR_LMT_ETSI; -+ break; -+ case RT_CHANNEL_DOMAIN_FCC1_FCC9: -+ pHalData->Regulation2_4G = TXPWR_LMT_FCC; -+ pHalData->Regulation5G = TXPWR_LMT_FCC; -+ break; -+ case RT_CHANNEL_DOMAIN_WORLD_ETSI13: -+ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; -+ pHalData->Regulation5G = TXPWR_LMT_ETSI; -+ break; -+ case RT_CHANNEL_DOMAIN_FCC1_FCC10: -+ pHalData->Regulation2_4G = TXPWR_LMT_FCC; -+ pHalData->Regulation5G = TXPWR_LMT_FCC; -+ break; -+ case RT_CHANNEL_DOMAIN_REALTEK_DEFINE: /* Realtek Reserve */ -+ pHalData->Regulation2_4G = TXPWR_LMT_WW; -+ pHalData->Regulation5G = TXPWR_LMT_WW; -+ break; -+ default: -+ break; ++ switch (ChannelPlan) { ++ case RT_CHANNEL_DOMAIN_WORLD_NULL: ++ pHalData->Regulation2_4G = TXPWR_LMT_WW; ++ break; ++ case RT_CHANNEL_DOMAIN_ETSI1_NULL: ++ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; ++ break; ++ case RT_CHANNEL_DOMAIN_FCC1_NULL: ++ pHalData->Regulation2_4G = TXPWR_LMT_FCC; ++ break; ++ case RT_CHANNEL_DOMAIN_MKK1_NULL: ++ pHalData->Regulation2_4G = TXPWR_LMT_MKK; ++ break; ++ case RT_CHANNEL_DOMAIN_ETSI2_NULL: ++ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; ++ break; ++ case RT_CHANNEL_DOMAIN_FCC1_FCC1: ++ pHalData->Regulation2_4G = TXPWR_LMT_FCC; ++ pHalData->Regulation5G = TXPWR_LMT_FCC; ++ break; ++ case RT_CHANNEL_DOMAIN_WORLD_ETSI1: ++ pHalData->Regulation2_4G = TXPWR_LMT_FCC; ++ pHalData->Regulation5G = TXPWR_LMT_ETSI; ++ break; ++ case RT_CHANNEL_DOMAIN_MKK1_MKK1: ++ pHalData->Regulation2_4G = TXPWR_LMT_MKK; ++ pHalData->Regulation5G = TXPWR_LMT_MKK; ++ break; ++ case RT_CHANNEL_DOMAIN_WORLD_KCC1: ++ pHalData->Regulation2_4G = TXPWR_LMT_FCC; ++ pHalData->Regulation5G = TXPWR_LMT_MKK; ++ break; ++ case RT_CHANNEL_DOMAIN_WORLD_FCC2: ++ pHalData->Regulation2_4G = TXPWR_LMT_FCC; ++ pHalData->Regulation5G = TXPWR_LMT_FCC; ++ break; ++ case RT_CHANNEL_DOMAIN_WORLD_FCC3: ++ pHalData->Regulation2_4G = TXPWR_LMT_FCC; ++ pHalData->Regulation5G = TXPWR_LMT_FCC; ++ break; ++ case RT_CHANNEL_DOMAIN_WORLD_FCC4: ++ pHalData->Regulation2_4G = TXPWR_LMT_FCC; ++ pHalData->Regulation5G = TXPWR_LMT_FCC; ++ break; ++ case RT_CHANNEL_DOMAIN_WORLD_FCC5: ++ pHalData->Regulation2_4G = TXPWR_LMT_FCC; ++ pHalData->Regulation5G = TXPWR_LMT_FCC; ++ break; ++ case RT_CHANNEL_DOMAIN_WORLD_FCC6: ++ pHalData->Regulation2_4G = TXPWR_LMT_FCC; ++ pHalData->Regulation5G = TXPWR_LMT_FCC; ++ break; ++ case RT_CHANNEL_DOMAIN_FCC1_FCC7: ++ pHalData->Regulation2_4G = TXPWR_LMT_FCC; ++ pHalData->Regulation5G = TXPWR_LMT_FCC; ++ break; ++ case RT_CHANNEL_DOMAIN_WORLD_ETSI2: ++ pHalData->Regulation2_4G = TXPWR_LMT_FCC; ++ pHalData->Regulation5G = TXPWR_LMT_FCC; ++ break; ++ case RT_CHANNEL_DOMAIN_WORLD_ETSI3: ++ pHalData->Regulation2_4G = TXPWR_LMT_FCC; ++ pHalData->Regulation5G = TXPWR_LMT_FCC; ++ break; ++ case RT_CHANNEL_DOMAIN_MKK1_MKK2: ++ pHalData->Regulation2_4G = TXPWR_LMT_MKK; ++ pHalData->Regulation5G = TXPWR_LMT_FCC; ++ break; ++ case RT_CHANNEL_DOMAIN_MKK1_MKK3: ++ pHalData->Regulation2_4G = TXPWR_LMT_MKK; ++ pHalData->Regulation5G = TXPWR_LMT_FCC; ++ break; ++ case RT_CHANNEL_DOMAIN_FCC1_NCC1: ++ pHalData->Regulation2_4G = TXPWR_LMT_FCC; ++ pHalData->Regulation5G = TXPWR_LMT_FCC; ++ break; ++ case RT_CHANNEL_DOMAIN_FCC1_NCC2: ++ pHalData->Regulation2_4G = TXPWR_LMT_FCC; ++ pHalData->Regulation5G = TXPWR_LMT_FCC; ++ break; ++ case RT_CHANNEL_DOMAIN_GLOBAL_NULL: ++ pHalData->Regulation2_4G = TXPWR_LMT_WW; ++ pHalData->Regulation5G = TXPWR_LMT_WW; ++ break; ++ case RT_CHANNEL_DOMAIN_ETSI1_ETSI4: ++ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; ++ pHalData->Regulation5G = TXPWR_LMT_ETSI; ++ break; ++ case RT_CHANNEL_DOMAIN_FCC1_FCC2: ++ pHalData->Regulation2_4G = TXPWR_LMT_FCC; ++ pHalData->Regulation5G = TXPWR_LMT_FCC; ++ break; ++ case RT_CHANNEL_DOMAIN_FCC1_NCC3: ++ pHalData->Regulation2_4G = TXPWR_LMT_FCC; ++ pHalData->Regulation5G = TXPWR_LMT_FCC; ++ break; ++ case RT_CHANNEL_DOMAIN_WORLD_ETSI5: ++ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; ++ pHalData->Regulation5G = TXPWR_LMT_ETSI; ++ break; ++ case RT_CHANNEL_DOMAIN_FCC1_FCC8: ++ pHalData->Regulation2_4G = TXPWR_LMT_FCC; ++ pHalData->Regulation5G = TXPWR_LMT_FCC; ++ break; ++ case RT_CHANNEL_DOMAIN_WORLD_ETSI6: ++ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; ++ pHalData->Regulation5G = TXPWR_LMT_ETSI; ++ break; ++ case RT_CHANNEL_DOMAIN_WORLD_ETSI7: ++ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; ++ pHalData->Regulation5G = TXPWR_LMT_ETSI; ++ break; ++ case RT_CHANNEL_DOMAIN_WORLD_ETSI8: ++ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; ++ pHalData->Regulation5G = TXPWR_LMT_ETSI; ++ break; ++ case RT_CHANNEL_DOMAIN_WORLD_ETSI9: ++ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; ++ pHalData->Regulation5G = TXPWR_LMT_ETSI; ++ break; ++ case RT_CHANNEL_DOMAIN_WORLD_ETSI10: ++ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; ++ pHalData->Regulation5G = TXPWR_LMT_ETSI; ++ break; ++ case RT_CHANNEL_DOMAIN_WORLD_ETSI11: ++ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; ++ pHalData->Regulation5G = TXPWR_LMT_ETSI; ++ break; ++ case RT_CHANNEL_DOMAIN_FCC1_NCC4: ++ pHalData->Regulation2_4G = TXPWR_LMT_FCC; ++ pHalData->Regulation5G = TXPWR_LMT_FCC; ++ break; ++ case RT_CHANNEL_DOMAIN_WORLD_ETSI12: ++ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; ++ pHalData->Regulation5G = TXPWR_LMT_ETSI; ++ break; ++ case RT_CHANNEL_DOMAIN_FCC1_FCC9: ++ pHalData->Regulation2_4G = TXPWR_LMT_FCC; ++ pHalData->Regulation5G = TXPWR_LMT_FCC; ++ break; ++ case RT_CHANNEL_DOMAIN_WORLD_ETSI13: ++ pHalData->Regulation2_4G = TXPWR_LMT_ETSI; ++ pHalData->Regulation5G = TXPWR_LMT_ETSI; ++ break; ++ case RT_CHANNEL_DOMAIN_FCC1_FCC10: ++ pHalData->Regulation2_4G = TXPWR_LMT_FCC; ++ pHalData->Regulation5G = TXPWR_LMT_FCC; ++ break; ++ case RT_CHANNEL_DOMAIN_REALTEK_DEFINE: /* Realtek Reserve */ ++ pHalData->Regulation2_4G = TXPWR_LMT_WW; ++ pHalData->Regulation5G = TXPWR_LMT_WW; ++ break; ++ default: ++ break; + } +} + @@ -49450,11 +47942,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + +#define GetLineFromBuffer(buffer) strsep(&buffer, "\n") + -+int -+phy_ConfigMACWithParaFile( -+struct adapter *Adapter, -+char* pFileName -+) ++int phy_ConfigMACWithParaFile(struct adapter *Adapter, char *pFileName) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + int rlen = 0, rtStatus = _FAIL; @@ -49466,76 +47954,53 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + + memset(pHalData->para_file_buf, 0, MAX_PARA_FILE_BUF_LEN); + -+ if ((pHalData->mac_reg_len == 0) && (pHalData->mac_reg == NULL)) -+ { ++ if ((pHalData->mac_reg_len == 0) && (pHalData->mac_reg == NULL)) { + rtw_merge_string(file_path_bs, PATH_MAX, rtw_phy_file_path, pFileName); + -+ if (rtw_is_file_readable(file_path_bs) == true) -+ { ++ if (rtw_is_file_readable(file_path_bs) == true) { + rlen = rtw_retrive_from_file(file_path_bs, pHalData->para_file_buf, MAX_PARA_FILE_BUF_LEN); -+ if (rlen > 0) -+ { ++ if (rlen > 0) { + rtStatus = _SUCCESS; + pHalData->mac_reg = vzalloc(rlen); + if (pHalData->mac_reg) { + memcpy(pHalData->mac_reg, pHalData->para_file_buf, rlen); + pHalData->mac_reg_len = rlen; -+ } -+ else { ++ } else + DBG_871X("%s mac_reg alloc fail !\n", __func__); -+ } + } + } -+ } -+ else -+ { ++ } else { + if ((pHalData->mac_reg_len != 0) && (pHalData->mac_reg != NULL)) { + memcpy(pHalData->para_file_buf, pHalData->mac_reg, pHalData->mac_reg_len); + rtStatus = _SUCCESS; -+ } -+ else { ++ } else + DBG_871X("%s(): Critical Error !!!\n", __func__); -+ } + } + -+ if (rtStatus == _SUCCESS) -+ { ++ if (rtStatus == _SUCCESS) { + ptmp = pHalData->para_file_buf; -+ for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) -+ { -+ if (!IsCommentString(szLine)) -+ { ++ for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) { ++ if (!IsCommentString(szLine)) { + /* Get 1st hex value as register offset */ -+ if (GetHexValueFromString(szLine, &u4bRegOffset, &u4bMove)) -+ { -+ if (u4bRegOffset == 0xffff) -+ { /* Ending. */ ++ if (GetHexValueFromString(szLine, &u4bRegOffset, &u4bMove)) { ++ if (u4bRegOffset == 0xffff) /* Ending. */ + break; -+ } + + /* Get 2nd hex value as register value. */ + szLine += u4bMove; + if (GetHexValueFromString(szLine, &u4bRegValue, &u4bMove)) -+ { + rtw_write8(Adapter, u4bRegOffset, (u8)u4bRegValue); -+ } + } + } + } -+ } -+ else -+ { ++ } else + DBG_871X("%s(): No File %s, Load from HWImg Array!\n", __func__, pFileName); -+ } + + return rtStatus; +} + -+int -+phy_ConfigBBWithParaFile( -+struct adapter *Adapter, -+char* pFileName, -+u32 ConfigType ++int phy_ConfigBBWithParaFile( ++ struct adapter *Adapter, char *pFileName, u32 ConfigType +) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); @@ -49548,108 +48013,78 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + if (!(Adapter->registrypriv.load_phy_file & LOAD_BB_PARA_FILE)) + return rtStatus; + -+ switch (ConfigType) -+ { -+ case CONFIG_BB_PHY_REG: -+ pBuf = pHalData->bb_phy_reg; -+ pBufLen = &pHalData->bb_phy_reg_len; -+ break; -+ case CONFIG_BB_AGC_TAB: -+ pBuf = pHalData->bb_agc_tab; -+ pBufLen = &pHalData->bb_agc_tab_len; -+ break; -+ default: -+ DBG_871X("Unknown ConfigType!! %d\r\n", ConfigType); -+ break; ++ switch (ConfigType) { ++ case CONFIG_BB_PHY_REG: ++ pBuf = pHalData->bb_phy_reg; ++ pBufLen = &pHalData->bb_phy_reg_len; ++ break; ++ case CONFIG_BB_AGC_TAB: ++ pBuf = pHalData->bb_agc_tab; ++ pBufLen = &pHalData->bb_agc_tab_len; ++ break; ++ default: ++ DBG_871X("Unknown ConfigType!! %d\r\n", ConfigType); ++ break; + } + + memset(pHalData->para_file_buf, 0, MAX_PARA_FILE_BUF_LEN); + -+ if ((pBufLen != NULL) && (*pBufLen == 0) && (pBuf == NULL)) -+ { ++ if ((pBufLen != NULL) && (*pBufLen == 0) && (pBuf == NULL)) { + rtw_merge_string(file_path_bs, PATH_MAX, rtw_phy_file_path, pFileName); + -+ if (rtw_is_file_readable(file_path_bs) == true) -+ { ++ if (rtw_is_file_readable(file_path_bs) == true) { + rlen = rtw_retrive_from_file(file_path_bs, pHalData->para_file_buf, MAX_PARA_FILE_BUF_LEN); -+ if (rlen > 0) -+ { ++ if (rlen > 0) { + rtStatus = _SUCCESS; + pBuf = vzalloc(rlen); + if (pBuf) { + memcpy(pBuf, pHalData->para_file_buf, rlen); + *pBufLen = rlen; + -+ switch (ConfigType) -+ { -+ case CONFIG_BB_PHY_REG: -+ pHalData->bb_phy_reg = pBuf; -+ break; -+ case CONFIG_BB_AGC_TAB: -+ pHalData->bb_agc_tab = pBuf; -+ break; ++ switch (ConfigType) { ++ case CONFIG_BB_PHY_REG: ++ pHalData->bb_phy_reg = pBuf; ++ break; ++ case CONFIG_BB_AGC_TAB: ++ pHalData->bb_agc_tab = pBuf; ++ break; + } -+ } -+ else { ++ } else + DBG_871X("%s(): ConfigType %d alloc fail !\n", __func__, ConfigType); -+ } + } + } -+ } -+ else -+ { ++ } else { + if ((pBufLen != NULL) && (*pBufLen == 0) && (pBuf == NULL)) { + memcpy(pHalData->para_file_buf, pBuf, *pBufLen); + rtStatus = _SUCCESS; -+ } -+ else { ++ } else + DBG_871X("%s(): Critical Error !!!\n", __func__); -+ } + } + -+ if (rtStatus == _SUCCESS) -+ { ++ if (rtStatus == _SUCCESS) { + ptmp = pHalData->para_file_buf; -+ for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) -+ { -+ if (!IsCommentString(szLine)) -+ { ++ for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) { ++ if (!IsCommentString(szLine)) { + /* Get 1st hex value as register offset. */ -+ if (GetHexValueFromString(szLine, &u4bRegOffset, &u4bMove)) -+ { -+ if (u4bRegOffset == 0xffff) -+ { /* Ending. */ ++ if (GetHexValueFromString(szLine, &u4bRegOffset, &u4bMove)) { ++ if (u4bRegOffset == 0xffff) /* Ending. */ + break; -+ } + else if (u4bRegOffset == 0xfe || u4bRegOffset == 0xffe) -+ { + msleep(50); -+ } + else if (u4bRegOffset == 0xfd) -+ { + mdelay(5); -+ } + else if (u4bRegOffset == 0xfc) -+ { + mdelay(1); -+ } + else if (u4bRegOffset == 0xfb) -+ { + udelay(50); -+ } + else if (u4bRegOffset == 0xfa) -+ { + udelay(5); -+ } + else if (u4bRegOffset == 0xf9) -+ { + udelay(1); -+ } + + /* Get 2nd hex value as register value. */ + szLine += u4bMove; -+ if (GetHexValueFromString(szLine, &u4bRegValue, &u4bMove)) -+ { ++ if (GetHexValueFromString(szLine, &u4bRegValue, &u4bMove)) { + /* DBG_871X("[BB-ADDR]%03lX =%08lX\n", u4bRegOffset, u4bRegValue); */ + PHY_SetBBReg(Adapter, u4bRegOffset, bMaskDWord, u4bRegValue); + @@ -49662,20 +48097,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + } + } + } -+ } -+ else -+ { ++ } else + DBG_871X("%s(): No File %s, Load from HWImg Array!\n", __func__, pFileName); -+ } + + return rtStatus; +} + -+static void -+phy_DecryptBBPgParaFile( -+ struct adapter * Adapter, -+ char* buffer -+ ) ++static void phy_DecryptBBPgParaFile(struct adapter *Adapter, char *buffer) +{ + u32 i = 0, j = 0; + u8 map[95] = {0}; @@ -49689,12 +48117,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + + ptmp = buffer; + i = 0; -+ for (BufOfLines = GetLineFromBuffer(ptmp); BufOfLines != NULL; BufOfLines = GetLineFromBuffer(ptmp)) -+ { ++ for (BufOfLines = GetLineFromBuffer(ptmp); BufOfLines != NULL; BufOfLines = GetLineFromBuffer(ptmp)) { + /* DBG_871X("Encrypted Line: %s\n", BufOfLines); */ + -+ for (j = 0; j < strlen(BufOfLines); ++j) -+ { ++ for (j = 0; j < strlen(BufOfLines); ++j) { + currentChar = BufOfLines[j]; + + if (currentChar == '\0') @@ -49711,11 +48137,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + } +} + -+static int -+phy_ParseBBPgParaFile( -+ struct adapter * Adapter, -+ char* buffer -+ ) ++static int phy_ParseBBPgParaFile(struct adapter *Adapter, char *buffer) +{ + int rtStatus = _SUCCESS; + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); @@ -49732,64 +48154,47 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + phy_DecryptBBPgParaFile(Adapter, buffer); + + ptmp = buffer; -+ for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) -+ { -+ if (!IsCommentString(szLine)) -+ { ++ for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) { ++ if (!IsCommentString(szLine)) { + if (isAllSpaceOrTab(szLine, sizeof(*szLine))) + continue; + + /* Get header info (relative value or exact value) */ -+ if (firstLine) -+ { -+ if (eqNByte(szLine, (u8 *)("#[v1]"), 5)) -+ { ++ if (firstLine) { ++ if (eqNByte(szLine, (u8 *)("#[v1]"), 5)) { + + pHalData->odmpriv.PhyRegPgVersion = szLine[3] - '0'; + /* DBG_871X("This is a new format PHY_REG_PG.txt\n"); */ -+ } -+ else if (eqNByte(szLine, (u8 *)("#[v0]"), 5)) -+ { ++ } else if (eqNByte(szLine, (u8 *)("#[v0]"), 5)) { + pHalData->odmpriv.PhyRegPgVersion = szLine[3] - '0'; + /* DBG_871X("This is a old format PHY_REG_PG.txt ok\n"); */ -+ } -+ else -+ { ++ } else { + DBG_871X("The format in PHY_REG_PG are invalid %s\n", szLine); + return _FAIL; + } + -+ if (eqNByte(szLine + 5, (u8 *)("[Exact]#"), 8)) -+ { ++ if (eqNByte(szLine + 5, (u8 *)("[Exact]#"), 8)) { + pHalData->odmpriv.PhyRegPgValueType = PHY_REG_PG_EXACT_VALUE; + /* DBG_871X("The values in PHY_REG_PG are exact values ok\n"); */ + firstLine = false; + continue; -+ } -+ else if (eqNByte(szLine + 5, (u8 *)("[Relative]#"), 11)) -+ { ++ } else if (eqNByte(szLine + 5, (u8 *)("[Relative]#"), 11)) { + pHalData->odmpriv.PhyRegPgValueType = PHY_REG_PG_RELATIVE_VALUE; + /* DBG_871X("The values in PHY_REG_PG are relative values ok\n"); */ + firstLine = false; + continue; -+ } -+ else -+ { ++ } else { + DBG_871X("The values in PHY_REG_PG are invalid %s\n", szLine); + return _FAIL; + } + } + -+ if (pHalData->odmpriv.PhyRegPgVersion == 0) -+ { ++ if (pHalData->odmpriv.PhyRegPgVersion == 0) { + /* Get 1st hex value as register offset. */ -+ if (GetHexValueFromString(szLine, &u4bRegOffset, &u4bMove)) -+ { ++ if (GetHexValueFromString(szLine, &u4bRegOffset, &u4bMove)) { + szLine += u4bMove; -+ if (u4bRegOffset == 0xffff) -+ { /* Ending. */ ++ if (u4bRegOffset == 0xffff) /* Ending. */ + break; -+ } + + /* Get 2nd hex value as register mask. */ + if (GetHexValueFromString(szLine, &u4bRegMask, &u4bMove)) @@ -49797,21 +48202,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + else + return _FAIL; + -+ if (pHalData->odmpriv.PhyRegPgValueType == PHY_REG_PG_RELATIVE_VALUE) -+ { ++ if (pHalData->odmpriv.PhyRegPgValueType == PHY_REG_PG_RELATIVE_VALUE) { + /* Get 3rd hex value as register value. */ -+ if (GetHexValueFromString(szLine, &u4bRegValue, &u4bMove)) -+ { ++ if (GetHexValueFromString(szLine, &u4bRegValue, &u4bMove)) { + PHY_StoreTxPowerByRate(Adapter, 0, 0, 1, u4bRegOffset, u4bRegMask, u4bRegValue); + /* DBG_871X("[ADDR] %03X =%08X Mask =%08x\n", u4bRegOffset, u4bRegValue, u4bRegMask); */ -+ } -+ else -+ { ++ } else + return _FAIL; -+ } -+ } -+ else if (pHalData->odmpriv.PhyRegPgValueType == PHY_REG_PG_EXACT_VALUE) -+ { ++ } else if (pHalData->odmpriv.PhyRegPgValueType == PHY_REG_PG_EXACT_VALUE) { + u32 combineValue = 0; + u8 integer = 0, fraction = 0; + @@ -49821,7 +48219,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + return _FAIL; + + integer *= 2; -+ if (fraction == 5) integer += 1; ++ if (fraction == 5) ++ integer += 1; + combineValue |= (((integer / 10) << 4) + (integer % 10)); + /* DBG_871X(" %d", integer); */ + @@ -49831,7 +48230,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + return _FAIL; + + integer *= 2; -+ if (fraction == 5) integer += 1; ++ if (fraction == 5) ++ integer += 1; + combineValue <<= 8; + combineValue |= (((integer / 10) << 4) + (integer % 10)); + /* DBG_871X(" %d", integer); */ @@ -49842,7 +48242,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + return _FAIL; + + integer *= 2; -+ if (fraction == 5) integer += 1; ++ if (fraction == 5) ++ integer += 1; + combineValue <<= 8; + combineValue |= (((integer / 10) << 4) + (integer % 10)); + /* DBG_871X(" %d", integer); */ @@ -49853,7 +48254,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + return _FAIL; + + integer *= 2; -+ if (fraction == 5) integer += 1; ++ if (fraction == 5) ++ integer += 1; + combineValue <<= 8; + combineValue |= (((integer / 10) << 4) + (integer % 10)); + /* DBG_871X(" %d", integer); */ @@ -49862,41 +48264,30 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + /* DBG_871X("[ADDR] 0x%3x = 0x%4x\n", u4bRegOffset, combineValue); */ + } + } -+ } -+ else if (pHalData->odmpriv.PhyRegPgVersion > 0) -+ { ++ } else if (pHalData->odmpriv.PhyRegPgVersion > 0) { + u32 index = 0; + + if (eqNByte(szLine, "0xffff", 6)) + break; + -+ if (!eqNByte("#[END]#", szLine, 7)) -+ { ++ if (!eqNByte("#[END]#", szLine, 7)) { + /* load the table label info */ -+ if (szLine[0] == '#') -+ { ++ if (szLine[0] == '#') { + index = 0; -+ if (eqNByte(szLine, "#[2.4G]" , 7)) -+ { ++ if (eqNByte(szLine, "#[2.4G]", 7)) { + band = BAND_ON_2_4G; + index += 8; -+ } -+ else if (eqNByte(szLine, "#[5G]", 5)) -+ { ++ } else if (eqNByte(szLine, "#[5G]", 5)) { + band = BAND_ON_5G; + index += 6; -+ } -+ else -+ { ++ } else { + DBG_871X("Invalid band %s in PHY_REG_PG.txt\n", szLine); + return _FAIL; + } + + rf_path = szLine[index] - 'A'; + /* DBG_871X(" Table label Band %d, RfPath %d\n", band, rf_path); */ -+ } -+ else /* load rows of tables */ -+ { ++ } else { /* load rows of tables */ + if (szLine[1] == '1') + tx_num = RF_1TX; + else if (szLine[1] == '2') @@ -49905,8 +48296,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + tx_num = RF_3TX; + else if (szLine[1] == '4') + tx_num = RF_4TX; -+ else -+ { ++ else { + DBG_871X("Invalid row in PHY_REG_PG.txt %c\n", szLine[1]); + return _FAIL; + } @@ -49928,21 +48318,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + else + return _FAIL; + -+ if (pHalData->odmpriv.PhyRegPgValueType == PHY_REG_PG_RELATIVE_VALUE) -+ { ++ if (pHalData->odmpriv.PhyRegPgValueType == PHY_REG_PG_RELATIVE_VALUE) { + /* Get 3rd hex value as register value. */ -+ if (GetHexValueFromString(szLine, &u4bRegValue, &u4bMove)) -+ { ++ if (GetHexValueFromString(szLine, &u4bRegValue, &u4bMove)) { + PHY_StoreTxPowerByRate(Adapter, band, rf_path, tx_num, u4bRegOffset, u4bRegMask, u4bRegValue); + /* DBG_871X("[ADDR] %03X (tx_num %d) =%08X Mask =%08x\n", u4bRegOffset, tx_num, u4bRegValue, u4bRegMask); */ -+ } -+ else -+ { ++ } else + return _FAIL; -+ } -+ } -+ else if (pHalData->odmpriv.PhyRegPgValueType == PHY_REG_PG_EXACT_VALUE) -+ { ++ } else if (pHalData->odmpriv.PhyRegPgValueType == PHY_REG_PG_EXACT_VALUE) { + u32 combineValue = 0; + u8 integer = 0, fraction = 0; + @@ -49952,7 +48335,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + return _FAIL; + + integer *= 2; -+ if (fraction == 5) integer += 1; ++ if (fraction == 5) ++ integer += 1; + combineValue |= (((integer / 10) << 4) + (integer % 10)); + /* DBG_871X(" %d", integer); */ + @@ -49962,7 +48346,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + return _FAIL; + + integer *= 2; -+ if (fraction == 5) integer += 1; ++ if (fraction == 5) ++ integer += 1; + combineValue <<= 8; + combineValue |= (((integer / 10) << 4) + (integer % 10)); + /* DBG_871X(" %d", integer); */ @@ -49973,7 +48358,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + return _FAIL; + + integer *= 2; -+ if (fraction == 5) integer += 1; ++ if (fraction == 5) ++ integer += 1; + combineValue <<= 8; + combineValue |= (((integer / 10) << 4) + (integer % 10)); + /* DBG_871X(" %d", integer); */ @@ -49984,7 +48370,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + return _FAIL; + + integer *= 2; -+ if (fraction == 5) integer += 1; ++ if (fraction == 5) ++ integer += 1; + combineValue <<= 8; + combineValue |= (((integer / 10) << 4) + (integer % 10)); + /* DBG_871X(" %d", integer); */ @@ -50001,10 +48388,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + return rtStatus; +} + -+int -+phy_ConfigBBWithPgParaFile( -+struct adapter *Adapter, -+char* pFileName) ++int phy_ConfigBBWithPgParaFile(struct adapter *Adapter, char *pFileName) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + int rlen = 0, rtStatus = _FAIL; @@ -50014,56 +48398,40 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + + memset(pHalData->para_file_buf, 0, MAX_PARA_FILE_BUF_LEN); + -+ if ((pHalData->bb_phy_reg_pg_len == 0) && (pHalData->bb_phy_reg_pg == NULL)) -+ { ++ if ((pHalData->bb_phy_reg_pg_len == 0) && (pHalData->bb_phy_reg_pg == NULL)) { + rtw_merge_string(file_path_bs, PATH_MAX, rtw_phy_file_path, pFileName); + -+ if (rtw_is_file_readable(file_path_bs) == true) -+ { ++ if (rtw_is_file_readable(file_path_bs) == true) { + rlen = rtw_retrive_from_file(file_path_bs, pHalData->para_file_buf, MAX_PARA_FILE_BUF_LEN); -+ if (rlen > 0) -+ { ++ if (rlen > 0) { + rtStatus = _SUCCESS; + pHalData->bb_phy_reg_pg = vzalloc(rlen); + if (pHalData->bb_phy_reg_pg) { + memcpy(pHalData->bb_phy_reg_pg, pHalData->para_file_buf, rlen); + pHalData->bb_phy_reg_pg_len = rlen; -+ } -+ else { ++ } else + DBG_871X("%s bb_phy_reg_pg alloc fail !\n", __func__); -+ } + } + } -+ } -+ else -+ { ++ } else { + if ((pHalData->bb_phy_reg_pg_len != 0) && (pHalData->bb_phy_reg_pg != NULL)) { + memcpy(pHalData->para_file_buf, pHalData->bb_phy_reg_pg, pHalData->bb_phy_reg_pg_len); + rtStatus = _SUCCESS; -+ } -+ else { ++ } else + DBG_871X("%s(): Critical Error !!!\n", __func__); -+ } + } + -+ if (rtStatus == _SUCCESS) -+ { ++ if (rtStatus == _SUCCESS) { + /* DBG_871X("phy_ConfigBBWithPgParaFile(): read %s ok\n", pFileName); */ + phy_ParseBBPgParaFile(Adapter, pHalData->para_file_buf); -+ } -+ else -+ { ++ } else + DBG_871X("%s(): No File %s, Load from HWImg Array!\n", __func__, pFileName); -+ } + + return rtStatus; +} + -+int -+PHY_ConfigRFWithParaFile( -+struct adapter *Adapter, -+char* pFileName, -+u8 eRFPath ++int PHY_ConfigRFWithParaFile( ++ struct adapter *Adapter, char *pFileName, u8 eRFPath +) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); @@ -50077,114 +48445,84 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + if (!(Adapter->registrypriv.load_phy_file & LOAD_RF_PARA_FILE)) + return rtStatus; + -+ switch (eRFPath) -+ { -+ case ODM_RF_PATH_A: -+ pBuf = pHalData->rf_radio_a; -+ pBufLen = &pHalData->rf_radio_a_len; -+ break; -+ case ODM_RF_PATH_B: -+ pBuf = pHalData->rf_radio_b; -+ pBufLen = &pHalData->rf_radio_b_len; -+ break; -+ default: -+ DBG_871X("Unknown RF path!! %d\r\n", eRFPath); -+ break; ++ switch (eRFPath) { ++ case ODM_RF_PATH_A: ++ pBuf = pHalData->rf_radio_a; ++ pBufLen = &pHalData->rf_radio_a_len; ++ break; ++ case ODM_RF_PATH_B: ++ pBuf = pHalData->rf_radio_b; ++ pBufLen = &pHalData->rf_radio_b_len; ++ break; ++ default: ++ DBG_871X("Unknown RF path!! %d\r\n", eRFPath); ++ break; + } + + memset(pHalData->para_file_buf, 0, MAX_PARA_FILE_BUF_LEN); + -+ if ((pBufLen != NULL) && (*pBufLen == 0) && (pBuf == NULL)) -+ { ++ if ((pBufLen != NULL) && (*pBufLen == 0) && (pBuf == NULL)) { + rtw_merge_string(file_path_bs, PATH_MAX, rtw_phy_file_path, pFileName); + -+ if (rtw_is_file_readable(file_path_bs) == true) -+ { ++ if (rtw_is_file_readable(file_path_bs) == true) { + rlen = rtw_retrive_from_file(file_path_bs, pHalData->para_file_buf, MAX_PARA_FILE_BUF_LEN); -+ if (rlen > 0) -+ { ++ if (rlen > 0) { + rtStatus = _SUCCESS; + pBuf = vzalloc(rlen); + if (pBuf) { + memcpy(pBuf, pHalData->para_file_buf, rlen); + *pBufLen = rlen; + -+ switch (eRFPath) -+ { -+ case ODM_RF_PATH_A: -+ pHalData->rf_radio_a = pBuf; -+ break; -+ case ODM_RF_PATH_B: -+ pHalData->rf_radio_b = pBuf; -+ break; ++ switch (eRFPath) { ++ case ODM_RF_PATH_A: ++ pHalData->rf_radio_a = pBuf; ++ break; ++ case ODM_RF_PATH_B: ++ pHalData->rf_radio_b = pBuf; ++ break; + } -+ } -+ else { ++ } else + DBG_871X("%s(): eRFPath =%d alloc fail !\n", __func__, eRFPath); -+ } + } + } -+ } -+ else -+ { ++ } else { + if ((pBufLen != NULL) && (*pBufLen == 0) && (pBuf == NULL)) { + memcpy(pHalData->para_file_buf, pBuf, *pBufLen); + rtStatus = _SUCCESS; -+ } -+ else { ++ } else + DBG_871X("%s(): Critical Error !!!\n", __func__); -+ } + } + -+ if (rtStatus == _SUCCESS) -+ { ++ if (rtStatus == _SUCCESS) { + /* DBG_871X("%s(): read %s successfully\n", __func__, pFileName); */ + + ptmp = pHalData->para_file_buf; -+ for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) -+ { -+ if (!IsCommentString(szLine)) -+ { ++ for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) { ++ if (!IsCommentString(szLine)) { + /* Get 1st hex value as register offset. */ -+ if (GetHexValueFromString(szLine, &u4bRegOffset, &u4bMove)) -+ { -+ if (u4bRegOffset == 0xfe || u4bRegOffset == 0xffe) -+ { /* Deay specific ms. Only RF configuration require delay. */ ++ if (GetHexValueFromString(szLine, &u4bRegOffset, &u4bMove)) { ++ if (u4bRegOffset == 0xfe || u4bRegOffset == 0xffe) /* Deay specific ms. Only RF configuration require delay. */ + msleep(50); -+ } -+ else if (u4bRegOffset == 0xfd) -+ { ++ else if (u4bRegOffset == 0xfd) { + /* mdelay(5); */ -+ for (i = 0;i<100;i++) ++ for (i = 0; i < 100; i++) + udelay(MAX_STALL_TIME); -+ } -+ else if (u4bRegOffset == 0xfc) -+ { ++ } else if (u4bRegOffset == 0xfc) { + /* mdelay(1); */ -+ for (i = 0;i<20;i++) ++ for (i = 0; i < 20; i++) + udelay(MAX_STALL_TIME); -+ } -+ else if (u4bRegOffset == 0xfb) -+ { ++ } else if (u4bRegOffset == 0xfb) + udelay(50); -+ } + else if (u4bRegOffset == 0xfa) -+ { + udelay(5); -+ } + else if (u4bRegOffset == 0xf9) -+ { + udelay(1); -+ } + else if (u4bRegOffset == 0xffff) -+ { + break; -+ } + + /* Get 2nd hex value as register value. */ + szLine += u4bMove; -+ if (GetHexValueFromString(szLine, &u4bRegValue, &u4bMove)) -+ { ++ if (GetHexValueFromString(szLine, &u4bRegValue, &u4bMove)) { + PHY_SetRFReg(Adapter, eRFPath, u4bRegOffset, bRFRegOffsetMask, u4bRegValue); + + /* Temp add, for frequency lock, if no delay, that may cause */ @@ -50200,24 +48538,20 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + } + } + } -+ } -+ else -+ { ++ } else + DBG_871X("%s(): No File %s, Load from HWImg Array!\n", __func__, pFileName); -+ } + + return rtStatus; +} + -+static void -+initDeltaSwingIndexTables( ++static void initDeltaSwingIndexTables( + struct adapter *Adapter, -+ char* Band, -+ char* Path, -+ char* Sign, -+ char* Channel, -+ char* Rate, -+ char* Data ++ char *Band, ++ char *Path, ++ char *Sign, ++ char *Channel, ++ char *Rate, ++ char *Data +) +{ + #define STR_EQUAL_5G(_band, _path, _sign, _rate, _chnl) \ @@ -50230,132 +48564,77 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + ) + + #define STORE_SWING_TABLE(_array, _iteratedIdx) \ -+ for (token = strsep(&Data, delim); token != NULL; token = strsep(&Data, delim))\ -+ {\ ++ for (token = strsep(&Data, delim); token != NULL; token = strsep(&Data, delim)) {\ + sscanf(token, "%d", &idx);\ + _array[_iteratedIdx++] = (u8)idx;\ -+ }\ ++ } \ + + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); -+ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; -+ PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); ++ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; ++ PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); + u32 j = 0; + char *token; + char delim[] = ","; + u32 idx = 0; + + /* DBG_871X("===>initDeltaSwingIndexTables(): Band: %s;\nPath: %s;\nSign: %s;\nChannel: %s;\nRate: %s;\n, Data: %s;\n", */ -+ /* Band, Path, Sign, Channel, Rate, Data); */ ++ /* Band, Path, Sign, Channel, Rate, Data); */ + -+ if (STR_EQUAL_2G("2G", "A", "+", "CCK")) -+ { ++ if (STR_EQUAL_2G("2G", "A", "+", "CCK")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_P, j); -+ } -+ else if (STR_EQUAL_2G("2G", "A", "-", "CCK")) -+ { ++ } else if (STR_EQUAL_2G("2G", "A", "-", "CCK")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_N, j); -+ } -+ else if (STR_EQUAL_2G("2G", "B", "+", "CCK")) -+ { ++ } else if (STR_EQUAL_2G("2G", "B", "+", "CCK")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_P, j); -+ } -+ else if (STR_EQUAL_2G("2G", "B", "-", "CCK")) -+ { ++ } else if (STR_EQUAL_2G("2G", "B", "-", "CCK")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_N, j); -+ } -+ else if (STR_EQUAL_2G("2G", "A", "+", "ALL")) -+ { ++ } else if (STR_EQUAL_2G("2G", "A", "+", "ALL")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_2GA_P, j); -+ } -+ else if (STR_EQUAL_2G("2G", "A", "-", "ALL")) -+ { ++ } else if (STR_EQUAL_2G("2G", "A", "-", "ALL")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_2GA_N, j); -+ } -+ else if (STR_EQUAL_2G("2G", "B", "+", "ALL")) -+ { ++ } else if (STR_EQUAL_2G("2G", "B", "+", "ALL")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_2GB_P, j); -+ } -+ else if (STR_EQUAL_2G("2G", "B", "-", "ALL")) -+ { ++ } else if (STR_EQUAL_2G("2G", "B", "-", "ALL")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_2GB_N, j); -+ } -+ else if (STR_EQUAL_5G("5G", "A", "+", "ALL", "0")) -+ { ++ } else if (STR_EQUAL_5G("5G", "A", "+", "ALL", "0")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_5GA_P[0], j); -+ } -+ else if (STR_EQUAL_5G("5G", "A", "-", "ALL", "0")) -+ { ++ } else if (STR_EQUAL_5G("5G", "A", "-", "ALL", "0")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_5GA_N[0], j); -+ } -+ else if (STR_EQUAL_5G("5G", "B", "+", "ALL", "0")) -+ { ++ } else if (STR_EQUAL_5G("5G", "B", "+", "ALL", "0")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_5GB_P[0], j); -+ } -+ else if (STR_EQUAL_5G("5G", "B", "-", "ALL", "0")) -+ { ++ } else if (STR_EQUAL_5G("5G", "B", "-", "ALL", "0")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_5GB_N[0], j); -+ } -+ else if (STR_EQUAL_5G("5G", "A", "+", "ALL", "1")) -+ { ++ } else if (STR_EQUAL_5G("5G", "A", "+", "ALL", "1")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_5GA_P[1], j); -+ } -+ else if (STR_EQUAL_5G("5G", "A", "-", "ALL", "1")) -+ { ++ } else if (STR_EQUAL_5G("5G", "A", "-", "ALL", "1")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_5GA_N[1], j); -+ } -+ else if (STR_EQUAL_5G("5G", "B", "+", "ALL", "1")) -+ { ++ } else if (STR_EQUAL_5G("5G", "B", "+", "ALL", "1")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_5GB_P[1], j); -+ } -+ else if (STR_EQUAL_5G("5G", "B", "-", "ALL", "1")) -+ { ++ } else if (STR_EQUAL_5G("5G", "B", "-", "ALL", "1")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_5GB_N[1], j); -+ } -+ else if (STR_EQUAL_5G("5G", "A", "+", "ALL", "2")) -+ { ++ } else if (STR_EQUAL_5G("5G", "A", "+", "ALL", "2")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_5GA_P[2], j); -+ } -+ else if (STR_EQUAL_5G("5G", "A", "-", "ALL", "2")) -+ { ++ } else if (STR_EQUAL_5G("5G", "A", "-", "ALL", "2")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_5GA_N[2], j); -+ } -+ else if (STR_EQUAL_5G("5G", "B", "+", "ALL", "2")) -+ { ++ } else if (STR_EQUAL_5G("5G", "B", "+", "ALL", "2")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_5GB_P[2], j); -+ } -+ else if (STR_EQUAL_5G("5G", "B", "-", "ALL", "2")) -+ { ++ } else if (STR_EQUAL_5G("5G", "B", "-", "ALL", "2")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_5GB_N[2], j); -+ } -+ else if (STR_EQUAL_5G("5G", "A", "+", "ALL", "3")) -+ { ++ } else if (STR_EQUAL_5G("5G", "A", "+", "ALL", "3")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_5GA_P[3], j); -+ } -+ else if (STR_EQUAL_5G("5G", "A", "-", "ALL", "3")) -+ { ++ } else if (STR_EQUAL_5G("5G", "A", "-", "ALL", "3")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_5GA_N[3], j); -+ } -+ else if (STR_EQUAL_5G("5G", "B", "+", "ALL", "3")) -+ { ++ } else if (STR_EQUAL_5G("5G", "B", "+", "ALL", "3")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_5GB_P[3], j); -+ } -+ else if (STR_EQUAL_5G("5G", "B", "-", "ALL", "3")) -+ { ++ } else if (STR_EQUAL_5G("5G", "B", "-", "ALL", "3")) { + STORE_SWING_TABLE(pRFCalibrateInfo->DeltaSwingTableIdx_5GB_N[3], j); -+ } -+ else -+ { ++ } else + DBG_871X("===>initDeltaSwingIndexTables(): The input is invalid!!\n"); -+ } +} + -+int -+PHY_ConfigRFWithTxPwrTrackParaFile( -+struct adapter * Adapter, -+char* pFileName -+) ++int PHY_ConfigRFWithTxPwrTrackParaFile(struct adapter *Adapter, char *pFileName) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + int rlen = 0, rtStatus = _FAIL; + char *szLine, *ptmp; + u32 i = 0; @@ -50365,50 +48644,38 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + + memset(pHalData->para_file_buf, 0, MAX_PARA_FILE_BUF_LEN); + -+ if ((pHalData->rf_tx_pwr_track_len == 0) && (pHalData->rf_tx_pwr_track == NULL)) -+ { ++ if ((pHalData->rf_tx_pwr_track_len == 0) && (pHalData->rf_tx_pwr_track == NULL)) { + rtw_merge_string(file_path_bs, PATH_MAX, rtw_phy_file_path, pFileName); + -+ if (rtw_is_file_readable(file_path_bs) == true) -+ { ++ if (rtw_is_file_readable(file_path_bs) == true) { + rlen = rtw_retrive_from_file(file_path_bs, pHalData->para_file_buf, MAX_PARA_FILE_BUF_LEN); -+ if (rlen > 0) -+ { ++ if (rlen > 0) { + rtStatus = _SUCCESS; + pHalData->rf_tx_pwr_track = vzalloc(rlen); + if (pHalData->rf_tx_pwr_track) { + memcpy(pHalData->rf_tx_pwr_track, pHalData->para_file_buf, rlen); + pHalData->rf_tx_pwr_track_len = rlen; -+ } -+ else { ++ } else + DBG_871X("%s rf_tx_pwr_track alloc fail !\n", __func__); -+ } + } + } -+ } -+ else -+ { ++ } else { + if ((pHalData->rf_tx_pwr_track_len != 0) && (pHalData->rf_tx_pwr_track != NULL)) { + memcpy(pHalData->para_file_buf, pHalData->rf_tx_pwr_track, pHalData->rf_tx_pwr_track_len); + rtStatus = _SUCCESS; -+ } -+ else { ++ } else + DBG_871X("%s(): Critical Error !!!\n", __func__); -+ } + } + -+ if (rtStatus == _SUCCESS) -+ { ++ if (rtStatus == _SUCCESS) { + /* DBG_871X("%s(): read %s successfully\n", __func__, pFileName); */ + + ptmp = pHalData->para_file_buf; -+ for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) -+ { -+ if (! IsCommentString(szLine)) -+ { -+ char band[5]="", path[5]="", sign[5] = ""; -+ char chnl[5]="", rate[10]=""; -+ char data[300]=""; /* 100 is too small */ ++ for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) { ++ if (!IsCommentString(szLine)) { ++ char band[5] = "", path[5] = "", sign[5] = ""; ++ char chnl[5] = "", rate[10] = ""; ++ char data[300] = ""; /* 100 is too small */ + + if (strlen(szLine) < 10 || szLine[0] != '[') + continue; @@ -50418,35 +48685,28 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + strncpy(sign, szLine+8, 1); + + i = 10; /* szLine+10 */ -+ if (! ParseQualifiedString(szLine, &i, rate, '[', ']')) { ++ if (!ParseQualifiedString(szLine, &i, rate, '[', ']')) { + /* DBG_871X("Fail to parse rate!\n"); */ + } -+ if (! ParseQualifiedString(szLine, &i, chnl, '[', ']')) { ++ if (!ParseQualifiedString(szLine, &i, chnl, '[', ']')) { + /* DBG_871X("Fail to parse channel group!\n"); */ + } + while (szLine[i] != '{' && i < strlen(szLine)) + i++; -+ if (! ParseQualifiedString(szLine, &i, data, '{', '}')) { ++ if (!ParseQualifiedString(szLine, &i, data, '{', '}')) { + /* DBG_871X("Fail to parse data!\n"); */ + } + + initDeltaSwingIndexTables(Adapter, band, path, sign, chnl, rate, data); + } + } -+ } -+ else -+ { ++ } else + DBG_871X("%s(): No File %s, Load from HWImg Array!\n", __func__, pFileName); -+ } + + return rtStatus; +} + -+static int -+phy_ParsePowerLimitTableFile( -+ struct adapter * Adapter, -+ char* buffer -+) ++static int phy_ParsePowerLimitTableFile(struct adapter *Adapter, char *buffer) +{ + u32 i = 0, forCnt = 0; + u8 loadingStage = 0, limitValue = 0, fraction = 0; @@ -50462,8 +48722,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + phy_DecryptBBPgParaFile(Adapter, buffer); + + ptmp = buffer; -+ for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) -+ { ++ for (szLine = GetLineFromBuffer(ptmp); szLine != NULL; szLine = GetLineFromBuffer(ptmp)) { + /* skip comment */ + if (IsCommentString(szLine)) { + continue; @@ -50472,6 +48731,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + if (loadingStage == 0) { + for (forCnt = 0; forCnt < TXPWR_LMT_MAX_REGULATION_NUM; ++forCnt) + memset((void *) regulation[forCnt], 0, 10); ++ + memset((void *) band, 0, 10); + memset((void *) bandwidth, 0, 10); + memset((void *) rateSection, 0, 10); @@ -50489,27 +48749,25 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + szLine[--i] = ' '; /* return the space in front of the regulation info */ + + /* Parse the label of the table */ -+ if (! ParseQualifiedString(szLine, &i, band, ' ', ',')) { ++ if (!ParseQualifiedString(szLine, &i, band, ' ', ',')) { + DBG_871X("Fail to parse band!\n"); + return _FAIL; + } -+ if (! ParseQualifiedString(szLine, &i, bandwidth, ' ', ',')) { ++ if (!ParseQualifiedString(szLine, &i, bandwidth, ' ', ',')) { + DBG_871X("Fail to parse bandwidth!\n"); + return _FAIL; + } -+ if (! ParseQualifiedString(szLine, &i, rfPath, ' ', ',')) { ++ if (!ParseQualifiedString(szLine, &i, rfPath, ' ', ',')) { + DBG_871X("Fail to parse rf path!\n"); + return _FAIL; + } -+ if (! ParseQualifiedString(szLine, &i, rateSection, ' ', ',')) { ++ if (!ParseQualifiedString(szLine, &i, rateSection, ' ', ',')) { + DBG_871X("Fail to parse rate!\n"); + return _FAIL; + } + + loadingStage = 1; -+ } -+ else if (loadingStage == 1) -+ { ++ } else if (loadingStage == 1) { + if (szLine[0] != '#' || szLine[1] != '#') + continue; + @@ -50524,9 +48782,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + } + + loadingStage = 2; -+ } -+ else if (loadingStage == 2) -+ { ++ } else if (loadingStage == 2) { + if (szLine[0] != '#' || szLine[1] != '#') + continue; + @@ -50535,7 +48791,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + while (szLine[i] == ' ' || szLine[i] == '\t') + ++i; + -+ if (! ParseQualifiedString(szLine, &i, colNumBuf, '#', '#')) { ++ if (!ParseQualifiedString(szLine, &i, colNumBuf, '#', '#')) { + DBG_871X("Fail to parse column number!\n"); + return _FAIL; + } @@ -50544,13 +48800,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + return _FAIL; + + if (colNum > TXPWR_LMT_MAX_REGULATION_NUM) { -+ DBG_871X("unvalid col number %d (greater than max %d)\n", -+ colNum, TXPWR_LMT_MAX_REGULATION_NUM); ++ DBG_871X( ++ "unvalid col number %d (greater than max %d)\n", ++ colNum, TXPWR_LMT_MAX_REGULATION_NUM ++ ); + return _FAIL; + } + -+ for (forCnt = 0; forCnt < colNum; ++forCnt) -+ { ++ for (forCnt = 0; forCnt < colNum; ++forCnt) { + u8 regulation_name_cnt = 0; + + /* skip the space */ @@ -50568,9 +48825,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + } + + loadingStage = 3; -+ } -+ else if (loadingStage == 3) -+ { ++ } else if (loadingStage == 3) { + char channel[10] = {0}, powerLimit[10] = {0}; + u8 cnt = 0; + @@ -50583,8 +48838,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + if (eqNByte((u8 *)(szLine + i), (u8 *)("END"), 3)) { + loadingStage = 0; + continue; -+ } -+ else { ++ } else { + DBG_871X("Wrong format\n"); + DBG_871X("<===== phy_ParsePowerLimitTableFile()\n"); + return _FAIL; @@ -50607,8 +48861,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + } + /* DBG_871X("chnl %s!\n", channel); */ + -+ for (forCnt = 0; forCnt < colNum; ++forCnt) -+ { ++ for (forCnt = 0; forCnt < colNum; ++forCnt) { + /* skip the space between channel number and the power limit value */ + while (szLine[i] == ' ' || szLine[i] == '\t') + ++i; @@ -50617,14 +48870,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + cnt = 0; + fraction = 0; + memset((void *) powerLimit, 0, 10); -+ while ((szLine[i] >= '0' && szLine[i] <= '9') || szLine[i] == '.') -+ { ++ while ((szLine[i] >= '0' && szLine[i] <= '9') || szLine[i] == '.') { + if (szLine[i] == '.') { + if ((szLine[i+1] >= '0' && szLine[i+1] <= '9')) { + fraction = szLine[i+1]; + i += 2; -+ } -+ else { ++ } else { + DBG_871X("Wrong fraction in TXPWR_LMT.txt\n"); + return _FAIL; + } @@ -50641,8 +48892,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + powerLimit[0] = '6'; + powerLimit[1] = '3'; + i += 2; -+ } -+ else { ++ } else { + if (!GetU1ByteIntegerFromStringInDecimal(powerLimit, &limitValue)) + return _FAIL; + @@ -50659,15 +48909,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + if (limitValue >= 10) { + powerLimit[cnt++] = limitValue/10 + '0'; + limitValue %= 10; -+ } -+ else { ++ } else + powerLimit[cnt++] = '0'; -+ } + + powerLimit[cnt++] = limitValue + '0'; -+ } -+ /* the value is greater or equal to 10 */ -+ else if (limitValue >= 10) { ++ } else if (limitValue >= 10) { /* the value is greater or equal to 10 */ + powerLimit[cnt++] = limitValue/10 + '0'; + limitValue %= 10; + powerLimit[cnt++] = limitValue + '0'; @@ -50686,9 +48932,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + (u8 *)bandwidth, (u8 *)rateSection, (u8 *)rfPath, (u8 *)channel, (u8 *)powerLimit); + + } -+ } -+ else -+ { ++ } else { + DBG_871X("Abnormal loading stage in phy_ParsePowerLimitTableFile()!\n"); + rtStatus = _FAIL; + break; @@ -50699,13 +48943,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + return rtStatus; +} + -+int -+PHY_ConfigRFWithPowerLimitTableParaFile( -+struct adapter *Adapter, -+char* pFileName ++int PHY_ConfigRFWithPowerLimitTableParaFile( ++ struct adapter *Adapter, char *pFileName +) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + int rlen = 0, rtStatus = _FAIL; + + if (!(Adapter->registrypriv.load_phy_file & LOAD_RF_TXPWR_LMT_PARA_FILE)) @@ -50713,47 +48955,34 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs + + memset(pHalData->para_file_buf, 0, MAX_PARA_FILE_BUF_LEN); + -+ if ((pHalData->rf_tx_pwr_lmt_len == 0) && (pHalData->rf_tx_pwr_lmt == NULL)) -+ { ++ if ((pHalData->rf_tx_pwr_lmt_len == 0) && (pHalData->rf_tx_pwr_lmt == NULL)) { + rtw_merge_string(file_path_bs, PATH_MAX, rtw_phy_file_path, pFileName); + -+ if (rtw_is_file_readable(file_path_bs) == true) -+ { ++ if (rtw_is_file_readable(file_path_bs) == true) { + rlen = rtw_retrive_from_file(file_path_bs, pHalData->para_file_buf, MAX_PARA_FILE_BUF_LEN); -+ if (rlen > 0) -+ { ++ if (rlen > 0) { + rtStatus = _SUCCESS; + pHalData->rf_tx_pwr_lmt = vzalloc(rlen); + if (pHalData->rf_tx_pwr_lmt) { + memcpy(pHalData->rf_tx_pwr_lmt, pHalData->para_file_buf, rlen); + pHalData->rf_tx_pwr_lmt_len = rlen; -+ } -+ else { ++ } else + DBG_871X("%s rf_tx_pwr_lmt alloc fail !\n", __func__); -+ } + } + } -+ } -+ else -+ { ++ } else { + if ((pHalData->rf_tx_pwr_lmt_len != 0) && (pHalData->rf_tx_pwr_lmt != NULL)) { + memcpy(pHalData->para_file_buf, pHalData->rf_tx_pwr_lmt, pHalData->rf_tx_pwr_lmt_len); + rtStatus = _SUCCESS; -+ } -+ else { ++ } else + DBG_871X("%s(): Critical Error !!!\n", __func__); -+ } + } + -+ if (rtStatus == _SUCCESS) -+ { ++ if (rtStatus == _SUCCESS) { + /* DBG_871X("%s(): read %s ok\n", __func__, pFileName); */ + rtStatus = phy_ParsePowerLimitTableFile(Adapter, pHalData->para_file_buf); -+ } -+ else -+ { ++ } else + DBG_871X("%s(): No File %s, Load from HWImg Array!\n", __func__, pFileName); -+ } + + return rtStatus; +} @@ -50784,10 +49013,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_com_phycfg.c linux-4.3-rtl8723bs +} + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.c ---- linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,612 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.c linux/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.c +--- linux.old/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,643 @@ +/****************************************************************************** +* +* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -50806,40 +49035,71 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.c linux-4.3-rtl8723 + +#include "odm_precomp.h" + -+static bool -+CheckPositive( -+ PDM_ODM_T pDM_Odm, -+ const u32 Condition1, -+ const u32 Condition2 -+ ) ++static bool CheckPositive( ++ PDM_ODM_T pDM_Odm, const u32 Condition1, const u32 Condition2 ++) +{ -+ u8 _BoardType = ((pDM_Odm->BoardType & BIT4) >> 4) << 0 | /* _GLNA */ -+ ((pDM_Odm->BoardType & BIT3) >> 3) << 1 | /* _GPA */ -+ ((pDM_Odm->BoardType & BIT7) >> 7) << 2 | /* _ALNA */ -+ ((pDM_Odm->BoardType & BIT6) >> 6) << 3 | /* _APA */ -+ ((pDM_Odm->BoardType & BIT2) >> 2) << 4; /* _BT */ ++ u8 _BoardType = ++ ((pDM_Odm->BoardType & BIT4) >> 4) << 0 | /* _GLNA */ ++ ((pDM_Odm->BoardType & BIT3) >> 3) << 1 | /* _GPA */ ++ ((pDM_Odm->BoardType & BIT7) >> 7) << 2 | /* _ALNA */ ++ ((pDM_Odm->BoardType & BIT6) >> 6) << 3 | /* _APA */ ++ ((pDM_Odm->BoardType & BIT2) >> 2) << 4; /* _BT */ + -+ u32 cond1 = Condition1, cond2 = Condition2; -+ u32 driver1 = pDM_Odm->CutVersion << 24 | -+ pDM_Odm->SupportPlatform << 16 | -+ pDM_Odm->PackageType << 12 | -+ pDM_Odm->SupportInterface << 8 | -+ _BoardType; ++ u32 cond1 = Condition1, cond2 = Condition2; ++ u32 driver1 = ++ pDM_Odm->CutVersion << 24 | ++ pDM_Odm->SupportPlatform << 16 | ++ pDM_Odm->PackageType << 12 | ++ pDM_Odm->SupportInterface << 8 | ++ _BoardType; + -+ u32 driver2 = pDM_Odm->TypeGLNA << 0 | -+ pDM_Odm->TypeGPA << 8 | -+ pDM_Odm->TypeALNA << 16 | -+ pDM_Odm->TypeAPA << 24; ++ u32 driver2 = ++ pDM_Odm->TypeGLNA << 0 | ++ pDM_Odm->TypeGPA << 8 | ++ pDM_Odm->TypeALNA << 16 | ++ pDM_Odm->TypeAPA << 24; + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, -+ ("===> [8812A] CheckPositive (cond1, cond2) = (0x%X 0x%X)\n", cond1, cond2)); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, -+ ("===> [8812A] CheckPositive (driver1, driver2) = (0x%X 0x%X)\n", driver1, driver2)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_TRACE, ++ ( ++ "===> [8812A] CheckPositive (cond1, cond2) = (0x%X 0x%X)\n", ++ cond1, ++ cond2 ++ ) ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_TRACE, ++ ( ++ "===> [8812A] CheckPositive (driver1, driver2) = (0x%X 0x%X)\n", ++ driver1, ++ driver2 ++ ) ++ ); + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, -+ (" (Platform, Interface) = (0x%X, 0x%X)\n", pDM_Odm->SupportPlatform, pDM_Odm->SupportInterface)); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, -+ (" (Board, Package) = (0x%X, 0x%X)\n", pDM_Odm->BoardType, pDM_Odm->PackageType)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_TRACE, ++ (" (Platform, Interface) = (0x%X, 0x%X)\n", ++ pDM_Odm->SupportPlatform, ++ pDM_Odm->SupportInterface ++ ) ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_TRACE, ++ ( ++ " (Board, Package) = (0x%X, 0x%X)\n", ++ pDM_Odm->BoardType, ++ pDM_Odm->PackageType ++ ) ++ ); + + + /* Value Defined Check =============== */ @@ -50851,13 +49111,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.c linux-4.3-rtl8723 + return false; + + /* Bit Defined Check ================ */ -+ /* We don't care [31:28] and [23:20] */ -+ /* */ ++ /* We don't care [31:28] and [23:20] */ ++ /* */ + cond1 &= 0x000F0FFF; + driver1 &= 0x000F0FFF; + + if ((cond1 & driver1) == cond1) { + u32 bitMask = 0; ++ + if ((cond1 & 0x0F) == 0) /* BoardType is DONTCARE */ + return true; + @@ -50870,19 +49131,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.c linux-4.3-rtl8723 + if ((cond1 & BIT3) != 0) /* APA */ + bitMask |= 0xFF000000; + -+ if ((cond2 & bitMask) == (driver2 & bitMask)) /* BoardType of each RF path is matched */ ++ /* BoardType of each RF path is matched */ ++ if ((cond2 & bitMask) == (driver2 & bitMask)) + return true; + } + return false; +} -+static bool -+CheckNegative( -+ PDM_ODM_T pDM_Odm, -+ const u32 Condition1, -+ const u32 Condition2 -+ ) ++ ++static bool CheckNegative( ++ PDM_ODM_T pDM_Odm, const u32 Condition1, const u32 Condition2 ++) +{ -+ return true; ++ return true; +} + +/****************************************************************************** @@ -51024,72 +49284,72 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.c linux-4.3-rtl8723 + +}; + -+void -+ODM_ReadAndConfig_MP_8723B_AGC_TAB( -+ PDM_ODM_T pDM_Odm -+ ) ++void ODM_ReadAndConfig_MP_8723B_AGC_TAB(PDM_ODM_T pDM_Odm) +{ -+ u32 i = 0; -+ u32 ArrayLen = sizeof(Array_MP_8723B_AGC_TAB)/sizeof(u32); -+ u32 * Array = Array_MP_8723B_AGC_TAB; ++ u32 i = 0; ++ u32 ArrayLen = sizeof(Array_MP_8723B_AGC_TAB)/sizeof(u32); ++ u32 *Array = Array_MP_8723B_AGC_TAB; + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> ODM_ReadAndConfig_MP_8723B_AGC_TAB\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_LOUD, ++ ("===> ODM_ReadAndConfig_MP_8723B_AGC_TAB\n") ++ ); + -+ for (i = 0; i < ArrayLen; i += 2) -+ { -+ u32 v1 = Array[i]; -+ u32 v2 = Array[i+1]; ++ for (i = 0; i < ArrayLen; i += 2) { ++ u32 v1 = Array[i]; ++ u32 v2 = Array[i+1]; + -+ /* This (offset, data) pair doesn't care the condition. */ -+ if (v1 < 0x40000000) -+ { -+ odm_ConfigBB_AGC_8723B(pDM_Odm, v1, bMaskDWord, v2); -+ continue; -+ } -+ else -+ { /* This line is the beginning of branch. */ -+ bool bMatched = true; -+ u8 cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); ++ /* This (offset, data) pair doesn't care the condition. */ ++ if (v1 < 0x40000000) { ++ odm_ConfigBB_AGC_8723B(pDM_Odm, v1, bMaskDWord, v2); ++ continue; ++ } else { ++ /* This line is the beginning of branch. */ ++ bool bMatched = true; ++ u8 cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); + -+ if (cCond == COND_ELSE) { /* ELSE, ENDIF */ -+ bMatched = true; -+ READ_NEXT_PAIR(v1, v2, i); -+ } else if (! CheckPositive(pDM_Odm, v1, v2)) { -+ bMatched = false; -+ READ_NEXT_PAIR(v1, v2, i); -+ READ_NEXT_PAIR(v1, v2, i); -+ } else { -+ READ_NEXT_PAIR(v1, v2, i); -+ if (! CheckNegative(pDM_Odm, v1, v2)) -+ bMatched = false; -+ else -+ bMatched = true; -+ READ_NEXT_PAIR(v1, v2, i); -+ } ++ if (cCond == COND_ELSE) { /* ELSE, ENDIF */ ++ bMatched = true; ++ READ_NEXT_PAIR(v1, v2, i); ++ } else if (!CheckPositive(pDM_Odm, v1, v2)) { ++ bMatched = false; ++ READ_NEXT_PAIR(v1, v2, i); ++ READ_NEXT_PAIR(v1, v2, i); ++ } else { ++ READ_NEXT_PAIR(v1, v2, i); ++ if (!CheckNegative(pDM_Odm, v1, v2)) ++ bMatched = false; ++ else ++ bMatched = true; ++ READ_NEXT_PAIR(v1, v2, i); ++ } + -+ if (bMatched == false) -+ { /* Condition isn't matched. Discard the following (offset, data) pairs. */ -+ while (v1 < 0x40000000 && i < ArrayLen -2) -+ READ_NEXT_PAIR(v1, v2, i); ++ if (bMatched == false) { ++ /* Condition isn't matched. ++ * Discard the following (offset, data) pairs. ++ */ ++ while (v1 < 0x40000000 && i < ArrayLen-2) ++ READ_NEXT_PAIR(v1, v2, i); + -+ i -= 2; /* prevent from for-loop += 2 */ -+ } -+ else /* Configure matched pairs and skip to end of if-else. */ -+ { -+ while (v1 < 0x40000000 && i < ArrayLen-2) { -+ odm_ConfigBB_AGC_8723B(pDM_Odm, v1, bMaskDWord, v2); -+ READ_NEXT_PAIR(v1, v2, i); -+ } ++ i -= 2; /* prevent from for-loop += 2 */ ++ } else { ++ /* Configure matched pairs and skip to end of if-else. */ ++ while (v1 < 0x40000000 && i < ArrayLen-2) { ++ odm_ConfigBB_AGC_8723B(pDM_Odm, v1, bMaskDWord, v2); ++ READ_NEXT_PAIR(v1, v2, i); ++ } + -+ /* Keeps reading until ENDIF. */ -+ cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); -+ while (cCond != COND_ENDIF && i < ArrayLen-2) { -+ READ_NEXT_PAIR(v1, v2, i); -+ cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); -+ } -+ } -+ } -+ } ++ /* Keeps reading until ENDIF. */ ++ cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); ++ while (cCond != COND_ENDIF && i < ArrayLen-2) { ++ READ_NEXT_PAIR(v1, v2, i); ++ cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); ++ } ++ } ++ } ++ } +} + +/****************************************************************************** @@ -51293,72 +49553,71 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.c linux-4.3-rtl8723 + +}; + -+void -+ODM_ReadAndConfig_MP_8723B_PHY_REG( -+ PDM_ODM_T pDM_Odm -+ ) ++void ODM_ReadAndConfig_MP_8723B_PHY_REG(PDM_ODM_T pDM_Odm) +{ -+ u32 i = 0; -+ u32 ArrayLen = sizeof(Array_MP_8723B_PHY_REG)/sizeof(u32); -+ u32 * Array = Array_MP_8723B_PHY_REG; ++ u32 i = 0; ++ u32 ArrayLen = sizeof(Array_MP_8723B_PHY_REG)/sizeof(u32); ++ u32 *Array = Array_MP_8723B_PHY_REG; + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> ODM_ReadAndConfig_MP_8723B_PHY_REG\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_LOUD, ++ ("===> ODM_ReadAndConfig_MP_8723B_PHY_REG\n") ++ ); + -+ for (i = 0; i < ArrayLen; i += 2) -+ { -+ u32 v1 = Array[i]; -+ u32 v2 = Array[i+1]; ++ for (i = 0; i < ArrayLen; i += 2) { ++ u32 v1 = Array[i]; ++ u32 v2 = Array[i+1]; + -+ /* This (offset, data) pair doesn't care the condition. */ -+ if (v1 < 0x40000000) -+ { -+ odm_ConfigBB_PHY_8723B(pDM_Odm, v1, bMaskDWord, v2); -+ continue; -+ } -+ else -+ { /* This line is the beginning of branch. */ -+ bool bMatched = true; -+ u8 cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); ++ /* This (offset, data) pair doesn't care the condition. */ ++ if (v1 < 0x40000000) { ++ odm_ConfigBB_PHY_8723B(pDM_Odm, v1, bMaskDWord, v2); ++ continue; ++ } else { ++ /* This line is the beginning of branch. */ ++ bool bMatched = true; ++ u8 cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); + -+ if (cCond == COND_ELSE) { /* ELSE, ENDIF */ -+ bMatched = true; -+ READ_NEXT_PAIR(v1, v2, i); -+ } else if (! CheckPositive(pDM_Odm, v1, v2)) { -+ bMatched = false; -+ READ_NEXT_PAIR(v1, v2, i); -+ READ_NEXT_PAIR(v1, v2, i); -+ } else { -+ READ_NEXT_PAIR(v1, v2, i); -+ if (! CheckNegative(pDM_Odm, v1, v2)) -+ bMatched = false; -+ else -+ bMatched = true; -+ READ_NEXT_PAIR(v1, v2, i); -+ } ++ if (cCond == COND_ELSE) { /* ELSE, ENDIF */ ++ bMatched = true; ++ READ_NEXT_PAIR(v1, v2, i); ++ } else if (!CheckPositive(pDM_Odm, v1, v2)) { ++ bMatched = false; ++ READ_NEXT_PAIR(v1, v2, i); ++ READ_NEXT_PAIR(v1, v2, i); ++ } else { ++ READ_NEXT_PAIR(v1, v2, i); ++ if (!CheckNegative(pDM_Odm, v1, v2)) ++ bMatched = false; ++ else ++ bMatched = true; ++ READ_NEXT_PAIR(v1, v2, i); ++ } + -+ if (bMatched == false) -+ { /* Condition isn't matched. Discard the following (offset, data) pairs. */ -+ while (v1 < 0x40000000 && i < ArrayLen -2) -+ READ_NEXT_PAIR(v1, v2, i); ++ if (bMatched == false) { ++ /* Condition isn't matched. ++ * Discard the following (offset, data) pairs. ++ */ ++ while (v1 < 0x40000000 && i < ArrayLen-2) ++ READ_NEXT_PAIR(v1, v2, i); + -+ i -= 2; /* prevent from for-loop += 2 */ -+ } -+ else /* Configure matched pairs and skip to end of if-else. */ -+ { -+ while (v1 < 0x40000000 && i < ArrayLen-2) { -+ odm_ConfigBB_PHY_8723B(pDM_Odm, v1, bMaskDWord, v2); -+ READ_NEXT_PAIR(v1, v2, i); -+ } ++ i -= 2; /* prevent from for-loop += 2 */ ++ } else { /* Configure matched pairs and skip to end of if-else. */ ++ while (v1 < 0x40000000 && i < ArrayLen-2) { ++ odm_ConfigBB_PHY_8723B(pDM_Odm, v1, bMaskDWord, v2); ++ READ_NEXT_PAIR(v1, v2, i); ++ } + -+ /* Keeps reading until ENDIF. */ -+ cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); -+ while (cCond != COND_ENDIF && i < ArrayLen-2) { -+ READ_NEXT_PAIR(v1, v2, i); -+ cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); -+ } -+ } -+ } -+ } ++ /* Keeps reading until ENDIF. */ ++ cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); ++ while (cCond != COND_ENDIF && i < ArrayLen-2) { ++ READ_NEXT_PAIR(v1, v2, i); ++ cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); ++ } ++ } ++ } ++ } +} + +/****************************************************************************** @@ -51374,35 +49633,36 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.c linux-4.3-rtl8723 + 0, 0, 0, 0x00000e14, 0xffffffff, 0x26303436 +}; + -+void -+ODM_ReadAndConfig_MP_8723B_PHY_REG_PG( -+ PDM_ODM_T pDM_Odm -+ ) ++void ODM_ReadAndConfig_MP_8723B_PHY_REG_PG(PDM_ODM_T pDM_Odm) +{ -+ u32 i = 0; -+ u32 ArrayLen = sizeof(Array_MP_8723B_PHY_REG_PG)/sizeof(u32); -+ u32 * Array = Array_MP_8723B_PHY_REG_PG; ++ u32 i = 0; ++ u32 ArrayLen = sizeof(Array_MP_8723B_PHY_REG_PG)/sizeof(u32); ++ u32 *Array = Array_MP_8723B_PHY_REG_PG; + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> ODM_ReadAndConfig_MP_8723B_PHY_REG_PG\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_LOUD, ++ ("===> ODM_ReadAndConfig_MP_8723B_PHY_REG_PG\n") ++ ); + + pDM_Odm->PhyRegPgVersion = 1; + pDM_Odm->PhyRegPgValueType = PHY_REG_PG_EXACT_VALUE; + -+ for (i = 0; i < ArrayLen; i += 6) -+ { -+ u32 v1 = Array[i]; -+ u32 v2 = Array[i+1]; -+ u32 v3 = Array[i+2]; -+ u32 v4 = Array[i+3]; -+ u32 v5 = Array[i+4]; -+ u32 v6 = Array[i+5]; ++ for (i = 0; i < ArrayLen; i += 6) { ++ u32 v1 = Array[i]; ++ u32 v2 = Array[i+1]; ++ u32 v3 = Array[i+2]; ++ u32 v4 = Array[i+3]; ++ u32 v5 = Array[i+4]; ++ u32 v6 = Array[i+5]; + -+ odm_ConfigBB_PHY_REG_PG_8723B(pDM_Odm, v1, v2, v3, v4, v5, v6); ++ odm_ConfigBB_PHY_REG_PG_8723B(pDM_Odm, v1, v2, v3, v4, v5, v6); + } +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.h ---- linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.h linux/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.h +--- linux.old/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,48 @@ +/****************************************************************************** +* @@ -51452,10 +49712,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_BB.h linux-4.3-rtl8723 +u32 ODM_GetVersion_MP_8723B_PHY_REG_PG(void); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.c ---- linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,275 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.c linux/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.c +--- linux.old/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,302 @@ +/****************************************************************************** +* +* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -51474,40 +49734,72 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.c linux-4.3-rtl872 + +#include "odm_precomp.h" + -+static bool -+CheckPositive( -+ PDM_ODM_T pDM_Odm, -+ const u32 Condition1, -+ const u32 Condition2 -+ ) ++static bool CheckPositive( ++ PDM_ODM_T pDM_Odm, const u32 Condition1, const u32 Condition2 ++) +{ -+ u8 _BoardType = ((pDM_Odm->BoardType & BIT4) >> 4) << 0 | /* _GLNA */ -+ ((pDM_Odm->BoardType & BIT3) >> 3) << 1 | /* _GPA */ -+ ((pDM_Odm->BoardType & BIT7) >> 7) << 2 | /* _ALNA */ -+ ((pDM_Odm->BoardType & BIT6) >> 6) << 3 | /* _APA */ -+ ((pDM_Odm->BoardType & BIT2) >> 2) << 4; /* _BT */ ++ u8 _BoardType = ++ ((pDM_Odm->BoardType & BIT4) >> 4) << 0 | /* _GLNA */ ++ ((pDM_Odm->BoardType & BIT3) >> 3) << 1 | /* _GPA */ ++ ((pDM_Odm->BoardType & BIT7) >> 7) << 2 | /* _ALNA */ ++ ((pDM_Odm->BoardType & BIT6) >> 6) << 3 | /* _APA */ ++ ((pDM_Odm->BoardType & BIT2) >> 2) << 4; /* _BT */ + + u32 cond1 = Condition1, cond2 = Condition2; -+ u32 driver1 = pDM_Odm->CutVersion << 24 | -+ pDM_Odm->SupportPlatform << 16 | -+ pDM_Odm->PackageType << 12 | -+ pDM_Odm->SupportInterface << 8 | -+ _BoardType; ++ u32 driver1 = ++ pDM_Odm->CutVersion << 24 | ++ pDM_Odm->SupportPlatform << 16 | ++ pDM_Odm->PackageType << 12 | ++ pDM_Odm->SupportInterface << 8 | ++ _BoardType; + -+ u32 driver2 = pDM_Odm->TypeGLNA << 0 | -+ pDM_Odm->TypeGPA << 8 | -+ pDM_Odm->TypeALNA << 16 | -+ pDM_Odm->TypeAPA << 24; ++ u32 driver2 = ++ pDM_Odm->TypeGLNA << 0 | ++ pDM_Odm->TypeGPA << 8 | ++ pDM_Odm->TypeALNA << 16 | ++ pDM_Odm->TypeAPA << 24; + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, -+ ("===> [8812A] CheckPositive (cond1, cond2) = (0x%X 0x%X)\n", cond1, cond2)); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, -+ ("===> [8812A] CheckPositive (driver1, driver2) = (0x%X 0x%X)\n", driver1, driver2)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_TRACE, ++ ( ++ "===> [8812A] CheckPositive (cond1, cond2) = (0x%X 0x%X)\n", ++ cond1, ++ cond2 ++ ) ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_TRACE, ++ ( ++ "===> [8812A] CheckPositive (driver1, driver2) = (0x%X 0x%X)\n", ++ driver1, ++ driver2 ++ ) ++ ); + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, -+ (" (Platform, Interface) = (0x%X, 0x%X)\n", pDM_Odm->SupportPlatform, pDM_Odm->SupportInterface)); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, -+ (" (Board, Package) = (0x%X, 0x%X)\n", pDM_Odm->BoardType, pDM_Odm->PackageType)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_TRACE, ++ ( ++ " (Platform, Interface) = (0x%X, 0x%X)\n", ++ pDM_Odm->SupportPlatform, ++ pDM_Odm->SupportInterface ++ ) ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_TRACE, ++ ( ++ " (Board, Package) = (0x%X, 0x%X)\n", ++ pDM_Odm->BoardType, ++ pDM_Odm->PackageType ++ ) ++ ); + + + /* Value Defined Check =============== */ @@ -51519,8 +49811,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.c linux-4.3-rtl872 + return false; + + /* Bit Defined Check ================ */ -+ /* We don't care [31:28] and [23:20] */ -+ /* */ ++ /* We don't care [31:28] and [23:20] */ ++ /* */ + cond1 &= 0x000F0FFF; + driver1 &= 0x000F0FFF; + @@ -51543,14 +49835,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.c linux-4.3-rtl872 + } + return false; +} -+static bool -+CheckNegative( -+ PDM_ODM_T pDM_Odm, -+ const u32 Condition1, -+ const u32 Condition2 -+ ) ++ ++static bool CheckNegative( ++ PDM_ODM_T pDM_Odm, const u32 Condition1, const u32 Condition2 ++) +{ -+ return true; ++ return true; +} + +/****************************************************************************** @@ -51664,76 +49954,73 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.c linux-4.3-rtl872 + +}; + -+void -+ODM_ReadAndConfig_MP_8723B_MAC_REG( -+ PDM_ODM_T pDM_Odm -+ ) ++void ODM_ReadAndConfig_MP_8723B_MAC_REG(PDM_ODM_T pDM_Odm) +{ -+ u32 i = 0; -+ u32 ArrayLen = sizeof(Array_MP_8723B_MAC_REG)/sizeof(u32); -+ u32 * Array = Array_MP_8723B_MAC_REG; ++ u32 i = 0; ++ u32 ArrayLen = sizeof(Array_MP_8723B_MAC_REG)/sizeof(u32); ++ u32 *Array = Array_MP_8723B_MAC_REG; + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> ODM_ReadAndConfig_MP_8723B_MAC_REG\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_LOUD, ++ ("===> ODM_ReadAndConfig_MP_8723B_MAC_REG\n") ++ ); + -+ for (i = 0; i < ArrayLen; i += 2) -+ { -+ u32 v1 = Array[i]; -+ u32 v2 = Array[i+1]; ++ for (i = 0; i < ArrayLen; i += 2) { ++ u32 v1 = Array[i]; ++ u32 v2 = Array[i+1]; + -+ /* This (offset, data) pair doesn't care the condition. */ -+ if (v1 < 0x40000000) -+ { -+ odm_ConfigMAC_8723B(pDM_Odm, v1, (u8)v2); -+ continue; -+ } -+ else -+ { /* This line is the beginning of branch. */ -+ bool bMatched = true; -+ u8 cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); ++ /* This (offset, data) pair doesn't care the condition. */ ++ if (v1 < 0x40000000) { ++ odm_ConfigMAC_8723B(pDM_Odm, v1, (u8)v2); ++ continue; ++ } else { ++ /* This line is the beginning of branch. */ ++ bool bMatched = true; ++ u8 cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); + -+ if (cCond == COND_ELSE) { /* ELSE, ENDIF */ -+ bMatched = true; -+ READ_NEXT_PAIR(v1, v2, i); -+ } else if (! CheckPositive(pDM_Odm, v1, v2)) { -+ bMatched = false; -+ READ_NEXT_PAIR(v1, v2, i); -+ READ_NEXT_PAIR(v1, v2, i); -+ } else { -+ READ_NEXT_PAIR(v1, v2, i); -+ if (! CheckNegative(pDM_Odm, v1, v2)) -+ bMatched = false; -+ else -+ bMatched = true; -+ READ_NEXT_PAIR(v1, v2, i); -+ } ++ if (cCond == COND_ELSE) { /* ELSE, ENDIF */ ++ bMatched = true; ++ READ_NEXT_PAIR(v1, v2, i); ++ } else if (!CheckPositive(pDM_Odm, v1, v2)) { ++ bMatched = false; ++ READ_NEXT_PAIR(v1, v2, i); ++ READ_NEXT_PAIR(v1, v2, i); ++ } else { ++ READ_NEXT_PAIR(v1, v2, i); ++ if (!CheckNegative(pDM_Odm, v1, v2)) ++ bMatched = false; ++ else ++ bMatched = true; ++ READ_NEXT_PAIR(v1, v2, i); ++ } + -+ if (bMatched == false) -+ { /* Condition isn't matched. Discard the following (offset, data) pairs. */ -+ while (v1 < 0x40000000 && i < ArrayLen -2) -+ READ_NEXT_PAIR(v1, v2, i); ++ if (bMatched == false) { ++ /* Condition isn't matched. Discard the following (offset, data) pairs. */ ++ while (v1 < 0x40000000 && i < ArrayLen-2) ++ READ_NEXT_PAIR(v1, v2, i); + -+ i -= 2; /* prevent from for-loop += 2 */ -+ } -+ else /* Configure matched pairs and skip to end of if-else. */ -+ { -+ while (v1 < 0x40000000 && i < ArrayLen-2) { -+ odm_ConfigMAC_8723B(pDM_Odm, v1, (u8)v2); -+ READ_NEXT_PAIR(v1, v2, i); -+ } ++ i -= 2; /* prevent from for-loop += 2 */ ++ } else { /* Configure matched pairs and skip to end of if-else. */ ++ while (v1 < 0x40000000 && i < ArrayLen-2) { ++ odm_ConfigMAC_8723B(pDM_Odm, v1, (u8)v2); ++ READ_NEXT_PAIR(v1, v2, i); ++ } + -+ /* Keeps reading until ENDIF. */ -+ cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); -+ while (cCond != COND_ENDIF && i < ArrayLen-2) { -+ READ_NEXT_PAIR(v1, v2, i); -+ cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); -+ } -+ } -+ } -+ } ++ /* Keeps reading until ENDIF. */ ++ cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); ++ while (cCond != COND_ENDIF && i < ArrayLen-2) { ++ READ_NEXT_PAIR(v1, v2, i); ++ cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); ++ } ++ } ++ } ++ } +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.h ---- linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.h linux/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.h +--- linux.old/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,28 @@ +/****************************************************************************** +* @@ -51763,10 +50050,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_MAC.h linux-4.3-rtl872 + PDM_ODM_T pDM_Odm +); +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.c ---- linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,638 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.c linux/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.c +--- linux.old/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,799 @@ +/****************************************************************************** +* +* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -51785,47 +50072,86 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.c linux-4.3-rtl8723 + +#include "odm_precomp.h" + -+static bool -+CheckPositive( -+ PDM_ODM_T pDM_Odm, -+ const u32 Condition1, -+ const u32 Condition2 -+ ) ++static bool CheckPositive( ++ PDM_ODM_T pDM_Odm, const u32 Condition1, const u32 Condition2 ++) +{ -+ u8 _BoardType = ((pDM_Odm->BoardType & BIT4) >> 4) << 0 | /* _GLNA */ -+ ((pDM_Odm->BoardType & BIT3) >> 3) << 1 | /* _GPA */ -+ ((pDM_Odm->BoardType & BIT7) >> 7) << 2 | /* _ALNA */ -+ ((pDM_Odm->BoardType & BIT6) >> 6) << 3 | /* _APA */ -+ ((pDM_Odm->BoardType & BIT2) >> 2) << 4; /* _BT */ ++ u8 _BoardType = ++ ((pDM_Odm->BoardType & BIT4) >> 4) << 0 | /* _GLNA */ ++ ((pDM_Odm->BoardType & BIT3) >> 3) << 1 | /* _GPA */ ++ ((pDM_Odm->BoardType & BIT7) >> 7) << 2 | /* _ALNA */ ++ ((pDM_Odm->BoardType & BIT6) >> 6) << 3 | /* _APA */ ++ ((pDM_Odm->BoardType & BIT2) >> 2) << 4; /* _BT */ + -+ u32 cond1 = Condition1, cond2 = Condition2; -+ u32 driver1 = pDM_Odm->CutVersion << 24 | -+ pDM_Odm->SupportPlatform << 16 | -+ pDM_Odm->PackageType << 12 | -+ pDM_Odm->SupportInterface << 8 | -+ _BoardType; ++ u32 cond1 = Condition1, cond2 = Condition2; ++ u32 driver1 = ++ pDM_Odm->CutVersion << 24 | ++ pDM_Odm->SupportPlatform << 16 | ++ pDM_Odm->PackageType << 12 | ++ pDM_Odm->SupportInterface << 8 | ++ _BoardType; + -+ u32 driver2 = pDM_Odm->TypeGLNA << 0 | -+ pDM_Odm->TypeGPA << 8 | -+ pDM_Odm->TypeALNA << 16 | -+ pDM_Odm->TypeAPA << 24; ++ u32 driver2 = ++ pDM_Odm->TypeGLNA << 0 | ++ pDM_Odm->TypeGPA << 8 | ++ pDM_Odm->TypeALNA << 16 | ++ pDM_Odm->TypeAPA << 24; + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, -+ ("===> [8812A] CheckPositive (cond1, cond2) = (0x%X 0x%X)\n", cond1, cond2)); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, -+ ("===> [8812A] CheckPositive (driver1, driver2) = (0x%X 0x%X)\n", driver1, driver2)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_TRACE, ++ ( ++ "===> [8812A] CheckPositive (cond1, cond2) = (0x%X 0x%X)\n", ++ cond1, ++ cond2 ++ ) ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_TRACE, ++ ( ++ "===> [8812A] CheckPositive (driver1, driver2) = (0x%X 0x%X)\n", ++ driver1, ++ driver2 ++ ) ++ ); + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, -+ (" (Platform, Interface) = (0x%X, 0x%X)\n", pDM_Odm->SupportPlatform, pDM_Odm->SupportInterface)); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, -+ (" (Board, Package) = (0x%X, 0x%X)\n", pDM_Odm->BoardType, pDM_Odm->PackageType)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_TRACE, ++ ( ++ " (Platform, Interface) = (0x%X, 0x%X)\n", ++ pDM_Odm->SupportPlatform, ++ pDM_Odm->SupportInterface ++ ) ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_TRACE, ++ ( ++ " (Board, Package) = (0x%X, 0x%X)\n", ++ pDM_Odm->BoardType, ++ pDM_Odm->PackageType ++ ) ++ ); + + /* Value Defined Check =============== */ + /* QFN Type [15:12] and Cut Version [27:24] need to do value check */ + -+ if (((cond1 & 0x0000F000) != 0) && ((cond1 & 0x0000F000) != (driver1 & 0x0000F000))) ++ if ( ++ ((cond1 & 0x0000F000) != 0) && ++ ((cond1 & 0x0000F000) != (driver1 & 0x0000F000)) ++ ) + return false; -+ if (((cond1 & 0x0F000000) != 0) && ((cond1 & 0x0F000000) != (driver1 & 0x0F000000))) ++ ++ if ( ++ ((cond1 & 0x0F000000) != 0) && ++ ((cond1 & 0x0F000000) != (driver1 & 0x0F000000)) ++ ) + return false; + + /* Bit Defined Check ================ */ @@ -51835,6 +50161,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.c linux-4.3-rtl8723 + + if ((cond1 & driver1) == cond1) { + u32 bitMask = 0; ++ + if ((cond1 & 0x0F) == 0) /* BoardType is DONTCARE */ + return true; + @@ -51847,21 +50174,21 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.c linux-4.3-rtl8723 + if ((cond1 & BIT3) != 0) /* APA */ + bitMask |= 0xFF000000; + -+ if ((cond2 & bitMask) == (driver2 & bitMask)) /* BoardType of each RF path is matched */ ++ /* BoardType of each RF path is matched */ ++ if ((cond2 & bitMask) == (driver2 & bitMask)) + return true; ++ + return false; + } -+ return false; ++ ++ return false; +} + -+static bool -+CheckNegative( -+ PDM_ODM_T pDM_Odm, -+ const u32 Condition1, -+ const u32 Condition2 -+ ) ++static bool CheckNegative( ++ PDM_ODM_T pDM_Odm, const u32 Condition1, const u32 Condition2 ++) +{ -+ return true; ++ return true; +} + +/****************************************************************************** @@ -51996,72 +50323,72 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.c linux-4.3-rtl8723 + +}; + -+void -+ODM_ReadAndConfig_MP_8723B_RadioA( -+ PDM_ODM_T pDM_Odm -+ ) ++void ODM_ReadAndConfig_MP_8723B_RadioA(PDM_ODM_T pDM_Odm) +{ -+ u32 i = 0; -+ u32 ArrayLen = sizeof(Array_MP_8723B_RadioA)/sizeof(u32); -+ u32 * Array = Array_MP_8723B_RadioA; ++ u32 i = 0; ++ u32 ArrayLen = sizeof(Array_MP_8723B_RadioA)/sizeof(u32); ++ u32 *Array = Array_MP_8723B_RadioA; + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> ODM_ReadAndConfig_MP_8723B_RadioA\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_LOUD, ++ ("===> ODM_ReadAndConfig_MP_8723B_RadioA\n") ++ ); + -+ for (i = 0; i < ArrayLen; i += 2) -+ { -+ u32 v1 = Array[i]; -+ u32 v2 = Array[i+1]; ++ for (i = 0; i < ArrayLen; i += 2) { ++ u32 v1 = Array[i]; ++ u32 v2 = Array[i+1]; + -+ /* This (offset, data) pair doesn't care the condition. */ -+ if (v1 < 0x40000000) -+ { -+ odm_ConfigRF_RadioA_8723B(pDM_Odm, v1, v2); -+ continue; -+ } -+ else -+ { /* This line is the beginning of branch. */ -+ bool bMatched = true; -+ u8 cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); ++ /* This (offset, data) pair doesn't care the condition. */ ++ if (v1 < 0x40000000) { ++ odm_ConfigRF_RadioA_8723B(pDM_Odm, v1, v2); ++ continue; ++ } else { ++ /* This line is the beginning of branch. */ ++ bool bMatched = true; ++ u8 cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); + -+ if (cCond == COND_ELSE) { /* ELSE, ENDIF */ -+ bMatched = true; -+ READ_NEXT_PAIR(v1, v2, i); -+ } else if (! CheckPositive(pDM_Odm, v1, v2)) { -+ bMatched = false; -+ READ_NEXT_PAIR(v1, v2, i); -+ READ_NEXT_PAIR(v1, v2, i); -+ } else { -+ READ_NEXT_PAIR(v1, v2, i); -+ if (! CheckNegative(pDM_Odm, v1, v2)) -+ bMatched = false; -+ else -+ bMatched = true; -+ READ_NEXT_PAIR(v1, v2, i); -+ } ++ if (cCond == COND_ELSE) { /* ELSE, ENDIF */ ++ bMatched = true; ++ READ_NEXT_PAIR(v1, v2, i); ++ } else if (!CheckPositive(pDM_Odm, v1, v2)) { ++ bMatched = false; ++ READ_NEXT_PAIR(v1, v2, i); ++ READ_NEXT_PAIR(v1, v2, i); ++ } else { ++ READ_NEXT_PAIR(v1, v2, i); ++ if (!CheckNegative(pDM_Odm, v1, v2)) ++ bMatched = false; ++ else ++ bMatched = true; ++ READ_NEXT_PAIR(v1, v2, i); ++ } + -+ if (bMatched == false) -+ { /* Condition isn't matched. Discard the following (offset, data) pairs. */ -+ while (v1 < 0x40000000 && i < ArrayLen -2) -+ READ_NEXT_PAIR(v1, v2, i); ++ if (bMatched == false) { ++ /* Condition isn't matched. ++ * Discard the following (offset, data) pairs. ++ */ ++ while (v1 < 0x40000000 && i < ArrayLen-2) ++ READ_NEXT_PAIR(v1, v2, i); + -+ i -= 2; /* prevent from for-loop += 2 */ -+ } -+ else /* Configure matched pairs and skip to end of if-else. */ -+ { -+ while (v1 < 0x40000000 && i < ArrayLen-2) { -+ odm_ConfigRF_RadioA_8723B(pDM_Odm, v1, v2); -+ READ_NEXT_PAIR(v1, v2, i); -+ } ++ i -= 2; /* prevent from for-loop += 2 */ ++ } else { ++ /* Configure matched pairs and skip to end of if-else. */ ++ while (v1 < 0x40000000 && i < ArrayLen-2) { ++ odm_ConfigRF_RadioA_8723B(pDM_Odm, v1, v2); ++ READ_NEXT_PAIR(v1, v2, i); ++ } + -+ /* Keeps reading until ENDIF. */ -+ cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); -+ while (cCond != COND_ENDIF && i < ArrayLen-2) { -+ READ_NEXT_PAIR(v1, v2, i); -+ cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); -+ } -+ } -+ } -+ } ++ /* Keeps reading until ENDIF. */ ++ cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); ++ while (cCond != COND_ENDIF && i < ArrayLen-2) { ++ READ_NEXT_PAIR(v1, v2, i); ++ cCond = (u8)((v1 & (BIT29|BIT28)) >> 28); ++ } ++ } ++ } ++ } +} + +/****************************************************************************** @@ -52069,65 +50396,175 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.c linux-4.3-rtl8723 +******************************************************************************/ + +static u8 gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_SDIO_8723B[][DELTA_SWINGIDX_SIZE] = { -+ {0, 1, 1, 2, 2, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 11, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14}, -+ {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14}, -+ {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14}, ++ { ++ 0, 1, 1, 2, 2, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, ++ 9, 10, 11, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14 ++ }, ++ { ++ 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, ++ 10, 11, 11, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14 ++ }, ++ { ++ 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, ++ 10, 11, 11, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14 ++ }, +}; +static u8 gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_SDIO_8723B[][DELTA_SWINGIDX_SIZE] = { -+ {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 16, 17, 17, 18, 19, 20, 20, 20}, -+ {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 19, 20, 20, 20}, -+ {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 20, 21, 21, 21}, ++ { ++ 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, ++ 12, 13, 14, 15, 15, 16, 16, 17, 17, 18, 19, 20, 20, 20 ++ }, ++ { ++ 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, ++ 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 19, 20, 20, 20 ++ }, ++ { ++ 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, ++ 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 20, 21, 21, 21 ++ }, +}; +static u8 gDeltaSwingTableIdx_MP_5GA_N_TxPowerTrack_SDIO_8723B[][DELTA_SWINGIDX_SIZE] = { -+ {0, 1, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14}, -+ {0, 1, 2, 3, 3, 4, 5, 6, 6, 6, 7, 7, 8, 8, 9, 10, 11, 11, 12, 13, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16}, -+ {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 10, 11, 11, 12, 13, 14, 14, 15, 15, 16, 16, 16, 16, 16, 16, 16}, ++ { ++ 0, 1, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 8, 9, 9, 10, ++ 10, 11, 11, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14 ++ }, ++ { ++ 0, 1, 2, 3, 3, 4, 5, 6, 6, 6, 7, 7, 8, 8, 9, 10, ++ 11, 11, 12, 13, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16 ++ }, ++ { ++ 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 10, 11, ++ 11, 12, 13, 14, 14, 15, 15, 16, 16, 16, 16, 16, 16, 16 ++ }, +}; +static u8 gDeltaSwingTableIdx_MP_5GA_P_TxPowerTrack_SDIO_8723B[][DELTA_SWINGIDX_SIZE] = { -+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, -+ {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 20, 21, 21, 21}, -+ {0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 20, 21, 21, 21}, ++ { ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ++ }, ++ { ++ 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, ++ 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 20, 21, 21, 21 ++ }, ++ { ++ 0, 1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 9, 9, 10, 11, 12, ++ 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 20, 21, 21, 21 ++ }, ++}; ++static u8 gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_SDIO_8723B[] = { ++ 0, 0, 1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6, 6, 6, 6, ++ 7, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12, 13, 14, 15 ++}; ++static u8 gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_SDIO_8723B[] = { ++ 0, 0, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, ++ 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 13, 14, 15, 15 ++}; ++static u8 gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_SDIO_8723B[] = { ++ 0, 0, 1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6, 6, 6, 6, ++ 7, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12, 13, 14, 15 ++}; ++static u8 gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_SDIO_8723B[] = { ++ 0, 0, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, ++ 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 13, 14, 15, 15 ++}; ++static u8 gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_SDIO_8723B[] = { ++ 0, 0, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 7, 8, ++ 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15 ++}; ++static u8 gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_SDIO_8723B[] = { ++ 0, 0, 1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6, 6, 7, 7, ++ 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15 ++}; ++static u8 gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_SDIO_8723B[] = { ++ 0, 0, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 7, 8, ++ 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15 ++}; ++static u8 gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_SDIO_8723B[] = { ++ 0, 0, 1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6, 6, 7, 7, ++ 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15 +}; -+static u8 gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_SDIO_8723B[] = {0, 0, 1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12, 13, 14, 15}; -+static u8 gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_SDIO_8723B[] = {0, 0, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 13, 14, 15, 15}; -+static u8 gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_SDIO_8723B[] = {0, 0, 1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12, 13, 14, 15}; -+static u8 gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_SDIO_8723B[] = {0, 0, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 13, 14, 15, 15}; -+static u8 gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_SDIO_8723B[] = {0, 0, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; -+static u8 gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_SDIO_8723B[] = {0, 0, 1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; -+static u8 gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_SDIO_8723B[] = {0, 0, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; -+static u8 gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_SDIO_8723B[] = {0, 0, 1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15}; + -+void -+ODM_ReadAndConfig_MP_8723B_TxPowerTrack_SDIO( -+ PDM_ODM_T pDM_Odm -+ ) ++void ODM_ReadAndConfig_MP_8723B_TxPowerTrack_SDIO(PDM_ODM_T pDM_Odm) +{ -+ PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); ++ PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> ODM_ReadAndConfig_MP_MP_8723B\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_LOUD, ++ ("===> ODM_ReadAndConfig_MP_MP_8723B\n") ++ ); + + -+ memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_2GA_P, gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_SDIO_8723B, DELTA_SWINGIDX_SIZE); -+ memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_2GA_N, gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_SDIO_8723B, DELTA_SWINGIDX_SIZE); -+ memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_2GB_P, gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_SDIO_8723B, DELTA_SWINGIDX_SIZE); -+ memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_2GB_N, gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_SDIO_8723B, DELTA_SWINGIDX_SIZE); ++ memcpy( ++ pRFCalibrateInfo->DeltaSwingTableIdx_2GA_P, ++ gDeltaSwingTableIdx_MP_2GA_P_TxPowerTrack_SDIO_8723B, ++ DELTA_SWINGIDX_SIZE ++ ); ++ memcpy( ++ pRFCalibrateInfo->DeltaSwingTableIdx_2GA_N, ++ gDeltaSwingTableIdx_MP_2GA_N_TxPowerTrack_SDIO_8723B, ++ DELTA_SWINGIDX_SIZE ++ ); ++ memcpy( ++ pRFCalibrateInfo->DeltaSwingTableIdx_2GB_P, ++ gDeltaSwingTableIdx_MP_2GB_P_TxPowerTrack_SDIO_8723B, ++ DELTA_SWINGIDX_SIZE ++ ); ++ memcpy( ++ pRFCalibrateInfo->DeltaSwingTableIdx_2GB_N, ++ gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_SDIO_8723B, ++ DELTA_SWINGIDX_SIZE ++ ); + -+ memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_P, gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_SDIO_8723B, DELTA_SWINGIDX_SIZE); -+ memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_N, gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_SDIO_8723B, DELTA_SWINGIDX_SIZE); -+ memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_P, gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_SDIO_8723B, DELTA_SWINGIDX_SIZE); -+ memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_N, gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_SDIO_8723B, DELTA_SWINGIDX_SIZE); ++ memcpy( ++ pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_P, ++ gDeltaSwingTableIdx_MP_2GCCKA_P_TxPowerTrack_SDIO_8723B, ++ DELTA_SWINGIDX_SIZE ++ ); ++ memcpy( ++ pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKA_N, ++ gDeltaSwingTableIdx_MP_2GCCKA_N_TxPowerTrack_SDIO_8723B, ++ DELTA_SWINGIDX_SIZE ++ ); ++ memcpy( ++ pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_P, ++ gDeltaSwingTableIdx_MP_2GCCKB_P_TxPowerTrack_SDIO_8723B, ++ DELTA_SWINGIDX_SIZE ++ ); ++ memcpy( ++ pRFCalibrateInfo->DeltaSwingTableIdx_2GCCKB_N, ++ gDeltaSwingTableIdx_MP_2GCCKB_N_TxPowerTrack_SDIO_8723B, ++ DELTA_SWINGIDX_SIZE ++ ); + -+ memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_5GA_P, gDeltaSwingTableIdx_MP_5GA_P_TxPowerTrack_SDIO_8723B, DELTA_SWINGIDX_SIZE*3); -+ memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_5GA_N, gDeltaSwingTableIdx_MP_5GA_N_TxPowerTrack_SDIO_8723B, DELTA_SWINGIDX_SIZE*3); -+ memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_5GB_P, gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_SDIO_8723B, DELTA_SWINGIDX_SIZE*3); -+ memcpy(pRFCalibrateInfo->DeltaSwingTableIdx_5GB_N, gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_SDIO_8723B, DELTA_SWINGIDX_SIZE*3); ++ memcpy( ++ pRFCalibrateInfo->DeltaSwingTableIdx_5GA_P, ++ gDeltaSwingTableIdx_MP_5GA_P_TxPowerTrack_SDIO_8723B, ++ DELTA_SWINGIDX_SIZE*3 ++ ); ++ memcpy( ++ pRFCalibrateInfo->DeltaSwingTableIdx_5GA_N, ++ gDeltaSwingTableIdx_MP_5GA_N_TxPowerTrack_SDIO_8723B, ++ DELTA_SWINGIDX_SIZE*3 ++ ); ++ memcpy( ++ pRFCalibrateInfo->DeltaSwingTableIdx_5GB_P, ++ gDeltaSwingTableIdx_MP_5GB_P_TxPowerTrack_SDIO_8723B, ++ DELTA_SWINGIDX_SIZE*3 ++ ); ++ memcpy( ++ pRFCalibrateInfo->DeltaSwingTableIdx_5GB_N, ++ gDeltaSwingTableIdx_MP_5GB_N_TxPowerTrack_SDIO_8723B, ++ DELTA_SWINGIDX_SIZE*3 ++ ); +} + +/****************************************************************************** +* TXPWR_LMT.TXT +******************************************************************************/ + -+static u8 * Array_MP_8723B_TXPWR_LMT[] = { ++static u8 *Array_MP_8723B_TXPWR_LMT[] = { + "FCC", "2.4G", "20M", "CCK", "1T", "01", "32", + "ETSI", "2.4G", "20M", "CCK", "1T", "01", "32", + "MKK", "2.4G", "20M", "CCK", "1T", "01", "32", @@ -52382,32 +50819,43 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.c linux-4.3-rtl8723 + "MKK", "2.4G", "40M", "HT", "2T", "14", "63" +}; + -+void -+ODM_ReadAndConfig_MP_8723B_TXPWR_LMT( -+ PDM_ODM_T pDM_Odm -+ ) ++void ODM_ReadAndConfig_MP_8723B_TXPWR_LMT(PDM_ODM_T pDM_Odm) +{ -+ u32 i = 0; -+ u32 ArrayLen = sizeof(Array_MP_8723B_TXPWR_LMT)/sizeof(u8 *); -+ u8 * *Array = Array_MP_8723B_TXPWR_LMT; ++ u32 i = 0; ++ u32 ArrayLen = sizeof(Array_MP_8723B_TXPWR_LMT)/sizeof(u8 *); ++ u8 **Array = Array_MP_8723B_TXPWR_LMT; + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> ODM_ReadAndConfig_MP_8723B_TXPWR_LMT\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_LOUD, ++ ("===> ODM_ReadAndConfig_MP_8723B_TXPWR_LMT\n") ++ ); + + for (i = 0; i < ArrayLen; i += 7) { -+ u8 * regulation = Array[i]; -+ u8 * band = Array[i+1]; -+ u8 * bandwidth = Array[i+2]; -+ u8 * rate = Array[i+3]; -+ u8 * rfPath = Array[i+4]; -+ u8 * chnl = Array[i+5]; -+ u8 * val = Array[i+6]; ++ u8 *regulation = Array[i]; ++ u8 *band = Array[i+1]; ++ u8 *bandwidth = Array[i+2]; ++ u8 *rate = Array[i+3]; ++ u8 *rfPath = Array[i+4]; ++ u8 *chnl = Array[i+5]; ++ u8 *val = Array[i+6]; + -+ odm_ConfigBB_TXPWR_LMT_8723B(pDM_Odm, regulation, band, bandwidth, rate, rfPath, chnl, val); ++ odm_ConfigBB_TXPWR_LMT_8723B( ++ pDM_Odm, ++ regulation, ++ band, ++ bandwidth, ++ rate, ++ rfPath, ++ chnl, ++ val ++ ); + } +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.h ---- linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.h linux/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.h +--- linux.old/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,49 @@ +/****************************************************************************** +* @@ -52458,10 +50906,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalHWImg8723B_RF.h linux-4.3-rtl8723 +u32 ODM_GetVersion_MP_8723B_TXPWR_LMT(void); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_intf.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/hal_intf.c ---- linux-4.3/3rdparty/rtl8723bs/hal/hal_intf.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/hal_intf.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,478 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/hal_intf.c linux/3rdparty/rtl8723bs/hal/hal_intf.c +--- linux.old/3rdparty/rtl8723bs/hal/hal_intf.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/hal_intf.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,474 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. @@ -52507,6 +50955,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_intf.c linux-4.3-rtl8723bs/3rdpa + if (padapter->HalFunc.init_default_value) + padapter->HalFunc.init_default_value(padapter); +} ++ +void rtw_hal_free_data(struct adapter *padapter) +{ + /* free HAL Data */ @@ -52516,12 +50965,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_intf.c linux-4.3-rtl8723bs/3rdpa + if (padapter->HalFunc.free_hal_data) + padapter->HalFunc.free_hal_data(padapter); +} ++ +void rtw_hal_dm_init(struct adapter *padapter) +{ + if (is_primary_adapter(padapter)) + if (padapter->HalFunc.dm_init) + padapter->HalFunc.dm_init(padapter); +} ++ +void rtw_hal_dm_deinit(struct adapter *padapter) +{ + /* cancel dm timer */ @@ -52550,9 +51001,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_intf.c linux-4.3-rtl8723bs/3rdpa + rtw_setopmode_cmd(padapter, networkType, false); +} + -+uint rtw_hal_init(struct adapter *padapter) ++uint rtw_hal_init(struct adapter *padapter) +{ -+ uint status; ++ uint status; + struct dvobj_priv *dvobj = adapter_to_dvobj(padapter); + + status = padapter->HalFunc.hal_init(padapter); @@ -52623,6 +51074,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_intf.c linux-4.3-rtl8723bs/3rdpa + return padapter->HalFunc.SetHalDefVarHandler(padapter, eVariable, pValue); + return _FAIL; +} ++ +u8 rtw_hal_get_def_var(struct adapter *padapter, enum HAL_DEF_VARIABLE eVariable, void *pValue) +{ + if (padapter->HalFunc.GetHalDefVarHandler) @@ -52635,6 +51087,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_intf.c linux-4.3-rtl8723bs/3rdpa + if (padapter->HalFunc.SetHalODMVarHandler) + padapter->HalFunc.SetHalODMVarHandler(padapter, eVariable, pValue1, bSet); +} ++ +void rtw_hal_get_odm_var(struct adapter *padapter, enum HAL_ODM_VARIABLE eVariable, void *pValue1, void *pValue2) +{ + if (padapter->HalFunc.GetHalODMVarHandler) @@ -52649,6 +51102,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_intf.c linux-4.3-rtl8723bs/3rdpa + DBG_871X("%s: HalFunc.enable_interrupt is NULL!\n", __func__); + +} ++ +void rtw_hal_disable_interrupt(struct adapter *padapter) +{ + if (padapter->HalFunc.disable_interrupt) @@ -52696,15 +51150,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_intf.c linux-4.3-rtl8723bs/3rdpa + /* pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; */ + /* memcpy(pmgntframe->attrib.ra, pwlanhdr->addr1, ETH_ALEN); */ + -+ if (padapter->securitypriv.binstallBIPkey == true) -+ { -+ if (IS_MCAST(pmgntframe->attrib.ra)) -+ { ++ if (padapter->securitypriv.binstallBIPkey == true) { ++ if (IS_MCAST(pmgntframe->attrib.ra)) { + pmgntframe->attrib.encrypt = _BIP_; + /* pmgntframe->attrib.bswenc = true; */ -+ } -+ else -+ { ++ } else { + pmgntframe->attrib.encrypt = _AES_; + pmgntframe->attrib.bswenc = true; + } @@ -52722,6 +51172,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_intf.c linux-4.3-rtl8723bs/3rdpa + return padapter->HalFunc.init_xmit_priv(padapter); + return _FAIL; +} ++ +void rtw_hal_free_xmit_priv(struct adapter *padapter) +{ + if (padapter->HalFunc.free_xmit_priv != NULL) @@ -52735,6 +51186,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_intf.c linux-4.3-rtl8723bs/3rdpa + + return _FAIL; +} ++ +void rtw_hal_free_recv_priv(struct adapter *padapter) +{ + @@ -52755,11 +51207,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_intf.c linux-4.3-rtl8723bs/3rdpa + pmlmepriv = &(padapter->mlmepriv); + + if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true) -+ { + add_RATid(padapter, psta, rssi_level); -+ } -+ else -+ { ++ else { + if (padapter->HalFunc.UpdateRAMaskHandler) + padapter->HalFunc.UpdateRAMaskHandler(padapter, psta->mac_id, rssi_level); + } @@ -52834,12 +51283,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_intf.c linux-4.3-rtl8723bs/3rdpa + +void rtw_hal_dm_watchdog_in_lps(struct adapter *padapter) +{ -+ if (adapter_to_pwrctl(padapter)->bFwCurrentInPSMode ==true) -+ { ++ if (adapter_to_pwrctl(padapter)->bFwCurrentInPSMode == true) { + if (padapter->HalFunc.hal_dm_watchdog_in_lps) -+ { -+ padapter->HalFunc.hal_dm_watchdog_in_lps(padapter);/* this fuction caller is in interrupt context */ -+ } ++ padapter->HalFunc.hal_dm_watchdog_in_lps(padapter); /* this fuction caller is in interrupt context */ + } +} + @@ -52863,7 +51309,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_intf.c linux-4.3-rtl8723bs/3rdpa + adapter->HalFunc.hal_notch_filter(adapter, enable); +} + -+void rtw_hal_reset_security_engine(struct adapter * adapter) ++void rtw_hal_reset_security_engine(struct adapter *adapter) +{ + if (adapter->HalFunc.hal_reset_security_engine) + adapter->HalFunc.hal_reset_security_engine(adapter); @@ -52871,7 +51317,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_intf.c linux-4.3-rtl8723bs/3rdpa + +bool rtw_hal_c2h_valid(struct adapter *adapter, u8 *buf) +{ -+ return c2h_evt_valid((struct c2h_evt_hdr_88xx*)buf); ++ return c2h_evt_valid((struct c2h_evt_hdr_88xx *)buf); +} + +s32 rtw_hal_c2h_evt_read(struct adapter *adapter, u8 *buf) @@ -52934,16 +51380,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_intf.c linux-4.3-rtl8723bs/3rdpa + if (padapter->HalFunc.fill_h2c_cmd) + ret = padapter->HalFunc.fill_h2c_cmd(padapter, ElementID, CmdLen, pCmdBuffer); + else -+ { + DBG_871X("%s: func[fill_h2c_cmd] not defined!\n", __func__); -+ } + + return ret; +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_phy.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/hal_phy.c ---- linux-4.3/3rdparty/rtl8723bs/hal/hal_phy.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/hal_phy.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,272 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/hal_phy.c linux/3rdparty/rtl8723bs/hal/hal_phy.c +--- linux.old/3rdparty/rtl8723bs/hal/hal_phy.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/hal_phy.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,224 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -52973,20 +51417,16 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_phy.c linux-4.3-rtl8723bs/3rdpar +* Output: none +* Return: u32 Return the shift bit bit position of the mask +*/ -+u32 -+PHY_CalculateBitShift( -+ u32 BitMask -+ ) ++u32 PHY_CalculateBitShift(u32 BitMask) +{ + u32 i; + -+ for(i=0; i<=31; i++) -+ { -+ if (((BitMask>>i) & 0x1 ) == 1) ++ for (i = 0; i <= 31; i++) { ++ if (((BitMask>>i) & 0x1) == 1) + break; + } + -+ return (i); ++ return i; +} + + @@ -53018,23 +51458,16 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_phy.c linux-4.3-rtl8723bs/3rdpar + * 11/20/2008 MHC Create Version 0. + * + *---------------------------------------------------------------------------*/ -+u32 -+PHY_RFShadowRead( -+ IN PADAPTER Adapter, -+ IN u8 eRFPath, -+ IN u32 Offset) ++u32 PHY_RFShadowRead(IN PADAPTER Adapter, IN u8 eRFPath, IN u32 Offset) +{ + return RF_Shadow[eRFPath][Offset].Value; + +} /* PHY_RFShadowRead */ + + -+void -+PHY_RFShadowWrite( -+ IN PADAPTER Adapter, -+ IN u8 eRFPath, -+ IN u32 Offset, -+ IN u32 Data) ++void PHY_RFShadowWrite( ++ IN PADAPTER Adapter, IN u8 eRFPath, IN u32 Offset, IN u32 Data ++) +{ + RF_Shadow[eRFPath][Offset].Value = (Data & bRFRegOffsetMask); + RF_Shadow[eRFPath][Offset].Driver_Write = true; @@ -53042,44 +51475,32 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_phy.c linux-4.3-rtl8723bs/3rdpar +} /* PHY_RFShadowWrite */ + + -+bool -+PHY_RFShadowCompare( -+ IN PADAPTER Adapter, -+ IN u8 eRFPath, -+ IN u32 Offset) ++bool PHY_RFShadowCompare(IN PADAPTER Adapter, IN u8 eRFPath, IN u32 Offset) +{ + u32 reg; + /* Check if we need to check the register */ -+ if (RF_Shadow[eRFPath][Offset].Compare == true) -+ { ++ if (RF_Shadow[eRFPath][Offset].Compare == true) { + reg = rtw_hal_read_rfreg(Adapter, eRFPath, Offset, bRFRegOffsetMask); + /* Compare shadow and real rf register for 20bits!! */ -+ if (RF_Shadow[eRFPath][Offset].Value != reg) -+ { ++ if (RF_Shadow[eRFPath][Offset].Value != reg) { + /* Locate error position. */ + RF_Shadow[eRFPath][Offset].ErrorOrNot = true; + /* RT_TRACE(COMP_INIT, DBG_LOUD, */ + /* PHY_RFShadowCompare RF-%d Addr%02lx Err = %05lx\n", */ + /* eRFPath, Offset, reg)); */ + } -+ return RF_Shadow[eRFPath][Offset].ErrorOrNot ; ++ return RF_Shadow[eRFPath][Offset].ErrorOrNot; + } + return false; +} /* PHY_RFShadowCompare */ + + -+void -+PHY_RFShadowRecorver( -+ IN PADAPTER Adapter, -+ IN u8 eRFPath, -+ IN u32 Offset) ++void PHY_RFShadowRecorver(IN PADAPTER Adapter, IN u8 eRFPath, IN u32 Offset) +{ + /* Check if the address is error */ -+ if (RF_Shadow[eRFPath][Offset].ErrorOrNot == true) -+ { ++ if (RF_Shadow[eRFPath][Offset].ErrorOrNot == true) { + /* Check if we need to recorver the register. */ -+ if (RF_Shadow[eRFPath][Offset].Recorver == true) -+ { ++ if (RF_Shadow[eRFPath][Offset].Recorver == true) { + rtw_hal_write_rfreg(Adapter, eRFPath, Offset, bRFRegOffsetMask, + RF_Shadow[eRFPath][Offset].Value); + /* RT_TRACE(COMP_INIT, DBG_LOUD, */ @@ -53091,17 +51512,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_phy.c linux-4.3-rtl8723bs/3rdpar +} /* PHY_RFShadowRecorver */ + + -+void -+PHY_RFShadowCompareAll( -+ IN PADAPTER Adapter) ++void PHY_RFShadowCompareAll(IN PADAPTER Adapter) +{ -+ u8 eRFPath = 0 ; -+ u32 Offset = 0, maxReg= GET_RF6052_REAL_MAX_REG(Adapter); ++ u8 eRFPath = 0; ++ u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter); + -+ for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) -+ { -+ for (Offset = 0; Offset < maxReg; Offset++) -+ { ++ for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) { ++ for (Offset = 0; Offset < maxReg; Offset++) { + PHY_RFShadowCompare(Adapter, eRFPath, Offset); + } + } @@ -53109,17 +51526,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_phy.c linux-4.3-rtl8723bs/3rdpar +} /* PHY_RFShadowCompareAll */ + + -+void -+PHY_RFShadowRecorverAll( -+ IN PADAPTER Adapter) ++void PHY_RFShadowRecorverAll(IN PADAPTER Adapter) +{ -+ u8 eRFPath =0; -+ u32 Offset = 0, maxReg= GET_RF6052_REAL_MAX_REG(Adapter); ++ u8 eRFPath = 0; ++ u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter); + -+ for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) -+ { -+ for (Offset = 0; Offset < maxReg; Offset++) -+ { ++ for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) { ++ for (Offset = 0; Offset < maxReg; Offset++) { + PHY_RFShadowRecorver(Adapter, eRFPath, Offset); + } + } @@ -53129,10 +51542,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_phy.c linux-4.3-rtl8723bs/3rdpar + +void +PHY_RFShadowCompareFlagSet( -+ IN PADAPTER Adapter, -+ IN u8 eRFPath, -+ IN u32 Offset, -+ IN u8 Type) ++ IN PADAPTER Adapter, IN u8 eRFPath, IN u32 Offset, IN u8 Type ++) +{ + /* Set True or False!!! */ + RF_Shadow[eRFPath][Offset].Compare = Type; @@ -53140,30 +51551,23 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_phy.c linux-4.3-rtl8723bs/3rdpar +} /* PHY_RFShadowCompareFlagSet */ + + -+void -+PHY_RFShadowRecorverFlagSet( -+ IN PADAPTER Adapter, -+ IN u8 eRFPath, -+ IN u32 Offset, -+ IN u8 Type) ++void PHY_RFShadowRecorverFlagSet( ++ IN PADAPTER Adapter, IN u8 eRFPath, IN u32 Offset, IN u8 Type ++) +{ + /* Set True or False!!! */ -+ RF_Shadow[eRFPath][Offset].Recorver= Type; ++ RF_Shadow[eRFPath][Offset].Recorver = Type; + +} /* PHY_RFShadowRecorverFlagSet */ + + -+void -+PHY_RFShadowCompareFlagSetAll( -+ IN PADAPTER Adapter) ++void PHY_RFShadowCompareFlagSetAll(IN PADAPTER Adapter) +{ + u8 eRFPath = 0; -+ u32 Offset = 0, maxReg= GET_RF6052_REAL_MAX_REG(Adapter); ++ u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter); + -+ for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) -+ { -+ for (Offset = 0; Offset < maxReg; Offset++) -+ { ++ for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) { ++ for (Offset = 0; Offset < maxReg; Offset++) { + /* 2008/11/20 MH For S3S4 test, we only check reg 26/27 now!!!! */ + if (Offset != 0x26 && Offset != 0x27) + PHY_RFShadowCompareFlagSet(Adapter, eRFPath, Offset, false); @@ -53175,17 +51579,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_phy.c linux-4.3-rtl8723bs/3rdpar +} /* PHY_RFShadowCompareFlagSetAll */ + + -+void -+PHY_RFShadowRecorverFlagSetAll( -+ IN PADAPTER Adapter) ++void PHY_RFShadowRecorverFlagSetAll(IN PADAPTER Adapter) +{ + u8 eRFPath = 0; -+ u32 Offset = 0, maxReg= GET_RF6052_REAL_MAX_REG(Adapter); ++ u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter); + -+ for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) -+ { -+ for (Offset = 0; Offset < maxReg; Offset++) -+ { ++ for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) { ++ for (Offset = 0; Offset < maxReg; Offset++) { + /* 2008/11/20 MH For S3S4 test, we only check reg 26/27 now!!!! */ + if (Offset != 0x26 && Offset != 0x27) + PHY_RFShadowRecorverFlagSet(Adapter, eRFPath, Offset, false); @@ -53196,17 +51596,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_phy.c linux-4.3-rtl8723bs/3rdpar + +} /* PHY_RFShadowCompareFlagSetAll */ + -+void -+PHY_RFShadowRefresh( -+ IN PADAPTER Adapter) ++void PHY_RFShadowRefresh(IN PADAPTER Adapter) +{ + u8 eRFPath = 0; -+ u32 Offset = 0, maxReg= GET_RF6052_REAL_MAX_REG(Adapter); ++ u32 Offset = 0, maxReg = GET_RF6052_REAL_MAX_REG(Adapter); + -+ for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) -+ { -+ for (Offset = 0; Offset < maxReg; Offset++) -+ { ++ for (eRFPath = 0; eRFPath < RF6052_MAX_PATH; eRFPath++) { ++ for (Offset = 0; Offset < maxReg; Offset++) { + RF_Shadow[eRFPath][Offset].Value = 0; + RF_Shadow[eRFPath][Offset].Compare = false; + RF_Shadow[eRFPath][Offset].Recorver = false; @@ -53216,10 +51612,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_phy.c linux-4.3-rtl8723bs/3rdpar + } + +} /* PHY_RFShadowRead */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c ---- linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,2171 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c +--- linux.old/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,2091 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -53270,11 +51666,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + * 88E as the default table. + */ +static u8 DeltaSwingTableIdx_2GA_N_8188E[] = { -+ 0, 0, 0, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, -+ 9, 9, 10, 10, 10, 11, 11, 11, 11}; ++ 0, 0, 0, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, ++ 7, 7, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11 ++}; +static u8 DeltaSwingTableIdx_2GA_P_8188E[] = { -+ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 7, -+ 7, 8, 8, 8, 9, 9, 9, 9, 9}; ++ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 4, 4, ++ 4, 4, 4, 5, 5, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9 ++}; + +/* 3 ============================================================ */ +/* 3 Tx Power Tracking */ @@ -53282,14 +51680,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + + +static void setIqkMatrix_8723B( -+ PDM_ODM_T pDM_Odm, ++ PDM_ODM_T pDM_Odm, + u8 OFDM_index, + u8 RFPath, -+ s32 IqkResult_X, -+ s32 IqkResult_Y -+ ) ++ s32 IqkResult_X, ++ s32 IqkResult_Y ++) +{ -+ s32 ele_A = 0, ele_D, ele_C = 0, value32; ++ s32 ele_A = 0, ele_D, ele_C = 0, value32; + + if (OFDM_index >= OFDM_TABLE_SIZE) + OFDM_index = OFDM_TABLE_SIZE-1; @@ -53297,8 +51695,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + ele_D = (OFDMSwingTable_New[OFDM_index] & 0xFFC00000)>>22; + + /* new element A = element D x X */ -+ if ((IqkResult_X != 0) && (*(pDM_Odm->pBandType) == ODM_BAND_2_4G)) -+ { ++ if ((IqkResult_X != 0) && (*(pDM_Odm->pBandType) == ODM_BAND_2_4G)) { + if ((IqkResult_X & 0x00000200) != 0) /* consider minus */ + IqkResult_X = IqkResult_X | 0xFFFFFC00; + ele_A = ((IqkResult_X * ele_D)>>8)&0x000003FF; @@ -53309,8 +51706,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + ele_C = ((IqkResult_Y * ele_D)>>8)&0x000003FF; + + /* if (RFPath == ODM_RF_PATH_A) */ -+ switch (RFPath) -+ { ++ switch (RFPath) { + case ODM_RF_PATH_A: + /* wirte new elements A, C, D to regC80 and regC94, element B is always 0 */ + value32 = (ele_D<<22)|((ele_C&0x3F)<<16)|ele_A; @@ -53324,7 +51720,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + break; + case ODM_RF_PATH_B: + /* wirte new elements A, C, D to regC88 and regC9C, element B is always 0 */ -+ value32 =(ele_D<<22)|((ele_C&0x3F)<<16) |ele_A; ++ value32 = (ele_D<<22)|((ele_C&0x3F)<<16)|ele_A; + PHY_SetBBReg(pDM_Odm->Adapter, rOFDM0_XBTxIQImbalance, bMaskDWord, value32); + + value32 = (ele_C&0x000003C0)>>6; @@ -53337,11 +51733,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + default: + break; + } -+ } -+ else -+ { -+ switch (RFPath) -+ { ++ } else { ++ switch (RFPath) { + case ODM_RF_PATH_A: + PHY_SetBBReg(pDM_Odm->Adapter, rOFDM0_XATxIQImbalance, bMaskDWord, OFDMSwingTable_New[OFDM_index]); + PHY_SetBBReg(pDM_Odm->Adapter, rOFDM0_XCTxAFE, bMaskH4Bits, 0x00); @@ -53364,14 +51757,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs +} + + -+static void -+setCCKFilterCoefficient( -+ PDM_ODM_T pDM_Odm, -+ u8 CCKSwingIndex -+) ++static void setCCKFilterCoefficient(PDM_ODM_T pDM_Odm, u8 CCKSwingIndex) +{ -+ if (!pDM_Odm->RFCalibrateInfo.bCCKinCH14) -+ { ++ if (!pDM_Odm->RFCalibrateInfo.bCCKinCH14) { + rtw_write8(pDM_Odm->Adapter, 0xa22, CCKSwingTable_Ch1_Ch13_New[CCKSwingIndex][0]); + rtw_write8(pDM_Odm->Adapter, 0xa23, CCKSwingTable_Ch1_Ch13_New[CCKSwingIndex][1]); + rtw_write8(pDM_Odm->Adapter, 0xa24, CCKSwingTable_Ch1_Ch13_New[CCKSwingIndex][2]); @@ -53380,9 +51768,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + rtw_write8(pDM_Odm->Adapter, 0xa27, CCKSwingTable_Ch1_Ch13_New[CCKSwingIndex][5]); + rtw_write8(pDM_Odm->Adapter, 0xa28, CCKSwingTable_Ch1_Ch13_New[CCKSwingIndex][6]); + rtw_write8(pDM_Odm->Adapter, 0xa29, CCKSwingTable_Ch1_Ch13_New[CCKSwingIndex][7]); -+ } -+ else -+ { ++ } else { + rtw_write8(pDM_Odm->Adapter, 0xa22, CCKSwingTable_Ch14_New[CCKSwingIndex][0]); + rtw_write8(pDM_Odm->Adapter, 0xa23, CCKSwingTable_Ch14_New[CCKSwingIndex][1]); + rtw_write8(pDM_Odm->Adapter, 0xa24, CCKSwingTable_Ch14_New[CCKSwingIndex][2]); @@ -53395,11 +51781,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs +} + +void DoIQK_8723B( -+ PDM_ODM_T pDM_Odm, ++ PDM_ODM_T pDM_Odm, + u8 DeltaThermalIndex, + u8 ThermalValue, + u8 Threshold -+ ) ++) +{ +} + @@ -53420,40 +51806,35 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + *04/23/2012 MHC Create Version 0. + * + *---------------------------------------------------------------------------*/ -+void -+ODM_TxPwrTrackSetPwr_8723B( -+ PDM_ODM_T pDM_Odm, -+ PWRTRACK_METHOD Method, -+ u8 RFPath, -+ u8 ChannelMappedIndex -+ ) ++void ODM_TxPwrTrackSetPwr_8723B( ++ PDM_ODM_T pDM_Odm, ++ PWRTRACK_METHOD Method, ++ u8 RFPath, ++ u8 ChannelMappedIndex ++) +{ + struct adapter *Adapter = pDM_Odm->Adapter; + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + u8 PwrTrackingLimit_OFDM = 34; /* 0dB */ -+ u8 PwrTrackingLimit_CCK = 28; /* 2dB */ ++ u8 PwrTrackingLimit_CCK = 28; /* 2dB */ + u8 TxRate = 0xFF; + u8 Final_OFDM_Swing_Index = 0; + u8 Final_CCK_Swing_Index = 0; + + { -+ u16 rate = *(pDM_Odm->pForcedDataRate); ++ u16 rate = *(pDM_Odm->pForcedDataRate); + -+ if (!rate) /* auto rate */ -+ { ++ if (!rate) { /* auto rate */ + if (pDM_Odm->TxRate != 0xFF) + TxRate = HwRateToMRate(pDM_Odm->TxRate); -+ } -+ else /* force rate */ -+ { ++ } else /* force rate */ + TxRate = (u8)rate; -+ } ++ + } + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("===>ODM_TxPwrTrackSetPwr8723B\n")); + -+ if (TxRate != 0xFF) -+ { ++ if (TxRate != 0xFF) { + /* 2 CCK */ + if ((TxRate >= MGN_1M) && (TxRate <= MGN_11M)) + PwrTrackingLimit_CCK = 28; /* 2dB */ @@ -53477,18 +51858,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("TxRate = 0x%x, PwrTrackingLimit =%d\n", TxRate, PwrTrackingLimit_OFDM)); + + if (Method == TXAGC) { -+ struct adapter * Adapter = pDM_Odm->Adapter; ++ struct adapter *Adapter = pDM_Odm->Adapter; + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("odm_TxPwrTrackSetPwr8723B CH =%d\n", *(pDM_Odm->pChannel))); + + pDM_Odm->Remnant_OFDMSwingIdx[RFPath] = pDM_Odm->Absolute_OFDMSwingIdx[RFPath]; + -+ pDM_Odm->Modify_TxAGC_Flag_PathA = true; -+ pDM_Odm->Modify_TxAGC_Flag_PathA_CCK = true; ++ pDM_Odm->Modify_TxAGC_Flag_PathA = true; ++ pDM_Odm->Modify_TxAGC_Flag_PathA_CCK = true; + -+ PHY_SetTxPowerIndexByRateSection(Adapter, RFPath, pHalData->CurrentChannel, CCK); -+ PHY_SetTxPowerIndexByRateSection(Adapter, RFPath, pHalData->CurrentChannel, OFDM); -+ PHY_SetTxPowerIndexByRateSection(Adapter, RFPath, pHalData->CurrentChannel, HT_MCS0_MCS7); ++ PHY_SetTxPowerIndexByRateSection(Adapter, RFPath, pHalData->CurrentChannel, CCK); ++ PHY_SetTxPowerIndexByRateSection(Adapter, RFPath, pHalData->CurrentChannel, OFDM); ++ PHY_SetTxPowerIndexByRateSection(Adapter, RFPath, pHalData->CurrentChannel, HT_MCS0_MCS7); + } else if (Method == BBSWING) { + Final_OFDM_Swing_Index = pDM_Odm->DefaultOfdmIndex + pDM_Odm->Absolute_OFDMSwingIdx[RFPath]; + Final_CCK_Swing_Index = pDM_Odm->DefaultCckIndex + pDM_Odm->Absolute_OFDMSwingIdx[RFPath]; @@ -53510,9 +51891,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + + setCCKFilterCoefficient(pDM_Odm, Final_CCK_Swing_Index); + -+ } -+ else if (Method == MIX_MODE) -+ { ++ } else if (Method == MIX_MODE) { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, + ("pDM_Odm->DefaultOfdmIndex =%d, pDM_Odm->DefaultCCKIndex =%d, pDM_Odm->Absolute_OFDMSwingIdx[RFPath]=%d, RF_Path = %d\n", + pDM_Odm->DefaultOfdmIndex, pDM_Odm->DefaultCckIndex, pDM_Odm->Absolute_OFDMSwingIdx[RFPath], RFPath)); @@ -53520,8 +51899,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + Final_OFDM_Swing_Index = pDM_Odm->DefaultOfdmIndex + pDM_Odm->Absolute_OFDMSwingIdx[RFPath]; + Final_CCK_Swing_Index = pDM_Odm->DefaultCckIndex + pDM_Odm->Absolute_OFDMSwingIdx[RFPath]; + -+ if (Final_OFDM_Swing_Index > PwrTrackingLimit_OFDM) /* BBSwing higher then Limit */ -+ { ++ if (Final_OFDM_Swing_Index > PwrTrackingLimit_OFDM) { /* BBSwing higher then Limit */ + pDM_Odm->Remnant_OFDMSwingIdx[RFPath] = Final_OFDM_Swing_Index - PwrTrackingLimit_OFDM; + + setIqkMatrix_8723B(pDM_Odm, PwrTrackingLimit_OFDM, RFPath, @@ -53535,9 +51913,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, + ("******Path_A Over BBSwing Limit , PwrTrackingLimit = %d , Remnant TxAGC Value = %d\n", + PwrTrackingLimit_OFDM, pDM_Odm->Remnant_OFDMSwingIdx[RFPath])); -+ } -+ else if (Final_OFDM_Swing_Index <= 0) -+ { ++ } else if (Final_OFDM_Swing_Index <= 0) { + pDM_Odm->Remnant_OFDMSwingIdx[RFPath] = Final_OFDM_Swing_Index; + + setIqkMatrix_8723B(pDM_Odm, 0, RFPath, @@ -53551,9 +51927,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, + ("******Path_A Lower then BBSwing lower bound 0 , Remnant TxAGC Value = %d\n", + pDM_Odm->Remnant_OFDMSwingIdx[RFPath])); -+ } -+ else -+ { ++ } else { + setIqkMatrix_8723B(pDM_Odm, Final_OFDM_Swing_Index, RFPath, + pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][0], + pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[ChannelMappedIndex].Value[0][1]); @@ -53561,8 +51935,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, + ("******Path_A Compensate with BBSwing , Final_OFDM_Swing_Index = %d\n", Final_OFDM_Swing_Index)); + -+ if (pDM_Odm->Modify_TxAGC_Flag_PathA) /* If TxAGC has changed, reset TxAGC again */ -+ { ++ if (pDM_Odm->Modify_TxAGC_Flag_PathA) { /* If TxAGC has changed, reset TxAGC again */ + pDM_Odm->Remnant_OFDMSwingIdx[RFPath] = 0; + PHY_SetTxPowerIndexByRateSection(Adapter, RFPath, pHalData->CurrentChannel, OFDM); + PHY_SetTxPowerIndexByRateSection(Adapter, RFPath, pHalData->CurrentChannel, HT_MCS0_MCS7); @@ -53573,8 +51946,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + } + } + -+ if (Final_CCK_Swing_Index > PwrTrackingLimit_CCK) -+ { ++ if (Final_CCK_Swing_Index > PwrTrackingLimit_CCK) { + pDM_Odm->Remnant_CCKSwingIdx = Final_CCK_Swing_Index - PwrTrackingLimit_CCK; + setCCKFilterCoefficient(pDM_Odm, PwrTrackingLimit_CCK); + pDM_Odm->Modify_TxAGC_Flag_PathA_CCK = true; @@ -53582,9 +51954,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, + ("******Path_A CCK Over Limit , PwrTrackingLimit_CCK = %d , pDM_Odm->Remnant_CCKSwingIdx = %d\n", PwrTrackingLimit_CCK, pDM_Odm->Remnant_CCKSwingIdx)); -+ } -+ else if (Final_CCK_Swing_Index <= 0) /* Lowest CCK Index = 0 */ -+ { ++ } else if (Final_CCK_Swing_Index <= 0) { /* Lowest CCK Index = 0 */ + pDM_Odm->Remnant_CCKSwingIdx = Final_CCK_Swing_Index; + setCCKFilterCoefficient(pDM_Odm, 0); + pDM_Odm->Modify_TxAGC_Flag_PathA_CCK = true; @@ -53592,16 +51962,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, + ("******Path_A CCK Under Limit , PwrTrackingLimit_CCK = %d , pDM_Odm->Remnant_CCKSwingIdx = %d\n", 0, pDM_Odm->Remnant_CCKSwingIdx)); -+ } -+ else -+ { ++ } else { + setCCKFilterCoefficient(pDM_Odm, Final_CCK_Swing_Index); + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, + ("******Path_A CCK Compensate with BBSwing , Final_CCK_Swing_Index = %d\n", Final_CCK_Swing_Index)); + -+ if (pDM_Odm->Modify_TxAGC_Flag_PathA_CCK) /* If TxAGC has changed, reset TxAGC again */ -+ { ++ if (pDM_Odm->Modify_TxAGC_Flag_PathA_CCK) { /* If TxAGC has changed, reset TxAGC again */ + pDM_Odm->Remnant_CCKSwingIdx = 0; + PHY_SetTxPowerIndexByRateSection(Adapter, RFPath, pHalData->CurrentChannel, CCK); + pDM_Odm->Modify_TxAGC_Flag_PathA_CCK = false; @@ -53610,27 +51977,23 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + ("******Path_A pDM_Odm->Modify_TxAGC_Flag_CCK = false\n")); + } + } -+ } -+ else -+ { ++ } else + return; /* This method is not supported. */ -+ } +} + -+static void -+GetDeltaSwingTable_8723B( -+PDM_ODM_T pDM_Odm, -+ u8 * *TemperatureUP_A, -+ u8 * *TemperatureDOWN_A, -+ u8 * *TemperatureUP_B, -+ u8 * *TemperatureDOWN_B -+ ) ++static void GetDeltaSwingTable_8723B( ++ PDM_ODM_T pDM_Odm, ++ u8 **TemperatureUP_A, ++ u8 **TemperatureDOWN_A, ++ u8 **TemperatureUP_B, ++ u8 **TemperatureDOWN_B ++) +{ -+ struct adapter * Adapter = pDM_Odm->Adapter; -+ PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); -+ u16 rate = *(pDM_Odm->pForcedDataRate); -+ u8 channel = pHalData->CurrentChannel; ++ struct adapter *Adapter = pDM_Odm->Adapter; ++ PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ u16 rate = *(pDM_Odm->pForcedDataRate); ++ u8 channel = pHalData->CurrentChannel; + + if (1 <= channel && channel <= 14) { + if (IS_CCK_RATE(rate)) { @@ -53644,7 +52007,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + *TemperatureUP_B = pRFCalibrateInfo->DeltaSwingTableIdx_2GB_P; + *TemperatureDOWN_B = pRFCalibrateInfo->DeltaSwingTableIdx_2GB_N; + } -+ }/*else if (36 <= channel && channel <= 64) { ++ } /*else if (36 <= channel && channel <= 64) { + *TemperatureUP_A = pRFCalibrateInfo->DeltaSwingTableIdx_5GA_P[0]; + *TemperatureDOWN_A = pRFCalibrateInfo->DeltaSwingTableIdx_5GA_N[0]; + *TemperatureUP_B = pRFCalibrateInfo->DeltaSwingTableIdx_5GB_P[0]; @@ -53670,9 +52033,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs +} + + -+void ConfigureTxpowerTrack_8723B( -+ PTXPWRTRACK_CFG pConfig -+ ) ++void ConfigureTxpowerTrack_8723B(PTXPWRTRACK_CFG pConfig) +{ + pConfig->SwingTableSize_CCK = CCK_TABLE_SIZE; + pConfig->SwingTableSize_OFDM = OFDM_TABLE_SIZE; @@ -53687,16 +52048,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + pConfig->GetDeltaSwingTable = GetDeltaSwingTable_8723B; +} + -+/* 1 7. IQK */ ++/* 1 7. IQK */ +#define MAX_TOLERANCE 5 +#define IQK_DELAY_TIME 1 /* ms */ + -+static u8 /* bit0 = 1 => Tx OK, bit1 = 1 => Rx OK */ -+phy_PathA_IQK_8723B( -+struct adapter *padapter, -+bool configPathB, -+u8 RF_Path -+ ) ++/* bit0 = 1 => Tx OK, bit1 = 1 => Rx OK */ ++static u8 phy_PathA_IQK_8723B( ++ struct adapter *padapter, bool configPathB, u8 RF_Path ++) +{ + u32 regEAC, regE94, regE9C, tmp, Path_SEL_BB /*, regEA4*/; + u8 result = 0x00; @@ -53786,16 +52145,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + + + /* Allen 20131125 */ -+ tmp =(regE9C & 0x03FF0000)>>16; -+ if ((tmp & 0x200)> 0) ++ tmp = (regE9C & 0x03FF0000)>>16; ++ if ((tmp & 0x200) > 0) + tmp = 0x400 - tmp; + -+ if (!(regEAC & BIT28) && -+ (((regE94 & 0x03FF0000)>>16) != 0x142) && -+ (((regE9C & 0x03FF0000)>>16) != 0x42) && -+ (((regE94 & 0x03FF0000)>>16) <0x110) && -+ (((regE94 & 0x03FF0000)>>16) >0xf0) && -+ (tmp <0xf)) ++ if ( ++ !(regEAC & BIT28) && ++ (((regE94 & 0x03FF0000)>>16) != 0x142) && ++ (((regE9C & 0x03FF0000)>>16) != 0x42) && ++ (((regE94 & 0x03FF0000)>>16) < 0x110) && ++ (((regE94 & 0x03FF0000)>>16) > 0xf0) && ++ (tmp < 0xf) ++ ) + result |= 0x01; + else /* if Tx not OK, ignore Rx */ + return result; @@ -53803,17 +52164,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + return result; +} + -+static u8 /* bit0 = 1 => Tx OK, bit1 = 1 => Rx OK */ -+phy_PathA_RxIQK8723B( -+struct adapter *padapter, -+bool configPathB, -+u8 RF_Path -+ ) ++/* bit0 = 1 => Tx OK, bit1 = 1 => Rx OK */ ++static u8 phy_PathA_RxIQK8723B( ++ struct adapter *padapter, bool configPathB, u8 RF_Path ++) +{ + u32 regEAC, regE94, regE9C, regEA4, u4tmp, tmp, Path_SEL_BB; + u8 result = 0x00; -+ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; ++ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); ++ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + +/* ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK!\n")); */ + @@ -53895,24 +52254,26 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe94 = 0x%x, 0xe9c = 0x%x\n", regE94, regE9C)); + /* monitor image power before & after IQK */ + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe90(before IQK) = 0x%x, 0xe98(afer IQK) = 0x%x\n", -+ PHY_QueryBBReg(pDM_Odm->Adapter, 0xe90, bMaskDWord), PHY_QueryBBReg(pDM_Odm->Adapter, 0xe98, bMaskDWord))); ++ PHY_QueryBBReg(pDM_Odm->Adapter, 0xe90, bMaskDWord), PHY_QueryBBReg(pDM_Odm->Adapter, 0xe98, bMaskDWord))); + + /* Allen 20131125 */ -+ tmp =(regE9C & 0x03FF0000)>>16; -+ if ((tmp & 0x200)> 0) ++ tmp = (regE9C & 0x03FF0000)>>16; ++ if ((tmp & 0x200) > 0) + tmp = 0x400 - tmp; + -+ if (!(regEAC & BIT28) && -+ (((regE94 & 0x03FF0000)>>16) != 0x142) && -+ (((regE9C & 0x03FF0000)>>16) != 0x42) && -+ (((regE94 & 0x03FF0000)>>16) <0x110) && -+ (((regE94 & 0x03FF0000)>>16) >0xf0) && -+ (tmp <0xf)) ++ if ( ++ !(regEAC & BIT28) && ++ (((regE94 & 0x03FF0000)>>16) != 0x142) && ++ (((regE9C & 0x03FF0000)>>16) != 0x42) && ++ (((regE94 & 0x03FF0000)>>16) < 0x110) && ++ (((regE94 & 0x03FF0000)>>16) > 0xf0) && ++ (tmp < 0xf) ++ ) + result |= 0x01; + else /* if Tx not OK, ignore Rx */ + return result; + -+ u4tmp = 0x80007C00 | (regE94&0x3FF0000) | ((regE9C&0x3FF0000) >> 16); ++ u4tmp = 0x80007C00 | (regE94&0x3FF0000) | ((regE9C&0x3FF0000) >> 16); + PHY_SetBBReg(pDM_Odm->Adapter, rTx_IQK, bMaskDWord, u4tmp); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe40 = 0x%x u4tmp = 0x%x\n", PHY_QueryBBReg(pDM_Odm->Adapter, rTx_IQK, bMaskDWord), u4tmp)); + @@ -54001,31 +52362,31 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + PHY_SetRFReg(pDM_Odm->Adapter, ODM_RF_PATH_A, 0xdf, bRFRegOffsetMask, 0x780); + + /* Allen 20131125 */ -+ tmp =(regEAC & 0x03FF0000)>>16; -+ if ((tmp & 0x200)> 0) ++ tmp = (regEAC & 0x03FF0000)>>16; ++ if ((tmp & 0x200) > 0) + tmp = 0x400 - tmp; + -+ if (!(regEAC & BIT27) && /* if Tx is OK, check whether Rx is OK */ -+ (((regEA4 & 0x03FF0000)>>16) != 0x132) && -+ (((regEAC & 0x03FF0000)>>16) != 0x36) && -+ (((regEA4 & 0x03FF0000)>>16) < 0x110) && -+ (((regEA4 & 0x03FF0000)>>16) > 0xf0) && -+ (tmp <0xf)) ++ if ( ++ !(regEAC & BIT27) && /* if Tx is OK, check whether Rx is OK */ ++ (((regEA4 & 0x03FF0000)>>16) != 0x132) && ++ (((regEAC & 0x03FF0000)>>16) != 0x36) && ++ (((regEA4 & 0x03FF0000)>>16) < 0x110) && ++ (((regEA4 & 0x03FF0000)>>16) > 0xf0) && ++ (tmp < 0xf) ++ ) + result |= 0x02; + else /* if Tx not OK, ignore Rx */ + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK fail!!\n")); + return result; +} + -+static u8 /* bit0 = 1 => Tx OK, bit1 = 1 => Rx OK */ -+phy_PathB_IQK_8723B( -+struct adapter *padapter -+ ) ++/* bit0 = 1 => Tx OK, bit1 = 1 => Rx OK */ ++static u8 phy_PathB_IQK_8723B(struct adapter *padapter) +{ + u32 regEAC, regE94, regE9C, tmp, Path_SEL_BB/*, regEC4, regECC, Path_SEL_BB*/; + u8 result = 0x00; + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; ++ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQK!\n")); + @@ -54106,34 +52467,33 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe94 = 0x%x, 0xe9c = 0x%x\n", regE94, regE9C)); + /* monitor image power before & after IQK */ + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("0xe90(before IQK) = 0x%x, 0xe98(afer IQK) = 0x%x\n", -+ PHY_QueryBBReg(pDM_Odm->Adapter, 0xe90, bMaskDWord), PHY_QueryBBReg(pDM_Odm->Adapter, 0xe98, bMaskDWord))); ++ PHY_QueryBBReg(pDM_Odm->Adapter, 0xe90, bMaskDWord), PHY_QueryBBReg(pDM_Odm->Adapter, 0xe98, bMaskDWord))); + + /* Allen 20131125 */ -+ tmp =(regE9C & 0x03FF0000)>>16; -+ if ((tmp & 0x200)> 0) ++ tmp = (regE9C & 0x03FF0000)>>16; ++ if ((tmp & 0x200) > 0) + tmp = 0x400 - tmp; + -+ if (!(regEAC & BIT28) && -+ (((regE94 & 0x03FF0000)>>16) != 0x142) && -+ (((regE9C & 0x03FF0000)>>16) != 0x42) && -+ (((regE94 & 0x03FF0000)>>16) <0x110) && -+ (((regE94 & 0x03FF0000)>>16) >0xf0) && -+ (tmp <0xf)) ++ if ( ++ !(regEAC & BIT28) && ++ (((regE94 & 0x03FF0000)>>16) != 0x142) && ++ (((regE9C & 0x03FF0000)>>16) != 0x42) && ++ (((regE94 & 0x03FF0000)>>16) < 0x110) && ++ (((regE94 & 0x03FF0000)>>16) > 0xf0) && ++ (tmp < 0xf) ++ ) + result |= 0x01; + + return result; +} + -+static u8 /* bit0 = 1 => Tx OK, bit1 = 1 => Rx OK */ -+phy_PathB_RxIQK8723B( -+struct adapter *padapter, -+bool configPathB -+ ) ++/* bit0 = 1 => Tx OK, bit1 = 1 => Rx OK */ ++static u8 phy_PathB_RxIQK8723B(struct adapter *padapter, bool configPathB) +{ + u32 regE94, regE9C, regEA4, regEAC, u4tmp, tmp, Path_SEL_BB; + u8 result = 0x00; -+ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; ++ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); ++ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + +/* ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B Rx IQK!\n")); */ + @@ -54219,18 +52579,20 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + PHY_QueryBBReg(pDM_Odm->Adapter, 0xe90, bMaskDWord), PHY_QueryBBReg(pDM_Odm->Adapter, 0xe98, bMaskDWord))); + + /* Allen 20131125 */ -+ tmp =(regE9C & 0x03FF0000)>>16; ++ tmp = (regE9C & 0x03FF0000)>>16; +/* ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("tmp1 = 0x%x\n", tmp)); */ -+ if ((tmp & 0x200)> 0) ++ if ((tmp & 0x200) > 0) + tmp = 0x400 - tmp; +/* ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("tmp2 = 0x%x\n", tmp)); */ + -+ if (!(regEAC & BIT28) && -+ (((regE94 & 0x03FF0000)>>16) != 0x142) && -+ (((regE9C & 0x03FF0000)>>16) != 0x42) && -+ (((regE94 & 0x03FF0000)>>16) <0x110) && -+ (((regE94 & 0x03FF0000)>>16) >0xf0) && -+ (tmp <0xf)) ++ if ( ++ !(regEAC & BIT28) && ++ (((regE94 & 0x03FF0000)>>16) != 0x142) && ++ (((regE9C & 0x03FF0000)>>16) != 0x42) && ++ (((regE94 & 0x03FF0000)>>16) < 0x110) && ++ (((regE94 & 0x03FF0000)>>16) > 0xf0) && ++ (tmp < 0xf) ++ ) + result |= 0x01; + else /* if Tx not OK, ignore Rx */ + return result; @@ -54324,16 +52686,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + + + /* Allen 20131125 */ -+ tmp =(regEAC & 0x03FF0000)>>16; -+ if ((tmp & 0x200)> 0) ++ tmp = (regEAC & 0x03FF0000)>>16; ++ if ((tmp & 0x200) > 0) + tmp = 0x400 - tmp; + -+ if (!(regEAC & BIT27) && /* if Tx is OK, check whether Rx is OK */ -+ (((regEA4 & 0x03FF0000)>>16) != 0x132) && -+ (((regEAC & 0x03FF0000)>>16) != 0x36) && -+ (((regEA4 & 0x03FF0000)>>16) <0x110) && -+ (((regEA4 & 0x03FF0000)>>16) >0xf0) && -+ (tmp <0xf)) ++ if ( ++ !(regEAC & BIT27) && /* if Tx is OK, check whether Rx is OK */ ++ (((regEA4 & 0x03FF0000)>>16) != 0x132) && ++ (((regEAC & 0x03FF0000)>>16) != 0x36) && ++ (((regEA4 & 0x03FF0000)>>16) < 0x110) && ++ (((regEA4 & 0x03FF0000)>>16) > 0xf0) && ++ (tmp < 0xf) ++ ) + result |= 0x02; + else + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B Rx IQK fail!!\n")); @@ -54341,29 +52705,27 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + return result; +} + -+static void -+_PHY_PathAFillIQKMatrix8723B( -+struct adapter *padapter, -+bool bIQKOK, -+s32 result[][8], -+u8 final_candidate, -+bool bTxOnly -+ ) ++static void _PHY_PathAFillIQKMatrix8723B( ++ struct adapter *padapter, ++ bool bIQKOK, ++ s32 result[][8], ++ u8 final_candidate, ++ bool bTxOnly ++) +{ + u32 Oldval_0, X, TX0_A, reg; -+ s32 Y, TX0_C; ++ s32 Y, TX0_C; + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; ++ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + -+ PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); ++ PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A IQ Calibration %s !\n", (bIQKOK)?"Success":"Failed")); + + if (final_candidate == 0xFF) + return; + -+ else if (bIQKOK) -+ { ++ else if (bIQKOK) { + Oldval_0 = (PHY_QueryBBReg(pDM_Odm->Adapter, rOFDM0_XATxIQImbalance, bMaskDWord) >> 22) & 0x3FF; + + X = result[final_candidate][0]; @@ -54373,7 +52735,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("X = 0x%x, TX0_A = 0x%x, Oldval_0 0x%x\n", X, TX0_A, Oldval_0)); + PHY_SetBBReg(pDM_Odm->Adapter, rOFDM0_XATxIQImbalance, 0x3FF, TX0_A); + -+ PHY_SetBBReg(pDM_Odm->Adapter, rOFDM0_ECCAThreshold, BIT(31), ((X* Oldval_0>>7) & 0x1)); ++ PHY_SetBBReg(pDM_Odm->Adapter, rOFDM0_ECCAThreshold, BIT(31), ((X*Oldval_0>>7) & 0x1)); + + Y = result[final_candidate][1]; + if ((Y & 0x00000200) != 0) @@ -54390,12 +52752,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + pRFCalibrateInfo->TxIQC_8723B[PATH_S1][IDX_0xC80][KEY] = rOFDM0_XATxIQImbalance; + pRFCalibrateInfo->TxIQC_8723B[PATH_S1][IDX_0xC80][VAL] = PHY_QueryBBReg(pDM_Odm->Adapter, rOFDM0_XATxIQImbalance, bMaskDWord); + -+ PHY_SetBBReg(pDM_Odm->Adapter, rOFDM0_ECCAThreshold, BIT(29), ((Y* Oldval_0>>7) & 0x1)); ++ PHY_SetBBReg(pDM_Odm->Adapter, rOFDM0_ECCAThreshold, BIT(29), ((Y*Oldval_0>>7) & 0x1)); + pRFCalibrateInfo->TxIQC_8723B[PATH_S1][IDX_0xC4C][KEY] = rOFDM0_ECCAThreshold; + pRFCalibrateInfo->TxIQC_8723B[PATH_S1][IDX_0xC4C][VAL] = PHY_QueryBBReg(pDM_Odm->Adapter, rOFDM0_ECCAThreshold, bMaskDWord); + -+ if (bTxOnly) -+ { ++ if (bTxOnly) { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("_PHY_PathAFillIQKMatrix8723B only Tx OK\n")); + + /* <20130226, Kordan> Saving RxIQC, otherwise not initialized. */ @@ -54424,29 +52785,27 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + } +} + -+static void -+_PHY_PathBFillIQKMatrix8723B( -+struct adapter *padapter, -+bool bIQKOK, -+s32 result[][8], -+u8 final_candidate, -+bool bTxOnly /* do Tx only */ -+ ) ++static void _PHY_PathBFillIQKMatrix8723B( ++ struct adapter *padapter, ++ bool bIQKOK, ++ s32 result[][8], ++ u8 final_candidate, ++ bool bTxOnly /* do Tx only */ ++) +{ + u32 Oldval_1, X, TX1_A, reg; + s32 Y, TX1_C; + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; ++ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + -+ PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); ++ PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQ Calibration %s !\n", (bIQKOK)?"Success":"Failed")); + + if (final_candidate == 0xFF) + return; + -+ else if (bIQKOK) -+ { ++ else if (bIQKOK) { + Oldval_1 = (PHY_QueryBBReg(pDM_Odm->Adapter, rOFDM0_XBTxIQImbalance, bMaskDWord) >> 22) & 0x3FF; + + X = result[final_candidate][4]; @@ -54457,7 +52816,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + + PHY_SetBBReg(pDM_Odm->Adapter, rOFDM0_XBTxIQImbalance, 0x3FF, TX1_A); + -+ PHY_SetBBReg(pDM_Odm->Adapter, rOFDM0_ECCAThreshold, BIT(27), ((X* Oldval_1>>7) & 0x1)); ++ PHY_SetBBReg(pDM_Odm->Adapter, rOFDM0_ECCAThreshold, BIT(27), ((X*Oldval_1>>7) & 0x1)); + + Y = result[final_candidate][5]; + if ((Y & 0x00000200) != 0) @@ -54477,7 +52836,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC80][KEY] = rOFDM0_XATxIQImbalance; + pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC80][VAL] = PHY_QueryBBReg(pDM_Odm->Adapter, rOFDM0_XBTxIQImbalance, bMaskDWord); + -+ PHY_SetBBReg(pDM_Odm->Adapter, rOFDM0_ECCAThreshold, BIT(25), ((Y* Oldval_1>>7) & 0x1)); ++ PHY_SetBBReg(pDM_Odm->Adapter, rOFDM0_ECCAThreshold, BIT(25), ((Y*Oldval_1>>7) & 0x1)); + pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC4C][KEY] = rOFDM0_ECCAThreshold; + pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC4C][VAL] = PHY_QueryBBReg(pDM_Odm->Adapter, rOFDM0_ECCAThreshold, bMaskDWord); + @@ -54503,7 +52862,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + reg = (result[final_candidate][7] >> 6) & 0xF; +/* PHY_SetBBReg(pDM_Odm->Adapter, rOFDM0_AGCRSSITable, 0x0000F000, reg); */ + pRFCalibrateInfo->RxIQC_8723B[PATH_S0][IDX_0xCA0][KEY] = rOFDM0_RxIQExtAnta; -+ pRFCalibrateInfo->RxIQC_8723B[PATH_S0][IDX_0xCA0][VAL] = (reg << 28)|(PHY_QueryBBReg(pDM_Odm->Adapter, rOFDM0_RxIQExtAnta, bMaskDWord)& 0x0fffffff); ++ pRFCalibrateInfo->RxIQC_8723B[PATH_S0][IDX_0xCA0][VAL] = (reg << 28)|(PHY_QueryBBReg(pDM_Odm->Adapter, rOFDM0_RxIQExtAnta, bMaskDWord)&0x0fffffff); + } +} + @@ -54512,18 +52871,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs +/* */ +/* MP Already declare in odm.c */ + -+void -+ODM_SetIQCbyRFpath(PDM_ODM_T pDM_Odm, u32 RFpath) ++void ODM_SetIQCbyRFpath(PDM_ODM_T pDM_Odm, u32 RFpath) +{ + -+ PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); ++ PODM_RF_CAL_T pRFCalibrateInfo = &(pDM_Odm->RFCalibrateInfo); + -+ if ((pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC80][VAL] != 0x0) && -+ (pRFCalibrateInfo->RxIQC_8723B[PATH_S0][IDX_0xC14][VAL] != 0x0) && -+ (pRFCalibrateInfo->TxIQC_8723B[PATH_S1][IDX_0xC80][VAL] != 0x0) && -+ (pRFCalibrateInfo->RxIQC_8723B[PATH_S1][IDX_0xC14][VAL] != 0x0)) { -+ if (RFpath) /* S1: RFpath = 0, S0:RFpath = 1 */ -+ { ++ if ( ++ (pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC80][VAL] != 0x0) && ++ (pRFCalibrateInfo->RxIQC_8723B[PATH_S0][IDX_0xC14][VAL] != 0x0) && ++ (pRFCalibrateInfo->TxIQC_8723B[PATH_S1][IDX_0xC80][VAL] != 0x0) && ++ (pRFCalibrateInfo->RxIQC_8723B[PATH_S1][IDX_0xC14][VAL] != 0x0) ++ ) { ++ if (RFpath) { /* S1: RFpath = 0, S0:RFpath = 1 */ + /* S0 TX IQC */ + PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC94][KEY], bMaskDWord, pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC94][VAL]); + PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC80][KEY], bMaskDWord, pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC80][VAL]); @@ -54543,24 +52902,21 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + } +} + -+static bool -+ODM_CheckPowerStatus( -+ struct adapter * Adapter) ++static bool ODM_CheckPowerStatus(struct adapter *Adapter) +{ -+ return true; ++ return true; +} + -+static void -+_PHY_SaveADDARegisters8723B( -+struct adapter *padapter, -+u32 * ADDAReg, -+u32 * ADDABackup, -+u32 RegisterNum -+ ) ++static void _PHY_SaveADDARegisters8723B( ++ struct adapter *padapter, ++ u32 *ADDAReg, ++ u32 *ADDABackup, ++ u32 RegisterNum ++) +{ + u32 i; -+ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; ++ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); ++ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + + if (ODM_CheckPowerStatus(padapter) == false) + return; @@ -54572,12 +52928,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs +} + + -+static void -+_PHY_SaveMACRegisters8723B( -+struct adapter *padapter, -+u32 * MACReg, -+u32 * MACBackup -+ ) ++static void _PHY_SaveMACRegisters8723B( ++ struct adapter *padapter, u32 *MACReg, u32 *MACBackup ++) +{ + u32 i; + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); @@ -54592,31 +52945,26 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs +} + + -+static void -+_PHY_ReloadADDARegisters8723B( -+struct adapter *padapter, -+u32 * ADDAReg, -+u32 * ADDABackup, -+u32 RegiesterNum -+ ) ++static void _PHY_ReloadADDARegisters8723B( ++ struct adapter *padapter, ++ u32 *ADDAReg, ++ u32 *ADDABackup, ++ u32 RegiesterNum ++) +{ + u32 i; + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; ++ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Reload ADDA power saving parameters !\n")); -+ for (i = 0 ; i < RegiesterNum; i++) -+ { ++ for (i = 0 ; i < RegiesterNum; i++) { + PHY_SetBBReg(pDM_Odm->Adapter, ADDAReg[i], bMaskDWord, ADDABackup[i]); + } +} + -+static void -+_PHY_ReloadMACRegisters8723B( -+struct adapter *padapter, -+u32 * MACReg, -+u32 * MACBackup -+ ) ++static void _PHY_ReloadMACRegisters8723B( ++ struct adapter *padapter, u32 *MACReg, u32 *MACBackup ++) +{ + u32 i; + @@ -54627,18 +52975,17 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs +} + + -+static void -+_PHY_PathADDAOn8723B( -+struct adapter *padapter, -+u32 * ADDAReg, -+bool isPathAOn, -+bool is2T -+ ) ++static void _PHY_PathADDAOn8723B( ++ struct adapter *padapter, ++ u32 *ADDAReg, ++ bool isPathAOn, ++ bool is2T ++) +{ + u32 pathOn; + u32 i; -+ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; ++ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); ++ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("ADDA ON.\n")); + @@ -54646,8 +52993,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + if (false == is2T) { + pathOn = 0x01c00014; + PHY_SetBBReg(pDM_Odm->Adapter, ADDAReg[0], bMaskDWord, 0x01c00014); -+ } -+ else { ++ } else { + PHY_SetBBReg(pDM_Odm->Adapter, ADDAReg[0], bMaskDWord, pathOn); + } + @@ -54657,16 +53003,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + +} + -+static void -+_PHY_MACSettingCalibration8723B( -+struct adapter *padapter, -+u32 * MACReg, -+u32 * MACBackup -+ ) ++static void _PHY_MACSettingCalibration8723B( ++ struct adapter *padapter, u32 *MACReg, u32 *MACBackup ++) +{ + u32 i = 0; + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; ++ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("MAC settings for Calibration.\n")); + @@ -54679,18 +53022,17 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + +} + -+static bool -+phy_SimularityCompare_8723B( -+struct adapter *padapter, -+s32 result[][8], -+u8 c1, -+u8 c2 -+ ) ++static bool phy_SimularityCompare_8723B( ++ struct adapter *padapter, ++ s32 result[][8], ++ u8 c1, ++ u8 c2 ++) +{ -+ u32 i, j, diff, SimularityBitMap, bound = 0; -+ u8 final_candidate[2] = {0xFF, 0xFF}; /* for path A and path B */ -+ bool bResult = true; -+ bool is2T = true; ++ u32 i, j, diff, SimularityBitMap, bound = 0; ++ u8 final_candidate[2] = {0xFF, 0xFF}; /* for path A and path B */ ++ bool bResult = true; ++ bool is2T = true; + s32 tmp1 = 0, tmp2 = 0; + + if (is2T) @@ -54700,81 +53042,65 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + + SimularityBitMap = 0; + -+ for (i = 0; i < bound; i++) -+ { ++ for (i = 0; i < bound; i++) { + -+ if ((i == 1) || (i ==3) || (i ==5) || (i ==7)) -+ { -+ if ((result[c1][i]& 0x00000200) != 0) ++ if ((i == 1) || (i == 3) || (i == 5) || (i == 7)) { ++ if ((result[c1][i] & 0x00000200) != 0) + tmp1 = result[c1][i] | 0xFFFFFC00; + else + tmp1 = result[c1][i]; + -+ if ((result[c2][i]& 0x00000200) != 0) ++ if ((result[c2][i] & 0x00000200) != 0) + tmp2 = result[c2][i] | 0xFFFFFC00; + else + tmp2 = result[c2][i]; -+ } -+ else -+ { ++ } else { + tmp1 = result[c1][i]; + tmp2 = result[c2][i]; + } + + diff = (tmp1 > tmp2) ? (tmp1 - tmp2) : (tmp2 - tmp1); + -+ if (diff > MAX_TOLERANCE) -+ { -+ if ((i == 2 || i == 6) && !SimularityBitMap) -+ { ++ if (diff > MAX_TOLERANCE) { ++ if ((i == 2 || i == 6) && !SimularityBitMap) { + if (result[c1][i]+result[c1][i+1] == 0) + final_candidate[(i/4)] = c2; + else if (result[c2][i]+result[c2][i+1] == 0) + final_candidate[(i/4)] = c1; + else + SimularityBitMap = SimularityBitMap|(1<odmpriv; ++ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + -+ u32 i; -+ u8 PathAOK, PathBOK; -+ u8 tmp0xc50 = (u8)PHY_QueryBBReg(pDM_Odm->Adapter, 0xC50, bMaskByte0); -+ u8 tmp0xc58 = (u8)PHY_QueryBBReg(pDM_Odm->Adapter, 0xC58, bMaskByte0); -+ u32 ADDA_REG[IQK_ADDA_REG_NUM] = { -+ rFPGA0_XCD_SwitchControl, rBlue_Tooth, -+ rRx_Wait_CCA, rTx_CCK_RFON, -+ rTx_CCK_BBON, rTx_OFDM_RFON, -+ rTx_OFDM_BBON, rTx_To_Rx, -+ rTx_To_Tx, rRx_CCK, -+ rRx_OFDM, rRx_Wait_RIFS, -+ rRx_TO_Rx, rStandby, -+ rSleep, rPMPD_ANAEN }; -+ u32 IQK_MAC_REG[IQK_MAC_REG_NUM] = { -+ REG_TXPAUSE, REG_BCN_CTRL, -+ REG_BCN_CTRL_1, REG_GPIO_MUXCFG}; ++ u32 i; ++ u8 PathAOK, PathBOK; ++ u8 tmp0xc50 = (u8)PHY_QueryBBReg(pDM_Odm->Adapter, 0xC50, bMaskByte0); ++ u8 tmp0xc58 = (u8)PHY_QueryBBReg(pDM_Odm->Adapter, 0xC58, bMaskByte0); ++ u32 ADDA_REG[IQK_ADDA_REG_NUM] = { ++ rFPGA0_XCD_SwitchControl, ++ rBlue_Tooth, ++ rRx_Wait_CCA, ++ rTx_CCK_RFON, ++ rTx_CCK_BBON, ++ rTx_OFDM_RFON, ++ rTx_OFDM_BBON, ++ rTx_To_Rx, ++ rTx_To_Tx, ++ rRx_CCK, ++ rRx_OFDM, ++ rRx_Wait_RIFS, ++ rRx_TO_Rx, ++ rStandby, ++ rSleep, ++ rPMPD_ANAEN ++ }; ++ u32 IQK_MAC_REG[IQK_MAC_REG_NUM] = { ++ REG_TXPAUSE, ++ REG_BCN_CTRL, ++ REG_BCN_CTRL_1, ++ REG_GPIO_MUXCFG ++ }; + + /* since 92C & 92D have the different define in IQK_BB_REG */ + u32 IQK_BB_REG_92C[IQK_BB_REG_NUM] = { -+ rOFDM0_TRxPathEnable, rOFDM0_TRMuxPar, -+ rFPGA0_XCD_RFInterfaceSW, rConfig_AntA, rConfig_AntB, -+ rFPGA0_XAB_RFInterfaceSW, rFPGA0_XA_RFInterfaceOE, -+ rFPGA0_XB_RFInterfaceOE, rCCK0_AFESetting -+ }; ++ rOFDM0_TRxPathEnable, ++ rOFDM0_TRMuxPar, ++ rFPGA0_XCD_RFInterfaceSW, ++ rConfig_AntA, ++ rConfig_AntB, ++ rFPGA0_XAB_RFInterfaceSW, ++ rFPGA0_XA_RFInterfaceOE, ++ rFPGA0_XB_RFInterfaceOE, ++ rCCK0_AFESetting ++ }; + const u32 retryCount = 2; + + /* Note: IQ calibration must be performed after loading */ @@ -54827,8 +53169,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + + /* u32 bbvalue; */ + -+ if (t == 0) -+ { ++ if (t == 0) { +/* bbvalue = PHY_QueryBBReg(pDM_Odm->Adapter, rFPGA0_RFMOD, bMaskDWord); */ +/* RT_DISP(FINIT, INIT_IQK, ("phy_IQCalibrate_8188E() ==>0x%08x\n", bbvalue)); */ + @@ -54902,9 +53243,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + result[t][2] = (PHY_QueryBBReg(pDM_Odm->Adapter, rRx_Power_Before_IQK_A_2, bMaskDWord)&0x3FF0000)>>16; + result[t][3] = (PHY_QueryBBReg(pDM_Odm->Adapter, rRx_Power_After_IQK_A_2, bMaskDWord)&0x3FF0000)>>16; + break; -+ } -+ else -+ { ++ } else { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A Rx IQK Fail!!\n")); + } + } @@ -54988,11 +53327,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs +} + + -+static void -+phy_LCCalibrate_8723B( -+ PDM_ODM_T pDM_Odm, -+ bool is2T -+ ) ++static void phy_LCCalibrate_8723B(PDM_ODM_T pDM_Odm, bool is2T) +{ + u8 tmpReg; + u32 RF_Amode = 0, RF_Bmode = 0, LC_Cal; @@ -55006,8 +53341,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + else /* Deal with Packet TX case */ + rtw_write8(pDM_Odm->Adapter, REG_TXPAUSE, 0xFF); /* block all queues */ + -+ if ((tmpReg&0x70) != 0) -+ { ++ if ((tmpReg&0x70) != 0) { + /* 1. Read original RF mode */ + /* Path-A */ + RF_Amode = PHY_QueryRFReg(padapter, ODM_RF_PATH_A, RF_AC, bMask12Bits); @@ -55037,14 +53371,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + PHY_SetRFReg(pDM_Odm->Adapter, ODM_RF_PATH_A, 0xB0, bRFRegOffsetMask, 0xDFFE0); /* LDO OFF */ + + /* Channel 10 LC calibration issue for 8723bs with 26M xtal */ -+ if (pDM_Odm->SupportInterface == ODM_ITRF_SDIO && pDM_Odm->PackageType >= 0x2) -+ { ++ if (pDM_Odm->SupportInterface == ODM_ITRF_SDIO && pDM_Odm->PackageType >= 0x2) { + PHY_SetRFReg(pDM_Odm->Adapter, ODM_RF_PATH_A, RF_CHNLBW, bMask12Bits, LC_Cal); + } + + /* Restore original situation */ -+ if ((tmpReg&0x70) != 0) /* Deal with contisuous TX case */ -+ { ++ if ((tmpReg&0x70) != 0) { /* Deal with contisuous TX case */ + /* Path-A */ + rtw_write8(pDM_Odm->Adapter, 0xd03, tmpReg); + PHY_SetRFReg(pDM_Odm->Adapter, ODM_RF_PATH_A, RF_AC, bMask12Bits, RF_Amode); @@ -55052,11 +53384,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + /* Path-B */ + if (is2T) + PHY_SetRFReg(pDM_Odm->Adapter, ODM_RF_PATH_B, RF_AC, bMask12Bits, RF_Bmode); -+ } -+ else /* Deal with Packet TX case */ -+ { ++ } else /* Deal with Packet TX case */ + rtw_write8(pDM_Odm->Adapter, REG_TXPAUSE, 0x00); -+ } +} + +/* Analog Pre-distortion calibration */ @@ -55075,31 +53404,35 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + +/* IQK version:V2.5 20140123 */ +/* IQK is controlled by Is2ant, RF path */ -+void -+PHY_IQCalibrate_8723B( ++void PHY_IQCalibrate_8723B( + struct adapter *padapter, -+ bool bReCovery, -+ bool bRestore, -+ bool Is2ant, /* false:1ant, true:2-ant */ ++ bool bReCovery, ++ bool bRestore, ++ bool Is2ant, /* false:1ant, true:2-ant */ + u8 RF_Path /* 0:S1, 1:S0 */ -+ ) ++) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + -+ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; ++ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + -+ s32 result[4][8]; /* last is final result */ -+ u8 i, final_candidate, Indexforchannel; -+ bool bPathAOK, bPathBOK; -+ s32 RegE94, RegE9C, RegEA4, RegEAC, RegEB4, RegEBC, RegEC4, RegECC, RegTmp = 0; -+ bool is12simular, is13simular, is23simular; -+ bool bSingleTone = false, bCarrierSuppression = false; -+ u32 IQK_BB_REG_92C[IQK_BB_REG_NUM] = { -+ rOFDM0_XARxIQImbalance, rOFDM0_XBRxIQImbalance, -+ rOFDM0_ECCAThreshold, rOFDM0_AGCRSSITable, -+ rOFDM0_XATxIQImbalance, rOFDM0_XBTxIQImbalance, -+ rOFDM0_XCTxAFE, rOFDM0_XDTxAFE, -+ rOFDM0_RxIQExtAnta}; ++ s32 result[4][8]; /* last is final result */ ++ u8 i, final_candidate, Indexforchannel; ++ bool bPathAOK, bPathBOK; ++ s32 RegE94, RegE9C, RegEA4, RegEAC, RegEB4, RegEBC, RegEC4, RegECC, RegTmp = 0; ++ bool is12simular, is13simular, is23simular; ++ bool bSingleTone = false, bCarrierSuppression = false; ++ u32 IQK_BB_REG_92C[IQK_BB_REG_NUM] = { ++ rOFDM0_XARxIQImbalance, ++ rOFDM0_XBRxIQImbalance, ++ rOFDM0_ECCAThreshold, ++ rOFDM0_AGCRSSITable, ++ rOFDM0_XATxIQImbalance, ++ rOFDM0_XBTxIQImbalance, ++ rOFDM0_XCTxAFE, ++ rOFDM0_XDTxAFE, ++ rOFDM0_RxIQExtAnta ++ }; +/* u32 Path_SEL_BB = 0; */ + u32 GNT_BT_default; + u32 StartTime; @@ -55109,9 +53442,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + return; + + if (!(pDM_Odm->SupportAbility & ODM_RF_CALIBRATION)) -+ { + return; -+ } + + /* 20120213 Turn on when continuous Tx to pass lab testing. (required by Edlu) */ + if (bSingleTone || bCarrierSuppression) @@ -55138,7 +53469,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + offset = pRFCalibrateInfo->TxIQC_8723B[path][i][0]; + data = pRFCalibrateInfo->TxIQC_8723B[path][i][1]; + if ((offset == 0) || (data == 0)) { -+ DBG_871X("%s =>path:%s Restore TX IQK result failed\n", __func__, (path ==ODM_RF_PATH_A)?"A":"B"); ++ DBG_871X( ++ "%s =>path:%s Restore TX IQK result failed\n", ++ __func__, ++ (path == ODM_RF_PATH_A)?"A":"B" ++ ); + bResult = FAIL; + break; + } @@ -55151,7 +53486,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + offset = pRFCalibrateInfo->RxIQC_8723B[path][i][0]; + data = pRFCalibrateInfo->RxIQC_8723B[path][i][1]; + if ((offset == 0) || (data == 0)) { -+ DBG_871X("%s =>path:%s Restore RX IQK result failed\n", __func__, (path ==ODM_RF_PATH_A)?"A":"B"); ++ DBG_871X( ++ "%s =>path:%s Restore RX IQK result failed\n", ++ __func__, ++ (path == ODM_RF_PATH_A)?"A":"B" ++ ); + bResult = FAIL; + break; + } @@ -55171,8 +53510,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + return; + } + -+ if (bReCovery) -+ { ++ if (bReCovery) { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("PHY_IQCalibrate_8723B: Return due to bReCovery!\n")); + _PHY_ReloadADDARegisters8723B(padapter, IQK_BB_REG_92C, pDM_Odm->RFCalibrateInfo.IQK_BB_backup_recover, 9); + return; @@ -55191,13 +53529,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs +/* PHY_SetBBReg(pDM_Odm->Adapter, 0x764, BIT11, 0x1); */ + + -+ for (i = 0; i < 8; i++) -+ { ++ for (i = 0; i < 8; i++) { + result[0][i] = 0; + result[1][i] = 0; + result[2][i] = 0; + result[3][i] = 0; + } ++ + final_candidate = 0xff; + bPathAOK = false; + bPathBOK = false; @@ -55206,39 +53544,32 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + is13simular = false; + + -+ for (i = 0; i<3; i++) -+ { ++ for (i = 0; i < 3; i++) { + phy_IQCalibrate_8723B(padapter, result, i, Is2ant, RF_Path); + -+ if (i == 1) -+ { ++ if (i == 1) { + is12simular = phy_SimularityCompare_8723B(padapter, result, 0, 1); -+ if (is12simular) -+ { ++ if (is12simular) { + final_candidate = 0; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: is12simular final_candidate is %x\n", final_candidate)); + break; + } + } + -+ if (i == 2) -+ { ++ if (i == 2) { + is13simular = phy_SimularityCompare_8723B(padapter, result, 0, 2); -+ if (is13simular) -+ { ++ if (is13simular) { + final_candidate = 0; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: is13simular final_candidate is %x\n", final_candidate)); + + break; + } ++ + is23simular = phy_SimularityCompare_8723B(padapter, result, 1, 2); -+ if (is23simular) -+ { ++ if (is23simular) { + final_candidate = 1; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: is23simular final_candidate is %x\n", final_candidate)); -+ } -+ else -+ { ++ } else { + for (i = 0; i < 8; i++) + RegTmp += result[3][i]; + @@ -55251,8 +53582,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + } +/* RT_TRACE(COMP_INIT, DBG_LOUD, ("Release Mutex in IQCalibrate\n")); */ + -+ for (i = 0; i<4; i++) -+ { ++ for (i = 0; i < 4; i++) { + RegE94 = result[i][0]; + RegE9C = result[i][1]; + RegEA4 = result[i][2]; @@ -55264,8 +53594,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: RegE94 =%x RegE9C =%x RegEA4 =%x RegEAC =%x RegEB4 =%x RegEBC =%x RegEC4 =%x RegECC =%x\n ", RegE94, RegE9C, RegEA4, RegEAC, RegEB4, RegEBC, RegEC4, RegECC)); + } + -+ if (final_candidate != 0xff) -+ { ++ if (final_candidate != 0xff) { + pDM_Odm->RFCalibrateInfo.RegE94 = RegE94 = result[final_candidate][0]; + pDM_Odm->RFCalibrateInfo.RegE9C = RegE9C = result[final_candidate][1]; + RegEA4 = result[final_candidate][2]; @@ -55277,9 +53606,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: final_candidate is %x\n", final_candidate)); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: RegE94 =%x RegE9C =%x RegEA4 =%x RegEAC =%x RegEB4 =%x RegEBC =%x RegEC4 =%x RegECC =%x\n ", RegE94, RegE9C, RegEA4, RegEAC, RegEB4, RegEBC, RegEC4, RegECC)); + bPathAOK = bPathBOK = true; -+ } -+ else -+ { ++ } else { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("IQK: FAIL use default value\n")); + + pDM_Odm->RFCalibrateInfo.RegE94 = pDM_Odm->RFCalibrateInfo.RegEB4 = 0x100; /* X default value */ @@ -55288,23 +53615,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + + { + if (RegE94 != 0) -+ { + _PHY_PathAFillIQKMatrix8723B(padapter, bPathAOK, result, final_candidate, (RegEA4 == 0)); -+ } + } + { + if (RegEB4 != 0) -+ { + _PHY_PathBFillIQKMatrix8723B(padapter, bPathBOK, result, final_candidate, (RegEC4 == 0)); -+ } + } + + Indexforchannel = ODM_GetRightChnlPlaceforIQK(pHalData->CurrentChannel); + +/* To Fix BSOD when final_candidate is 0xff */ +/* by sherry 20120321 */ -+ if (final_candidate < 4) -+ { ++ if (final_candidate < 4) { + for (i = 0; i < IQK_Matrix_REG_NUM; i++) + pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[Indexforchannel].Value[0][i] = result[final_candidate][i]; + pDM_Odm->RFCalibrateInfo.IQKMatrixRegSetting[Indexforchannel].bIQKDone = true; @@ -55349,10 +53671,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs +} + + -+void -+PHY_LCCalibrate_8723B( -+ PDM_ODM_T pDM_Odm -+ ) ++void PHY_LCCalibrate_8723B(PDM_ODM_T pDM_Odm) +{ + bool bSingleTone = false, bCarrierSuppression = false; + u32 timeout = 2000, timecount = 0; @@ -55364,17 +53683,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs +#endif + + if (!(pDM_Odm->SupportAbility & ODM_RF_CALIBRATION)) -+ { + return; -+ } + + /* 20120213 Turn on when continuous Tx to pass lab testing. (required by Edlu) */ + if (bSingleTone || bCarrierSuppression) + return; + + StartTime = jiffies; -+ while (*(pDM_Odm->pbScanInProcess) && timecount < timeout) -+ { ++ while (*(pDM_Odm->pbScanInProcess) && timecount < timeout) { + mdelay(50); + timecount += 50; + } @@ -55391,10 +53707,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.c linux-4.3-rtl8723bs + ProgressingTime = jiffies_to_msecs(jiffies - StartTime); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("LCK ProgressingTime = %d\n", ProgressingTime)); +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.h ---- linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.h 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,100 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.h linux/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.h +--- linux.old/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.h 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,83 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -55421,84 +53737,67 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf_8723B.h linux-4.3-rtl8723bs +#define RF_T_METER_8723B 0x42 /* */ + + -+void ConfigureTxpowerTrack_8723B( -+ PTXPWRTRACK_CFG pConfig -+ ); ++void ConfigureTxpowerTrack_8723B(PTXPWRTRACK_CFG pConfig); + +void DoIQK_8723B( -+ PDM_ODM_T pDM_Odm, ++ PDM_ODM_T pDM_Odm, + u8 DeltaThermalIndex, + u8 ThermalValue, + u8 Threshold -+ ); ++); + -+void -+ODM_TxPwrTrackSetPwr_8723B( -+ PDM_ODM_T pDM_Odm, -+ PWRTRACK_METHOD Method, -+ u8 RFPath, -+ u8 ChannelMappedIndex -+ ); ++void ODM_TxPwrTrackSetPwr_8723B( ++ PDM_ODM_T pDM_Odm, ++ PWRTRACK_METHOD Method, ++ u8 RFPath, ++ u8 ChannelMappedIndex ++); + -+/* 1 7. IQK */ -+ -+void -+PHY_IQCalibrate_8723B( ++/* 1 7. IQK */ ++void PHY_IQCalibrate_8723B( + struct adapter *Adapter, -+ bool bReCovery, -+ bool bRestore, -+ bool Is2ant, -+ u8 RF_Path); ++ bool bReCovery, ++ bool bRestore, ++ bool Is2ant, ++ u8 RF_Path ++); + -+void -+ODM_SetIQCbyRFpath( -+ PDM_ODM_T pDM_Odm, -+ u32 RFpath -+ ); ++void ODM_SetIQCbyRFpath(PDM_ODM_T pDM_Odm, u32 RFpath); + +/* */ +/* LC calibrate */ +/* */ -+void -+PHY_LCCalibrate_8723B( -+ PDM_ODM_T pDM_Odm -+); ++void PHY_LCCalibrate_8723B(PDM_ODM_T pDM_Odm); + +/* */ +/* AP calibrate */ +/* */ -+void -+PHY_DigitalPredistortion_8723B(struct adapter *padapter); ++void PHY_DigitalPredistortion_8723B(struct adapter *padapter); + + -+void -+_PHY_SaveADDARegisters_8723B( ++void _PHY_SaveADDARegisters_8723B( + struct adapter *padapter, -+ u32 * ADDAReg, -+ u32 * ADDABackup, -+ u32 RegisterNum -+ ); ++ u32 *ADDAReg, ++ u32 *ADDABackup, ++ u32 RegisterNum ++); + -+void -+_PHY_PathADDAOn_8723B( ++void _PHY_PathADDAOn_8723B( + struct adapter *padapter, -+ u32 * ADDAReg, -+ bool isPathAOn, -+ bool is2T -+ ); ++ u32 *ADDAReg, ++ bool isPathAOn, ++ bool is2T ++); + -+void -+_PHY_MACSettingCalibration_8723B( -+ struct adapter *padapter, -+ u32 * MACReg, -+ u32 * MACBackup -+ ); ++void _PHY_MACSettingCalibration_8723B( ++ struct adapter *padapter, u32 *MACReg, u32 *MACBackup ++); + -+#endif /* #ifndef __HAL_PHY_RF_8188E_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalPhyRf.c ---- linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalPhyRf.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,394 @@ ++#endif /* #ifndef __HAL_PHY_RF_8188E_H__ */ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/HalPhyRf.c linux/3rdparty/rtl8723bs/hal/HalPhyRf.c +--- linux.old/3rdparty/rtl8723bs/hal/HalPhyRf.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/HalPhyRf.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,662 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -55518,26 +53817,21 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf.c linux-4.3-rtl8723bs/3rdpa +#include "odm_precomp.h" + + -+#define CALCULATE_SWINGTALBE_OFFSET(_offset, _direction, _size, _deltaThermal) \ -+ do {\ -+ for (_offset = 0; _offset < _size; _offset++)\ -+ {\ -+ if (_deltaThermal < thermalThreshold[_direction][_offset])\ -+ {\ -+ if (_offset != 0)\ -+ _offset--;\ -+ break;\ -+ }\ -+ } \ -+ if (_offset >= _size)\ -+ _offset = _size-1;\ -+ } while (0) ++#define CALCULATE_SWINGTALBE_OFFSET(_offset, _direction, _size, _deltaThermal) \ ++ do {\ ++ for (_offset = 0; _offset < _size; _offset++) {\ ++ if (_deltaThermal < thermalThreshold[_direction][_offset]) {\ ++ if (_offset != 0)\ ++ _offset--;\ ++ break;\ ++ } \ ++ } \ ++ if (_offset >= _size)\ ++ _offset = _size-1;\ ++ } while (0) + + -+void ConfigureTxpowerTrack( -+PDM_ODM_T pDM_Odm, -+ PTXPWRTRACK_CFG pConfig -+ ) ++void ConfigureTxpowerTrack(PDM_ODM_T pDM_Odm, PTXPWRTRACK_CFG pConfig) +{ + ConfigureTxpowerTrack_8723B(pConfig); +} @@ -55550,20 +53844,16 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf.c linux-4.3-rtl8723bs/3rdpa +/* NOTE: If Tx BB swing or Tx scaling is varified during run-time, still */ +/* need to call this function. */ +/* */ -+void -+ODM_ClearTxPowerTrackingState( -+ PDM_ODM_T pDM_Odm -+ ) ++void ODM_ClearTxPowerTrackingState(PDM_ODM_T pDM_Odm) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(pDM_Odm->Adapter); -+ u8 p = 0; ++ u8 p = 0; + + pDM_Odm->BbSwingIdxCckBase = pDM_Odm->DefaultCckIndex; + pDM_Odm->BbSwingIdxCck = pDM_Odm->DefaultCckIndex; + pDM_Odm->RFCalibrateInfo.CCK_index = 0; + -+ for (p = ODM_RF_PATH_A; p < MAX_RF_PATH; ++p) -+ { ++ for (p = ODM_RF_PATH_A; p < MAX_RF_PATH; ++p) { + pDM_Odm->BbSwingIdxOfdmBase[p] = pDM_Odm->DefaultOfdmIndex; + pDM_Odm->BbSwingIdxOfdm[p] = pDM_Odm->DefaultOfdmIndex; + pDM_Odm->RFCalibrateInfo.OFDM_index[p] = pDM_Odm->DefaultOfdmIndex; @@ -55573,67 +53863,87 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf.c linux-4.3-rtl8723bs/3rdpa + pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[p] = 0; + pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p] = 0; + -+ pDM_Odm->Absolute_OFDMSwingIdx[p] = 0; /* Initial Mix mode power tracking */ ++ /* Initial Mix mode power tracking */ ++ pDM_Odm->Absolute_OFDMSwingIdx[p] = 0; + pDM_Odm->Remnant_OFDMSwingIdx[p] = 0; + } + -+ pDM_Odm->Modify_TxAGC_Flag_PathA = false; /* Initial at Modify Tx Scaling Mode */ -+ pDM_Odm->Modify_TxAGC_Flag_PathB = false; /* Initial at Modify Tx Scaling Mode */ ++ /* Initial at Modify Tx Scaling Mode */ ++ pDM_Odm->Modify_TxAGC_Flag_PathA = false; ++ /* Initial at Modify Tx Scaling Mode */ ++ pDM_Odm->Modify_TxAGC_Flag_PathB = false; + pDM_Odm->Remnant_CCKSwingIdx = 0; + pDM_Odm->RFCalibrateInfo.ThermalValue = pHalData->EEPROMThermalMeter; + pDM_Odm->RFCalibrateInfo.ThermalValue_IQK = pHalData->EEPROMThermalMeter; + pDM_Odm->RFCalibrateInfo.ThermalValue_LCK = pHalData->EEPROMThermalMeter; +} + -+void -+ODM_TXPowerTrackingCallback_ThermalMeter( -+ struct adapter *Adapter -+ ) ++void ODM_TXPowerTrackingCallback_ThermalMeter(struct adapter *Adapter) +{ + -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); -+ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + -+ u8 ThermalValue = 0, delta, delta_LCK, delta_IQK, p = 0, i = 0; -+ u8 ThermalValue_AVG_count = 0; -+ u32 ThermalValue_AVG = 0; ++ u8 ThermalValue = 0, delta, delta_LCK, delta_IQK, p = 0, i = 0; ++ u8 ThermalValue_AVG_count = 0; ++ u32 ThermalValue_AVG = 0; + -+ u8 OFDM_min_index = 0; /* OFDM BB Swing should be less than +3.0dB, which is required by Arthur */ -+ u8 Indexforchannel = 0; /* GetRightChnlPlaceforIQK(pHalData->CurrentChannel) */ ++ u8 OFDM_min_index = 0; /* OFDM BB Swing should be less than +3.0dB, which is required by Arthur */ ++ u8 Indexforchannel = 0; /* GetRightChnlPlaceforIQK(pHalData->CurrentChannel) */ + -+ TXPWRTRACK_CFG c; ++ TXPWRTRACK_CFG c; + + + /* 4 1. The following TWO tables decide the final index of OFDM/CCK swing table. */ -+ u8 * deltaSwingTableIdx_TUP_A; -+ u8 * deltaSwingTableIdx_TDOWN_A; -+ u8 * deltaSwingTableIdx_TUP_B; -+ u8 * deltaSwingTableIdx_TDOWN_B; ++ u8 *deltaSwingTableIdx_TUP_A; ++ u8 *deltaSwingTableIdx_TDOWN_A; ++ u8 *deltaSwingTableIdx_TUP_B; ++ u8 *deltaSwingTableIdx_TDOWN_B; + + /* 4 2. Initilization (7 steps in total) */ + + ConfigureTxpowerTrack(pDM_Odm, &c); + -+ (*c.GetDeltaSwingTable)(pDM_Odm, (u8 **)&deltaSwingTableIdx_TUP_A, (u8 **)&deltaSwingTableIdx_TDOWN_A, -+ (u8 **)&deltaSwingTableIdx_TUP_B, (u8 **)&deltaSwingTableIdx_TDOWN_B); ++ (*c.GetDeltaSwingTable)( ++ pDM_Odm, ++ (u8 **)&deltaSwingTableIdx_TUP_A, ++ (u8 **)&deltaSwingTableIdx_TDOWN_A, ++ (u8 **)&deltaSwingTableIdx_TUP_B, ++ (u8 **)&deltaSwingTableIdx_TDOWN_B ++ ); + -+ pDM_Odm->RFCalibrateInfo.TXPowerTrackingCallbackCnt++; /* cosa add for debug */ ++ /* cosa add for debug */ ++ pDM_Odm->RFCalibrateInfo.TXPowerTrackingCallbackCnt++; + pDM_Odm->RFCalibrateInfo.bTXPowerTrackingInit = true; + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, -+ ("===>ODM_TXPowerTrackingCallback_ThermalMeter, \ -+ \n pDM_Odm->BbSwingIdxCckBase: %d, pDM_Odm->BbSwingIdxOfdmBase[A]: %d, pDM_Odm->DefaultOfdmIndex: %d\n", -+ pDM_Odm->BbSwingIdxCckBase, pDM_Odm->BbSwingIdxOfdmBase[ODM_RF_PATH_A], pDM_Odm->DefaultOfdmIndex)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "===>ODM_TXPowerTrackingCallback_ThermalMeter,\npDM_Odm->BbSwingIdxCckBase: %d, pDM_Odm->BbSwingIdxOfdmBase[A]: %d, pDM_Odm->DefaultOfdmIndex: %d\n", ++ pDM_Odm->BbSwingIdxCckBase, ++ pDM_Odm->BbSwingIdxOfdmBase[ODM_RF_PATH_A], ++ pDM_Odm->DefaultOfdmIndex ++ ) ++ ); + + ThermalValue = (u8)PHY_QueryRFReg(pDM_Odm->Adapter, ODM_RF_PATH_A, c.ThermalRegAddr, 0xfc00); /* 0x42: RF Reg[15:10] 88E */ -+ if (! pDM_Odm->RFCalibrateInfo.TxPowerTrackControl || pHalData->EEPROMThermalMeter == 0 || -+ pHalData->EEPROMThermalMeter == 0xFF) ++ if ( ++ !pDM_Odm->RFCalibrateInfo.TxPowerTrackControl || ++ pHalData->EEPROMThermalMeter == 0 || ++ pHalData->EEPROMThermalMeter == 0xFF ++ ) + return; + + /* 4 3. Initialize ThermalValues of RFCalibrateInfo */ + + if (pDM_Odm->RFCalibrateInfo.bReloadtxpowerindex) -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("reload ofdm index for band switch\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ++ ("reload ofdm index for band switch\n") ++ ); + + /* 4 4. Calculate average thermal meter */ + @@ -55649,156 +53959,337 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf.c linux-4.3-rtl8723bs/3rdpa + } + } + -+ if (ThermalValue_AVG_count) /* Calculate Average ThermalValue after average enough times */ -+ { ++ /* Calculate Average ThermalValue after average enough times */ ++ if (ThermalValue_AVG_count) { + ThermalValue = (u8)(ThermalValue_AVG / ThermalValue_AVG_count); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, -+ ("AVG Thermal Meter = 0x%X, EFUSE Thermal Base = 0x%X\n", ThermalValue, pHalData->EEPROMThermalMeter)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "AVG Thermal Meter = 0x%X, EFUSE Thermal Base = 0x%X\n", ++ ThermalValue, ++ pHalData->EEPROMThermalMeter ++ ) ++ ); + } + + /* 4 5. Calculate delta, delta_LCK, delta_IQK. */ -+ + /* delta" here is used to determine whether thermal value changes or not. */ -+ delta = (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue)?(ThermalValue - pDM_Odm->RFCalibrateInfo.ThermalValue):(pDM_Odm->RFCalibrateInfo.ThermalValue - ThermalValue); -+ delta_LCK = (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue_LCK)?(ThermalValue - pDM_Odm->RFCalibrateInfo.ThermalValue_LCK):(pDM_Odm->RFCalibrateInfo.ThermalValue_LCK - ThermalValue); -+ delta_IQK = (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue_IQK)?(ThermalValue - pDM_Odm->RFCalibrateInfo.ThermalValue_IQK):(pDM_Odm->RFCalibrateInfo.ThermalValue_IQK - ThermalValue); ++ delta = ++ (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue) ? ++ (ThermalValue - pDM_Odm->RFCalibrateInfo.ThermalValue) : ++ (pDM_Odm->RFCalibrateInfo.ThermalValue - ThermalValue); ++ delta_LCK = ++ (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue_LCK) ? ++ (ThermalValue - pDM_Odm->RFCalibrateInfo.ThermalValue_LCK) : ++ (pDM_Odm->RFCalibrateInfo.ThermalValue_LCK - ThermalValue); ++ delta_IQK = ++ (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue_IQK) ? ++ (ThermalValue - pDM_Odm->RFCalibrateInfo.ThermalValue_IQK) : ++ (pDM_Odm->RFCalibrateInfo.ThermalValue_IQK - ThermalValue); + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("(delta, delta_LCK, delta_IQK) = (%d, %d, %d)\n", delta, delta_LCK, delta_IQK)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "(delta, delta_LCK, delta_IQK) = (%d, %d, %d)\n", ++ delta, ++ delta_LCK, ++ delta_IQK ++ ) ++ ); + + /* 4 6. If necessary, do LCK. */ -+ -+ if ((delta_LCK >= c.Threshold_IQK)) /* Delta temperature is equal to or larger than 20 centigrade. */ -+ { -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("delta_LCK(%d) >= Threshold_IQK(%d)\n", delta_LCK, c.Threshold_IQK)); ++ /* Delta temperature is equal to or larger than 20 centigrade. */ ++ if (delta_LCK >= c.Threshold_IQK) { ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "delta_LCK(%d) >= Threshold_IQK(%d)\n", ++ delta_LCK, ++ c.Threshold_IQK ++ ) ++ ); + pDM_Odm->RFCalibrateInfo.ThermalValue_LCK = ThermalValue; + if (c.PHY_LCCalibrate) + (*c.PHY_LCCalibrate)(pDM_Odm); + } + + /* 3 7. If necessary, move the index of swing table to adjust Tx power. */ -+ + if (delta > 0 && pDM_Odm->RFCalibrateInfo.TxPowerTrackControl) { + /* delta" here is used to record the absolute value of differrence. */ -+ delta = ThermalValue > pHalData->EEPROMThermalMeter?(ThermalValue - pHalData->EEPROMThermalMeter):(pHalData->EEPROMThermalMeter - ThermalValue); ++ delta = ++ ThermalValue > pHalData->EEPROMThermalMeter ? ++ (ThermalValue - pHalData->EEPROMThermalMeter) : ++ (pHalData->EEPROMThermalMeter - ThermalValue); ++ + if (delta >= TXPWR_TRACK_TABLE_SIZE) + delta = TXPWR_TRACK_TABLE_SIZE - 1; + + /* 4 7.1 The Final Power Index = BaseIndex + PowerIndexOffset */ -+ + if (ThermalValue > pHalData->EEPROMThermalMeter) { -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, -+ ("deltaSwingTableIdx_TUP_A[%d] = %d\n", delta, deltaSwingTableIdx_TUP_A[delta])); -+ pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[ODM_RF_PATH_A] = pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[ODM_RF_PATH_A]; -+ pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[ODM_RF_PATH_A] = deltaSwingTableIdx_TUP_A[delta]; ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "deltaSwingTableIdx_TUP_A[%d] = %d\n", ++ delta, ++ deltaSwingTableIdx_TUP_A[delta] ++ ) ++ ); ++ pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[ODM_RF_PATH_A] = ++ pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[ODM_RF_PATH_A]; ++ pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[ODM_RF_PATH_A] = ++ deltaSwingTableIdx_TUP_A[delta]; + -+ pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_A] = deltaSwingTableIdx_TUP_A[delta]; /* Record delta swing for mix mode power tracking */ ++ /* Record delta swing for mix mode power tracking */ ++ pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_A] = ++ deltaSwingTableIdx_TUP_A[delta]; + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("******Temp is higher and pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_A] = %d\n", pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_A])); -+ -+ if (c.RfPathCount > 1) -+ { -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, -+ ("deltaSwingTableIdx_TUP_B[%d] = %d\n", delta, deltaSwingTableIdx_TUP_B[delta])); -+ pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[ODM_RF_PATH_B] = pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[ODM_RF_PATH_B]; -+ pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[ODM_RF_PATH_B] = deltaSwingTableIdx_TUP_B[delta]; -+ -+ pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_B] = deltaSwingTableIdx_TUP_B[delta]; /* Record delta swing for mix mode power tracking */ -+ -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("******Temp is higher and pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_B] = %d\n", pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_B])); -+ } -+ -+ } else { -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, -+ ("deltaSwingTableIdx_TDOWN_A[%d] = %d\n", delta, deltaSwingTableIdx_TDOWN_A[delta])); -+ -+ pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[ODM_RF_PATH_A] = pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[ODM_RF_PATH_A]; -+ pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[ODM_RF_PATH_A] = -1 * deltaSwingTableIdx_TDOWN_A[delta]; -+ -+ pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_A] = -1 * deltaSwingTableIdx_TDOWN_A[delta]; /* Record delta swing for mix mode power tracking */ -+ -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("******Temp is lower and pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_A] = %d\n", pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_A])); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "******Temp is higher and pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_A] = %d\n", ++ pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_A] ++ ) ++ ); + + if (c.RfPathCount > 1) { -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, -+ ("deltaSwingTableIdx_TDOWN_B[%d] = %d\n", delta, deltaSwingTableIdx_TDOWN_B[delta])); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "deltaSwingTableIdx_TUP_B[%d] = %d\n", ++ delta, ++ deltaSwingTableIdx_TUP_B[delta] ++ ) ++ ); ++ pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[ODM_RF_PATH_B] = ++ pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[ODM_RF_PATH_B]; ++ pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[ODM_RF_PATH_B] = ++ deltaSwingTableIdx_TUP_B[delta]; + -+ pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[ODM_RF_PATH_B] = pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[ODM_RF_PATH_B]; -+ pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[ODM_RF_PATH_B] = -1 * deltaSwingTableIdx_TDOWN_B[delta]; ++ /* Record delta swing for mix mode power tracking */ ++ pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_B] = ++ deltaSwingTableIdx_TUP_B[delta]; ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "******Temp is higher and pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_B] = %d\n", ++ pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_B] ++ ) ++ ); ++ } + -+ pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_B] = -1 * deltaSwingTableIdx_TDOWN_B[delta]; /* Record delta swing for mix mode power tracking */ ++ } else { ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "deltaSwingTableIdx_TDOWN_A[%d] = %d\n", ++ delta, ++ deltaSwingTableIdx_TDOWN_A[delta] ++ ) ++ ); + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("******Temp is lower and pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_B] = %d\n", pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_B])); -+ } -+ } ++ pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[ODM_RF_PATH_A] = ++ pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[ODM_RF_PATH_A]; ++ pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[ODM_RF_PATH_A] = ++ -1 * deltaSwingTableIdx_TDOWN_A[delta]; ++ ++ /* Record delta swing for mix mode power tracking */ ++ pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_A] = ++ -1 * deltaSwingTableIdx_TDOWN_A[delta]; ++ ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "******Temp is lower and pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_A] = %d\n", ++ pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_A] ++ ) ++ ); ++ ++ if (c.RfPathCount > 1) { ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "deltaSwingTableIdx_TDOWN_B[%d] = %d\n", ++ delta, ++ deltaSwingTableIdx_TDOWN_B[delta] ++ ) ++ ); ++ ++ pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[ODM_RF_PATH_B] = ++ pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[ODM_RF_PATH_B]; ++ pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[ODM_RF_PATH_B] = ++ -1 * deltaSwingTableIdx_TDOWN_B[delta]; ++ ++ /* Record delta swing for mix mode power tracking */ ++ pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_B] = ++ -1 * deltaSwingTableIdx_TDOWN_B[delta]; ++ ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "******Temp is lower and pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_B] = %d\n", ++ pDM_Odm->Absolute_OFDMSwingIdx[ODM_RF_PATH_B] ++ ) ++ ); ++ } ++ } + + for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++) { -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, -+ ("\n\n ================================ [Path-%c] Calculating PowerIndexOffset ================================\n", (p == ODM_RF_PATH_A ? 'A' : 'B'))); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "\n\n ================================ [Path-%c] Calculating PowerIndexOffset ================================\n", ++ (p == ODM_RF_PATH_A ? 'A' : 'B') ++ ) ++ ); + -+ if (pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p] == pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[p]) /* If Thermal value changes but lookup table value still the same */ ++ if ( ++ pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p] == ++ pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[p] ++ ) /* If Thermal value changes but lookup table value still the same */ + pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p] = 0; + else + pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p] = pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p] - pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[p]; /* Power Index Diff between 2 times Power Tracking */ + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("[Path-%c] PowerIndexOffset(%d) = DeltaPowerIndex(%d) - DeltaPowerIndexLast(%d)\n", -+ (p == ODM_RF_PATH_A ? 'A' : 'B'), pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p], pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p], -+ pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[p])); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "[Path-%c] PowerIndexOffset(%d) = DeltaPowerIndex(%d) - DeltaPowerIndexLast(%d)\n", ++ ( ++ p == ODM_RF_PATH_A ? 'A' : 'B'), ++ pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p], ++ pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p], ++ pDM_Odm->RFCalibrateInfo.DeltaPowerIndexLast[p] ++ ) ++ ); + -+ pDM_Odm->RFCalibrateInfo.OFDM_index[p] = pDM_Odm->BbSwingIdxOfdmBase[p] + pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p]; -+ pDM_Odm->RFCalibrateInfo.CCK_index = pDM_Odm->BbSwingIdxCckBase + pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p]; ++ pDM_Odm->RFCalibrateInfo.OFDM_index[p] = ++ pDM_Odm->BbSwingIdxOfdmBase[p] + ++ pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p]; + -+ pDM_Odm->BbSwingIdxCck = pDM_Odm->RFCalibrateInfo.CCK_index; -+ pDM_Odm->BbSwingIdxOfdm[p] = pDM_Odm->RFCalibrateInfo.OFDM_index[p]; ++ pDM_Odm->RFCalibrateInfo.CCK_index = ++ pDM_Odm->BbSwingIdxCckBase + ++ pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p]; ++ ++ pDM_Odm->BbSwingIdxCck = ++ pDM_Odm->RFCalibrateInfo.CCK_index; ++ ++ pDM_Odm->BbSwingIdxOfdm[p] = ++ pDM_Odm->RFCalibrateInfo.OFDM_index[p]; + + /* *************Print BB Swing Base and Index Offset************* */ ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "The 'CCK' final index(%d) = BaseIndex(%d) + PowerIndexOffset(%d)\n", ++ pDM_Odm->BbSwingIdxCck, ++ pDM_Odm->BbSwingIdxCckBase, ++ pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p] ++ ) ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "The 'OFDM' final index(%d) = BaseIndex[%c](%d) + PowerIndexOffset(%d)\n", ++ pDM_Odm->BbSwingIdxOfdm[p], ++ (p == ODM_RF_PATH_A ? 'A' : 'B'), ++ pDM_Odm->BbSwingIdxOfdmBase[p], ++ pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p] ++ ) ++ ); + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("The 'CCK' final index(%d) = BaseIndex(%d) + PowerIndexOffset(%d)\n", -+ pDM_Odm->BbSwingIdxCck, pDM_Odm->BbSwingIdxCckBase, pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p])); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("The 'OFDM' final index(%d) = BaseIndex[%c](%d) + PowerIndexOffset(%d)\n", -+ pDM_Odm->BbSwingIdxOfdm[p], (p == ODM_RF_PATH_A ? 'A' : 'B'), pDM_Odm->BbSwingIdxOfdmBase[p], pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p])); -+ -+ /* 4 7.1 Handle boundary conditions of index. */ -+ -+ ++ /* 4 7.1 Handle boundary conditions of index. */ + if (pDM_Odm->RFCalibrateInfo.OFDM_index[p] > c.SwingTableSize_OFDM-1) -+ { + pDM_Odm->RFCalibrateInfo.OFDM_index[p] = c.SwingTableSize_OFDM-1; -+ } + else if (pDM_Odm->RFCalibrateInfo.OFDM_index[p] < OFDM_min_index) -+ { + pDM_Odm->RFCalibrateInfo.OFDM_index[p] = OFDM_min_index; -+ } + } -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, -+ ("\n\n ========================================================================================================\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ("\n\n ========================================================================================================\n") ++ ); + if (pDM_Odm->RFCalibrateInfo.CCK_index > c.SwingTableSize_CCK-1) + pDM_Odm->RFCalibrateInfo.CCK_index = c.SwingTableSize_CCK-1; + /* else if (pDM_Odm->RFCalibrateInfo.CCK_index < 0) */ + /* pDM_Odm->RFCalibrateInfo.CCK_index = 0; */ -+ } -+ else -+ { -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, -+ ("The thermal meter is unchanged or TxPowerTracking OFF(%d): ThermalValue: %d , pDM_Odm->RFCalibrateInfo.ThermalValue: %d\n", -+ pDM_Odm->RFCalibrateInfo.TxPowerTrackControl, ThermalValue, pDM_Odm->RFCalibrateInfo.ThermalValue)); ++ } else { ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "The thermal meter is unchanged or TxPowerTracking OFF(%d): ThermalValue: %d , pDM_Odm->RFCalibrateInfo.ThermalValue: %d\n", ++ pDM_Odm->RFCalibrateInfo.TxPowerTrackControl, ++ ThermalValue, ++ pDM_Odm->RFCalibrateInfo.ThermalValue ++ ) ++ ); + -+ for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++) -+ pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p] = 0; ++ for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++) ++ pDM_Odm->RFCalibrateInfo.PowerIndexOffset[p] = 0; + } -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, -+ ("TxPowerTracking: [CCK] Swing Current Index: %d, Swing Base Index: %d\n", -+ pDM_Odm->RFCalibrateInfo.CCK_index, pDM_Odm->BbSwingIdxCckBase)); /* Print Swing base & current */ -+ for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++) -+ { -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, -+ ("TxPowerTracking: [OFDM] Swing Current Index: %d, Swing Base Index[%c]: %d\n", -+ pDM_Odm->RFCalibrateInfo.OFDM_index[p], (p == ODM_RF_PATH_A ? 'A' : 'B'), pDM_Odm->BbSwingIdxOfdmBase[p])); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "TxPowerTracking: [CCK] Swing Current Index: %d, Swing Base Index: %d\n", ++ pDM_Odm->RFCalibrateInfo.CCK_index, ++ pDM_Odm->BbSwingIdxCckBase ++ ) ++ ); ++ ++ /* Print Swing base & current */ ++ for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++) { ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "TxPowerTracking: [OFDM] Swing Current Index: %d, Swing Base Index[%c]: %d\n", ++ pDM_Odm->RFCalibrateInfo.OFDM_index[p], ++ (p == ODM_RF_PATH_A ? 'A' : 'B'), ++ pDM_Odm->BbSwingIdxOfdmBase[p] ++ ) ++ ); + } + -+ if ((pDM_Odm->RFCalibrateInfo.PowerIndexOffset[ODM_RF_PATH_A] != 0 || ++ if ( ++ (pDM_Odm->RFCalibrateInfo.PowerIndexOffset[ODM_RF_PATH_A] != 0 || + pDM_Odm->RFCalibrateInfo.PowerIndexOffset[ODM_RF_PATH_B] != 0) && -+ pDM_Odm->RFCalibrateInfo.TxPowerTrackControl) -+ { ++ pDM_Odm->RFCalibrateInfo.TxPowerTrackControl ++ ) { + /* 4 7.2 Configure the Swing Table to adjust Tx Power. */ + + pDM_Odm->RFCalibrateInfo.bTxPowerChanged = true; /* Always true after Tx Power is adjusted by power tracking. */ @@ -55807,61 +54298,135 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf.c linux-4.3-rtl8723bs/3rdpa + /* to increase TX power. Otherwise, EVM will be bad. */ + /* */ + /* 2012/04/25 MH Add for tx power tracking to set tx power in tx agc for 88E. */ -+ if (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue) -+ { -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, -+ ("Temperature Increasing(A): delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n", -+ pDM_Odm->RFCalibrateInfo.PowerIndexOffset[ODM_RF_PATH_A], delta, ThermalValue, pHalData->EEPROMThermalMeter, pDM_Odm->RFCalibrateInfo.ThermalValue)); ++ if (ThermalValue > pDM_Odm->RFCalibrateInfo.ThermalValue) { ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "Temperature Increasing(A): delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n", ++ pDM_Odm->RFCalibrateInfo.PowerIndexOffset[ODM_RF_PATH_A], ++ delta, ++ ThermalValue, ++ pHalData->EEPROMThermalMeter, ++ pDM_Odm->RFCalibrateInfo.ThermalValue ++ ) ++ ); + + if (c.RfPathCount > 1) -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, -+ ("Temperature Increasing(B): delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n", -+ pDM_Odm->RFCalibrateInfo.PowerIndexOffset[ODM_RF_PATH_B], delta, ThermalValue, pHalData->EEPROMThermalMeter, pDM_Odm->RFCalibrateInfo.ThermalValue)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "Temperature Increasing(B): delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n", ++ pDM_Odm->RFCalibrateInfo.PowerIndexOffset[ODM_RF_PATH_B], ++ delta, ++ ThermalValue, ++ pHalData->EEPROMThermalMeter, ++ pDM_Odm->RFCalibrateInfo.ThermalValue ++ ) ++ ); + -+ } -+ else if (ThermalValue < pDM_Odm->RFCalibrateInfo.ThermalValue)/* Low temperature */ -+ { -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, -+ ("Temperature Decreasing(A): delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n", -+ pDM_Odm->RFCalibrateInfo.PowerIndexOffset[ODM_RF_PATH_A], delta, ThermalValue, pHalData->EEPROMThermalMeter, pDM_Odm->RFCalibrateInfo.ThermalValue)); ++ } else if (ThermalValue < pDM_Odm->RFCalibrateInfo.ThermalValue) { /* Low temperature */ ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "Temperature Decreasing(A): delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n", ++ pDM_Odm->RFCalibrateInfo.PowerIndexOffset[ODM_RF_PATH_A], ++ delta, ++ ThermalValue, ++ pHalData->EEPROMThermalMeter, ++ pDM_Odm->RFCalibrateInfo.ThermalValue ++ ) ++ ); + + if (c.RfPathCount > 1) -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, -+ ("Temperature Decreasing(B): delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n", -+ pDM_Odm->RFCalibrateInfo.PowerIndexOffset[ODM_RF_PATH_B], delta, ThermalValue, pHalData->EEPROMThermalMeter, pDM_Odm->RFCalibrateInfo.ThermalValue)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "Temperature Decreasing(B): delta_pi: %d , delta_t: %d, Now_t: %d, EFUSE_t: %d, Last_t: %d\n", ++ pDM_Odm->RFCalibrateInfo.PowerIndexOffset[ODM_RF_PATH_B], ++ delta, ++ ThermalValue, ++ pHalData->EEPROMThermalMeter, ++ pDM_Odm->RFCalibrateInfo.ThermalValue ++ ) ++ ); + + } -+ if (ThermalValue > pHalData->EEPROMThermalMeter) -+ { -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, -+ ("Temperature(%d) higher than PG value(%d)\n", ThermalValue, pHalData->EEPROMThermalMeter)); + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking MIX_MODE**********\n")); ++ if (ThermalValue > pHalData->EEPROMThermalMeter) { ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "Temperature(%d) higher than PG value(%d)\n", ++ ThermalValue, ++ pHalData->EEPROMThermalMeter ++ ) ++ ); ++ ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ("**********Enter POWER Tracking MIX_MODE**********\n") ++ ); + for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++) + (*c.ODM_TxPwrTrackSetPwr)(pDM_Odm, MIX_MODE, p, 0); -+ } -+ else -+ { -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, -+ ("Temperature(%d) lower than PG value(%d)\n", ThermalValue, pHalData->EEPROMThermalMeter)); ++ } else { ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ( ++ "Temperature(%d) lower than PG value(%d)\n", ++ ThermalValue, ++ pHalData->EEPROMThermalMeter ++ ) ++ ); + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("**********Enter POWER Tracking MIX_MODE**********\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ("**********Enter POWER Tracking MIX_MODE**********\n") ++ ); + for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++) + (*c.ODM_TxPwrTrackSetPwr)(pDM_Odm, MIX_MODE, p, Indexforchannel); + } + -+ pDM_Odm->BbSwingIdxCckBase = pDM_Odm->BbSwingIdxCck; /* Record last time Power Tracking result as base. */ ++ /* Record last time Power Tracking result as base. */ ++ pDM_Odm->BbSwingIdxCckBase = pDM_Odm->BbSwingIdxCck; + for (p = ODM_RF_PATH_A; p < c.RfPathCount; p++) -+ pDM_Odm->BbSwingIdxOfdmBase[p] = pDM_Odm->BbSwingIdxOfdm[p]; ++ pDM_Odm->BbSwingIdxOfdmBase[p] = pDM_Odm->BbSwingIdxOfdm[p]; + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, -+ ("pDM_Odm->RFCalibrateInfo.ThermalValue = %d ThermalValue = %d\n", pDM_Odm->RFCalibrateInfo.ThermalValue, ThermalValue)); -+ -+ pDM_Odm->RFCalibrateInfo.ThermalValue = ThermalValue; /* Record last Power Tracking Thermal Value */ ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ++ ( ++ "pDM_Odm->RFCalibrateInfo.ThermalValue = %d ThermalValue = %d\n", ++ pDM_Odm->RFCalibrateInfo.ThermalValue, ++ ThermalValue ++ ) ++ ); + ++ /* Record last Power Tracking Thermal Value */ ++ pDM_Odm->RFCalibrateInfo.ThermalValue = ThermalValue; + } + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_TX_PWR_TRACK, ODM_DBG_LOUD, ("<===ODM_TXPowerTrackingCallback_ThermalMeter\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_TX_PWR_TRACK, ++ ODM_DBG_LOUD, ++ ("<===ODM_TXPowerTrackingCallback_ThermalMeter\n") ++ ); + + pDM_Odm->RFCalibrateInfo.TXPowercount = 0; +} @@ -55875,28 +54440,30 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf.c linux-4.3-rtl8723bs/3rdpa + +u8 ODM_GetRightChnlPlaceforIQK(u8 chnl) +{ -+ u8 channel_all[ODM_TARGET_CHNL_NUM_2G_5G] = -+ {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 149, 151, 153, 155, 157, 159, 161, 163, 165}; ++ u8 channel_all[ODM_TARGET_CHNL_NUM_2G_5G] = { ++ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ++ 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, ++ 60, 62, 64, 100, 102, 104, 106, 108, 110, 112, ++ 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, ++ 134, 136, 138, 140, 149, 151, 153, 155, 157, 159, ++ 161, 163, 165 ++ }; + u8 place = chnl; + + -+ if (chnl > 14) -+ { -+ for (place = 14; place 14) { ++ for (place = 14; place < sizeof(channel_all); place++) { + if (channel_all[place] == chnl) -+ { + return place-13; -+ } + } + } + return 0; + +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalPhyRf.h ---- linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalPhyRf.h 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,75 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/HalPhyRf.h linux/3rdparty/rtl8723bs/hal/HalPhyRf.h +--- linux.old/3rdparty/rtl8723bs/hal/HalPhyRf.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/HalPhyRf.h 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,63 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -55937,45 +54504,33 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPhyRf.h linux-4.3-rtl8723bs/3rdpa + u8 Threshold_IQK; + u8 AverageThermalNum; + u8 RfPathCount; -+ u32 ThermalRegAddr; -+ FuncSetPwr ODM_TxPwrTrackSetPwr; -+ FuncIQK DoIQK; -+ FuncLCK PHY_LCCalibrate; -+ FuncSwing GetDeltaSwingTable; ++ u32 ThermalRegAddr; ++ FuncSetPwr ODM_TxPwrTrackSetPwr; ++ FuncIQK DoIQK; ++ FuncLCK PHY_LCCalibrate; ++ FuncSwing GetDeltaSwingTable; +} TXPWRTRACK_CFG, *PTXPWRTRACK_CFG; + -+void ConfigureTxpowerTrack( -+ PDM_ODM_T pDM_Odm, -+ PTXPWRTRACK_CFG pConfig -+ ); ++void ConfigureTxpowerTrack(PDM_ODM_T pDM_Odm, PTXPWRTRACK_CFG pConfig); + + -+void -+ODM_ClearTxPowerTrackingState( -+ PDM_ODM_T pDM_Odm -+ ); ++void ODM_ClearTxPowerTrackingState(PDM_ODM_T pDM_Odm); + -+void -+ODM_TXPowerTrackingCallback_ThermalMeter( -+ struct adapter *Adapter -+ ); ++void ODM_TXPowerTrackingCallback_ThermalMeter(struct adapter *Adapter); + + + -+#define ODM_TARGET_CHNL_NUM_2G_5G 59 ++#define ODM_TARGET_CHNL_NUM_2G_5G 59 + + -+u8 -+ODM_GetRightChnlPlaceforIQK( -+ u8 chnl -+); ++u8 ODM_GetRightChnlPlaceforIQK(u8 chnl); + + +#endif /* #ifndef __HAL_PHY_RF_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPwrSeqCmd.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalPwrSeqCmd.c ---- linux-4.3/3rdparty/rtl8723bs/hal/HalPwrSeqCmd.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/HalPwrSeqCmd.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,166 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/HalPwrSeqCmd.c linux/3rdparty/rtl8723bs/hal/HalPwrSeqCmd.c +--- linux.old/3rdparty/rtl8723bs/hal/HalPwrSeqCmd.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/HalPwrSeqCmd.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,205 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -56012,140 +54567,179 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/HalPwrSeqCmd.c linux-4.3-rtl8723bs/3 + + +/* */ -+/* Description: */ -+/* This routine deal with the Power Configuration CMDs parsing for RTL8723/RTL8188E Series IC. */ ++/* Description: */ ++/* This routine deal with the Power Configuration CMDs parsing for RTL8723/RTL8188E Series IC. */ +/* */ -+/* Assumption: */ -+/* We should follow specific format which was released from HW SD. */ ++/* Assumption: */ ++/* We should follow specific format which was released from HW SD. */ +/* */ -+/* 2011.07.07, added by Roger. */ ++/* 2011.07.07, added by Roger. */ +/* */ +u8 HalPwrSeqCmdParsing( -+ struct adapter * padapter, -+ u8 CutVersion, -+ u8 FabVersion, -+ u8 InterfaceType, -+ WLAN_PWR_CFG PwrSeqCmd[]) ++ struct adapter *padapter, ++ u8 CutVersion, ++ u8 FabVersion, ++ u8 InterfaceType, ++ WLAN_PWR_CFG PwrSeqCmd[] ++) +{ -+ WLAN_PWR_CFG PwrCfgCmd = {0}; -+ u8 bPollingBit = false; -+ u32 AryIdx = 0; -+ u8 value = 0; -+ u32 offset = 0; -+ u32 pollingCount = 0; /* polling autoload done. */ -+ u32 maxPollingCnt = 5000; ++ WLAN_PWR_CFG PwrCfgCmd = {0}; ++ u8 bPollingBit = false; ++ u32 AryIdx = 0; ++ u8 value = 0; ++ u32 offset = 0; ++ u32 pollingCount = 0; /* polling autoload done. */ ++ u32 maxPollingCnt = 5000; + + do { + PwrCfgCmd = PwrSeqCmd[AryIdx]; + -+ RT_TRACE(_module_hal_init_c_ , _drv_info_, -+ ("HalPwrSeqCmdParsing: offset(%#x) cut_msk(%#x) fab_msk(%#x) interface_msk(%#x) base(%#x) cmd(%#x) msk(%#x) value(%#x)\n", -+ GET_PWR_CFG_OFFSET(PwrCfgCmd), -+ GET_PWR_CFG_CUT_MASK(PwrCfgCmd), -+ GET_PWR_CFG_FAB_MASK(PwrCfgCmd), -+ GET_PWR_CFG_INTF_MASK(PwrCfgCmd), -+ GET_PWR_CFG_BASE(PwrCfgCmd), -+ GET_PWR_CFG_CMD(PwrCfgCmd), -+ GET_PWR_CFG_MASK(PwrCfgCmd), -+ GET_PWR_CFG_VALUE(PwrCfgCmd))); ++ RT_TRACE( ++ _module_hal_init_c_, ++ _drv_info_, ++ ( ++ "HalPwrSeqCmdParsing: offset(%#x) cut_msk(%#x) fab_msk(%#x) interface_msk(%#x) base(%#x) cmd(%#x) msk(%#x) value(%#x)\n", ++ GET_PWR_CFG_OFFSET(PwrCfgCmd), ++ GET_PWR_CFG_CUT_MASK(PwrCfgCmd), ++ GET_PWR_CFG_FAB_MASK(PwrCfgCmd), ++ GET_PWR_CFG_INTF_MASK(PwrCfgCmd), ++ GET_PWR_CFG_BASE(PwrCfgCmd), ++ GET_PWR_CFG_CMD(PwrCfgCmd), ++ GET_PWR_CFG_MASK(PwrCfgCmd), ++ GET_PWR_CFG_VALUE(PwrCfgCmd) ++ ) ++ ); + + /* 2 Only Handle the command whose FAB, CUT, and Interface are matched */ -+ if ((GET_PWR_CFG_FAB_MASK(PwrCfgCmd) & FabVersion) && ++ if ( ++ (GET_PWR_CFG_FAB_MASK(PwrCfgCmd) & FabVersion) && + (GET_PWR_CFG_CUT_MASK(PwrCfgCmd) & CutVersion) && -+ (GET_PWR_CFG_INTF_MASK(PwrCfgCmd) & InterfaceType)) -+ { -+ switch (GET_PWR_CFG_CMD(PwrCfgCmd)) -+ { -+ case PWR_CMD_READ: -+ RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_READ\n")); -+ break; ++ (GET_PWR_CFG_INTF_MASK(PwrCfgCmd) & InterfaceType) ++ ) { ++ switch (GET_PWR_CFG_CMD(PwrCfgCmd)) { ++ case PWR_CMD_READ: ++ RT_TRACE( ++ _module_hal_init_c_, ++ _drv_info_, ++ ("HalPwrSeqCmdParsing: PWR_CMD_READ\n") ++ ); ++ break; + -+ case PWR_CMD_WRITE: -+ RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_WRITE\n")); -+ offset = GET_PWR_CFG_OFFSET(PwrCfgCmd); ++ case PWR_CMD_WRITE: ++ RT_TRACE( ++ _module_hal_init_c_, ++ _drv_info_, ++ ("HalPwrSeqCmdParsing: PWR_CMD_WRITE\n") ++ ); ++ offset = GET_PWR_CFG_OFFSET(PwrCfgCmd); + -+ /* */ -+ /* We should deal with interface specific address mapping for some interfaces, e.g., SDIO interface */ -+ /* 2011.07.07. */ -+ /* */ ++ /* */ ++ /* We should deal with interface specific address mapping for some interfaces, e.g., SDIO interface */ ++ /* 2011.07.07. */ ++ /* */ ++ if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO) { ++ /* Read Back SDIO Local value */ ++ value = SdioLocalCmd52Read1Byte(padapter, offset); ++ ++ value &= ~(GET_PWR_CFG_MASK(PwrCfgCmd)); ++ value |= ( ++ GET_PWR_CFG_VALUE(PwrCfgCmd) & ++ GET_PWR_CFG_MASK(PwrCfgCmd) ++ ); ++ ++ /* Write Back SDIO Local value */ ++ SdioLocalCmd52Write1Byte(padapter, offset, value); ++ } else { ++ /* Read the value from system register */ ++ value = rtw_read8(padapter, offset); ++ ++ value &= (~(GET_PWR_CFG_MASK(PwrCfgCmd))); ++ value |= ( ++ GET_PWR_CFG_VALUE(PwrCfgCmd) ++ &GET_PWR_CFG_MASK(PwrCfgCmd) ++ ); ++ ++ /* Write the value back to sytem register */ ++ rtw_write8(padapter, offset, value); ++ } ++ break; ++ ++ case PWR_CMD_POLLING: ++ RT_TRACE( ++ _module_hal_init_c_, ++ _drv_info_, ++ ("HalPwrSeqCmdParsing: PWR_CMD_POLLING\n") ++ ); ++ ++ bPollingBit = false; ++ offset = GET_PWR_CFG_OFFSET(PwrCfgCmd); ++ do { + if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO) -+ { -+ /* Read Back SDIO Local value */ + value = SdioLocalCmd52Read1Byte(padapter, offset); -+ -+ value &= ~(GET_PWR_CFG_MASK(PwrCfgCmd)); -+ value |= (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd)); -+ -+ /* Write Back SDIO Local value */ -+ SdioLocalCmd52Write1Byte(padapter, offset, value); -+ } + else -+ { -+ /* Read the value from system register */ + value = rtw_read8(padapter, offset); + -+ value =value&(~(GET_PWR_CFG_MASK(PwrCfgCmd))); -+ value =value|(GET_PWR_CFG_VALUE(PwrCfgCmd)&GET_PWR_CFG_MASK(PwrCfgCmd)); -+ -+ /* Write the value back to sytem register */ -+ rtw_write8(padapter, offset, value); -+ } -+ break; -+ -+ case PWR_CMD_POLLING: -+ RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_POLLING\n")); -+ -+ bPollingBit = false; -+ offset = GET_PWR_CFG_OFFSET(PwrCfgCmd); -+ do { -+ if (GET_PWR_CFG_BASE(PwrCfgCmd) == PWR_BASEADDR_SDIO) -+ value = SdioLocalCmd52Read1Byte(padapter, offset); -+ else -+ value = rtw_read8(padapter, offset); -+ -+ value =value&GET_PWR_CFG_MASK(PwrCfgCmd); -+ if (value == (GET_PWR_CFG_VALUE(PwrCfgCmd) & GET_PWR_CFG_MASK(PwrCfgCmd))) -+ bPollingBit = true; -+ else -+ udelay(10); -+ -+ if (pollingCount++ > maxPollingCnt) { -+ DBG_871X("Fail to polling Offset[%#x]=%02x\n", offset, value); -+ return false; -+ } -+ } while (!bPollingBit); -+ -+ break; -+ -+ case PWR_CMD_DELAY: -+ RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_DELAY\n")); -+ if (GET_PWR_CFG_VALUE(PwrCfgCmd) == PWRSEQ_DELAY_US) -+ udelay(GET_PWR_CFG_OFFSET(PwrCfgCmd)); ++ value = value&GET_PWR_CFG_MASK(PwrCfgCmd); ++ if ( ++ value == (GET_PWR_CFG_VALUE(PwrCfgCmd) & ++ GET_PWR_CFG_MASK(PwrCfgCmd)) ++ ) ++ bPollingBit = true; + else -+ udelay(GET_PWR_CFG_OFFSET(PwrCfgCmd)*1000); -+ break; ++ udelay(10); + -+ case PWR_CMD_END: -+ /* When this command is parsed, end the process */ -+ RT_TRACE(_module_hal_init_c_ , _drv_info_, ("HalPwrSeqCmdParsing: PWR_CMD_END\n")); -+ return true; -+ break; ++ if (pollingCount++ > maxPollingCnt) { ++ DBG_871X( ++ "Fail to polling Offset[%#x]=%02x\n", ++ offset, ++ value ++ ); ++ return false; ++ } ++ } while (!bPollingBit); + -+ default: -+ RT_TRACE(_module_hal_init_c_ , _drv_err_, ("HalPwrSeqCmdParsing: Unknown CMD!!\n")); -+ break; ++ break; ++ ++ case PWR_CMD_DELAY: ++ RT_TRACE( ++ _module_hal_init_c_, ++ _drv_info_, ++ ("HalPwrSeqCmdParsing: PWR_CMD_DELAY\n") ++ ); ++ if (GET_PWR_CFG_VALUE(PwrCfgCmd) == PWRSEQ_DELAY_US) ++ udelay(GET_PWR_CFG_OFFSET(PwrCfgCmd)); ++ else ++ udelay(GET_PWR_CFG_OFFSET(PwrCfgCmd)*1000); ++ break; ++ ++ case PWR_CMD_END: ++ /* When this command is parsed, end the process */ ++ RT_TRACE( ++ _module_hal_init_c_, ++ _drv_info_, ++ ("HalPwrSeqCmdParsing: PWR_CMD_END\n") ++ ); ++ return true; ++ ++ default: ++ RT_TRACE( ++ _module_hal_init_c_, ++ _drv_err_, ++ ("HalPwrSeqCmdParsing: Unknown CMD!!\n") ++ ); ++ break; + } + } + + AryIdx++;/* Add Array Index */ -+ }while (1); ++ } while (1); + + return true; +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_sdio.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/hal_sdio.c ---- linux-4.3/3rdparty/rtl8723bs/hal/hal_sdio.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/hal_sdio.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,106 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/hal_sdio.c linux/3rdparty/rtl8723bs/hal/hal_sdio.c +--- linux.old/3rdparty/rtl8723bs/hal/hal_sdio.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/hal_sdio.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,115 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -56176,7 +54770,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_sdio.c linux-4.3-rtl8723bs/3rdpa + return pHalData->SdioTxOQTMaxFreeSpace; +} + -+u8 rtw_hal_sdio_query_tx_freepage(struct adapter *padapter, u8 PageIdx, u8 RequiredPageNum) ++u8 rtw_hal_sdio_query_tx_freepage( ++ struct adapter *padapter, u8 PageIdx, u8 RequiredPageNum ++) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + @@ -56186,7 +54782,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_sdio.c linux-4.3-rtl8723bs/3rdpa + return false; +} + -+void rtw_hal_sdio_update_tx_freepage(struct adapter *padapter, u8 PageIdx, u8 RequiredPageNum) ++void rtw_hal_sdio_update_tx_freepage( ++ struct adapter *padapter, u8 PageIdx, u8 RequiredPageNum ++) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + u8 DedicatedPgNum = 0; @@ -56207,21 +54805,26 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_sdio.c linux-4.3-rtl8723bs/3rdpa + /* spin_unlock_bh(&pHalData->SdioTxFIFOFreePageLock); */ +} + -+void rtw_hal_set_sdio_tx_max_length(struct adapter *padapter, u8 numHQ, u8 numNQ, u8 numLQ, u8 numPubQ) ++void rtw_hal_set_sdio_tx_max_length( ++ struct adapter *padapter, u8 numHQ, u8 numNQ, u8 numLQ, u8 numPubQ ++) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + u32 page_size; + u32 lenHQ, lenNQ, lenLQ; + -+ rtw_hal_get_def_var(padapter, HAL_DEF_TX_PAGE_SIZE,&page_size); ++ rtw_hal_get_def_var(padapter, HAL_DEF_TX_PAGE_SIZE, &page_size); + + lenHQ = ((numHQ + numPubQ) >> 1) * page_size; + lenNQ = ((numNQ + numPubQ) >> 1) * page_size; + lenLQ = ((numLQ + numPubQ) >> 1) * page_size; + -+ pHalData->sdio_tx_max_len[HI_QUEUE_IDX] = (lenHQ > MAX_XMITBUF_SZ)? MAX_XMITBUF_SZ:lenHQ; -+ pHalData->sdio_tx_max_len[MID_QUEUE_IDX] = (lenNQ > MAX_XMITBUF_SZ)? MAX_XMITBUF_SZ:lenNQ; -+ pHalData->sdio_tx_max_len[LOW_QUEUE_IDX] = (lenLQ > MAX_XMITBUF_SZ)? MAX_XMITBUF_SZ:lenLQ; ++ pHalData->sdio_tx_max_len[HI_QUEUE_IDX] = ++ (lenHQ > MAX_XMITBUF_SZ) ? MAX_XMITBUF_SZ : lenHQ; ++ pHalData->sdio_tx_max_len[MID_QUEUE_IDX] = ++ (lenNQ > MAX_XMITBUF_SZ) ? MAX_XMITBUF_SZ : lenNQ; ++ pHalData->sdio_tx_max_len[LOW_QUEUE_IDX] = ++ (lenLQ > MAX_XMITBUF_SZ) ? MAX_XMITBUF_SZ : lenLQ; +} + +u32 rtw_hal_get_sdio_tx_max_length(struct adapter *padapter, u8 queue_idx) @@ -56233,28 +54836,28 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/hal_sdio.c linux-4.3-rtl8723bs/3rdpa + + deviceId = ffaddr2deviceId(pdvobjpriv, queue_idx); + switch (deviceId) { -+ case WLAN_TX_HIQ_DEVICE_ID: -+ max_len = pHalData->sdio_tx_max_len[HI_QUEUE_IDX]; -+ break; ++ case WLAN_TX_HIQ_DEVICE_ID: ++ max_len = pHalData->sdio_tx_max_len[HI_QUEUE_IDX]; ++ break; + -+ case WLAN_TX_MIQ_DEVICE_ID: -+ max_len = pHalData->sdio_tx_max_len[MID_QUEUE_IDX]; -+ break; ++ case WLAN_TX_MIQ_DEVICE_ID: ++ max_len = pHalData->sdio_tx_max_len[MID_QUEUE_IDX]; ++ break; + -+ case WLAN_TX_LOQ_DEVICE_ID: -+ max_len = pHalData->sdio_tx_max_len[LOW_QUEUE_IDX]; -+ break; ++ case WLAN_TX_LOQ_DEVICE_ID: ++ max_len = pHalData->sdio_tx_max_len[LOW_QUEUE_IDX]; ++ break; + -+ default: -+ max_len = pHalData->sdio_tx_max_len[MID_QUEUE_IDX]; -+ break; ++ default: ++ max_len = pHalData->sdio_tx_max_len[MID_QUEUE_IDX]; ++ break; + } + + return max_len; +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/Mp_Precomp.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/Mp_Precomp.h ---- linux-4.3/3rdparty/rtl8723bs/hal/Mp_Precomp.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/Mp_Precomp.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/Mp_Precomp.h linux/3rdparty/rtl8723bs/hal/Mp_Precomp.h +--- linux.old/3rdparty/rtl8723bs/hal/Mp_Precomp.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/Mp_Precomp.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,33 @@ +/****************************************************************************** + * @@ -56289,10 +54892,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/Mp_Precomp.h linux-4.3-rtl8723bs/3rd +#include "HalBtc8723b2Ant.h" + +#endif /* __MP_PRECOMP_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_AntDiv.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_AntDiv.c ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_AntDiv.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_AntDiv.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,74 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_AntDiv.c linux/3rdparty/rtl8723bs/hal/odm_AntDiv.c +--- linux.old/3rdparty/rtl8723bs/hal/odm_AntDiv.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_AntDiv.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,70 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -56315,61 +54918,57 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_AntDiv.c linux-4.3-rtl8723bs/3rd +#include "odm_precomp.h" + +//====================================================== -+// when antenna test utility is on or some testing need to disable antenna diversity -+// call this function to disable all ODM related mechanisms which will switch antenna. ++// when antenna test utility is on or some testing ++// need to disable antenna diversity ++// call this function to disable all ODM related mechanisms ++// which will switch antenna. +//====================================================== -+void -+ODM_StopAntennaSwitchDm( -+PDM_ODM_T pDM_Odm -+ ) ++void ODM_StopAntennaSwitchDm(PDM_ODM_T pDM_Odm) +{ + // disable ODM antenna diversity + pDM_Odm->SupportAbility &= ~ODM_BB_ANT_DIV; -+ ODM_RT_TRACE(pDM_Odm,ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("STOP Antenna Diversity\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_ANT_DIV, ++ ODM_DBG_LOUD, ++ ("STOP Antenna Diversity\n") ++ ); +} + -+void -+ODM_SetAntConfig( -+PDM_ODM_T pDM_Odm, -+u8 antSetting // 0=A, 1=B, 2=C, .... -+ ) ++void ODM_SetAntConfig(PDM_ODM_T pDM_Odm, u8 antSetting)// 0=A, 1=B, 2=C, .... +{ -+ if(antSetting == 0) // ant A ++ if (antSetting == 0) // ant A + PHY_SetBBReg(pDM_Odm->Adapter, 0x948, bMaskDWord, 0x00000000); -+ else if(antSetting == 1) ++ else if (antSetting == 1) + PHY_SetBBReg(pDM_Odm->Adapter, 0x948, bMaskDWord, 0x00000280); +} + +//====================================================== + + -+void -+ODM_SwAntDivRestAfterLink( -+ PDM_ODM_T pDM_Odm -+ ) ++void ODM_SwAntDivRestAfterLink(PDM_ODM_T pDM_Odm) +{ -+ pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; -+ pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; -+ u32 i; ++ pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; ++ pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; ++ u32 i; + + pDM_Odm->RSSI_test = false; + pDM_SWAT_Table->try_flag = 0xff; + pDM_SWAT_Table->RSSI_Trying = 0; -+ pDM_SWAT_Table->Double_chk_flag= 0; ++ pDM_SWAT_Table->Double_chk_flag = 0; + -+ pDM_FatTable->RxIdleAnt=MAIN_ANT; ++ pDM_FatTable->RxIdleAnt = MAIN_ANT; + -+ for (i=0; iMainAnt_Sum[i] = 0; + pDM_FatTable->AuxAnt_Sum[i] = 0; + pDM_FatTable->MainAnt_Cnt[i] = 0; + pDM_FatTable->AuxAnt_Cnt[i] = 0; + } +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_AntDiv.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_AntDiv.h ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_AntDiv.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_AntDiv.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_AntDiv.h linux/3rdparty/rtl8723bs/hal/odm_AntDiv.h +--- linux.old/3rdparty/rtl8723bs/hal/odm_AntDiv.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_AntDiv.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,38 @@ +/****************************************************************************** + * @@ -56409,10 +55008,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_AntDiv.h linux-4.3-rtl8723bs/3rd +#define RELEASE_ANTDIV_TIMMER 2 + +#endif /* ifndef __ODMANTDIV_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm.c ---- linux-4.3/3rdparty/rtl8723bs/hal/odm.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,1630 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm.c linux/3rdparty/rtl8723bs/hal/odm.c +--- linux.old/3rdparty/rtl8723bs/hal/odm.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,1446 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -56440,7 +55039,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r + {4467, 5012, 5623, 6310, 7079, 7943, 8913, 10000, 11220, 12589, 14125, + 15849}, + {17783, 19953, 22387, 25119, 28184, 31623, 35481, 39811, 44668, 50119, -+ 56234, 65535}}; ++ 56234, 65535} ++ }; + +/* Global var */ + @@ -56638,7 +55238,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r + {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04} /* 32, +0dB */ +}; + -+u8 CCKSwingTable_Ch14_New[CCK_TABLE_SIZE][8]= { ++u8 CCKSwingTable_Ch14_New[CCK_TABLE_SIZE][8] = { + {0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00}, /* 0, -16.0dB */ + {0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 1, -15.5dB */ + {0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00}, /* 2, -15.0dB */ @@ -56674,8 +55274,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r + {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00} /* 32, +0dB */ +}; + -+u32 TxScalingTable_Jaguar[TXSCALE_TABLE_SIZE] = -+{ ++u32 TxScalingTable_Jaguar[TXSCALE_TABLE_SIZE] = { + 0x081, /* 0, -12.0dB */ + 0x088, /* 1, -11.5dB */ + 0x090, /* 2, -11.0dB */ @@ -56718,26 +55317,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r +/* Local Function predefine. */ + +/* START------------COMMON INFO RELATED--------------- */ -+void -+odm_CommonInfoSelfInit( -+ PDM_ODM_T pDM_Odm -+ ); ++void odm_CommonInfoSelfInit(PDM_ODM_T pDM_Odm); + -+void -+odm_CommonInfoSelfUpdate( -+ PDM_ODM_T pDM_Odm -+ ); ++void odm_CommonInfoSelfUpdate(PDM_ODM_T pDM_Odm); + -+void -+odm_CmnInfoInit_Debug( -+ PDM_ODM_T pDM_Odm -+ ); ++void odm_CmnInfoInit_Debug(PDM_ODM_T pDM_Odm); + -+void -+odm_BasicDbgMessage -+( -+ PDM_ODM_T pDM_Odm -+ ); ++void odm_BasicDbgMessage(PDM_ODM_T pDM_Odm); + +/* END------------COMMON INFO RELATED--------------- */ + @@ -56751,107 +55337,59 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r +/* Remove BB power Saving by YuChen */ +/* END---------BB POWER SAVE----------------------- */ + -+void -+odm_RefreshRateAdaptiveMaskCE( -+ PDM_ODM_T pDM_Odm -+ ); ++void odm_RefreshRateAdaptiveMaskCE(PDM_ODM_T pDM_Odm); + +/* Remove by YuChen */ + -+void -+odm_RSSIMonitorInit( -+PDM_ODM_T pDM_Odm -+ ); ++void odm_RSSIMonitorInit(PDM_ODM_T pDM_Odm); + -+void -+odm_RSSIMonitorCheckCE( -+ PDM_ODM_T pDM_Odm -+ ); ++void odm_RSSIMonitorCheckCE(PDM_ODM_T pDM_Odm); + -+void -+odm_RSSIMonitorCheck( -+ PDM_ODM_T pDM_Odm -+ ); ++void odm_RSSIMonitorCheck(PDM_ODM_T pDM_Odm); + -+void -+odm_SwAntDetectInit( -+ PDM_ODM_T pDM_Odm -+ ); ++void odm_SwAntDetectInit(PDM_ODM_T pDM_Odm); + +void odm_SwAntDivChkAntSwitchCallback(void *FunctionContext); + + + -+void -+odm_GlobalAdapterCheck( -+ void -+ ); ++void odm_GlobalAdapterCheck(void); + -+void -+odm_RefreshRateAdaptiveMask( -+ PDM_ODM_T pDM_Odm -+ ); ++void odm_RefreshRateAdaptiveMask(PDM_ODM_T pDM_Odm); + -+void -+ODM_TXPowerTrackingCheck( -+ PDM_ODM_T pDM_Odm -+ ); ++void ODM_TXPowerTrackingCheck(PDM_ODM_T pDM_Odm); + -+void -+odm_RateAdaptiveMaskInit( -+PDM_ODM_T pDM_Odm -+ ); ++void odm_RateAdaptiveMaskInit(PDM_ODM_T pDM_Odm); + -+void -+odm_TXPowerTrackingThermalMeterInit( -+PDM_ODM_T pDM_Odm -+ ); ++void odm_TXPowerTrackingThermalMeterInit(PDM_ODM_T pDM_Odm); + + -+void -+odm_TXPowerTrackingInit( -+PDM_ODM_T pDM_Odm -+ ); ++void odm_TXPowerTrackingInit(PDM_ODM_T pDM_Odm); + -+void -+odm_TXPowerTrackingCheckCE( -+PDM_ODM_T pDM_Odm -+ ); ++void odm_TXPowerTrackingCheckCE(PDM_ODM_T pDM_Odm); + +/* Remove Edca by Yu Chen */ + + -+#define RxDefaultAnt1 0x65a9 -+#define RxDefaultAnt2 0x569a ++#define RxDefaultAnt1 0x65a9 ++#define RxDefaultAnt2 0x569a + -+void -+odm_InitHybridAntDiv( -+ PDM_ODM_T pDM_Odm -+ ); ++void odm_InitHybridAntDiv(PDM_ODM_T pDM_Odm); + -+bool -+odm_StaDefAntSel( -+ PDM_ODM_T pDM_Odm, -+ u32 OFDM_Ant1_Cnt, -+ u32 OFDM_Ant2_Cnt, -+ u32 CCK_Ant1_Cnt, -+ u32 CCK_Ant2_Cnt, ++bool odm_StaDefAntSel( ++ PDM_ODM_T pDM_Odm, ++ u32 OFDM_Ant1_Cnt, ++ u32 OFDM_Ant2_Cnt, ++ u32 CCK_Ant1_Cnt, ++ u32 CCK_Ant2_Cnt, + u8 *pDefAnt -+ ); -+ -+void -+odm_SetRxIdleAnt( -+PDM_ODM_T pDM_Odm, -+u8 Ant, -+ bool bDualPath +); + ++void odm_SetRxIdleAnt(PDM_ODM_T pDM_Odm, u8 Ant, bool bDualPath); + + -+void -+odm_HwAntDiv( -+PDM_ODM_T pDM_Odm -+); ++ ++void odm_HwAntDiv(PDM_ODM_T pDM_Odm); + + +/* */ @@ -56861,10 +55399,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r +/* */ +/* 2011/09/21 MH Add to describe different team necessary resource allocate?? */ +/* */ -+void -+ODM_DMInit( -+ PDM_ODM_T pDM_Odm -+ ) ++void ODM_DMInit(PDM_ODM_T pDM_Odm) +{ + + odm_CommonInfoSelfInit(pDM_Odm); @@ -56894,10 +55429,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r +/* You can not add any dummy function here, be care, you can only use DM structure */ +/* to perform any new ODM_DM. */ +/* */ -+void -+ODM_DMWatchdog( -+ PDM_ODM_T pDM_Odm -+ ) ++void ODM_DMWatchdog(PDM_ODM_T pDM_Odm) +{ + odm_CommonInfoSelfUpdate(pDM_Odm); + odm_BasicDbgMessage(pDM_Odm); @@ -56913,27 +55445,24 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r + /* Fix Leave LPS issue */ + if ((adapter_to_pwrctl(pDM_Odm->Adapter)->pwr_mode != PS_MODE_ACTIVE) /* in LPS mode */ + /* */ -+ /* (pDM_Odm->SupportICType & (ODM_RTL8723A))|| */ -+ /* (pDM_Odm->SupportICType & (ODM_RTL8188E) &&(&&(((pDM_Odm->SupportInterface == ODM_ITRF_SDIO))) */ ++ /* (pDM_Odm->SupportICType & (ODM_RTL8723A))|| */ ++ /* (pDM_Odm->SupportICType & (ODM_RTL8188E) &&(&&(((pDM_Odm->SupportInterface == ODM_ITRF_SDIO))) */ + /* */ -+ ) -+ { ++ ) { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("----Step1: odm_DIG is in LPS mode\n")); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("---Step2: 8723AS is in LPS mode\n")); + odm_DIGbyRSSI_LPS(pDM_Odm); -+ } -+ else -+ { ++ } else + odm_DIG(pDM_Odm); -+ } + + { -+ pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; ++ pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; ++ + odm_Adaptivity(pDM_Odm, pDM_DigTable->CurIGValue); + } + odm_CCKPacketDetectionThresh(pDM_Odm); + -+ if (*(pDM_Odm->pbPowerSaving) ==true) ++ if (*(pDM_Odm->pbPowerSaving) == true) + return; + + @@ -56955,283 +55484,267 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r +/* */ +/* Init /.. Fixed HW value. Only init time. */ +/* */ -+void -+ODM_CmnInfoInit( -+ PDM_ODM_T pDM_Odm, -+ ODM_CMNINFO_E CmnInfo, -+ u32 Value -+ ) ++void ODM_CmnInfoInit(PDM_ODM_T pDM_Odm, ODM_CMNINFO_E CmnInfo, u32 Value) +{ + /* */ + /* This section is used for init value */ + /* */ -+ switch (CmnInfo) -+ { -+ /* */ -+ /* Fixed ODM value. */ -+ /* */ -+ case ODM_CMNINFO_ABILITY: -+ pDM_Odm->SupportAbility = (u32)Value; -+ break; ++ switch (CmnInfo) { ++ /* */ ++ /* Fixed ODM value. */ ++ /* */ ++ case ODM_CMNINFO_ABILITY: ++ pDM_Odm->SupportAbility = (u32)Value; ++ break; + -+ case ODM_CMNINFO_RF_TYPE: -+ pDM_Odm->RFType = (u8)Value; -+ break; ++ case ODM_CMNINFO_RF_TYPE: ++ pDM_Odm->RFType = (u8)Value; ++ break; + -+ case ODM_CMNINFO_PLATFORM: -+ pDM_Odm->SupportPlatform = (u8)Value; -+ break; ++ case ODM_CMNINFO_PLATFORM: ++ pDM_Odm->SupportPlatform = (u8)Value; ++ break; + -+ case ODM_CMNINFO_INTERFACE: -+ pDM_Odm->SupportInterface = (u8)Value; -+ break; ++ case ODM_CMNINFO_INTERFACE: ++ pDM_Odm->SupportInterface = (u8)Value; ++ break; + -+ case ODM_CMNINFO_MP_TEST_CHIP: -+ pDM_Odm->bIsMPChip = (u8)Value; -+ break; ++ case ODM_CMNINFO_MP_TEST_CHIP: ++ pDM_Odm->bIsMPChip = (u8)Value; ++ break; + -+ case ODM_CMNINFO_IC_TYPE: -+ pDM_Odm->SupportICType = Value; -+ break; ++ case ODM_CMNINFO_IC_TYPE: ++ pDM_Odm->SupportICType = Value; ++ break; + -+ case ODM_CMNINFO_CUT_VER: -+ pDM_Odm->CutVersion = (u8)Value; -+ break; ++ case ODM_CMNINFO_CUT_VER: ++ pDM_Odm->CutVersion = (u8)Value; ++ break; + -+ case ODM_CMNINFO_FAB_VER: -+ pDM_Odm->FabVersion = (u8)Value; -+ break; ++ case ODM_CMNINFO_FAB_VER: ++ pDM_Odm->FabVersion = (u8)Value; ++ break; + -+ case ODM_CMNINFO_RFE_TYPE: -+ pDM_Odm->RFEType = (u8)Value; -+ break; ++ case ODM_CMNINFO_RFE_TYPE: ++ pDM_Odm->RFEType = (u8)Value; ++ break; + -+ case ODM_CMNINFO_RF_ANTENNA_TYPE: -+ pDM_Odm->AntDivType = (u8)Value; -+ break; ++ case ODM_CMNINFO_RF_ANTENNA_TYPE: ++ pDM_Odm->AntDivType = (u8)Value; ++ break; + -+ case ODM_CMNINFO_BOARD_TYPE: -+ pDM_Odm->BoardType = (u8)Value; -+ break; ++ case ODM_CMNINFO_BOARD_TYPE: ++ pDM_Odm->BoardType = (u8)Value; ++ break; + -+ case ODM_CMNINFO_PACKAGE_TYPE: -+ pDM_Odm->PackageType = (u8)Value; -+ break; ++ case ODM_CMNINFO_PACKAGE_TYPE: ++ pDM_Odm->PackageType = (u8)Value; ++ break; + -+ case ODM_CMNINFO_EXT_LNA: -+ pDM_Odm->ExtLNA = (u8)Value; -+ break; ++ case ODM_CMNINFO_EXT_LNA: ++ pDM_Odm->ExtLNA = (u8)Value; ++ break; + -+ case ODM_CMNINFO_5G_EXT_LNA: -+ pDM_Odm->ExtLNA5G = (u8)Value; -+ break; ++ case ODM_CMNINFO_5G_EXT_LNA: ++ pDM_Odm->ExtLNA5G = (u8)Value; ++ break; + -+ case ODM_CMNINFO_EXT_PA: -+ pDM_Odm->ExtPA = (u8)Value; -+ break; ++ case ODM_CMNINFO_EXT_PA: ++ pDM_Odm->ExtPA = (u8)Value; ++ break; + -+ case ODM_CMNINFO_5G_EXT_PA: -+ pDM_Odm->ExtPA5G = (u8)Value; -+ break; ++ case ODM_CMNINFO_5G_EXT_PA: ++ pDM_Odm->ExtPA5G = (u8)Value; ++ break; + -+ case ODM_CMNINFO_GPA: -+ pDM_Odm->TypeGPA = (ODM_TYPE_GPA_E)Value; -+ break; -+ case ODM_CMNINFO_APA: -+ pDM_Odm->TypeAPA = (ODM_TYPE_APA_E)Value; -+ break; -+ case ODM_CMNINFO_GLNA: -+ pDM_Odm->TypeGLNA = (ODM_TYPE_GLNA_E)Value; -+ break; -+ case ODM_CMNINFO_ALNA: -+ pDM_Odm->TypeALNA = (ODM_TYPE_ALNA_E)Value; -+ break; ++ case ODM_CMNINFO_GPA: ++ pDM_Odm->TypeGPA = (ODM_TYPE_GPA_E)Value; ++ break; ++ case ODM_CMNINFO_APA: ++ pDM_Odm->TypeAPA = (ODM_TYPE_APA_E)Value; ++ break; ++ case ODM_CMNINFO_GLNA: ++ pDM_Odm->TypeGLNA = (ODM_TYPE_GLNA_E)Value; ++ break; ++ case ODM_CMNINFO_ALNA: ++ pDM_Odm->TypeALNA = (ODM_TYPE_ALNA_E)Value; ++ break; + -+ case ODM_CMNINFO_EXT_TRSW: -+ pDM_Odm->ExtTRSW = (u8)Value; -+ break; -+ case ODM_CMNINFO_PATCH_ID: -+ pDM_Odm->PatchID = (u8)Value; -+ break; -+ case ODM_CMNINFO_BINHCT_TEST: -+ pDM_Odm->bInHctTest = (bool)Value; -+ break; -+ case ODM_CMNINFO_BWIFI_TEST: -+ pDM_Odm->bWIFITest = (bool)Value; -+ break; ++ case ODM_CMNINFO_EXT_TRSW: ++ pDM_Odm->ExtTRSW = (u8)Value; ++ break; ++ case ODM_CMNINFO_PATCH_ID: ++ pDM_Odm->PatchID = (u8)Value; ++ break; ++ case ODM_CMNINFO_BINHCT_TEST: ++ pDM_Odm->bInHctTest = (bool)Value; ++ break; ++ case ODM_CMNINFO_BWIFI_TEST: ++ pDM_Odm->bWIFITest = (bool)Value; ++ break; + -+ case ODM_CMNINFO_SMART_CONCURRENT: -+ pDM_Odm->bDualMacSmartConcurrent = (bool)Value; -+ break; -+ -+ /* To remove the compiler warning, must add an empty default statement to handle the other values. */ -+ default: -+ /* do nothing */ -+ break; ++ case ODM_CMNINFO_SMART_CONCURRENT: ++ pDM_Odm->bDualMacSmartConcurrent = (bool)Value; ++ break; + ++ /* To remove the compiler warning, must add an empty default statement to handle the other values. */ ++ default: ++ /* do nothing */ ++ break; + } + +} + + -+void -+ODM_CmnInfoHook( -+ PDM_ODM_T pDM_Odm, -+ ODM_CMNINFO_E CmnInfo, -+ void * pValue -+ ) ++void ODM_CmnInfoHook(PDM_ODM_T pDM_Odm, ODM_CMNINFO_E CmnInfo, void *pValue) +{ + /* */ + /* Hook call by reference pointer. */ + /* */ -+ switch (CmnInfo) -+ { -+ /* */ -+ /* Dynamic call by reference pointer. */ -+ /* */ -+ case ODM_CMNINFO_MAC_PHY_MODE: -+ pDM_Odm->pMacPhyMode = (u8 *)pValue; -+ break; ++ switch (CmnInfo) { ++ /* */ ++ /* Dynamic call by reference pointer. */ ++ /* */ ++ case ODM_CMNINFO_MAC_PHY_MODE: ++ pDM_Odm->pMacPhyMode = (u8 *)pValue; ++ break; + -+ case ODM_CMNINFO_TX_UNI: -+ pDM_Odm->pNumTxBytesUnicast = (u64 *)pValue; -+ break; ++ case ODM_CMNINFO_TX_UNI: ++ pDM_Odm->pNumTxBytesUnicast = (u64 *)pValue; ++ break; + -+ case ODM_CMNINFO_RX_UNI: -+ pDM_Odm->pNumRxBytesUnicast = (u64 *)pValue; -+ break; ++ case ODM_CMNINFO_RX_UNI: ++ pDM_Odm->pNumRxBytesUnicast = (u64 *)pValue; ++ break; + -+ case ODM_CMNINFO_WM_MODE: -+ pDM_Odm->pwirelessmode = (u8 *)pValue; -+ break; ++ case ODM_CMNINFO_WM_MODE: ++ pDM_Odm->pwirelessmode = (u8 *)pValue; ++ break; + -+ case ODM_CMNINFO_BAND: -+ pDM_Odm->pBandType = (u8 *)pValue; -+ break; ++ case ODM_CMNINFO_BAND: ++ pDM_Odm->pBandType = (u8 *)pValue; ++ break; + -+ case ODM_CMNINFO_SEC_CHNL_OFFSET: -+ pDM_Odm->pSecChOffset = (u8 *)pValue; -+ break; ++ case ODM_CMNINFO_SEC_CHNL_OFFSET: ++ pDM_Odm->pSecChOffset = (u8 *)pValue; ++ break; + -+ case ODM_CMNINFO_SEC_MODE: -+ pDM_Odm->pSecurity = (u8 *)pValue; -+ break; ++ case ODM_CMNINFO_SEC_MODE: ++ pDM_Odm->pSecurity = (u8 *)pValue; ++ break; + -+ case ODM_CMNINFO_BW: -+ pDM_Odm->pBandWidth = (u8 *)pValue; -+ break; ++ case ODM_CMNINFO_BW: ++ pDM_Odm->pBandWidth = (u8 *)pValue; ++ break; + -+ case ODM_CMNINFO_CHNL: -+ pDM_Odm->pChannel = (u8 *)pValue; -+ break; ++ case ODM_CMNINFO_CHNL: ++ pDM_Odm->pChannel = (u8 *)pValue; ++ break; + -+ case ODM_CMNINFO_DMSP_GET_VALUE: -+ pDM_Odm->pbGetValueFromOtherMac = (bool *)pValue; -+ break; ++ case ODM_CMNINFO_DMSP_GET_VALUE: ++ pDM_Odm->pbGetValueFromOtherMac = (bool *)pValue; ++ break; + -+ case ODM_CMNINFO_BUDDY_ADAPTOR: -+ pDM_Odm->pBuddyAdapter = (struct adapter * *)pValue; -+ break; ++ case ODM_CMNINFO_BUDDY_ADAPTOR: ++ pDM_Odm->pBuddyAdapter = (struct adapter **)pValue; ++ break; + -+ case ODM_CMNINFO_DMSP_IS_MASTER: -+ pDM_Odm->pbMasterOfDMSP = (bool *)pValue; -+ break; ++ case ODM_CMNINFO_DMSP_IS_MASTER: ++ pDM_Odm->pbMasterOfDMSP = (bool *)pValue; ++ break; + -+ case ODM_CMNINFO_SCAN: -+ pDM_Odm->pbScanInProcess = (bool *)pValue; -+ break; ++ case ODM_CMNINFO_SCAN: ++ pDM_Odm->pbScanInProcess = (bool *)pValue; ++ break; + -+ case ODM_CMNINFO_POWER_SAVING: -+ pDM_Odm->pbPowerSaving = (bool *)pValue; -+ break; ++ case ODM_CMNINFO_POWER_SAVING: ++ pDM_Odm->pbPowerSaving = (bool *)pValue; ++ break; + -+ case ODM_CMNINFO_ONE_PATH_CCA: -+ pDM_Odm->pOnePathCCA = (u8 *)pValue; -+ break; ++ case ODM_CMNINFO_ONE_PATH_CCA: ++ pDM_Odm->pOnePathCCA = (u8 *)pValue; ++ break; + -+ case ODM_CMNINFO_DRV_STOP: -+ pDM_Odm->pbDriverStopped = (bool *)pValue; -+ break; ++ case ODM_CMNINFO_DRV_STOP: ++ pDM_Odm->pbDriverStopped = (bool *)pValue; ++ break; + -+ case ODM_CMNINFO_PNP_IN: -+ pDM_Odm->pbDriverIsGoingToPnpSetPowerSleep = (bool *)pValue; -+ break; ++ case ODM_CMNINFO_PNP_IN: ++ pDM_Odm->pbDriverIsGoingToPnpSetPowerSleep = (bool *)pValue; ++ break; + -+ case ODM_CMNINFO_INIT_ON: -+ pDM_Odm->pinit_adpt_in_progress = (bool *)pValue; -+ break; ++ case ODM_CMNINFO_INIT_ON: ++ pDM_Odm->pinit_adpt_in_progress = (bool *)pValue; ++ break; + -+ case ODM_CMNINFO_ANT_TEST: -+ pDM_Odm->pAntennaTest = (u8 *)pValue; -+ break; ++ case ODM_CMNINFO_ANT_TEST: ++ pDM_Odm->pAntennaTest = (u8 *)pValue; ++ break; + -+ case ODM_CMNINFO_NET_CLOSED: -+ pDM_Odm->pbNet_closed = (bool *)pValue; -+ break; ++ case ODM_CMNINFO_NET_CLOSED: ++ pDM_Odm->pbNet_closed = (bool *)pValue; ++ break; + -+ case ODM_CMNINFO_FORCED_RATE: -+ pDM_Odm->pForcedDataRate = (u16 *)pValue; -+ break; ++ case ODM_CMNINFO_FORCED_RATE: ++ pDM_Odm->pForcedDataRate = (u16 *)pValue; ++ break; + -+ case ODM_CMNINFO_FORCED_IGI_LB: -+ pDM_Odm->pu1ForcedIgiLb = (u8 *)pValue; -+ break; ++ case ODM_CMNINFO_FORCED_IGI_LB: ++ pDM_Odm->pu1ForcedIgiLb = (u8 *)pValue; ++ break; + -+ case ODM_CMNINFO_MP_MODE: -+ pDM_Odm->mp_mode = (u8 *)pValue; -+ break; ++ case ODM_CMNINFO_MP_MODE: ++ pDM_Odm->mp_mode = (u8 *)pValue; ++ break; + -+ /* case ODM_CMNINFO_RTSTA_AID: */ -+ /* pDM_Odm->pAidMap = (u8 *)pValue; */ -+ /* break; */ ++ /* case ODM_CMNINFO_RTSTA_AID: */ ++ /* pDM_Odm->pAidMap = (u8 *)pValue; */ ++ /* break; */ + -+ /* case ODM_CMNINFO_BT_COEXIST: */ -+ /* pDM_Odm->BTCoexist = (bool *)pValue; */ ++ /* case ODM_CMNINFO_BT_COEXIST: */ ++ /* pDM_Odm->BTCoexist = (bool *)pValue; */ + -+ /* case ODM_CMNINFO_STA_STATUS: */ -+ /* pDM_Odm->pODM_StaInfo[] = (PSTA_INFO_T)pValue; */ -+ /* break; */ ++ /* case ODM_CMNINFO_STA_STATUS: */ ++ /* pDM_Odm->pODM_StaInfo[] = (PSTA_INFO_T)pValue; */ ++ /* break; */ + -+ /* case ODM_CMNINFO_PHY_STATUS: */ -+ /* pDM_Odm->pPhyInfo = (ODM_PHY_INFO *)pValue; */ -+ /* break; */ -+ -+ /* case ODM_CMNINFO_MAC_STATUS: */ -+ /* pDM_Odm->pMacInfo = (ODM_MAC_INFO *)pValue; */ -+ /* break; */ -+ /* To remove the compiler warning, must add an empty default statement to handle the other values. */ -+ default: -+ /* do nothing */ -+ break; ++ /* case ODM_CMNINFO_PHY_STATUS: */ ++ /* pDM_Odm->pPhyInfo = (ODM_PHY_INFO *)pValue; */ ++ /* break; */ + ++ /* case ODM_CMNINFO_MAC_STATUS: */ ++ /* pDM_Odm->pMacInfo = (ODM_MAC_INFO *)pValue; */ ++ /* break; */ ++ /* To remove the compiler warning, must add an empty default statement to handle the other values. */ ++ default: ++ /* do nothing */ ++ break; + } + +} + + -+void -+ODM_CmnInfoPtrArrayHook( -+ PDM_ODM_T pDM_Odm, -+ ODM_CMNINFO_E CmnInfo, -+ u16 Index, -+ void * pValue -+ ) ++void ODM_CmnInfoPtrArrayHook( ++ PDM_ODM_T pDM_Odm, ++ ODM_CMNINFO_E CmnInfo, ++ u16 Index, ++ void *pValue ++) +{ + /* */ + /* Hook call by reference pointer. */ + /* */ -+ switch (CmnInfo) -+ { -+ /* */ -+ /* Dynamic call by reference pointer. */ -+ /* */ -+ case ODM_CMNINFO_STA_STATUS: -+ pDM_Odm->pODM_StaInfo[Index] = (PSTA_INFO_T)pValue; -+ break; -+ /* To remove the compiler warning, must add an empty default statement to handle the other values. */ -+ default: -+ /* do nothing */ -+ break; ++ switch (CmnInfo) { ++ /* */ ++ /* Dynamic call by reference pointer. */ ++ /* */ ++ case ODM_CMNINFO_STA_STATUS: ++ pDM_Odm->pODM_StaInfo[Index] = (PSTA_INFO_T)pValue; ++ break; ++ /* To remove the compiler warning, must add an empty default statement to handle the other values. */ ++ default: ++ /* do nothing */ ++ break; + } + +} @@ -57240,130 +55753,121 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r +/* */ +/* Update Band/CHannel/.. The values are dynamic but non-per-packet. */ +/* */ -+void -+ODM_CmnInfoUpdate( -+ PDM_ODM_T pDM_Odm, -+ u32 CmnInfo, -+ u64 Value -+ ) ++void ODM_CmnInfoUpdate(PDM_ODM_T pDM_Odm, u32 CmnInfo, u64 Value) +{ + /* */ + /* This init variable may be changed in run time. */ + /* */ -+ switch (CmnInfo) -+ { -+ case ODM_CMNINFO_LINK_IN_PROGRESS: -+ pDM_Odm->bLinkInProcess = (bool)Value; -+ break; ++ switch (CmnInfo) { ++ case ODM_CMNINFO_LINK_IN_PROGRESS: ++ pDM_Odm->bLinkInProcess = (bool)Value; ++ break; + -+ case ODM_CMNINFO_ABILITY: -+ pDM_Odm->SupportAbility = (u32)Value; -+ break; ++ case ODM_CMNINFO_ABILITY: ++ pDM_Odm->SupportAbility = (u32)Value; ++ break; + -+ case ODM_CMNINFO_RF_TYPE: -+ pDM_Odm->RFType = (u8)Value; -+ break; ++ case ODM_CMNINFO_RF_TYPE: ++ pDM_Odm->RFType = (u8)Value; ++ break; + -+ case ODM_CMNINFO_WIFI_DIRECT: -+ pDM_Odm->bWIFI_Direct = (bool)Value; -+ break; ++ case ODM_CMNINFO_WIFI_DIRECT: ++ pDM_Odm->bWIFI_Direct = (bool)Value; ++ break; + -+ case ODM_CMNINFO_WIFI_DISPLAY: -+ pDM_Odm->bWIFI_Display = (bool)Value; -+ break; ++ case ODM_CMNINFO_WIFI_DISPLAY: ++ pDM_Odm->bWIFI_Display = (bool)Value; ++ break; + -+ case ODM_CMNINFO_LINK: -+ pDM_Odm->bLinked = (bool)Value; -+ break; ++ case ODM_CMNINFO_LINK: ++ pDM_Odm->bLinked = (bool)Value; ++ break; + -+ case ODM_CMNINFO_STATION_STATE: -+ pDM_Odm->bsta_state = (bool)Value; -+ break; ++ case ODM_CMNINFO_STATION_STATE: ++ pDM_Odm->bsta_state = (bool)Value; ++ break; + -+ case ODM_CMNINFO_RSSI_MIN: -+ pDM_Odm->RSSI_Min = (u8)Value; -+ break; ++ case ODM_CMNINFO_RSSI_MIN: ++ pDM_Odm->RSSI_Min = (u8)Value; ++ break; + -+ case ODM_CMNINFO_DBG_COMP: -+ pDM_Odm->DebugComponents = Value; -+ break; ++ case ODM_CMNINFO_DBG_COMP: ++ pDM_Odm->DebugComponents = Value; ++ break; + -+ case ODM_CMNINFO_DBG_LEVEL: -+ pDM_Odm->DebugLevel = (u32)Value; -+ break; -+ case ODM_CMNINFO_RA_THRESHOLD_HIGH: -+ pDM_Odm->RateAdaptive.HighRSSIThresh = (u8)Value; -+ break; ++ case ODM_CMNINFO_DBG_LEVEL: ++ pDM_Odm->DebugLevel = (u32)Value; ++ break; ++ case ODM_CMNINFO_RA_THRESHOLD_HIGH: ++ pDM_Odm->RateAdaptive.HighRSSIThresh = (u8)Value; ++ break; + -+ case ODM_CMNINFO_RA_THRESHOLD_LOW: -+ pDM_Odm->RateAdaptive.LowRSSIThresh = (u8)Value; -+ break; -+ /* The following is for BT HS mode and BT coexist mechanism. */ -+ case ODM_CMNINFO_BT_ENABLED: -+ pDM_Odm->bBtEnabled = (bool)Value; -+ break; ++ case ODM_CMNINFO_RA_THRESHOLD_LOW: ++ pDM_Odm->RateAdaptive.LowRSSIThresh = (u8)Value; ++ break; ++ /* The following is for BT HS mode and BT coexist mechanism. */ ++ case ODM_CMNINFO_BT_ENABLED: ++ pDM_Odm->bBtEnabled = (bool)Value; ++ break; + -+ case ODM_CMNINFO_BT_HS_CONNECT_PROCESS: -+ pDM_Odm->bBtConnectProcess = (bool)Value; -+ break; ++ case ODM_CMNINFO_BT_HS_CONNECT_PROCESS: ++ pDM_Odm->bBtConnectProcess = (bool)Value; ++ break; + -+ case ODM_CMNINFO_BT_HS_RSSI: -+ pDM_Odm->btHsRssi = (u8)Value; -+ break; ++ case ODM_CMNINFO_BT_HS_RSSI: ++ pDM_Odm->btHsRssi = (u8)Value; ++ break; + -+ case ODM_CMNINFO_BT_OPERATION: -+ pDM_Odm->bBtHsOperation = (bool)Value; -+ break; ++ case ODM_CMNINFO_BT_OPERATION: ++ pDM_Odm->bBtHsOperation = (bool)Value; ++ break; + -+ case ODM_CMNINFO_BT_LIMITED_DIG: -+ pDM_Odm->bBtLimitedDig = (bool)Value; -+ break; ++ case ODM_CMNINFO_BT_LIMITED_DIG: ++ pDM_Odm->bBtLimitedDig = (bool)Value; ++ break; + -+ case ODM_CMNINFO_BT_DISABLE_EDCA: -+ pDM_Odm->bBtDisableEdcaTurbo = (bool)Value; -+ break; ++ case ODM_CMNINFO_BT_DISABLE_EDCA: ++ pDM_Odm->bBtDisableEdcaTurbo = (bool)Value; ++ break; + +/* -+ case ODM_CMNINFO_OP_MODE: -+ pDM_Odm->OPMode = (u8)Value; -+ break; ++ case ODM_CMNINFO_OP_MODE: ++ pDM_Odm->OPMode = (u8)Value; ++ break; + -+ case ODM_CMNINFO_WM_MODE: -+ pDM_Odm->WirelessMode = (u8)Value; -+ break; ++ case ODM_CMNINFO_WM_MODE: ++ pDM_Odm->WirelessMode = (u8)Value; ++ break; + -+ case ODM_CMNINFO_BAND: -+ pDM_Odm->BandType = (u8)Value; -+ break; ++ case ODM_CMNINFO_BAND: ++ pDM_Odm->BandType = (u8)Value; ++ break; + -+ case ODM_CMNINFO_SEC_CHNL_OFFSET: -+ pDM_Odm->SecChOffset = (u8)Value; -+ break; ++ case ODM_CMNINFO_SEC_CHNL_OFFSET: ++ pDM_Odm->SecChOffset = (u8)Value; ++ break; + -+ case ODM_CMNINFO_SEC_MODE: -+ pDM_Odm->Security = (u8)Value; -+ break; ++ case ODM_CMNINFO_SEC_MODE: ++ pDM_Odm->Security = (u8)Value; ++ break; + -+ case ODM_CMNINFO_BW: -+ pDM_Odm->BandWidth = (u8)Value; -+ break; ++ case ODM_CMNINFO_BW: ++ pDM_Odm->BandWidth = (u8)Value; ++ break; + -+ case ODM_CMNINFO_CHNL: -+ pDM_Odm->Channel = (u8)Value; -+ break; ++ case ODM_CMNINFO_CHNL: ++ pDM_Odm->Channel = (u8)Value; ++ break; +*/ -+ default: -+ /* do nothing */ -+ break; ++ default: ++ /* do nothing */ ++ break; + } + + +} + -+void -+odm_CommonInfoSelfInit( -+ PDM_ODM_T pDM_Odm -+ ) ++void odm_CommonInfoSelfInit(PDM_ODM_T pDM_Odm) +{ + pDM_Odm->bCckHighPower = (bool) PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG(CCK_RPT_FORMAT, pDM_Odm), ODM_BIT(CCK_RPT_FORMAT, pDM_Odm)); + pDM_Odm->RFPathRxEnable = (u8) PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG(BB_RX_PATH, pDM_Odm), ODM_BIT(BB_RX_PATH, pDM_Odm)); @@ -57373,41 +55877,33 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r + pDM_Odm->TxRate = 0xFF; +} + -+void -+odm_CommonInfoSelfUpdate( -+ PDM_ODM_T pDM_Odm -+ ) ++void odm_CommonInfoSelfUpdate(PDM_ODM_T pDM_Odm) +{ + u8 EntryCnt = 0; + u8 i; + PSTA_INFO_T pEntry; + -+ if (*(pDM_Odm->pBandWidth) == ODM_BW40M) -+ { ++ if (*(pDM_Odm->pBandWidth) == ODM_BW40M) { + if (*(pDM_Odm->pSecChOffset) == 1) -+ pDM_Odm->ControlChannel = *(pDM_Odm->pChannel) -2; ++ pDM_Odm->ControlChannel = *(pDM_Odm->pChannel)-2; + else if (*(pDM_Odm->pSecChOffset) == 2) -+ pDM_Odm->ControlChannel = *(pDM_Odm->pChannel) +2; -+ } -+ else ++ pDM_Odm->ControlChannel = *(pDM_Odm->pChannel)+2; ++ } else + pDM_Odm->ControlChannel = *(pDM_Odm->pChannel); + -+ for (i = 0; ipODM_StaInfo[i]; + if (IS_STA_VALID(pEntry)) + EntryCnt++; + } ++ + if (EntryCnt == 1) + pDM_Odm->bOneEntryOnly = true; + else + pDM_Odm->bOneEntryOnly = false; +} + -+void -+odm_CmnInfoInit_Debug( -+ PDM_ODM_T pDM_Odm -+ ) ++void odm_CmnInfoInit_Debug(PDM_ODM_T pDM_Odm) +{ + ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_CmnInfoInit_Debug ==>\n")); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("SupportPlatform =%d\n", pDM_Odm->SupportPlatform)); @@ -57428,11 +55924,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r + +} + -+void -+odm_BasicDbgMessage -+( -+ PDM_ODM_T pDM_Odm -+ ) ++void odm_BasicDbgMessage(PDM_ODM_T pDM_Odm) +{ + ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_BasicDbgMsg ==>\n")); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("bLinked = %d, RSSI_Min = %d,\n", @@ -57458,7 +55950,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r + * Revised History: + *When Who Remark + * -+ *---------------------------------------------------------------------------*/ ++ *--------------------------------------------------------------------------- ++ */ + +/* Remove DIG by yuchen */ + @@ -57478,12 +55971,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r +/* 3 Rate Adaptive */ +/* 3 ============================================================ */ + -+void -+odm_RateAdaptiveMaskInit( -+PDM_ODM_T pDM_Odm -+ ) ++void odm_RateAdaptiveMaskInit(PDM_ODM_T pDM_Odm) +{ -+ PODM_RATE_ADAPTIVE pOdmRA = &pDM_Odm->RateAdaptive; ++ PODM_RATE_ADAPTIVE pOdmRA = &pDM_Odm->RateAdaptive; + + pOdmRA->Type = DM_Type_ByDriver; + if (pOdmRA->Type == DM_Type_ByDriver) @@ -57499,10 +55989,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r +} + +u32 ODM_Get_Rate_Bitmap( -+PDM_ODM_T pDM_Odm, -+u32 macid, -+u32 ra_mask, -+u8 rssi_level) ++ PDM_ODM_T pDM_Odm, ++ u32 macid, ++ u32 ra_mask, ++ u8 rssi_level ++) +{ + PSTA_INFO_T pEntry; + u32 rate_bitmap = 0; @@ -57514,113 +56005,94 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r + + WirelessMode = pEntry->wireless_mode; + -+ switch (WirelessMode) -+ { -+ case ODM_WM_B: -+ if (ra_mask & 0x0000000c) /* 11M or 5.5M enable */ -+ rate_bitmap = 0x0000000d; -+ else -+ rate_bitmap = 0x0000000f; -+ break; ++ switch (WirelessMode) { ++ case ODM_WM_B: ++ if (ra_mask & 0x0000000c) /* 11M or 5.5M enable */ ++ rate_bitmap = 0x0000000d; ++ else ++ rate_bitmap = 0x0000000f; ++ break; + -+ case (ODM_WM_G): -+ case (ODM_WM_A): -+ if (rssi_level == DM_RATR_STA_HIGH) -+ rate_bitmap = 0x00000f00; -+ else -+ rate_bitmap = 0x00000ff0; -+ break; ++ case (ODM_WM_G): ++ case (ODM_WM_A): ++ if (rssi_level == DM_RATR_STA_HIGH) ++ rate_bitmap = 0x00000f00; ++ else ++ rate_bitmap = 0x00000ff0; ++ break; + -+ case (ODM_WM_B|ODM_WM_G): ++ case (ODM_WM_B|ODM_WM_G): ++ if (rssi_level == DM_RATR_STA_HIGH) ++ rate_bitmap = 0x00000f00; ++ else if (rssi_level == DM_RATR_STA_MIDDLE) ++ rate_bitmap = 0x00000ff0; ++ else ++ rate_bitmap = 0x00000ff5; ++ break; ++ ++ case (ODM_WM_B|ODM_WM_G|ODM_WM_N24G): ++ case (ODM_WM_B|ODM_WM_N24G): ++ case (ODM_WM_G|ODM_WM_N24G): ++ case (ODM_WM_A|ODM_WM_N5G): ++ if (pDM_Odm->RFType == ODM_1T2R || pDM_Odm->RFType == ODM_1T1R) { + if (rssi_level == DM_RATR_STA_HIGH) -+ rate_bitmap = 0x00000f00; ++ rate_bitmap = 0x000f0000; + else if (rssi_level == DM_RATR_STA_MIDDLE) -+ rate_bitmap = 0x00000ff0; -+ else -+ rate_bitmap = 0x00000ff5; -+ break; -+ -+ case (ODM_WM_B|ODM_WM_G|ODM_WM_N24G) : -+ case (ODM_WM_B|ODM_WM_N24G) : -+ case (ODM_WM_G|ODM_WM_N24G) : -+ case (ODM_WM_A|ODM_WM_N5G) : -+ { -+ if (pDM_Odm->RFType == ODM_1T2R ||pDM_Odm->RFType == ODM_1T1R) -+ { -+ if (rssi_level == DM_RATR_STA_HIGH) -+ { -+ rate_bitmap = 0x000f0000; -+ } -+ else if (rssi_level == DM_RATR_STA_MIDDLE) -+ { -+ rate_bitmap = 0x000ff000; -+ } -+ else { -+ if (*(pDM_Odm->pBandWidth) == ODM_BW40M) -+ rate_bitmap = 0x000ff015; -+ else -+ rate_bitmap = 0x000ff005; -+ } -+ } ++ rate_bitmap = 0x000ff000; ++ else { ++ if (*(pDM_Odm->pBandWidth) == ODM_BW40M) ++ rate_bitmap = 0x000ff015; + else -+ { -+ if (rssi_level == DM_RATR_STA_HIGH) -+ { -+ rate_bitmap = 0x0f8f0000; -+ } -+ else if (rssi_level == DM_RATR_STA_MIDDLE) -+ { -+ rate_bitmap = 0x0f8ff000; -+ } -+ else -+ { -+ if (*(pDM_Odm->pBandWidth) == ODM_BW40M) -+ rate_bitmap = 0x0f8ff015; -+ else -+ rate_bitmap = 0x0f8ff005; -+ } -+ } ++ rate_bitmap = 0x000ff005; + } -+ break; ++ } else { ++ if (rssi_level == DM_RATR_STA_HIGH) ++ rate_bitmap = 0x0f8f0000; ++ else if (rssi_level == DM_RATR_STA_MIDDLE) ++ rate_bitmap = 0x0f8ff000; ++ else { ++ if (*(pDM_Odm->pBandWidth) == ODM_BW40M) ++ rate_bitmap = 0x0f8ff015; ++ else ++ rate_bitmap = 0x0f8ff005; ++ } ++ } ++ break; + -+ case (ODM_WM_AC|ODM_WM_G): -+ if (rssi_level == 1) -+ rate_bitmap = 0xfc3f0000; ++ case (ODM_WM_AC|ODM_WM_G): ++ if (rssi_level == 1) ++ rate_bitmap = 0xfc3f0000; ++ else if (rssi_level == 2) ++ rate_bitmap = 0xfffff000; ++ else ++ rate_bitmap = 0xffffffff; ++ break; ++ ++ case (ODM_WM_AC|ODM_WM_A): ++ ++ if (pDM_Odm->RFType == RF_1T1R) { ++ if (rssi_level == 1) /* add by Gary for ac-series */ ++ rate_bitmap = 0x003f8000; + else if (rssi_level == 2) -+ rate_bitmap = 0xfffff000; ++ rate_bitmap = 0x003ff000; + else -+ rate_bitmap = 0xffffffff; -+ break; -+ -+ case (ODM_WM_AC|ODM_WM_A): -+ -+ if (pDM_Odm->RFType == RF_1T1R) -+ { -+ if (rssi_level == 1) /* add by Gary for ac-series */ -+ rate_bitmap = 0x003f8000; -+ else if (rssi_level == 2) -+ rate_bitmap = 0x003ff000; -+ else -+ rate_bitmap = 0x003ff010; -+ } ++ rate_bitmap = 0x003ff010; ++ } else { ++ if (rssi_level == 1) /* add by Gary for ac-series */ ++ rate_bitmap = 0xfe3f8000; /* VHT 2SS MCS3~9 */ ++ else if (rssi_level == 2) ++ rate_bitmap = 0xfffff000; /* VHT 2SS MCS0~9 */ + else -+ { -+ if (rssi_level == 1) /* add by Gary for ac-series */ -+ rate_bitmap = 0xfe3f8000; /* VHT 2SS MCS3~9 */ -+ else if (rssi_level == 2) -+ rate_bitmap = 0xfffff000; /* VHT 2SS MCS0~9 */ -+ else -+ rate_bitmap = 0xfffff010; /* All */ -+ } -+ break; -+ -+ default: -+ if (pDM_Odm->RFType == RF_1T2R) -+ rate_bitmap = 0x000fffff; -+ else -+ rate_bitmap = 0x0fffffff; -+ break; ++ rate_bitmap = 0xfffff010; /* All */ ++ } ++ break; + ++ default: ++ if (pDM_Odm->RFType == RF_1T2R) ++ rate_bitmap = 0x000fffff; ++ else ++ rate_bitmap = 0x0fffffff; ++ break; + } + + /* printk("%s ==> rssi_level:0x%02x, WirelessMode:0x%02x, rate_bitmap:0x%08x\n", __func__, rssi_level, WirelessMode, rate_bitmap); */ @@ -57631,68 +56103,60 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r +} + +/*----------------------------------------------------------------------------- -+ * Function: odm_RefreshRateAdaptiveMask() -+ * -+ * Overview: Update rate table mask according to rssi -+ * -+ * Input: NONE -+ * -+ * Output: NONE -+ * -+ * Return: NONE -+ * -+ * Revised History: -+ *When Who Remark -+ *05/27/2009 hpfan Create Version 0. -+ * -+ *---------------------------------------------------------------------------*/ -+void -+odm_RefreshRateAdaptiveMask( -+ PDM_ODM_T pDM_Odm -+ ) ++* Function: odm_RefreshRateAdaptiveMask() ++* ++* Overview: Update rate table mask according to rssi ++* ++* Input: NONE ++* ++* Output: NONE ++* ++* Return: NONE ++* ++* Revised History: ++*When Who Remark ++*05/27/2009 hpfan Create Version 0. ++* ++* -------------------------------------------------------------------------- ++*/ ++void odm_RefreshRateAdaptiveMask(PDM_ODM_T pDM_Odm) +{ + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_TRACE, ("odm_RefreshRateAdaptiveMask()---------->\n")); -+ if (!(pDM_Odm->SupportAbility & ODM_BB_RA_MASK)) -+ { ++ if (!(pDM_Odm->SupportAbility & ODM_BB_RA_MASK)) { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_TRACE, ("odm_RefreshRateAdaptiveMask(): Return cos not supported\n")); + return; + } + odm_RefreshRateAdaptiveMaskCE(pDM_Odm); +} + -+void -+odm_RefreshRateAdaptiveMaskCE( -+ PDM_ODM_T pDM_Odm -+ ) ++void odm_RefreshRateAdaptiveMaskCE(PDM_ODM_T pDM_Odm) +{ + u8 i; -+ struct adapter *padapter = pDM_Odm->Adapter; ++ struct adapter *padapter = pDM_Odm->Adapter; + -+ if (padapter->bDriverStopped) -+ { ++ if (padapter->bDriverStopped) { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_TRACE, ("<---- odm_RefreshRateAdaptiveMask(): driver is going to unload\n")); + return; + } + -+ if (!pDM_Odm->bUseRAMask) -+ { ++ if (!pDM_Odm->bUseRAMask) { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("<---- odm_RefreshRateAdaptiveMask(): driver does not control rate adaptive mask\n")); + return; + } + + /* printk("==> %s\n", __func__); */ + -+ for (i = 0; ipODM_StaInfo[i]; ++ + if (IS_STA_VALID(pstat)) { + if (IS_MCAST(pstat->hwaddr)) /* if (psta->mac_id == 1) */ -+ continue; ++ continue; + if (IS_MCAST(pstat->hwaddr)) + continue; + -+ if (true == ODM_RAStateCheck(pDM_Odm, pstat->rssi_stat.UndecoratedSmoothedPWDB, false , &pstat->rssi_level)) -+ { ++ if (true == ODM_RAStateCheck(pDM_Odm, pstat->rssi_stat.UndecoratedSmoothedPWDB, false, &pstat->rssi_level)) { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("RSSI:%d, RSSI_LEVEL:%d\n", pstat->rssi_stat.UndecoratedSmoothedPWDB, pstat->rssi_level)); + /* printk("RSSI:%d, RSSI_LEVEL:%d\n", pstat->rssi_stat.UndecoratedSmoothedPWDB, pstat->rssi_level); */ + rtw_hal_update_ra_mask(pstat, pstat->rssi_level); @@ -57704,13 +56168,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r + +/* Return Value: bool */ +/* - true: RATRState is changed. */ -+bool -+ODM_RAStateCheck( -+ PDM_ODM_T pDM_Odm, -+ s32 RSSI, -+ bool bForceUpdate, -+ u8 * pRATRState -+ ) ++bool ODM_RAStateCheck( ++ PDM_ODM_T pDM_Odm, ++ s32 RSSI, ++ bool bForceUpdate, ++ u8 *pRATRState ++) +{ + PODM_RATE_ADAPTIVE pRA = &pDM_Odm->RateAdaptive; + const u8 GoUpGap = 5; @@ -57721,24 +56184,23 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r + /* Threshold Adjustment: */ + /* when RSSI state trends to go up one or two levels, make sure RSSI is high enough. */ + /* Here GoUpGap is added to solve the boundary's level alternation issue. */ -+ switch (*pRATRState) -+ { -+ case DM_RATR_STA_INIT: -+ case DM_RATR_STA_HIGH: -+ break; ++ switch (*pRATRState) { ++ case DM_RATR_STA_INIT: ++ case DM_RATR_STA_HIGH: ++ break; + -+ case DM_RATR_STA_MIDDLE: -+ HighRSSIThreshForRA += GoUpGap; -+ break; ++ case DM_RATR_STA_MIDDLE: ++ HighRSSIThreshForRA += GoUpGap; ++ break; + -+ case DM_RATR_STA_LOW: -+ HighRSSIThreshForRA += GoUpGap; -+ LowRSSIThreshForRA += GoUpGap; -+ break; ++ case DM_RATR_STA_LOW: ++ HighRSSIThreshForRA += GoUpGap; ++ LowRSSIThreshForRA += GoUpGap; ++ break; + -+ default: -+ ODM_RT_ASSERT(pDM_Odm, false, ("wrong rssi level setting %d !", *pRATRState)); -+ break; ++ default: ++ ODM_RT_ASSERT(pDM_Odm, false, ("wrong rssi level setting %d !", *pRATRState)); ++ break; + } + + /* Decide RATRState by RSSI. */ @@ -57750,8 +56212,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r + RATRState = DM_RATR_STA_LOW; + /* printk("==>%s, RATRState:0x%02x , RSSI:%d\n", __func__, RATRState, RSSI); */ + -+ if (*pRATRState!=RATRState || bForceUpdate) -+ { ++ if (*pRATRState != RATRState || bForceUpdate) { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_RA_MASK, ODM_DBG_LOUD, ("RSSI Level %d -> %d\n", *pRATRState, RATRState)); + *pRATRState = RATRState; + return true; @@ -57773,21 +56234,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r +/* 3 RSSI Monitor */ +/* 3 ============================================================ */ + -+void -+odm_RSSIMonitorInit( -+PDM_ODM_T pDM_Odm -+ ) ++void odm_RSSIMonitorInit(PDM_ODM_T pDM_Odm) +{ -+ pRA_T pRA_Table = &pDM_Odm->DM_RA_Table; ++ pRA_T pRA_Table = &pDM_Odm->DM_RA_Table; + + pRA_Table->firstconnect = false; + +} + -+void -+odm_RSSIMonitorCheck( -+ PDM_ODM_T pDM_Odm -+ ) ++void odm_RSSIMonitorCheck(PDM_ODM_T pDM_Odm) +{ + if (!(pDM_Odm->SupportAbility & ODM_BB_RSSI_MONITOR)) + return; @@ -57800,39 +56255,34 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; -+ PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); ++ PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); + + /* 1 1.Determine the minimum RSSI */ + -+ if ((pDM_Odm->bLinked != true) && -+ (pdmpriv->EntryMinUndecoratedSmoothedPWDB == 0)) -+ { ++ if ( ++ (pDM_Odm->bLinked != true) && ++ (pdmpriv->EntryMinUndecoratedSmoothedPWDB == 0) ++ ) { + pdmpriv->MinUndecoratedPWDBForDM = 0; + /* ODM_RT_TRACE(pDM_Odm, COMP_BB_POWERSAVING, DBG_LOUD, ("Not connected to any\n")); */ -+ } -+ else -+ { ++ } else + pdmpriv->MinUndecoratedPWDBForDM = pdmpriv->EntryMinUndecoratedSmoothedPWDB; -+ } + + /* DBG_8192C("%s =>MinUndecoratedPWDBForDM(%d)\n", __func__, pdmpriv->MinUndecoratedPWDBForDM); */ + /* ODM_RT_TRACE(pDM_Odm, COMP_DIG, DBG_LOUD, ("MinUndecoratedPWDBForDM =%d\n", pHalData->MinUndecoratedPWDBForDM)); */ +} + -+void -+odm_RSSIMonitorCheckCE( -+ PDM_ODM_T pDM_Odm -+ ) ++void odm_RSSIMonitorCheckCE(PDM_ODM_T pDM_Odm) +{ + struct adapter *Adapter = pDM_Odm->Adapter; + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; -+ int i; -+ int tmpEntryMaxPWDB = 0, tmpEntryMinPWDB = 0xff; ++ int i; ++ int tmpEntryMaxPWDB = 0, tmpEntryMinPWDB = 0xff; + u8 sta_cnt = 0; -+ u32 PWDB_rssi[NUM_STA]={0};/* 0~15]:MACID, [16~31]:PWDB_rssi */ -+ bool FirstConnect = false; -+ pRA_T pRA_Table = &pDM_Odm->DM_RA_Table; ++ u32 PWDB_rssi[NUM_STA] = {0};/* 0~15]:MACID, [16~31]:PWDB_rssi */ ++ bool FirstConnect = false; ++ pRA_T pRA_Table = &pDM_Odm->DM_RA_Table; + + if (pDM_Odm->bLinked != true) + return; @@ -57844,36 +56294,32 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r + { + struct sta_info *psta; + -+ for (i = 0; ipODM_StaInfo[i])) -+ { -+ if (IS_MCAST(psta->hwaddr)) /* if (psta->mac_id == 1) */ -+ continue; ++ for (i = 0; i < ODM_ASSOCIATE_ENTRY_NUM; i++) { ++ psta = pDM_Odm->pODM_StaInfo[i]; ++ if (IS_STA_VALID(psta)) { ++ if (IS_MCAST(psta->hwaddr)) /* if (psta->mac_id == 1) */ ++ continue; + -+ if (psta->rssi_stat.UndecoratedSmoothedPWDB == (-1)) -+ continue; ++ if (psta->rssi_stat.UndecoratedSmoothedPWDB == (-1)) ++ continue; + -+ if (psta->rssi_stat.UndecoratedSmoothedPWDB < tmpEntryMinPWDB) -+ tmpEntryMinPWDB = psta->rssi_stat.UndecoratedSmoothedPWDB; ++ if (psta->rssi_stat.UndecoratedSmoothedPWDB < tmpEntryMinPWDB) ++ tmpEntryMinPWDB = psta->rssi_stat.UndecoratedSmoothedPWDB; + -+ if (psta->rssi_stat.UndecoratedSmoothedPWDB > tmpEntryMaxPWDB) -+ tmpEntryMaxPWDB = psta->rssi_stat.UndecoratedSmoothedPWDB; ++ if (psta->rssi_stat.UndecoratedSmoothedPWDB > tmpEntryMaxPWDB) ++ tmpEntryMaxPWDB = psta->rssi_stat.UndecoratedSmoothedPWDB; + -+ if (psta->rssi_stat.UndecoratedSmoothedPWDB != (-1)) { -+ PWDB_rssi[sta_cnt++] = (psta->mac_id | (psta->rssi_stat.UndecoratedSmoothedPWDB<<16)); -+ } ++ if (psta->rssi_stat.UndecoratedSmoothedPWDB != (-1)) ++ PWDB_rssi[sta_cnt++] = (psta->mac_id | (psta->rssi_stat.UndecoratedSmoothedPWDB<<16)); + } + } + + /* printk("%s ==> sta_cnt(%d)\n", __func__, sta_cnt); */ + -+ for (i = 0; i< sta_cnt; i++) -+ { ++ for (i = 0; i < sta_cnt; i++) { + if (PWDB_rssi[i] != (0)) { + if (pHalData->fw_ractrl == true)/* Report every sta's RSSI to FW */ -+ { + rtl8723b_set_rssi_cmd(Adapter, (u8 *)(&PWDB_rssi[i])); -+ } + } + } + } @@ -57881,22 +56327,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r + + + if (tmpEntryMaxPWDB != 0) /* If associated entry is found */ -+ { + pdmpriv->EntryMaxUndecoratedSmoothedPWDB = tmpEntryMaxPWDB; -+ } + else -+ { + pdmpriv->EntryMaxUndecoratedSmoothedPWDB = 0; -+ } + + if (tmpEntryMinPWDB != 0xff) /* If associated entry is found */ -+ { + pdmpriv->EntryMinUndecoratedSmoothedPWDB = tmpEntryMinPWDB; -+ } + else -+ { + pdmpriv->EntryMinUndecoratedSmoothedPWDB = 0; -+ } + + FindMinimumRSSI(Adapter);/* get pdmpriv->MinUndecoratedPWDBForDM */ + @@ -57908,24 +56346,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r +/* 3 Tx Power Tracking */ +/* 3 ============================================================ */ + -+void -+odm_TXPowerTrackingInit( -+PDM_ODM_T pDM_Odm -+ ) ++void odm_TXPowerTrackingInit(PDM_ODM_T pDM_Odm) +{ + odm_TXPowerTrackingThermalMeterInit(pDM_Odm); +} + -+static u8 -+getSwingIndex( -+PDM_ODM_T pDM_Odm -+ ) ++static u8 getSwingIndex(PDM_ODM_T pDM_Odm) +{ -+ struct adapter * Adapter = pDM_Odm->Adapter; -+ u8 i = 0; -+ u32 bbSwing; -+ u32 swingTableSize; -+ u32 * pSwingTable; ++ struct adapter *Adapter = pDM_Odm->Adapter; ++ u8 i = 0; ++ u32 bbSwing; ++ u32 swingTableSize; ++ u32 *pSwingTable; + + bbSwing = PHY_QueryBBReg(Adapter, rOFDM0_XATxIQImbalance, 0xFFC00000); + @@ -57943,15 +56375,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r + return i; +} + -+void -+odm_TXPowerTrackingThermalMeterInit( -+PDM_ODM_T pDM_Odm -+ ) ++void odm_TXPowerTrackingThermalMeterInit(PDM_ODM_T pDM_Odm) +{ + u8 defaultSwingIndex = getSwingIndex(pDM_Odm); -+ u8 p = 0; -+ struct adapter * Adapter = pDM_Odm->Adapter; -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ u8 p = 0; ++ struct adapter *Adapter = pDM_Odm->Adapter; ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + + + struct dm_priv *pdmpriv = &pHalData->dmpriv; @@ -57980,8 +56409,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r + pDM_Odm->BbSwingIdxCckBase = pDM_Odm->DefaultCckIndex; + pDM_Odm->RFCalibrateInfo.CCK_index = pDM_Odm->DefaultCckIndex; + -+ for (p = ODM_RF_PATH_A; p < MAX_RF_PATH; ++p) -+ { ++ for (p = ODM_RF_PATH_A; p < MAX_RF_PATH; ++p) { + pDM_Odm->BbSwingIdxOfdmBase[p] = pDM_Odm->DefaultOfdmIndex; + pDM_Odm->RFCalibrateInfo.OFDM_index[p] = pDM_Odm->DefaultOfdmIndex; + pDM_Odm->RFCalibrateInfo.DeltaPowerIndex[p] = 0; @@ -57992,37 +56420,26 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r +} + + -+void -+ODM_TXPowerTrackingCheck( -+ PDM_ODM_T pDM_Odm -+ ) ++void ODM_TXPowerTrackingCheck(PDM_ODM_T pDM_Odm) +{ + odm_TXPowerTrackingCheckCE(pDM_Odm); +} + -+void -+odm_TXPowerTrackingCheckCE( -+ PDM_ODM_T pDM_Odm -+ ) ++void odm_TXPowerTrackingCheckCE(PDM_ODM_T pDM_Odm) +{ + struct adapter *Adapter = pDM_Odm->Adapter; + + if (!(pDM_Odm->SupportAbility & ODM_RF_TX_PWR_TRACK)) -+ { + return; -+ } + -+ if (!pDM_Odm->RFCalibrateInfo.TM_Trigger) /* at least delay 1 sec */ -+ { ++ if (!pDM_Odm->RFCalibrateInfo.TM_Trigger) { /* at least delay 1 sec */ + PHY_SetRFReg(pDM_Odm->Adapter, ODM_RF_PATH_A, RF_T_METER_NEW, (BIT17 | BIT16), 0x03); + + /* DBG_871X("Trigger Thermal Meter!!\n"); */ + + pDM_Odm->RFCalibrateInfo.TM_Trigger = 1; + return; -+ } -+ else -+ { ++ } else { + /* DBG_871X("Schedule TxPowerTracking direct call!!\n"); */ + ODM_TXPowerTrackingCallback_ThermalMeter(Adapter); + pDM_Odm->RFCalibrateInfo.TM_Trigger = 0; @@ -58032,21 +56449,19 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.c linux-4.3-rtl8723bs/3rdparty/r +/* 3 ============================================================ */ +/* 3 SW Antenna Diversity */ +/* 3 ============================================================ */ -+void -+odm_SwAntDetectInit( -+ PDM_ODM_T pDM_Odm -+ ) ++void odm_SwAntDetectInit(PDM_ODM_T pDM_Odm) +{ -+ pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; ++ pSWAT_T pDM_SWAT_Table = &pDM_Odm->DM_SWAT_Table; ++ + pDM_SWAT_Table->SWAS_NoLink_BK_Reg92c = rtw_read32(pDM_Odm->Adapter, rDPDT_control); + pDM_SWAT_Table->PreAntenna = MAIN_ANT; + pDM_SWAT_Table->CurAntenna = MAIN_ANT; + pDM_SWAT_Table->SWAS_NoLink_State = 0; +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_CfoTracking.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_CfoTracking.c ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_CfoTracking.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_CfoTracking.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,275 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_CfoTracking.c linux/3rdparty/rtl8723bs/hal/odm_CfoTracking.c +--- linux.old/3rdparty/rtl8723bs/hal/odm_CfoTracking.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_CfoTracking.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,338 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -58064,19 +56479,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_CfoTracking.c linux-4.3-rtl8723b + +#include "odm_precomp.h" + -+static void -+odm_SetCrystalCap( -+ void * pDM_VOID, -+ u8 CrystalCap -+) ++static void odm_SetCrystalCap(void *pDM_VOID, u8 CrystalCap) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; -+ PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; -+ bool bEEPROMCheck; -+ struct adapter * Adapter = pDM_Odm->Adapter; -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; ++ bool bEEPROMCheck; ++ struct adapter *Adapter = pDM_Odm->Adapter; ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + -+ bEEPROMCheck = (pHalData->EEPROMVersion >= 0x01)?true:false; ++ bEEPROMCheck = (pHalData->EEPROMVersion >= 0x01) ? true : false; + + if (pCfoTrack->CrystalCap == CrystalCap) + return; @@ -58085,21 +56496,31 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_CfoTracking.c linux-4.3-rtl8723b + + /* 0x2C[23:18] = 0x2C[17:12] = CrystalCap */ + CrystalCap = CrystalCap & 0x3F; -+ PHY_SetBBReg(pDM_Odm->Adapter, REG_MAC_PHY_CTRL, 0x00FFF000, (CrystalCap | (CrystalCap << 6))); ++ PHY_SetBBReg( ++ pDM_Odm->Adapter, ++ REG_MAC_PHY_CTRL, ++ 0x00FFF000, ++ (CrystalCap | (CrystalCap << 6)) ++ ); + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("odm_SetCrystalCap(): CrystalCap = 0x%x\n", CrystalCap)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_CFO_TRACKING, ++ ODM_DBG_LOUD, ++ ( ++ "odm_SetCrystalCap(): CrystalCap = 0x%x\n", ++ CrystalCap ++ ) ++ ); +} + -+static u8 -+odm_GetDefaultCrytaltalCap( -+ void * pDM_VOID -+) ++static u8 odm_GetDefaultCrytaltalCap(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; -+ u8 CrystalCap = 0x20; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ u8 CrystalCap = 0x20; + -+ struct adapter * Adapter = pDM_Odm->Adapter; -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ struct adapter *Adapter = pDM_Odm->Adapter; ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + + CrystalCap = pHalData->CrystalCap; + @@ -58108,41 +56529,40 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_CfoTracking.c linux-4.3-rtl8723b + return CrystalCap; +} + -+static void -+odm_SetATCStatus( -+ void * pDM_VOID, -+ bool ATCStatus -+) ++static void odm_SetATCStatus(void *pDM_VOID, bool ATCStatus) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; -+ PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; + + if (pCfoTrack->bATCStatus == ATCStatus) + return; + -+ PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG(BB_ATC, pDM_Odm), ODM_BIT(BB_ATC, pDM_Odm), ATCStatus); ++ PHY_SetBBReg( ++ pDM_Odm->Adapter, ++ ODM_REG(BB_ATC, pDM_Odm), ++ ODM_BIT(BB_ATC, pDM_Odm), ++ ATCStatus ++ ); + pCfoTrack->bATCStatus = ATCStatus; +} + -+static bool -+odm_GetATCStatus( -+ void * pDM_VOID -+) ++static bool odm_GetATCStatus(void *pDM_VOID) +{ -+ bool ATCStatus; -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ bool ATCStatus; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + -+ ATCStatus = (bool)PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG(BB_ATC, pDM_Odm), ODM_BIT(BB_ATC, pDM_Odm)); ++ ATCStatus = (bool)PHY_QueryBBReg( ++ pDM_Odm->Adapter, ++ ODM_REG(BB_ATC, pDM_Odm), ++ ODM_BIT(BB_ATC, pDM_Odm) ++ ); + return ATCStatus; +} + -+void -+ODM_CfoTrackingReset( -+ void * pDM_VOID -+) ++void ODM_CfoTrackingReset(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; -+ PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; + + pCfoTrack->DefXCap = odm_GetDefaultCrytaltalCap(pDM_Odm); + pCfoTrack->bAdjust = true; @@ -58151,56 +56571,85 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_CfoTracking.c linux-4.3-rtl8723b + odm_SetATCStatus(pDM_Odm, true); +} + -+void -+ODM_CfoTrackingInit( -+ void * pDM_VOID -+) ++void ODM_CfoTrackingInit(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; -+ PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; + -+ pCfoTrack->DefXCap = pCfoTrack->CrystalCap = odm_GetDefaultCrytaltalCap(pDM_Odm); ++ pCfoTrack->DefXCap = ++ pCfoTrack->CrystalCap = odm_GetDefaultCrytaltalCap(pDM_Odm); + pCfoTrack->bATCStatus = odm_GetATCStatus(pDM_Odm); + pCfoTrack->bAdjust = true; -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking_init() =========>\n")); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking_init(): bATCStatus = %d, CrystalCap = 0x%x\n", pCfoTrack->bATCStatus, pCfoTrack->DefXCap)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_CFO_TRACKING, ++ ODM_DBG_LOUD, ++ ("ODM_CfoTracking_init() =========>\n") ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_CFO_TRACKING, ++ ODM_DBG_LOUD, ++ ( ++ "ODM_CfoTracking_init(): bATCStatus = %d, CrystalCap = 0x%x\n", ++ pCfoTrack->bATCStatus, ++ pCfoTrack->DefXCap ++ ) ++ ); +} + -+void -+ODM_CfoTracking( -+ void * pDM_VOID -+) ++void ODM_CfoTracking(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; -+ PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; -+ int CFO_kHz_A, CFO_kHz_B, CFO_ave = 0; -+ int CFO_ave_diff; -+ int CrystalCap = (int)pCfoTrack->CrystalCap; -+ u8 Adjust_Xtal = 1; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; ++ int CFO_kHz_A, CFO_kHz_B, CFO_ave = 0; ++ int CFO_ave_diff; ++ int CrystalCap = (int)pCfoTrack->CrystalCap; ++ u8 Adjust_Xtal = 1; + + /* 4 Support ability */ -+ if (!(pDM_Odm->SupportAbility & ODM_BB_CFO_TRACKING)) -+ { -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Return: SupportAbility ODM_BB_CFO_TRACKING is disabled\n")); ++ if (!(pDM_Odm->SupportAbility & ODM_BB_CFO_TRACKING)) { ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_CFO_TRACKING, ++ ODM_DBG_LOUD, ++ ("ODM_CfoTracking(): Return: SupportAbility ODM_BB_CFO_TRACKING is disabled\n") ++ ); + return; + } + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking() =========>\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_CFO_TRACKING, ++ ODM_DBG_LOUD, ++ ("ODM_CfoTracking() =========>\n") ++ ); + -+ if (!pDM_Odm->bLinked || !pDM_Odm->bOneEntryOnly) -+ { ++ if (!pDM_Odm->bLinked || !pDM_Odm->bOneEntryOnly) { + /* 4 No link or more than one entry */ + ODM_CfoTrackingReset(pDM_Odm); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Reset: bLinked = %d, bOneEntryOnly = %d\n", -+ pDM_Odm->bLinked, pDM_Odm->bOneEntryOnly)); -+ } -+ else -+ { ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_CFO_TRACKING, ++ ODM_DBG_LOUD, ++ ( ++ "ODM_CfoTracking(): Reset: bLinked = %d, bOneEntryOnly = %d\n", ++ pDM_Odm->bLinked, ++ pDM_Odm->bOneEntryOnly ++ ) ++ ); ++ } else { + /* 3 1. CFO Tracking */ + /* 4 1.1 No new packet */ -+ if (pCfoTrack->packetCount == pCfoTrack->packetCount_pre) -+ { -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): packet counter doesn't change\n")); ++ if (pCfoTrack->packetCount == pCfoTrack->packetCount_pre) { ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_CFO_TRACKING, ++ ODM_DBG_LOUD, ++ ( ++ "ODM_CfoTracking(): packet counter doesn't change\n" ++ ) ++ ); + return; + } + pCfoTrack->packetCount_pre = pCfoTrack->packetCount; @@ -58213,55 +56662,77 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_CfoTracking.c linux-4.3-rtl8723b + CFO_ave = CFO_kHz_A; + else + CFO_ave = (int)(CFO_kHz_A + CFO_kHz_B) >> 1; -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): CFO_kHz_A = %dkHz, CFO_kHz_B = %dkHz, CFO_ave = %dkHz\n", -+ CFO_kHz_A, CFO_kHz_B, CFO_ave)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_CFO_TRACKING, ++ ODM_DBG_LOUD, ++ ( ++ "ODM_CfoTracking(): CFO_kHz_A = %dkHz, CFO_kHz_B = %dkHz, CFO_ave = %dkHz\n", ++ CFO_kHz_A, ++ CFO_kHz_B, ++ CFO_ave ++ ) ++ ); + + /* 4 1.3 Avoid abnormal large CFO */ -+ CFO_ave_diff = (pCfoTrack->CFO_ave_pre >= CFO_ave)?(pCfoTrack->CFO_ave_pre - CFO_ave):(CFO_ave - pCfoTrack->CFO_ave_pre); -+ if (CFO_ave_diff > 20 && pCfoTrack->largeCFOHit == 0 && !pCfoTrack->bAdjust) -+ { ++ CFO_ave_diff = ++ (pCfoTrack->CFO_ave_pre >= CFO_ave) ? ++ (pCfoTrack->CFO_ave_pre-CFO_ave) : ++ (CFO_ave-pCfoTrack->CFO_ave_pre); ++ ++ if ( ++ CFO_ave_diff > 20 && ++ pCfoTrack->largeCFOHit == 0 && ++ !pCfoTrack->bAdjust ++ ) { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): first large CFO hit\n")); + pCfoTrack->largeCFOHit = 1; + return; -+ } -+ else ++ } else + pCfoTrack->largeCFOHit = 0; + pCfoTrack->CFO_ave_pre = CFO_ave; + + /* 4 1.4 Dynamic Xtal threshold */ -+ if (pCfoTrack->bAdjust == false) -+ { ++ if (pCfoTrack->bAdjust == false) { + if (CFO_ave > CFO_TH_XTAL_HIGH || CFO_ave < (-CFO_TH_XTAL_HIGH)) + pCfoTrack->bAdjust = true; -+ } -+ else -+ { ++ } else { + if (CFO_ave < CFO_TH_XTAL_LOW && CFO_ave > (-CFO_TH_XTAL_LOW)) + pCfoTrack->bAdjust = false; + } + + /* 4 1.5 BT case: Disable CFO tracking */ -+ if (pDM_Odm->bBtEnabled) -+ { ++ if (pDM_Odm->bBtEnabled) { + pCfoTrack->bAdjust = false; + odm_SetCrystalCap(pDM_Odm, pCfoTrack->DefXCap); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Disable CFO tracking for BT!!\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_CFO_TRACKING, ++ ODM_DBG_LOUD, ++ ("ODM_CfoTracking(): Disable CFO tracking for BT!!\n") ++ ); + } + + /* 4 1.6 Big jump */ -+ if (pCfoTrack->bAdjust) -+ { ++ if (pCfoTrack->bAdjust) { + if (CFO_ave > CFO_TH_XTAL_LOW) -+ Adjust_Xtal = Adjust_Xtal + ((CFO_ave - CFO_TH_XTAL_LOW) >> 2); ++ Adjust_Xtal = Adjust_Xtal+((CFO_ave-CFO_TH_XTAL_LOW)>>2); + else if (CFO_ave < (-CFO_TH_XTAL_LOW)) -+ Adjust_Xtal = Adjust_Xtal + ((CFO_TH_XTAL_LOW - CFO_ave) >> 2); ++ Adjust_Xtal = Adjust_Xtal+((CFO_TH_XTAL_LOW-CFO_ave)>>2); + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Crystal cap offset = %d\n", Adjust_Xtal)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_CFO_TRACKING, ++ ODM_DBG_LOUD, ++ ( ++ "ODM_CfoTracking(): Crystal cap offset = %d\n", ++ Adjust_Xtal ++ ) ++ ); + } + + /* 4 1.7 Adjust Crystal Cap. */ -+ if (pCfoTrack->bAdjust) -+ { ++ if (pCfoTrack->bAdjust) { + if (CFO_ave > CFO_TH_XTAL_LOW) + CrystalCap = CrystalCap + Adjust_Xtal; + else if (CFO_ave < (-CFO_TH_XTAL_LOW)) @@ -58274,46 +56745,53 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_CfoTracking.c linux-4.3-rtl8723b + + odm_SetCrystalCap(pDM_Odm, (u8)CrystalCap); + } -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Crystal cap = 0x%x, Default Crystal cap = 0x%x\n", -+ pCfoTrack->CrystalCap, pCfoTrack->DefXCap)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_CFO_TRACKING, ++ ODM_DBG_LOUD, ++ ( ++ "ODM_CfoTracking(): Crystal cap = 0x%x, Default Crystal cap = 0x%x\n", ++ pCfoTrack->CrystalCap, ++ pCfoTrack->DefXCap ++ ) ++ ); + + /* 3 2. Dynamic ATC switch */ -+ if (CFO_ave < CFO_TH_ATC && CFO_ave > -CFO_TH_ATC) -+ { ++ if (CFO_ave < CFO_TH_ATC && CFO_ave > -CFO_TH_ATC) { + odm_SetATCStatus(pDM_Odm, false); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Disable ATC!!\n")); -+ } -+ else -+ { ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_CFO_TRACKING, ++ ODM_DBG_LOUD, ++ ("ODM_CfoTracking(): Disable ATC!!\n") ++ ); ++ } else { + odm_SetATCStatus(pDM_Odm, true); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_CFO_TRACKING, ODM_DBG_LOUD, ("ODM_CfoTracking(): Enable ATC!!\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_CFO_TRACKING, ++ ODM_DBG_LOUD, ++ ("ODM_CfoTracking(): Enable ATC!!\n") ++ ); + } + } +} + -+void -+ODM_ParsingCFO( -+ void * pDM_VOID, -+ void * pPktinfo_VOID, -+ s8 * pcfotail -+ ) ++void ODM_ParsingCFO(void *pDM_VOID, void *pPktinfo_VOID, s8 *pcfotail) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; -+ PODM_PACKET_INFO_T pPktinfo = (PODM_PACKET_INFO_T)pPktinfo_VOID; -+ PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; -+ u8 i; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ PODM_PACKET_INFO_T pPktinfo = (PODM_PACKET_INFO_T)pPktinfo_VOID; ++ PCFO_TRACKING pCfoTrack = &pDM_Odm->DM_CfoTrack; ++ u8 i; + + if (!(pDM_Odm->SupportAbility & ODM_BB_CFO_TRACKING)) + return; + -+ if (pPktinfo->StationID != 0) -+ { ++ if (pPktinfo->StationID != 0) { + /* 3 Update CFO report for path-A & path-B */ + /* Only paht-A and path-B have CFO tail and short CFO */ + for (i = ODM_RF_PATH_A; i <= ODM_RF_PATH_B; i++) -+ { + pCfoTrack->CFO_tail[i] = (int)pcfotail[i]; -+ } + + /* 3 Update packet counter */ + if (pCfoTrack->packetCount == 0xffffffff) @@ -58322,10 +56800,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_CfoTracking.c linux-4.3-rtl8723b + pCfoTrack->packetCount++; + } +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_CfoTracking.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_CfoTracking.h ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_CfoTracking.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_CfoTracking.h 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,48 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_CfoTracking.h linux/3rdparty/rtl8723bs/hal/odm_CfoTracking.h +--- linux.old/3rdparty/rtl8723bs/hal/odm_CfoTracking.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_CfoTracking.h 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,47 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -58348,20 +56826,19 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_CfoTracking.h linux-4.3-rtl8723b +#define CFO_TH_XTAL_LOW 10 /* kHz */ +#define CFO_TH_ATC 80 /* kHz */ + -+typedef struct _CFO_TRACKING_ -+{ -+ bool bATCStatus; -+ bool largeCFOHit; -+ bool bAdjust; -+ u8 CrystalCap; -+ u8 DefXCap; -+ int CFO_tail[2]; -+ int CFO_ave_pre; -+ u32 packetCount; -+ u32 packetCount_pre; ++typedef struct _CFO_TRACKING_ { ++ bool bATCStatus; ++ bool largeCFOHit; ++ bool bAdjust; ++ u8 CrystalCap; ++ u8 DefXCap; ++ int CFO_tail[2]; ++ int CFO_ave_pre; ++ u32 packetCount; ++ u32 packetCount_pre; + -+ bool bForceXtalCap; -+ bool bReset; ++ bool bForceXtalCap; ++ bool bReset; +} CFO_TRACKING, *PCFO_TRACKING; + +void ODM_CfoTrackingReset(void *pDM_VOID @@ -58374,9 +56851,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_CfoTracking.h linux-4.3-rtl8723b +void ODM_ParsingCFO(void *pDM_VOID, void *pPktinfo_VOID, s8 *pcfotail); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_debug.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_debug.c ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_debug.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_debug.c 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_debug.c linux/3rdparty/rtl8723bs/hal/odm_debug.c +--- linux.old/3rdparty/rtl8723bs/hal/odm_debug.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_debug.c 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,52 @@ +/****************************************************************************** + * @@ -58430,10 +56907,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_debug.c linux-4.3-rtl8723bs/3rdp +/* ODM_COMP_PSD | */ +0; +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_debug.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_debug.h ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_debug.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_debug.h 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,154 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_debug.h linux/3rdparty/rtl8723bs/hal/odm_debug.h +--- linux.old/3rdparty/rtl8723bs/hal/odm_debug.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_debug.h 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,165 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -58449,71 +56926,73 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_debug.h linux-4.3-rtl8723bs/3rdp + * + ******************************************************************************/ + -+#ifndef __ODM_DBG_H__ ++#ifndef __ODM_DBG_H__ +#define __ODM_DBG_H__ + + +/* */ -+/* Define the debug levels */ ++/* Define the debug levels */ +/* */ -+/* 1. DBG_TRACE and DBG_LOUD are used for normal cases. */ -+/* So that, they can help SW engineer to develope or trace states changed */ -+/* and also help HW enginner to trace every operation to and from HW, */ -+/* e.g IO, Tx, Rx. */ ++/* 1. DBG_TRACE and DBG_LOUD are used for normal cases. */ ++/* So that, they can help SW engineer to develope or trace states changed */ ++/* and also help HW enginner to trace every operation to and from HW, */ ++/* e.g IO, Tx, Rx. */ +/* */ -+/* 2. DBG_WARNNING and DBG_SERIOUS are used for unusual or error cases, */ -+/* which help us to debug SW or HW. */ ++/* 2. DBG_WARNNING and DBG_SERIOUS are used for unusual or error cases, */ ++/* which help us to debug SW or HW. */ +/* */ +/* */ +/* */ -+/* Never used in a call to ODM_RT_TRACE()! */ ++/* Never used in a call to ODM_RT_TRACE()! */ +/* */ +#define ODM_DBG_OFF 1 + +/* */ -+/* Fatal bug. */ -+/* For example, Tx/Rx/IO locked up, OS hangs, memory access violation, */ -+/* resource allocation failed, unexpected HW behavior, HW BUG and so on. */ ++/* Fatal bug. */ ++/* For example, Tx/Rx/IO locked up, OS hangs, memory access violation, */ ++/* resource allocation failed, unexpected HW behavior, HW BUG and so on. */ +/* */ +#define ODM_DBG_SERIOUS 2 + +/* */ -+/* Abnormal, rare, or unexpeted cases. */ -+/* For example, IRP/Packet/OID canceled, device suprisely unremoved and so on. */ ++/* Abnormal, rare, or unexpeted cases. */ ++/* For example, */ ++/* IRP/Packet/OID canceled, */ ++/* device suprisely unremoved and so on. */ +/* */ +#define ODM_DBG_WARNING 3 + +/* */ -+/* Normal case with useful information about current SW or HW state. */ -+/* For example, Tx/Rx descriptor to fill, Tx/Rx descriptor completed status, */ -+/* SW protocol state change, dynamic mechanism state change and so on. */ ++/* Normal case with useful information about current SW or HW state. */ ++/* For example, Tx/Rx descriptor to fill, Tx/Rx descriptor completed status, */ ++/* SW protocol state change, dynamic mechanism state change and so on. */ +/* */ -+#define ODM_DBG_LOUD 4 ++#define ODM_DBG_LOUD 4 + +/* */ -+/* Normal case with detail execution flow or information. */ ++/* Normal case with detail execution flow or information. */ +/* */ -+#define ODM_DBG_TRACE 5 ++#define ODM_DBG_TRACE 5 + +/* */ +/* Define the tracing components */ +/* */ +/* */ +/* BB Functions */ -+#define ODM_COMP_DIG BIT0 -+#define ODM_COMP_RA_MASK BIT1 ++#define ODM_COMP_DIG BIT0 ++#define ODM_COMP_RA_MASK BIT1 +#define ODM_COMP_DYNAMIC_TXPWR BIT2 +#define ODM_COMP_FA_CNT BIT3 +#define ODM_COMP_RSSI_MONITOR BIT4 +#define ODM_COMP_CCK_PD BIT5 -+#define ODM_COMP_ANT_DIV BIT6 ++#define ODM_COMP_ANT_DIV BIT6 +#define ODM_COMP_PWR_SAVE BIT7 +#define ODM_COMP_PWR_TRAIN BIT8 +#define ODM_COMP_RATE_ADAPTIVE BIT9 -+#define ODM_COMP_PATH_DIV BIT10 -+#define ODM_COMP_PSD BIT11 ++#define ODM_COMP_PATH_DIV BIT10 ++#define ODM_COMP_PSD BIT11 +#define ODM_COMP_DYNAMIC_PRICCA BIT12 -+#define ODM_COMP_RXHP BIT13 ++#define ODM_COMP_RXHP BIT13 +#define ODM_COMP_MP BIT14 +#define ODM_COMP_CFO_TRACKING BIT15 +/* MAC Functions */ @@ -58522,56 +57001,68 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_debug.h linux-4.3-rtl8723bs/3rdp +/* RF Functions */ +#define ODM_COMP_TX_PWR_TRACK BIT24 +#define ODM_COMP_RX_GAIN_TRACK BIT25 -+#define ODM_COMP_CALIBRATION BIT26 ++#define ODM_COMP_CALIBRATION BIT26 +/* Common Functions */ +#define ODM_COMP_COMMON BIT30 -+#define ODM_COMP_INIT BIT31 ++#define ODM_COMP_INIT BIT31 + +/*------------------------Export Marco Definition---------------------------*/ -+ #define DbgPrint printk -+ #define RT_PRINTK(fmt, args...) DbgPrint("%s(): " fmt, __func__, ## args); -+ #define RT_DISP(dbgtype, dbgflag, printstr) ++ #define DbgPrint printk ++ #define RT_PRINTK(fmt, args...)\ ++ DbgPrint("%s(): " fmt, __func__, ## args) ++ #define RT_DISP(dbgtype, dbgflag, printstr) + +#ifndef ASSERT + #define ASSERT(expr) +#endif + +#if DBG -+#define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) \ -+ if (((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel || level == ODM_DBG_SERIOUS)) \ -+ { \ -+ RT_PRINTK fmt; \ -+ } ++#define ODM_RT_TRACE(pDM_Odm, comp, level, fmt)\ ++ if (\ ++ (comp & pDM_Odm->DebugComponents) &&\ ++ (level <= pDM_Odm->DebugLevel || level == ODM_DBG_SERIOUS)\ ++ ) {\ ++ RT_PRINTK fmt;\ ++ } + -+#define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt) \ -+ if (((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \ -+ { \ -+ RT_PRINTK fmt; \ -+ } ++#define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt)\ ++ if (\ ++ (comp & pDM_Odm->DebugComponents) &&\ ++ (level <= pDM_Odm->DebugLevel)\ ++ ) {\ ++ RT_PRINTK fmt;\ ++ } + -+#define ODM_RT_ASSERT(pDM_Odm, expr, fmt) \ -+ if (!(expr)) { \ -+ DbgPrint("Assertion failed! %s at ......\n", #expr); \ -+ DbgPrint(" ......%s,%s, line =%d\n", __FILE__, __func__, __LINE__); \ -+ RT_PRINTK fmt; \ -+ ASSERT(false); \ -+ } ++#define ODM_RT_ASSERT(pDM_Odm, expr, fmt)\ ++ if (!expr) {\ ++ DbgPrint("Assertion failed! %s at ......\n", #expr);\ ++ DbgPrint(\ ++ " ......%s,%s, line =%d\n",\ ++ __FILE__,\ ++ __func__,\ ++ __LINE__\ ++ );\ ++ RT_PRINTK fmt;\ ++ ASSERT(false);\ ++ } +#define ODM_dbg_enter() { DbgPrint("==> %s\n", __func__); } +#define ODM_dbg_exit() { DbgPrint("<== %s\n", __func__); } +#define ODM_dbg_trace(str) { DbgPrint("%s:%s\n", __func__, str); } + -+#define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr) \ -+ if (((comp) & pDM_Odm->DebugComponents) && (level <= pDM_Odm->DebugLevel)) \ -+ { \ -+ int __i; \ -+ u8 *__ptr = (u8 *)ptr; \ -+ DbgPrint("[ODM] "); \ -+ DbgPrint(title_str); \ -+ DbgPrint(" "); \ -+ for (__i = 0; __i<6; __i++) \ -+ DbgPrint("%02X%s", __ptr[__i], (__i ==5)?"":"-"); \ -+ DbgPrint("\n"); \ -+ } ++#define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr)\ ++ if (\ ++ (comp & pDM_Odm->DebugComponents) &&\ ++ (level <= pDM_Odm->DebugLevel)\ ++ ) {\ ++ int __i;\ ++ u8 *__ptr = (u8 *)ptr;\ ++ DbgPrint("[ODM] ");\ ++ DbgPrint(title_str);\ ++ DbgPrint(" ");\ ++ for (__i = 0; __i < 6; __i++)\ ++ DbgPrint("%02X%s", __ptr[__i], (__i == 5) ? "" : "-");\ ++ DbgPrint("\n");\ ++ } +#else +#define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) +#define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt) @@ -58582,16 +57073,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_debug.h linux-4.3-rtl8723bs/3rdp +#define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr) +#endif + -+void -+ODM_InitDebugSetting( -+ PDM_ODM_T pDM_Odm -+ ); ++void ODM_InitDebugSetting(PDM_ODM_T pDM_Odm); + +#endif /* __ODM_DBG_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_DIG.c ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_DIG.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,1104 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_DIG.c linux/3rdparty/rtl8723bs/hal/odm_DIG.c +--- linux.old/3rdparty/rtl8723bs/hal/odm_DIG.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_DIG.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,1221 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -58609,12 +57097,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + +#include "odm_precomp.h" + -+#define ADAPTIVITY_VERSION "5.0" ++#define ADAPTIVITY_VERSION "5.0" + -+void -+odm_NHMCounterStatisticsInit( -+ void * pDM_VOID -+ ) ++void odm_NHMCounterStatisticsInit(void *pDM_VOID) +{ + PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + @@ -58630,12 +57115,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG_OFDM_FA_RSTC_11N, BIT7, 0x1); /* 0xc0c[7]= 1 max power among all RX ants */ +} + -+void -+odm_NHMCounterStatistics( -+ void * pDM_VOID -+ ) ++void odm_NHMCounterStatistics(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + /* Get NHM report */ + odm_GetNHMCounterStatistics(pDM_Odm); @@ -58644,36 +57126,27 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + odm_NHMCounterStatisticsReset(pDM_Odm); +} + -+void -+odm_GetNHMCounterStatistics( -+ void * pDM_VOID -+ ) ++void odm_GetNHMCounterStatistics(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; -+ u32 value32 = 0; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ u32 value32 = 0; + + value32 = PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG_NHM_CNT_11N, bMaskDWord); + + pDM_Odm->NHM_cnt_0 = (u8)(value32 & bMaskByte0); +} + -+void -+odm_NHMCounterStatisticsReset( -+ void * pDM_VOID -+ ) ++void odm_NHMCounterStatisticsReset(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG_NHM_TH9_TH10_11N, BIT1, 0); + PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG_NHM_TH9_TH10_11N, BIT1, 1); +} + -+void -+odm_NHMBBInit( -+ void * pDM_VOID -+) ++void odm_NHMBBInit(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + pDM_Odm->adaptivity_flag = 0; + pDM_Odm->tolerance_cnt = 3; @@ -58684,62 +57157,61 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar +} + +/* */ -+void -+odm_NHMBB( -+ void * pDM_VOID -+) ++void odm_NHMBB(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + /* u8 test_status; */ + /* Pfalse_ALARM_STATISTICS pFalseAlmCnt = &(pDM_Odm->FalseAlmCnt); */ + -+ pDM_Odm->NHMCurTxOkcnt = *(pDM_Odm->pNumTxBytesUnicast) - pDM_Odm->NHMLastTxOkcnt; -+ pDM_Odm->NHMCurRxOkcnt = *(pDM_Odm->pNumRxBytesUnicast) - pDM_Odm->NHMLastRxOkcnt; -+ pDM_Odm->NHMLastTxOkcnt = *(pDM_Odm->pNumTxBytesUnicast); -+ pDM_Odm->NHMLastRxOkcnt = *(pDM_Odm->pNumRxBytesUnicast); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("NHM_cnt_0 =%d, NHMCurTxOkcnt = %llu, NHMCurRxOkcnt = %llu\n", -+ pDM_Odm->NHM_cnt_0, pDM_Odm->NHMCurTxOkcnt, pDM_Odm->NHMCurRxOkcnt)); ++ pDM_Odm->NHMCurTxOkcnt = ++ *(pDM_Odm->pNumTxBytesUnicast)-pDM_Odm->NHMLastTxOkcnt; ++ pDM_Odm->NHMCurRxOkcnt = ++ *(pDM_Odm->pNumRxBytesUnicast)-pDM_Odm->NHMLastRxOkcnt; ++ pDM_Odm->NHMLastTxOkcnt = ++ *(pDM_Odm->pNumTxBytesUnicast); ++ pDM_Odm->NHMLastRxOkcnt = ++ *(pDM_Odm->pNumRxBytesUnicast); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_DIG, ++ ODM_DBG_LOUD, ++ ( ++ "NHM_cnt_0 =%d, NHMCurTxOkcnt = %llu, NHMCurRxOkcnt = %llu\n", ++ pDM_Odm->NHM_cnt_0, ++ pDM_Odm->NHMCurTxOkcnt, ++ pDM_Odm->NHMCurRxOkcnt ++ ) ++ ); + + -+ if ((pDM_Odm->NHMCurTxOkcnt) + 1 > (u64)(pDM_Odm->NHMCurRxOkcnt<<2) + 1) /* Tx > 4*Rx possible for adaptivity test */ -+ { -+ if (pDM_Odm->NHM_cnt_0 >= 190 || pDM_Odm->adaptivity_flag == true) -+ { ++ if ((pDM_Odm->NHMCurTxOkcnt) + 1 > (u64)(pDM_Odm->NHMCurRxOkcnt<<2) + 1) { /* Tx > 4*Rx possible for adaptivity test */ ++ if (pDM_Odm->NHM_cnt_0 >= 190 || pDM_Odm->adaptivity_flag == true) { + /* Enable EDCCA since it is possible running Adaptivity testing */ + /* test_status = 1; */ + pDM_Odm->adaptivity_flag = true; + pDM_Odm->tolerance_cnt = 0; -+ } -+ else -+ { -+ if (pDM_Odm->tolerance_cnt<3) ++ } else { ++ if (pDM_Odm->tolerance_cnt < 3) + pDM_Odm->tolerance_cnt = pDM_Odm->tolerance_cnt + 1; + else + pDM_Odm->tolerance_cnt = 4; + /* test_status = 5; */ -+ if (pDM_Odm->tolerance_cnt > 3) -+ { ++ if (pDM_Odm->tolerance_cnt > 3) { + /* test_status = 3; */ + pDM_Odm->adaptivity_flag = false; + } + } -+ } -+ else /* TXadaptivity_flag == true && pDM_Odm->NHM_cnt_0 <= 200) -+ { ++ } else { /* TXadaptivity_flag == true && pDM_Odm->NHM_cnt_0 <= 200) { + /* test_status = 2; */ + pDM_Odm->tolerance_cnt = 0; -+ } -+ else -+ { -+ if (pDM_Odm->tolerance_cnt<3) ++ } else { ++ if (pDM_Odm->tolerance_cnt < 3) + pDM_Odm->tolerance_cnt = pDM_Odm->tolerance_cnt + 1; + else + pDM_Odm->tolerance_cnt = 4; + /* test_status = 5; */ -+ if (pDM_Odm->tolerance_cnt >3) -+ { ++ if (pDM_Odm->tolerance_cnt > 3) { + /* test_status = 4; */ + pDM_Odm->adaptivity_flag = false; + } @@ -58749,24 +57221,20 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("adaptivity_flag = %d\n ", pDM_Odm->adaptivity_flag)); +} + -+void -+odm_SearchPwdBLowerBound( -+ void * pDM_VOID, -+ u8 IGI_target -+) ++void odm_SearchPwdBLowerBound(void *pDM_VOID, u8 IGI_target) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; -+ u32 value32 = 0; -+ u8 cnt, IGI; -+ bool bAdjust =true; -+ s8 TH_L2H_dmc, TH_H2L_dmc; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ u32 value32 = 0; ++ u8 cnt, IGI; ++ bool bAdjust = true; ++ s8 TH_L2H_dmc, TH_H2L_dmc; + s8 Diff; + + IGI = 0x50; /* find H2L, L2H lower bound */ + ODM_Write_DIG(pDM_Odm, IGI); + + -+ Diff = IGI_target -(s8)IGI; ++ Diff = IGI_target-(s8)IGI; + TH_L2H_dmc = pDM_Odm->TH_L2H_ini + Diff; + if (TH_L2H_dmc > 10) + TH_L2H_dmc = 10; @@ -58777,7 +57245,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + mdelay(5); + + while (bAdjust) { -+ for (cnt = 0; cnt<20; cnt ++) { ++ for (cnt = 0; cnt < 20; cnt++) { + value32 = PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG_RPT_11N, bMaskDWord); + + if (value32 & BIT30) @@ -58790,7 +57258,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + /* DbgPrint("txEdcca1 = %d, txEdcca0 = %d\n", pDM_Odm->txEdcca1, pDM_Odm->txEdcca0); */ + + if (pDM_Odm->txEdcca1 > 5) { -+ IGI = IGI -1; ++ IGI = IGI-1; + TH_L2H_dmc = TH_L2H_dmc + 1; + if (TH_L2H_dmc > 10) + TH_L2H_dmc = 10; @@ -58822,20 +57290,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + } + } + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("IGI = 0x%x, H2L_lb = 0x%x, L2H_lb = 0x%x\n", IGI, pDM_Odm->H2L_lb , pDM_Odm->L2H_lb)); ++ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("IGI = 0x%x, H2L_lb = 0x%x, L2H_lb = 0x%x\n", IGI, pDM_Odm->H2L_lb, pDM_Odm->L2H_lb)); +} + -+void -+odm_AdaptivityInit( -+void * pDM_VOID -+) ++void odm_AdaptivityInit(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + if (pDM_Odm->Carrier_Sense_enable == false) -+ { + pDM_Odm->TH_L2H_ini = 0xf7; /* -7 */ -+ } + else + pDM_Odm->TH_L2H_ini = 0xa; + @@ -58858,19 +57321,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar +} + + -+void -+odm_Adaptivity( -+ void * pDM_VOID, -+ u8 IGI -+) ++void odm_Adaptivity(void *pDM_VOID, u8 IGI) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + s8 TH_L2H_dmc, TH_H2L_dmc; + s8 Diff, IGI_target; + bool EDCCA_State = false; + -+ if (!(pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY)) -+ { ++ if (!(pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY)) { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("Go to odm_DynamicEDCCA()\n")); + return; + } @@ -58889,38 +57347,48 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + pDM_Odm->IGI_target = (u8) IGI_target; + + /* Search pwdB lower bound */ -+ if (pDM_Odm->TxHangFlg == true) -+ { ++ if (pDM_Odm->TxHangFlg == true) { + PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG_DBG_RPT_11N, bMaskDWord, 0x208); + odm_SearchPwdBLowerBound(pDM_Odm, pDM_Odm->IGI_target); + } + -+ if ((!pDM_Odm->bLinked)||(*pDM_Odm->pChannel > 149)) /* Band4 doesn't need adaptivity */ -+ { ++ if ((!pDM_Odm->bLinked) || (*pDM_Odm->pChannel > 149)) { /* Band4 doesn't need adaptivity */ + PHY_SetBBReg(pDM_Odm->Adapter, rOFDM0_ECCAThreshold, bMaskByte0, 0x7f); + PHY_SetBBReg(pDM_Odm->Adapter, rOFDM0_ECCAThreshold, bMaskByte2, 0x7f); + return; + } + -+ if (!pDM_Odm->ForceEDCCA) -+ { ++ if (!pDM_Odm->ForceEDCCA) { + if (pDM_Odm->RSSI_Min > pDM_Odm->AdapEn_RSSI) + EDCCA_State = 1; + else if (pDM_Odm->RSSI_Min < (pDM_Odm->AdapEn_RSSI - 5)) + EDCCA_State = 0; -+ } -+ else ++ } else + EDCCA_State = 1; + -+ if (pDM_Odm->bLinked && pDM_Odm->Carrier_Sense_enable == false && pDM_Odm->NHM_disable == false &&pDM_Odm->TxHangFlg == false) ++ if ( ++ pDM_Odm->bLinked && ++ pDM_Odm->Carrier_Sense_enable == false && ++ pDM_Odm->NHM_disable == false && ++ pDM_Odm->TxHangFlg == false ++ ) + odm_NHMBB(pDM_Odm); + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("BandWidth =%s, IGI_target = 0x%x, EDCCA_State =%d\n", -+ (*pDM_Odm->pBandWidth ==ODM_BW80M)?"80M":((*pDM_Odm->pBandWidth ==ODM_BW40M)?"40M":"20M"), IGI_target, EDCCA_State)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_DIG, ++ ODM_DBG_LOUD, ++ ( ++ "BandWidth =%s, IGI_target = 0x%x, EDCCA_State =%d\n", ++ (*pDM_Odm->pBandWidth == ODM_BW80M) ? "80M" : ++ ((*pDM_Odm->pBandWidth == ODM_BW40M) ? "40M" : "20M"), ++ IGI_target, ++ EDCCA_State ++ ) ++ ); + -+ if (EDCCA_State == 1) -+ { -+ Diff = IGI_target -(s8)IGI; ++ if (EDCCA_State == 1) { ++ Diff = IGI_target-(s8)IGI; + TH_L2H_dmc = pDM_Odm->TH_L2H_ini + Diff; + if (TH_L2H_dmc > 10) + TH_L2H_dmc = 10; @@ -58932,9 +57400,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + TH_H2L_dmc = pDM_Odm->H2L_lb; + if (TH_L2H_dmc < pDM_Odm->L2H_lb) + TH_L2H_dmc = pDM_Odm->L2H_lb; -+ } -+ else -+ { ++ } else { + TH_L2H_dmc = 0x7f; + TH_H2L_dmc = 0x7f; + } @@ -58944,17 +57410,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + PHY_SetBBReg(pDM_Odm->Adapter, rOFDM0_ECCAThreshold, bMaskByte2, (u8)TH_H2L_dmc); +} + -+void -+ODM_Write_DIG( -+void * pDM_VOID, -+u8 CurrentIGI -+ ) ++void ODM_Write_DIG(void *pDM_VOID, u8 CurrentIGI) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; -+ pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + -+ if (pDM_DigTable->bStopDIG) -+ { ++ if (pDM_DigTable->bStopDIG) { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("Stop Writing IGI\n")); + return; + } @@ -58962,13 +57423,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_TRACE, ("ODM_REG(IGI_A, pDM_Odm) = 0x%x, ODM_BIT(IGI, pDM_Odm) = 0x%x\n", + ODM_REG(IGI_A, pDM_Odm), ODM_BIT(IGI, pDM_Odm))); + -+ if (pDM_DigTable->CurIGValue != CurrentIGI) -+ { ++ if (pDM_DigTable->CurIGValue != CurrentIGI) { + /* 1 Check initial gain by upper bound */ -+ if (!pDM_DigTable->bPSDInProgress) -+ { -+ if (CurrentIGI > pDM_DigTable->rx_gain_range_max) -+ { ++ if (!pDM_DigTable->bPSDInProgress) { ++ if (CurrentIGI > pDM_DigTable->rx_gain_range_max) { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_TRACE, ("CurrentIGI(0x%02x) is larger than upper bound !!\n", pDM_DigTable->rx_gain_range_max)); + CurrentIGI = pDM_DigTable->rx_gain_range_max; + } @@ -58988,104 +57446,107 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + +} + -+void -+odm_PauseDIG( -+ void * pDM_VOID, -+ ODM_Pause_DIG_TYPE PauseType, -+ u8 IGIValue ++void odm_PauseDIG( ++ void *pDM_VOID, ++ ODM_Pause_DIG_TYPE PauseType, ++ u8 IGIValue +) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; -+ pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; -+ static bool bPaused = false; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; ++ static bool bPaused = false; + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG() =========>\n")); + -+ if ((pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY) && pDM_Odm->TxHangFlg == true) -+ { -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Dynamic adjust threshold in progress !!\n")); ++ if ( ++ (pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY) && ++ pDM_Odm->TxHangFlg == true ++ ) { ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_DIG, ++ ODM_DBG_LOUD, ++ ("odm_PauseDIG(): Dynamic adjust threshold in progress !!\n") ++ ); + return; + } + -+ if (!bPaused && (!(pDM_Odm->SupportAbility & ODM_BB_DIG) || !(pDM_Odm->SupportAbility & ODM_BB_FA_CNT))) -+ { -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Return: SupportAbility ODM_BB_DIG or ODM_BB_FA_CNT is disabled\n")); ++ if ( ++ !bPaused && (!(pDM_Odm->SupportAbility & ODM_BB_DIG) || ++ !(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) ++ ){ ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_DIG, ++ ODM_DBG_LOUD, ++ ("odm_PauseDIG(): Return: SupportAbility ODM_BB_DIG or ODM_BB_FA_CNT is disabled\n") ++ ); + return; + } + -+ switch (PauseType) -+ { -+ /* 1 Pause DIG */ -+ case ODM_PAUSE_DIG: -+ /* 2 Disable DIG */ -+ ODM_CmnInfoUpdate(pDM_Odm, ODM_CMNINFO_ABILITY, pDM_Odm->SupportAbility & (~ODM_BB_DIG)); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Pause DIG !!\n")); ++ switch (PauseType) { ++ /* 1 Pause DIG */ ++ case ODM_PAUSE_DIG: ++ /* 2 Disable DIG */ ++ ODM_CmnInfoUpdate(pDM_Odm, ODM_CMNINFO_ABILITY, pDM_Odm->SupportAbility & (~ODM_BB_DIG)); ++ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Pause DIG !!\n")); + -+ /* 2 Backup IGI value */ -+ if (!bPaused) -+ { -+ pDM_DigTable->IGIBackup = pDM_DigTable->CurIGValue; -+ bPaused = true; -+ } -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Backup IGI = 0x%x\n", pDM_DigTable->IGIBackup)); ++ /* 2 Backup IGI value */ ++ if (!bPaused) { ++ pDM_DigTable->IGIBackup = pDM_DigTable->CurIGValue; ++ bPaused = true; ++ } ++ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Backup IGI = 0x%x\n", pDM_DigTable->IGIBackup)); + -+ /* 2 Write new IGI value */ -+ ODM_Write_DIG(pDM_Odm, IGIValue); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Write new IGI = 0x%x\n", IGIValue)); -+ break; ++ /* 2 Write new IGI value */ ++ ODM_Write_DIG(pDM_Odm, IGIValue); ++ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Write new IGI = 0x%x\n", IGIValue)); ++ break; + -+ /* 1 Resume DIG */ -+ case ODM_RESUME_DIG: -+ if (bPaused) -+ { -+ /* 2 Write backup IGI value */ -+ ODM_Write_DIG(pDM_Odm, pDM_DigTable->IGIBackup); -+ bPaused = false; -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Write original IGI = 0x%x\n", pDM_DigTable->IGIBackup)); ++ /* 1 Resume DIG */ ++ case ODM_RESUME_DIG: ++ if (bPaused) { ++ /* 2 Write backup IGI value */ ++ ODM_Write_DIG(pDM_Odm, pDM_DigTable->IGIBackup); ++ bPaused = false; ++ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Write original IGI = 0x%x\n", pDM_DigTable->IGIBackup)); + -+ /* 2 Enable DIG */ -+ ODM_CmnInfoUpdate(pDM_Odm, ODM_CMNINFO_ABILITY, pDM_Odm->SupportAbility | ODM_BB_DIG); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Resume DIG !!\n")); -+ } -+ break; ++ /* 2 Enable DIG */ ++ ODM_CmnInfoUpdate(pDM_Odm, ODM_CMNINFO_ABILITY, pDM_Odm->SupportAbility | ODM_BB_DIG); ++ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Resume DIG !!\n")); ++ } ++ break; + -+ default: -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Wrong type !!\n")); -+ break; ++ default: ++ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_PauseDIG(): Wrong type !!\n")); ++ break; + } +} + -+bool -+odm_DigAbort( -+ void * pDM_VOID -+ ) ++bool odm_DigAbort(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + /* SupportAbility */ -+ if (!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) -+ { ++ if (!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Return: SupportAbility ODM_BB_FA_CNT is disabled\n")); + return true; + } + + /* SupportAbility */ -+ if (!(pDM_Odm->SupportAbility & ODM_BB_DIG)) -+ { ++ if (!(pDM_Odm->SupportAbility & ODM_BB_DIG)) { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Return: SupportAbility ODM_BB_DIG is disabled\n")); + return true; + } + + /* ScanInProcess */ -+ if (*(pDM_Odm->pbScanInProcess)) -+ { ++ if (*(pDM_Odm->pbScanInProcess)) { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Return: In Scan Progress\n")); + return true; + } + + /* add by Neil Chen to avoid PSD is processing */ -+ if (pDM_Odm->bDMInitialGainEnable == false) -+ { ++ if (pDM_Odm->bDMInitialGainEnable == false) { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Return: PSD is Processing\n")); + return true; + } @@ -59093,13 +57554,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + return false; +} + -+void -+odm_DIGInit( -+ void * pDM_VOID -+ ) ++void odm_DIGInit(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; -+ pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + + pDM_DigTable->bStopDIG = false; + pDM_DigTable->bPSDInProgress = false; @@ -59128,13 +57586,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + /* To Initi BT30 IGI */ + pDM_DigTable->BT30_CurIGI = 0x32; + -+ if (pDM_Odm->BoardType & (ODM_BOARD_EXT_PA|ODM_BOARD_EXT_LNA)) -+ { ++ if (pDM_Odm->BoardType & (ODM_BOARD_EXT_PA|ODM_BOARD_EXT_LNA)) { + pDM_DigTable->rx_gain_range_max = DM_DIG_MAX_NIC; + pDM_DigTable->rx_gain_range_min = DM_DIG_MIN_NIC; -+ } -+ else -+ { ++ } else { + pDM_DigTable->rx_gain_range_max = DM_DIG_MAX_NIC; + pDM_DigTable->rx_gain_range_min = DM_DIG_MIN_NIC; + } @@ -59142,26 +57597,23 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar +} + + -+void -+odm_DIG( -+ void * pDM_VOID -+ ) ++void odm_DIG(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + /* Common parameters */ -+ pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; -+ Pfalse_ALARM_STATISTICS pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; -+ bool FirstConnect, FirstDisConnect; -+ u8 DIG_MaxOfMin, DIG_Dynamic_MIN; -+ u8 dm_dig_max, dm_dig_min; -+ u8 CurrentIGI = pDM_DigTable->CurIGValue; -+ u8 offset; -+ u32 dm_FA_thres[3]; -+ u8 Adap_IGI_Upper = 0; -+ u32 TxTp = 0, RxTp = 0; -+ bool bDFSBand = false; -+ bool bPerformance = true, bFirstTpTarget = false, bFirstCoverage = false; ++ pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; ++ Pfalse_ALARM_STATISTICS pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; ++ bool FirstConnect, FirstDisConnect; ++ u8 DIG_MaxOfMin, DIG_Dynamic_MIN; ++ u8 dm_dig_max, dm_dig_min; ++ u8 CurrentIGI = pDM_DigTable->CurIGValue; ++ u8 offset; ++ u32 dm_FA_thres[3]; ++ u8 Adap_IGI_Upper = 0; ++ u32 TxTp = 0, RxTp = 0; ++ bool bDFSBand = false; ++ bool bPerformance = true, bFirstTpTarget = false, bFirstCoverage = false; + + if (odm_DigAbort(pDM_Odm) == true) + return; @@ -59186,16 +57638,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Absolutly upper bound = 0x%x, lower bound = 0x%x\n", dm_dig_max, dm_dig_min)); + + /* 1 Adjust boundary by RSSI */ -+ if (pDM_Odm->bLinked && bPerformance) -+ { ++ if (pDM_Odm->bLinked && bPerformance) { + /* 2 Modify DIG upper bound */ + /* 4 Modify DIG upper bound for 92E, 8723A\B, 8821 & 8812 BT */ -+ if (pDM_Odm->bBtLimitedDig == 1) -+ { ++ if (pDM_Odm->bBtLimitedDig == 1) { + offset = 10; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Coex. case: Force upper bound to RSSI + %d !!!!!!\n", offset)); -+ } -+ else ++ } else + offset = 15; + + if ((pDM_Odm->RSSI_Min + offset) > dm_dig_max) @@ -59215,63 +57664,107 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + else + DIG_Dynamic_MIN = pDM_Odm->RSSI_Min; + } -+ } -+ else -+ { -+ { -+ pDM_DigTable->rx_gain_range_max = dm_dig_max; -+ } ++ } else { ++ pDM_DigTable->rx_gain_range_max = dm_dig_max; + DIG_Dynamic_MIN = dm_dig_min; + } + + /* 1 Force Lower Bound for AntDiv */ -+ if (pDM_Odm->bLinked && !pDM_Odm->bOneEntryOnly) -+ { -+ if (pDM_Odm->SupportAbility & ODM_BB_ANT_DIV) -+ { -+ if (pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV || pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV ||pDM_Odm->AntDivType == S0S1_SW_ANTDIV) -+ { ++ if (pDM_Odm->bLinked && !pDM_Odm->bOneEntryOnly) { ++ if (pDM_Odm->SupportAbility & ODM_BB_ANT_DIV) { ++ if ( ++ pDM_Odm->AntDivType == CG_TRX_HW_ANTDIV || ++ pDM_Odm->AntDivType == CG_TRX_SMART_ANTDIV || ++ pDM_Odm->AntDivType == S0S1_SW_ANTDIV ++ ) { + if (pDM_DigTable->AntDiv_RSSI_max > DIG_MaxOfMin) + DIG_Dynamic_MIN = DIG_MaxOfMin; + else + DIG_Dynamic_MIN = (u8) pDM_DigTable->AntDiv_RSSI_max; -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_DIG(): Antenna diversity case: Force lower bound to 0x%x !!!!!!\n", DIG_Dynamic_MIN)); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_ANT_DIV, ODM_DBG_LOUD, ("odm_DIG(): Antenna diversity case: RSSI_max = 0x%x !!!!!!\n", pDM_DigTable->AntDiv_RSSI_max)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_ANT_DIV, ++ ODM_DBG_LOUD, ++ ( ++ "odm_DIG(): Antenna diversity case: Force lower bound to 0x%x !!!!!!\n", ++ DIG_Dynamic_MIN ++ ) ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_ANT_DIV, ++ ODM_DBG_LOUD, ++ ( ++ "odm_DIG(): Antenna diversity case: RSSI_max = 0x%x !!!!!!\n", ++ pDM_DigTable->AntDiv_RSSI_max ++ ) ++ ); + } + } + } -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Adjust boundary by RSSI Upper bound = 0x%x, Lower bound = 0x%x\n", -+ pDM_DigTable->rx_gain_range_max, DIG_Dynamic_MIN)); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Link status: bLinked = %d, RSSI = %d, bFirstConnect = %d, bFirsrDisConnect = %d\n\n", -+ pDM_Odm->bLinked, pDM_Odm->RSSI_Min, FirstConnect, FirstDisConnect)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_DIG, ++ ODM_DBG_LOUD, ++ ( ++ "odm_DIG(): Adjust boundary by RSSI Upper bound = 0x%x, Lower bound = 0x%x\n", ++ pDM_DigTable->rx_gain_range_max, ++ DIG_Dynamic_MIN ++ ) ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_DIG, ++ ODM_DBG_LOUD, ++ ( ++ "odm_DIG(): Link status: bLinked = %d, RSSI = %d, bFirstConnect = %d, bFirsrDisConnect = %d\n\n", ++ pDM_Odm->bLinked, ++ pDM_Odm->RSSI_Min, ++ FirstConnect, ++ FirstDisConnect ++ ) ++ ); + + /* 1 Modify DIG lower bound, deal with abnormal case */ + /* 2 Abnormal false alarm case */ -+ { -+ if (FirstDisConnect) -+ { -+ pDM_DigTable->rx_gain_range_min = DIG_Dynamic_MIN; -+ pDM_DigTable->ForbiddenIGI = DIG_Dynamic_MIN; -+ } -+ else -+ pDM_DigTable->rx_gain_range_min = odm_ForbiddenIGICheck(pDM_Odm, DIG_Dynamic_MIN, CurrentIGI); -+ } ++ if (FirstDisConnect) { ++ pDM_DigTable->rx_gain_range_min = DIG_Dynamic_MIN; ++ pDM_DigTable->ForbiddenIGI = DIG_Dynamic_MIN; ++ } else ++ pDM_DigTable->rx_gain_range_min = ++ odm_ForbiddenIGICheck(pDM_Odm, DIG_Dynamic_MIN, CurrentIGI); + -+ if (pDM_Odm->bLinked && !FirstConnect) -+ { -+ if ((pDM_Odm->PhyDbgInfo.NumQryBeaconPkt < 5) && (pDM_Odm->bsta_state)) -+ { ++ if (pDM_Odm->bLinked && !FirstConnect) { ++ if ( ++ (pDM_Odm->PhyDbgInfo.NumQryBeaconPkt < 5) && ++ pDM_Odm->bsta_state ++ ) { + pDM_DigTable->rx_gain_range_min = dm_dig_min; -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Abnrormal #beacon (%d) case in STA mode: Force lower bound to 0x%x !!!!!!\n\n", -+ pDM_Odm->PhyDbgInfo.NumQryBeaconPkt, pDM_DigTable->rx_gain_range_min)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_DIG, ++ ODM_DBG_LOUD, ++ ( ++ "odm_DIG(): Abnrormal #beacon (%d) case in STA mode: Force lower bound to 0x%x !!!!!!\n\n", ++ pDM_Odm->PhyDbgInfo.NumQryBeaconPkt, ++ pDM_DigTable->rx_gain_range_min ++ ) ++ ); + } + } + + /* 2 Abnormal lower bound case */ -+ if (pDM_DigTable->rx_gain_range_min > pDM_DigTable->rx_gain_range_max) -+ { ++ if (pDM_DigTable->rx_gain_range_min > pDM_DigTable->rx_gain_range_max) { + pDM_DigTable->rx_gain_range_min = pDM_DigTable->rx_gain_range_max; -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Abnrormal lower bound case: Force lower bound to 0x%x !!!!!!\n\n", pDM_DigTable->rx_gain_range_min)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_DIG, ++ ODM_DBG_LOUD, ++ ( ++ "odm_DIG(): Abnrormal lower bound case: Force lower bound to 0x%x !!!!!!\n\n", ++ pDM_DigTable->rx_gain_range_min ++ ) ++ ); + } + + @@ -59280,33 +57773,37 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): False alarm threshold = %d, %d, %d\n\n", dm_FA_thres[0], dm_FA_thres[1], dm_FA_thres[2])); + + /* 1 Adjust initial gain by false alarm */ -+ if (pDM_Odm->bLinked && bPerformance) -+ { ++ if (pDM_Odm->bLinked && bPerformance) { + /* 2 After link */ -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Adjust IGI after link\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_DIG, ++ ODM_DBG_LOUD, ++ ("odm_DIG(): Adjust IGI after link\n") ++ ); + -+ if (bFirstTpTarget || (FirstConnect && bPerformance)) -+ { ++ if (bFirstTpTarget || (FirstConnect && bPerformance)) { + pDM_DigTable->LargeFAHit = 0; + -+ { -+ if (pDM_Odm->RSSI_Min < DIG_MaxOfMin) -+ { -+ if (CurrentIGI < pDM_Odm->RSSI_Min) -+ CurrentIGI = pDM_Odm->RSSI_Min; -+ } -+ else -+ { -+ if (CurrentIGI < DIG_MaxOfMin) -+ CurrentIGI = DIG_MaxOfMin; -+ } ++ if (pDM_Odm->RSSI_Min < DIG_MaxOfMin) { ++ if (CurrentIGI < pDM_Odm->RSSI_Min) ++ CurrentIGI = pDM_Odm->RSSI_Min; ++ } else { ++ if (CurrentIGI < DIG_MaxOfMin) ++ CurrentIGI = DIG_MaxOfMin; + } + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): First connect case: IGI does on-shot to 0x%x\n", CurrentIGI)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_DIG, ++ ODM_DBG_LOUD, ++ ( ++ "odm_DIG(): First connect case: IGI does on-shot to 0x%x\n", ++ CurrentIGI ++ ) ++ ); + -+ } -+ else -+ { ++ } else { + if (pFalseAlmCnt->Cnt_all > dm_FA_thres[2]) + CurrentIGI = CurrentIGI + 4; + else if (pFalseAlmCnt->Cnt_all > dm_FA_thres[1]) @@ -59314,26 +57811,42 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + else if (pFalseAlmCnt->Cnt_all < dm_FA_thres[0]) + CurrentIGI = CurrentIGI - 2; + -+ if ((pDM_Odm->PhyDbgInfo.NumQryBeaconPkt < 5) && (pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH1) && (pDM_Odm->bsta_state)) -+ { ++ if ( ++ (pDM_Odm->PhyDbgInfo.NumQryBeaconPkt < 5) && ++ (pFalseAlmCnt->Cnt_all < DM_DIG_FA_TH1) && ++ (pDM_Odm->bsta_state) ++ ) { + CurrentIGI = pDM_DigTable->rx_gain_range_min; -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Abnormal #beacon (%d) case: IGI does one-shot to 0x%x\n", -+ pDM_Odm->PhyDbgInfo.NumQryBeaconPkt, CurrentIGI)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_DIG, ++ ODM_DBG_LOUD, ++ ( ++ "odm_DIG(): Abnormal #beacon (%d) case: IGI does one-shot to 0x%x\n", ++ pDM_Odm->PhyDbgInfo.NumQryBeaconPkt, ++ CurrentIGI ++ ) ++ ); + } + } -+ } -+ else -+ { ++ } else { + /* 2 Before link */ -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Adjust IGI before link\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_DIG, ++ ODM_DBG_LOUD, ++ ("odm_DIG(): Adjust IGI before link\n") ++ ); + -+ if (FirstDisConnect || bFirstCoverage) -+ { ++ if (FirstDisConnect || bFirstCoverage) { + CurrentIGI = dm_dig_min; -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): First disconnect case: IGI does on-shot to lower bound\n")); -+ } -+ else -+ { ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_DIG, ++ ODM_DBG_LOUD, ++ ("odm_DIG(): First disconnect case: IGI does on-shot to lower bound\n") ++ ); ++ } else { + if (pFalseAlmCnt->Cnt_all > dm_FA_thres[2]) + CurrentIGI = CurrentIGI + 4; + else if (pFalseAlmCnt->Cnt_all > dm_FA_thres[1]) @@ -59350,16 +57863,26 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + if (CurrentIGI > pDM_DigTable->rx_gain_range_max) + CurrentIGI = pDM_DigTable->rx_gain_range_max; + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): CurIGValue = 0x%x, TotalFA = %d\n\n", CurrentIGI, pFalseAlmCnt->Cnt_all)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_DIG, ++ ODM_DBG_LOUD, ++ ( ++ "odm_DIG(): CurIGValue = 0x%x, TotalFA = %d\n\n", ++ CurrentIGI, ++ pFalseAlmCnt->Cnt_all ++ ) ++ ); + + /* 1 Force upper bound and lower bound for adaptivity */ -+ if (pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY && pDM_Odm->adaptivity_flag == true) -+ { ++ if ( ++ pDM_Odm->SupportAbility & ODM_BB_ADAPTIVITY && ++ pDM_Odm->adaptivity_flag == true ++ ) { + if (CurrentIGI > Adap_IGI_Upper) + CurrentIGI = Adap_IGI_Upper; + -+ if (pDM_Odm->IGI_LowerBound != 0) -+ { ++ if (pDM_Odm->IGI_LowerBound != 0) { + if (CurrentIGI < pDM_Odm->IGI_LowerBound) + CurrentIGI = pDM_Odm->IGI_LowerBound; + } @@ -59369,10 +57892,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + + + /* 1 Update status */ -+ if (pDM_Odm->bBtHsOperation) -+ { -+ if (pDM_Odm->bLinked) -+ { ++ if (pDM_Odm->bBtHsOperation) { ++ if (pDM_Odm->bLinked) { + if (pDM_DigTable->BT30_CurIGI > (CurrentIGI)) + ODM_Write_DIG(pDM_Odm, CurrentIGI); + else @@ -59380,9 +57901,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + + pDM_DigTable->bMediaConnect_0 = pDM_Odm->bLinked; + pDM_DigTable->DIG_Dynamic_MIN_0 = DIG_Dynamic_MIN; -+ } -+ else -+ { ++ } else { + if (pDM_Odm->bLinkInProcess) + ODM_Write_DIG(pDM_Odm, 0x1c); + else if (pDM_Odm->bBtConnectProcess) @@ -59390,33 +57909,33 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + else + ODM_Write_DIG(pDM_Odm, pDM_DigTable->BT30_CurIGI);/* ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); */ + } -+ } -+ else /* BT is not using */ -+ { ++ } else { /* BT is not using */ + ODM_Write_DIG(pDM_Odm, CurrentIGI);/* ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); */ + pDM_DigTable->bMediaConnect_0 = pDM_Odm->bLinked; + pDM_DigTable->DIG_Dynamic_MIN_0 = DIG_Dynamic_MIN; + } +} + -+void -+odm_DIGbyRSSI_LPS( -+ void * pDM_VOID -+ ) ++void odm_DIGbyRSSI_LPS(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; -+ Pfalse_ALARM_STATISTICS pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ Pfalse_ALARM_STATISTICS pFalseAlmCnt = &pDM_Odm->FalseAlmCnt; + -+ u8 RSSI_Lower =DM_DIG_MIN_NIC; /* 0x1E or 0x1C */ -+ u8 CurrentIGI =pDM_Odm->RSSI_Min; ++ u8 RSSI_Lower = DM_DIG_MIN_NIC; /* 0x1E or 0x1C */ ++ u8 CurrentIGI = pDM_Odm->RSSI_Min; + -+ CurrentIGI =CurrentIGI+RSSI_OFFSET_DIG; ++ CurrentIGI = CurrentIGI+RSSI_OFFSET_DIG; + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIGbyRSSI_LPS() ==>\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_DIG, ++ ODM_DBG_LOUD, ++ ("odm_DIGbyRSSI_LPS() ==>\n") ++ ); + + /* Using FW PS mode to make IGI */ + /* Adjust by FA in LPS MODE */ -+ if (pFalseAlmCnt->Cnt_all> DM_DIG_FA_TH2_LPS) ++ if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH2_LPS) + CurrentIGI = CurrentIGI+4; + else if (pFalseAlmCnt->Cnt_all > DM_DIG_FA_TH1_LPS) + CurrentIGI = CurrentIGI+2; @@ -59428,163 +57947,252 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + + /* RSSI Lower bound check */ + if ((pDM_Odm->RSSI_Min-10) > DM_DIG_MIN_NIC) -+ RSSI_Lower =(pDM_Odm->RSSI_Min-10); ++ RSSI_Lower = pDM_Odm->RSSI_Min-10; + else -+ RSSI_Lower =DM_DIG_MIN_NIC; ++ RSSI_Lower = DM_DIG_MIN_NIC; + + /* Upper and Lower Bound checking */ + if (CurrentIGI > DM_DIG_MAX_NIC) -+ CurrentIGI =DM_DIG_MAX_NIC; ++ CurrentIGI = DM_DIG_MAX_NIC; + else if (CurrentIGI < RSSI_Lower) -+ CurrentIGI =RSSI_Lower; ++ CurrentIGI = RSSI_Lower; + + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIGbyRSSI_LPS(): pFalseAlmCnt->Cnt_all = %d\n", pFalseAlmCnt->Cnt_all)); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIGbyRSSI_LPS(): pDM_Odm->RSSI_Min = %d\n", pDM_Odm->RSSI_Min)); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIGbyRSSI_LPS(): CurrentIGI = 0x%x\n", CurrentIGI)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_DIG, ++ ODM_DBG_LOUD, ++ ("odm_DIGbyRSSI_LPS(): pFalseAlmCnt->Cnt_all = %d\n", pFalseAlmCnt->Cnt_all) ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_DIG, ++ ODM_DBG_LOUD, ++ ("odm_DIGbyRSSI_LPS(): pDM_Odm->RSSI_Min = %d\n", pDM_Odm->RSSI_Min) ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_DIG, ++ ODM_DBG_LOUD, ++ ("odm_DIGbyRSSI_LPS(): CurrentIGI = 0x%x\n", CurrentIGI) ++ ); + -+ ODM_Write_DIG(pDM_Odm, CurrentIGI);/* ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); */ ++ ODM_Write_DIG(pDM_Odm, CurrentIGI); ++ /* ODM_Write_DIG(pDM_Odm, pDM_DigTable->CurIGValue); */ +} + +/* 3 ============================================================ */ +/* 3 FASLE ALARM CHECK */ +/* 3 ============================================================ */ + -+void -+odm_FalseAlarmCounterStatistics( -+ void * pDM_VOID -+ ) ++void odm_FalseAlarmCounterStatistics(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; -+ Pfalse_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); -+ u32 ret_value; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ Pfalse_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); ++ u32 ret_value; + + if (!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT)) + return; + + /* hold ofdm counter */ -+ PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG_OFDM_FA_HOLDC_11N, BIT31, 1); /* hold page C counter */ -+ PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG_OFDM_FA_RSTD_11N, BIT31, 1); /* hold page D counter */ ++ /* hold page C counter */ ++ PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG_OFDM_FA_HOLDC_11N, BIT31, 1); ++ /* hold page D counter */ ++ PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG_OFDM_FA_RSTD_11N, BIT31, 1); + -+ ret_value = PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG_OFDM_FA_TYPE1_11N, bMaskDWord); ++ ret_value = PHY_QueryBBReg( ++ pDM_Odm->Adapter, ODM_REG_OFDM_FA_TYPE1_11N, bMaskDWord ++ ); + FalseAlmCnt->Cnt_Fast_Fsync = (ret_value&0xffff); + FalseAlmCnt->Cnt_SB_Search_fail = ((ret_value&0xffff0000)>>16); + -+ ret_value = PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG_OFDM_FA_TYPE2_11N, bMaskDWord); ++ ret_value = PHY_QueryBBReg( ++ pDM_Odm->Adapter, ODM_REG_OFDM_FA_TYPE2_11N, bMaskDWord ++ ); + FalseAlmCnt->Cnt_OFDM_CCA = (ret_value&0xffff); + FalseAlmCnt->Cnt_Parity_Fail = ((ret_value&0xffff0000)>>16); + -+ ret_value = PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG_OFDM_FA_TYPE3_11N, bMaskDWord); ++ ret_value = PHY_QueryBBReg( ++ pDM_Odm->Adapter, ODM_REG_OFDM_FA_TYPE3_11N, bMaskDWord ++ ); + FalseAlmCnt->Cnt_Rate_Illegal = (ret_value&0xffff); + FalseAlmCnt->Cnt_Crc8_fail = ((ret_value&0xffff0000)>>16); + -+ ret_value = PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG_OFDM_FA_TYPE4_11N, bMaskDWord); ++ ret_value = PHY_QueryBBReg( ++ pDM_Odm->Adapter, ODM_REG_OFDM_FA_TYPE4_11N, bMaskDWord ++ ); + FalseAlmCnt->Cnt_Mcs_fail = (ret_value&0xffff); + -+ FalseAlmCnt->Cnt_Ofdm_fail = FalseAlmCnt->Cnt_Parity_Fail + FalseAlmCnt->Cnt_Rate_Illegal + -+ FalseAlmCnt->Cnt_Crc8_fail + FalseAlmCnt->Cnt_Mcs_fail + -+ FalseAlmCnt->Cnt_Fast_Fsync + FalseAlmCnt->Cnt_SB_Search_fail; ++ FalseAlmCnt->Cnt_Ofdm_fail = ++ FalseAlmCnt->Cnt_Parity_Fail + ++ FalseAlmCnt->Cnt_Rate_Illegal + ++ FalseAlmCnt->Cnt_Crc8_fail + ++ FalseAlmCnt->Cnt_Mcs_fail + ++ FalseAlmCnt->Cnt_Fast_Fsync + ++ FalseAlmCnt->Cnt_SB_Search_fail; + + { + /* hold cck counter */ + PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG_CCK_FA_RST_11N, BIT12, 1); + PHY_SetBBReg(pDM_Odm->Adapter, ODM_REG_CCK_FA_RST_11N, BIT14, 1); + -+ ret_value = PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG_CCK_FA_LSB_11N, bMaskByte0); ++ ret_value = PHY_QueryBBReg( ++ pDM_Odm->Adapter, ODM_REG_CCK_FA_LSB_11N, bMaskByte0 ++ ); + FalseAlmCnt->Cnt_Cck_fail = ret_value; + -+ ret_value = PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG_CCK_FA_MSB_11N, bMaskByte3); -+ FalseAlmCnt->Cnt_Cck_fail += (ret_value& 0xff)<<8; ++ ret_value = PHY_QueryBBReg( ++ pDM_Odm->Adapter, ODM_REG_CCK_FA_MSB_11N, bMaskByte3 ++ ); ++ FalseAlmCnt->Cnt_Cck_fail += (ret_value&0xff)<<8; + -+ ret_value = PHY_QueryBBReg(pDM_Odm->Adapter, ODM_REG_CCK_CCA_CNT_11N, bMaskDWord); -+ FalseAlmCnt->Cnt_CCK_CCA = ((ret_value&0xFF)<<8) |((ret_value&0xFF00)>>8); ++ ret_value = PHY_QueryBBReg( ++ pDM_Odm->Adapter, ODM_REG_CCK_CCA_CNT_11N, bMaskDWord ++ ); ++ FalseAlmCnt->Cnt_CCK_CCA = ++ ((ret_value&0xFF)<<8) | ((ret_value&0xFF00)>>8); + } + -+ FalseAlmCnt->Cnt_all = (FalseAlmCnt->Cnt_Fast_Fsync + -+ FalseAlmCnt->Cnt_SB_Search_fail + -+ FalseAlmCnt->Cnt_Parity_Fail + -+ FalseAlmCnt->Cnt_Rate_Illegal + -+ FalseAlmCnt->Cnt_Crc8_fail + -+ FalseAlmCnt->Cnt_Mcs_fail + -+ FalseAlmCnt->Cnt_Cck_fail); ++ FalseAlmCnt->Cnt_all = ( ++ FalseAlmCnt->Cnt_Fast_Fsync + ++ FalseAlmCnt->Cnt_SB_Search_fail + ++ FalseAlmCnt->Cnt_Parity_Fail + ++ FalseAlmCnt->Cnt_Rate_Illegal + ++ FalseAlmCnt->Cnt_Crc8_fail + ++ FalseAlmCnt->Cnt_Mcs_fail + ++ FalseAlmCnt->Cnt_Cck_fail ++ ); + -+ FalseAlmCnt->Cnt_CCA_all = FalseAlmCnt->Cnt_OFDM_CCA + FalseAlmCnt->Cnt_CCK_CCA; ++ FalseAlmCnt->Cnt_CCA_all = ++ FalseAlmCnt->Cnt_OFDM_CCA + FalseAlmCnt->Cnt_CCK_CCA; + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Enter odm_FalseAlarmCounterStatistics\n")); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Fast_Fsync =%d, Cnt_SB_Search_fail =%d\n", -+ FalseAlmCnt->Cnt_Fast_Fsync, FalseAlmCnt->Cnt_SB_Search_fail)); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Parity_Fail =%d, Cnt_Rate_Illegal =%d\n", -+ FalseAlmCnt->Cnt_Parity_Fail, FalseAlmCnt->Cnt_Rate_Illegal)); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Crc8_fail =%d, Cnt_Mcs_fail =%d\n", -+ FalseAlmCnt->Cnt_Crc8_fail, FalseAlmCnt->Cnt_Mcs_fail)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_FA_CNT, ++ ODM_DBG_LOUD, ++ ("Enter odm_FalseAlarmCounterStatistics\n") ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_FA_CNT, ++ ODM_DBG_LOUD, ++ ( ++ "Cnt_Fast_Fsync =%d, Cnt_SB_Search_fail =%d\n", ++ FalseAlmCnt->Cnt_Fast_Fsync, ++ FalseAlmCnt->Cnt_SB_Search_fail ++ ) ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_FA_CNT, ++ ODM_DBG_LOUD, ++ ( ++ "Cnt_Parity_Fail =%d, Cnt_Rate_Illegal =%d\n", ++ FalseAlmCnt->Cnt_Parity_Fail, ++ FalseAlmCnt->Cnt_Rate_Illegal ++ ) ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_FA_CNT, ++ ODM_DBG_LOUD, ++ ( ++ "Cnt_Crc8_fail =%d, Cnt_Mcs_fail =%d\n", ++ FalseAlmCnt->Cnt_Crc8_fail, ++ FalseAlmCnt->Cnt_Mcs_fail ++ ) ++ ); + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_OFDM_CCA =%d\n", FalseAlmCnt->Cnt_OFDM_CCA)); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_CCK_CCA =%d\n", FalseAlmCnt->Cnt_CCK_CCA)); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_CCA_all =%d\n", FalseAlmCnt->Cnt_CCA_all)); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Ofdm_fail =%d\n", FalseAlmCnt->Cnt_Ofdm_fail)); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Cck_fail =%d\n", FalseAlmCnt->Cnt_Cck_fail)); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Cnt_Ofdm_fail =%d\n", FalseAlmCnt->Cnt_Ofdm_fail)); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_FA_CNT, ODM_DBG_LOUD, ("Total False Alarm =%d\n", FalseAlmCnt->Cnt_all)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_FA_CNT, ++ ODM_DBG_LOUD, ++ ("Cnt_OFDM_CCA =%d\n", FalseAlmCnt->Cnt_OFDM_CCA) ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_FA_CNT, ++ ODM_DBG_LOUD, ++ ("Cnt_CCK_CCA =%d\n", FalseAlmCnt->Cnt_CCK_CCA) ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_FA_CNT, ++ ODM_DBG_LOUD, ++ ("Cnt_CCA_all =%d\n", FalseAlmCnt->Cnt_CCA_all) ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_FA_CNT, ++ ODM_DBG_LOUD, ++ ("Cnt_Ofdm_fail =%d\n", FalseAlmCnt->Cnt_Ofdm_fail) ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_FA_CNT, ++ ODM_DBG_LOUD, ++ ("Cnt_Cck_fail =%d\n", FalseAlmCnt->Cnt_Cck_fail) ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_FA_CNT, ++ ODM_DBG_LOUD, ++ ("Cnt_Ofdm_fail =%d\n", FalseAlmCnt->Cnt_Ofdm_fail) ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_FA_CNT, ++ ODM_DBG_LOUD, ++ ("Total False Alarm =%d\n", FalseAlmCnt->Cnt_all) ++ ); +} + + -+void -+odm_FAThresholdCheck( -+ void * pDM_VOID, -+ bool bDFSBand, -+ bool bPerformance, -+ u32 RxTp, -+ u32 TxTp, -+ u32* dm_FA_thres -+ ) ++void odm_FAThresholdCheck( ++ void *pDM_VOID, ++ bool bDFSBand, ++ bool bPerformance, ++ u32 RxTp, ++ u32 TxTp, ++ u32 *dm_FA_thres ++) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + -+ if (pDM_Odm->bLinked && (bPerformance||bDFSBand)) -+ { ++ if (pDM_Odm->bLinked && (bPerformance || bDFSBand)) { + /* For NIC */ + dm_FA_thres[0] = DM_DIG_FA_TH0; + dm_FA_thres[1] = DM_DIG_FA_TH1; + dm_FA_thres[2] = DM_DIG_FA_TH2; -+ } -+ else -+ { -+ { -+ dm_FA_thres[0] = 2000; -+ dm_FA_thres[1] = 4000; -+ dm_FA_thres[2] = 5000; -+ } ++ } else { ++ dm_FA_thres[0] = 2000; ++ dm_FA_thres[1] = 4000; ++ dm_FA_thres[2] = 5000; + } + return; +} + -+u8 -+odm_ForbiddenIGICheck( -+ void * pDM_VOID, -+ u8 DIG_Dynamic_MIN, -+ u8 CurrentIGI -+ ) ++u8 odm_ForbiddenIGICheck(void *pDM_VOID, u8 DIG_Dynamic_MIN, u8 CurrentIGI) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; -+ pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; -+ Pfalse_ALARM_STATISTICS pFalseAlmCnt = &(pDM_Odm->FalseAlmCnt); -+ u8 rx_gain_range_min = pDM_DigTable->rx_gain_range_min; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; ++ Pfalse_ALARM_STATISTICS pFalseAlmCnt = &(pDM_Odm->FalseAlmCnt); ++ u8 rx_gain_range_min = pDM_DigTable->rx_gain_range_min; + -+ if (pFalseAlmCnt->Cnt_all > 10000) -+ { ++ if (pFalseAlmCnt->Cnt_all > 10000) { + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Abnormally false alarm case.\n")); + + if (pDM_DigTable->LargeFAHit != 3) + pDM_DigTable->LargeFAHit++; + -+ if (pDM_DigTable->ForbiddenIGI < CurrentIGI)/* if (pDM_DigTable->ForbiddenIGI < pDM_DigTable->CurIGValue) */ -+ { -+ pDM_DigTable->ForbiddenIGI = CurrentIGI;/* pDM_DigTable->ForbiddenIGI = pDM_DigTable->CurIGValue; */ ++ /* if (pDM_DigTable->ForbiddenIGI < pDM_DigTable->CurIGValue) */ ++ if (pDM_DigTable->ForbiddenIGI < CurrentIGI) { ++ pDM_DigTable->ForbiddenIGI = CurrentIGI; ++ /* pDM_DigTable->ForbiddenIGI = pDM_DigTable->CurIGValue; */ + pDM_DigTable->LargeFAHit = 1; + } + -+ if (pDM_DigTable->LargeFAHit >= 3) -+ { ++ if (pDM_DigTable->LargeFAHit >= 3) { + if ((pDM_DigTable->ForbiddenIGI + 2) > pDM_DigTable->rx_gain_range_max) + rx_gain_range_min = pDM_DigTable->rx_gain_range_max; + else @@ -59592,35 +58200,23 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + pDM_DigTable->Recover_cnt = 1800; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Abnormally false alarm case: Recover_cnt = %d\n", pDM_DigTable->Recover_cnt)); + } -+ } -+ else -+ { -+ if (pDM_DigTable->Recover_cnt != 0) -+ { -+ pDM_DigTable->Recover_cnt --; ++ } else { ++ if (pDM_DigTable->Recover_cnt != 0) { ++ pDM_DigTable->Recover_cnt--; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Normal Case: Recover_cnt = %d\n", pDM_DigTable->Recover_cnt)); -+ } -+ else -+ { -+ if (pDM_DigTable->LargeFAHit < 3) -+ { -+ if ((pDM_DigTable->ForbiddenIGI - 2) < DIG_Dynamic_MIN) /* DM_DIG_MIN) */ -+ { ++ } else { ++ if (pDM_DigTable->LargeFAHit < 3) { ++ if ((pDM_DigTable->ForbiddenIGI - 2) < DIG_Dynamic_MIN) { /* DM_DIG_MIN) */ + pDM_DigTable->ForbiddenIGI = DIG_Dynamic_MIN; /* DM_DIG_MIN; */ + rx_gain_range_min = DIG_Dynamic_MIN; /* DM_DIG_MIN; */ + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Normal Case: At Lower Bound\n")); -+ } -+ else -+ { ++ } else { + pDM_DigTable->ForbiddenIGI -= 2; + rx_gain_range_min = (pDM_DigTable->ForbiddenIGI + 2); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_DIG, ODM_DBG_LOUD, ("odm_DIG(): Normal Case: Approach Lower Bound\n")); + } -+ } -+ else -+ { ++ } else + pDM_DigTable->LargeFAHit = 0; -+ } + } + } + @@ -59632,43 +58228,48 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar +/* 3 CCK Packet Detect Threshold */ +/* 3 ============================================================ */ + -+void -+odm_CCKPacketDetectionThresh( -+ void * pDM_VOID -+ ) ++void odm_CCKPacketDetectionThresh(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; -+ Pfalse_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); -+ u8 CurCCK_CCAThres; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ Pfalse_ALARM_STATISTICS FalseAlmCnt = &(pDM_Odm->FalseAlmCnt); ++ u8 CurCCK_CCAThres; + + -+ if ((!(pDM_Odm->SupportAbility & ODM_BB_CCK_PD)) ||(!(pDM_Odm->SupportAbility & ODM_BB_FA_CNT))) -+ { -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_CCK_PD, ODM_DBG_LOUD, ("odm_CCKPacketDetectionThresh() return ==========\n")); ++ if ( ++ !(pDM_Odm->SupportAbility & ODM_BB_CCK_PD) || ++ !(pDM_Odm->SupportAbility & ODM_BB_FA_CNT) ++ ) { ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_CCK_PD, ++ ODM_DBG_LOUD, ++ ("odm_CCKPacketDetectionThresh() return ==========\n") ++ ); + return; + } + + if (pDM_Odm->ExtLNA) + return; + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_CCK_PD, ODM_DBG_LOUD, ("odm_CCKPacketDetectionThresh() ==========>\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_CCK_PD, ++ ODM_DBG_LOUD, ++ ("odm_CCKPacketDetectionThresh() ==========>\n") ++ ); + -+ if (pDM_Odm->bLinked) -+ { ++ if (pDM_Odm->bLinked) { + if (pDM_Odm->RSSI_Min > 25) + CurCCK_CCAThres = 0xcd; + else if ((pDM_Odm->RSSI_Min <= 25) && (pDM_Odm->RSSI_Min > 10)) + CurCCK_CCAThres = 0x83; -+ else -+ { ++ else { + if (FalseAlmCnt->Cnt_Cck_fail > 1000) + CurCCK_CCAThres = 0x83; + else + CurCCK_CCAThres = 0x40; + } -+ } -+ else -+ { ++ } else { + if (FalseAlmCnt->Cnt_Cck_fail > 1000) + CurCCK_CCAThres = 0x83; + else @@ -59677,29 +58278,33 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.c linux-4.3-rtl8723bs/3rdpar + + ODM_Write_CCK_CCA_Thres(pDM_Odm, CurCCK_CCAThres); + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_CCK_PD, ODM_DBG_LOUD, ("odm_CCKPacketDetectionThresh() CurCCK_CCAThres = 0x%x\n", CurCCK_CCAThres)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_CCK_PD, ++ ODM_DBG_LOUD, ++ ( ++ "odm_CCKPacketDetectionThresh() CurCCK_CCAThres = 0x%x\n", ++ CurCCK_CCAThres ++ ) ++ ); +} + -+void -+ODM_Write_CCK_CCA_Thres( -+void * pDM_VOID, -+u8 CurCCK_CCAThres -+ ) ++void ODM_Write_CCK_CCA_Thres(void *pDM_VOID, u8 CurCCK_CCAThres) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; -+ pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + -+ if (pDM_DigTable->CurCCK_CCAThres!=CurCCK_CCAThres) /* modify by Guo.Mingzhi 2012-01-03 */ -+ { ++ /* modify by Guo.Mingzhi 2012-01-03 */ ++ if (pDM_DigTable->CurCCK_CCAThres != CurCCK_CCAThres) + rtw_write8(pDM_Odm->Adapter, ODM_REG(CCK_CCA, pDM_Odm), CurCCK_CCAThres); -+ } ++ + pDM_DigTable->PreCCK_CCAThres = pDM_DigTable->CurCCK_CCAThres; + pDM_DigTable->CurCCK_CCAThres = CurCCK_CCAThres; +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_DIG.h ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_DIG.h 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,263 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_DIG.h linux/3rdparty/rtl8723bs/hal/odm_DIG.h +--- linux.old/3rdparty/rtl8723bs/hal/odm_DIG.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_DIG.h 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,195 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -59715,22 +58320,21 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.h linux-4.3-rtl8723bs/3rdpar + * + ******************************************************************************/ + -+#ifndef __ODMDIG_H__ -+#define __ODMDIG_H__ ++#ifndef __ODMDIG_H__ ++#define __ODMDIG_H__ + -+typedef struct _Dynamic_Initial_Gain_Threshold_ -+{ -+ bool bStopDIG; -+ bool bPSDInProgress; ++typedef struct _Dynamic_Initial_Gain_Threshold_ { ++ bool bStopDIG; ++ bool bPSDInProgress; + + u8 Dig_Enable_Flag; + u8 Dig_Ext_Port_Stage; + -+ int RssiLowThresh; -+ int RssiHighThresh; ++ int RssiLowThresh; ++ int RssiHighThresh; + -+ u32 FALowThresh; -+ u32 FAHighThresh; ++ u32 FALowThresh; ++ u32 FAHighThresh; + + u8 CurSTAConnectState; + u8 PreSTAConnectState; @@ -59742,9 +58346,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.h linux-4.3-rtl8723bs/3rdpar + u8 BT30_CurIGI; + u8 IGIBackup; + -+ s8 BackoffVal; -+ s8 BackoffVal_range_max; -+ s8 BackoffVal_range_min; ++ s8 BackoffVal; ++ s8 BackoffVal_range_max; ++ s8 BackoffVal_range_min; + u8 rx_gain_range_max; + u8 rx_gain_range_min; + u8 Rssi_val_min; @@ -59757,26 +58361,26 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.h linux-4.3-rtl8723bs/3rdpar + + u8 LargeFAHit; + u8 ForbiddenIGI; -+ u32 Recover_cnt; ++ u32 Recover_cnt; + + u8 DIG_Dynamic_MIN_0; + u8 DIG_Dynamic_MIN_1; -+ bool bMediaConnect_0; -+ bool bMediaConnect_1; ++ bool bMediaConnect_0; ++ bool bMediaConnect_1; + -+ u32 AntDiv_RSSI_max; -+ u32 RSSI_max; ++ u32 AntDiv_RSSI_max; ++ u32 RSSI_max; + + u8 *pbP2pLinkInProgress; -+}DIG_T,*pDIG_T; ++} DIG_T, *pDIG_T; + -+typedef struct false_ALARM_STATISTICS{ ++typedef struct false_ALARM_STATISTICS { + u32 Cnt_Parity_Fail; + u32 Cnt_Rate_Illegal; + u32 Cnt_Crc8_fail; + u32 Cnt_Mcs_fail; + u32 Cnt_Ofdm_fail; -+ u32 Cnt_Ofdm_fail_pre; /* For RTL8881A */ ++ u32 Cnt_Ofdm_fail_pre; /* For RTL8881A */ + u32 Cnt_Cck_fail; + u32 Cnt_all; + u32 Cnt_Fast_Fsync; @@ -59784,30 +58388,29 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.h linux-4.3-rtl8723bs/3rdpar + u32 Cnt_OFDM_CCA; + u32 Cnt_CCK_CCA; + u32 Cnt_CCA_all; -+ u32 Cnt_BW_USC; /* Gary */ -+ u32 Cnt_BW_LSC; /* Gary */ -+}false_ALARM_STATISTICS, *Pfalse_ALARM_STATISTICS; ++ u32 Cnt_BW_USC; /* Gary */ ++ u32 Cnt_BW_LSC; /* Gary */ ++} false_ALARM_STATISTICS, *Pfalse_ALARM_STATISTICS; + -+typedef enum tag_Dynamic_Init_Gain_Operation_Type_Definition -+{ -+ DIG_TYPE_THRESH_HIGH = 0, -+ DIG_TYPE_THRESH_LOW = 1, -+ DIG_TYPE_BACKOFF = 2, -+ DIG_TYPE_RX_GAIN_MIN = 3, -+ DIG_TYPE_RX_GAIN_MAX = 4, -+ DIG_TYPE_ENABLE = 5, -+ DIG_TYPE_DISABLE = 6, ++typedef enum tag_Dynamic_Init_Gain_Operation_Type_Definition { ++ DIG_TYPE_THRESH_HIGH = 0, ++ DIG_TYPE_THRESH_LOW = 1, ++ DIG_TYPE_BACKOFF = 2, ++ DIG_TYPE_RX_GAIN_MIN = 3, ++ DIG_TYPE_RX_GAIN_MAX = 4, ++ DIG_TYPE_ENABLE = 5, ++ DIG_TYPE_DISABLE = 6, + DIG_OP_TYPE_MAX -+}DM_DIG_OP_E; ++} DM_DIG_OP_E; + +typedef enum tag_ODM_PauseDIG_Type { -+ ODM_PAUSE_DIG = BIT0, -+ ODM_RESUME_DIG = BIT1 ++ ODM_PAUSE_DIG = BIT0, ++ ODM_RESUME_DIG = BIT1 +} ODM_Pause_DIG_TYPE; + +typedef enum tag_ODM_PauseCCKPD_Type { -+ ODM_PAUSE_CCKPD = BIT0, -+ ODM_RESUME_CCKPD = BIT1 ++ ODM_PAUSE_CCKPD = BIT0, ++ ODM_RESUME_CCKPD = BIT1 +} ODM_Pause_CCKPD_TYPE; + +#define DM_DIG_THRESH_HIGH 40 @@ -59849,124 +58452,58 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DIG.h linux-4.3-rtl8723bs/3rdpar +#define DM_DIG_FA_TH2_LPS 30 /* 30 lps */ +#define RSSI_OFFSET_DIG 0x05 + -+void -+odm_NHMCounterStatisticsInit( -+ void * pDM_VOID -+ ); ++void odm_NHMCounterStatisticsInit(void *pDM_VOID); + -+void -+odm_NHMCounterStatistics( -+ void * pDM_VOID -+ ); ++void odm_NHMCounterStatistics(void *pDM_VOID); + -+void -+odm_NHMBBInit( -+ void * pDM_VOID ++void odm_NHMBBInit(void *pDM_VOID); ++ ++void odm_NHMBB(void *pDM_VOID); ++ ++void odm_NHMCounterStatisticsReset(void *pDM_VOID); ++ ++void odm_GetNHMCounterStatistics(void *pDM_VOID); ++ ++void odm_SearchPwdBLowerBound(void *pDM_VOID, u8 IGI_target); ++ ++void odm_AdaptivityInit(void *pDM_VOID); ++ ++void odm_Adaptivity(void *pDM_VOID, u8 IGI); ++ ++void ODM_Write_DIG(void *pDM_VOID, u8 CurrentIGI); ++ ++void odm_PauseDIG(void *pDM_VOID, ODM_Pause_DIG_TYPE PauseType, u8 IGIValue); ++ ++void odm_DIGInit(void *pDM_VOID); ++ ++void odm_DIG(void *pDM_VOID); ++ ++void odm_DIGbyRSSI_LPS(void *pDM_VOID); ++ ++void odm_FalseAlarmCounterStatistics(void *pDM_VOID); ++ ++void odm_FAThresholdCheck( ++ void *pDM_VOID, ++ bool bDFSBand, ++ bool bPerformance, ++ u32 RxTp, ++ u32 TxTp, ++ u32 *dm_FA_thres +); + -+void -+odm_NHMBB( -+ void * pDM_VOID -+); ++u8 odm_ForbiddenIGICheck(void *pDM_VOID, u8 DIG_Dynamic_MIN, u8 CurrentIGI); + -+void -+odm_NHMCounterStatisticsReset( -+ void * pDM_VOID -+); ++bool odm_DigAbort(void *pDM_VOID); + -+void -+odm_GetNHMCounterStatistics( -+ void * pDM_VOID -+); ++void odm_CCKPacketDetectionThresh(void *pDM_VOID); + -+void -+odm_SearchPwdBLowerBound( -+ void * pDM_VOID, -+ u8 IGI_target -+); -+ -+void -+odm_AdaptivityInit( -+ void * pDM_VOID -+ ); -+ -+void -+odm_Adaptivity( -+ void * pDM_VOID, -+ u8 IGI -+ ); -+ -+void -+ODM_Write_DIG( -+ void * pDM_VOID, -+ u8 CurrentIGI -+ ); -+ -+void -+odm_PauseDIG( -+ void * pDM_VOID, -+ ODM_Pause_DIG_TYPE PauseType, -+ u8 IGIValue -+ ); -+ -+void -+odm_DIGInit( -+ void * pDM_VOID -+ ); -+ -+void -+odm_DIG( -+ void * pDM_VOID -+ ); -+ -+void -+odm_DIGbyRSSI_LPS( -+ void * pDM_VOID -+ ); -+ -+void -+odm_FalseAlarmCounterStatistics( -+ void * pDM_VOID -+ ); -+ -+void -+odm_FAThresholdCheck( -+ void * pDM_VOID, -+ bool bDFSBand, -+ bool bPerformance, -+ u32 RxTp, -+ u32 TxTp, -+ u32* dm_FA_thres -+ ); -+ -+u8 -+odm_ForbiddenIGICheck( -+ void * pDM_VOID, -+ u8 DIG_Dynamic_MIN, -+ u8 CurrentIGI -+ ); -+ -+bool -+odm_DigAbort( -+ void * pDM_VOID -+ ); -+ -+void -+odm_CCKPacketDetectionThresh( -+ void * pDM_VOID -+ ); -+ -+void -+ODM_Write_CCK_CCA_Thres( -+ void * pDM_VOID, -+ u8 CurCCK_CCAThres -+ ); ++void ODM_Write_CCK_CCA_Thres(void *pDM_VOID, u8 CurCCK_CCAThres); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DynamicBBPowerSaving.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_DynamicBBPowerSaving.c ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_DynamicBBPowerSaving.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_DynamicBBPowerSaving.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,107 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_DynamicBBPowerSaving.c linux/3rdparty/rtl8723bs/hal/odm_DynamicBBPowerSaving.c +--- linux.old/3rdparty/rtl8723bs/hal/odm_DynamicBBPowerSaving.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_DynamicBBPowerSaving.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,89 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -59984,13 +58521,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DynamicBBPowerSaving.c linux-4.3 + +#include "odm_precomp.h" + -+void -+odm_DynamicBBPowerSavingInit( -+ void * pDM_VOID -+ ) ++void odm_DynamicBBPowerSavingInit(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; -+ pPS_T pDM_PSTable = &pDM_Odm->DM_PSTable; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ pPS_T pDM_PSTable = &pDM_Odm->DM_PSTable; + + pDM_PSTable->PreCCAState = CCA_MAX; + pDM_PSTable->CurCCAState = CCA_MAX; @@ -60000,21 +58534,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DynamicBBPowerSaving.c linux-4.3 + pDM_PSTable->initialize = 0; +} + -+void -+ODM_RF_Saving( -+ void * pDM_VOID, -+u8 bForceInNormal -+ ) ++void ODM_RF_Saving(void *pDM_VOID, u8 bForceInNormal) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; -+ pPS_T pDM_PSTable = &pDM_Odm->DM_PSTable; -+ u8 Rssi_Up_bound = 30 ; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ pPS_T pDM_PSTable = &pDM_Odm->DM_PSTable; ++ u8 Rssi_Up_bound = 30; + u8 Rssi_Low_bound = 25; -+ if (pDM_Odm->PatchID == 40) /* RT_CID_819x_FUNAI_TV */ -+ { -+ Rssi_Up_bound = 50 ; ++ ++ if (pDM_Odm->PatchID == 40) { /* RT_CID_819x_FUNAI_TV */ ++ Rssi_Up_bound = 50; + Rssi_Low_bound = 45; + } ++ + if (pDM_PSTable->initialize == 0) { + + pDM_PSTable->Reg874 = (PHY_QueryBBReg(pDM_Odm->Adapter, 0x874, bMaskDWord)&0x1CC000)>>14; @@ -60025,59 +58556,47 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DynamicBBPowerSaving.c linux-4.3 + pDM_PSTable->initialize = 1; + } + -+ if (!bForceInNormal) -+ { -+ if (pDM_Odm->RSSI_Min != 0xFF) -+ { -+ if (pDM_PSTable->PreRFState == RF_Normal) -+ { ++ if (!bForceInNormal) { ++ if (pDM_Odm->RSSI_Min != 0xFF) { ++ if (pDM_PSTable->PreRFState == RF_Normal) { + if (pDM_Odm->RSSI_Min >= Rssi_Up_bound) + pDM_PSTable->CurRFState = RF_Save; + else + pDM_PSTable->CurRFState = RF_Normal; -+ } -+ else { ++ } else { + if (pDM_Odm->RSSI_Min <= Rssi_Low_bound) + pDM_PSTable->CurRFState = RF_Normal; + else + pDM_PSTable->CurRFState = RF_Save; + } -+ } -+ else -+ pDM_PSTable->CurRFState =RF_MAX; -+ } -+ else -+ { ++ } else ++ pDM_PSTable->CurRFState = RF_MAX; ++ } else + pDM_PSTable->CurRFState = RF_Normal; -+ } + -+ if (pDM_PSTable->PreRFState != pDM_PSTable->CurRFState) -+ { -+ if (pDM_PSTable->CurRFState == RF_Save) -+ { -+ PHY_SetBBReg(pDM_Odm->Adapter, 0x874 , 0x1C0000, 0x2); /* Reg874[20:18]=3'b010 */ ++ if (pDM_PSTable->PreRFState != pDM_PSTable->CurRFState) { ++ if (pDM_PSTable->CurRFState == RF_Save) { ++ PHY_SetBBReg(pDM_Odm->Adapter, 0x874, 0x1C0000, 0x2); /* Reg874[20:18]=3'b010 */ + PHY_SetBBReg(pDM_Odm->Adapter, 0xc70, BIT3, 0); /* RegC70[3]= 1'b0 */ + PHY_SetBBReg(pDM_Odm->Adapter, 0x85c, 0xFF000000, 0x63); /* Reg85C[31:24]= 0x63 */ + PHY_SetBBReg(pDM_Odm->Adapter, 0x874, 0xC000, 0x2); /* Reg874[15:14]=2'b10 */ + PHY_SetBBReg(pDM_Odm->Adapter, 0xa74, 0xF000, 0x3); /* RegA75[7:4]= 0x3 */ + PHY_SetBBReg(pDM_Odm->Adapter, 0x818, BIT28, 0x0); /* Reg818[28]= 1'b0 */ + PHY_SetBBReg(pDM_Odm->Adapter, 0x818, BIT28, 0x1); /* Reg818[28]= 1'b1 */ -+ } -+ else -+ { -+ PHY_SetBBReg(pDM_Odm->Adapter, 0x874 , 0x1CC000, pDM_PSTable->Reg874); ++ } else { ++ PHY_SetBBReg(pDM_Odm->Adapter, 0x874, 0x1CC000, pDM_PSTable->Reg874); + PHY_SetBBReg(pDM_Odm->Adapter, 0xc70, BIT3, pDM_PSTable->RegC70); + PHY_SetBBReg(pDM_Odm->Adapter, 0x85c, 0xFF000000, pDM_PSTable->Reg85C); + PHY_SetBBReg(pDM_Odm->Adapter, 0xa74, 0xF000, pDM_PSTable->RegA74); + PHY_SetBBReg(pDM_Odm->Adapter, 0x818, BIT28, 0x0); + } -+ pDM_PSTable->PreRFState =pDM_PSTable->CurRFState; ++ pDM_PSTable->PreRFState = pDM_PSTable->CurRFState; + } +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DynamicBBPowerSaving.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_DynamicBBPowerSaving.h ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_DynamicBBPowerSaving.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_DynamicBBPowerSaving.h 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,46 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_DynamicBBPowerSaving.h linux/3rdparty/rtl8723bs/hal/odm_DynamicBBPowerSaving.h +--- linux.old/3rdparty/rtl8723bs/hal/odm_DynamicBBPowerSaving.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_DynamicBBPowerSaving.h 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,39 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -60096,38 +58615,31 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DynamicBBPowerSaving.h linux-4.3 +#ifndef __ODMDYNAMICBBPOWERSAVING_H__ +#define __ODMDYNAMICBBPOWERSAVING_H__ + -+typedef struct _Dynamic_Power_Saving_ -+{ ++typedef struct _Dynamic_Power_Saving_ { + u8 PreCCAState; + u8 CurCCAState; + + u8 PreRFState; + u8 CurRFState; + -+ int Rssi_val_min; ++ int Rssi_val_min; + + u8 initialize; -+ u32 Reg874, RegC70, Reg85C, RegA74; ++ u32 Reg874, RegC70, Reg85C, RegA74; + -+}PS_T,*pPS_T; ++} PS_T, *pPS_T; + -+#define dm_RF_Saving ODM_RF_Saving ++#define dm_RF_Saving ODM_RF_Saving + -+void ODM_RF_Saving( -+ void * pDM_VOID, -+u8 bForceInNormal -+ ); ++void ODM_RF_Saving(void *pDM_VOID, u8 bForceInNormal); + -+void -+odm_DynamicBBPowerSavingInit( -+ void * pDM_VOID -+ ); ++void odm_DynamicBBPowerSavingInit(void *pDM_VOID); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DynamicTxPower.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_DynamicTxPower.c ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_DynamicTxPower.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_DynamicTxPower.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,32 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_DynamicTxPower.c linux/3rdparty/rtl8723bs/hal/odm_DynamicTxPower.c +--- linux.old/3rdparty/rtl8723bs/hal/odm_DynamicTxPower.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_DynamicTxPower.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,30 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -60145,25 +58657,23 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DynamicTxPower.c linux-4.3-rtl87 + +#include "odm_precomp.h" + -+void -+odm_DynamicTxPowerInit( -+ void * pDM_VOID -+ ) ++void odm_DynamicTxPowerInit(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + struct adapter *Adapter = pDM_Odm->Adapter; -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; ++ + pdmpriv->bDynamicTxPowerEnable = false; + + pdmpriv->LastDTPLvl = TxHighPwrLevel_Normal; + pdmpriv->DynamicTxHighPowerLvl = TxHighPwrLevel_Normal; +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DynamicTxPower.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_DynamicTxPower.h ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_DynamicTxPower.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_DynamicTxPower.h 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,40 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_DynamicTxPower.h linux/3rdparty/rtl8723bs/hal/odm_DynamicTxPower.h +--- linux.old/3rdparty/rtl8723bs/hal/odm_DynamicTxPower.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_DynamicTxPower.h 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,37 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -60198,16 +58708,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_DynamicTxPower.h linux-4.3-rtl87 +#define TxHighPwrLevel_70 8 +#define TxHighPwrLevel_100 9 + -+void -+odm_DynamicTxPowerInit( -+ void * pDM_VOID -+ ); ++void odm_DynamicTxPowerInit(void *pDM_VOID); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_EdcaTurboCheck.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_EdcaTurboCheck.c ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_EdcaTurboCheck.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_EdcaTurboCheck.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,187 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_EdcaTurboCheck.c linux/3rdparty/rtl8723bs/hal/odm_EdcaTurboCheck.c +--- linux.old/3rdparty/rtl8723bs/hal/odm_EdcaTurboCheck.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_EdcaTurboCheck.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,186 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -60249,7 +58756,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_EdcaTurboCheck.c linux-4.3-rtl87 + +void ODM_EdcaTurboInit(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + struct adapter *Adapter = pDM_Odm->Adapter; + + pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = false; @@ -60291,8 +58798,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_EdcaTurboCheck.c linux-4.3-rtl87 + +void odm_EdcaTurboCheckCE(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; -+ struct adapter * Adapter = pDM_Odm->Adapter; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ struct adapter *Adapter = pDM_Odm->Adapter; + struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(Adapter); + struct recv_priv *precvpriv = &(Adapter->recvpriv); + struct registry_priv *pregpriv = &Adapter->registrypriv; @@ -60389,16 +58896,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_EdcaTurboCheck.c linux-4.3-rtl87 + /* Turn Off EDCA turbo here. */ + /* Restore original EDCA according to the declaration of AP. */ + if (pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA) { -+ rtw_write32(Adapter, REG_EDCA_BE_PARAM, -+ pHalData->AcParam_BE); ++ rtw_write32(Adapter, REG_EDCA_BE_PARAM, pHalData->AcParam_BE); + pDM_Odm->DM_EDCA_Table.bCurrentTurboEDCA = false; + } + } +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_EdcaTurboCheck.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_EdcaTurboCheck.h ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_EdcaTurboCheck.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_EdcaTurboCheck.h 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,41 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_EdcaTurboCheck.h linux/3rdparty/rtl8723bs/hal/odm_EdcaTurboCheck.h +--- linux.old/3rdparty/rtl8723bs/hal/odm_EdcaTurboCheck.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_EdcaTurboCheck.h 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,31 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -60414,36 +58920,26 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_EdcaTurboCheck.h linux-4.3-rtl87 + * + ******************************************************************************/ + -+#ifndef __ODMEDCATURBOCHECK_H__ -+#define __ODMEDCATURBOCHECK_H__ ++#ifndef __ODMEDCATURBOCHECK_H__ ++#define __ODMEDCATURBOCHECK_H__ + -+typedef struct _EDCA_TURBO_ -+{ ++typedef struct _EDCA_TURBO_ { + bool bCurrentTurboEDCA; + bool bIsCurRDLState; + + u32 prv_traffic_idx; /* edca turbo */ -+}EDCA_T,*pEDCA_T; ++} EDCA_T, *pEDCA_T; + -+void -+odm_EdcaTurboCheck( -+void * pDM_VOID -+ ); -+void -+ODM_EdcaTurboInit( -+void * pDM_VOID -+); ++void odm_EdcaTurboCheck(void *pDM_VOID); ++void ODM_EdcaTurboInit(void *pDM_VOID); + -+void -+odm_EdcaTurboCheckCE( -+void * pDM_VOID -+ ); ++void odm_EdcaTurboCheckCE(void *pDM_VOID); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm.h ---- linux-4.3/3rdparty/rtl8723bs/hal/odm.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm.h 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,1558 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm.h linux/3rdparty/rtl8723bs/hal/odm.h +--- linux.old/3rdparty/rtl8723bs/hal/odm.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm.h 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,1465 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -60539,7 +59035,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + +/* Remove DIG by yuchen */ + -+typedef struct _Dynamic_Primary_CCA{ ++typedef struct _Dynamic_Primary_CCA { + u8 PriCCA_flag; + u8 intf_flag; + u8 intf_type; @@ -60547,14 +59043,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + u8 Monitor_flag; + u8 CH_offset; + u8 MF_state; -+}Pri_CCA_T, *pPri_CCA_T; ++} Pri_CCA_T, *pPri_CCA_T; + -+typedef struct _Rate_Adaptive_Table_{ ++typedef struct _Rate_Adaptive_Table_ { + u8 firstconnect; -+}RA_T, *pRA_T; ++} RA_T, *pRA_T; + -+typedef struct _RX_High_Power_ -+{ ++typedef struct _RX_High_Power_ { + u8 RXHP_flag; + u8 PSD_func_trigger; + u8 PSD_bitmap_RXHP[80]; @@ -60562,11 +59057,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + u8 Cur_IGI; + u8 Pre_pw_th; + u8 Cur_pw_th; -+ bool First_time_enter; -+ bool RXHP_enable; ++ bool First_time_enter; ++ bool RXHP_enable; + u8 TP_Mode; -+ RT_TIMER PSDTimer; -+}RXHP_T, *pRXHP_T; ++ RT_TIMER PSDTimer; ++} RXHP_T, *pRXHP_T; + +#define ASSOCIATE_ENTRY_NUM 32 /* Max size of AsocEntry[]. */ +#define ODM_ASSOCIATE_ENTRY_NUM ASSOCIATE_ENTRY_NUM @@ -60584,11 +59079,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r +#define TRAFFIC_HIGH 1 +#define TRAFFIC_UltraLOW 2 + -+typedef struct _SW_Antenna_Switch_ -+{ ++typedef struct _SW_Antenna_Switch_ { + u8 Double_chk_flag; + u8 try_flag; -+ s32 PreRSSI; ++ s32 PreRSSI; + u8 CurAntenna; + u8 PreAntenna; + u8 RSSI_Trying; @@ -60597,55 +59091,54 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + u8 SelectAntennaMap; + u8 RSSI_target; + u8 reset_idx; -+ u16 Single_Ant_Counter; -+ u16 Dual_Ant_Counter; -+ u16 Aux_FailDetec_Counter; -+ u16 Retry_Counter; ++ u16 Single_Ant_Counter; ++ u16 Dual_Ant_Counter; ++ u16 Aux_FailDetec_Counter; ++ u16 Retry_Counter; + + /* Before link Antenna Switch check */ + u8 SWAS_NoLink_State; -+ u32 SWAS_NoLink_BK_Reg860; -+ u32 SWAS_NoLink_BK_Reg92c; -+ u32 SWAS_NoLink_BK_Reg948; -+ bool ANTA_ON; /* To indicate Ant A is or not */ -+ bool ANTB_ON; /* To indicate Ant B is on or not */ -+ bool Pre_Aux_FailDetec; -+ bool RSSI_AntDect_bResult; ++ u32 SWAS_NoLink_BK_Reg860; ++ u32 SWAS_NoLink_BK_Reg92c; ++ u32 SWAS_NoLink_BK_Reg948; ++ bool ANTA_ON; /* To indicate Ant A is or not */ ++ bool ANTB_ON; /* To indicate Ant B is on or not */ ++ bool Pre_Aux_FailDetec; ++ bool RSSI_AntDect_bResult; + u8 Ant5G; + u8 Ant2G; + -+ s32 RSSI_sum_A; -+ s32 RSSI_sum_B; -+ s32 RSSI_cnt_A; -+ s32 RSSI_cnt_B; ++ s32 RSSI_sum_A; ++ s32 RSSI_sum_B; ++ s32 RSSI_cnt_A; ++ s32 RSSI_cnt_B; + -+ u64 lastTxOkCnt; -+ u64 lastRxOkCnt; -+ u64 TXByteCnt_A; -+ u64 TXByteCnt_B; -+ u64 RXByteCnt_A; -+ u64 RXByteCnt_B; ++ u64 lastTxOkCnt; ++ u64 lastRxOkCnt; ++ u64 TXByteCnt_A; ++ u64 TXByteCnt_B; ++ u64 RXByteCnt_A; ++ u64 RXByteCnt_B; + u8 TrafficLoad; + u8 Train_time; + u8 Train_time_flag; -+ RT_TIMER SwAntennaSwitchTimer; -+ RT_TIMER SwAntennaSwitchTimer_8723B; -+ u32 PktCnt_SWAntDivByCtrlFrame; -+ bool bSWAntDivByCtrlFrame; -+}SWAT_T, *pSWAT_T; ++ RT_TIMER SwAntennaSwitchTimer; ++ RT_TIMER SwAntennaSwitchTimer_8723B; ++ u32 PktCnt_SWAntDivByCtrlFrame; ++ bool bSWAntDivByCtrlFrame; ++} SWAT_T, *pSWAT_T; + +/* Remove Edca by YuChen */ + + -+typedef struct _ODM_RATE_ADAPTIVE -+{ -+ u8 Type; /* DM_Type_ByFW/DM_Type_ByDriver */ -+ u8 LdpcThres; /* if RSSI > LdpcThres => switch from LPDC to BCC */ -+ bool bUseLdpc; -+ bool bLowerRtsRate; -+ u8 HighRSSIThresh; /* if RSSI > HighRSSIThresh => RATRState is DM_RATR_STA_HIGH */ -+ u8 LowRSSIThresh; /* if RSSI <= LowRSSIThresh => RATRState is DM_RATR_STA_LOW */ -+ u8 RATRState; /* Current RSSI level, DM_RATR_STA_HIGH/DM_RATR_STA_MIDDLE/DM_RATR_STA_LOW */ ++typedef struct _ODM_RATE_ADAPTIVE { ++ u8 Type; /* DM_Type_ByFW/DM_Type_ByDriver */ ++ u8 LdpcThres; /* if RSSI > LdpcThres => switch from LPDC to BCC */ ++ bool bUseLdpc; ++ bool bLowerRtsRate; ++ u8 HighRSSIThresh; /* if RSSI > HighRSSIThresh => RATRState is DM_RATR_STA_HIGH */ ++ u8 LowRSSIThresh; /* if RSSI <= LowRSSIThresh => RATRState is DM_RATR_STA_LOW */ ++ u8 RATRState; /* Current RSSI level, DM_RATR_STA_HIGH/DM_RATR_STA_MIDDLE/DM_RATR_STA_LOW */ + +} ODM_RATE_ADAPTIVE, *PODM_RATE_ADAPTIVE; + @@ -60679,8 +59172,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r +#define IQK_THRESHOLD 8 +#define DPK_THRESHOLD 4 + -+typedef struct _ODM_Phy_Status_Info_ -+{ ++typedef struct _ODM_Phy_Status_Info_ { + /* */ + /* Be care, if you want to add any element please insert between */ + /* RxPWDBAll & SignalStrength. */ @@ -60688,84 +59180,79 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + u8 RxPWDBAll; + + u8 SignalQuality; /* in 0-100 index. */ -+ s8 RxMIMOSignalQuality[4]; /* per-path's EVM */ ++ s8 RxMIMOSignalQuality[4]; /* per-path's EVM */ + u8 RxMIMOEVMdbm[4]; /* per-path's EVM dbm */ + + u8 RxMIMOSignalStrength[4];/* in 0~100 index */ + -+ u16 Cfo_short[4]; /* per-path's Cfo_short */ -+ u16 Cfo_tail[4]; /* per-path's Cfo_tail */ ++ u16 Cfo_short[4]; /* per-path's Cfo_short */ ++ u16 Cfo_tail[4]; /* per-path's Cfo_tail */ + -+ s8 RxPower; /* in dBm Translate from PWdB */ -+ s8 RecvSignalPower; /* Real power in dBm for this packet, no beautification and aggregation. Keep this raw info to be used for the other procedures. */ ++ s8 RxPower; /* in dBm Translate from PWdB */ ++ s8 RecvSignalPower; /* Real power in dBm for this packet, no beautification and aggregation. Keep this raw info to be used for the other procedures. */ + u8 BTRxRSSIPercentage; + u8 SignalStrength; /* in 0-100 index. */ + -+ s8 RxPwr[4]; /* per-path's pwdb */ ++ s8 RxPwr[4]; /* per-path's pwdb */ + + u8 RxSNR[4]; /* per-path's SNR */ + u8 BandWidth; + u8 btCoexPwrAdjust; -+}ODM_PHY_INFO_T,*PODM_PHY_INFO_T; ++} ODM_PHY_INFO_T, *PODM_PHY_INFO_T; + + -+typedef struct _ODM_Per_Pkt_Info_ -+{ ++typedef struct _ODM_Per_Pkt_Info_ { + /* u8 Rate; */ + u8 DataRate; + u8 StationID; -+ bool bPacketMatchBSSID; -+ bool bPacketToSelf; -+ bool bPacketBeacon; -+ bool bToSelf; -+}ODM_PACKET_INFO_T,*PODM_PACKET_INFO_T; ++ bool bPacketMatchBSSID; ++ bool bPacketToSelf; ++ bool bPacketBeacon; ++ bool bToSelf; ++} ODM_PACKET_INFO_T, *PODM_PACKET_INFO_T; + + -+typedef struct _ODM_Phy_Dbg_Info_ -+{ ++typedef struct _ODM_Phy_Dbg_Info_ { + /* ODM Write, debug info */ -+ s8 RxSNRdB[4]; -+ u32 NumQryPhyStatus; -+ u32 NumQryPhyStatusCCK; -+ u32 NumQryPhyStatusOFDM; ++ s8 RxSNRdB[4]; ++ u32 NumQryPhyStatus; ++ u32 NumQryPhyStatusCCK; ++ u32 NumQryPhyStatusOFDM; + u8 NumQryBeaconPkt; + /* Others */ -+ s32 RxEVM[4]; ++ s32 RxEVM[4]; + -+}ODM_PHY_DBG_INFO_T; ++} ODM_PHY_DBG_INFO_T; + + -+typedef struct _ODM_Mac_Status_Info_ -+{ ++typedef struct _ODM_Mac_Status_Info_ { + u8 test; -+ -+}ODM_MAC_INFO; ++} ODM_MAC_INFO; + + -+typedef enum tag_Dynamic_ODM_Support_Ability_Type -+{ ++typedef enum tag_Dynamic_ODM_Support_Ability_Type { + /* BB Team */ + ODM_DIG = 0x00000001, + ODM_HIGH_POWER = 0x00000002, + ODM_CCK_CCA_TH = 0x00000004, -+ ODM_FA_STATISTICS = 0x00000008, ++ ODM_FA_STATISTICS = 0x00000008, + ODM_RAMASK = 0x00000010, -+ ODM_RSSI_MONITOR = 0x00000020, ++ ODM_RSSI_MONITOR = 0x00000020, + ODM_SW_ANTDIV = 0x00000040, + ODM_HW_ANTDIV = 0x00000080, -+ ODM_BB_PWRSV = 0x00000100, -+ ODM_2TPATHDIV = 0x00000200, -+ ODM_1TPATHDIV = 0x00000400, ++ ODM_BB_PWRSV = 0x00000100, ++ ODM_2TPATHDIV = 0x00000200, ++ ODM_1TPATHDIV = 0x00000400, + ODM_PSD2AFH = 0x00000800 -+}ODM_Ability_E; ++} ODM_Ability_E; + +/* */ +/* 2011/20/20 MH For MP driver RT_WLAN_STA = STA_INFO_T */ +/* Please declare below ODM relative info in your STA info structure. */ +/* */ -+typedef struct _ODM_STA_INFO{ ++typedef struct _ODM_STA_INFO { + /* Driver Write */ -+ bool bUsed; /* record the sta status link or not? */ ++ bool bUsed; /* record the sta status link or not? */ + /* u8 WirelessMode; */ + u8 IOTPeer; /* Enum value. HT_IOT_PEER_E */ + @@ -60786,13 +59273,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + /* */ + /* ODM Write Wilson will handle this part(said by Luke.Lee) */ + /* TX_RPT_T pTxRpt; Define in IC folder. Move lower layer. */ -+}ODM_STA_INFO_T, *PODM_STA_INFO_T; ++} ODM_STA_INFO_T, *PODM_STA_INFO_T; + +/* */ +/* 2011/10/20 MH Define Common info enum for all team. */ +/* */ -+typedef enum _ODM_Common_Info_Definition -+{ ++typedef enum _ODM_Common_Info_Definition { + /* Fixed value: */ + + /* HOOK BEFORE REG INIT----------- */ @@ -60882,11 +59368,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + ODM_CMNINFO_MAX, + + -+}ODM_CMNINFO_E; ++} ODM_CMNINFO_E; + +/* 2011/10/20 MH Define ODM support ability. ODM_CMNINFO_ABILITY */ -+typedef enum _ODM_Support_Ability_Definition -+{ ++typedef enum _ODM_Support_Ability_Definition { + /* */ + /* BB ODM section BIT 0-15 */ + /* */ @@ -60912,26 +59397,23 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + + /* RF ODM section BIT 24-31 */ + ODM_RF_TX_PWR_TRACK = BIT24, -+ ODM_RF_RX_GAIN_TRACK = BIT25, ++ ODM_RF_RX_GAIN_TRACK = BIT25, + ODM_RF_CALIBRATION = BIT26, -+}ODM_ABILITY_E; ++} ODM_ABILITY_E; + +/* ODM_CMNINFO_INTERFACE */ -+typedef enum tag_ODM_Support_Interface_Definition -+{ ++typedef enum tag_ODM_Support_Interface_Definition { + ODM_ITRF_SDIO = 0x4, + ODM_ITRF_ALL = 0x7, -+}ODM_INTERFACE_E; ++} ODM_INTERFACE_E; + +/* ODM_CMNINFO_IC_TYPE */ -+typedef enum tag_ODM_Support_IC_Type_Definition -+{ ++typedef enum tag_ODM_Support_IC_Type_Definition { + ODM_RTL8723B = BIT8, -+}ODM_IC_TYPE_E; ++} ODM_IC_TYPE_E; + +/* ODM_CMNINFO_CUT_VER */ -+typedef enum tag_ODM_Cut_Version_Definition -+{ ++typedef enum tag_ODM_Cut_Version_Definition { + ODM_CUT_A = 0, + ODM_CUT_B = 1, + ODM_CUT_C = 2, @@ -60943,21 +59425,19 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + ODM_CUT_J = 9, + ODM_CUT_K = 10, + ODM_CUT_TEST = 15, -+}ODM_CUT_VERSION_E; ++} ODM_CUT_VERSION_E; + +/* ODM_CMNINFO_FAB_VER */ -+typedef enum tag_ODM_Fab_Version_Definition -+{ ++typedef enum tag_ODM_Fab_Version_Definition { + ODM_TSMC = 0, + ODM_UMC = 1, -+}ODM_FAB_E; ++} ODM_FAB_E; + +/* ODM_CMNINFO_RF_TYPE */ +/* */ +/* For example 1T2R (A+AB = BIT0|BIT4|BIT5) */ +/* */ -+typedef enum tag_ODM_RF_Path_Bit_Definition -+{ ++typedef enum tag_ODM_RF_Path_Bit_Definition { + ODM_RF_TX_A = BIT0, + ODM_RF_TX_B = BIT1, + ODM_RF_TX_C = BIT2, @@ -60966,11 +59446,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + ODM_RF_RX_B = BIT5, + ODM_RF_RX_C = BIT6, + ODM_RF_RX_D = BIT7, -+}ODM_RF_PATH_E; ++} ODM_RF_PATH_E; + + -+typedef enum tag_ODM_RF_Type_Definition -+{ ++typedef enum tag_ODM_RF_Type_Definition { + ODM_1T1R = 0, + ODM_1T2R = 1, + ODM_2T2R = 2, @@ -60979,7 +59458,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + ODM_3T3R = 5, + ODM_3T4R = 6, + ODM_4T4R = 7, -+}ODM_RF_TYPE_E; ++} ODM_RF_TYPE_E; + + +/* */ @@ -60992,154 +59471,137 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r +/* DUALMAC_SINGLEPHY, */ +/* MACPHY_MODE_8192D,*PMACPHY_MODE_8192D; */ +/* Above is the original define in MP driver. Please use the same define. THX. */ -+typedef enum tag_ODM_MAC_PHY_Mode_Definition -+{ ++typedef enum tag_ODM_MAC_PHY_Mode_Definition { + ODM_SMSP = 0, + ODM_DMSP = 1, + ODM_DMDP = 2, -+}ODM_MAC_PHY_MODE_E; ++} ODM_MAC_PHY_MODE_E; + + -+typedef enum tag_BT_Coexist_Definition -+{ ++typedef enum tag_BT_Coexist_Definition { + ODM_BT_BUSY = 1, -+ ODM_BT_ON = 2, ++ ODM_BT_ON = 2, + ODM_BT_OFF = 3, + ODM_BT_NONE = 4, -+}ODM_BT_COEXIST_E; ++} ODM_BT_COEXIST_E; + +/* ODM_CMNINFO_OP_MODE */ -+typedef enum tag_Operation_Mode_Definition -+{ -+ ODM_NO_LINK = BIT0, -+ ODM_LINK = BIT1, -+ ODM_SCAN = BIT2, -+ ODM_POWERSAVE = BIT3, -+ ODM_AP_MODE = BIT4, -+ ODM_CLIENT_MODE = BIT5, -+ ODM_AD_HOC = BIT6, -+ ODM_WIFI_DIRECT = BIT7, -+ ODM_WIFI_DISPLAY = BIT8, -+}ODM_OPERATION_MODE_E; ++typedef enum tag_Operation_Mode_Definition { ++ ODM_NO_LINK = BIT0, ++ ODM_LINK = BIT1, ++ ODM_SCAN = BIT2, ++ ODM_POWERSAVE = BIT3, ++ ODM_AP_MODE = BIT4, ++ ODM_CLIENT_MODE = BIT5, ++ ODM_AD_HOC = BIT6, ++ ODM_WIFI_DIRECT = BIT7, ++ ODM_WIFI_DISPLAY = BIT8, ++} ODM_OPERATION_MODE_E; + +/* ODM_CMNINFO_WM_MODE */ -+typedef enum tag_Wireless_Mode_Definition -+{ -+ ODM_WM_UNKNOW = 0x0, -+ ODM_WM_B = BIT0, -+ ODM_WM_G = BIT1, -+ ODM_WM_A = BIT2, -+ ODM_WM_N24G = BIT3, -+ ODM_WM_N5G = BIT4, -+ ODM_WM_AUTO = BIT5, -+ ODM_WM_AC = BIT6, -+}ODM_WIRELESS_MODE_E; ++typedef enum tag_Wireless_Mode_Definition { ++ ODM_WM_UNKNOW = 0x0, ++ ODM_WM_B = BIT0, ++ ODM_WM_G = BIT1, ++ ODM_WM_A = BIT2, ++ ODM_WM_N24G = BIT3, ++ ODM_WM_N5G = BIT4, ++ ODM_WM_AUTO = BIT5, ++ ODM_WM_AC = BIT6, ++} ODM_WIRELESS_MODE_E; + +/* ODM_CMNINFO_BAND */ -+typedef enum tag_Band_Type_Definition -+{ -+ ODM_BAND_2_4G = 0, -+ ODM_BAND_5G, -+ ODM_BAND_ON_BOTH, -+ ODM_BANDMAX -+ -+}ODM_BAND_TYPE_E; ++typedef enum tag_Band_Type_Definition { ++ ODM_BAND_2_4G = 0, ++ ODM_BAND_5G, ++ ODM_BAND_ON_BOTH, ++ ODM_BANDMAX ++} ODM_BAND_TYPE_E; + +/* ODM_CMNINFO_SEC_CHNL_OFFSET */ -+typedef enum tag_Secondary_Channel_Offset_Definition -+{ ++typedef enum tag_Secondary_Channel_Offset_Definition { + ODM_DONT_CARE = 0, + ODM_BELOW = 1, -+ ODM_ABOVE = 2 -+}ODM_SEC_CHNL_OFFSET_E; ++ ODM_ABOVE = 2 ++} ODM_SEC_CHNL_OFFSET_E; + +/* ODM_CMNINFO_SEC_MODE */ -+typedef enum tag_Security_Definition -+{ -+ ODM_SEC_OPEN = 0, ++typedef enum tag_Security_Definition { ++ ODM_SEC_OPEN = 0, + ODM_SEC_WEP40 = 1, -+ ODM_SEC_TKIP = 2, -+ ODM_SEC_RESERVE = 3, -+ ODM_SEC_AESCCMP = 4, ++ ODM_SEC_TKIP = 2, ++ ODM_SEC_RESERVE = 3, ++ ODM_SEC_AESCCMP = 4, + ODM_SEC_WEP104 = 5, -+ ODM_WEP_WPA_MIXED = 6, /* WEP + WPA */ -+ ODM_SEC_SMS4 = 7, -+}ODM_SECURITY_E; ++ ODM_WEP_WPA_MIXED = 6, /* WEP + WPA */ ++ ODM_SEC_SMS4 = 7, ++} ODM_SECURITY_E; + +/* ODM_CMNINFO_BW */ -+typedef enum tag_Bandwidth_Definition -+{ ++typedef enum tag_Bandwidth_Definition { + ODM_BW20M = 0, + ODM_BW40M = 1, + ODM_BW80M = 2, + ODM_BW160M = 3, + ODM_BW10M = 4, -+}ODM_BW_E; ++} ODM_BW_E; + + +/* ODM_CMNINFO_BOARD_TYPE */ +/* For non-AC-series IC , ODM_BOARD_5G_EXT_PA and ODM_BOARD_5G_EXT_LNA are ignored */ +/* For AC-series IC, external PA & LNA can be indivisuallly added on 2.4G and/or 5G */ -+typedef enum tag_Board_Definition -+{ -+ ODM_BOARD_DEFAULT = 0, /* The DEFAULT case. */ -+ ODM_BOARD_MINICARD = BIT(0), /* 0 = non-mini card, 1 = mini card. */ -+ ODM_BOARD_SLIM = BIT(1), /* 0 = non-slim card, 1 = slim card */ -+ ODM_BOARD_BT = BIT(2), /* 0 = without BT card, 1 = with BT */ -+ ODM_BOARD_EXT_PA = BIT(3), /* 0 = no 2G ext-PA, 1 = existing 2G ext-PA */ -+ ODM_BOARD_EXT_LNA = BIT(4), /* 0 = no 2G ext-LNA, 1 = existing 2G ext-LNA */ -+ ODM_BOARD_EXT_TRSW = BIT(5), /* 0 = no ext-TRSW, 1 = existing ext-TRSW */ -+ ODM_BOARD_EXT_PA_5G = BIT(6), /* 0 = no 5G ext-PA, 1 = existing 5G ext-PA */ -+ ODM_BOARD_EXT_LNA_5G = BIT(7), /* 0 = no 5G ext-LNA, 1 = existing 5G ext-LNA */ -+}ODM_BOARD_TYPE_E; ++typedef enum tag_Board_Definition { ++ ODM_BOARD_DEFAULT = 0, /* The DEFAULT case. */ ++ ODM_BOARD_MINICARD = BIT(0), /* 0 = non-mini card, 1 = mini card. */ ++ ODM_BOARD_SLIM = BIT(1), /* 0 = non-slim card, 1 = slim card */ ++ ODM_BOARD_BT = BIT(2), /* 0 = without BT card, 1 = with BT */ ++ ODM_BOARD_EXT_PA = BIT(3), /* 0 = no 2G ext-PA, 1 = existing 2G ext-PA */ ++ ODM_BOARD_EXT_LNA = BIT(4), /* 0 = no 2G ext-LNA, 1 = existing 2G ext-LNA */ ++ ODM_BOARD_EXT_TRSW = BIT(5), /* 0 = no ext-TRSW, 1 = existing ext-TRSW */ ++ ODM_BOARD_EXT_PA_5G = BIT(6), /* 0 = no 5G ext-PA, 1 = existing 5G ext-PA */ ++ ODM_BOARD_EXT_LNA_5G = BIT(7), /* 0 = no 5G ext-LNA, 1 = existing 5G ext-LNA */ ++} ODM_BOARD_TYPE_E; + -+typedef enum tag_ODM_Package_Definition -+{ -+ ODM_PACKAGE_DEFAULT = 0, -+ ODM_PACKAGE_QFN68 = BIT(0), -+ ODM_PACKAGE_TFBGA90 = BIT(1), -+ ODM_PACKAGE_TFBGA79 = BIT(2), -+}ODM_Package_TYPE_E; ++typedef enum tag_ODM_Package_Definition { ++ ODM_PACKAGE_DEFAULT = 0, ++ ODM_PACKAGE_QFN68 = BIT(0), ++ ODM_PACKAGE_TFBGA90 = BIT(1), ++ ODM_PACKAGE_TFBGA79 = BIT(2), ++} ODM_Package_TYPE_E; + -+typedef enum tag_ODM_TYPE_GPA_Definition -+{ -+ TYPE_GPA0 = 0, -+ TYPE_GPA1 = BIT(1)|BIT(0) -+}ODM_TYPE_GPA_E; ++typedef enum tag_ODM_TYPE_GPA_Definition { ++ TYPE_GPA0 = 0, ++ TYPE_GPA1 = BIT(1)|BIT(0) ++} ODM_TYPE_GPA_E; + -+typedef enum tag_ODM_TYPE_APA_Definition -+{ -+ TYPE_APA0 = 0, -+ TYPE_APA1 = BIT(1)|BIT(0) -+}ODM_TYPE_APA_E; ++typedef enum tag_ODM_TYPE_APA_Definition { ++ TYPE_APA0 = 0, ++ TYPE_APA1 = BIT(1)|BIT(0) ++} ODM_TYPE_APA_E; + -+typedef enum tag_ODM_TYPE_GLNA_Definition -+{ -+ TYPE_GLNA0 = 0, -+ TYPE_GLNA1 = BIT(2)|BIT(0), -+ TYPE_GLNA2 = BIT(3)|BIT(1), -+ TYPE_GLNA3 = BIT(3)|BIT(2)|BIT(1)|BIT(0) -+}ODM_TYPE_GLNA_E; ++typedef enum tag_ODM_TYPE_GLNA_Definition { ++ TYPE_GLNA0 = 0, ++ TYPE_GLNA1 = BIT(2)|BIT(0), ++ TYPE_GLNA2 = BIT(3)|BIT(1), ++ TYPE_GLNA3 = BIT(3)|BIT(2)|BIT(1)|BIT(0) ++} ODM_TYPE_GLNA_E; + -+typedef enum tag_ODM_TYPE_ALNA_Definition -+{ -+ TYPE_ALNA0 = 0, -+ TYPE_ALNA1 = BIT(2)|BIT(0), -+ TYPE_ALNA2 = BIT(3)|BIT(1), -+ TYPE_ALNA3 = BIT(3)|BIT(2)|BIT(1)|BIT(0) -+}ODM_TYPE_ALNA_E; ++typedef enum tag_ODM_TYPE_ALNA_Definition { ++ TYPE_ALNA0 = 0, ++ TYPE_ALNA1 = BIT(2)|BIT(0), ++ TYPE_ALNA2 = BIT(3)|BIT(1), ++ TYPE_ALNA3 = BIT(3)|BIT(2)|BIT(1)|BIT(0) ++} ODM_TYPE_ALNA_E; + +/* ODM_CMNINFO_ONE_PATH_CCA */ -+typedef enum tag_CCA_Path -+{ ++typedef enum tag_CCA_Path { + ODM_CCA_2R = 0, + ODM_CCA_1R_A = 1, + ODM_CCA_1R_B = 2, -+}ODM_CCA_PATH_E; ++} ODM_CCA_PATH_E; + + -+typedef struct _ODM_RA_Info_ -+{ ++typedef struct _ODM_RA_Info_ { + u8 RateID; + u32 RateMask; + u32 RAUseRate; @@ -61169,26 +59631,25 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + u8 PTModeSS; /* decide whitch rate should do PT */ + u8 RAstage; /* StageRA, decide how many times RA will be done between PT */ + u8 PTSmoothFactor; -+} ODM_RA_INFO_T,*PODM_RA_INFO_T; ++} ODM_RA_INFO_T, *PODM_RA_INFO_T; + -+typedef struct _IQK_MATRIX_REGS_SETTING{ -+ bool bIQKDone; -+ s32 Value[3][IQK_Matrix_REG_NUM]; -+ bool bBWIqkResultSaved[3]; -+}IQK_MATRIX_REGS_SETTING,*PIQK_MATRIX_REGS_SETTING; ++typedef struct _IQK_MATRIX_REGS_SETTING { ++ bool bIQKDone; ++ s32 Value[3][IQK_Matrix_REG_NUM]; ++ bool bBWIqkResultSaved[3]; ++} IQK_MATRIX_REGS_SETTING, *PIQK_MATRIX_REGS_SETTING; + + +/* Remove PATHDIV_PARA struct to odm_PathDiv.h */ + -+typedef struct ODM_RF_Calibration_Structure -+{ ++typedef struct ODM_RF_Calibration_Structure { + /* for tx power tracking */ + + u32 RegA24; /* for TempCCK */ -+ s32 RegE94; -+ s32 RegE9C; -+ s32 RegEB4; -+ s32 RegEBC; ++ s32 RegE94; ++ s32 RegE9C; ++ s32 RegEB4; ++ s32 RegEBC; + + u8 TXPowercount; + bool bTXPowerTrackingInit; @@ -61208,9 +59669,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + u8 ThermalValue_Crystal; + u8 ThermalValue_DPKstore; + u8 ThermalValue_DPKtrack; -+ bool TxPowerTrackingInProgress; ++ bool TxPowerTrackingInProgress; + -+ bool bReloadtxpowerindex; ++ bool bReloadtxpowerindex; + u8 bRfPiEnable; + u32 TXPowerTrackingCallbackCnt; /* cosa add for debug */ + @@ -61219,33 +59680,33 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + u8 bCCKinCH14; + u8 CCK_index; + u8 OFDM_index[MAX_RF_PATH]; -+ s8 PowerIndexOffset[MAX_RF_PATH]; -+ s8 DeltaPowerIndex[MAX_RF_PATH]; -+ s8 DeltaPowerIndexLast[MAX_RF_PATH]; ++ s8 PowerIndexOffset[MAX_RF_PATH]; ++ s8 DeltaPowerIndex[MAX_RF_PATH]; ++ s8 DeltaPowerIndexLast[MAX_RF_PATH]; + bool bTxPowerChanged; + + u8 ThermalValue_HP[HP_THERMAL_NUM]; + u8 ThermalValue_HP_index; + IQK_MATRIX_REGS_SETTING IQKMatrixRegSetting[IQK_Matrix_Settings_NUM]; -+ bool bNeedIQK; -+ bool bIQKInProgress; ++ bool bNeedIQK; ++ bool bIQKInProgress; + u8 Delta_IQK; + u8 Delta_LCK; -+ s8 BBSwingDiff2G, BBSwingDiff5G; /* Unit: dB */ -+ u8 DeltaSwingTableIdx_2GCCKA_P[DELTA_SWINGIDX_SIZE]; -+ u8 DeltaSwingTableIdx_2GCCKA_N[DELTA_SWINGIDX_SIZE]; -+ u8 DeltaSwingTableIdx_2GCCKB_P[DELTA_SWINGIDX_SIZE]; -+ u8 DeltaSwingTableIdx_2GCCKB_N[DELTA_SWINGIDX_SIZE]; -+ u8 DeltaSwingTableIdx_2GA_P[DELTA_SWINGIDX_SIZE]; -+ u8 DeltaSwingTableIdx_2GA_N[DELTA_SWINGIDX_SIZE]; -+ u8 DeltaSwingTableIdx_2GB_P[DELTA_SWINGIDX_SIZE]; -+ u8 DeltaSwingTableIdx_2GB_N[DELTA_SWINGIDX_SIZE]; -+ u8 DeltaSwingTableIdx_5GA_P[BAND_NUM][DELTA_SWINGIDX_SIZE]; -+ u8 DeltaSwingTableIdx_5GA_N[BAND_NUM][DELTA_SWINGIDX_SIZE]; -+ u8 DeltaSwingTableIdx_5GB_P[BAND_NUM][DELTA_SWINGIDX_SIZE]; -+ u8 DeltaSwingTableIdx_5GB_N[BAND_NUM][DELTA_SWINGIDX_SIZE]; -+ u8 DeltaSwingTableIdx_2GA_P_8188E[DELTA_SWINGIDX_SIZE]; -+ u8 DeltaSwingTableIdx_2GA_N_8188E[DELTA_SWINGIDX_SIZE]; ++ s8 BBSwingDiff2G, BBSwingDiff5G; /* Unit: dB */ ++ u8 DeltaSwingTableIdx_2GCCKA_P[DELTA_SWINGIDX_SIZE]; ++ u8 DeltaSwingTableIdx_2GCCKA_N[DELTA_SWINGIDX_SIZE]; ++ u8 DeltaSwingTableIdx_2GCCKB_P[DELTA_SWINGIDX_SIZE]; ++ u8 DeltaSwingTableIdx_2GCCKB_N[DELTA_SWINGIDX_SIZE]; ++ u8 DeltaSwingTableIdx_2GA_P[DELTA_SWINGIDX_SIZE]; ++ u8 DeltaSwingTableIdx_2GA_N[DELTA_SWINGIDX_SIZE]; ++ u8 DeltaSwingTableIdx_2GB_P[DELTA_SWINGIDX_SIZE]; ++ u8 DeltaSwingTableIdx_2GB_N[DELTA_SWINGIDX_SIZE]; ++ u8 DeltaSwingTableIdx_5GA_P[BAND_NUM][DELTA_SWINGIDX_SIZE]; ++ u8 DeltaSwingTableIdx_5GA_N[BAND_NUM][DELTA_SWINGIDX_SIZE]; ++ u8 DeltaSwingTableIdx_5GB_P[BAND_NUM][DELTA_SWINGIDX_SIZE]; ++ u8 DeltaSwingTableIdx_5GB_N[BAND_NUM][DELTA_SWINGIDX_SIZE]; ++ u8 DeltaSwingTableIdx_2GA_P_8188E[DELTA_SWINGIDX_SIZE]; ++ u8 DeltaSwingTableIdx_2GA_N_8188E[DELTA_SWINGIDX_SIZE]; + + /* */ + @@ -61259,9 +59720,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + u32 Reg860; + u32 Reg864; + -+ bool bIQKInitialized; ++ bool bIQKInitialized; + bool bLCKInProgress; -+ bool bAntennaDetected; ++ bool bAntennaDetected; + u32 ADDA_backup[IQK_ADDA_REG_NUM]; + u32 IQK_MAC_backup[IQK_MAC_REG_NUM]; + u32 IQK_BB_backup_recover[9]; @@ -61283,13 +59744,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + + u32 TxLOK[2]; + -+}ODM_RF_CAL_T,*PODM_RF_CAL_T; ++} ODM_RF_CAL_T, *PODM_RF_CAL_T; +/* */ +/* ODM Dynamic common info value definition */ +/* */ + -+typedef struct _FAST_ANTENNA_TRAINNING_ -+{ ++typedef struct _FAST_ANTENNA_TRAINNING_ { + u8 Bssid[6]; + u8 antsel_rx_keep_0; + u8 antsel_rx_keep_1; @@ -61313,31 +59773,29 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + u8 idx_AntDiv_counter_2G; + u8 idx_AntDiv_counter_5G; + u32 AntDiv_2G_5G; -+ u32 CCK_counter_main; -+ u32 CCK_counter_aux; -+ u32 OFDM_counter_main; -+ u32 OFDM_counter_aux; ++ u32 CCK_counter_main; ++ u32 CCK_counter_aux; ++ u32 OFDM_counter_main; ++ u32 OFDM_counter_aux; + + -+ u32 CCK_CtrlFrame_Cnt_main; -+ u32 CCK_CtrlFrame_Cnt_aux; -+ u32 OFDM_CtrlFrame_Cnt_main; -+ u32 OFDM_CtrlFrame_Cnt_aux; ++ u32 CCK_CtrlFrame_Cnt_main; ++ u32 CCK_CtrlFrame_Cnt_aux; ++ u32 OFDM_CtrlFrame_Cnt_main; ++ u32 OFDM_CtrlFrame_Cnt_aux; + u32 MainAnt_CtrlFrame_Sum; + u32 AuxAnt_CtrlFrame_Sum; + u32 MainAnt_CtrlFrame_Cnt; + u32 AuxAnt_CtrlFrame_Cnt; + -+}FAT_T,*pFAT_T; ++} FAT_T, *pFAT_T; + -+typedef enum _FAT_STATE -+{ ++typedef enum _FAT_STATE { + FAT_NORMAL_STATE = 0, + FAT_TRAINING_STATE = 1, -+}FAT_STATE_E, *PFAT_STATE_E; ++} FAT_STATE_E, *PFAT_STATE_E; + -+typedef enum _ANT_DIV_TYPE -+{ ++typedef enum _ANT_DIV_TYPE { + NO_ANTDIV = 0xFF, + CG_TRX_HW_ANTDIV = 0x01, + CGCS_RX_HW_ANTDIV = 0x02, @@ -61345,17 +59803,16 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + CG_TRX_SMART_ANTDIV = 0x04, + CGCS_RX_SW_ANTDIV = 0x05, + S0S1_SW_ANTDIV = 0x06 /* 8723B intrnal switch S0 S1 */ -+}ANT_DIV_TYPE_E, *PANT_DIV_TYPE_E; ++} ANT_DIV_TYPE_E, *PANT_DIV_TYPE_E; + -+typedef struct _ODM_PATH_DIVERSITY_ -+{ ++typedef struct _ODM_PATH_DIVERSITY_ { + u8 RespTxPath; + u8 PathSel[ODM_ASSOCIATE_ENTRY_NUM]; + u32 PathA_Sum[ODM_ASSOCIATE_ENTRY_NUM]; + u32 PathB_Sum[ODM_ASSOCIATE_ENTRY_NUM]; + u32 PathA_Cnt[ODM_ASSOCIATE_ENTRY_NUM]; + u32 PathB_Cnt[ODM_ASSOCIATE_ENTRY_NUM]; -+}PATHDIV_T, *pPATHDIV_T; ++} PATHDIV_T, *pPATHDIV_T; + + +typedef enum _BASEBAND_CONFIG_PHY_REG_PG_VALUE_TYPE{ @@ -61367,42 +59824,41 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r +/* */ +/* Antenna detection information from single tone mechanism, added by Roger, 2012.11.27. */ +/* */ -+typedef struct _ANT_DETECTED_INFO{ -+ bool bAntDetected; -+ u32 dBForAntA; -+ u32 dBForAntB; -+ u32 dBForAntO; -+}ANT_DETECTED_INFO, *PANT_DETECTED_INFO; ++typedef struct _ANT_DETECTED_INFO { ++ bool bAntDetected; ++ u32 dBForAntA; ++ u32 dBForAntB; ++ u32 dBForAntO; ++} ANT_DETECTED_INFO, *PANT_DETECTED_INFO; + +/* */ +/* 2011/09/22 MH Copy from SD4 defined structure. We use to support PHY DM integration. */ +/* */ -+typedef struct DM_Out_Source_Dynamic_Mechanism_Structure -+{ ++typedef struct DM_Out_Source_Dynamic_Mechanism_Structure { + /* RT_TIMER FastAntTrainingTimer; */ + /* */ + /* Add for different team use temporarily */ + /* */ -+ struct adapter * Adapter; /* For CE/NIC team */ ++ struct adapter *Adapter; /* For CE/NIC team */ + /* WHen you use Adapter or priv pointer, you must make sure the pointer is ready. */ -+ bool odm_ready; ++ bool odm_ready; + -+ PHY_REG_PG_TYPE PhyRegPgValueType; -+ u8 PhyRegPgVersion; ++ PHY_REG_PG_TYPE PhyRegPgValueType; ++ u8 PhyRegPgVersion; + -+ u64 DebugComponents; -+ u32 DebugLevel; ++ u64 DebugComponents; ++ u32 DebugLevel; + -+ u32 NumQryPhyStatusAll; /* CCK + OFDM */ -+ u32 LastNumQryPhyStatusAll; -+ u32 RxPWDBAve; -+ bool MPDIG_2G; /* off MPDIG */ -+ u8 Times_2G; ++ u32 NumQryPhyStatusAll; /* CCK + OFDM */ ++ u32 LastNumQryPhyStatusAll; ++ u32 RxPWDBAve; ++ bool MPDIG_2G; /* off MPDIG */ ++ u8 Times_2G; + +/* ODM HANDLE, DRIVER NEEDS NOT TO HOOK------ */ -+ bool bCckHighPower; -+ u8 RFPathRxEnable; /* ODM_CMNINFO_RFPATH_ENABLE */ -+ u8 ControlChannel; ++ bool bCckHighPower; ++ u8 RFPathRxEnable; /* ODM_CMNINFO_RFPATH_ENABLE */ ++ u8 ControlChannel; +/* ODM HANDLE, DRIVER NEEDS NOT TO HOOK------ */ + +/* REMOVED COMMON INFO---------- */ @@ -61424,42 +59880,42 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + /* */ +/* HOOK BEFORE REG INIT----------- */ + /* ODM Platform info AP/ADSL/CE/MP = 1/2/3/4 */ -+ u8 SupportPlatform; ++ u8 SupportPlatform; + /* ODM Support Ability DIG/RATR/TX_PWR_TRACK/ ?K?K = 1/2/3/?K */ -+ u32 SupportAbility; ++ u32 SupportAbility; + /* ODM PCIE/USB/SDIO = 1/2/3 */ -+ u8 SupportInterface; ++ u8 SupportInterface; + /* ODM composite or independent. Bit oriented/ 92C+92D+ .... or any other type = 1/2/3/... */ -+ u32 SupportICType; ++ u32 SupportICType; + /* Cut Version TestChip/A-cut/B-cut... = 0/1/2/3/... */ -+ u8 CutVersion; ++ u8 CutVersion; + /* Fab Version TSMC/UMC = 0/1 */ -+ u8 FabVersion; ++ u8 FabVersion; + /* RF Type 4T4R/3T3R/2T2R/1T2R/1T1R/... */ -+ u8 RFType; -+ u8 RFEType; ++ u8 RFType; ++ u8 RFEType; + /* Board Type Normal/HighPower/MiniCard/SLIM/Combo/... = 0/1/2/3/4/... */ -+ u8 BoardType; -+ u8 PackageType; -+ u8 TypeGLNA; -+ u8 TypeGPA; -+ u8 TypeALNA; -+ u8 TypeAPA; ++ u8 BoardType; ++ u8 PackageType; ++ u8 TypeGLNA; ++ u8 TypeGPA; ++ u8 TypeALNA; ++ u8 TypeAPA; + /* with external LNA NO/Yes = 0/1 */ -+ u8 ExtLNA; -+ u8 ExtLNA5G; ++ u8 ExtLNA; ++ u8 ExtLNA5G; + /* with external PA NO/Yes = 0/1 */ -+ u8 ExtPA; -+ u8 ExtPA5G; ++ u8 ExtPA; ++ u8 ExtPA5G; + /* with external TRSW NO/Yes = 0/1 */ -+ u8 ExtTRSW; -+ u8 PatchID; /* Customer ID */ -+ bool bInHctTest; -+ bool bWIFITest; ++ u8 ExtTRSW; ++ u8 PatchID; /* Customer ID */ ++ bool bInHctTest; ++ bool bWIFITest; + -+ bool bDualMacSmartConcurrent; -+ u32 BK_SupportAbility; -+ u8 AntDivType; ++ bool bDualMacSmartConcurrent; ++ u32 BK_SupportAbility; ++ u8 AntDivType; +/* HOOK BEFORE REG INIT----------- */ + + /* */ @@ -61467,126 +59923,126 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + /* */ +/* POINTER REFERENCE----------- */ + -+ u8 u8_temp; -+ bool bool_temp; ++ u8 u8_temp; ++ bool bool_temp; + struct adapter *adapter_temp; + + /* MAC PHY Mode SMSP/DMSP/DMDP = 0/1/2 */ -+ u8 *pMacPhyMode; ++ u8 *pMacPhyMode; + /* TX Unicast byte count */ -+ u64 *pNumTxBytesUnicast; ++ u64 *pNumTxBytesUnicast; + /* RX Unicast byte count */ -+ u64 *pNumRxBytesUnicast; ++ u64 *pNumRxBytesUnicast; + /* Wireless mode B/G/A/N = BIT0/BIT1/BIT2/BIT3 */ -+ u8 *pwirelessmode; /* ODM_WIRELESS_MODE_E */ ++ u8 *pwirelessmode; /* ODM_WIRELESS_MODE_E */ + /* Frequence band 2.4G/5G = 0/1 */ -+ u8 *pBandType; ++ u8 *pBandType; + /* Secondary channel offset don't_care/below/above = 0/1/2 */ -+ u8 *pSecChOffset; ++ u8 *pSecChOffset; + /* Security mode Open/WEP/AES/TKIP = 0/1/2/3 */ -+ u8 *pSecurity; ++ u8 *pSecurity; + /* BW info 20M/40M/80M = 0/1/2 */ -+ u8 *pBandWidth; ++ u8 *pBandWidth; + /* Central channel location Ch1/Ch2/.... */ -+ u8 *pChannel; /* central channel number */ -+ bool DPK_Done; ++ u8 *pChannel; /* central channel number */ ++ bool DPK_Done; + /* Common info for 92D DMSP */ + -+ bool *pbGetValueFromOtherMac; -+ struct adapter * *pBuddyAdapter; -+ bool *pbMasterOfDMSP; /* MAC0: master, MAC1: slave */ ++ bool *pbGetValueFromOtherMac; ++ struct adapter **pBuddyAdapter; ++ bool *pbMasterOfDMSP; /* MAC0: master, MAC1: slave */ + /* Common info for Status */ -+ bool *pbScanInProcess; -+ bool *pbPowerSaving; ++ bool *pbScanInProcess; ++ bool *pbPowerSaving; + /* CCA Path 2-path/path-A/path-B = 0/1/2; using ODM_CCA_PATH_E. */ -+ u8 *pOnePathCCA; ++ u8 *pOnePathCCA; + /* pMgntInfo->AntennaTest */ -+ u8 *pAntennaTest; -+ bool *pbNet_closed; -+ u8 *mp_mode; ++ u8 *pAntennaTest; ++ bool *pbNet_closed; ++ u8 *mp_mode; + /* u8 *pAidMap; */ -+ u8 *pu1ForcedIgiLb; ++ u8 *pu1ForcedIgiLb; +/* For 8723B IQK----------- */ -+ bool *pIs1Antenna; -+ u8 *pRFDefaultPath; ++ bool *pIs1Antenna; ++ u8 *pRFDefaultPath; + /* 0:S1, 1:S0 */ + +/* POINTER REFERENCE----------- */ -+ u16 * pForcedDataRate; ++ u16 *pForcedDataRate; +/* CALL BY VALUE------------- */ -+ bool bLinkInProcess; -+ bool bWIFI_Direct; -+ bool bWIFI_Display; -+ bool bLinked; ++ bool bLinkInProcess; ++ bool bWIFI_Direct; ++ bool bWIFI_Display; ++ bool bLinked; + -+ bool bsta_state; -+ u8 RSSI_Min; -+ u8 InterfaceIndex; /* Add for 92D dual MAC: 0--Mac0 1--Mac1 */ -+ bool bIsMPChip; -+ bool bOneEntryOnly; ++ bool bsta_state; ++ u8 RSSI_Min; ++ u8 InterfaceIndex; /* Add for 92D dual MAC: 0--Mac0 1--Mac1 */ ++ bool bIsMPChip; ++ bool bOneEntryOnly; + /* Common info for BTDM */ -+ bool bBtEnabled; /* BT is disabled */ -+ bool bBtConnectProcess; /* BT HS is under connection progress. */ -+ u8 btHsRssi; /* BT HS mode wifi rssi value. */ -+ bool bBtHsOperation; /* BT HS mode is under progress */ -+ bool bBtDisableEdcaTurbo; /* Under some condition, don't enable the EDCA Turbo */ -+ bool bBtLimitedDig; /* BT is busy. */ ++ bool bBtEnabled; /* BT is disabled */ ++ bool bBtConnectProcess; /* BT HS is under connection progress. */ ++ u8 btHsRssi; /* BT HS mode wifi rssi value. */ ++ bool bBtHsOperation; /* BT HS mode is under progress */ ++ bool bBtDisableEdcaTurbo; /* Under some condition, don't enable the EDCA Turbo */ ++ bool bBtLimitedDig; /* BT is busy. */ +/* CALL BY VALUE------------- */ -+ u8 RSSI_A; -+ u8 RSSI_B; -+ u64 RSSI_TRSW; -+ u64 RSSI_TRSW_H; -+ u64 RSSI_TRSW_L; -+ u64 RSSI_TRSW_iso; ++ u8 RSSI_A; ++ u8 RSSI_B; ++ u64 RSSI_TRSW; ++ u64 RSSI_TRSW_H; ++ u64 RSSI_TRSW_L; ++ u64 RSSI_TRSW_iso; + -+ u8 RxRate; -+ bool bNoisyState; -+ u8 TxRate; -+ u8 LinkedInterval; -+ u8 preChannel; -+ u32 TxagcOffsetValueA; -+ bool IsTxagcOffsetPositiveA; -+ u32 TxagcOffsetValueB; -+ bool IsTxagcOffsetPositiveB; -+ u64 lastTxOkCnt; -+ u64 lastRxOkCnt; -+ u32 BbSwingOffsetA; -+ bool IsBbSwingOffsetPositiveA; -+ u32 BbSwingOffsetB; -+ bool IsBbSwingOffsetPositiveB; -+ s8 TH_L2H_ini; -+ s8 TH_EDCCA_HL_diff; -+ s8 IGI_Base; -+ u8 IGI_target; -+ bool ForceEDCCA; -+ u8 AdapEn_RSSI; -+ s8 Force_TH_H; -+ s8 Force_TH_L; -+ u8 IGI_LowerBound; -+ u8 antdiv_rssi; -+ u8 AntType; -+ u8 pre_AntType; -+ u8 antdiv_period; -+ u8 antdiv_select; -+ u8 NdpaPeriod; -+ bool H2C_RARpt_connect; ++ u8 RxRate; ++ bool bNoisyState; ++ u8 TxRate; ++ u8 LinkedInterval; ++ u8 preChannel; ++ u32 TxagcOffsetValueA; ++ bool IsTxagcOffsetPositiveA; ++ u32 TxagcOffsetValueB; ++ bool IsTxagcOffsetPositiveB; ++ u64 lastTxOkCnt; ++ u64 lastRxOkCnt; ++ u32 BbSwingOffsetA; ++ bool IsBbSwingOffsetPositiveA; ++ u32 BbSwingOffsetB; ++ bool IsBbSwingOffsetPositiveB; ++ s8 TH_L2H_ini; ++ s8 TH_EDCCA_HL_diff; ++ s8 IGI_Base; ++ u8 IGI_target; ++ bool ForceEDCCA; ++ u8 AdapEn_RSSI; ++ s8 Force_TH_H; ++ s8 Force_TH_L; ++ u8 IGI_LowerBound; ++ u8 antdiv_rssi; ++ u8 AntType; ++ u8 pre_AntType; ++ u8 antdiv_period; ++ u8 antdiv_select; ++ u8 NdpaPeriod; ++ bool H2C_RARpt_connect; + + /* add by Yu Cehn for adaptivtiy */ -+ bool adaptivity_flag; -+ bool NHM_disable; -+ bool TxHangFlg; -+ bool Carrier_Sense_enable; -+ u8 tolerance_cnt; -+ u64 NHMCurTxOkcnt; -+ u64 NHMCurRxOkcnt; -+ u64 NHMLastTxOkcnt; -+ u64 NHMLastRxOkcnt; -+ u8 txEdcca1; -+ u8 txEdcca0; -+ s8 H2L_lb; -+ s8 L2H_lb; -+ u8 Adaptivity_IGI_upper; -+ u8 NHM_cnt_0; ++ bool adaptivity_flag; ++ bool NHM_disable; ++ bool TxHangFlg; ++ bool Carrier_Sense_enable; ++ u8 tolerance_cnt; ++ u64 NHMCurTxOkcnt; ++ u64 NHMCurRxOkcnt; ++ u64 NHMLastTxOkcnt; ++ u64 NHMLastRxOkcnt; ++ u8 txEdcca1; ++ u8 txEdcca0; ++ s8 H2L_lb; ++ s8 L2H_lb; ++ u8 Adaptivity_IGI_upper; ++ u8 NHM_cnt_0; + + + ODM_NOISE_MONITOR noise_level;/* ODM_MAX_CHANNEL_NUM]; */ @@ -61594,22 +60050,22 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + /* 2 Define STA info. */ + /* _ODM_STA_INFO */ + /* 2012/01/12 MH For MP, we need to reduce one array pointer for default port.?? */ -+ PSTA_INFO_T pODM_StaInfo[ODM_ASSOCIATE_ENTRY_NUM]; ++ PSTA_INFO_T pODM_StaInfo[ODM_ASSOCIATE_ENTRY_NUM]; + + /* */ + /* 2012/02/14 MH Add to share 88E ra with other SW team. */ + /* We need to colelct all support abilit to a proper area. */ + /* */ -+ bool RaSupport88E; ++ bool RaSupport88E; + + /* Define ........... */ + + /* Latest packet phy info (ODM write) */ -+ ODM_PHY_DBG_INFO_T PhyDbgInfo; ++ ODM_PHY_DBG_INFO_T PhyDbgInfo; + /* PHY_INFO_88E PhyInfo; */ + + /* Latest packet phy info (ODM write) */ -+ ODM_MAC_INFO *pMacInfo; ++ ODM_MAC_INFO *pMacInfo; + /* MAC_INFO_88E MacInfo; */ + + /* Different Team independt structure?? */ @@ -61622,21 +60078,21 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + /* */ + /* ODM Structure */ + /* */ -+ FAT_T DM_FatTable; -+ DIG_T DM_DigTable; -+ PS_T DM_PSTable; -+ Pri_CCA_T DM_PriCCA; -+ RXHP_T DM_RXHP_Table; -+ RA_T DM_RA_Table; -+ false_ALARM_STATISTICS FalseAlmCnt; -+ false_ALARM_STATISTICS FlaseAlmCntBuddyAdapter; -+ SWAT_T DM_SWAT_Table; -+ bool RSSI_test; -+ CFO_TRACKING DM_CfoTrack; ++ FAT_T DM_FatTable; ++ DIG_T DM_DigTable; ++ PS_T DM_PSTable; ++ Pri_CCA_T DM_PriCCA; ++ RXHP_T DM_RXHP_Table; ++ RA_T DM_RA_Table; ++ false_ALARM_STATISTICS FalseAlmCnt; ++ false_ALARM_STATISTICS FlaseAlmCntBuddyAdapter; ++ SWAT_T DM_SWAT_Table; ++ bool RSSI_test; ++ CFO_TRACKING DM_CfoTrack; + -+ EDCA_T DM_EDCA_Table; -+ u32 WMMEDCA_BE; -+ PATHDIV_T DM_PathDiv; ++ EDCA_T DM_EDCA_Table; ++ u32 WMMEDCA_BE; ++ PATHDIV_T DM_PathDiv; + /* Copy from SD4 structure */ + /* */ + /* ================================================== */ @@ -61653,126 +60109,126 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + /* u8 AntDivCfg; 0:OFF , 1:ON, 2:by efuse */ + /* PSTA_INFO_T RSSI_target; */ + -+ bool *pbDriverStopped; -+ bool *pbDriverIsGoingToPnpSetPowerSleep; -+ bool *pinit_adpt_in_progress; ++ bool *pbDriverStopped; ++ bool *pbDriverIsGoingToPnpSetPowerSleep; ++ bool *pinit_adpt_in_progress; + + /* PSD */ -+ bool bUserAssignLevel; -+ RT_TIMER PSDTimer; -+ u8 RSSI_BT; /* come from BT */ -+ bool bPSDinProcess; -+ bool bPSDactive; -+ bool bDMInitialGainEnable; ++ bool bUserAssignLevel; ++ RT_TIMER PSDTimer; ++ u8 RSSI_BT; /* come from BT */ ++ bool bPSDinProcess; ++ bool bPSDactive; ++ bool bDMInitialGainEnable; + + /* MPT DIG */ -+ RT_TIMER MPT_DIGTimer; ++ RT_TIMER MPT_DIGTimer; + + /* for rate adaptive, in fact, 88c/92c fw will handle this */ -+ u8 bUseRAMask; ++ u8 bUseRAMask; + -+ ODM_RATE_ADAPTIVE RateAdaptive; ++ ODM_RATE_ADAPTIVE RateAdaptive; + -+ ANT_DETECTED_INFO AntDetectedInfo; /* Antenna detected information for RSSI tool */ ++ ANT_DETECTED_INFO AntDetectedInfo; /* Antenna detected information for RSSI tool */ + -+ ODM_RF_CAL_T RFCalibrateInfo; ++ ODM_RF_CAL_T RFCalibrateInfo; + + /* */ + /* TX power tracking */ + /* */ -+ u8 BbSwingIdxOfdm[MAX_RF_PATH]; -+ u8 BbSwingIdxOfdmCurrent; -+ u8 BbSwingIdxOfdmBase[MAX_RF_PATH]; -+ bool BbSwingFlagOfdm; -+ u8 BbSwingIdxCck; -+ u8 BbSwingIdxCckCurrent; -+ u8 BbSwingIdxCckBase; -+ u8 DefaultOfdmIndex; -+ u8 DefaultCckIndex; -+ bool BbSwingFlagCck; ++ u8 BbSwingIdxOfdm[MAX_RF_PATH]; ++ u8 BbSwingIdxOfdmCurrent; ++ u8 BbSwingIdxOfdmBase[MAX_RF_PATH]; ++ bool BbSwingFlagOfdm; ++ u8 BbSwingIdxCck; ++ u8 BbSwingIdxCckCurrent; ++ u8 BbSwingIdxCckBase; ++ u8 DefaultOfdmIndex; ++ u8 DefaultCckIndex; ++ bool BbSwingFlagCck; + -+ s8 Absolute_OFDMSwingIdx[MAX_RF_PATH]; -+ s8 Remnant_OFDMSwingIdx[MAX_RF_PATH]; -+ s8 Remnant_CCKSwingIdx; -+ s8 Modify_TxAGC_Value; /* Remnat compensate value at TxAGC */ -+ bool Modify_TxAGC_Flag_PathA; -+ bool Modify_TxAGC_Flag_PathB; -+ bool Modify_TxAGC_Flag_PathC; -+ bool Modify_TxAGC_Flag_PathD; -+ bool Modify_TxAGC_Flag_PathA_CCK; ++ s8 Absolute_OFDMSwingIdx[MAX_RF_PATH]; ++ s8 Remnant_OFDMSwingIdx[MAX_RF_PATH]; ++ s8 Remnant_CCKSwingIdx; ++ s8 Modify_TxAGC_Value; /* Remnat compensate value at TxAGC */ ++ bool Modify_TxAGC_Flag_PathA; ++ bool Modify_TxAGC_Flag_PathB; ++ bool Modify_TxAGC_Flag_PathC; ++ bool Modify_TxAGC_Flag_PathD; ++ bool Modify_TxAGC_Flag_PathA_CCK; + -+ s8 KfreeOffset[MAX_RF_PATH]; ++ s8 KfreeOffset[MAX_RF_PATH]; + /* */ + /* ODM system resource. */ + /* */ + + /* ODM relative time. */ -+ RT_TIMER PathDivSwitchTimer; ++ RT_TIMER PathDivSwitchTimer; + /* 2011.09.27 add for Path Diversity */ -+ RT_TIMER CCKPathDiversityTimer; -+ RT_TIMER FastAntTrainingTimer; ++ RT_TIMER CCKPathDiversityTimer; ++ RT_TIMER FastAntTrainingTimer; + + /* ODM relative workitem. */ + + #if (BEAMFORMING_SUPPORT == 1) + RT_BEAMFORMING_INFO BeamformingInfo; + #endif -+} DM_ODM_T, *PDM_ODM_T; /* DM_Dynamic_Mechanism_Structure */ ++} DM_ODM_T, *PDM_ODM_T; /* DM_Dynamic_Mechanism_Structure */ + +#define ODM_RF_PATH_MAX 2 + +typedef enum _ODM_RF_RADIO_PATH { -+ ODM_RF_PATH_A = 0, /* Radio Path A */ -+ ODM_RF_PATH_B = 1, /* Radio Path B */ -+ ODM_RF_PATH_C = 2, /* Radio Path C */ -+ ODM_RF_PATH_D = 3, /* Radio Path D */ -+ ODM_RF_PATH_AB, -+ ODM_RF_PATH_AC, -+ ODM_RF_PATH_AD, -+ ODM_RF_PATH_BC, -+ ODM_RF_PATH_BD, -+ ODM_RF_PATH_CD, -+ ODM_RF_PATH_ABC, -+ ODM_RF_PATH_ACD, -+ ODM_RF_PATH_BCD, -+ ODM_RF_PATH_ABCD, -+ /* ODM_RF_PATH_MAX, Max RF number 90 support */ ++ ODM_RF_PATH_A = 0, /* Radio Path A */ ++ ODM_RF_PATH_B = 1, /* Radio Path B */ ++ ODM_RF_PATH_C = 2, /* Radio Path C */ ++ ODM_RF_PATH_D = 3, /* Radio Path D */ ++ ODM_RF_PATH_AB, ++ ODM_RF_PATH_AC, ++ ODM_RF_PATH_AD, ++ ODM_RF_PATH_BC, ++ ODM_RF_PATH_BD, ++ ODM_RF_PATH_CD, ++ ODM_RF_PATH_ABC, ++ ODM_RF_PATH_ACD, ++ ODM_RF_PATH_BCD, ++ ODM_RF_PATH_ABCD, ++ /* ODM_RF_PATH_MAX, Max RF number 90 support */ +} ODM_RF_RADIO_PATH_E, *PODM_RF_RADIO_PATH_E; + -+ typedef enum _ODM_RF_CONTENT{ ++ typedef enum _ODM_RF_CONTENT { + odm_radioa_txt = 0x1000, + odm_radiob_txt = 0x1001, + odm_radioc_txt = 0x1002, + odm_radiod_txt = 0x1003 +} ODM_RF_CONTENT; + -+typedef enum _ODM_BB_Config_Type{ -+ CONFIG_BB_PHY_REG, -+ CONFIG_BB_AGC_TAB, -+ CONFIG_BB_AGC_TAB_2G, -+ CONFIG_BB_AGC_TAB_5G, -+ CONFIG_BB_PHY_REG_PG, -+ CONFIG_BB_PHY_REG_MP, -+ CONFIG_BB_AGC_TAB_DIFF, ++typedef enum _ODM_BB_Config_Type { ++ CONFIG_BB_PHY_REG, ++ CONFIG_BB_AGC_TAB, ++ CONFIG_BB_AGC_TAB_2G, ++ CONFIG_BB_AGC_TAB_5G, ++ CONFIG_BB_PHY_REG_PG, ++ CONFIG_BB_PHY_REG_MP, ++ CONFIG_BB_AGC_TAB_DIFF, +} ODM_BB_Config_Type, *PODM_BB_Config_Type; + -+typedef enum _ODM_RF_Config_Type{ ++typedef enum _ODM_RF_Config_Type { + CONFIG_RF_RADIO, -+ CONFIG_RF_TXPWR_LMT, ++ CONFIG_RF_TXPWR_LMT, +} ODM_RF_Config_Type, *PODM_RF_Config_Type; + -+typedef enum _ODM_FW_Config_Type{ -+ CONFIG_FW_NIC, -+ CONFIG_FW_NIC_2, -+ CONFIG_FW_AP, -+ CONFIG_FW_WoWLAN, -+ CONFIG_FW_WoWLAN_2, -+ CONFIG_FW_AP_WoWLAN, -+ CONFIG_FW_BT, ++typedef enum _ODM_FW_Config_Type { ++ CONFIG_FW_NIC, ++ CONFIG_FW_NIC_2, ++ CONFIG_FW_AP, ++ CONFIG_FW_WoWLAN, ++ CONFIG_FW_WoWLAN_2, ++ CONFIG_FW_AP_WoWLAN, ++ CONFIG_FW_BT, +} ODM_FW_Config_Type; + +/* Status code */ -+typedef enum _RT_STATUS{ ++typedef enum _RT_STATUS { + RT_STATUS_SUCCESS, + RT_STATUS_FAILURE, + RT_STATUS_PENDING, @@ -61781,7 +60237,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + RT_STATUS_INVALID_PARAMETER, + RT_STATUS_NOT_SUPPORT, + RT_STATUS_OS_API_FAILED, -+}RT_STATUS,*PRT_STATUS; ++} RT_STATUS, *PRT_STATUS; + +#ifdef REMOVE_PACK +#pragma pack() @@ -61822,36 +60278,33 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r +/* 3 =========================================================== */ +#define DM_RATR_STA_INIT 0 +#define DM_RATR_STA_HIGH 1 -+#define DM_RATR_STA_MIDDLE 2 -+#define DM_RATR_STA_LOW 3 ++#define DM_RATR_STA_MIDDLE 2 ++#define DM_RATR_STA_LOW 3 + +/* 3 =========================================================== */ +/* 3 BB Power Save */ +/* 3 =========================================================== */ + -+typedef enum tag_1R_CCA_Type_Definition -+{ ++typedef enum tag_1R_CCA_Type_Definition { + CCA_1R = 0, + CCA_2R = 1, + CCA_MAX = 2, -+}DM_1R_CCA_E; ++} DM_1R_CCA_E; + -+typedef enum tag_RF_Type_Definition -+{ ++typedef enum tag_RF_Type_Definition { + RF_Save = 0, + RF_Normal = 1, + RF_MAX = 2, -+}DM_RF_E; ++} DM_RF_E; + +/* 3 =========================================================== */ +/* 3 Antenna Diversity */ +/* 3 =========================================================== */ -+typedef enum tag_SW_Antenna_Switch_Definition -+{ ++typedef enum tag_SW_Antenna_Switch_Definition { + Antenna_A = 1, + Antenna_B = 2, + Antenna_MAX = 3, -+}DM_SWAS_E; ++} DM_SWAS_E; + + +/* Maximal number of antenna detection mechanism needs to perform, added by Roger, 2011.12.28. */ @@ -61862,11 +60315,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r +/* */ +extern u32 OFDMSwingTable[OFDM_TABLE_SIZE]; +extern u8 CCKSwingTable_Ch1_Ch13[CCK_TABLE_SIZE][8]; -+extern u8 CCKSwingTable_Ch14 [CCK_TABLE_SIZE][8]; ++extern u8 CCKSwingTable_Ch14[CCK_TABLE_SIZE][8]; + +extern u32 OFDMSwingTable_New[OFDM_TABLE_SIZE]; +extern u8 CCKSwingTable_Ch1_Ch13_New[CCK_TABLE_SIZE][8]; -+extern u8 CCKSwingTable_Ch14_New [CCK_TABLE_SIZE][8]; ++extern u8 CCKSwingTable_Ch14_New[CCK_TABLE_SIZE][8]; + +extern u32 TxScalingTable_Jaguar[TXSCALE_TABLE_SIZE]; + @@ -61884,128 +60337,78 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm.h linux-4.3-rtl8723bs/3rdparty/r + +/* Remove DIG by yuchen */ + -+void -+ODM_SetAntenna( -+PDM_ODM_T pDM_Odm, -+u8 Antenna); ++void ODM_SetAntenna(PDM_ODM_T pDM_Odm, u8 Antenna); + + +/* Remove BB power saving by Yuchen */ + -+#define dm_CheckTXPowerTracking ODM_TXPowerTrackingCheck -+void -+ODM_TXPowerTrackingCheck( -+ PDM_ODM_T pDM_Odm -+ ); ++#define dm_CheckTXPowerTracking ODM_TXPowerTrackingCheck ++void ODM_TXPowerTrackingCheck(PDM_ODM_T pDM_Odm); + -+bool -+ODM_RAStateCheck( -+ PDM_ODM_T pDM_Odm, -+ s32 RSSI, -+ bool bForceUpdate, -+ u8 * pRATRState -+ ); ++bool ODM_RAStateCheck( ++ PDM_ODM_T pDM_Odm, ++ s32 RSSI, ++ bool bForceUpdate, ++ u8 *pRATRState ++); + +#define dm_SWAW_RSSI_Check ODM_SwAntDivChkPerPktRssi +void ODM_SwAntDivChkPerPktRssi( -+ PDM_ODM_T pDM_Odm, -+ u8 StationID, ++ PDM_ODM_T pDM_Odm, ++ u8 StationID, + PODM_PHY_INFO_T pPhyInfo -+ ); ++); + +u32 ODM_Get_Rate_Bitmap( -+ PDM_ODM_T pDM_Odm, -+ u32 macid, -+ u32 ra_mask, -+ u8 rssi_level); ++ PDM_ODM_T pDM_Odm, ++ u32 macid, ++ u32 ra_mask, ++ u8 rssi_level ++); + +#if (BEAMFORMING_SUPPORT == 1) -+BEAMFORMING_CAP -+Beamforming_GetEntryBeamCapByMacId( -+ PMGNT_INFO pMgntInfo, -+ u8 MacId -+); ++BEAMFORMING_CAP Beamforming_GetEntryBeamCapByMacId(PMGNT_INFO pMgntInfo, u8 MacId); +#endif + -+void -+odm_TXPowerTrackingInit( -+ PDM_ODM_T pDM_Odm -+ ); ++void odm_TXPowerTrackingInit(PDM_ODM_T pDM_Odm); + -+void -+ODM_DMInit( -+ PDM_ODM_T pDM_Odm ++void ODM_DMInit(PDM_ODM_T pDM_Odm); ++ ++void ODM_DMWatchdog(PDM_ODM_T pDM_Odm); /* For common use in the future */ ++ ++void ODM_CmnInfoInit(PDM_ODM_T pDM_Odm, ODM_CMNINFO_E CmnInfo, u32 Value); ++ ++void ODM_CmnInfoHook(PDM_ODM_T pDM_Odm, ODM_CMNINFO_E CmnInfo, void *pValue); ++ ++void ODM_CmnInfoPtrArrayHook( ++ PDM_ODM_T pDM_Odm, ++ ODM_CMNINFO_E CmnInfo, ++ u16 Index, ++ void *pValue +); + -+void -+ODM_DMWatchdog( -+ PDM_ODM_T pDM_Odm /* For common use in the future */ -+ ); ++void ODM_CmnInfoUpdate(PDM_ODM_T pDM_Odm, u32 CmnInfo, u64 Value); + -+void -+ODM_CmnInfoInit( -+ PDM_ODM_T pDM_Odm, -+ ODM_CMNINFO_E CmnInfo, -+ u32 Value -+ ); ++void ODM_InitAllTimers(PDM_ODM_T pDM_Odm); + -+void -+ODM_CmnInfoHook( -+ PDM_ODM_T pDM_Odm, -+ ODM_CMNINFO_E CmnInfo, -+ void * pValue -+ ); ++void ODM_CancelAllTimers(PDM_ODM_T pDM_Odm); + -+void -+ODM_CmnInfoPtrArrayHook( -+ PDM_ODM_T pDM_Odm, -+ ODM_CMNINFO_E CmnInfo, -+ u16 Index, -+ void * pValue -+ ); ++void ODM_ReleaseAllTimers(PDM_ODM_T pDM_Odm); + -+void -+ODM_CmnInfoUpdate( -+ PDM_ODM_T pDM_Odm, -+ u32 CmnInfo, -+ u64 Value -+ ); -+ -+void -+ODM_InitAllTimers( -+ PDM_ODM_T pDM_Odm -+ ); -+ -+void -+ODM_CancelAllTimers( -+ PDM_ODM_T pDM_Odm -+ ); -+ -+void -+ODM_ReleaseAllTimers( -+ PDM_ODM_T pDM_Odm -+ ); -+ -+void -+ODM_AntselStatistics_88C( -+ PDM_ODM_T pDM_Odm, -+ u8 MacId, -+ u32 PWDBAll, -+ bool isCCKrate ++void ODM_AntselStatistics_88C( ++ PDM_ODM_T pDM_Odm, ++ u8 MacId, ++ u32 PWDBAll, ++ bool isCCKrate +); + -+void -+ODM_DynamicARFBSelect( -+ PDM_ODM_T pDM_Odm, -+ u8 rate, -+ bool Collision_State -+ ); ++void ODM_DynamicARFBSelect(PDM_ODM_T pDM_Odm, u8 rate, bool Collision_State); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_HWConfig.c ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_HWConfig.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,608 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux/3rdparty/rtl8723bs/hal/odm_HWConfig.c +--- linux.old/3rdparty/rtl8723bs/hal/odm_HWConfig.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_HWConfig.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,535 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -62025,88 +60428,52 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 + +#define READ_AND_CONFIG_MP(ic, txt) (ODM_ReadAndConfig_MP_##ic##txt(pDM_Odm)) +#define READ_AND_CONFIG READ_AND_CONFIG_MP -+#define GET_VERSION_MP(ic, txt) (ODM_GetVersion_MP_##ic##txt()) ++#define GET_VERSION_MP(ic, txt) (ODM_GetVersion_MP_##ic##txt()) +#define GET_VERSION(ic, txt) (pDM_Odm->bIsMPChip?GET_VERSION_MP(ic, txt):GET_VERSION_TC(ic, txt)) + -+static u8 -+odm_QueryRxPwrPercentage( -+ s8 AntPower -+ ) ++static u8 odm_QueryRxPwrPercentage(s8 AntPower) +{ + if ((AntPower <= -100) || (AntPower >= 20)) -+ { + return 0; -+ } + else if (AntPower >= 0) -+ { + return 100; -+ } + else -+ { + return (100+AntPower); -+ } + +} + -+static s32 -+odm_SignalScaleMapping_92CSeries( -+ PDM_ODM_T pDM_Odm, -+ s32 CurrSig -+) ++static s32 odm_SignalScaleMapping_92CSeries(PDM_ODM_T pDM_Odm, s32 CurrSig) +{ + s32 RetSig = 0; + -+ if (pDM_Odm->SupportInterface == ODM_ITRF_SDIO) -+ { ++ if (pDM_Odm->SupportInterface == ODM_ITRF_SDIO) { + if (CurrSig >= 51 && CurrSig <= 100) -+ { + RetSig = 100; -+ } + else if (CurrSig >= 41 && CurrSig <= 50) -+ { + RetSig = 80 + ((CurrSig - 40)*2); -+ } + else if (CurrSig >= 31 && CurrSig <= 40) -+ { + RetSig = 66 + (CurrSig - 30); -+ } + else if (CurrSig >= 21 && CurrSig <= 30) -+ { + RetSig = 54 + (CurrSig - 20); -+ } + else if (CurrSig >= 10 && CurrSig <= 20) -+ { + RetSig = 42 + (((CurrSig - 10) * 2) / 3); -+ } + else if (CurrSig >= 5 && CurrSig <= 9) -+ { + RetSig = 22 + (((CurrSig - 5) * 3) / 2); -+ } + else if (CurrSig >= 1 && CurrSig <= 4) -+ { + RetSig = 6 + (((CurrSig - 1) * 3) / 2); -+ } + else -+ { + RetSig = CurrSig; -+ } + } + + return RetSig; +} -+s32 -+odm_SignalScaleMapping( -+ PDM_ODM_T pDM_Odm, -+s32 CurrSig -+) ++ ++s32 odm_SignalScaleMapping(PDM_ODM_T pDM_Odm, s32 CurrSig) +{ + return odm_SignalScaleMapping_92CSeries(pDM_Odm, CurrSig); +} + -+static u8 -+odm_EVMdbToPercentage( -+ s8 Value -+ ) ++static u8 odm_EVMdbToPercentage(s8 Value) +{ + /* */ + /* -33dB~0dB to 0%~99% */ @@ -62125,33 +60492,32 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 + ret_val = -33; + + ret_val = 0 - ret_val; -+ ret_val*=3; ++ ret_val *= 3; + + if (ret_val == 99) + ret_val = 100; + -+ return(ret_val); ++ return ret_val; +} + -+static void -+odm_RxPhyStatus92CSeries_Parsing( -+ PDM_ODM_T pDM_Odm, -+ PODM_PHY_INFO_T pPhyInfo, -+ u8 * pPhyStatus, -+ PODM_PACKET_INFO_T pPktinfo -+ ) ++static void odm_RxPhyStatus92CSeries_Parsing( ++ PDM_ODM_T pDM_Odm, ++ PODM_PHY_INFO_T pPhyInfo, ++ u8 *pPhyStatus, ++ PODM_PACKET_INFO_T pPktinfo ++) +{ -+ u8 i, Max_spatial_stream; -+ s8 rx_pwr[4], rx_pwr_all = 0; -+ u8 EVM, PWDB_ALL = 0, PWDB_ALL_BT; -+ u8 RSSI, total_rssi = 0; -+ bool isCCKrate =false; -+ u8 rf_rx_num = 0; -+ u8 cck_highpwr = 0; -+ u8 LNA_idx, VGA_idx; ++ u8 i, Max_spatial_stream; ++ s8 rx_pwr[4], rx_pwr_all = 0; ++ u8 EVM, PWDB_ALL = 0, PWDB_ALL_BT; ++ u8 RSSI, total_rssi = 0; ++ bool isCCKrate = false; ++ u8 rf_rx_num = 0; ++ u8 cck_highpwr = 0; ++ u8 LNA_idx, VGA_idx; + PPHY_STATUS_RPT_8192CD_T pPhyStaRpt = (PPHY_STATUS_RPT_8192CD_T)pPhyStatus; + -+ isCCKrate = (pPktinfo->DataRate <= DESC_RATE11M)?true :false; ++ isCCKrate = (pPktinfo->DataRate <= DESC_RATE11M) ? true : false; + pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_A] = -1; + pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_B] = -1; + @@ -62168,18 +60534,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 + /* if (pHalData->eRFPowerState == eRfOn) */ + cck_highpwr = pDM_Odm->bCckHighPower; + /* else */ -+ /* cck_highpwr = false; */ ++ /* cck_highpwr = false; */ + + cck_agc_rpt = pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a ; + + /* 2011.11.28 LukeLee: 88E use different LNA & VGA gain table */ + /* The RSSI formula should be modified according to the gain table */ + /* In 88E, cck_highpwr is always set to 1 */ -+ LNA_idx = ((cck_agc_rpt & 0xE0) >>5); ++ LNA_idx = ((cck_agc_rpt & 0xE0)>>5); + VGA_idx = (cck_agc_rpt & 0x1F); + rx_pwr_all = odm_CCKRSSI_8723B(LNA_idx, VGA_idx); + PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all); -+ if (PWDB_ALL>100) ++ if (PWDB_ALL > 100) + PWDB_ALL = 100; + + pPhyInfo->RxPWDBAll = PWDB_ALL; @@ -62192,9 +60558,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 + { + u8 SQ, SQ_rpt; + -+ if (pPhyInfo->RxPWDBAll > 40 && !pDM_Odm->bInHctTest) { ++ if (pPhyInfo->RxPWDBAll > 40 && !pDM_Odm->bInHctTest) + SQ = 100; -+ } + else { + SQ_rpt = pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all; + @@ -62212,9 +60577,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 + pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_A] = SQ; + pPhyInfo->RxMIMOSignalQuality[ODM_RF_PATH_B] = -1; + } -+ } -+ else /* is OFDM rate */ -+ { ++ } else { /* is OFDM rate */ + pDM_Odm->PhyDbgInfo.NumQryPhyStatusOFDM++; + + /* */ @@ -62228,7 +60591,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 + /* else */ + /* continue; */ + -+ rx_pwr[i] = ((pPhyStaRpt->path_agc[i].gain& 0x3F)*2) - 110; ++ rx_pwr[i] = ((pPhyStaRpt->path_agc[i].gain&0x3F)*2) - 110; + + + pPhyInfo->RxPwr[i] = rx_pwr[i]; @@ -62238,7 +60601,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 + total_rssi += RSSI; + /* RT_DISP(FRX, RX_PHY_SS, ("RF-%d RXPWR =%x RSSI =%d\n", i, rx_pwr[i], RSSI)); */ + -+ pPhyInfo->RxMIMOSignalStrength[i] =(u8) RSSI; ++ pPhyInfo->RxMIMOSignalStrength[i] = (u8) RSSI; + + /* Get Rx snr value in DB */ + pPhyInfo->RxSNR[i] = pDM_Odm->PhyDbgInfo.RxSNRdB[i] = (s32)(pPhyStaRpt->path_rxsnr[i]/2); @@ -62248,7 +60611,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 + /* */ + /* (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive) */ + /* */ -+ rx_pwr_all = (((pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all) >> 1)& 0x7f) -110; ++ rx_pwr_all = (((pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all) >> 1)&0x7f)-110; + + PWDB_ALL_BT = PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all); + /* RT_DISP(FRX, RX_PHY_SS, ("PWDB_ALL =%d\n", PWDB_ALL)); */ @@ -62263,13 +60626,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 + /* */ + /* (3)EVM of HT rate */ + /* */ -+ if (pPktinfo->DataRate >=DESC_RATEMCS8 && pPktinfo->DataRate <=DESC_RATEMCS15) ++ if (pPktinfo->DataRate >= DESC_RATEMCS8 && pPktinfo->DataRate <= DESC_RATEMCS15) + Max_spatial_stream = 2; /* both spatial stream make sense */ + else + Max_spatial_stream = 1; /* only spatial stream 1 makes sense */ + -+ for (i = 0; i>= 1" because the compilor of free build environment */ + /* fill most significant bit to "zero" when doing shifting operation which may change a negative */ + /* value to positive one, then the dbm value (which is supposed to be negative) is not correct anymore. */ @@ -62280,10 +60642,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 + + /* if (pPktinfo->bPacketMatchBSSID) */ + { -+ if (i ==ODM_RF_PATH_A) /* Fill value in RFD, Get the first spatial stream only */ -+ { ++ if (i == ODM_RF_PATH_A) /* Fill value in RFD, Get the first spatial stream only */ + pPhyInfo->SignalQuality = (u8)(EVM & 0xff); -+ } ++ + pPhyInfo->RxMIMOSignalQuality[i] = (u8)(EVM & 0xff); + } + } @@ -62295,23 +60656,19 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 + + /* UI BSS List signal strength(in percentage), make it good looking, from 0~100. */ + /* It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp(). */ -+ if (isCCKrate) -+ { ++ if (isCCKrate) { +#ifdef CONFIG_SKIP_SIGNAL_SCALE_MAPPING + pPhyInfo->SignalStrength = (u8)PWDB_ALL; +#else + pPhyInfo->SignalStrength = (u8)(odm_SignalScaleMapping(pDM_Odm, PWDB_ALL));/* PWDB_ALL; */ +#endif -+ } -+ else -+ { -+ if (rf_rx_num != 0) -+ { ++ } else { ++ if (rf_rx_num != 0) { +#ifdef CONFIG_SKIP_SIGNAL_SCALE_MAPPING -+ total_rssi/=rf_rx_num; ++ total_rssi /= rf_rx_num; + pPhyInfo->SignalStrength = (u8)total_rssi; +#else -+ pPhyInfo->SignalStrength = (u8)(odm_SignalScaleMapping(pDM_Odm, total_rssi/=rf_rx_num)); ++ pPhyInfo->SignalStrength = (u8)(odm_SignalScaleMapping(pDM_Odm, total_rssi /= rf_rx_num)); +#endif + } + } @@ -62320,20 +60677,17 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 + /* isCCKrate, pPhyInfo->RxPWDBAll, pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a); */ +} + -+static void -+odm_Process_RSSIForDM( -+ PDM_ODM_T pDM_Odm, -+ PODM_PHY_INFO_T pPhyInfo, -+ PODM_PACKET_INFO_T pPktinfo -+ ) ++static void odm_Process_RSSIForDM( ++ PDM_ODM_T pDM_Odm, PODM_PHY_INFO_T pPhyInfo, PODM_PACKET_INFO_T pPktinfo ++) +{ + -+ s32 UndecoratedSmoothedPWDB, UndecoratedSmoothedCCK, UndecoratedSmoothedOFDM, RSSI_Ave; -+ u8 isCCKrate = 0; -+ u8 RSSI_max, RSSI_min, i; -+ u32 OFDM_pkt = 0; -+ u32 Weighting = 0; -+ PSTA_INFO_T pEntry; ++ s32 UndecoratedSmoothedPWDB, UndecoratedSmoothedCCK, UndecoratedSmoothedOFDM, RSSI_Ave; ++ u8 isCCKrate = 0; ++ u8 RSSI_max, RSSI_min, i; ++ u32 OFDM_pkt = 0; ++ u32 Weighting = 0; ++ PSTA_INFO_T pEntry; + + + if (pPktinfo->StationID == 0xFF) @@ -62341,13 +60695,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 + + pEntry = pDM_Odm->pODM_StaInfo[pPktinfo->StationID]; + -+ if (!IS_STA_VALID(pEntry)) { ++ if (!IS_STA_VALID(pEntry)) + return; -+ } ++ + if ((!pPktinfo->bPacketMatchBSSID)) -+ { + return; -+ } + + if (pPktinfo->bPacketBeacon) + pDM_Odm->PhyDbgInfo.NumQryBeaconPkt++; @@ -62356,48 +60708,45 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 + pDM_Odm->RxRate = pPktinfo->DataRate; + + /* Statistic for antenna/path diversity------------------ */ -+ if (pDM_Odm->SupportAbility & ODM_BB_ANT_DIV) -+ { ++ if (pDM_Odm->SupportAbility & ODM_BB_ANT_DIV) { ++ + } + + /* Smart Antenna Debug Message------------------ */ + -+ UndecoratedSmoothedCCK = pEntry->rssi_stat.UndecoratedSmoothedCCK; ++ UndecoratedSmoothedCCK = pEntry->rssi_stat.UndecoratedSmoothedCCK; + UndecoratedSmoothedOFDM = pEntry->rssi_stat.UndecoratedSmoothedOFDM; + UndecoratedSmoothedPWDB = pEntry->rssi_stat.UndecoratedSmoothedPWDB; + -+ if (pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon) -+ { ++ if (pPktinfo->bPacketToSelf || pPktinfo->bPacketBeacon) { + -+ if (!isCCKrate)/* ofdm rate */ -+ { ++ if (!isCCKrate) { /* ofdm rate */ + if (pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B] == 0) { + RSSI_Ave = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; + pDM_Odm->RSSI_A = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; + pDM_Odm->RSSI_B = 0; -+ } -+ else -+ { ++ } else { + /* DbgPrint("pRfd->Status.RxMIMOSignalStrength[0] = %d, pRfd->Status.RxMIMOSignalStrength[1] = %d\n", */ + /* pRfd->Status.RxMIMOSignalStrength[0], pRfd->Status.RxMIMOSignalStrength[1]); */ + pDM_Odm->RSSI_A = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; + pDM_Odm->RSSI_B = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B]; + -+ if (pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A] > pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B]) -+ { ++ if ( ++ pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A] > ++ pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B] ++ ) { + RSSI_max = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; + RSSI_min = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B]; -+ } -+ else -+ { ++ } else { + RSSI_max = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_B]; + RSSI_min = pPhyInfo->RxMIMOSignalStrength[ODM_RF_PATH_A]; + } -+ if ((RSSI_max -RSSI_min) < 3) ++ ++ if ((RSSI_max-RSSI_min) < 3) + RSSI_Ave = RSSI_max; -+ else if ((RSSI_max -RSSI_min) < 6) ++ else if ((RSSI_max-RSSI_min) < 6) + RSSI_Ave = RSSI_max - 1; -+ else if ((RSSI_max -RSSI_min) < 10) ++ else if ((RSSI_max-RSSI_min) < 10) + RSSI_Ave = RSSI_max - 2; + else + RSSI_Ave = RSSI_max - 3; @@ -62405,54 +60754,40 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 + + /* 1 Process OFDM RSSI */ + if (UndecoratedSmoothedOFDM <= 0) /* initialize */ -+ { + UndecoratedSmoothedOFDM = pPhyInfo->RxPWDBAll; -+ } -+ else -+ { -+ if (pPhyInfo->RxPWDBAll > (u32)UndecoratedSmoothedOFDM) -+ { ++ else { ++ if (pPhyInfo->RxPWDBAll > (u32)UndecoratedSmoothedOFDM) { + UndecoratedSmoothedOFDM = -+ (((UndecoratedSmoothedOFDM)*(Rx_Smooth_Factor-1)) + -+ (RSSI_Ave)) /(Rx_Smooth_Factor); ++ ((UndecoratedSmoothedOFDM*(Rx_Smooth_Factor-1)) + ++ RSSI_Ave)/Rx_Smooth_Factor; + UndecoratedSmoothedOFDM = UndecoratedSmoothedOFDM + 1; -+ } -+ else -+ { ++ } else { + UndecoratedSmoothedOFDM = -+ (((UndecoratedSmoothedOFDM)*(Rx_Smooth_Factor-1)) + -+ (RSSI_Ave)) /(Rx_Smooth_Factor); ++ ((UndecoratedSmoothedOFDM*(Rx_Smooth_Factor-1)) + ++ RSSI_Ave)/Rx_Smooth_Factor; + } + } + + pEntry->rssi_stat.PacketMap = (pEntry->rssi_stat.PacketMap<<1) | BIT0; + -+ } -+ else -+ { ++ } else { + RSSI_Ave = pPhyInfo->RxPWDBAll; + pDM_Odm->RSSI_A = (u8) pPhyInfo->RxPWDBAll; + pDM_Odm->RSSI_B = 0; + + /* 1 Process CCK RSSI */ + if (UndecoratedSmoothedCCK <= 0) /* initialize */ -+ { + UndecoratedSmoothedCCK = pPhyInfo->RxPWDBAll; -+ } -+ else -+ { -+ if (pPhyInfo->RxPWDBAll > (u32)UndecoratedSmoothedCCK) -+ { ++ else { ++ if (pPhyInfo->RxPWDBAll > (u32)UndecoratedSmoothedCCK) { + UndecoratedSmoothedCCK = -+ (((UndecoratedSmoothedCCK)*(Rx_Smooth_Factor-1)) + -+ (pPhyInfo->RxPWDBAll)) /(Rx_Smooth_Factor); ++ ((UndecoratedSmoothedCCK*(Rx_Smooth_Factor-1)) + ++ pPhyInfo->RxPWDBAll)/Rx_Smooth_Factor; + UndecoratedSmoothedCCK = UndecoratedSmoothedCCK + 1; -+ } -+ else -+ { ++ } else { + UndecoratedSmoothedCCK = -+ (((UndecoratedSmoothedCCK)*(Rx_Smooth_Factor-1)) + -+ (pPhyInfo->RxPWDBAll)) /(Rx_Smooth_Factor); ++ ((UndecoratedSmoothedCCK*(Rx_Smooth_Factor-1)) + ++ pPhyInfo->RxPWDBAll)/Rx_Smooth_Factor; + } + } + pEntry->rssi_stat.PacketMap = pEntry->rssi_stat.PacketMap<<1; @@ -62466,16 +60801,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 + else + pEntry->rssi_stat.ValidBit++; + -+ for (i = 0; irssi_stat.ValidBit; i++) ++ for (i = 0; i < pEntry->rssi_stat.ValidBit; i++) + OFDM_pkt += (u8)(pEntry->rssi_stat.PacketMap>>i)&BIT0; + -+ if (pEntry->rssi_stat.ValidBit == 64) -+ { ++ if (pEntry->rssi_stat.ValidBit == 64) { + Weighting = ((OFDM_pkt<<4) > 64)?64:(OFDM_pkt<<4); + UndecoratedSmoothedPWDB = (Weighting*UndecoratedSmoothedOFDM+(64-Weighting)*UndecoratedSmoothedCCK)>>6; -+ } -+ else -+ { ++ } else { + if (pEntry->rssi_stat.ValidBit != 0) + UndecoratedSmoothedPWDB = (OFDM_pkt*UndecoratedSmoothedOFDM+(pEntry->rssi_stat.ValidBit-OFDM_pkt)*UndecoratedSmoothedCCK)/pEntry->rssi_stat.ValidBit; + else @@ -62488,7 +60820,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 + + /* DbgPrint("OFDM_pkt =%d, Weighting =%d\n", OFDM_pkt, Weighting); */ + /* DbgPrint("UndecoratedSmoothedOFDM =%d, UndecoratedSmoothedPWDB =%d, UndecoratedSmoothedCCK =%d\n", */ -+ /* UndecoratedSmoothedOFDM, UndecoratedSmoothedPWDB, UndecoratedSmoothedCCK); */ ++ /* UndecoratedSmoothedOFDM, UndecoratedSmoothedPWDB, UndecoratedSmoothedCCK); */ + + } + @@ -62499,32 +60831,26 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 +/* */ +/* Endianness before calling this API */ +/* */ -+static void -+ODM_PhyStatusQuery_92CSeries( -+ PDM_ODM_T pDM_Odm, -+ PODM_PHY_INFO_T pPhyInfo, -+ u8 * pPhyStatus, -+ PODM_PACKET_INFO_T pPktinfo -+ ) ++static void ODM_PhyStatusQuery_92CSeries( ++ PDM_ODM_T pDM_Odm, ++ PODM_PHY_INFO_T pPhyInfo, ++ u8 *pPhyStatus, ++ PODM_PACKET_INFO_T pPktinfo ++) +{ + -+ odm_RxPhyStatus92CSeries_Parsing( -+ pDM_Odm, -+ pPhyInfo, -+ pPhyStatus, -+ pPktinfo); ++ odm_RxPhyStatus92CSeries_Parsing(pDM_Odm, pPhyInfo, pPhyStatus, pPktinfo); + + if (!pDM_Odm->RSSI_test) + odm_Process_RSSIForDM(pDM_Odm, pPhyInfo, pPktinfo); +} + -+void -+ODM_PhyStatusQuery( -+ PDM_ODM_T pDM_Odm, -+ PODM_PHY_INFO_T pPhyInfo, -+ u8 * pPhyStatus, -+ PODM_PACKET_INFO_T pPktinfo -+ ) ++void ODM_PhyStatusQuery( ++ PDM_ODM_T pDM_Odm, ++ PODM_PHY_INFO_T pPhyInfo, ++ u8 *pPhyStatus, ++ PODM_PACKET_INFO_T pPktinfo ++) +{ + + ODM_PhyStatusQuery_92CSeries(pDM_Odm, pPhyInfo, pPhyStatus, pPktinfo); @@ -62535,12 +60861,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 +/* */ +/* */ + -+HAL_STATUS -+ODM_ConfigRFWithHeaderFile( -+PDM_ODM_T pDM_Odm, -+ODM_RF_Config_Type ConfigType, -+ODM_RF_RADIO_PATH_E eRFPath -+ ) ++HAL_STATUS ODM_ConfigRFWithHeaderFile( ++ PDM_ODM_T pDM_Odm, ++ ODM_RF_Config_Type ConfigType, ++ ODM_RF_RADIO_PATH_E eRFPath ++) +{ + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, + ("===>ODM_ConfigRFWithHeaderFile (%s)\n", (pDM_Odm->bIsMPChip) ? "MPChip" : "TestChip")); @@ -62548,20 +60873,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 + ("pDM_Odm->SupportPlatform: 0x%X, pDM_Odm->SupportInterface: 0x%X, pDM_Odm->BoardType: 0x%X\n", + pDM_Odm->SupportPlatform, pDM_Odm->SupportInterface, pDM_Odm->BoardType)); + -+ if (ConfigType == CONFIG_RF_RADIO) { ++ if (ConfigType == CONFIG_RF_RADIO) + READ_AND_CONFIG(8723B, _RadioA); -+ } -+ else if (ConfigType == CONFIG_RF_TXPWR_LMT) { ++ else if (ConfigType == CONFIG_RF_TXPWR_LMT) + READ_AND_CONFIG(8723B, _TXPWR_LMT); -+ } + + return HAL_STATUS_SUCCESS; +} + -+HAL_STATUS -+ODM_ConfigRFWithTxPwrTrackHeaderFile( -+PDM_ODM_T pDM_Odm -+ ) ++HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(PDM_ODM_T pDM_Odm) +{ + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, + ("===>ODM_ConfigRFWithTxPwrTrackHeaderFile (%s)\n", (pDM_Odm->bIsMPChip) ? "MPChip" : "TestChip")); @@ -62575,11 +60895,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 + return HAL_STATUS_SUCCESS; +} + -+HAL_STATUS -+ODM_ConfigBBWithHeaderFile( -+PDM_ODM_T pDM_Odm, -+ODM_BB_Config_Type ConfigType -+ ) ++HAL_STATUS ODM_ConfigBBWithHeaderFile( ++ PDM_ODM_T pDM_Odm, ODM_BB_Config_Type ConfigType ++) +{ + ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, + ("===>ODM_ConfigBBWithHeaderFile (%s)\n", (pDM_Odm->bIsMPChip) ? "MPChip" : "TestChip")); @@ -62597,27 +60915,39 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.c linux-4.3-rtl8723bs/3 + return HAL_STATUS_SUCCESS; +} + -+HAL_STATUS -+ODM_ConfigMACWithHeaderFile( -+PDM_ODM_T pDM_Odm -+ ) ++HAL_STATUS ODM_ConfigMACWithHeaderFile(PDM_ODM_T pDM_Odm) +{ + u8 result = HAL_STATUS_SUCCESS; + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, -+ ("===>ODM_ConfigMACWithHeaderFile (%s)\n", (pDM_Odm->bIsMPChip) ? "MPChip" : "TestChip")); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, -+ ("pDM_Odm->SupportPlatform: 0x%X, pDM_Odm->SupportInterface: 0x%X, pDM_Odm->BoardType: 0x%X\n", -+ pDM_Odm->SupportPlatform, pDM_Odm->SupportInterface, pDM_Odm->BoardType)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_LOUD, ++ ( ++ "===>ODM_ConfigMACWithHeaderFile (%s)\n", ++ (pDM_Odm->bIsMPChip) ? "MPChip" : "TestChip" ++ ) ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_LOUD, ++ ( ++ "pDM_Odm->SupportPlatform: 0x%X, pDM_Odm->SupportInterface: 0x%X, pDM_Odm->BoardType: 0x%X\n", ++ pDM_Odm->SupportPlatform, ++ pDM_Odm->SupportInterface, ++ pDM_Odm->BoardType ++ ) ++ ); + + READ_AND_CONFIG(8723B, _MAC_REG); + + return result; +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_HWConfig.h ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_HWConfig.h 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,179 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_HWConfig.h linux/3rdparty/rtl8723bs/hal/odm_HWConfig.h +--- linux.old/3rdparty/rtl8723bs/hal/odm_HWConfig.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_HWConfig.h 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,162 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -62634,40 +60964,39 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.h linux-4.3-rtl8723bs/3 + ******************************************************************************/ + + -+#ifndef __HALHWOUTSRC_H__ ++#ifndef __HALHWOUTSRC_H__ +#define __HALHWOUTSRC_H__ + + +/*--------------------------Define -------------------------------------------*/ +/* define READ_NEXT_PAIR(v1, v2, i) do { i += 2; v1 = Array[i]; v2 = Array[i+1]; } while (0) */ +#define AGC_DIFF_CONFIG_MP(ic, band) (ODM_ReadAndConfig_MP_##ic##_AGC_TAB_DIFF(pDM_Odm, Array_MP_##ic##_AGC_TAB_DIFF_##band, \ -+ sizeof(Array_MP_##ic##_AGC_TAB_DIFF_##band)/sizeof(u32))) ++ sizeof(Array_MP_##ic##_AGC_TAB_DIFF_##band)/sizeof(u32))) +#define AGC_DIFF_CONFIG_TC(ic, band) (ODM_ReadAndConfig_TC_##ic##_AGC_TAB_DIFF(pDM_Odm, Array_TC_##ic##_AGC_TAB_DIFF_##band, \ -+ sizeof(Array_TC_##ic##_AGC_TAB_DIFF_##band)/sizeof(u32))) ++ sizeof(Array_TC_##ic##_AGC_TAB_DIFF_##band)/sizeof(u32))) + -+#define AGC_DIFF_CONFIG(ic, band) do {\ -+ if (pDM_Odm->bIsMPChip)\ -+ AGC_DIFF_CONFIG_MP(ic, band);\ -+ else\ -+ AGC_DIFF_CONFIG_TC(ic, band);\ -+ } while (0) ++#define AGC_DIFF_CONFIG(ic, band)\ ++ do {\ ++ if (pDM_Odm->bIsMPChip)\ ++ AGC_DIFF_CONFIG_MP(ic, band);\ ++ else\ ++ AGC_DIFF_CONFIG_TC(ic, band);\ ++ } while (0) + + +/* */ +/* structure and define */ +/* */ + -+typedef struct _Phy_Rx_AGC_Info -+{ ++typedef struct _Phy_Rx_AGC_Info { + #if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE) + u8 gain:7, trsw:1; + #else + u8 trsw:1, gain:7; + #endif -+} PHY_RX_AGC_INFO_T,*pPHY_RX_AGC_INFO_T; ++} PHY_RX_AGC_INFO_T, *pPHY_RX_AGC_INFO_T; + -+typedef struct _Phy_Status_Rpt_8192cd -+{ ++typedef struct _Phy_Status_Rpt_8192cd { + PHY_RX_AGC_INFO_T path_agc[2]; + u8 ch_corr[2]; + u8 cck_sig_qual_ofdm_pwdb_all; @@ -62675,9 +61004,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.h linux-4.3-rtl8723bs/3 + u8 cck_rpt_b_ofdm_cfosho_b; + u8 rsvd_1;/* ch_corr_msb; */ + u8 noise_power_db_msb; -+ s8 path_cfotail[2]; ++ s8 path_cfotail[2]; + u8 pcts_mask[2]; -+ s8 stream_rxevm[2]; ++ s8 stream_rxevm[2]; + u8 path_rxsnr[2]; + u8 noise_power_db_lsb; + u8 rsvd_2[3]; @@ -62703,104 +61032,88 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_HWConfig.h linux-4.3-rtl8723bs/3 + u8 sgi_en:1; + u8 antsel_rx_keep_2:1; /* ex_intf_flg:1; */ +#endif -+} PHY_STATUS_RPT_8192CD_T,*PPHY_STATUS_RPT_8192CD_T; ++} PHY_STATUS_RPT_8192CD_T, *PPHY_STATUS_RPT_8192CD_T; + + -+typedef struct _Phy_Status_Rpt_8812 -+{ ++typedef struct _Phy_Status_Rpt_8812 { + /* 2012.05.24 LukeLee: This structure should take big/little endian in consideration later..... */ + + /* DWORD 0 */ -+ u8 gain_trsw[2]; ++ u8 gain_trsw[2]; +#if (ODM_ENDIAN_TYPE == ODM_ENDIAN_LITTLE) -+ u16 chl_num:10; -+ u16 sub_chnl:4; -+ u16 r_RFMOD:2; ++ u16 chl_num:10; ++ u16 sub_chnl:4; ++ u16 r_RFMOD:2; +#else /* _BIG_ENDIAN_ */ -+ u16 r_RFMOD:2; -+ u16 sub_chnl:4; -+ u16 chl_num:10; ++ u16 r_RFMOD:2; ++ u16 sub_chnl:4; ++ u16 chl_num:10; +#endif + + /* DWORD 1 */ -+ u8 pwdb_all; -+ u8 cfosho[4]; /* DW 1 byte 1 DW 2 byte 0 */ ++ u8 pwdb_all; ++ u8 cfosho[4]; /* DW 1 byte 1 DW 2 byte 0 */ + + /* DWORD 2 */ -+ s8 cfotail[4]; /* DW 2 byte 1 DW 3 byte 0 */ ++ s8 cfotail[4]; /* DW 2 byte 1 DW 3 byte 0 */ + + /* DWORD 3 */ -+ s8 rxevm[2]; /* DW 3 byte 1 DW 3 byte 2 */ -+ s8 rxsnr[2]; /* DW 3 byte 3 DW 4 byte 0 */ ++ s8 rxevm[2]; /* DW 3 byte 1 DW 3 byte 2 */ ++ s8 rxsnr[2]; /* DW 3 byte 3 DW 4 byte 0 */ + + /* DWORD 4 */ -+ u8 PCTS_MSK_RPT[2]; -+ u8 pdsnr[2]; /* DW 4 byte 3 DW 5 Byte 0 */ ++ u8 PCTS_MSK_RPT[2]; ++ u8 pdsnr[2]; /* DW 4 byte 3 DW 5 Byte 0 */ + + /* DWORD 5 */ -+ u8 csi_current[2]; -+ u8 rx_gain_c; ++ u8 csi_current[2]; ++ u8 rx_gain_c; + + /* DWORD 6 */ -+ u8 rx_gain_d; -+ s8 sigevm; -+ u8 resvd_0; -+ u8 antidx_anta:3; -+ u8 antidx_antb:3; -+ u8 resvd_1:2; -+} PHY_STATUS_RPT_8812_T,*PPHY_STATUS_RPT_8812_T; ++ u8 rx_gain_d; ++ s8 sigevm; ++ u8 resvd_0; ++ u8 antidx_anta:3; ++ u8 antidx_antb:3; ++ u8 resvd_1:2; ++} PHY_STATUS_RPT_8812_T, *PPHY_STATUS_RPT_8812_T; + + -+void -+ODM_PhyStatusQuery( -+ PDM_ODM_T pDM_Odm, -+ PODM_PHY_INFO_T pPhyInfo, -+ u8 * pPhyStatus, -+ PODM_PACKET_INFO_T pPktinfo -+ ); -+ -+HAL_STATUS -+ODM_ConfigRFWithTxPwrTrackHeaderFile( -+PDM_ODM_T pDM_Odm -+ ); -+ -+HAL_STATUS -+ODM_ConfigRFWithHeaderFile( -+PDM_ODM_T pDM_Odm, -+ODM_RF_Config_Type ConfigType, -+ODM_RF_RADIO_PATH_E eRFPath -+ ); -+ -+HAL_STATUS -+ODM_ConfigBBWithHeaderFile( -+PDM_ODM_T pDM_Odm, -+ODM_BB_Config_Type ConfigType -+ ); -+ -+HAL_STATUS -+ODM_ConfigMACWithHeaderFile( -+PDM_ODM_T pDM_Odm -+ ); -+ -+HAL_STATUS -+ODM_ConfigFWWithHeaderFile( -+PDM_ODM_T pDM_Odm, -+ODM_FW_Config_Type ConfigType, -+ u8 *pFirmware, -+ u32 *pSize -+ ); -+ -+s32 -+odm_SignalScaleMapping( ++void ODM_PhyStatusQuery( + PDM_ODM_T pDM_Odm, -+s32 CurrSig -+ ); ++ PODM_PHY_INFO_T pPhyInfo, ++ u8 *pPhyStatus, ++ PODM_PACKET_INFO_T pPktinfo ++); ++ ++HAL_STATUS ODM_ConfigRFWithTxPwrTrackHeaderFile(PDM_ODM_T pDM_Odm); ++ ++HAL_STATUS ODM_ConfigRFWithHeaderFile( ++ PDM_ODM_T pDM_Odm, ++ ODM_RF_Config_Type ConfigType, ++ ODM_RF_RADIO_PATH_E eRFPath ++); ++ ++HAL_STATUS ODM_ConfigBBWithHeaderFile( ++ PDM_ODM_T pDM_Odm, ODM_BB_Config_Type ConfigType ++); ++ ++HAL_STATUS ODM_ConfigMACWithHeaderFile(PDM_ODM_T pDM_Odm); ++ ++HAL_STATUS ODM_ConfigFWWithHeaderFile( ++ PDM_ODM_T pDM_Odm, ++ ODM_FW_Config_Type ConfigType, ++ u8 *pFirmware, ++ u32 *pSize ++); ++ ++s32 odm_SignalScaleMapping(PDM_ODM_T pDM_Odm, s32 CurrSig); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_interface.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_interface.h ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_interface.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_interface.h 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,60 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_interface.h linux/3rdparty/rtl8723bs/hal/odm_interface.h +--- linux.old/3rdparty/rtl8723bs/hal/odm_interface.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_interface.h 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,59 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -62850,21 +61163,20 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_interface.h linux-4.3-rtl8723bs/ +#define ODM_REG(_name, _pDM_Odm) _cat(_name, _pDM_Odm->SupportICType, _reg) +#define ODM_BIT(_name, _pDM_Odm) _cat(_name, _pDM_Odm->SupportICType, _bit) + -+typedef enum _ODM_H2C_CMD -+{ ++typedef enum _ODM_H2C_CMD { + ODM_H2C_RSSI_REPORT = 0, + ODM_H2C_PSD_RESULT = 1, + ODM_H2C_PathDiv = 2, + ODM_H2C_WIFI_CALIBRATION = 3, + ODM_MAX_H2CCMD -+}ODM_H2C_CMD; ++} ODM_H2C_CMD; + + +#endif /* __ODM_INTERFACE_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.c ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,172 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.c linux/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.c +--- linux.old/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,175 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -62887,24 +61199,29 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.c linux-4.3-rtl8723 +/* 1. disable DIG and Power Saving */ +/* 2. Set initial gain = 0x1a */ +/* 3. Stop updating idle time pwer report (for driver read) */ -+/* - 0x80c[25] */ ++/* - 0x80c[25] */ + +#define Valid_Min -35 +#define Valid_Max 10 +#define ValidCnt 5 + -+static s16 odm_InbandNoise_Monitor_NSeries(PDM_ODM_T pDM_Odm, u8 bPauseDIG, u8 IGIValue, u32 max_time) ++static s16 odm_InbandNoise_Monitor_NSeries( ++ PDM_ODM_T pDM_Odm, ++ u8 bPauseDIG, ++ u8 IGIValue, ++ u32 max_time ++) +{ -+ u32 tmp4b; -+ u8 max_rf_path = 0, rf_path; -+ u8 reg_c50, reg_c58, valid_done = 0; -+ struct noise_level noise_data; -+ u32 start = 0, func_start = 0, func_end = 0; ++ u32 tmp4b; ++ u8 max_rf_path = 0, rf_path; ++ u8 reg_c50, reg_c58, valid_done = 0; ++ struct noise_level noise_data; ++ u32 start = 0, func_start = 0, func_end = 0; + + func_start = jiffies; + pDM_Odm->noise_level.noise_all = 0; + -+ if ((pDM_Odm->RFType == ODM_1T2R) ||(pDM_Odm->RFType == ODM_2T2R)) ++ if ((pDM_Odm->RFType == ODM_1T2R) || (pDM_Odm->RFType == ODM_2T2R)) + max_rf_path = 2; + else + max_rf_path = 1; @@ -62918,9 +61235,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.c linux-4.3-rtl8723 + /* */ + + if (bPauseDIG) -+ { + odm_PauseDIG(pDM_Odm, ODM_PAUSE_DIG, IGIValue); -+ } + /* */ + /* Step 2. Disable all power save for read registers */ + /* */ @@ -62930,8 +61245,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.c linux-4.3-rtl8723 + /* Step 3. Get noise power level */ + /* */ + start = jiffies; -+ while (1) -+ { ++ while (1) { + + /* Stop updating idle time pwer report (for driver read) */ + PHY_SetBBReg(pDM_Odm->Adapter, rFPGA0_TxGainStage, BIT25, 1); @@ -62942,7 +61256,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.c linux-4.3-rtl8723 + + /* PHY_SetBBReg(pDM_Odm->Adapter, rOFDM0_XAAGCCore1, bMaskByte0, TestInitialGain); */ + /* if (max_rf_path == 2) */ -+ /* PHY_SetBBReg(pDM_Odm->Adapter, rOFDM0_XBAGCCore1, bMaskByte0, TestInitialGain); */ ++ /* PHY_SetBBReg(pDM_Odm->Adapter, rOFDM0_XBAGCCore1, bMaskByte0, TestInitialGain); */ + + /* update idle time pwer report per 5us */ + PHY_SetBBReg(pDM_Odm->Adapter, rFPGA0_TxGainStage, BIT25, 0); @@ -62953,11 +61267,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.c linux-4.3-rtl8723 + ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("value_a = 0x%x(%d), value_b = 0x%x(%d)\n", + noise_data.value[ODM_RF_PATH_A], noise_data.value[ODM_RF_PATH_A], noise_data.value[ODM_RF_PATH_B], noise_data.value[ODM_RF_PATH_B])); + -+ for (rf_path = ODM_RF_PATH_A; rf_path < max_rf_path; rf_path++) -+ { ++ for (rf_path = ODM_RF_PATH_A; rf_path < max_rf_path; rf_path++) { + noise_data.sval[rf_path] = (s8)noise_data.value[rf_path]; + noise_data.sval[rf_path] /= 2; -+ } ++ } + + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("sval_a = %d, sval_b = %d\n", @@ -62965,16 +61278,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.c linux-4.3-rtl8723 + /* mdelay(10); */ + /* msleep(10); */ + -+ for (rf_path = ODM_RF_PATH_A; rf_path < max_rf_path; rf_path++) -+ { -+ if ((noise_data.valid_cnt[rf_path] < ValidCnt) && (noise_data.sval[rf_path] < Valid_Max && noise_data.sval[rf_path] >= Valid_Min)) -+ { ++ for (rf_path = ODM_RF_PATH_A; rf_path < max_rf_path; rf_path++) { ++ if ((noise_data.valid_cnt[rf_path] < ValidCnt) && (noise_data.sval[rf_path] < Valid_Max && noise_data.sval[rf_path] >= Valid_Min)) { + noise_data.valid_cnt[rf_path]++; + noise_data.sum[rf_path] += noise_data.sval[rf_path]; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("RF_Path:%d Valid sval = %d\n", rf_path, noise_data.sval[rf_path])); + ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("Sum of sval = %d,\n", noise_data.sum[rf_path])); -+ if (noise_data.valid_cnt[rf_path] == ValidCnt) -+ { ++ if (noise_data.valid_cnt[rf_path] == ValidCnt) { + valid_done++; + ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("After divided, RF_Path:%d , sum = %d\n", rf_path, noise_data.sum[rf_path])); + } @@ -62984,10 +61294,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.c linux-4.3-rtl8723 + } + + /* printk("####### valid_done:%d #############\n", valid_done); */ -+ if ((valid_done ==max_rf_path) || (jiffies_to_msecs(jiffies - start) > max_time)) -+ { -+ for (rf_path = ODM_RF_PATH_A; rf_path < max_rf_path; rf_path++) -+ { ++ if ((valid_done == max_rf_path) || (jiffies_to_msecs(jiffies - start) > max_time)) { ++ for (rf_path = ODM_RF_PATH_A; rf_path < max_rf_path; rf_path++) { + /* printk("%s PATH_%d - sum = %d, valid_cnt = %d\n", __func__, rf_path, noise_data.sum[rf_path], noise_data.valid_cnt[rf_path]); */ + if (noise_data.valid_cnt[rf_path]) + noise_data.sum[rf_path] /= noise_data.valid_cnt[rf_path]; @@ -63012,35 +61320,42 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.c linux-4.3-rtl8723 + } + pDM_Odm->noise_level.noise_all /= max_rf_path; + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("noise_a = %d, noise_b = %d\n", -+ pDM_Odm->noise_level.noise[ODM_RF_PATH_A], -+ pDM_Odm->noise_level.noise[ODM_RF_PATH_B])); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_COMMON, ++ ODM_DBG_LOUD, ++ ( ++ "noise_a = %d, noise_b = %d\n", ++ pDM_Odm->noise_level.noise[ODM_RF_PATH_A], ++ pDM_Odm->noise_level.noise[ODM_RF_PATH_B] ++ ) ++ ); + + /* */ + /* Step 4. Recover the Dig */ + /* */ + if (bPauseDIG) -+ { + odm_PauseDIG(pDM_Odm, ODM_RESUME_DIG, IGIValue); -+ } -+ func_end = jiffies_to_msecs(jiffies - func_start) ; ++ ++ func_end = jiffies_to_msecs(jiffies - func_start); + /* printk("%s noise_a = %d, noise_b = %d noise_all:%d (%d ms)\n", __func__, */ -+ /* pDM_Odm->noise_level.noise[ODM_RF_PATH_A], */ -+ /* pDM_Odm->noise_level.noise[ODM_RF_PATH_B], */ -+ /* pDM_Odm->noise_level.noise_all, func_end); */ ++ /* pDM_Odm->noise_level.noise[ODM_RF_PATH_A], */ ++ /* pDM_Odm->noise_level.noise[ODM_RF_PATH_B], */ ++ /* pDM_Odm->noise_level.noise_all, func_end); */ + + ODM_RT_TRACE(pDM_Odm, ODM_COMP_COMMON, ODM_DBG_LOUD, ("odm_DebugControlInbandNoise_Nseries() <==\n")); + return pDM_Odm->noise_level.noise_all; + +} ++ +s16 ODM_InbandNoise_Monitor(void *pDM_VOID, u8 bPauseDIG, u8 IGIValue, u32 max_time) +{ + return odm_InbandNoise_Monitor_NSeries(pDM_VOID, bPauseDIG, IGIValue, max_time); +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.h ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.h 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,44 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.h linux/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.h +--- linux.old/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.h 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,47 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -63059,36 +61374,39 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_NoiseMonitor.h linux-4.3-rtl8723 +#define __ODMNOISEMONITOR_H__ + +#define ODM_MAX_CHANNEL_NUM 38/* 14+24 */ -+struct noise_level -+{ -+ /* u8 value_a, value_b; */ -+ u8 value[MAX_RF_PATH]; -+ /* s8 sval_a, sval_b; */ -+ s8 sval[MAX_RF_PATH]; ++struct noise_level { ++ /* u8 value_a, value_b; */ ++ u8 value[MAX_RF_PATH]; ++ /* s8 sval_a, sval_b; */ ++ s8 sval[MAX_RF_PATH]; + -+ /* s32 noise_a = 0, noise_b = 0, sum_a = 0, sum_b = 0; */ -+ /* s32 noise[ODM_RF_PATH_MAX]; */ -+ s32 sum[MAX_RF_PATH]; -+ /* u8 valid_cnt_a = 0, valid_cnt_b = 0, */ -+ u8 valid[MAX_RF_PATH]; -+ u8 valid_cnt[MAX_RF_PATH]; ++ /* s32 noise_a = 0, noise_b = 0, sum_a = 0, sum_b = 0; */ ++ /* s32 noise[ODM_RF_PATH_MAX]; */ ++ s32 sum[MAX_RF_PATH]; ++ /* u8 valid_cnt_a = 0, valid_cnt_b = 0, */ ++ u8 valid[MAX_RF_PATH]; ++ u8 valid_cnt[MAX_RF_PATH]; + +}; + + -+typedef struct _ODM_NOISE_MONITOR_ -+{ -+ s8 noise[MAX_RF_PATH]; -+ s16 noise_all; -+}ODM_NOISE_MONITOR; ++typedef struct _ODM_NOISE_MONITOR_ { ++ s8 noise[MAX_RF_PATH]; ++ s16 noise_all; ++} ODM_NOISE_MONITOR; + -+s16 ODM_InbandNoise_Monitor(void *pDM_VOID, u8 bPauseDIG, u8 IGIValue, u32 max_time); ++s16 ODM_InbandNoise_Monitor( ++ void *pDM_VOID, ++ u8 bPauseDIG, ++ u8 IGIValue, ++ u32 max_time ++); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_PathDiv.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_PathDiv.c ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_PathDiv.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_PathDiv.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,34 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_PathDiv.c linux/3rdparty/rtl8723bs/hal/odm_PathDiv.c +--- linux.old/3rdparty/rtl8723bs/hal/odm_PathDiv.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_PathDiv.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,42 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -63108,24 +61426,32 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_PathDiv.c linux-4.3-rtl8723bs/3r + +void odm_PathDiversityInit(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + if (!(pDM_Odm->SupportAbility & ODM_BB_PATH_DIV)) -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, -+ ("Return: Not Support PathDiv\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_PATH_DIV, ++ ODM_DBG_LOUD, ++ ("Return: Not Support PathDiv\n") ++ ); +} + +void odm_PathDiversity(void *pDM_VOID) +{ -+ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; ++ PDM_ODM_T pDM_Odm = (PDM_ODM_T)pDM_VOID; + + if (!(pDM_Odm->SupportAbility & ODM_BB_PATH_DIV)) -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_PATH_DIV, ODM_DBG_LOUD, -+ ("Return: Not Support PathDiv\n")); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_PATH_DIV, ++ ODM_DBG_LOUD, ++ ("Return: Not Support PathDiv\n") ++ ); +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_PathDiv.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_PathDiv.h ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_PathDiv.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_PathDiv.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_PathDiv.h linux/3rdparty/rtl8723bs/hal/odm_PathDiv.h +--- linux.old/3rdparty/rtl8723bs/hal/odm_PathDiv.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_PathDiv.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,29 @@ +/****************************************************************************** + * @@ -63156,9 +61482,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_PathDiv.h linux-4.3-rtl8723bs/3r + ); + + #endif /* ifndef __ODMPATHDIV_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_precomp.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_precomp.h ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_precomp.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_precomp.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_precomp.h linux/3rdparty/rtl8723bs/hal/odm_precomp.h +--- linux.old/3rdparty/rtl8723bs/hal/odm_precomp.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_precomp.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,60 @@ +/****************************************************************************** + * @@ -63220,10 +61546,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_precomp.h linux-4.3-rtl8723bs/3r +#include "odm_RegConfig8723B.h" + +#endif /* __ODM_PRECOMP_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_RegConfig8723B.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_RegConfig8723B.c ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_RegConfig8723B.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_RegConfig8723B.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,189 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_RegConfig8723B.c linux/3rdparty/rtl8723bs/hal/odm_RegConfig8723B.c +--- linux.old/3rdparty/rtl8723bs/hal/odm_RegConfig8723B.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_RegConfig8723B.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,257 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -63241,65 +61567,98 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_RegConfig8723B.c linux-4.3-rtl87 + +#include "odm_precomp.h" + -+void -+odm_ConfigRFReg_8723B( -+PDM_ODM_T pDM_Odm, -+u32 Addr, -+u32 Data, -+ ODM_RF_RADIO_PATH_E RF_PATH, -+u32 RegAddr -+ ) ++void odm_ConfigRFReg_8723B( ++ PDM_ODM_T pDM_Odm, ++ u32 Addr, ++ u32 Data, ++ ODM_RF_RADIO_PATH_E RF_PATH, ++ u32 RegAddr ++) +{ -+ if (Addr == 0xfe || Addr == 0xffe) -+ { ++ if (Addr == 0xfe || Addr == 0xffe) + msleep(50); -+ } -+ else -+ { ++ else { + PHY_SetRFReg(pDM_Odm->Adapter, RF_PATH, RegAddr, bRFRegOffsetMask, Data); + /* Add 1us delay between BB/RF register setting. */ + udelay(1); + + /* For disable/enable test in high temperature, the B6 value will fail to fill. Suggestion by BB Stanley, 2013.06.25. */ -+ if (Addr == 0xb6) -+ { ++ if (Addr == 0xb6) { + u32 getvalue = 0; + u8 count = 0; -+ getvalue = PHY_QueryRFReg(pDM_Odm->Adapter, RF_PATH, Addr, bMaskDWord); ++ ++ getvalue = PHY_QueryRFReg( ++ pDM_Odm->Adapter, RF_PATH, Addr, bMaskDWord ++ ); + + udelay(1); + -+ while ((getvalue>>8)!=(Data>>8)) -+ { ++ while ((getvalue>>8) != (Data>>8)) { + count++; + PHY_SetRFReg(pDM_Odm->Adapter, RF_PATH, RegAddr, bRFRegOffsetMask, Data); + udelay(1); + getvalue = PHY_QueryRFReg(pDM_Odm->Adapter, RF_PATH, Addr, bMaskDWord); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigRFWithHeaderFile: [B6] getvalue 0x%x, Data 0x%x, count %d\n", getvalue, Data, count)); -+ if (count>5) ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_TRACE, ++ ( ++ "===> ODM_ConfigRFWithHeaderFile: [B6] getvalue 0x%x, Data 0x%x, count %d\n", ++ getvalue, ++ Data, ++ count ++ ) ++ ); ++ if (count > 5) + break; + } + } + -+ if (Addr == 0xb2) -+ { ++ if (Addr == 0xb2) { + u32 getvalue = 0; + u8 count = 0; -+ getvalue = PHY_QueryRFReg(pDM_Odm->Adapter, RF_PATH, Addr, bMaskDWord); ++ ++ getvalue = PHY_QueryRFReg( ++ pDM_Odm->Adapter, RF_PATH, Addr, bMaskDWord ++ ); + + udelay(1); + -+ while (getvalue!=Data) -+ { ++ while (getvalue != Data) { + count++; -+ PHY_SetRFReg(pDM_Odm->Adapter, RF_PATH, RegAddr, bRFRegOffsetMask, Data); ++ PHY_SetRFReg( ++ pDM_Odm->Adapter, ++ RF_PATH, ++ RegAddr, ++ bRFRegOffsetMask, ++ Data ++ ); + udelay(1); + /* Do LCK againg */ -+ PHY_SetRFReg(pDM_Odm->Adapter, RF_PATH, 0x18, bRFRegOffsetMask, 0x0fc07); ++ PHY_SetRFReg( ++ pDM_Odm->Adapter, ++ RF_PATH, ++ 0x18, ++ bRFRegOffsetMask, ++ 0x0fc07 ++ ); + udelay(1); -+ getvalue = PHY_QueryRFReg(pDM_Odm->Adapter, RF_PATH, Addr, bMaskDWord); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigRFWithHeaderFile: [B2] getvalue 0x%x, Data 0x%x, count %d\n", getvalue, Data, count)); -+ if (count>5) ++ getvalue = PHY_QueryRFReg( ++ pDM_Odm->Adapter, RF_PATH, Addr, bMaskDWord ++ ); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_TRACE, ++ ( ++ "===> ODM_ConfigRFWithHeaderFile: [B2] getvalue 0x%x, Data 0x%x, count %d\n", ++ getvalue, ++ Data, ++ count ++ ) ++ ); ++ ++ if (count > 5) + break; + } + } @@ -63307,74 +61666,103 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_RegConfig8723B.c linux-4.3-rtl87 +} + + -+void -+odm_ConfigRF_RadioA_8723B( -+PDM_ODM_T pDM_Odm, -+u32 Addr, -+u32 Data -+ ) ++void odm_ConfigRF_RadioA_8723B(PDM_ODM_T pDM_Odm, u32 Addr, u32 Data) +{ + u32 content = 0x1000; /* RF_Content: radioa_txt */ + u32 maskforPhySet = (u32)(content&0xE000); + -+ odm_ConfigRFReg_8723B(pDM_Odm, Addr, Data, ODM_RF_PATH_A, Addr|maskforPhySet); ++ odm_ConfigRFReg_8723B( ++ pDM_Odm, ++ Addr, ++ Data, ++ ODM_RF_PATH_A, ++ Addr|maskforPhySet ++ ); + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigRFWithHeaderFile: [RadioA] %08X %08X\n", Addr, Data)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_TRACE, ++ ( ++ "===> ODM_ConfigRFWithHeaderFile: [RadioA] %08X %08X\n", ++ Addr, ++ Data ++ ) ++ ); +} + -+void -+odm_ConfigMAC_8723B( -+PDM_ODM_T pDM_Odm, -+u32 Addr, -+u8 Data -+ ) ++void odm_ConfigMAC_8723B(PDM_ODM_T pDM_Odm, u32 Addr, u8 Data) +{ + rtw_write8(pDM_Odm->Adapter, Addr, Data); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigMACWithHeaderFile: [MAC_REG] %08X %08X\n", Addr, Data)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_TRACE, ++ ( ++ "===> ODM_ConfigMACWithHeaderFile: [MAC_REG] %08X %08X\n", ++ Addr, ++ Data ++ ) ++ ); +} + -+void -+odm_ConfigBB_AGC_8723B( -+ PDM_ODM_T pDM_Odm, -+ u32 Addr, -+ u32 Bitmask, -+ u32 Data -+ ) ++void odm_ConfigBB_AGC_8723B( ++ PDM_ODM_T pDM_Odm, ++ u32 Addr, ++ u32 Bitmask, ++ u32 Data ++) +{ + PHY_SetBBReg(pDM_Odm->Adapter, Addr, Bitmask, Data); + /* Add 1us delay between BB/RF register setting. */ + udelay(1); + -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigBBWithHeaderFile: [AGC_TAB] %08X %08X\n", Addr, Data)); ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_TRACE, ++ ( ++ "===> ODM_ConfigBBWithHeaderFile: [AGC_TAB] %08X %08X\n", ++ Addr, ++ Data ++ ) ++ ); +} + -+void -+odm_ConfigBB_PHY_REG_PG_8723B( -+PDM_ODM_T pDM_Odm, -+u32 Band, -+u32 RfPath, -+u32 TxNum, -+ u32 Addr, -+ u32 Bitmask, -+ u32 Data -+ ) ++void odm_ConfigBB_PHY_REG_PG_8723B( ++ PDM_ODM_T pDM_Odm, ++ u32 Band, ++ u32 RfPath, ++ u32 TxNum, ++ u32 Addr, ++ u32 Bitmask, ++ u32 Data ++) +{ + if (Addr == 0xfe || Addr == 0xffe) + msleep(50); -+ else -+ { -+ PHY_StoreTxPowerByRate(pDM_Odm->Adapter, Band, RfPath, TxNum, Addr, Bitmask, Data); -+ } -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_LOUD, ("===> ODM_ConfigBBWithHeaderFile: [PHY_REG] %08X %08X %08X\n", Addr, Bitmask, Data)); ++ else { ++ PHY_StoreTxPowerByRate(pDM_Odm->Adapter, Band, RfPath, TxNum, Addr, Bitmask, Data); ++ } ++ ODM_RT_TRACE( ++ pDM_Odm, ++ ODM_COMP_INIT, ++ ODM_DBG_LOUD, ++ ( ++ "===> ODM_ConfigBBWithHeaderFile: [PHY_REG] %08X %08X %08X\n", ++ Addr, ++ Bitmask, ++ Data ++ ) ++ ); +} + -+void -+odm_ConfigBB_PHY_8723B( -+PDM_ODM_T pDM_Odm, -+ u32 Addr, -+ u32 Bitmask, -+ u32 Data -+ ) ++void odm_ConfigBB_PHY_8723B( ++ PDM_ODM_T pDM_Odm, ++ u32 Addr, ++ u32 Bitmask, ++ u32 Data ++) +{ + if (Addr == 0xfe) + msleep(50); @@ -63388,35 +61776,41 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_RegConfig8723B.c linux-4.3-rtl87 + udelay(5); + else if (Addr == 0xf9) + udelay(1); -+ else -+ { ++ else { + PHY_SetBBReg(pDM_Odm->Adapter, Addr, Bitmask, Data); + } + + /* Add 1us delay between BB/RF register setting. */ + udelay(1); -+ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigBBWithHeaderFile: [PHY_REG] %08X %08X\n", Addr, Data)); ++ ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_TRACE, ("===> ODM_ConfigBBWithHeaderFile: [PHY_REG] %08X %08X\n", Addr, Data)); +} + -+void -+odm_ConfigBB_TXPWR_LMT_8723B( -+PDM_ODM_T pDM_Odm, -+u8 * Regulation, -+u8 * Band, -+u8 * Bandwidth, -+u8 * RateSection, -+u8 * RfPath, -+u8 * Channel, -+u8 * PowerLimit -+ ) ++void odm_ConfigBB_TXPWR_LMT_8723B( ++ PDM_ODM_T pDM_Odm, ++ u8 *Regulation, ++ u8 *Band, ++ u8 *Bandwidth, ++ u8 *RateSection, ++ u8 *RfPath, ++ u8 *Channel, ++ u8 *PowerLimit ++) +{ -+ PHY_SetTxPowerLimit(pDM_Odm->Adapter, Regulation, Band, -+ Bandwidth, RateSection, RfPath, Channel, PowerLimit); ++ PHY_SetTxPowerLimit( ++ pDM_Odm->Adapter, ++ Regulation, ++ Band, ++ Bandwidth, ++ RateSection, ++ RfPath, ++ Channel, ++ PowerLimit ++ ); +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_RegConfig8723B.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_RegConfig8723B.h ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_RegConfig8723B.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_RegConfig8723B.h 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,80 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_RegConfig8723B.h linux/3rdparty/rtl8723bs/hal/odm_RegConfig8723B.h +--- linux.old/3rdparty/rtl8723bs/hal/odm_RegConfig8723B.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_RegConfig8723B.h 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,65 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -63434,72 +61828,57 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_RegConfig8723B.h linux-4.3-rtl87 +#ifndef __INC_ODM_REGCONFIG_H_8723B +#define __INC_ODM_REGCONFIG_H_8723B + -+void -+odm_ConfigRFReg_8723B( -+PDM_ODM_T pDM_Odm, -+u32 Addr, -+u32 Data, -+ ODM_RF_RADIO_PATH_E RF_PATH, -+u32 RegAddr -+ ); ++void odm_ConfigRFReg_8723B( ++ PDM_ODM_T pDM_Odm, ++ u32 Addr, ++ u32 Data, ++ ODM_RF_RADIO_PATH_E RF_PATH, ++ u32 RegAddr ++); + -+void -+odm_ConfigRF_RadioA_8723B( -+PDM_ODM_T pDM_Odm, -+u32 Addr, -+u32 Data -+ ); ++void odm_ConfigRF_RadioA_8723B(PDM_ODM_T pDM_Odm, u32 Addr, u32 Data); + -+void -+odm_ConfigMAC_8723B( -+PDM_ODM_T pDM_Odm, -+u32 Addr, -+u8 Data -+ ); ++void odm_ConfigMAC_8723B(PDM_ODM_T pDM_Odm, u32 Addr, u8 Data); + -+void -+odm_ConfigBB_AGC_8723B( -+ PDM_ODM_T pDM_Odm, -+ u32 Addr, -+ u32 Bitmask, -+ u32 Data -+ ); ++void odm_ConfigBB_AGC_8723B( ++ PDM_ODM_T pDM_Odm, ++ u32 Addr, ++ u32 Bitmask, ++ u32 Data ++); + -+void -+odm_ConfigBB_PHY_REG_PG_8723B( -+PDM_ODM_T pDM_Odm, -+u32 Band, -+u32 RfPath, -+u32 TxNum, -+ u32 Addr, -+ u32 Bitmask, -+ u32 Data -+ ); ++void odm_ConfigBB_PHY_REG_PG_8723B( ++ PDM_ODM_T pDM_Odm, ++ u32 Band, ++ u32 RfPath, ++ u32 TxNum, ++ u32 Addr, ++ u32 Bitmask, ++ u32 Data ++); + -+void -+odm_ConfigBB_PHY_8723B( -+PDM_ODM_T pDM_Odm, -+ u32 Addr, -+ u32 Bitmask, -+ u32 Data -+ ); ++void odm_ConfigBB_PHY_8723B( ++ PDM_ODM_T pDM_Odm, ++ u32 Addr, ++ u32 Bitmask, ++ u32 Data ++); + -+void -+odm_ConfigBB_TXPWR_LMT_8723B( -+PDM_ODM_T pDM_Odm, -+u8 * Regulation, -+u8 * Band, -+u8 * Bandwidth, -+u8 * RateSection, -+u8 * RfPath, -+u8 * Channel, -+u8 * PowerLimit -+ ); ++void odm_ConfigBB_TXPWR_LMT_8723B( ++ PDM_ODM_T pDM_Odm, ++ u8 *Regulation, ++ u8 *Band, ++ u8 *Bandwidth, ++ u8 *RateSection, ++ u8 *RfPath, ++ u8 *Channel, ++ u8 *PowerLimit ++); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_RegDefine11N.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_RegDefine11N.h ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_RegDefine11N.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_RegDefine11N.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_RegDefine11N.h linux/3rdparty/rtl8723bs/hal/odm_RegDefine11N.h +--- linux.old/3rdparty/rtl8723bs/hal/odm_RegDefine11N.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_RegDefine11N.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,172 @@ +/****************************************************************************** + * @@ -63673,9 +62052,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_RegDefine11N.h linux-4.3-rtl8723 +#define ODM_BIT_BB_ATC_11N BIT11 + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_reg.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_reg.h ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_reg.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_reg.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_reg.h linux/3rdparty/rtl8723bs/hal/odm_reg.h +--- linux.old/3rdparty/rtl8723bs/hal/odm_reg.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_reg.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,103 @@ +/****************************************************************************** + * @@ -63780,10 +62159,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_reg.h linux-4.3-rtl8723bs/3rdpar +#define BIT_FA_RESET BIT0 + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_RTL8723B.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_RTL8723B.c ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_RTL8723B.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_RTL8723B.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,49 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_RTL8723B.c linux/3rdparty/rtl8723bs/hal/odm_RTL8723B.c +--- linux.old/3rdparty/rtl8723bs/hal/odm_RTL8723B.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_RTL8723B.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,45 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -63801,41 +62180,37 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_RTL8723B.c linux-4.3-rtl8723bs/3 + +#include "odm_precomp.h" + -+ s8 -+odm_CCKRSSI_8723B( -+ u8 LNA_idx, -+ u8 VGA_idx -+ ) ++s8 odm_CCKRSSI_8723B(u8 LNA_idx, u8 VGA_idx) +{ -+ s8 rx_pwr_all = 0x00; -+ switch (LNA_idx) -+ { -+ /* 46 53 73 95 201301231630 */ -+ /* 46 53 77 99 201301241630 */ ++ s8 rx_pwr_all = 0x00; + -+ case 6: -+ rx_pwr_all = -34 - (2 * VGA_idx); -+ break; -+ case 4: -+ rx_pwr_all = -14 - (2 * VGA_idx); -+ break; -+ case 1: -+ rx_pwr_all = 6 - (2 * VGA_idx); -+ break; -+ case 0: -+ rx_pwr_all = 16 - (2 * VGA_idx); -+ break; -+ default: -+ /* rx_pwr_all = -53+(2*(31-VGA_idx)); */ -+ /* DbgPrint("wrong LNA index\n"); */ -+ break; ++ switch (LNA_idx) { ++ /* 46 53 73 95 201301231630 */ ++ /* 46 53 77 99 201301241630 */ ++ ++ case 6: ++ rx_pwr_all = -34 - (2 * VGA_idx); ++ break; ++ case 4: ++ rx_pwr_all = -14 - (2 * VGA_idx); ++ break; ++ case 1: ++ rx_pwr_all = 6 - (2 * VGA_idx); ++ break; ++ case 0: ++ rx_pwr_all = 16 - (2 * VGA_idx); ++ break; ++ default: ++ /* rx_pwr_all = -53+(2*(31-VGA_idx)); */ ++ /* DbgPrint("wrong LNA index\n"); */ ++ break; + + } -+ return rx_pwr_all; ++ return rx_pwr_all; +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_RTL8723B.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_RTL8723B.h ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_RTL8723B.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_RTL8723B.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_RTL8723B.h linux/3rdparty/rtl8723bs/hal/odm_RTL8723B.h +--- linux.old/3rdparty/rtl8723bs/hal/odm_RTL8723B.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_RTL8723B.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,22 @@ +/****************************************************************************** + * @@ -63859,9 +62234,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_RTL8723B.h linux-4.3-rtl8723bs/3 +s8 odm_CCKRSSI_8723B(u8 LNA_idx, u8 VGA_idx); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_types.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_types.h ---- linux-4.3/3rdparty/rtl8723bs/hal/odm_types.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/odm_types.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/odm_types.h linux/3rdparty/rtl8723bs/hal/odm_types.h +--- linux.old/3rdparty/rtl8723bs/hal/odm_types.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/odm_types.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,102 @@ +/****************************************************************************** + * @@ -63888,7 +62263,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_types.h linux-4.3-rtl8723bs/3rdp + +#define GET_ODM(__padapter) ((PDM_ODM_T)(&((GET_HAL_DATA(__padapter))->odmpriv))) + -+typedef enum _HAL_STATUS{ ++typedef enum _HAL_STATUS { + HAL_STATUS_SUCCESS, + HAL_STATUS_FAILURE, + /*RT_STATUS_PENDING, @@ -63897,13 +62272,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_types.h linux-4.3-rtl8723bs/3rdp + RT_STATUS_INVALID_PARAMETER, + RT_STATUS_NOT_SUPPORT, + RT_STATUS_OS_API_FAILED,*/ -+}HAL_STATUS,*PHAL_STATUS; ++} HAL_STATUS, *PHAL_STATUS; + + +/* */ +/* Declare for ODM spin lock defintion temporarily fro compile pass. */ +/* */ -+typedef enum _RT_SPINLOCK_TYPE{ ++typedef enum _RT_SPINLOCK_TYPE { + RT_TX_SPINLOCK = 1, + RT_RX_SPINLOCK = 2, + RT_RM_SPINLOCK = 3, @@ -63919,12 +62294,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_types.h linux-4.3-rtl8723bs/3rdp + RT_PORT_SPINLOCK = 16, + RT_H2C_SPINLOCK = 20, /* For H2C cmd. Added by tynli. 2009.11.09. */ + -+ RT_BTData_SPINLOCK =25, ++ RT_BTData_SPINLOCK = 25, + -+ RT_WAPI_OPTION_SPINLOCK =26, -+ RT_WAPI_RX_SPINLOCK =27, ++ RT_WAPI_OPTION_SPINLOCK = 26, ++ RT_WAPI_RX_SPINLOCK = 27, + -+ /* add for 92D CCK control issue */ ++ /* add for 92D CCK control issue */ + RT_CCK_PAGEA_SPINLOCK = 28, + RT_BUFFER_SPINLOCK = 29, + RT_CHANNEL_AND_BANDWIDTH_SPINLOCK = 30, @@ -63939,7 +62314,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_types.h linux-4.3-rtl8723bs/3rdp + RT_PENDED_OID_SPINLOCK = 39, + RT_CHNLLIST_SPINLOCK = 40, + RT_INDIC_SPINLOCK = 41, /* protect indication */ -+}RT_SPINLOCK_TYPE; ++} RT_SPINLOCK_TYPE; + + #if defined(__LITTLE_ENDIAN) + #define ODM_ENDIAN_TYPE ODM_ENDIAN_LITTLE @@ -63948,7 +62323,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_types.h linux-4.3-rtl8723bs/3rdp + #endif + + typedef struct timer_list RT_TIMER, *PRT_TIMER; -+ typedef void * RT_TIMER_CALL_BACK; ++ typedef void *RT_TIMER_CALL_BACK; + #define STA_INFO_T struct sta_info + #define PSTA_INFO_T struct sta_info * + @@ -63965,10 +62340,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/odm_types.h linux-4.3-rtl8723bs/3rdp +#define COND_ENDIF 3 + +#endif /* __ODM_TYPES_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c ---- linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,2412 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c +--- linux.old/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,2358 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. @@ -63991,7 +62366,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 +#include "hal_com_h2c.h" + +#define MAX_H2C_BOX_NUMS 4 -+#define MESSAGE_BOX_SIZE 4 ++#define MESSAGE_BOX_SIZE 4 + +#define RTL8723B_MAX_CMD_LEN 7 +#define RTL8723B_EX_MESSAGE_BOX_SIZE 4 @@ -63999,13 +62374,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 +static u8 _is_fw_read_cmd_down(struct adapter *padapter, u8 msgbox_num) +{ + u8 read_down = false; -+ int retry_cnts = 100; ++ int retry_cnts = 100; + + u8 valid; + + /* DBG_8192C(" _is_fw_read_cmd_down , reg_1cc(%x), msg_box(%d)...\n", rtw_read8(padapter, REG_HMETFR), msgbox_num); */ + -+ do{ ++ do { + valid = rtw_read8(padapter, REG_HMETFR) & BIT(msgbox_num); + if (0 == valid) { + read_down = true; @@ -64014,7 +62389,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + else + msleep(1); +#endif -+ }while ((!read_down) && (retry_cnts--)); ++ } while ((!read_down) && (retry_cnts--)); + + return read_down; + @@ -64047,14 +62422,16 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + if (!pCmdBuffer) { + goto exit; + } ++ + if (CmdLen > RTL8723B_MAX_CMD_LEN) { + goto exit; + } ++ + if (padapter->bSurpriseRemoved == true) + goto exit; + + /* pay attention to if race condition happened in H2C cmd setting. */ -+ do{ ++ do { + h2c_box_num = pHalData->LastHMEBoxNum; + + if (!_is_fw_read_cmd_down(padapter, h2c_box_num)) { @@ -64064,10 +62441,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + goto exit; + } + -+ if (CmdLen<=3) -+ { ++ if (CmdLen <= 3) + memcpy((u8 *)(&h2c_cmd)+1, pCmdBuffer, CmdLen); -+ } + else { + memcpy((u8 *)(&h2c_cmd)+1, pCmdBuffer, 3); + memcpy((u8 *)(&h2c_cmd_ex), pCmdBuffer+3, CmdLen-3); @@ -64076,11 +62451,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + + *(u8 *)(&h2c_cmd) |= ElementID; + -+ if (CmdLen>3) { -+ msgbox_ex_addr = REG_HMEBOX_EXT0_8723B + (h2c_box_num *RTL8723B_EX_MESSAGE_BOX_SIZE); ++ if (CmdLen > 3) { ++ msgbox_ex_addr = REG_HMEBOX_EXT0_8723B + (h2c_box_num*RTL8723B_EX_MESSAGE_BOX_SIZE); + rtw_write32(padapter, msgbox_ex_addr, h2c_cmd_ex); + } -+ msgbox_addr =REG_HMEBOX_0 + (h2c_box_num *MESSAGE_BOX_SIZE); ++ msgbox_addr = REG_HMEBOX_0 + (h2c_box_num*MESSAGE_BOX_SIZE); + rtw_write32(padapter, msgbox_addr, h2c_cmd); + + /* DBG_8192C("MSG_BOX:%d, CmdLen(%d), CmdID(0x%x), reg:0x%x =>h2c_cmd:0x%.8x, reg:0x%x =>h2c_cmd_ex:0x%.8x\n" */ @@ -64088,7 +62463,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + + pHalData->LastHMEBoxNum = (h2c_box_num+1) % MAX_H2C_BOX_NUMS; + -+ }while (0); ++ } while (0); + + ret = _SUCCESS; + @@ -64100,12 +62475,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + +static void ConstructBeacon(struct adapter *padapter, u8 *pframe, u32 *pLength) +{ -+ struct ieee80211_hdr *pwlanhdr; ++ struct ieee80211_hdr *pwlanhdr; + __le16 *fctrl; -+ u32 rate_len, pktlen; ++ u32 rate_len, pktlen; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); -+ struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network); ++ struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network); + u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + + @@ -64143,8 +62518,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + pframe += 2; + pktlen += 2; + -+ if ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) -+ { ++ if ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) { + /* DBG_871X("ie len =%d\n", cur_network->IELength); */ + pktlen += cur_network->IELength - sizeof(struct ndis_802_11_fix_ie); + memcpy(pframe, cur_network->IEs+sizeof(struct ndis_802_11_fix_ie), pktlen); @@ -64159,13 +62533,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + + /* supported rates... */ + rate_len = rtw_get_rateset_len(cur_network->SupportedRates); -+ pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, ((rate_len > 8)? 8: rate_len), cur_network->SupportedRates, &pktlen); ++ pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, ((rate_len > 8) ? 8 : rate_len), cur_network->SupportedRates, &pktlen); + + /* DS parameter set */ + pframe = rtw_set_ie(pframe, _DSSET_IE_, 1, (unsigned char *)&(cur_network->Configuration.DSConfig), &pktlen); + -+ if ((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) -+ { ++ if ((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) { + u32 ATIMWindow; + /* IBSS Parameter Set... */ + /* ATIMWindow = cur->Configuration.ATIMWindow; */ @@ -64179,17 +62552,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + + /* EXTERNDED SUPPORTED RATE */ + if (rate_len > 8) -+ { + pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (rate_len - 8), (cur_network->SupportedRates + 8), &pktlen); -+ } + + + /* todo:HT for adhoc */ + +_ConstructBeacon: + -+ if ((pktlen + TXDESC_SIZE) > 512) -+ { ++ if ((pktlen + TXDESC_SIZE) > 512) { + DBG_871X("beacon frame too large\n"); + return; + } @@ -64202,7 +62572,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + +static void ConstructPSPoll(struct adapter *padapter, u8 *pframe, u32 *pLength) +{ -+ struct ieee80211_hdr *pwlanhdr; ++ struct ieee80211_hdr *pwlanhdr; + __le16 *fctrl; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -64232,53 +62602,51 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 +static void ConstructNullFunctionData( + struct adapter *padapter, + u8 *pframe, -+ u32 *pLength, ++ u32 *pLength, + u8 *StaAddr, + u8 bQoS, + u8 AC, + u8 bEosp, -+ u8 bForcePowerSave) ++ u8 bForcePowerSave ++) +{ -+ struct ieee80211_hdr *pwlanhdr; ++ struct ieee80211_hdr *pwlanhdr; + __le16 *fctrl; -+ u32 pktlen; -+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv; -+ struct wlan_network *cur_network = &pmlmepriv->cur_network; ++ u32 pktlen; ++ struct mlme_priv *pmlmepriv = &padapter->mlmepriv; ++ struct wlan_network *cur_network = &pmlmepriv->cur_network; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + + + /* DBG_871X("%s:%d\n", __func__, bForcePowerSave); */ + -+ pwlanhdr = (struct ieee80211_hdr*)pframe; ++ pwlanhdr = (struct ieee80211_hdr *)pframe; + + fctrl = &pwlanhdr->frame_control; + *(fctrl) = 0; + if (bForcePowerSave) -+ { + SetPwrMgt(fctrl); -+ } + -+ switch (cur_network->network.InfrastructureMode) -+ { -+ case Ndis802_11Infrastructure: -+ SetToDs(fctrl); -+ memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); -+ memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); -+ memcpy(pwlanhdr->addr3, StaAddr, ETH_ALEN); -+ break; -+ case Ndis802_11APMode: -+ SetFrDs(fctrl); -+ memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); -+ memcpy(pwlanhdr->addr2, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); -+ memcpy(pwlanhdr->addr3, myid(&(padapter->eeprompriv)), ETH_ALEN); -+ break; -+ case Ndis802_11IBSS: -+ default: -+ memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); -+ memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); -+ memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); -+ break; ++ switch (cur_network->network.InfrastructureMode) { ++ case Ndis802_11Infrastructure: ++ SetToDs(fctrl); ++ memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); ++ memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); ++ memcpy(pwlanhdr->addr3, StaAddr, ETH_ALEN); ++ break; ++ case Ndis802_11APMode: ++ SetFrDs(fctrl); ++ memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); ++ memcpy(pwlanhdr->addr2, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); ++ memcpy(pwlanhdr->addr3, myid(&(padapter->eeprompriv)), ETH_ALEN); ++ break; ++ case Ndis802_11IBSS: ++ default: ++ memcpy(pwlanhdr->addr1, StaAddr, ETH_ALEN); ++ memcpy(pwlanhdr->addr2, myid(&(padapter->eeprompriv)), ETH_ALEN); ++ memcpy(pwlanhdr->addr3, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); ++ break; + } + + SetSeqNum(pwlanhdr, 0); @@ -64288,7 +62656,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + + SetFrameSubType(pframe, WIFI_QOS_DATA_NULL); + -+ pwlanqoshdr = (struct ieee80211_qos_hdr*)pframe; ++ pwlanqoshdr = (struct ieee80211_qos_hdr *)pframe; + SetPriority(&pwlanqoshdr->qos_ctrl, AC); + SetEOSP(&pwlanqoshdr->qos_ctrl, bEosp); + @@ -64310,10 +62678,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 +/* */ +static void ConstructARPResponse( + struct adapter *padapter, -+ u8 *pframe, -+ u32 *pLength, -+ u8 *pIPAddress -+ ) ++ u8 *pframe, ++ u32 *pLength, ++ u8 *pIPAddress ++) +{ + struct ieee80211_hdr *pwlanhdr; + __le16 *fctrl; @@ -64327,7 +62695,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + u8 EncryptionHeadOverhead = 0; + /* DBG_871X("%s:%d\n", __func__, bForcePowerSave); */ + -+ pwlanhdr = (struct ieee80211_hdr*)pframe; ++ pwlanhdr = (struct ieee80211_hdr *)pframe; + + fctrl = &pwlanhdr->frame_control; + *(fctrl) = 0; @@ -64359,24 +62727,22 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + /* Security Header: leave space for it if necessary. */ + /* */ + -+ switch (psecuritypriv->dot11PrivacyAlgrthm) -+ { -+ case _WEP40_: -+ case _WEP104_: -+ EncryptionHeadOverhead = 4; -+ break; -+ case _TKIP_: -+ EncryptionHeadOverhead = 8; -+ break; -+ case _AES_: -+ EncryptionHeadOverhead = 8; -+ break; -+ default: -+ EncryptionHeadOverhead = 0; ++ switch (psecuritypriv->dot11PrivacyAlgrthm) { ++ case _WEP40_: ++ case _WEP104_: ++ EncryptionHeadOverhead = 4; ++ break; ++ case _TKIP_: ++ EncryptionHeadOverhead = 8; ++ break; ++ case _AES_: ++ EncryptionHeadOverhead = 8; ++ break; ++ default: ++ EncryptionHeadOverhead = 0; + } + -+ if (EncryptionHeadOverhead > 0) -+ { ++ if (EncryptionHeadOverhead > 0) { + memset(&(pframe[*pLength]), 0, EncryptionHeadOverhead); + *pLength += EncryptionHeadOverhead; + SetPrivacy(fctrl); @@ -64385,7 +62751,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + /* */ + /* Frame Body. */ + /* */ -+ pARPRspPkt = (u8 *)(pframe+ *pLength); ++ pARPRspPkt = (u8 *)(pframe + *pLength); + payload = pARPRspPkt; /* Get Payload pointer */ + /* LLC header */ + memcpy(pARPRspPkt, ARPLLCHeader, 8); @@ -64409,13 +62775,17 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + + *pLength += 28; + -+ if (psecuritypriv->dot11PrivacyAlgrthm == _TKIP_) -+ { ++ if (psecuritypriv->dot11PrivacyAlgrthm == _TKIP_) { + u8 mic[8]; + struct mic_data micdata; + struct sta_info *psta = NULL; -+ u8 priority[4]={0x0, 0x0, 0x0, 0x0}; -+ u8 null_key[16]={0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; ++ u8 priority[4] = { ++ 0x0, 0x0, 0x0, 0x0 ++ }; ++ u8 null_key[16] = { ++ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ++ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ++ }; + + DBG_871X("%s(): Add MIC\n", __func__); + @@ -64432,12 +62802,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + + rtw_secmicappend(&micdata, pwlanhdr->addr2, 6); /* SA */ + -+ priority[0]= 0; ++ priority[0] = 0; + rtw_secmicappend(&micdata, &priority[0], 4); + + rtw_secmicappend(&micdata, payload, 36); /* payload length = 8 + 28 */ + -+ rtw_secgetmic(&micdata,&(mic[0])); ++ rtw_secgetmic(&micdata, &(mic[0])); + + pARPRspPkt += 28; + memcpy(pARPRspPkt, &(mic[0]), 8); @@ -64448,60 +62818,56 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + +#ifdef CONFIG_PNO_SUPPORT +static void ConstructPnoInfo( -+ struct adapter *padapter, -+ u8 *pframe, -+ u32 *pLength -+ ) ++ struct adapter *padapter, u8 *pframe, u32 *pLength ++) +{ + + struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); + + u8 *pPnoInfoPkt = pframe; -+ pPnoInfoPkt = (u8 *)(pframe+ *pLength); ++ pPnoInfoPkt = (u8 *)(pframe + *pLength); + memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->ssid_num, 4); + -+ *pLength+=4; ++ *pLength += 4; + pPnoInfoPkt += 4; + memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->fast_scan_period, 4); + -+ *pLength+=4; ++ *pLength += 4; + pPnoInfoPkt += 4; + memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->fast_scan_iterations, 4); + -+ *pLength+=4; ++ *pLength += 4; + pPnoInfoPkt += 4; + memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->slow_scan_period, 4); + -+ *pLength+=4; ++ *pLength += 4; + pPnoInfoPkt += 4; + memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->ssid_length, + MAX_PNO_LIST_COUNT); + -+ *pLength+=MAX_PNO_LIST_COUNT; ++ *pLength += MAX_PNO_LIST_COUNT; + pPnoInfoPkt += MAX_PNO_LIST_COUNT; + memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->ssid_cipher_info, + MAX_PNO_LIST_COUNT); + -+ *pLength+=MAX_PNO_LIST_COUNT; ++ *pLength += MAX_PNO_LIST_COUNT; + pPnoInfoPkt += MAX_PNO_LIST_COUNT; + memcpy(pPnoInfoPkt, &pwrctl->pnlo_info->ssid_channel_info, + MAX_PNO_LIST_COUNT); + -+ *pLength+=MAX_PNO_LIST_COUNT; ++ *pLength += MAX_PNO_LIST_COUNT; + pPnoInfoPkt += MAX_PNO_LIST_COUNT; +} + +static void ConstructSSIDList( -+ struct adapter *padapter, -+ u8 *pframe, -+ u32 *pLength -+ ) ++ struct adapter *padapter, u8 *pframe, u32 *pLength ++) +{ + int i = 0; + u8 *pSSIDListPkt = pframe; + struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); + -+ pSSIDListPkt = (u8 *)(pframe+ *pLength); ++ pSSIDListPkt = (u8 *)(pframe + *pLength); + + for (i = 0; i < pwrctl->pnlo_info->ssid_num ; i++) { + memcpy(pSSIDListPkt, &pwrctl->pno_ssid_list->node[i].SSID, @@ -64513,60 +62879,57 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 +} + +static void ConstructScanInfo( -+ struct adapter *padapter, -+ u8 *pframe, -+ u32 *pLength -+ ) ++ struct adapter *padapter, u8 *pframe, u32 *pLength ++) +{ + int i = 0; + u8 *pScanInfoPkt = pframe; + struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); + -+ pScanInfoPkt = (u8 *)(pframe+ *pLength); ++ pScanInfoPkt = (u8 *)(pframe + *pLength); + + memcpy(pScanInfoPkt, &pwrctl->pscan_info->channel_num, 1); + -+ *pLength+= 1; ++ *pLength += 1; + pScanInfoPkt += 1; + memcpy(pScanInfoPkt, &pwrctl->pscan_info->orig_ch, 1); + + -+ *pLength+= 1; ++ *pLength += 1; + pScanInfoPkt += 1; + memcpy(pScanInfoPkt, &pwrctl->pscan_info->orig_bw, 1); + + -+ *pLength+= 1; ++ *pLength += 1; + pScanInfoPkt += 1; + memcpy(pScanInfoPkt, &pwrctl->pscan_info->orig_40_offset, 1); + -+ *pLength+= 1; ++ *pLength += 1; + pScanInfoPkt += 1; + memcpy(pScanInfoPkt, &pwrctl->pscan_info->orig_80_offset, 1); + -+ *pLength+= 1; ++ *pLength += 1; + pScanInfoPkt += 1; + memcpy(pScanInfoPkt, &pwrctl->pscan_info->periodScan, 1); + -+ *pLength+= 1; ++ *pLength += 1; + pScanInfoPkt += 1; + memcpy(pScanInfoPkt, &pwrctl->pscan_info->period_scan_time, 1); + -+ *pLength+= 1; ++ *pLength += 1; + pScanInfoPkt += 1; + memcpy(pScanInfoPkt, &pwrctl->pscan_info->enableRFE, 1); + -+ *pLength+= 1; ++ *pLength += 1; + pScanInfoPkt += 1; + memcpy(pScanInfoPkt, &pwrctl->pscan_info->rfe_type, 8); + -+ *pLength+=8; ++ *pLength += 8; + pScanInfoPkt += 8; + -+ for (i = 0 ; i < MAX_SCAN_LIST_COUNT ; i ++) { -+ memcpy(pScanInfoPkt, -+ &pwrctl->pscan_info->ssid_channel_info[i], 4); -+ *pLength+=4; ++ for (i = 0; i < MAX_SCAN_LIST_COUNT; i++) { ++ memcpy(pScanInfoPkt, &pwrctl->pscan_info->ssid_channel_info[i], 4); ++ *pLength += 4; + pScanInfoPkt += 4; + } +} @@ -64574,23 +62937,21 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + +#ifdef CONFIG_GTK_OL +static void ConstructGTKResponse( -+ struct adapter *padapter, -+ u8 *pframe, -+ u32 *pLength -+ ) ++ struct adapter *padapter, u8 *pframe, u32 *pLength ++) +{ -+ struct ieee80211_hdr *pwlanhdr; -+ u16 *fctrl; ++ struct ieee80211_hdr *pwlanhdr; ++ u16 *fctrl; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + struct security_priv *psecuritypriv = &padapter->securitypriv; -+ static u8 LLCHeader[8] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x88, 0x8E}; -+ static u8 GTKbody_a[11] ={0x01, 0x03, 0x00, 0x5F, 0x02, 0x03, 0x12, 0x00, 0x10, 0x42, 0x0B}; -+ u8 *pGTKRspPkt = pframe; -+ u8 EncryptionHeadOverhead = 0; ++ static u8 LLCHeader[8] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00, 0x88, 0x8E}; ++ static u8 GTKbody_a[11] = {0x01, 0x03, 0x00, 0x5F, 0x02, 0x03, 0x12, 0x00, 0x10, 0x42, 0x0B}; ++ u8 *pGTKRspPkt = pframe; ++ u8 EncryptionHeadOverhead = 0; + /* DBG_871X("%s:%d\n", __func__, bForcePowerSave); */ + -+ pwlanhdr = (struct ieee80211_hdr*)pframe; ++ pwlanhdr = (struct ieee80211_hdr *)pframe; + + fctrl = &pwlanhdr->frame_control; + *(fctrl) = 0; @@ -64614,24 +62975,22 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + /* Security Header: leave space for it if necessary. */ + /* */ + -+ switch (psecuritypriv->dot11PrivacyAlgrthm) -+ { -+ case _WEP40_: -+ case _WEP104_: -+ EncryptionHeadOverhead = 4; -+ break; -+ case _TKIP_: -+ EncryptionHeadOverhead = 8; -+ break; -+ case _AES_: -+ EncryptionHeadOverhead = 8; -+ break; -+ default: -+ EncryptionHeadOverhead = 0; ++ switch (psecuritypriv->dot11PrivacyAlgrthm) { ++ case _WEP40_: ++ case _WEP104_: ++ EncryptionHeadOverhead = 4; ++ break; ++ case _TKIP_: ++ EncryptionHeadOverhead = 8; ++ break; ++ case _AES_: ++ EncryptionHeadOverhead = 8; ++ break; ++ default: ++ EncryptionHeadOverhead = 0; + } + -+ if (EncryptionHeadOverhead > 0) -+ { ++ if (EncryptionHeadOverhead > 0) { + memset(&(pframe[*pLength]), 0, EncryptionHeadOverhead); + *pLength += EncryptionHeadOverhead; + /* GTK's privacy bit is done by FW */ @@ -64641,7 +63000,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + /* */ + /* Frame Body. */ + /* */ -+ pGTKRspPkt = (u8 *)(pframe+ *pLength); ++ pGTKRspPkt = (u8 *)(pframe + *pLength); + /* LLC header */ + memcpy(pGTKRspPkt, LLCHeader, 8); + *pLength += 8; @@ -64664,16 +63023,16 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 +#ifdef CONFIG_PNO_SUPPORT +static void ConstructProbeReq(struct adapter *padapter, u8 *pframe, u32 *pLength) +{ -+ struct ieee80211_hdr *pwlanhdr; -+ u16 *fctrl; -+ u32 pktlen; -+ unsigned char *mac; -+ unsigned char bssrate[NumRates]; -+ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); ++ struct ieee80211_hdr *pwlanhdr; ++ u16 *fctrl; ++ u32 pktlen; ++ unsigned char *mac; ++ unsigned char bssrate[NumRates]; ++ struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); + struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); -+ int bssrate_len = 0; ++ int bssrate_len = 0; + u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + + pwlanhdr = (struct ieee80211_hdr *)pframe; @@ -64698,15 +63057,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + + get_rate_set(padapter, bssrate, &bssrate_len); + -+ if (bssrate_len > 8) -+ { -+ pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , 8, bssrate, &pktlen); -+ pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_ , (bssrate_len - 8), (bssrate + 8), &pktlen); -+ } -+ else -+ { -+ pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_ , bssrate_len , bssrate, &pktlen); -+ } ++ if (bssrate_len > 8) { ++ pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, 8, bssrate, &pktlen); ++ pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (bssrate_len - 8), (bssrate + 8), &pktlen); ++ } else ++ pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, bssrate_len, bssrate, &pktlen); + + *pLength = pktlen; +} @@ -64716,13 +63071,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 +#ifdef CONFIG_AP_WOWLAN +static void ConstructProbeRsp(struct adapter *padapter, u8 *pframe, u32 *pLength, u8 *StaAddr, bool bHideSSID) +{ -+ struct ieee80211_hdr *pwlanhdr; -+ u16 *fctrl; -+ u8 *mac, *bssid; -+ u32 pktlen; ++ struct ieee80211_hdr *pwlanhdr; ++ u16 *fctrl; ++ u8 *mac, *bssid; ++ u32 pktlen; + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); -+ struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network); ++ struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network); + u8 *pwps_ie; + uint wps_ielen; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -64749,14 +63104,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + pktlen = sizeof(struct ieee80211_hdr_3addr); + pframe += pktlen; + -+ if (cur_network->IELength>MAX_IE_SZ) ++ if (cur_network->IELength > MAX_IE_SZ) + return; + + pwps_ie = rtw_get_wps_ie(cur_network->IEs+_FIXED_IE_LENGTH_, + cur_network->IELength-_FIXED_IE_LENGTH_, NULL, &wps_ielen); + + /* inerset & update wps_probe_resp_ie */ -+ if ((pmlmepriv->wps_probe_resp_ie!= NULL) && pwps_ie && (wps_ielen>0)) { ++ if ((pmlmepriv->wps_probe_resp_ie != NULL) && pwps_ie && (wps_ielen > 0)) { + uint wps_offset, remainder_ielen; + u8 *premainder_ie; + @@ -64771,13 +63126,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + pktlen += wps_offset; + + wps_ielen = (uint)pmlmepriv->wps_probe_resp_ie[1];/* to get ie data len */ -+ if ((wps_offset+wps_ielen+2)<=MAX_IE_SZ) { ++ if ((wps_offset+wps_ielen+2) <= MAX_IE_SZ) { + memcpy(pframe, pmlmepriv->wps_probe_resp_ie, wps_ielen+2); + pframe += wps_ielen+2; + pktlen += wps_ielen+2; + } + -+ if ((wps_offset+wps_ielen+2+remainder_ielen)<=MAX_IE_SZ) { ++ if ((wps_offset+wps_ielen+2+remainder_ielen) <= MAX_IE_SZ) { + memcpy(pframe, premainder_ie, remainder_ielen); + pframe += remainder_ielen; + pktlen += remainder_ielen; @@ -64828,16 +63183,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + +/* To check if reserved page content is destroyed by beacon beacuse beacon is too large. */ +/* 2010.06.23. Added by tynli. */ -+void -+CheckFwRsvdPageContent( -+ struct adapter * Adapter -+) ++void CheckFwRsvdPageContent(struct adapter *Adapter) +{ +} + +static void rtl8723b_set_FwRsvdPage_cmd(struct adapter *padapter, PRSVDPAGE_LOC rsvdpageloc) +{ -+ u8 u1H2CRsvdPageParm[H2C_RSVDPAGE_LOC_LEN]={0}; ++ u8 u1H2CRsvdPageParm[H2C_RSVDPAGE_LOC_LEN] = {0}; + + DBG_871X("8723BRsvdPageLoc: ProbeRsp =%d PsPoll =%d Null =%d QoSNull =%d BTNull =%d\n", + rsvdpageloc->LocProbeRsp, rsvdpageloc->LocPsPoll, @@ -64858,7 +63210,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 +{ +#ifdef CONFIG_WOWLAN + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; -+ u8 u1H2CAoacRsvdPageParm[H2C_AOAC_RSVDPAGE_LOC_LEN]={0}; ++ u8 u1H2CAoacRsvdPageParm[H2C_AOAC_RSVDPAGE_LOC_LEN] = {0}; + + DBG_871X("8723BAOACRsvdPageLoc: RWC =%d ArpRsp =%d NbrAdv =%d GtkRsp =%d GtkInfo =%d ProbeReq =%d NetworkList =%d\n", + rsvdpageloc->LocRemoteCtrlInfo, rsvdpageloc->LocArpRsp, @@ -64893,11 +63245,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 +} + +#ifdef CONFIG_AP_WOWLAN -+static void rtl8723b_set_ap_wow_rsvdpage_cmd(struct adapter *padapter, -+ PRSVDPAGE_LOC rsvdpageloc) ++static void rtl8723b_set_ap_wow_rsvdpage_cmd( ++ struct adapter *padapter, PRSVDPAGE_LOC rsvdpageloc ++) +{ + u8 header; -+ u8 rsvdparm[H2C_AOAC_RSVDPAGE_LOC_LEN]={0}; ++ u8 rsvdparm[H2C_AOAC_RSVDPAGE_LOC_LEN] = {0}; + + header = rtw_read8(padapter, REG_BCNQ_BDNY); + @@ -64929,7 +63282,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + +void rtl8723b_set_FwMediaStatusRpt_cmd(struct adapter *padapter, u8 mstatus, u8 macid) +{ -+ u8 u1H2CMediaStatusRptParm[H2C_MEDIA_STATUS_RPT_LEN]={0}; ++ u8 u1H2CMediaStatusRptParm[H2C_MEDIA_STATUS_RPT_LEN] = {0}; + u8 macid_end = 0; + + DBG_871X("%s(): mstatus = %d macid =%d\n", __func__, mstatus, macid); @@ -64946,7 +63299,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 +#ifdef CONFIG_WOWLAN +static void rtl8723b_set_FwKeepAlive_cmd(struct adapter *padapter, u8 benable, u8 pkt_type) +{ -+ u8 u1H2CKeepAliveParm[H2C_KEEP_ALIVE_CTRL_LEN]={0}; ++ u8 u1H2CKeepAliveParm[H2C_KEEP_ALIVE_CTRL_LEN] = {0}; + u8 adopt = 1, check_period = 5; + + DBG_871X("%s(): benable = %d\n", __func__, benable); @@ -64962,7 +63315,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + +static void rtl8723b_set_FwDisconDecision_cmd(struct adapter *padapter, u8 benable) +{ -+ u8 u1H2CDisconDecisionParm[H2C_DISCON_DECISION_LEN]={0}; ++ u8 u1H2CDisconDecisionParm[H2C_DISCON_DECISION_LEN] = {0}; + u8 adopt = 1, check_period = 10, trypkt_num = 0; + + DBG_871X("%s(): benable = %d\n", __func__, benable); @@ -64979,16 +63332,16 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + +void rtl8723b_set_FwMacIdConfig_cmd(struct adapter *padapter, u8 mac_id, u8 raid, u8 bw, u8 sgi, u32 mask) +{ -+ u8 u1H2CMacIdConfigParm[H2C_MACID_CFG_LEN]={0}; ++ u8 u1H2CMacIdConfigParm[H2C_MACID_CFG_LEN] = {0}; + + DBG_871X("%s(): mac_id =%d raid = 0x%x bw =%d mask = 0x%x\n", __func__, mac_id, raid, bw, mask); + + SET_8723B_H2CCMD_MACID_CFG_MACID(u1H2CMacIdConfigParm, mac_id); + SET_8723B_H2CCMD_MACID_CFG_RAID(u1H2CMacIdConfigParm, raid); -+ SET_8723B_H2CCMD_MACID_CFG_SGI_EN(u1H2CMacIdConfigParm, (sgi)? 1:0); ++ SET_8723B_H2CCMD_MACID_CFG_SGI_EN(u1H2CMacIdConfigParm, sgi ? 1 : 0); + SET_8723B_H2CCMD_MACID_CFG_BW(u1H2CMacIdConfigParm, bw); + SET_8723B_H2CCMD_MACID_CFG_RATE_MASK0(u1H2CMacIdConfigParm, (u8)(mask & 0x000000ff)); -+ SET_8723B_H2CCMD_MACID_CFG_RATE_MASK1(u1H2CMacIdConfigParm, (u8)((mask & 0x0000ff00) >>8)); ++ SET_8723B_H2CCMD_MACID_CFG_RATE_MASK1(u1H2CMacIdConfigParm, (u8)((mask & 0x0000ff00) >> 8)); + SET_8723B_H2CCMD_MACID_CFG_RATE_MASK2(u1H2CMacIdConfigParm, (u8)((mask & 0x00ff0000) >> 16)); + SET_8723B_H2CCMD_MACID_CFG_RATE_MASK3(u1H2CMacIdConfigParm, (u8)((mask & 0xff000000) >> 24)); + @@ -64998,7 +63351,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + +static void rtl8723b_set_FwRssiSetting_cmd(struct adapter *padapter, u8 *param) +{ -+ u8 u1H2CRssiSettingParm[H2C_RSSI_SETTING_LEN]={0}; ++ u8 u1H2CRssiSettingParm[H2C_RSSI_SETTING_LEN] = {0}; + u8 mac_id = *param; + u8 rssi = *(param+2); + u8 uldl_state = 0; @@ -65019,7 +63372,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + int i; + struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; -+ u8 u1H2CPwrModeParm[H2C_PWRMODE_LEN]={0}; ++ u8 u1H2CPwrModeParm[H2C_PWRMODE_LEN] = {0}; + u8 PowerState = 0, awake_intvl = 1, byte5 = 0, rlbm = 0; + + if (pwrpriv->dtim > 0) @@ -65028,12 +63381,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + DBG_871X("%s(): FW LPS mode = %d, SmartPS =%d\n", __func__, psmode, pwrpriv->smart_ps); + +#ifdef CONFIG_WOWLAN -+ if (psmode == PS_MODE_DTIM) /* For WOWLAN LPS, DTIM = (awake_intvl - 1) */ -+ { ++ if (psmode == PS_MODE_DTIM) { /* For WOWLAN LPS, DTIM = (awake_intvl - 1) */ + awake_intvl = 3;/* DTIM =2 */ + rlbm = 2; -+ } -+ else ++ } else +#endif /* CONFIG_WOWLAN */ + { + if (pwrpriv->dtim > 0 && pwrpriv->dtim < 16) @@ -65045,50 +63396,40 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + } + + -+ if (padapter->registrypriv.wifi_spec == 1) -+ { ++ if (padapter->registrypriv.wifi_spec == 1) { + awake_intvl = 2; + rlbm = 2; + } + -+ if (psmode > 0) -+ { -+ if (rtw_btcoex_IsBtControlLps(padapter) == true) -+ { ++ if (psmode > 0) { ++ if (rtw_btcoex_IsBtControlLps(padapter) == true) { + PowerState = rtw_btcoex_RpwmVal(padapter); + byte5 = rtw_btcoex_LpsVal(padapter); + -+ if ((rlbm == 2) && (byte5 & BIT(4))) -+ { ++ if ((rlbm == 2) && (byte5 & BIT(4))) { + /* Keep awake interval to 1 to prevent from */ + /* decreasing coex performance */ + awake_intvl = 2; + rlbm = 2; + } -+ } -+ else -+ { ++ } else { + PowerState = 0x00;/* AllON(0x0C), RFON(0x04), RFOFF(0x00) */ + byte5 = 0x40; + } -+ } -+ else -+ { ++ } else { + PowerState = 0x0C;/* AllON(0x0C), RFON(0x04), RFOFF(0x00) */ + byte5 = 0x40; + } + -+ SET_8723B_H2CCMD_PWRMODE_PARM_MODE(u1H2CPwrModeParm, (psmode>0)?1:0); ++ SET_8723B_H2CCMD_PWRMODE_PARM_MODE(u1H2CPwrModeParm, (psmode > 0) ? 1 : 0); + SET_8723B_H2CCMD_PWRMODE_PARM_SMART_PS(u1H2CPwrModeParm, pwrpriv->smart_ps); + SET_8723B_H2CCMD_PWRMODE_PARM_RLBM(u1H2CPwrModeParm, rlbm); + SET_8723B_H2CCMD_PWRMODE_PARM_BCN_PASS_TIME(u1H2CPwrModeParm, awake_intvl); + SET_8723B_H2CCMD_PWRMODE_PARM_ALL_QUEUE_UAPSD(u1H2CPwrModeParm, padapter->registrypriv.uapsd_enable); + SET_8723B_H2CCMD_PWRMODE_PARM_PWR_STATE(u1H2CPwrModeParm, PowerState); + SET_8723B_H2CCMD_PWRMODE_PARM_BYTE5(u1H2CPwrModeParm, byte5); -+ if (psmode != PS_MODE_ACTIVE) -+ { -+ if (pmlmeext ->adaptive_tsf_done == false && pmlmeext->bcn_cnt>0) -+ { ++ if (psmode != PS_MODE_ACTIVE) { ++ if (pmlmeext->adaptive_tsf_done == false && pmlmeext->bcn_cnt > 0) { + u8 ratio_20_delay, ratio_80_delay; + + /* byte 6 for adaptive_early_32k */ @@ -65101,24 +63442,27 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + + DBG_871X("%s(): bcn_cnt = %d\n", __func__, pmlmeext->bcn_cnt); + -+ for (i = 0; i<9; i++) -+ { -+ pmlmeext->bcn_delay_ratio[i] = (pmlmeext->bcn_delay_cnt[i] * 100) /pmlmeext->bcn_cnt; ++ for (i = 0; i < 9; i++) { ++ pmlmeext->bcn_delay_ratio[i] = (pmlmeext->bcn_delay_cnt[i]*100)/pmlmeext->bcn_cnt; + -+ DBG_871X("%s(): bcn_delay_cnt[%d]=%d, bcn_delay_ratio[%d] = %d\n", __func__, i, pmlmeext->bcn_delay_cnt[i] -+ , i , pmlmeext->bcn_delay_ratio[i]); ++ DBG_871X( ++ "%s(): bcn_delay_cnt[%d]=%d, bcn_delay_ratio[%d] = %d\n", ++ __func__, ++ i, ++ pmlmeext->bcn_delay_cnt[i], ++ i, ++ pmlmeext->bcn_delay_ratio[i] ++ ); + + ratio_20_delay += pmlmeext->bcn_delay_ratio[i]; + ratio_80_delay += pmlmeext->bcn_delay_ratio[i]; + -+ if (ratio_20_delay > 20 && pmlmeext->DrvBcnEarly == 0xff) -+ { ++ if (ratio_20_delay > 20 && pmlmeext->DrvBcnEarly == 0xff) { + pmlmeext->DrvBcnEarly = i; + DBG_871X("%s(): DrvBcnEarly = %d\n", __func__, pmlmeext->DrvBcnEarly); + } + -+ if (ratio_80_delay > 80 && pmlmeext->DrvBcnTimeOut == 0xff) -+ { ++ if (ratio_80_delay > 80 && pmlmeext->DrvBcnTimeOut == 0xff) { + pmlmeext->DrvBcnTimeOut = i; + DBG_871X("%s(): DrvBcnTimeOut = %d\n", __func__, pmlmeext->DrvBcnTimeOut); + } @@ -65130,11 +63474,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + } + + pmlmeext->bcn_cnt = 0; -+ pmlmeext ->adaptive_tsf_done = true; ++ pmlmeext->adaptive_tsf_done = true; + -+ } -+ else -+ { ++ } else { + DBG_871X("%s(): DrvBcnEarly = %d\n", __func__, pmlmeext->DrvBcnEarly); + DBG_871X("%s(): DrvBcnTimeOut = %d\n", __func__, pmlmeext->DrvBcnTimeOut); + } @@ -65158,7 +63500,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + +void rtl8723b_set_FwPsTuneParam_cmd(struct adapter *padapter) +{ -+ u8 u1H2CPsTuneParm[H2C_PSTUNEPARAM_LEN]={0}; ++ u8 u1H2CPsTuneParm[H2C_PSTUNEPARAM_LEN] = {0}; + u8 bcn_to_limit = 10; /* 10 * 100 * awakeinterval (ms) */ + u8 dtim_timeout = 5; /* ms wait broadcast data timer */ + u8 ps_timeout = 20; /* ms Keep awake when tx */ @@ -65190,7 +63532,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 +static void rtl8723b_set_FwWoWlanCtrl_Cmd(struct adapter *padapter, u8 bFuncEn) +{ + struct security_priv *psecpriv = &padapter->securitypriv; -+ u8 u1H2CWoWlanCtrlParm[H2C_WOWLAN_LEN]={0}; ++ u8 u1H2CWoWlanCtrlParm[H2C_WOWLAN_LEN] = {0}; + u8 discont_wake = 1, gpionum = 0, gpio_dur = 0, hw_unicast = 0; + u8 sdio_wakeup_enable = 1; + u8 gpio_high_active = 0; /* 0: low active, 1: high active */ @@ -65202,9 +63544,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 +#endif + +#ifdef CONFIG_PNO_SUPPORT -+ if (!ppwrpriv->wowlan_pno_enable) { ++ if (!ppwrpriv->wowlan_pno_enable) + magic_pkt = 1; -+ } +#endif + + if (psecpriv->dot11PrivacyAlgrthm == _WEP40_ || psecpriv->dot11PrivacyAlgrthm == _WEP104_) @@ -65232,8 +63573,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + +static void rtl8723b_set_FwRemoteWakeCtrl_Cmd(struct adapter *padapter, u8 benable) +{ -+ u8 u1H2CRemoteWakeCtrlParm[H2C_REMOTE_WAKE_CTRL_LEN]={0}; -+ struct security_priv* psecuritypriv =&(padapter->securitypriv); ++ u8 u1H2CRemoteWakeCtrlParm[H2C_REMOTE_WAKE_CTRL_LEN] = {0}; ++ struct security_priv *psecuritypriv = &(padapter->securitypriv); + struct pwrctrl_priv *ppwrpriv = adapter_to_pwrctl(padapter); + + DBG_871X("%s(): Enable =%d\n", __func__, benable); @@ -65285,7 +63626,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + +static void rtl8723b_set_FwAOACGlobalInfo_Cmd(struct adapter *padapter, u8 group_alg, u8 pairwise_alg) +{ -+ u8 u1H2CAOACGlobalInfoParm[H2C_AOAC_GLOBAL_INFO_LEN]={0}; ++ u8 u1H2CAOACGlobalInfoParm[H2C_AOAC_GLOBAL_INFO_LEN] = {0}; + + DBG_871X("%s(): group_alg =%d pairwise_alg =%d\n", __func__, group_alg, pairwise_alg); + @@ -65300,7 +63641,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 +#ifdef CONFIG_PNO_SUPPORT +static void rtl8723b_set_FwScanOffloadInfo_cmd(struct adapter *padapter, PRSVDPAGE_LOC rsvdpageloc, u8 enable) +{ -+ u8 u1H2CScanOffloadInfoParm[H2C_SCAN_OFFLOAD_CTRL_LEN]={0}; ++ u8 u1H2CScanOffloadInfoParm[H2C_SCAN_OFFLOAD_CTRL_LEN] = {0}; + u8 res = 0, count = 0; + struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); + @@ -65333,41 +63674,37 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + + rtl8723b_set_FwJoinBssRpt_cmd(padapter, RT_MEDIA_CONNECT); /* RT_MEDIA_CONNECT will confuse in the future */ + -+ if (!(ppwrpriv->wowlan_pno_enable)) -+ { ++ if (!(ppwrpriv->wowlan_pno_enable)) { + psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(pmlmepriv)); + if (psta != NULL) + rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_CONNECT, psta->mac_id); -+ } -+ else ++ } else + DBG_871X("%s(): Disconnected, no FwMediaStatusRpt CONNECT\n", __func__); + + msleep(2); + + if (!(ppwrpriv->wowlan_pno_enable)) { -+ rtl8723b_set_FwDisconDecision_cmd(padapter, enable); -+ msleep(2); ++ rtl8723b_set_FwDisconDecision_cmd(padapter, enable); ++ msleep(2); + + if ((psecpriv->dot11PrivacyAlgrthm != _WEP40_) || (psecpriv->dot11PrivacyAlgrthm != _WEP104_)) + pkt_type = 1; ++ + rtl8723b_set_FwKeepAlive_cmd(padapter, enable, pkt_type); -+ msleep(2); ++ msleep(2); + } + + rtl8723b_set_FwWoWlanCtrl_Cmd(padapter, enable); + msleep(2); + + rtl8723b_set_FwRemoteWakeCtrl_Cmd(padapter, enable); -+ } -+ else -+ { ++ } else { + rtl8723b_set_FwRemoteWakeCtrl_Cmd(padapter, enable); + msleep(2); + rtl8723b_set_FwWoWlanCtrl_Cmd(padapter, enable); + } + + DBG_871X_LEVEL(_drv_always_, "-%s()-\n", __func__); -+ return ; +} + +void rtl8723b_set_wowlan_cmd(struct adapter *padapter, u8 enable) @@ -65379,7 +63716,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 +#ifdef CONFIG_AP_WOWLAN +static void rtl8723b_set_FwAPWoWlanCtrl_Cmd(struct adapter *padapter, u8 bFuncEn) +{ -+ u8 u1H2CAPWoWlanCtrlParm[H2C_WOWLAN_LEN]={0}; ++ u8 u1H2CAPWoWlanCtrlParm[H2C_WOWLAN_LEN] = {0}; + u8 gpionum = 0, gpio_dur = 0; + u8 gpio_high_active = 1; /* 0: low active, 1: high active */ + u8 gpio_pulse = bFuncEn; @@ -65411,7 +63748,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + +static void rtl8723b_set_Fw_AP_Offload_Cmd(struct adapter *padapter, u8 bFuncEn) +{ -+ u8 u1H2CAPOffloadCtrlParm[H2C_WOWLAN_LEN]={0}; ++ u8 u1H2CAPOffloadCtrlParm[H2C_WOWLAN_LEN] = {0}; + + DBG_871X("%s(): bFuncEn =%d\n", __func__, bFuncEn); + @@ -65453,11 +63790,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 +/* true: At the second time, we should send the first packet (default:beacon) */ +/* to Hw again and set the lengh in descriptor to the real beacon lengh. */ +/* 2009.10.15 by tynli. */ -+static void rtl8723b_set_FwRsvdPagePkt(struct adapter *padapter, bool bDLFinished) ++static void rtl8723b_set_FwRsvdPagePkt( ++ struct adapter *padapter, bool bDLFinished ++) +{ + struct hal_com_data *pHalData; -+ struct xmit_frame *pcmdframe; -+ struct pkt_attrib *pattrib; ++ struct xmit_frame *pcmdframe; ++ struct pkt_attrib *pattrib; + struct xmit_priv *pxmitpriv; + struct mlme_ext_priv *pmlmeext; + struct mlme_ext_info *pmlmeinfo; @@ -65470,14 +63809,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + u8 TotalPageNum = 0, CurtPktPageNum = 0, RsvdPageNum = 0; + u16 BufIndex, PageSize = 128; + u32 TotalPacketLen, MaxRsvdPageBufSize = 0; -+ RSVDPAGE_LOC RsvdPageLoc; ++ RSVDPAGE_LOC RsvdPageLoc; +#ifdef CONFIG_WOWLAN + u32 ARPLegnth = 0, GTKLegnth = 0; + u8 currentip[4]; + u8 cur_dot11txpn[8]; +#ifdef CONFIG_GTK_OL + struct sta_priv *pstapriv = &padapter->stapriv; -+ struct sta_info * psta; ++ struct sta_info *psta; + u8 kek[RTW_KEK_LEN]; + u8 kck[RTW_KCK_LEN]; +#endif @@ -65512,9 +63851,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + CurtPktPageNum = (u8)PageNum_128(TxDescLen + BeaconLength); + /* If we don't add 1 more page, the WOWLAN function has a problem. Baron thinks it's a bug of firmware */ + if (CurtPktPageNum == 1) -+ { + CurtPktPageNum += 1; -+ } ++ + TotalPageNum += CurtPktPageNum; + + BufIndex += (CurtPktPageNum*PageSize); @@ -65540,7 +63878,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + &ReservedPagePacket[BufIndex], + &NullDataLength, + get_my_bssid(&pmlmeinfo->network), -+ false, 0, 0, false); ++ false, 0, 0, false ++ ); + rtl8723b_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], NullDataLength, false, false, false); + + /* DBG_871X("%s(): HW_VAR_SET_TX_CMD: NULL DATA %p %d\n", */ @@ -65559,7 +63898,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + &ReservedPagePacket[BufIndex], + &QosNullLength, + get_my_bssid(&pmlmeinfo->network), -+ true, 0, 0, false); ++ true, 0, 0, false ++ ); + rtl8723b_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], QosNullLength, false, false, false); + + /* DBG_871X("%s(): HW_VAR_SET_TX_CMD: QOS NULL DATA %p %d\n", */ @@ -65578,7 +63918,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + &ReservedPagePacket[BufIndex], + &BTQosNullLength, + get_my_bssid(&pmlmeinfo->network), -+ true, 0, 0, false); ++ true, 0, 0, false ++ ); + rtl8723b_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], BTQosNullLength, false, true, false); + + /* DBG_871X("%s(): HW_VAR_SET_TX_CMD: BT QOS NULL DATA %p %d\n", */ @@ -65633,14 +63974,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + + /* if the ap staion info. exists, get the kek, kck from staion info. */ + psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv)); -+ if (psta == NULL) -+ { ++ if (psta == NULL) { + memset(kek, 0, RTW_KEK_LEN); + memset(kck, 0, RTW_KCK_LEN); + DBG_8192C("%s, KEK, KCK download rsvd page all zero\n", __func__); -+ } -+ else -+ { ++ } else { + memcpy(kek, psta->kek, RTW_KEK_LEN); + memcpy(kck, psta->kck, RTW_KCK_LEN); + } @@ -65665,7 +64003,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + padapter, + &ReservedPagePacket[BufIndex], + >KLegnth -+ ); ++ ); + + rtl8723b_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], GTKLegnth, false, false, true); + /* DBG_871X("%s(): HW_VAR_SET_TX_CMD: GTK RSP %p %d\n", */ @@ -65708,9 +64046,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + { + int gj; + printk("probe req pkt =>\n"); -+ for (gj = 0; gj < ProbeReqLength + TxDescLen; gj++) { -+ printk(" %02x ", ReservedPagePacket[BufIndex- TxDescLen + gj]); -+ if ((gj + 1)%8 == 0) ++ for (gj = 0; gj < ProbeReqLength+TxDescLen; gj++) { ++ printk(" %02x ", ReservedPagePacket[BufIndex-TxDescLen+gj]); ++ if ((gj+1)%8 == 0) + printk("\n"); + } + printk(" <=end\n"); @@ -65725,13 +64063,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + + /* PNO INFO Page */ + RsvdPageLoc.LocPNOInfo = TotalPageNum; -+ ConstructPnoInfo(padapter, &ReservedPagePacket[BufIndex -TxDescLen], &PNOLength); ++ ConstructPnoInfo(padapter, &ReservedPagePacket[BufIndex-TxDescLen], &PNOLength); +#ifdef CONFIG_PNO_SET_DEBUG + { + int gj; + printk("PNO pkt =>\n"); + for (gj = 0; gj < PNOLength; gj++) { -+ printk(" %02x ", ReservedPagePacket[BufIndex-TxDescLen +gj]); ++ printk(" %02x ", ReservedPagePacket[BufIndex-TxDescLen+gj]); + if ((gj + 1)%8 == 0) + printk("\n"); + } @@ -65790,14 +64128,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 +#endif + } + -+ if (TotalPacketLen > MaxRsvdPageBufSize) -+ { ++ if (TotalPacketLen > MaxRsvdPageBufSize) { + DBG_871X("%s(): ERROR: The rsvd page size is not enough!!TotalPacketLen %d, MaxRsvdPageBufSize %d\n", __func__, + TotalPacketLen, MaxRsvdPageBufSize); + goto error; -+ } -+ else -+ { ++ } else { + /* update attribute */ + pattrib = &pcmdframe->attrib; + update_mgntframe_attrib(padapter, pattrib); @@ -65841,12 +64176,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 +/* true: At the second time, we should send the first packet (default:beacon) */ +/* to Hw again and set the lengh in descriptor to the real beacon lengh. */ +/* 2009.10.15 by tynli. */ -+static void rtl8723b_set_AP_FwRsvdPagePkt(struct adapter *padapter, -+ bool bDLFinished) ++static void rtl8723b_set_AP_FwRsvdPagePkt( ++ struct adapter *padapter, bool bDLFinished ++) +{ + struct hal_com_data *pHalData; -+ struct xmit_frame *pcmdframe; -+ struct pkt_attrib *pattrib; ++ struct xmit_frame *pcmdframe; ++ struct pkt_attrib *pattrib; + struct xmit_priv *pxmitpriv; + struct mlme_ext_priv *pmlmeext; + struct mlme_ext_info *pmlmeinfo; @@ -65858,7 +64194,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + u8 currentip[4]; + u16 BufIndex, PageSize = 128; + u32 TotalPacketLen = 0, MaxRsvdPageBufSize = 0; -+ RSVDPAGE_LOC RsvdPageLoc; ++ RSVDPAGE_LOC RsvdPageLoc; + + /* DBG_871X("%s---->\n", __func__); */ + DBG_8192C("+" FUNC_ADPT_FMT ": iface_type =%d\n", @@ -65891,9 +64227,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + CurtPktPageNum = (u8)PageNum_128(TxDescLen + BeaconLength); + /* If we don't add 1 more page, the WOWLAN function has a problem. Baron thinks it's a bug of firmware */ + if (CurtPktPageNum == 1) -+ { + CurtPktPageNum += 1; -+ } + TotalPageNum += CurtPktPageNum; + + BufIndex += (CurtPktPageNum*PageSize); @@ -65950,7 +64284,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 +} +#endif /* CONFIG_AP_WOWLAN */ + -+ void rtl8723b_download_rsvd_page(struct adapter *padapter, u8 mstatus) ++void rtl8723b_download_rsvd_page(struct adapter *padapter, u8 mstatus) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); +#ifdef CONFIG_AP_WOWLAN @@ -65958,7 +64292,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 +#endif + struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); + struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); -+ bool bcn_valid = false; ++ bool bcn_valid = false; + u8 DLBcnCount = 0; + u32 poll = 0; + u8 val8; @@ -65966,8 +64300,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + DBG_8192C("+" FUNC_ADPT_FMT ": iface_type =%d mstatus(%x)\n", + FUNC_ADPT_ARG(padapter), get_iface_type(padapter), mstatus); + -+ if (mstatus == RT_MEDIA_CONNECT) -+ { ++ if (mstatus == RT_MEDIA_CONNECT) { + bool bRecover = false; + u8 v8; + @@ -65978,7 +64311,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + /* set REG_CR bit 8 */ + v8 = rtw_read8(padapter, REG_CR+1); + v8 |= BIT(0); /* ENSWBCN */ -+ rtw_write8(padapter, REG_CR+1, v8); ++ rtw_write8(padapter, REG_CR+1, v8); + + /* Disable Hw protection for a time which revserd for Hw sending beacon. */ + /* Fix download reserved page packet fail that access collision with the protection time. */ @@ -66013,23 +64346,20 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + rtl8723b_set_FwRsvdPagePkt(padapter, 0); +#endif + DLBcnCount++; -+ do -+ { ++ do { + yield(); + /* mdelay(10); */ + /* check rsvd page download OK. */ + rtw_hal_get_hwreg(padapter, HW_VAR_BCN_VALID, (u8 *)(&bcn_valid)); + poll++; -+ } while (!bcn_valid && (poll%10)!= 0 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); ++ } while (!bcn_valid && (poll%10) != 0 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); + -+ }while (!bcn_valid && DLBcnCount<= 100 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); ++ } while (!bcn_valid && DLBcnCount <= 100 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); + -+ if (padapter->bSurpriseRemoved || padapter->bDriverStopped) -+ { -+ } -+ else if (!bcn_valid) ++ if (padapter->bSurpriseRemoved || padapter->bDriverStopped) { ++ } else if (!bcn_valid) + DBG_871X(ADPT_FMT": 1 DL RSVD page failed! DLBcnCount:%u, poll:%u\n", -+ ADPT_ARG(padapter) , DLBcnCount, poll); ++ ADPT_ARG(padapter), DLBcnCount, poll); + else { + struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); + pwrctl->fw_psmode_iface_id = padapter->iface_id; @@ -66048,8 +64378,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + /* prevent from setting 0x422[6] to 0 after download reserved page, or it will cause */ + /* the beacon cannot be sent by HW. */ + /* 2010.06.23. Added by tynli. */ -+ if (bRecover) -+ { ++ if (bRecover) { + rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, pHalData->RegFwHwTxQCtrl | BIT(6)); + pHalData->RegFwHwTxQCtrl |= BIT(6); + } @@ -66076,7 +64405,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 +/* arg[1] = raid */ +/* arg[2] = shortGIrate */ +/* arg[3] = init_rate */ -+void rtl8723b_Add_RateATid(struct adapter *padapter, u32 bitmap, u8 *arg, u8 rssi_level) ++void rtl8723b_Add_RateATid( ++ struct adapter *padapter, ++ u32 bitmap, ++ u8 *arg, ++ u8 rssi_level ++) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -66090,9 +64424,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + + psta = pmlmeinfo->FW_sta_info[mac_id].psta; + if (psta == NULL) -+ { + return; -+ } + + bw = psta->bw_mode; + @@ -66111,7 +64443,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + u8 bQoS, + u8 AC, + u8 bEosp, -+ u8 bForcePowerSave) ++ u8 bForcePowerSave ++) +{ + struct ieee80211_hdr *pwlanhdr; + __le16 *fctrl; @@ -66124,12 +64457,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + DBG_871X("+" FUNC_ADPT_FMT ": qos =%d eosp =%d ps =%d\n", + FUNC_ADPT_ARG(padapter), bQoS, bEosp, bForcePowerSave); + -+ pwlanhdr = (struct ieee80211_hdr*)pframe; ++ pwlanhdr = (struct ieee80211_hdr *)pframe; + pmlmeext = &padapter->mlmeextpriv; + pmlmeinfo = &pmlmeext->mlmext_info; + -+ if (NULL == StaAddr) -+ { ++ if (NULL == StaAddr) { + memcpy(bssid, myid(&padapter->eeprompriv), ETH_ALEN); + StaAddr = bssid; + } @@ -66147,20 +64479,17 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + SetDuration(pwlanhdr, 0); + SetSeqNum(pwlanhdr, 0); + -+ if (bQoS == true) -+ { ++ if (bQoS == true) { + struct ieee80211_qos_hdr *pwlanqoshdr; + + SetFrameSubType(pframe, WIFI_QOS_DATA_NULL); + -+ pwlanqoshdr = (struct ieee80211_qos_hdr*)pframe; ++ pwlanqoshdr = (struct ieee80211_qos_hdr *)pframe; + SetPriority(&pwlanqoshdr->qos_ctrl, AC); + SetEOSP(&pwlanqoshdr->qos_ctrl, bEosp); + + pktlen = sizeof(struct ieee80211_qos_hdr); -+ } -+ else -+ { ++ } else { + SetFrameSubType(pframe, WIFI_DATA_NULL); + + pktlen = sizeof(struct ieee80211_hdr_3addr); @@ -66218,16 +64547,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + CurtPktPageNum = (u8)PageNum_128(TxDescLen + BeaconLength); + /* If we don't add 1 more page, the WOWLAN function has a problem. Baron thinks it's a bug of firmware */ + if (CurtPktPageNum == 1) -+ { + CurtPktPageNum += 1; -+ } + TotalPageNum += CurtPktPageNum; + + BufIndex += (CurtPktPageNum*PageSize); + + /* Jump to lastest page */ -+ if (BufIndex < (MaxRsvdPageBufSize - PageSize)) -+ { ++ if (BufIndex < (MaxRsvdPageBufSize - PageSize)) { + BufIndex = TxDescOffset + (MaxRsvdPageBufSize - PageSize); + TotalPageNum = BCNQ_PAGE_NUM_8723B - 1; + } @@ -66239,7 +64565,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + &ReservedPagePacket[BufIndex], + &BTQosNullLength, + NULL, -+ true, 0, 0, false); ++ true, 0, 0, false ++ ); + rtl8723b_fill_fake_txdesc(padapter, &ReservedPagePacket[BufIndex-TxDescLen], BTQosNullLength, false, true, false); + + CurtPktPageNum = (u8)PageNum_128(TxDescLen + BTQosNullLength); @@ -66247,8 +64574,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + TotalPageNum += CurtPktPageNum; + + TotalPacketLen = BufIndex + BTQosNullLength; -+ if (TotalPacketLen > MaxRsvdPageBufSize) -+ { ++ if (TotalPacketLen > MaxRsvdPageBufSize) { + DBG_8192C(FUNC_ADPT_FMT ": ERROR: The rsvd page size is not enough!!TotalPacketLen %d, MaxRsvdPageBufSize %d\n", + FUNC_ADPT_ARG(padapter), TotalPacketLen, MaxRsvdPageBufSize); + goto error; @@ -66288,8 +64614,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + FUNC_ADPT_ARG(padapter), get_iface_type(padapter), get_fwstate(&padapter->mlmepriv)); + +#ifdef CONFIG_DEBUG -+ if (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == false) -+ { ++ if (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == false) { + DBG_8192C(FUNC_ADPT_FMT ": [WARNING] not in AP mode!!\n", + FUNC_ADPT_ARG(padapter)); + } @@ -66339,18 +64664,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + /* check rsvd page download OK. */ + rtw_hal_get_hwreg(padapter, HW_VAR_BCN_VALID, &bcn_valid); + poll++; -+ } while (!bcn_valid && (poll%10)!= 0 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); -+ } while (!bcn_valid && (DLBcnCount<= 100) && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); ++ } while (!bcn_valid && (poll%10) != 0 && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); ++ } while (!bcn_valid && (DLBcnCount <= 100) && !padapter->bSurpriseRemoved && !padapter->bDriverStopped); + -+ if (true == bcn_valid) -+ { ++ if (true == bcn_valid) { + struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter); + pwrctl->fw_psmode_iface_id = padapter->iface_id; + DBG_8192C(ADPT_FMT": DL RSVD page success! DLBcnCount:%d, poll:%d\n", + ADPT_ARG(padapter), DLBcnCount, poll); -+ } -+ else -+ { ++ } else { + DBG_8192C(ADPT_FMT": DL RSVD page fail! DLBcnCount:%d, poll:%d\n", + ADPT_ARG(padapter), DLBcnCount, poll); + DBG_8192C(ADPT_FMT": DL RSVD page fail! bSurpriseRemoved =%d\n", @@ -66370,8 +64692,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + /* prevent from setting 0x422[6] to 0 after download reserved page, or it will cause */ + /* the beacon cannot be sent by HW. */ + /* 2010.06.23. Added by tynli. */ -+ if (bRecover) -+ { ++ if (bRecover) { + pHalData->RegFwHwTxQCtrl |= BIT(6); + rtw_write8(padapter, REG_FWHW_TXQ_CTRL+2, pHalData->RegFwHwTxQCtrl); + } @@ -66381,10 +64702,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_cmd.c linux-4.3-rtl8723bs/3 + val8 &= ~BIT(0); /* ~ENSWBCN */ + rtw_write8(padapter, REG_CR+1, val8); +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_dm.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/rtl8723b_dm.c ---- linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_dm.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/rtl8723b_dm.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,314 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/rtl8723b_dm.c linux/3rdparty/rtl8723bs/hal/rtl8723b_dm.c +--- linux.old/3rdparty/rtl8723bs/hal/rtl8723b_dm.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/rtl8723b_dm.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,300 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. @@ -66410,10 +64731,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_dm.c linux-4.3-rtl8723bs/3r + +/* Global var */ + -+static void -+dm_CheckStatistics( -+struct adapter *Adapter -+ ) ++static void dm_CheckStatistics(struct adapter *Adapter) +{ +} +/* */ @@ -66423,7 +64741,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_dm.c linux-4.3-rtl8723bs/3r +{ + + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); -+ PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); ++ PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + u8 cut_ver, fab_ver; + @@ -66454,17 +64772,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_dm.c linux-4.3-rtl8723bs/3r + + if (pHalData->rf_type == RF_1T1R) { + ODM_CmnInfoUpdate(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_1T1R); -+ } -+ else if (pHalData->rf_type == RF_2T2R) { ++ } else if (pHalData->rf_type == RF_2T2R) { + ODM_CmnInfoUpdate(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_2T2R); -+ } -+ else if (pHalData->rf_type == RF_1T2R) { ++ } else if (pHalData->rf_type == RF_1T2R) { + ODM_CmnInfoUpdate(pDM_Odm, ODM_CMNINFO_RF_TYPE, ODM_1T2R); + } + -+ pdmpriv->InitODMFlag = ODM_RF_CALIBRATION | -+ ODM_RF_TX_PWR_TRACK /* */ -+ ; ++ pdmpriv->InitODMFlag = ODM_RF_CALIBRATION|ODM_RF_TX_PWR_TRACK; + + ODM_CmnInfoUpdate(pDM_Odm, ODM_CMNINFO_ABILITY, pdmpriv->InitODMFlag); +} @@ -66472,11 +64786,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_dm.c linux-4.3-rtl8723bs/3r +static void Update_ODM_ComInfo_8723b(struct adapter *Adapter) +{ + struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv; -+ struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; ++ struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; + struct dvobj_priv *dvobj = adapter_to_dvobj(Adapter); + struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(Adapter); + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); -+ PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); ++ PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); + struct dm_priv *pdmpriv = &pHalData->dmpriv; + int i; + u8 zero = 0; @@ -66506,35 +64820,32 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_dm.c linux-4.3-rtl8723bs/3r + + ODM_CmnInfoUpdate(pDM_Odm, ODM_CMNINFO_ABILITY, pdmpriv->InitODMFlag); + -+ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_TX_UNI,&(dvobj->traffic_stat.tx_bytes)); -+ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_RX_UNI,&(dvobj->traffic_stat.rx_bytes)); -+ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_WM_MODE,&(pmlmeext->cur_wireless_mode)); -+ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_SEC_CHNL_OFFSET,&(pHalData->nCur40MhzPrimeSC)); -+ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_SEC_MODE,&(Adapter->securitypriv.dot11PrivacyAlgrthm)); -+ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_BW,&(pHalData->CurrentChannelBW)); -+ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_CHNL,&(pHalData->CurrentChannel)); -+ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_NET_CLOSED,&(Adapter->net_closed)); ++ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_TX_UNI, &(dvobj->traffic_stat.tx_bytes)); ++ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_RX_UNI, &(dvobj->traffic_stat.rx_bytes)); ++ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_WM_MODE, &(pmlmeext->cur_wireless_mode)); ++ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_SEC_CHNL_OFFSET, &(pHalData->nCur40MhzPrimeSC)); ++ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_SEC_MODE, &(Adapter->securitypriv.dot11PrivacyAlgrthm)); ++ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_BW, &(pHalData->CurrentChannelBW)); ++ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_CHNL, &(pHalData->CurrentChannel)); ++ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_NET_CLOSED, &(Adapter->net_closed)); + ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_MP_MODE, &zero); -+ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_BAND,&(pHalData->CurrentBandType)); -+ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_FORCED_IGI_LB,&(pHalData->u1ForcedIgiLb)); -+ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_FORCED_RATE,&(pHalData->ForcedDataRate)); ++ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_BAND, &(pHalData->CurrentBandType)); ++ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_FORCED_IGI_LB, &(pHalData->u1ForcedIgiLb)); ++ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_FORCED_RATE, &(pHalData->ForcedDataRate)); + -+ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_SCAN,&(pmlmepriv->bScanInProcess)); -+ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_POWER_SAVING,&(pwrctrlpriv->bpower_saving)); ++ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_SCAN, &(pmlmepriv->bScanInProcess)); ++ ODM_CmnInfoHook(pDM_Odm, ODM_CMNINFO_POWER_SAVING, &(pwrctrlpriv->bpower_saving)); + + + for (i = 0; i < NUM_STA; i++) + ODM_CmnInfoPtrArrayHook(pDM_Odm, ODM_CMNINFO_STA_STATUS, i, NULL); +} + -+void -+rtl8723b_InitHalDm( -+struct adapter *Adapter -+ ) ++void rtl8723b_InitHalDm(struct adapter *Adapter) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; -+ PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); ++ PDM_ODM_T pDM_Odm = &(pHalData->odmpriv); + + pdmpriv->DM_Type = DM_Type_ByDriver; + pdmpriv->DMFlag = DYNAMIC_FUNC_DISABLE; @@ -66548,13 +64859,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_dm.c linux-4.3-rtl8723bs/3r + ODM_DMInit(pDM_Odm); +} + -+void -+rtl8723b_HalDmWatchDog( -+struct adapter *Adapter -+ ) ++void rtl8723b_HalDmWatchDog(struct adapter *Adapter) +{ -+ bool bFwCurrentInPSMode = false; -+ bool bFwPSAwake = true; ++ bool bFwCurrentInPSMode = false; ++ bool bFwPSAwake = true; + u8 hw_init_completed = false; + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + @@ -66566,9 +64874,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_dm.c linux-4.3-rtl8723bs/3r + bFwCurrentInPSMode = adapter_to_pwrctl(Adapter)->bFwCurrentInPSMode; + rtw_hal_get_hwreg(Adapter, HW_VAR_FWLPS_RF_ON, (u8 *)(&bFwPSAwake)); + -+ if ((hw_init_completed == true) -+ && ((!bFwCurrentInPSMode) && bFwPSAwake)) -+ { ++ if ( ++ (hw_init_completed == true) && ++ ((!bFwCurrentInPSMode) && bFwPSAwake) ++ ) { + /* */ + /* Calculate Tx/Rx statistics. */ + /* */ @@ -66577,10 +64886,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_dm.c linux-4.3-rtl8723bs/3r + } + + /* ODM */ -+ if (hw_init_completed == true) -+ { -+ u8 bLinked =false; -+ u8 bsta_state =false; ++ if (hw_init_completed == true) { ++ u8 bLinked = false; ++ u8 bsta_state = false; + u8 bBtDisabled = true; + + if (rtw_linked_check(Adapter)) { @@ -66589,8 +64897,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_dm.c linux-4.3-rtl8723bs/3r + bsta_state = true; + } + -+ ODM_CmnInfoUpdate(&pHalData->odmpriv , ODM_CMNINFO_LINK, bLinked); -+ ODM_CmnInfoUpdate(&pHalData->odmpriv , ODM_CMNINFO_STATION_STATE, bsta_state); ++ ODM_CmnInfoUpdate(&pHalData->odmpriv, ODM_CMNINFO_LINK, bLinked); ++ ODM_CmnInfoUpdate(&pHalData->odmpriv, ODM_CMNINFO_STATION_STATE, bsta_state); + + /* ODM_CmnInfoUpdate(&pHalData->odmpriv , ODM_CMNINFO_RSSI_MIN, pdmpriv->MinUndecoratedPWDBForDM); */ + @@ -66610,7 +64918,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_dm.c linux-4.3-rtl8723bs/3r + u32 PWDB_rssi = 0; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; ++ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; + struct sta_priv *pstapriv = &padapter->stapriv; + struct sta_info *psta = NULL; + @@ -66622,8 +64930,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_dm.c linux-4.3-rtl8723bs/3r + + /* set rssi to fw */ + psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv)); -+ if (psta && (psta->rssi_stat.UndecoratedSmoothedPWDB > 0)) -+ { ++ if (psta && (psta->rssi_stat.UndecoratedSmoothedPWDB > 0)) { + PWDB_rssi = (psta->mac_id | (psta->rssi_stat.UndecoratedSmoothedPWDB<<16)); + + rtl8723b_set_rssi_cmd(padapter, (u8 *)&PWDB_rssi); @@ -66633,12 +64940,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_dm.c linux-4.3-rtl8723bs/3r + +void rtl8723b_HalDmWatchDog_in_LPS(struct adapter *Adapter) +{ -+ u8 bLinked =false; ++ u8 bLinked = false; + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + struct mlme_priv *pmlmepriv = &Adapter->mlmepriv; + struct dm_priv *pdmpriv = &pHalData->dmpriv; -+ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; -+ pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; ++ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; ++ pDIG_T pDM_DigTable = &pDM_Odm->DM_DigTable; + struct sta_priv *pstapriv = &Adapter->stapriv; + struct sta_info *psta = NULL; + @@ -66649,7 +64956,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_dm.c linux-4.3-rtl8723bs/3r + if (rtw_linked_check(Adapter)) + bLinked = true; + -+ ODM_CmnInfoUpdate(&pHalData->odmpriv , ODM_CMNINFO_LINK, bLinked); ++ ODM_CmnInfoUpdate(&pHalData->odmpriv, ODM_CMNINFO_LINK, bLinked); + + if (bLinked == false) + goto skip_lps_dm; @@ -66678,12 +64985,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_dm.c linux-4.3-rtl8723bs/3r + pDM_Odm->RSSI_Min = pdmpriv->MinUndecoratedPWDBForDM; + + /* if (pDM_DigTable->CurIGValue != pDM_Odm->RSSI_Min) */ -+ if ((pDM_DigTable->CurIGValue > pDM_Odm->RSSI_Min + 5) || -+ (pDM_DigTable->CurIGValue < pDM_Odm->RSSI_Min - 5)) -+ -+ { ++ if ( ++ (pDM_DigTable->CurIGValue > pDM_Odm->RSSI_Min + 5) || ++ (pDM_DigTable->CurIGValue < pDM_Odm->RSSI_Min - 5) ++ ) + rtw_dm_in_lps_wk_cmd(Adapter); -+ } + + +skip_lps_dm: @@ -66692,17 +64998,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_dm.c linux-4.3-rtl8723bs/3r + +} + -+void rtl8723b_init_dm_priv(struct adapter * Adapter) ++void rtl8723b_init_dm_priv(struct adapter *Adapter) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + struct dm_priv *pdmpriv = &pHalData->dmpriv; ++ + memset(pdmpriv, 0, sizeof(struct dm_priv)); + Init_ODM_ComInfo_8723b(Adapter); +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c ---- linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,4844 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c +--- linux.old/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,4546 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2013 Realtek Corporation. All rights reserved. @@ -66726,16 +65033,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 +#include +#include "hal_com_h2c.h" + -+static void -+_FWDownloadEnable( -+struct adapter * padapter, -+bool enable -+ ) ++static void _FWDownloadEnable(struct adapter *padapter, bool enable) +{ + u8 tmp, count = 0; + -+ if (enable) -+ { ++ if (enable) { + /* 8051 enable */ + tmp = rtw_read8(padapter, REG_SYS_FUNC_EN+1); + rtw_write8(padapter, REG_SYS_FUNC_EN+1, tmp|0x04); @@ -66743,44 +65045,38 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + tmp = rtw_read8(padapter, REG_MCUFWDL); + rtw_write8(padapter, REG_MCUFWDL, tmp|0x01); + -+ do{ ++ do { + tmp = rtw_read8(padapter, REG_MCUFWDL); + if (tmp & 0x01) + break; + rtw_write8(padapter, REG_MCUFWDL, tmp|0x01); + msleep(1); -+ }while (count++<100); ++ } while (count++ < 100); ++ + if (count > 0) + DBG_871X("%s: !!!!!!!!Write 0x80 Fail!: count = %d\n", __func__, count); + + /* 8051 reset */ + tmp = rtw_read8(padapter, REG_MCUFWDL+2); + rtw_write8(padapter, REG_MCUFWDL+2, tmp&0xf7); -+ } -+ else -+ { ++ } else { + /* MCU firmware download disable. */ + tmp = rtw_read8(padapter, REG_MCUFWDL); + rtw_write8(padapter, REG_MCUFWDL, tmp&0xfe); + } +} + -+static int -+_BlockWrite( -+ struct adapter * padapter, -+ void * buffer, -+ u32 buffSize -+ ) ++static int _BlockWrite(struct adapter *padapter, void *buffer, u32 buffSize) +{ + int ret = _SUCCESS; + -+ u32 blockSize_p1 = 4; /* (Default) Phase #1 : PCI muse use 4-byte write to download FW */ -+ u32 blockSize_p2 = 8; /* Phase #2 : Use 8-byte, if Phase#1 use big size to write FW. */ -+ u32 blockSize_p3 = 1; /* Phase #3 : Use 1-byte, the remnant of FW image. */ -+ u32 blockCount_p1 = 0, blockCount_p2 = 0, blockCount_p3 = 0; -+ u32 remainSize_p1 = 0, remainSize_p2 = 0; -+ u8 *bufferPtr = (u8 *)buffer; -+ u32 i = 0, offset = 0; ++ u32 blockSize_p1 = 4; /* (Default) Phase #1 : PCI muse use 4-byte write to download FW */ ++ u32 blockSize_p2 = 8; /* Phase #2 : Use 8-byte, if Phase#1 use big size to write FW. */ ++ u32 blockSize_p3 = 1; /* Phase #3 : Use 1-byte, the remnant of FW image. */ ++ u32 blockCount_p1 = 0, blockCount_p2 = 0, blockCount_p3 = 0; ++ u32 remainSize_p1 = 0, remainSize_p2 = 0; ++ u8 *bufferPtr = (u8 *)buffer; ++ u32 i = 0, offset = 0; + +/* printk("====>%s %d\n", __func__, __LINE__); */ + @@ -66789,14 +65085,21 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + remainSize_p1 = buffSize % blockSize_p1; + + if (blockCount_p1) { -+ RT_TRACE(_module_hal_init_c_, _drv_notice_, -+ ("_BlockWrite: [P1] buffSize(%d) blockSize_p1(%d) blockCount_p1(%d) remainSize_p1(%d)\n", -+ buffSize, blockSize_p1, blockCount_p1, remainSize_p1)); ++ RT_TRACE( ++ _module_hal_init_c_, ++ _drv_notice_, ++ ( ++ "_BlockWrite: [P1] buffSize(%d) blockSize_p1(%d) blockCount_p1(%d) remainSize_p1(%d)\n", ++ buffSize, ++ blockSize_p1, ++ blockCount_p1, ++ remainSize_p1 ++ ) ++ ); + } + -+ for (i = 0; i < blockCount_p1; i++) -+ { -+ ret = rtw_write32(padapter, (FW_8723B_START_ADDRESS + i * blockSize_p1), *((u32*)(bufferPtr + i * blockSize_p1))); ++ for (i = 0; i < blockCount_p1; i++) { ++ ret = rtw_write32(padapter, (FW_8723B_START_ADDRESS + i * blockSize_p1), *((u32 *)(bufferPtr + i * blockSize_p1))); + if (ret == _FAIL) { + printk("====>%s %d i:%d\n", __func__, __LINE__, i); + goto exit; @@ -66804,24 +65107,30 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + } + + /* 3 Phase #2 */ -+ if (remainSize_p1) -+ { ++ if (remainSize_p1) { + offset = blockCount_p1 * blockSize_p1; + + blockCount_p2 = remainSize_p1/blockSize_p2; + remainSize_p2 = remainSize_p1%blockSize_p2; + + if (blockCount_p2) { -+ RT_TRACE(_module_hal_init_c_, _drv_notice_, -+ ("_BlockWrite: [P2] buffSize_p2(%d) blockSize_p2(%d) blockCount_p2(%d) remainSize_p2(%d)\n", -+ (buffSize-offset), blockSize_p2 , blockCount_p2, remainSize_p2)); ++ RT_TRACE( ++ _module_hal_init_c_, ++ _drv_notice_, ++ ( ++ "_BlockWrite: [P2] buffSize_p2(%d) blockSize_p2(%d) blockCount_p2(%d) remainSize_p2(%d)\n", ++ (buffSize-offset), ++ blockSize_p2, ++ blockCount_p2, ++ remainSize_p2 ++ ) ++ ); + } + + } + + /* 3 Phase #3 */ -+ if (remainSize_p2) -+ { ++ if (remainSize_p2) { + offset = (blockCount_p1 * blockSize_p1) + (blockCount_p2 * blockSize_p2); + + blockCount_p3 = remainSize_p2 / blockSize_p3; @@ -66830,7 +65139,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + ("_BlockWrite: [P3] buffSize_p3(%d) blockSize_p3(%d) blockCount_p3(%d)\n", + (buffSize-offset), blockSize_p3, blockCount_p3)); + -+ for (i = 0 ; i < blockCount_p3 ; i++) { ++ for (i = 0; i < blockCount_p3; i++) { + ret = rtw_write8(padapter, (FW_8723B_START_ADDRESS + offset + i), *(bufferPtr + offset + i)); + + if (ret == _FAIL) { @@ -66843,38 +65152,32 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + return ret; +} + -+static int -+_PageWrite( ++static int _PageWrite( + struct adapter *padapter, -+ u32 page, -+ void * buffer, -+ u32 size -+ ) ++ u32 page, ++ void *buffer, ++ u32 size ++) +{ + u8 value8; -+ u8 u8Page = (u8) (page & 0x07) ; ++ u8 u8Page = (u8) (page & 0x07); + -+ value8 = (rtw_read8(padapter, REG_MCUFWDL+2) & 0xF8) | u8Page ; ++ value8 = (rtw_read8(padapter, REG_MCUFWDL+2) & 0xF8) | u8Page; + rtw_write8(padapter, REG_MCUFWDL+2, value8); + + return _BlockWrite(padapter, buffer, size); +} + -+static int -+_WriteFW( -+ struct adapter * padapter, -+ void * buffer, -+ u32 size -+ ) ++static int _WriteFW(struct adapter *padapter, void *buffer, u32 size) +{ + /* Since we need dynamic decide method of dwonload fw, so we call this function to get chip version. */ + /* We can remove _ReadChipVersion from ReadpadapterInfo8192C later. */ + int ret = _SUCCESS; -+ u32 pageNums, remainSize ; ++ u32 pageNums, remainSize; + u32 page, offset; + u8 *bufferPtr = (u8 *)buffer; + -+ pageNums = size / MAX_DLFW_PAGE_SIZE ; ++ pageNums = size / MAX_DLFW_PAGE_SIZE; + /* RT_ASSERT((pageNums <= 4), ("Page numbers should not greater then 4\n")); */ + remainSize = size % MAX_DLFW_PAGE_SIZE; + @@ -66887,6 +65190,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + goto exit; + } + } ++ + if (remainSize) { + offset = pageNums * MAX_DLFW_PAGE_SIZE; + page = pageNums; @@ -66933,7 +65237,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + DBG_8192C("%s: Finish\n", __func__); +} + -+static s32 polling_fwdl_chksum(struct adapter *adapter, u32 min_cnt, u32 timeout_ms) ++static s32 polling_fwdl_chksum( ++ struct adapter *adapter, u32 min_cnt, u32 timeout_ms ++) +{ + s32 ret = _FAIL; + u32 value32; @@ -66947,7 +65253,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + if (value32 & FWDL_ChkSum_rpt || adapter->bSurpriseRemoved || adapter->bDriverStopped) + break; + yield(); -+ } while (jiffies_to_msecs(jiffies - start) < timeout_ms || cnt < min_cnt); ++ } while (jiffies_to_msecs(jiffies-start) < timeout_ms || cnt < min_cnt); + + if (!(value32 & FWDL_ChkSum_rpt)) { + goto exit; @@ -66962,8 +65268,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + ret = _SUCCESS; + +exit: -+ DBG_871X("%s: Checksum report %s! (%u, %dms), REG_MCUFWDL:0x%08x\n", __func__ -+ , (ret == _SUCCESS)?"OK":"Fail", cnt, jiffies_to_msecs(jiffies - start), value32); ++ DBG_871X( ++ "%s: Checksum report %s! (%u, %dms), REG_MCUFWDL:0x%08x\n", ++ __func__, ++ (ret == _SUCCESS) ? "OK" : "Fail", ++ cnt, ++ jiffies_to_msecs(jiffies-start), ++ value32 ++ ); + + return ret; +} @@ -67004,8 +65316,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + ret = _SUCCESS; + +exit: -+ DBG_871X("%s: Polling FW ready %s! (%u, %dms), REG_MCUFWDL:0x%08x\n", __func__ -+ , (ret == _SUCCESS)?"OK":"Fail", cnt, jiffies_to_msecs(jiffies - start), value32); ++ DBG_871X( ++ "%s: Polling FW ready %s! (%u, %dms), REG_MCUFWDL:0x%08x\n", ++ __func__, ++ (ret == _SUCCESS) ? "OK" : "Fail", ++ cnt, ++ jiffies_to_msecs(jiffies-start), ++ value32 ++ ); + + return ret; +} @@ -67014,21 +65332,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + +void rtl8723b_FirmwareSelfReset(struct adapter *padapter) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); ++ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + u8 u1bTmp; + u8 Delay = 100; + -+ if (!(IS_FW_81xxC(padapter) && -+ ((pHalData->FirmwareVersion < 0x21) || -+ (pHalData->FirmwareVersion == 0x21 && -+ pHalData->FirmwareSubVersion < 0x01)))) /* after 88C Fw v33.1 */ -+ { ++ if ( ++ !(IS_FW_81xxC(padapter) && ((pHalData->FirmwareVersion < 0x21) || (pHalData->FirmwareVersion == 0x21 && pHalData->FirmwareSubVersion < 0x01))) ++ ) { /* after 88C Fw v33.1 */ + /* 0x1cf = 0x20. Inform 8051 to reset. 2009.12.25. tynli_test */ + rtw_write8(padapter, REG_HMETFR+3, 0x20); + + u1bTmp = rtw_read8(padapter, REG_SYS_FUNC_EN+1); -+ while (u1bTmp & BIT2) -+ { ++ while (u1bTmp & BIT2) { + Delay--; + if (Delay == 0) + break; @@ -67037,8 +65352,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + } + RT_TRACE(_module_hal_init_c_, _drv_notice_, ("-%s: 8051 reset success (%d)\n", __func__, Delay)); + -+ if (Delay == 0) -+ { ++ if (Delay == 0) { + RT_TRACE(_module_hal_init_c_, _drv_notice_, ("%s: Force 8051 reset!!!\n", __func__)); + /* force firmware reset */ + u1bTmp = rtw_read8(padapter, REG_SYS_FUNC_EN+1); @@ -67054,15 +65368,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 +/* */ +s32 rtl8723b_FirmwareDownload(struct adapter *padapter, bool bUsedWoWLANFw) +{ -+ s32 rtStatus = _SUCCESS; ++ s32 rtStatus = _SUCCESS; + u8 write_fw = 0; + unsigned long fwdl_start_time; + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + struct rt_firmware *pFirmware; + struct rt_firmware *pBTFirmware; + struct rt_firmware_hdr *pFwHdr = NULL; -+ u8 *pFirmwareBuf; -+ u32 FirmwareLen; ++ u8 *pFirmwareBuf; ++ u32 FirmwareLen; + const struct firmware *fw; + struct device *device = dvobj_to_dev(padapter->dvobj); + u8 *fwfilepath; @@ -67077,7 +65391,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + pFirmware = kzalloc(sizeof(struct rt_firmware), GFP_KERNEL); + pBTFirmware = kzalloc(sizeof(struct rt_firmware), GFP_KERNEL); + -+ if (!pFirmware||!pBTFirmware) { ++ if (!pFirmware || !pBTFirmware) { + rtStatus = _FAIL; + goto exit; + } @@ -67094,6 +65408,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + DBG_871X(FUNC_ADPT_FMT" tmp_ps =%x\n", FUNC_ADPT_ARG(padapter), tmp_ps); + pdbgpriv->dbg_downloadfw_pwr_state_cnt++; + } ++ +#ifdef CONFIG_WOWLAN + if (bUsedWoWLANFw) + fwfilepath = "rtlwifi/rtl8723bs_wowlan.bin"; @@ -67109,23 +65424,29 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + rtStatus = _FAIL; + goto exit; + } ++ + if (!fw) { + pr_err("Firmware %s not available\n", fwfilepath); + rtStatus = _FAIL; + goto exit; + } ++ + if (fw->size > FW_8723B_SIZE) { + rtStatus = _FAIL; -+ RT_TRACE(_module_hal_init_c_, _drv_err_, -+ ("Firmware size exceed 0x%X. Check it.\n", -+ FW_8188E_SIZE)); ++ RT_TRACE( ++ _module_hal_init_c_, ++ _drv_err_, ++ ("Firmware size exceed 0x%X. Check it.\n", FW_8188E_SIZE) ++ ); + goto exit; + } ++ + pFirmware->szFwBuffer = kzalloc(fw->size, GFP_KERNEL); -+ if (! pFirmware->szFwBuffer) { ++ if (!pFirmware->szFwBuffer) { + rtStatus = _FAIL; + goto exit; -+ } ++ } ++ + memcpy(pFirmware->szFwBuffer, fw->data, fw->size); + pFirmware->ulFwLength = fw->size; + release_firmware(fw); @@ -67145,12 +65466,19 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + pHalData->FirmwareSubVersion = le16_to_cpu(pFwHdr->Subversion); + pHalData->FirmwareSignature = le16_to_cpu(pFwHdr->Signature); + -+ DBG_871X("%s: fw_ver =%x fw_subver =%04x sig = 0x%x, Month =%02x, Date =%02x, Hour =%02x, Minute =%02x\n", -+ __func__, pHalData->FirmwareVersion, pHalData->FirmwareSubVersion, pHalData->FirmwareSignature -+ , pFwHdr->Month, pFwHdr->Date, pFwHdr->Hour, pFwHdr->Minute); ++ DBG_871X( ++ "%s: fw_ver =%x fw_subver =%04x sig = 0x%x, Month =%02x, Date =%02x, Hour =%02x, Minute =%02x\n", ++ __func__, ++ pHalData->FirmwareVersion, ++ pHalData->FirmwareSubVersion, ++ pHalData->FirmwareSignature, ++ pFwHdr->Month, ++ pFwHdr->Date, ++ pFwHdr->Hour, ++ pFwHdr->Minute ++ ); + -+ if (IS_FW_HEADER_EXIST_8723B(pFwHdr)) -+ { ++ if (IS_FW_HEADER_EXIST_8723B(pFwHdr)) { + DBG_871X("%s(): Shift for fw header!\n", __func__); + /* Shift 32 bytes for FW header */ + pFirmwareBuf = pFirmwareBuf + 32; @@ -67159,17 +65487,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + /* Suggested by Filen. If 8051 is running in RAM code, driver should inform Fw to reset by itself, */ + /* or it will cause download Fw fail. 2010.02.01. by tynli. */ -+ if (rtw_read8(padapter, REG_MCUFWDL) & RAM_DL_SEL) /* 8051 RAM code */ -+ { ++ if (rtw_read8(padapter, REG_MCUFWDL) & RAM_DL_SEL) { /* 8051 RAM code */ + rtw_write8(padapter, REG_MCUFWDL, 0x00); + rtl8723b_FirmwareSelfReset(padapter); + } + + _FWDownloadEnable(padapter, true); + fwdl_start_time = jiffies; -+ while (!padapter->bDriverStopped && !padapter->bSurpriseRemoved -+ && (write_fw++ < 3 || jiffies_to_msecs(jiffies - fwdl_start_time) < 500)) -+ { ++ while ( ++ !padapter->bDriverStopped && ++ !padapter->bSurpriseRemoved && ++ (write_fw++ < 3 || jiffies_to_msecs(jiffies - fwdl_start_time) < 500) ++ ) { + /* reset FWDL chksum */ + rtw_write8(padapter, REG_MCUFWDL, rtw_read8(padapter, REG_MCUFWDL)|FWDL_ChkSum_rpt); + @@ -67190,10 +65519,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + goto fwdl_stat; + +fwdl_stat: -+ DBG_871X("FWDL %s. write_fw:%u, %dms\n" -+ , (rtStatus == _SUCCESS)?"success":"fail" -+ , write_fw -+ , jiffies_to_msecs(jiffies - fwdl_start_time) ++ DBG_871X( ++ "FWDL %s. write_fw:%u, %dms\n", ++ (rtStatus == _SUCCESS)?"success":"fail", ++ write_fw, ++ jiffies_to_msecs(jiffies - fwdl_start_time) + ); + +exit: @@ -67216,9 +65546,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + /* Init H2C counter. by tynli. 2009.12.09. */ + pHalData->LastHMEBoxNum = 0; -+/* pHalData->H2CQueueHead = 0; */ -+/* pHalData->H2CQueueTail = 0; */ -+/* pHalData->H2CStopInsertQueue = false; */ ++/* pHalData->H2CQueueHead = 0; */ ++/* pHalData->H2CQueueTail = 0; */ ++/* pHalData->H2CStopInsertQueue = false; */ +} + +#if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN) @@ -67226,16 +65556,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + +/* */ +/* Description: Prepare some information to Fw for WoWLAN. */ -+/* (1) Download wowlan Fw. */ -+/* (2) Download RSVD page packets. */ -+/* (3) Enable AP offload if needed. */ ++/* (1) Download wowlan Fw. */ ++/* (2) Download RSVD page packets. */ ++/* (3) Enable AP offload if needed. */ +/* */ +/* 2011.04.12 by tynli. */ +/* */ -+void -+SetFwRelatedForWoWLAN8723b( -+ struct adapter * padapter, -+ u8 bHostIsGoingtoSleep ++void SetFwRelatedForWoWLAN8723b( ++ struct adapter *padapter, u8 bHostIsGoingtoSleep +) +{ + int status = _FAIL; @@ -67263,11 +65591,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 +/* */ +/* Efuse related code */ +/* */ -+static u8 -+hal_EfuseSwitchToBank( -+ struct adapter *padapter, -+ u8 bank, -+ bool bPseudoTest) ++static u8 hal_EfuseSwitchToBank( ++ struct adapter *padapter, u8 bank, bool bPseudoTest ++) +{ + u8 bRet = false; + u32 value32 = 0; @@ -67278,37 +65604,33 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + + DBG_8192C("%s: Efuse switch bank to %d\n", __func__, bank); -+ if (bPseudoTest) -+ { ++ if (bPseudoTest) { +#ifdef HAL_EFUSE_MEMORY + pEfuseHal->fakeEfuseBank = bank; +#else + fakeEfuseBank = bank; +#endif + bRet = true; -+ } -+ else -+ { ++ } else { + value32 = rtw_read32(padapter, EFUSE_TEST); + bRet = true; -+ switch (bank) -+ { -+ case 0: -+ value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_WIFI_SEL_0); -+ break; -+ case 1: -+ value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_BT_SEL_0); -+ break; -+ case 2: -+ value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_BT_SEL_1); -+ break; -+ case 3: -+ value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_BT_SEL_2); -+ break; -+ default: -+ value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_WIFI_SEL_0); -+ bRet = false; -+ break; ++ switch (bank) { ++ case 0: ++ value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_WIFI_SEL_0); ++ break; ++ case 1: ++ value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_BT_SEL_0); ++ break; ++ case 2: ++ value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_BT_SEL_1); ++ break; ++ case 3: ++ value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_BT_SEL_2); ++ break; ++ default: ++ value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_WIFI_SEL_0); ++ bRet = false; ++ break; + } + rtw_write32(padapter, EFUSE_TEST, value32); + } @@ -67316,107 +65638,106 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + return bRet; +} + -+static void -+Hal_GetEfuseDefinition( ++static void Hal_GetEfuseDefinition( + struct adapter *padapter, -+ u8 efuseType, -+ u8 type, -+ void *pOut, -+ bool bPseudoTest) ++ u8 efuseType, ++ u8 type, ++ void *pOut, ++ bool bPseudoTest ++) +{ -+ switch (type) -+ { -+ case TYPE_EFUSE_MAX_SECTION: -+ { -+ u8 *pMax_section; -+ pMax_section = (u8 *)pOut; ++ switch (type) { ++ case TYPE_EFUSE_MAX_SECTION: ++ { ++ u8 *pMax_section; ++ pMax_section = (u8 *)pOut; + -+ if (efuseType == EFUSE_WIFI) -+ *pMax_section = EFUSE_MAX_SECTION_8723B; -+ else -+ *pMax_section = EFUSE_BT_MAX_SECTION; -+ } -+ break; ++ if (efuseType == EFUSE_WIFI) ++ *pMax_section = EFUSE_MAX_SECTION_8723B; ++ else ++ *pMax_section = EFUSE_BT_MAX_SECTION; ++ } ++ break; + -+ case TYPE_EFUSE_REAL_CONTENT_LEN: -+ { -+ u16 *pu2Tmp; -+ pu2Tmp = (u16*)pOut; ++ case TYPE_EFUSE_REAL_CONTENT_LEN: ++ { ++ u16 *pu2Tmp; ++ pu2Tmp = (u16 *)pOut; + -+ if (efuseType == EFUSE_WIFI) -+ *pu2Tmp = EFUSE_REAL_CONTENT_LEN_8723B; -+ else -+ *pu2Tmp = EFUSE_BT_REAL_CONTENT_LEN; -+ } -+ break; ++ if (efuseType == EFUSE_WIFI) ++ *pu2Tmp = EFUSE_REAL_CONTENT_LEN_8723B; ++ else ++ *pu2Tmp = EFUSE_BT_REAL_CONTENT_LEN; ++ } ++ break; + -+ case TYPE_AVAILABLE_EFUSE_BYTES_BANK: -+ { -+ u16 *pu2Tmp; -+ pu2Tmp = (u16*)pOut; ++ case TYPE_AVAILABLE_EFUSE_BYTES_BANK: ++ { ++ u16 *pu2Tmp; ++ pu2Tmp = (u16 *)pOut; + -+ if (efuseType == EFUSE_WIFI) -+ *pu2Tmp = (EFUSE_REAL_CONTENT_LEN_8723B-EFUSE_OOB_PROTECT_BYTES); -+ else -+ *pu2Tmp = (EFUSE_BT_REAL_BANK_CONTENT_LEN-EFUSE_PROTECT_BYTES_BANK); -+ } -+ break; ++ if (efuseType == EFUSE_WIFI) ++ *pu2Tmp = (EFUSE_REAL_CONTENT_LEN_8723B-EFUSE_OOB_PROTECT_BYTES); ++ else ++ *pu2Tmp = (EFUSE_BT_REAL_BANK_CONTENT_LEN-EFUSE_PROTECT_BYTES_BANK); ++ } ++ break; + -+ case TYPE_AVAILABLE_EFUSE_BYTES_TOTAL: -+ { -+ u16 *pu2Tmp; -+ pu2Tmp = (u16*)pOut; ++ case TYPE_AVAILABLE_EFUSE_BYTES_TOTAL: ++ { ++ u16 *pu2Tmp; ++ pu2Tmp = (u16 *)pOut; + -+ if (efuseType == EFUSE_WIFI) -+ *pu2Tmp = (EFUSE_REAL_CONTENT_LEN_8723B-EFUSE_OOB_PROTECT_BYTES); -+ else -+ *pu2Tmp = (EFUSE_BT_REAL_CONTENT_LEN-(EFUSE_PROTECT_BYTES_BANK*3)); -+ } -+ break; ++ if (efuseType == EFUSE_WIFI) ++ *pu2Tmp = (EFUSE_REAL_CONTENT_LEN_8723B-EFUSE_OOB_PROTECT_BYTES); ++ else ++ *pu2Tmp = (EFUSE_BT_REAL_CONTENT_LEN-(EFUSE_PROTECT_BYTES_BANK*3)); ++ } ++ break; + -+ case TYPE_EFUSE_MAP_LEN: -+ { -+ u16 *pu2Tmp; -+ pu2Tmp = (u16*)pOut; ++ case TYPE_EFUSE_MAP_LEN: ++ { ++ u16 *pu2Tmp; ++ pu2Tmp = (u16 *)pOut; + -+ if (efuseType == EFUSE_WIFI) -+ *pu2Tmp = EFUSE_MAX_MAP_LEN; -+ else -+ *pu2Tmp = EFUSE_BT_MAP_LEN; -+ } -+ break; ++ if (efuseType == EFUSE_WIFI) ++ *pu2Tmp = EFUSE_MAX_MAP_LEN; ++ else ++ *pu2Tmp = EFUSE_BT_MAP_LEN; ++ } ++ break; + -+ case TYPE_EFUSE_PROTECT_BYTES_BANK: -+ { -+ u8 *pu1Tmp; -+ pu1Tmp = (u8 *)pOut; ++ case TYPE_EFUSE_PROTECT_BYTES_BANK: ++ { ++ u8 *pu1Tmp; ++ pu1Tmp = (u8 *)pOut; + -+ if (efuseType == EFUSE_WIFI) -+ *pu1Tmp = EFUSE_OOB_PROTECT_BYTES; -+ else -+ *pu1Tmp = EFUSE_PROTECT_BYTES_BANK; -+ } -+ break; ++ if (efuseType == EFUSE_WIFI) ++ *pu1Tmp = EFUSE_OOB_PROTECT_BYTES; ++ else ++ *pu1Tmp = EFUSE_PROTECT_BYTES_BANK; ++ } ++ break; + -+ case TYPE_EFUSE_CONTENT_LEN_BANK: -+ { -+ u16 *pu2Tmp; -+ pu2Tmp = (u16*)pOut; ++ case TYPE_EFUSE_CONTENT_LEN_BANK: ++ { ++ u16 *pu2Tmp; ++ pu2Tmp = (u16 *)pOut; + -+ if (efuseType == EFUSE_WIFI) -+ *pu2Tmp = EFUSE_REAL_CONTENT_LEN_8723B; -+ else -+ *pu2Tmp = EFUSE_BT_REAL_BANK_CONTENT_LEN; -+ } -+ break; ++ if (efuseType == EFUSE_WIFI) ++ *pu2Tmp = EFUSE_REAL_CONTENT_LEN_8723B; ++ else ++ *pu2Tmp = EFUSE_BT_REAL_BANK_CONTENT_LEN; ++ } ++ break; + -+ default: -+ { -+ u8 *pu1Tmp; -+ pu1Tmp = (u8 *)pOut; -+ *pu1Tmp = 0; -+ } -+ break; ++ default: ++ { ++ u8 *pu1Tmp; ++ pu1Tmp = (u8 *)pOut; ++ *pu1Tmp = 0; ++ } ++ break; + } +} + @@ -67433,13 +65754,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + +/* */ +static void Hal_BT_EfusePowerSwitch( -+ struct adapter *padapter, -+ u8 bWrite, -+ u8 PwrState) ++ struct adapter *padapter, u8 bWrite, u8 PwrState ++) +{ + u8 tempval; -+ if (PwrState == true) -+ { ++ if (PwrState == true) { + /* enable BT power cut */ + /* 0x6A[14] = 1 */ + tempval = rtw_read8(padapter, 0x6B); @@ -67454,9 +65773,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + tempval = rtw_read8(padapter, 0x6B); + tempval &= ~BIT(7); + rtw_write8(padapter, 0x6B, tempval); -+ } -+ else -+ { ++ } else { + /* enable BT output isolation */ + /* 0x6A[15] = 1 */ + tempval = rtw_read8(padapter, 0x6B); @@ -67474,23 +65791,19 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + } + +} -+static void -+Hal_EfusePowerSwitch( -+ struct adapter *padapter, -+ u8 bWrite, -+ u8 PwrState) ++static void Hal_EfusePowerSwitch( ++ struct adapter *padapter, u8 bWrite, u8 PwrState ++) +{ + u8 tempval; + u16 tmpV16; + + -+ if (PwrState == true) -+ { ++ if (PwrState == true) { + /* To avoid cannot access efuse regsiters after disable/enable several times during DTM test. */ + /* Suggested by SD1 IsaacHsu. 2013.07.08, added by tynli. */ + tempval = rtw_read8(padapter, SDIO_LOCAL_BASE|SDIO_REG_HSUS_CTRL); -+ if (tempval & BIT(0)) /* SDIO local register is suspend */ -+ { ++ if (tempval & BIT(0)) { /* SDIO local register is suspend */ + u8 count = 0; + + @@ -67511,13 +65824,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + mdelay(10); + } while (1); + -+ if (count >= 100) -+ { ++ if (count >= 100) { + DBG_8192C(FUNC_ADPT_FMT ": Leave SDIO local register suspend fail! Local 0x86 =%#X\n", + FUNC_ADPT_ARG(padapter), tempval); -+ } -+ else -+ { ++ } else { + DBG_8192C(FUNC_ADPT_FMT ": Leave SDIO local register suspend OK! Local 0x86 =%#X\n", + FUNC_ADPT_ARG(padapter), tempval); + } @@ -67528,19 +65838,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + /* Reset: 0x0000h[28], default valid */ + tmpV16 = rtw_read16(padapter, REG_SYS_FUNC_EN); + if (!(tmpV16 & FEN_ELDR)) { -+ tmpV16 |= FEN_ELDR ; ++ tmpV16 |= FEN_ELDR; + rtw_write16(padapter, REG_SYS_FUNC_EN, tmpV16); + } + + /* Clock: Gated(0x0008h[5]) 8M(0x0008h[1]) clock from ANA, default valid */ + tmpV16 = rtw_read16(padapter, REG_SYS_CLKR); + if ((!(tmpV16 & LOADER_CLK_EN)) || (!(tmpV16 & ANA8M))) { -+ tmpV16 |= (LOADER_CLK_EN | ANA8M) ; ++ tmpV16 |= (LOADER_CLK_EN | ANA8M); + rtw_write16(padapter, REG_SYS_CLKR, tmpV16); + } + -+ if (bWrite == true) -+ { ++ if (bWrite == true) { + /* Enable LDO 2.5V before read/write action */ + tempval = rtw_read8(padapter, EFUSE_TEST+3); + tempval &= 0x0F; @@ -67549,9 +65858,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + /* rtw_write8(padapter, REG_EFUSE_ACCESS, EFUSE_ACCESS_ON); */ + } -+ } -+ else -+ { ++ } else { + rtw_write8(padapter, REG_EFUSE_ACCESS, EFUSE_ACCESS_OFF); + + if (bWrite == true) { @@ -67563,17 +65870,17 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + } +} + -+static void -+hal_ReadEFuse_WiFi( ++static void hal_ReadEFuse_WiFi( + struct adapter *padapter, -+ u16 _offset, -+ u16 _size_byte, -+ u8 *pbuf, -+ bool bPseudoTest) ++ u16 _offset, ++ u16 _size_byte, ++ u8 *pbuf, ++ bool bPseudoTest ++) +{ +#ifdef HAL_EFUSE_MEMORY + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ PEFUSE_HAL pEfuseHal = &pHalData->EfuseHal; ++ PEFUSE_HAL pEfuseHal = &pHalData->EfuseHal; +#endif + u8 *efuseTbl = NULL; + u16 eFuse_Addr = 0; @@ -67586,15 +65893,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + /* */ + /* Do NOT excess total size of EFuse table. Added by Roger, 2008.11.10. */ + /* */ -+ if ((_offset+_size_byte) > EFUSE_MAX_MAP_LEN) -+ { ++ if ((_offset+_size_byte) > EFUSE_MAX_MAP_LEN) { + DBG_8192C("%s: Invalid offset(%#x) with read bytes(%#x)!!\n", __func__, _offset, _size_byte); + return; + } + + efuseTbl = (u8 *)rtw_malloc(EFUSE_MAX_MAP_LEN); -+ if (efuseTbl == NULL) -+ { ++ if (efuseTbl == NULL) { + DBG_8192C("%s: alloc efuseTbl fail!\n", __func__); + return; + } @@ -67603,13 +65908,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + +#ifdef CONFIG_DEBUG -+if (0) -+{ -+ for (i = 0; i<256; i++) ++if (0) { ++ for (i = 0; i < 256; i++) + efuse_OneByteRead(padapter, i, &efuseTbl[i], false); + DBG_871X("Efuse Content:\n"); -+ for (i = 0; i<256; i++) -+ { ++ for (i = 0; i < 256; i++) { + if (i % 16 == 0) + printk("\n"); + printk("%02X ", efuseTbl[i]); @@ -67622,51 +65925,41 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + /* switch bank back to bank 0 for later BT and wifi use. */ + hal_EfuseSwitchToBank(padapter, 0, bPseudoTest); + -+ while (AVAILABLE_EFUSE_ADDR(eFuse_Addr)) -+ { ++ while (AVAILABLE_EFUSE_ADDR(eFuse_Addr)) { + efuse_OneByteRead(padapter, eFuse_Addr++, &efuseHeader, bPseudoTest); -+ if (efuseHeader == 0xFF) -+ { ++ if (efuseHeader == 0xFF) { + DBG_8192C("%s: data end at address =%#x\n", __func__, eFuse_Addr-1); + break; + } + /* DBG_8192C("%s: efuse[0x%X]= 0x%02X\n", __func__, eFuse_Addr-1, efuseHeader); */ + + /* Check PG header for section num. */ -+ if (EXT_HEADER(efuseHeader)) /* extended header */ -+ { ++ if (EXT_HEADER(efuseHeader)) { /* extended header */ + offset = GET_HDR_OFFSET_2_0(efuseHeader); + /* DBG_8192C("%s: extended header offset = 0x%X\n", __func__, offset); */ + + efuse_OneByteRead(padapter, eFuse_Addr++, &efuseExtHdr, bPseudoTest); + /* DBG_8192C("%s: efuse[0x%X]= 0x%02X\n", __func__, eFuse_Addr-1, efuseExtHdr); */ + if (ALL_WORDS_DISABLED(efuseExtHdr)) -+ { + continue; -+ } + + offset |= ((efuseExtHdr & 0xF0) >> 1); + wden = (efuseExtHdr & 0x0F); -+ } -+ else -+ { ++ } else { + offset = ((efuseHeader >> 4) & 0x0f); + wden = (efuseHeader & 0x0f); + } + /* DBG_8192C("%s: Offset =%d Worden = 0x%X\n", __func__, offset, wden); */ + -+ if (offset < EFUSE_MAX_SECTION_8723B) -+ { ++ if (offset < EFUSE_MAX_SECTION_8723B) { + u16 addr; + /* Get word enable value from PG header */ +/* DBG_8192C("%s: Offset =%d Worden = 0x%X\n", __func__, offset, wden); */ + + addr = offset * PGPKT_DATA_SIZE; -+ for (i = 0; ifakeEfuseUsedBytes = used; +#else + fakeEfuseUsedBytes = used; +#endif -+ } -+ else -+ { ++ } else { + rtw_hal_set_hwreg(padapter, HW_VAR_EFUSE_BYTES, (u8 *)&used); + rtw_hal_set_hwreg(padapter, HW_VAR_EFUSE_USAGE, (u8 *)&efuse_usage); + } @@ -67724,18 +66010,17 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + kfree(efuseTbl); +} + -+static void -+hal_ReadEFuse_BT( ++static void hal_ReadEFuse_BT( + struct adapter *padapter, -+ u16 _offset, -+ u16 _size_byte, -+ u8 *pbuf, -+ bool bPseudoTest -+ ) ++ u16 _offset, ++ u16 _size_byte, ++ u8 *pbuf, ++ bool bPseudoTest ++) +{ +#ifdef HAL_EFUSE_MEMORY + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ PEFUSE_HAL pEfuseHal = &pHalData->EfuseHal; ++ PEFUSE_HAL pEfuseHal = &pHalData->EfuseHal; +#endif + u8 *efuseTbl; + u8 bank; @@ -67749,8 +66034,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + /* */ + /* Do NOT excess total size of EFuse table. Added by Roger, 2008.11.10. */ + /* */ -+ if ((_offset+_size_byte) > EFUSE_BT_MAP_LEN) -+ { ++ if ((_offset+_size_byte) > EFUSE_BT_MAP_LEN) { + DBG_8192C("%s: Invalid offset(%#x) with read bytes(%#x)!!\n", __func__, _offset, _size_byte); + return; + } @@ -67765,57 +66049,48 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + EFUSE_GetEfuseDefinition(padapter, EFUSE_BT, TYPE_AVAILABLE_EFUSE_BYTES_BANK, &total, bPseudoTest); + -+ for (bank = 1; bank<3; bank++) /* 8723b Max bake 0~2 */ -+ { -+ if (hal_EfuseSwitchToBank(padapter, bank, bPseudoTest) == false) -+ { ++ for (bank = 1; bank < 3; bank++) { /* 8723b Max bake 0~2 */ ++ if (hal_EfuseSwitchToBank(padapter, bank, bPseudoTest) == false) { + DBG_8192C("%s: hal_EfuseSwitchToBank Fail!!\n", __func__); + goto exit; + } + + eFuse_Addr = 0; + -+ while (AVAILABLE_EFUSE_ADDR(eFuse_Addr)) -+ { ++ while (AVAILABLE_EFUSE_ADDR(eFuse_Addr)) { + efuse_OneByteRead(padapter, eFuse_Addr++, &efuseHeader, bPseudoTest); -+ if (efuseHeader == 0xFF) break; ++ if (efuseHeader == 0xFF) ++ break; + DBG_8192C("%s: efuse[%#X]= 0x%02x (header)\n", __func__, (((bank-1)*EFUSE_REAL_CONTENT_LEN_8723B)+eFuse_Addr-1), efuseHeader); + + /* Check PG header for section num. */ -+ if (EXT_HEADER(efuseHeader)) /* extended header */ -+ { ++ if (EXT_HEADER(efuseHeader)) { /* extended header */ + offset = GET_HDR_OFFSET_2_0(efuseHeader); + DBG_8192C("%s: extended header offset_2_0 = 0x%X\n", __func__, offset); + + efuse_OneByteRead(padapter, eFuse_Addr++, &efuseExtHdr, bPseudoTest); + DBG_8192C("%s: efuse[%#X]= 0x%02x (ext header)\n", __func__, (((bank-1)*EFUSE_REAL_CONTENT_LEN_8723B)+eFuse_Addr-1), efuseExtHdr); + if (ALL_WORDS_DISABLED(efuseExtHdr)) -+ { + continue; -+ } ++ + + offset |= ((efuseExtHdr & 0xF0) >> 1); + wden = (efuseExtHdr & 0x0F); -+ } -+ else -+ { ++ } else { + offset = ((efuseHeader >> 4) & 0x0f); + wden = (efuseHeader & 0x0f); + } + -+ if (offset < EFUSE_BT_MAX_SECTION) -+ { ++ if (offset < EFUSE_BT_MAX_SECTION) { + u16 addr; + + /* Get word enable value from PG header */ + DBG_8192C("%s: Offset =%d Worden =%#X\n", __func__, offset, wden); + + addr = offset * PGPKT_DATA_SIZE; -+ for (i = 0; ifakeBTEfuseUsedBytes = used; +#else + fakeBTEfuseUsedBytes = used; +#endif -+ } -+ else -+ { ++ } else { + rtw_hal_set_hwreg(padapter, HW_VAR_EFUSE_BT_BYTES, (u8 *)&used); + rtw_hal_set_hwreg(padapter, HW_VAR_EFUSE_BT_USAGE, (u8 *)&efuse_usage); + } @@ -67874,14 +66143,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + kfree(efuseTbl); +} + -+static void -+Hal_ReadEFuse( ++static void Hal_ReadEFuse( + struct adapter *padapter, -+ u8 efuseType, -+ u16 _offset, -+ u16 _size_byte, -+ u8 *pbuf, -+ bool bPseudoTest) ++ u8 efuseType, ++ u16 _offset, ++ u16 _size_byte, ++ u8 *pbuf, ++ bool bPseudoTest ++) +{ + if (efuseType == EFUSE_WIFI) + hal_ReadEFuse_WiFi(padapter, _offset, _size_byte, pbuf, bPseudoTest); @@ -67889,10 +66158,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + hal_ReadEFuse_BT(padapter, _offset, _size_byte, pbuf, bPseudoTest); +} + -+static u16 -+hal_EfuseGetCurrentSize_WiFi( -+ struct adapter *padapter, -+ bool bPseudoTest) ++static u16 hal_EfuseGetCurrentSize_WiFi( ++ struct adapter *padapter, bool bPseudoTest ++) +{ +#ifdef HAL_EFUSE_MEMORY + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); @@ -67905,18 +66173,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + u32 count = 0; /* for debug */ + + -+ if (bPseudoTest) -+ { ++ if (bPseudoTest) { +#ifdef HAL_EFUSE_MEMORY + efuse_addr = (u16)pEfuseHal->fakeEfuseUsedBytes; +#else + efuse_addr = (u16)fakeEfuseUsedBytes; +#endif -+ } -+ else -+ { ++ } else + rtw_hal_get_hwreg(padapter, HW_VAR_EFUSE_BYTES, (u8 *)&efuse_addr); -+ } ++ + start_addr = efuse_addr; + DBG_8192C("%s: start_efuse_addr = 0x%X\n", __func__, efuse_addr); + @@ -67924,29 +66189,25 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + hal_EfuseSwitchToBank(padapter, 0, bPseudoTest); + + count = 0; -+ while (AVAILABLE_EFUSE_ADDR(efuse_addr)) -+ { -+ if (efuse_OneByteRead(padapter, efuse_addr, &efuse_data, bPseudoTest) == false) -+ { ++ while (AVAILABLE_EFUSE_ADDR(efuse_addr)) { ++ if (efuse_OneByteRead(padapter, efuse_addr, &efuse_data, bPseudoTest) == false) { + DBG_8192C(KERN_ERR "%s: efuse_OneByteRead Fail! addr = 0x%X !!\n", __func__, efuse_addr); + goto error; + } + -+ if (efuse_data == 0xFF) break; ++ if (efuse_data == 0xFF) ++ break; + -+ if ((start_addr != 0) && (efuse_addr == start_addr)) -+ { ++ if ((start_addr != 0) && (efuse_addr == start_addr)) { + count++; + DBG_8192C(FUNC_ADPT_FMT ": [WARNING] efuse raw 0x%X = 0x%02X not 0xFF!!(%d times)\n", + FUNC_ADPT_ARG(padapter), efuse_addr, efuse_data, count); + + efuse_data = 0xFF; -+ if (count < 4) -+ { ++ if (count < 4) { + /* try again! */ + -+ if (count > 2) -+ { ++ if (count > 2) { + /* try again form address 0 */ + efuse_addr = 0; + start_addr = 0; @@ -67958,21 +66219,16 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + goto error; + } + -+ if (EXT_HEADER(efuse_data)) -+ { ++ if (EXT_HEADER(efuse_data)) { + hoffset = GET_HDR_OFFSET_2_0(efuse_data); + efuse_addr++; + efuse_OneByteRead(padapter, efuse_addr, &efuse_data, bPseudoTest); + if (ALL_WORDS_DISABLED(efuse_data)) -+ { + continue; -+ } + + hoffset |= ((efuse_data & 0xF0) >> 1); + hworden = efuse_data & 0x0F; -+ } -+ else -+ { ++ } else { + hoffset = (efuse_data>>4) & 0x0F; + hworden = efuse_data & 0x0F; + } @@ -67981,18 +66237,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + efuse_addr += (word_cnts*2)+1; + } + -+ if (bPseudoTest) -+ { ++ if (bPseudoTest) { +#ifdef HAL_EFUSE_MEMORY + pEfuseHal->fakeEfuseUsedBytes = efuse_addr; +#else + fakeEfuseUsedBytes = efuse_addr; +#endif -+ } -+ else -+ { ++ } else + rtw_hal_set_hwreg(padapter, HW_VAR_EFUSE_BYTES, (u8 *)&efuse_addr); -+ } + + goto exit; + @@ -68006,14 +66258,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + return efuse_addr; +} + -+static u16 -+hal_EfuseGetCurrentSize_BT( -+ struct adapter *padapter, -+ u8 bPseudoTest) ++static u16 hal_EfuseGetCurrentSize_BT(struct adapter *padapter, u8 bPseudoTest) +{ +#ifdef HAL_EFUSE_MEMORY + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ PEFUSE_HAL pEfuseHal = &pHalData->EfuseHal; ++ PEFUSE_HAL pEfuseHal = &pHalData->EfuseHal; +#endif + u16 btusedbytes; + u16 efuse_addr; @@ -68028,11 +66277,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 +#else + btusedbytes = fakeBTEfuseUsedBytes; +#endif -+ } -+ else -+ { ++ } else + rtw_hal_get_hwreg(padapter, HW_VAR_EFUSE_BT_BYTES, (u8 *)&btusedbytes); -+ } ++ + efuse_addr = (u16)((btusedbytes%EFUSE_BT_REAL_BANK_CONTENT_LEN)); + startBank = (u8)(1+(btusedbytes/EFUSE_BT_REAL_BANK_CONTENT_LEN)); + @@ -68040,10 +66287,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + EFUSE_GetEfuseDefinition(padapter, EFUSE_BT, TYPE_AVAILABLE_EFUSE_BYTES_BANK, &retU2, bPseudoTest); + -+ for (bank =startBank; bank<3; bank++) -+ { -+ if (hal_EfuseSwitchToBank(padapter, bank, bPseudoTest) == false) -+ { ++ for (bank = startBank; bank < 3; bank++) { ++ if (hal_EfuseSwitchToBank(padapter, bank, bPseudoTest) == false) { + DBG_8192C(KERN_ERR "%s: switch bank(%d) Fail!!\n", __func__, bank); + /* bank = EFUSE_MAX_BANK; */ + break; @@ -68054,27 +66299,24 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + efuse_addr = 0; +#if 1 + -+ while (AVAILABLE_EFUSE_ADDR(efuse_addr)) -+ { -+ if (efuse_OneByteRead(padapter, efuse_addr, &efuse_data, bPseudoTest) == false) -+ { ++ while (AVAILABLE_EFUSE_ADDR(efuse_addr)) { ++ if (efuse_OneByteRead(padapter, efuse_addr, &efuse_data, bPseudoTest) == false) { + DBG_8192C(KERN_ERR "%s: efuse_OneByteRead Fail! addr = 0x%X !!\n", __func__, efuse_addr); + /* bank = EFUSE_MAX_BANK; */ + break; + } + DBG_8192C("%s: efuse_OneByteRead ! addr = 0x%X !efuse_data = 0x%X! bank =%d\n", __func__, efuse_addr, efuse_data, bank); + -+ if (efuse_data == 0xFF) break; ++ if (efuse_data == 0xFF) ++ break; + -+ if (EXT_HEADER(efuse_data)) -+ { ++ if (EXT_HEADER(efuse_data)) { + hoffset = GET_HDR_OFFSET_2_0(efuse_data); + efuse_addr++; + efuse_OneByteRead(padapter, efuse_addr, &efuse_data, bPseudoTest); + DBG_8192C("%s: efuse_OneByteRead EXT_HEADER ! addr = 0x%X !efuse_data = 0x%X! bank =%d\n", __func__, efuse_addr, efuse_data, bank); + -+ if (ALL_WORDS_DISABLED(efuse_data)) -+ { ++ if (ALL_WORDS_DISABLED(efuse_data)) { + efuse_addr++; + continue; + } @@ -68082,9 +66324,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 +/* hoffset = ((hoffset & 0xE0) >> 5) | ((efuse_data & 0xF0) >> 1); */ + hoffset |= ((efuse_data & 0xF0) >> 1); + hworden = efuse_data & 0x0F; -+ } -+ else -+ { ++ } else { + hoffset = (efuse_data>>4) & 0x0F; + hworden = efuse_data & 0x0F; + } @@ -68097,60 +66337,46 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + efuse_addr += (word_cnts*2)+1; + } +#else -+ while (bContinual && -+ efuse_OneByteRead(padapter, efuse_addr ,&efuse_data, bPseudoTest) && -+ AVAILABLE_EFUSE_ADDR(efuse_addr)) -+ { -+ if (efuse_data!= 0xFF) -+ { -+ if ((efuse_data&0x1F) == 0x0F) /* extended header */ -+ { ++ while ( ++ bContinual && ++ efuse_OneByteRead(padapter, efuse_addr, &efuse_data, bPseudoTest) && ++ AVAILABLE_EFUSE_ADDR(efuse_addr) ++ ) { ++ if (efuse_data != 0xFF) { ++ if ((efuse_data&0x1F) == 0x0F) { /* extended header */ + hoffset = efuse_data; + efuse_addr++; -+ efuse_OneByteRead(padapter, efuse_addr ,&efuse_data, bPseudoTest); -+ if ((efuse_data & 0x0F) == 0x0F) -+ { ++ efuse_OneByteRead(padapter, efuse_addr, &efuse_data, bPseudoTest); ++ if ((efuse_data & 0x0F) == 0x0F) { + efuse_addr++; + continue; -+ } -+ else -+ { ++ } else { + hoffset = ((hoffset & 0xE0) >> 5) | ((efuse_data & 0xF0) >> 1); + hworden = efuse_data & 0x0F; + } -+ } -+ else -+ { ++ } else { + hoffset = (efuse_data>>4) & 0x0F; + hworden = efuse_data & 0x0F; + } + word_cnts = Efuse_CalculateWordCnts(hworden); + /* read next header */ + efuse_addr = efuse_addr + (word_cnts*2)+1; -+ } -+ else -+ { -+ bContinual = false ; -+ } ++ } else ++ bContinual = false; + } +#endif + + + /* Check if we need to check next bank efuse */ + if (efuse_addr < retU2) -+ { -+ break;/* don't need to check next bank. */ -+ } ++ break; /* don't need to check next bank. */ + } + + retU2 = ((bank-1)*EFUSE_BT_REAL_BANK_CONTENT_LEN)+efuse_addr; -+ if (bPseudoTest) -+ { ++ if (bPseudoTest) { + pEfuseHal->fakeBTEfuseUsedBytes = retU2; + /* RT_DISP(FEEPROM, EFUSE_PG, ("Hal_EfuseGetCurrentSize_BT92C(), already use %u bytes\n", pEfuseHal->fakeBTEfuseUsedBytes)); */ -+ } -+ else -+ { ++ } else { + pEfuseHal->BTEfuseUsedBytes = retU2; + /* RT_DISP(FEEPROM, EFUSE_PG, ("Hal_EfuseGetCurrentSize_BT92C(), already use %u bytes\n", pEfuseHal->BTEfuseUsedBytes)); */ + } @@ -68159,11 +66385,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + return retU2; +} + -+static u16 -+Hal_EfuseGetCurrentSize( -+ struct adapter *padapter, -+ u8 efuseType, -+ bool bPseudoTest) ++static u16 Hal_EfuseGetCurrentSize( ++ struct adapter *padapter, u8 efuseType, bool bPseudoTest ++) +{ + u16 ret = 0; + @@ -68175,13 +66399,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + return ret; +} + -+static u8 -+Hal_EfuseWordEnableDataWrite( ++static u8 Hal_EfuseWordEnableDataWrite( + struct adapter *padapter, -+ u16 efuse_addr, -+ u8 word_en, -+ u8 *data, -+ bool bPseudoTest) ++ u16 efuse_addr, ++ u8 word_en, ++ u8 *data, ++ bool bPseudoTest ++) +{ + u16 tmpaddr = 0; + u16 start_addr = efuse_addr; @@ -68192,51 +66416,49 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 +/* DBG_8192C("%s: efuse_addr =%#x word_en =%#x\n", __func__, efuse_addr, word_en); */ + memset(tmpdata, 0xFF, PGPKT_DATA_SIZE); + -+ if (!(word_en & BIT(0))) -+ { ++ if (!(word_en & BIT(0))) { + tmpaddr = start_addr; + efuse_OneByteWrite(padapter, start_addr++, data[0], bPseudoTest); + efuse_OneByteWrite(padapter, start_addr++, data[1], bPseudoTest); + + efuse_OneByteRead(padapter, tmpaddr, &tmpdata[0], bPseudoTest); + efuse_OneByteRead(padapter, tmpaddr+1, &tmpdata[1], bPseudoTest); -+ if ((data[0]!=tmpdata[0]) || (data[1]!=tmpdata[1])) { ++ if ((data[0] != tmpdata[0]) || (data[1] != tmpdata[1])) { + badworden &= (~BIT(0)); + } + } -+ if (!(word_en & BIT(1))) -+ { ++ if (!(word_en & BIT(1))) { + tmpaddr = start_addr; + efuse_OneByteWrite(padapter, start_addr++, data[2], bPseudoTest); + efuse_OneByteWrite(padapter, start_addr++, data[3], bPseudoTest); + + efuse_OneByteRead(padapter, tmpaddr, &tmpdata[2], bPseudoTest); + efuse_OneByteRead(padapter, tmpaddr+1, &tmpdata[3], bPseudoTest); -+ if ((data[2]!=tmpdata[2]) || (data[3]!=tmpdata[3])) { ++ if ((data[2] != tmpdata[2]) || (data[3] != tmpdata[3])) { + badworden &= (~BIT(1)); + } + } -+ if (!(word_en & BIT(2))) -+ { ++ ++ if (!(word_en & BIT(2))) { + tmpaddr = start_addr; + efuse_OneByteWrite(padapter, start_addr++, data[4], bPseudoTest); + efuse_OneByteWrite(padapter, start_addr++, data[5], bPseudoTest); + + efuse_OneByteRead(padapter, tmpaddr, &tmpdata[4], bPseudoTest); + efuse_OneByteRead(padapter, tmpaddr+1, &tmpdata[5], bPseudoTest); -+ if ((data[4]!=tmpdata[4]) || (data[5]!=tmpdata[5])) { ++ if ((data[4] != tmpdata[4]) || (data[5] != tmpdata[5])) { + badworden &= (~BIT(2)); + } + } -+ if (!(word_en & BIT(3))) -+ { ++ ++ if (!(word_en & BIT(3))) { + tmpaddr = start_addr; + efuse_OneByteWrite(padapter, start_addr++, data[6], bPseudoTest); + efuse_OneByteWrite(padapter, start_addr++, data[7], bPseudoTest); + + efuse_OneByteRead(padapter, tmpaddr, &tmpdata[6], bPseudoTest); + efuse_OneByteRead(padapter, tmpaddr+1, &tmpdata[7], bPseudoTest); -+ if ((data[6]!=tmpdata[6]) || (data[7]!=tmpdata[7])) { ++ if ((data[6] != tmpdata[6]) || (data[7] != tmpdata[7])) { + badworden &= (~BIT(3)); + } + } @@ -68244,12 +66466,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + return badworden; +} + -+static s32 -+Hal_EfusePgPacketRead( ++static s32 Hal_EfusePgPacketRead( + struct adapter *padapter, -+ u8 offset, -+ u8 *data, -+ bool bPseudoTest) ++ u8 offset, ++ u8 *data, ++ bool bPseudoTest ++) +{ + u8 efuse_data, word_cnts = 0; + u16 efuse_addr = 0; @@ -68263,8 +66485,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + return false; + + EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_EFUSE_MAX_SECTION, &max_section, bPseudoTest); -+ if (offset > max_section) -+ { ++ if (offset > max_section) { + DBG_8192C("%s: Packet offset(%d) is illegal(>%d)!\n", __func__, offset, max_section); + return false; + } @@ -68277,42 +66498,34 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + /* Skip dummy parts to prevent unexpected data read from Efuse. */ + /* By pass right now. 2009.02.19. */ + /* */ -+ while (AVAILABLE_EFUSE_ADDR(efuse_addr)) -+ { -+ if (efuse_OneByteRead(padapter, efuse_addr++, &efuse_data, bPseudoTest) == false) -+ { ++ while (AVAILABLE_EFUSE_ADDR(efuse_addr)) { ++ if (efuse_OneByteRead(padapter, efuse_addr++, &efuse_data, bPseudoTest) == false) { + ret = false; + break; + } + -+ if (efuse_data == 0xFF) break; ++ if (efuse_data == 0xFF) ++ break; + -+ if (EXT_HEADER(efuse_data)) -+ { ++ if (EXT_HEADER(efuse_data)) { + hoffset = GET_HDR_OFFSET_2_0(efuse_data); + efuse_OneByteRead(padapter, efuse_addr++, &efuse_data, bPseudoTest); -+ if (ALL_WORDS_DISABLED(efuse_data)) -+ { ++ if (ALL_WORDS_DISABLED(efuse_data)) { + DBG_8192C("%s: Error!! All words disabled!\n", __func__); + continue; + } + + hoffset |= ((efuse_data & 0xF0) >> 1); + hworden = efuse_data & 0x0F; -+ } -+ else -+ { ++ } else { + hoffset = (efuse_data>>4) & 0x0F; + hworden = efuse_data & 0x0F; + } + -+ if (hoffset == offset) -+ { -+ for (i = 0; i= max_available) -+ { ++ if (current_size >= max_available) { + DBG_8192C("%s: Error!! current_size(%d)>max_available(%d)\n", __func__, current_size, max_available); + return false; + } + return true; +} + -+static void -+hal_EfuseConstructPGPkt( -+ u8 offset, -+ u8 word_en, -+ u8 *pData, -+ PPGPKT_STRUCT pTargetPkt) ++static void hal_EfuseConstructPGPkt( ++ u8 offset, ++ u8 word_en, ++ u8 *pData, ++ PPGPKT_STRUCT pTargetPkt ++) +{ + memset(pTargetPkt->data, 0xFF, PGPKT_DATA_SIZE); + pTargetPkt->offset = offset; @@ -68369,93 +66577,72 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + pTargetPkt->word_cnts = Efuse_CalculateWordCnts(pTargetPkt->word_en); +} + -+static u8 -+hal_EfusePartialWriteCheck( -+ struct adapter * padapter, -+ u8 efuseType, -+ u16 *pAddr, -+ PPGPKT_STRUCT pTargetPkt, -+ u8 bPseudoTest) ++static u8 hal_EfusePartialWriteCheck( ++ struct adapter *padapter, ++ u8 efuseType, ++ u16 *pAddr, ++ PPGPKT_STRUCT pTargetPkt, ++ u8 bPseudoTest ++) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ PEFUSE_HAL pEfuseHal = &pHalData->EfuseHal; -+ u8 bRet =false; ++ PEFUSE_HAL pEfuseHal = &pHalData->EfuseHal; ++ u8 bRet = false; + u16 startAddr = 0, efuse_max_available_len = 0, efuse_max = 0; + u8 efuse_data = 0; + + EFUSE_GetEfuseDefinition(padapter, efuseType, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, &efuse_max_available_len, bPseudoTest); + EFUSE_GetEfuseDefinition(padapter, efuseType, TYPE_EFUSE_CONTENT_LEN_BANK, &efuse_max, bPseudoTest); + -+ if (efuseType == EFUSE_WIFI) -+ { -+ if (bPseudoTest) -+ { ++ if (efuseType == EFUSE_WIFI) { ++ if (bPseudoTest) { +#ifdef HAL_EFUSE_MEMORY + startAddr = (u16)pEfuseHal->fakeEfuseUsedBytes; +#else + startAddr = (u16)fakeEfuseUsedBytes; +#endif -+ } -+ else -+ { ++ } else + rtw_hal_get_hwreg(padapter, HW_VAR_EFUSE_BYTES, (u8 *)&startAddr); -+ } -+ } -+ else -+ { -+ if (bPseudoTest) -+ { ++ } else { ++ if (bPseudoTest) { +#ifdef HAL_EFUSE_MEMORY + startAddr = (u16)pEfuseHal->fakeBTEfuseUsedBytes; +#else + startAddr = (u16)fakeBTEfuseUsedBytes; +#endif -+ } -+ else -+ { ++ } else + rtw_hal_get_hwreg(padapter, HW_VAR_EFUSE_BT_BYTES, (u8 *)&startAddr); -+ } + } + startAddr %= efuse_max; + DBG_8192C("%s: startAddr =%#X\n", __func__, startAddr); + -+ while (1) -+ { -+ if (startAddr >= efuse_max_available_len) -+ { ++ while (1) { ++ if (startAddr >= efuse_max_available_len) { + bRet = false; -+ DBG_8192C("%s: startAddr(%d) >= efuse_max_available_len(%d)\n", -+ __func__, startAddr, efuse_max_available_len); ++ DBG_8192C("%s: startAddr(%d) >= efuse_max_available_len(%d)\n", __func__, startAddr, efuse_max_available_len); + break; + } + -+ if (efuse_OneByteRead(padapter, startAddr, &efuse_data, bPseudoTest) && (efuse_data!= 0xFF)) -+ { ++ if (efuse_OneByteRead(padapter, startAddr, &efuse_data, bPseudoTest) && (efuse_data != 0xFF)) { +#if 1 + bRet = false; + DBG_8192C("%s: Something Wrong! last bytes(%#X = 0x%02X) is not 0xFF\n", + __func__, startAddr, efuse_data); + break; +#else -+ if (EXT_HEADER(efuse_data)) -+ { ++ if (EXT_HEADER(efuse_data)) { + cur_header = efuse_data; + startAddr++; + efuse_OneByteRead(padapter, startAddr, &efuse_data, bPseudoTest); -+ if (ALL_WORDS_DISABLED(efuse_data)) -+ { ++ if (ALL_WORDS_DISABLED(efuse_data)) { + DBG_8192C("%s: Error condition, all words disabled!", __func__); + bRet = false; + break; -+ } -+ else -+ { ++ } else { + curPkt.offset = ((cur_header & 0xE0) >> 5) | ((efuse_data & 0xF0) >> 1); + curPkt.word_en = efuse_data & 0x0F; + } -+ } -+ else -+ { ++ } else { + cur_header = efuse_data; + curPkt.offset = (cur_header>>4) & 0x0F; + curPkt.word_en = cur_header & 0x0F; @@ -68464,15 +66651,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + curPkt.word_cnts = Efuse_CalculateWordCnts(curPkt.word_en); + /* if same header is found but no data followed */ + /* write some part of data followed by the header. */ -+ if ((curPkt.offset == pTargetPkt->offset) && ++ if ( ++ (curPkt.offset == pTargetPkt->offset) && + (hal_EfuseCheckIfDatafollowed(padapter, curPkt.word_cnts, startAddr+1, bPseudoTest) == false) && -+ wordEnMatched(pTargetPkt, &curPkt, &matched_wden) == true) -+ { ++ wordEnMatched(pTargetPkt, &curPkt, &matched_wden) == true ++ ) { + DBG_8192C("%s: Need to partial write data by the previous wrote header\n", __func__); + /* Here to write partial data */ + badworden = Efuse_WordEnableDataWrite(padapter, startAddr+1, matched_wden, pTargetPkt->data, bPseudoTest); -+ if (badworden != 0x0F) -+ { ++ if (badworden != 0x0F) { + u32 PgWriteSuccess = 0; + /* if write fail on some words, write these bad words again */ + if (efuseType == EFUSE_WIFI) @@ -68480,17 +66667,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + else + PgWriteSuccess = Efuse_PgPacketWrite_BT(padapter, pTargetPkt->offset, badworden, pTargetPkt->data, bPseudoTest); + -+ if (!PgWriteSuccess) -+ { ++ if (!PgWriteSuccess) { + bRet = false; /* write fail, return */ + break; + } + } + /* partial write ok, update the target packet for later use */ -+ for (i = 0; i<4; i++) -+ { -+ if ((matched_wden & (0x1<word_en |= (0x1< EFUSE_REPEAT_THRESHOLD_) -+ { ++ if (tmp_header != 0xFF) ++ break; ++ if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) { + DBG_8192C("%s: Repeat over limit for pg_header!!\n", __func__); + return false; + } + } while (1); + -+ if (tmp_header != pg_header) -+ { ++ if (tmp_header != pg_header) { + DBG_8192C(KERN_ERR "%s: PG Header Fail!!(pg = 0x%02X read = 0x%02X)\n", __func__, pg_header, tmp_header); + return false; + } @@ -68551,13 +66732,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + return true; +} + -+static u8 -+hal_EfusePgPacketWrite2ByteHeader( -+ struct adapter * padapter, -+ u8 efuseType, -+ u16 *pAddr, -+ PPGPKT_STRUCT pTargetPkt, -+ u8 bPseudoTest) ++static u8 hal_EfusePgPacketWrite2ByteHeader( ++ struct adapter *padapter, ++ u8 efuseType, ++ u16 *pAddr, ++ PPGPKT_STRUCT pTargetPkt, ++ u8 bPseudoTest ++) +{ + u16 efuse_addr, efuse_max_available_len = 0; + u8 pg_header = 0, tmp_header = 0; @@ -68568,8 +66749,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + EFUSE_GetEfuseDefinition(padapter, efuseType, TYPE_AVAILABLE_EFUSE_BYTES_BANK, &efuse_max_available_len, bPseudoTest); + + efuse_addr = *pAddr; -+ if (efuse_addr >= efuse_max_available_len) -+ { ++ if (efuse_addr >= efuse_max_available_len) { + DBG_8192C("%s: addr(%d) over avaliable(%d)!!\n", __func__, efuse_addr, efuse_max_available_len); + return false; + } @@ -68580,16 +66760,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + do { + efuse_OneByteWrite(padapter, efuse_addr, pg_header, bPseudoTest); + efuse_OneByteRead(padapter, efuse_addr, &tmp_header, bPseudoTest); -+ if (tmp_header != 0xFF) break; -+ if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) -+ { ++ if (tmp_header != 0xFF) ++ break; ++ if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) { + DBG_8192C("%s: Repeat over limit for pg_header!!\n", __func__); + return false; + } + } while (1); + -+ if (tmp_header != pg_header) -+ { ++ if (tmp_header != pg_header) { + DBG_8192C(KERN_ERR "%s: PG Header Fail!!(pg = 0x%02X read = 0x%02X)\n", __func__, pg_header, tmp_header); + return false; + } @@ -68601,16 +66780,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + do { + efuse_OneByteWrite(padapter, efuse_addr, pg_header, bPseudoTest); + efuse_OneByteRead(padapter, efuse_addr, &tmp_header, bPseudoTest); -+ if (tmp_header != 0xFF) break; -+ if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) -+ { ++ if (tmp_header != 0xFF) ++ break; ++ if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) { + DBG_8192C("%s: Repeat over limit for ext_header!!\n", __func__); + return false; + } + } while (1); + -+ if (tmp_header != pg_header) /* offset PG fail */ -+ { ++ if (tmp_header != pg_header) { /* offset PG fail */ + DBG_8192C(KERN_ERR "%s: PG EXT Header Fail!!(pg = 0x%02X read = 0x%02X)\n", __func__, pg_header, tmp_header); + return false; + } @@ -68620,35 +66798,31 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + return true; +} + -+static u8 -+hal_EfusePgPacketWriteHeader( -+ struct adapter * padapter, -+ u8 efuseType, -+ u16 *pAddr, -+ PPGPKT_STRUCT pTargetPkt, -+ u8 bPseudoTest) ++static u8 hal_EfusePgPacketWriteHeader( ++ struct adapter *padapter, ++ u8 efuseType, ++ u16 *pAddr, ++ PPGPKT_STRUCT pTargetPkt, ++ u8 bPseudoTest ++) +{ -+ u8 bRet =false; ++ u8 bRet = false; + + if (pTargetPkt->offset >= EFUSE_MAX_SECTION_BASE) -+ { + bRet = hal_EfusePgPacketWrite2ByteHeader(padapter, efuseType, pAddr, pTargetPkt, bPseudoTest); -+ } + else -+ { + bRet = hal_EfusePgPacketWrite1ByteHeader(padapter, efuseType, pAddr, pTargetPkt, bPseudoTest); -+ } + + return bRet; +} + -+static u8 -+hal_EfusePgPacketWriteData( -+ struct adapter * padapter, -+ u8 efuseType, -+ u16 *pAddr, -+ PPGPKT_STRUCT pTargetPkt, -+ u8 bPseudoTest) ++static u8 hal_EfusePgPacketWriteData( ++ struct adapter *padapter, ++ u8 efuseType, ++ u16 *pAddr, ++ PPGPKT_STRUCT pTargetPkt, ++ u8 bPseudoTest ++) +{ + u16 efuse_addr; + u8 badworden; @@ -68656,8 +66830,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + efuse_addr = *pAddr; + badworden = Efuse_WordEnableDataWrite(padapter, efuse_addr+1, pTargetPkt->word_en, pTargetPkt->data, bPseudoTest); -+ if (badworden != 0x0F) -+ { ++ if (badworden != 0x0F) { + DBG_8192C("%s: Fail!!\n", __func__); + return false; + } @@ -68666,17 +66839,17 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + return true; +} + -+static s32 -+Hal_EfusePgPacketWrite( ++static s32 Hal_EfusePgPacketWrite( + struct adapter *padapter, -+ u8 offset, -+ u8 word_en, -+ u8 *pData, -+ bool bPseudoTest) ++ u8 offset, ++ u8 word_en, ++ u8 *pData, ++ bool bPseudoTest ++) +{ + PGPKT_STRUCT targetPkt; + u16 startAddr = 0; -+ u8 efuseType =EFUSE_WIFI; ++ u8 efuseType = EFUSE_WIFI; + + if (!hal_EfusePgCheckAvailableAddr(padapter, efuseType, bPseudoTest)) + return false; @@ -68695,17 +66868,17 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + return true; +} + -+static bool -+Hal_EfusePgPacketWrite_BT( ++static bool Hal_EfusePgPacketWrite_BT( + struct adapter *padapter, -+ u8 offset, -+ u8 word_en, -+ u8 *pData, -+ bool bPseudoTest) ++ u8 offset, ++ u8 word_en, ++ u8 *pData, ++ bool bPseudoTest ++) +{ + PGPKT_STRUCT targetPkt; + u16 startAddr = 0; -+ u8 efuseType =EFUSE_BT; ++ u8 efuseType = EFUSE_BT; + + if (!hal_EfusePgCheckAvailableAddr(padapter, efuseType, bPseudoTest)) + return false; @@ -68724,14 +66897,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + return true; +} + -+static HAL_VERSION -+ReadChipVersion8723B( -+struct adapter *padapter -+ ) ++static HAL_VERSION ReadChipVersion8723B(struct adapter *padapter) +{ -+ u32 value32; -+ HAL_VERSION ChipVersion; -+ struct hal_com_data *pHalData; ++ u32 value32; ++ HAL_VERSION ChipVersion; ++ struct hal_com_data *pHalData; + +/* YJ, TODO, move read chip type here */ + pHalData = GET_HAL_DATA(padapter); @@ -68739,7 +66909,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + value32 = rtw_read32(padapter, REG_SYS_CFG); + ChipVersion.ICType = CHIP_8723B; + ChipVersion.ChipType = ((value32 & RTL_ID) ? TEST_CHIP : NORMAL_CHIP); -+ ChipVersion.RFType = RF_TYPE_1T1R ; ++ ChipVersion.RFType = RF_TYPE_1T1R; + ChipVersion.VendorType = ((value32 & VENDOR_ID) ? CHIP_VENDOR_UMC : CHIP_VENDOR_TSMC); + ChipVersion.CUTVersion = (value32 & CHIP_VER_RTL_MASK)>>CHIP_VER_RTL_SHIFT; /* IC version (CUT) */ + @@ -68811,9 +66981,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + pHalData->RegCR_1 = rtw_read8(padapter, REG_CR+1); +} + -+void _InitBurstPktLen_8723BS(struct adapter * Adapter) ++void _InitBurstPktLen_8723BS(struct adapter *Adapter) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + + rtw_write8(Adapter, 0x4c7, rtw_read8(Adapter, 0x4c7)|BIT(7)); /* enable single pkt ampdu */ + rtw_write8(Adapter, REG_RX_PKT_LIMIT_8723B, 0x18); /* for VHT packet length 11K */ @@ -68821,9 +66991,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + rtw_write8(Adapter, REG_PIFS_8723B, 0x00); + rtw_write8(Adapter, REG_FWHW_TXQ_CTRL_8723B, rtw_read8(Adapter, REG_FWHW_TXQ_CTRL)&(~BIT(7))); + if (pHalData->AMPDUBurstMode) -+ { + rtw_write8(Adapter, REG_AMPDU_BURST_MODE_8723B, 0x5F); -+ } + rtw_write8(Adapter, REG_AMPDU_MAX_TIME_8723B, 0x70); + + /* ARFB table 9 for 11ac 5G 2SS */ @@ -68928,8 +67096,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + rtw_write32(padapter, REG_TCR, value32); + + /* NOTE: Fix test chip's bug (about contention windows's randomness) */ -+ if (check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE|WIFI_AP_STATE) == true) -+ { ++ if (check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE|WIFI_AP_STATE) == true) { + rtw_write8(padapter, REG_RXTSF_OFFSET_CCK, 0x50); + rtw_write8(padapter, REG_RXTSF_OFFSET_OFDM, 0x50); + } @@ -68943,19 +67110,21 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 +} + +static void rtl8723b_GetHalODMVar( -+ struct adapter * Adapter, -+ enum HAL_ODM_VARIABLE eVariable, -+ void * pValue1, -+ void * pValue2) ++ struct adapter *Adapter, ++ enum HAL_ODM_VARIABLE eVariable, ++ void *pValue1, ++ void *pValue2 ++) +{ + GetHalODMVar(Adapter, eVariable, pValue1, pValue2); +} + +static void rtl8723b_SetHalODMVar( -+ struct adapter * Adapter, -+ enum HAL_ODM_VARIABLE eVariable, -+ void * pValue1, -+ bool bSet) ++ struct adapter *Adapter, ++ enum HAL_ODM_VARIABLE eVariable, ++ void *pValue1, ++ bool bSet ++) +{ + SetHalODMVar(Adapter, eVariable, pValue1, bSet); +} @@ -68984,15 +67153,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + DBG_871X("%s(): mac_id =%d rssi_level =%d\n", __func__, mac_id, rssi_level); + + if (mac_id >= NUM_STA) /* CAM_SIZE */ -+ { + return; -+ } + + psta = pmlmeinfo->FW_sta_info[mac_id].psta; + if (psta == NULL) -+ { + return; -+ } + + shortGIrate = query_ra_short_GI(psta); + @@ -69018,8 +67183,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + } +#endif + -+ if (pHalData->fw_ractrl == true) -+ { ++ if (pHalData->fw_ractrl == true) { + rtl8723b_set_FwMacIdConfig_cmd(padapter, mac_id, psta->raid, psta->bw_mode, shortGIrate, mask); + } + @@ -69126,7 +67290,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 +/* pdmpriv->initialize = 0; */ + + pdmpriv->ThermalValue_HP_index = 0; -+ for (i = 0; iThermalValue_HP[i] = 0; + + /* init Efuse variables */ @@ -69159,7 +67323,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + /* 6: EEPROM used is 93C46, 4: boot from E-Fuse. */ + size = (cr & BOOT_FROM_EEPROM) ? 6 : 4; + -+ MSG_8192C("EEPROM type is %s\n", size ==4 ? "E-FUSE" : "93C46"); ++ MSG_8192C("EEPROM type is %s\n", size == 4 ? "E-FUSE" : "93C46"); + + return size; +} @@ -69186,17 +67350,19 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + do { + val32 = rtw_read32(padapter, REG_AUTO_LLT); -+ if (!(val32 & BIT_AUTO_INIT_LLT)) -+ { ++ if (!(val32 & BIT_AUTO_INIT_LLT)) { + ret = _SUCCESS; + break; + } + + passing_time = jiffies_to_msecs(jiffies - start); -+ if (passing_time > 1000) -+ { -+ DBG_8192C("%s: FAIL!! REG_AUTO_LLT(0x%X) =%08x\n", -+ __func__, REG_AUTO_LLT, val32); ++ if (passing_time > 1000) { ++ DBG_8192C( ++ "%s: FAIL!! REG_AUTO_LLT(0x%X) =%08x\n", ++ __func__, ++ REG_AUTO_LLT, ++ val32 ++ ); + break; + } + @@ -69206,141 +67372,144 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + return ret; +} + -+static bool -+Hal_GetChnlGroup8723B( -+u8 Channel, -+ u8 *pGroup -+ ) ++static bool Hal_GetChnlGroup8723B(u8 Channel, u8 *pGroup) +{ -+ bool bIn24G =true; ++ bool bIn24G = true; + -+ if (Channel <= 14) -+ { -+ bIn24G =true; ++ if (Channel <= 14) { ++ bIn24G = true; + -+ if (1 <= Channel && Channel <= 2) *pGroup = 0; -+ else if (3 <= Channel && Channel <= 5) *pGroup = 1; -+ else if (6 <= Channel && Channel <= 8) *pGroup = 2; -+ else if (9 <= Channel && Channel <= 11) *pGroup = 3; -+ else if (12 <= Channel && Channel <= 14) *pGroup = 4; -+ else -+ { ++ if (1 <= Channel && Channel <= 2) ++ *pGroup = 0; ++ else if (3 <= Channel && Channel <= 5) ++ *pGroup = 1; ++ else if (6 <= Channel && Channel <= 8) ++ *pGroup = 2; ++ else if (9 <= Channel && Channel <= 11) ++ *pGroup = 3; ++ else if (12 <= Channel && Channel <= 14) ++ *pGroup = 4; ++ else { + RT_TRACE(_module_hci_hal_init_c_, _drv_notice_, ("==>Hal_GetChnlGroup8723B in 2.4 G, but Channel %d in Group not found\n", Channel)); + } -+ } -+ else -+ { -+ bIn24G =false; ++ } else { ++ bIn24G = false; + -+ if (36 <= Channel && Channel <= 42) *pGroup = 0; -+ else if (44 <= Channel && Channel <= 48) *pGroup = 1; -+ else if (50 <= Channel && Channel <= 58) *pGroup = 2; -+ else if (60 <= Channel && Channel <= 64) *pGroup = 3; -+ else if (100 <= Channel && Channel <= 106) *pGroup = 4; -+ else if (108 <= Channel && Channel <= 114) *pGroup = 5; -+ else if (116 <= Channel && Channel <= 122) *pGroup = 6; -+ else if (124 <= Channel && Channel <= 130) *pGroup = 7; -+ else if (132 <= Channel && Channel <= 138) *pGroup = 8; -+ else if (140 <= Channel && Channel <= 144) *pGroup = 9; -+ else if (149 <= Channel && Channel <= 155) *pGroup = 10; -+ else if (157 <= Channel && Channel <= 161) *pGroup = 11; -+ else if (165 <= Channel && Channel <= 171) *pGroup = 12; -+ else if (173 <= Channel && Channel <= 177) *pGroup = 13; -+ else -+ { ++ if (36 <= Channel && Channel <= 42) ++ *pGroup = 0; ++ else if (44 <= Channel && Channel <= 48) ++ *pGroup = 1; ++ else if (50 <= Channel && Channel <= 58) ++ *pGroup = 2; ++ else if (60 <= Channel && Channel <= 64) ++ *pGroup = 3; ++ else if (100 <= Channel && Channel <= 106) ++ *pGroup = 4; ++ else if (108 <= Channel && Channel <= 114) ++ *pGroup = 5; ++ else if (116 <= Channel && Channel <= 122) ++ *pGroup = 6; ++ else if (124 <= Channel && Channel <= 130) ++ *pGroup = 7; ++ else if (132 <= Channel && Channel <= 138) ++ *pGroup = 8; ++ else if (140 <= Channel && Channel <= 144) ++ *pGroup = 9; ++ else if (149 <= Channel && Channel <= 155) ++ *pGroup = 10; ++ else if (157 <= Channel && Channel <= 161) ++ *pGroup = 11; ++ else if (165 <= Channel && Channel <= 171) ++ *pGroup = 12; ++ else if (173 <= Channel && Channel <= 177) ++ *pGroup = 13; ++ else { + RT_TRACE(_module_hci_hal_init_c_, _drv_notice_, ("==>Hal_GetChnlGroup8723B in 5G, but Channel %d in Group not found\n", Channel)); + } + + } -+ RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("<==Hal_GetChnlGroup8723B, (%s) Channel = %d, Group =%d,\n", -+ (bIn24G) ? "2.4G" : "5G", Channel, *pGroup)); ++ RT_TRACE( ++ _module_hci_hal_init_c_, ++ _drv_info_, ++ ( ++ "<==Hal_GetChnlGroup8723B, (%s) Channel = %d, Group =%d,\n", ++ bIn24G ? "2.4G" : "5G", ++ Channel, ++ *pGroup ++ ) ++ ); + return bIn24G; +} + -+void -+Hal_InitPGData( -+ struct adapter *padapter, -+ u8 *PROMContent) ++void Hal_InitPGData(struct adapter *padapter, u8 *PROMContent) +{ + struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter); + -+ if (false == pEEPROM->bautoload_fail_flag) -+ { /* autoload OK. */ ++ if (false == pEEPROM->bautoload_fail_flag) { /* autoload OK. */ + if (!pEEPROM->EepromOrEfuse) { + /* Read EFUSE real map to shadow. */ + EFUSE_ShadowMapUpdate(padapter, EFUSE_WIFI, false); -+ memcpy((void*)PROMContent, (void*)pEEPROM->efuse_eeprom_data, HWSET_MAX_SIZE_8723B); ++ memcpy((void *)PROMContent, (void *)pEEPROM->efuse_eeprom_data, HWSET_MAX_SIZE_8723B); + } + } else {/* autoload fail */ + RT_TRACE(_module_hci_hal_init_c_, _drv_notice_, ("AutoLoad Fail reported from CR9346!!\n")); + if (false == pEEPROM->EepromOrEfuse) + EFUSE_ShadowMapUpdate(padapter, EFUSE_WIFI, false); -+ memcpy((void*)PROMContent, (void*)pEEPROM->efuse_eeprom_data, HWSET_MAX_SIZE_8723B); ++ memcpy((void *)PROMContent, (void *)pEEPROM->efuse_eeprom_data, HWSET_MAX_SIZE_8723B); + } +} + -+void -+Hal_EfuseParseIDCode( -+struct adapter *padapter, -+u8 *hwinfo -+ ) ++void Hal_EfuseParseIDCode(struct adapter *padapter, u8 *hwinfo) +{ + struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter); +/* struct hal_com_data *pHalData = GET_HAL_DATA(padapter); */ -+ u16 EEPROMId; ++ u16 EEPROMId; + + + /* Checl 0x8129 again for making sure autoload status!! */ -+ EEPROMId = le16_to_cpu(*((__le16*)hwinfo)); -+ if (EEPROMId != RTL_EEPROM_ID) -+ { ++ EEPROMId = le16_to_cpu(*((__le16 *)hwinfo)); ++ if (EEPROMId != RTL_EEPROM_ID) { + DBG_8192C("EEPROM ID(%#x) is invalid!!\n", EEPROMId); + pEEPROM->bautoload_fail_flag = true; -+ } -+ else -+ { ++ } else + pEEPROM->bautoload_fail_flag = false; -+ } + + RT_TRACE(_module_hal_init_c_, _drv_notice_, ("EEPROM ID = 0x%04x\n", EEPROMId)); +} + -+static void Hal_ReadPowerValueFromPROM_8723B(struct adapter *Adapter, -+ struct TxPowerInfo24G *pwrInfo24G, -+ u8 *PROMContent, bool AutoLoadFail) ++static void Hal_ReadPowerValueFromPROM_8723B( ++ struct adapter *Adapter, ++ struct TxPowerInfo24G *pwrInfo24G, ++ u8 *PROMContent, ++ bool AutoLoadFail ++) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); -+ u32 rfPath, eeAddr =EEPROM_TX_PWR_INX_8723B, group, TxCount = 0; ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ u32 rfPath, eeAddr = EEPROM_TX_PWR_INX_8723B, group, TxCount = 0; + + memset(pwrInfo24G, 0, sizeof(struct TxPowerInfo24G)); + + if (0xFF == PROMContent[eeAddr+1]) + AutoLoadFail = true; + -+ if (AutoLoadFail) -+ { ++ if (AutoLoadFail) { + DBG_871X("%s(): Use Default value!\n", __func__); -+ for (rfPath = 0 ; rfPath < MAX_RF_PATH ; rfPath++) -+ { ++ for (rfPath = 0; rfPath < MAX_RF_PATH; rfPath++) { + /* 2.4G default value */ -+ for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++) -+ { -+ pwrInfo24G->IndexCCK_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX; -+ pwrInfo24G->IndexBW40_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX; ++ for (group = 0; group < MAX_CHNL_GROUP_24G; group++) { ++ pwrInfo24G->IndexCCK_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX; ++ pwrInfo24G->IndexBW40_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX; + } -+ for (TxCount = 0;TxCountBW20_Diff[rfPath][0] = EEPROM_DEFAULT_24G_HT20_DIFF; -+ pwrInfo24G->OFDM_Diff[rfPath][0] = EEPROM_DEFAULT_24G_OFDM_DIFF; -+ } -+ else -+ { -+ pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; -+ pwrInfo24G->BW40_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; -+ pwrInfo24G->CCK_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; -+ pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; ++ ++ for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) { ++ if (TxCount == 0) { ++ pwrInfo24G->BW20_Diff[rfPath][0] = EEPROM_DEFAULT_24G_HT20_DIFF; ++ pwrInfo24G->OFDM_Diff[rfPath][0] = EEPROM_DEFAULT_24G_OFDM_DIFF; ++ } else { ++ pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; ++ pwrInfo24G->BW40_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; ++ pwrInfo24G->CCK_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; ++ pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; + } + } + } @@ -69350,83 +67519,70 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + pHalData->bTXPowerDataReadFromEEPORM = true; /* YJ, move, 120316 */ + -+ for (rfPath = 0 ; rfPath < MAX_RF_PATH ; rfPath++) -+ { ++ for (rfPath = 0; rfPath < MAX_RF_PATH; rfPath++) { + /* 2 2.4G default value */ -+ for (group = 0 ; group < MAX_CHNL_GROUP_24G; group++) -+ { ++ for (group = 0; group < MAX_CHNL_GROUP_24G; group++) { + pwrInfo24G->IndexCCK_Base[rfPath][group] = PROMContent[eeAddr++]; + if (pwrInfo24G->IndexCCK_Base[rfPath][group] == 0xFF) -+ { + pwrInfo24G->IndexCCK_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX; -+ } + } -+ for (group = 0 ; group < MAX_CHNL_GROUP_24G-1; group++) -+ { ++ ++ for (group = 0; group < MAX_CHNL_GROUP_24G-1; group++) { + pwrInfo24G->IndexBW40_Base[rfPath][group] = PROMContent[eeAddr++]; + if (pwrInfo24G->IndexBW40_Base[rfPath][group] == 0xFF) + pwrInfo24G->IndexBW40_Base[rfPath][group] = EEPROM_DEFAULT_24G_INDEX; + } -+ for (TxCount = 0;TxCountBW40_Diff[rfPath][TxCount] = 0; + if (PROMContent[eeAddr] == 0xFF) + pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_24G_HT20_DIFF; -+ else -+ { ++ else { + pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; + if (pwrInfo24G->BW20_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */ + pwrInfo24G->BW20_Diff[rfPath][TxCount] |= 0xF0; + } + + if (PROMContent[eeAddr] == 0xFF) -+ pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_24G_OFDM_DIFF; -+ else -+ { -+ pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); ++ pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_24G_OFDM_DIFF; ++ else { ++ pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); + if (pwrInfo24G->OFDM_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */ + pwrInfo24G->OFDM_Diff[rfPath][TxCount] |= 0xF0; + } + pwrInfo24G->CCK_Diff[rfPath][TxCount] = 0; + eeAddr++; -+ } -+ else -+ { ++ } else { + if (PROMContent[eeAddr] == 0xFF) -+ pwrInfo24G->BW40_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; -+ else -+ { -+ pwrInfo24G->BW40_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; ++ pwrInfo24G->BW40_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; ++ else { ++ pwrInfo24G->BW40_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; + if (pwrInfo24G->BW40_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */ + pwrInfo24G->BW40_Diff[rfPath][TxCount] |= 0xF0; + } + + if (PROMContent[eeAddr] == 0xFF) -+ pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; -+ else -+ { -+ pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); ++ pwrInfo24G->BW20_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; ++ else { ++ pwrInfo24G->BW20_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); + if (pwrInfo24G->BW20_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */ + pwrInfo24G->BW20_Diff[rfPath][TxCount] |= 0xF0; + } + eeAddr++; + + if (PROMContent[eeAddr] == 0xFF) -+ pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; -+ else -+ { -+ pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; ++ pwrInfo24G->OFDM_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; ++ else { ++ pwrInfo24G->OFDM_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0xf0)>>4; + if (pwrInfo24G->OFDM_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */ + pwrInfo24G->OFDM_Diff[rfPath][TxCount] |= 0xF0; + } + + if (PROMContent[eeAddr] == 0xFF) -+ pwrInfo24G->CCK_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; -+ else -+ { -+ pwrInfo24G->CCK_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); ++ pwrInfo24G->CCK_Diff[rfPath][TxCount] = EEPROM_DEFAULT_DIFF; ++ else { ++ pwrInfo24G->CCK_Diff[rfPath][TxCount] = (PROMContent[eeAddr]&0x0f); + if (pwrInfo24G->CCK_Diff[rfPath][TxCount] & BIT3) /* 4bit sign number to 8 bit sign number */ + pwrInfo24G->CCK_Diff[rfPath][TxCount] |= 0xF0; + } @@ -69437,49 +67593,40 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 +} + + -+void -+Hal_EfuseParseTxPowerInfo_8723B( -+struct adapter * padapter, -+u8* PROMContent, -+bool AutoLoadFail -+ ) ++void Hal_EfuseParseTxPowerInfo_8723B( ++ struct adapter *padapter, u8 *PROMContent, bool AutoLoadFail ++) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + struct TxPowerInfo24G pwrInfo24G; + u8 rfPath, ch, TxCount = 1; + + Hal_ReadPowerValueFromPROM_8723B(padapter, &pwrInfo24G, PROMContent, AutoLoadFail); -+ for (rfPath = 0 ; rfPath < MAX_RF_PATH ; rfPath++) -+ { -+ for (ch = 0 ; ch < CHANNEL_MAX_NUMBER; ch++) -+ { ++ for (rfPath = 0 ; rfPath < MAX_RF_PATH ; rfPath++) { ++ for (ch = 0 ; ch < CHANNEL_MAX_NUMBER; ch++) { + u8 group = 0; + + Hal_GetChnlGroup8723B(ch+1, &group); + -+ if (ch == 14-1) -+ { ++ if (ch == 14-1) { + pHalData->Index24G_CCK_Base[rfPath][ch] = pwrInfo24G.IndexCCK_Base[rfPath][5]; + pHalData->Index24G_BW40_Base[rfPath][ch] = pwrInfo24G.IndexBW40_Base[rfPath][group]; -+ } -+ else -+ { ++ } else { + pHalData->Index24G_CCK_Base[rfPath][ch] = pwrInfo24G.IndexCCK_Base[rfPath][group]; + pHalData->Index24G_BW40_Base[rfPath][ch] = pwrInfo24G.IndexBW40_Base[rfPath][group]; + } +#ifdef CONFIG_DEBUG + RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("======= Path %d, ChannelIndex %d, Group %d =======\n", rfPath, ch, group)); -+ RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("Index24G_CCK_Base[%d][%d] = 0x%x\n", rfPath, ch , pHalData->Index24G_CCK_Base[rfPath][ch])); ++ RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("Index24G_CCK_Base[%d][%d] = 0x%x\n", rfPath, ch, pHalData->Index24G_CCK_Base[rfPath][ch])); + RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("Index24G_BW40_Base[%d][%d] = 0x%x\n", rfPath, ch, pHalData->Index24G_BW40_Base[rfPath][ch])); +#endif + } + -+ for (TxCount = 0;TxCountCCK_24G_Diff[rfPath][TxCount]=pwrInfo24G.CCK_Diff[rfPath][TxCount]; -+ pHalData->OFDM_24G_Diff[rfPath][TxCount]=pwrInfo24G.OFDM_Diff[rfPath][TxCount]; -+ pHalData->BW20_24G_Diff[rfPath][TxCount]=pwrInfo24G.BW20_Diff[rfPath][TxCount]; -+ pHalData->BW40_24G_Diff[rfPath][TxCount]=pwrInfo24G.BW40_Diff[rfPath][TxCount]; ++ for (TxCount = 0; TxCount < MAX_TX_COUNT; TxCount++) { ++ pHalData->CCK_24G_Diff[rfPath][TxCount] = pwrInfo24G.CCK_Diff[rfPath][TxCount]; ++ pHalData->OFDM_24G_Diff[rfPath][TxCount] = pwrInfo24G.OFDM_Diff[rfPath][TxCount]; ++ pHalData->BW20_24G_Diff[rfPath][TxCount] = pwrInfo24G.BW20_Diff[rfPath][TxCount]; ++ pHalData->BW40_24G_Diff[rfPath][TxCount] = pwrInfo24G.BW40_Diff[rfPath][TxCount]; + +#ifdef CONFIG_DEBUG + RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("--------------------------------------- 2.4G ---------------------------------------\n")); @@ -69492,29 +67639,23 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + } + + /* 2010/10/19 MH Add Regulator recognize for CU. */ -+ if (!AutoLoadFail) -+ { ++ if (!AutoLoadFail) { + pHalData->EEPROMRegulatory = (PROMContent[EEPROM_RF_BOARD_OPTION_8723B]&0x7); /* bit0~2 */ + if (PROMContent[EEPROM_RF_BOARD_OPTION_8723B] == 0xFF) + pHalData->EEPROMRegulatory = (EEPROM_DEFAULT_BOARD_OPTION&0x7); /* bit0~2 */ -+ } -+ else -+ { ++ } else + pHalData->EEPROMRegulatory = 0; -+ } ++ + RT_TRACE(_module_hci_hal_init_c_, _drv_notice_, ("EEPROMRegulatory = 0x%x\n", pHalData->EEPROMRegulatory)); +} + -+void -+Hal_EfuseParseBTCoexistInfo_8723B( -+ struct adapter * padapter, -+ u8 *hwinfo, -+ bool AutoLoadFail -+ ) ++void Hal_EfuseParseBTCoexistInfo_8723B( ++ struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail ++) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ u8 tempval; -+ u32 tmpu4; ++ u8 tempval; ++ u32 tmpu4; + + if (!AutoLoadFail) { + tmpu4 = rtw_read32(padapter, REG_MULTI_FUNC_CTRL); @@ -69531,14 +67672,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + /* EFUSE_0xC3[6] == 0, S1(Main)-ODM_RF_PATH_A; */ + /* EFUSE_0xC3[6] == 1, S0(Aux)-ODM_RF_PATH_B */ + pHalData->ant_path = (tempval & BIT(6))?ODM_RF_PATH_B:ODM_RF_PATH_A; -+ } -+ else { ++ } else { + pHalData->EEPROMBluetoothAntNum = Ant_x1; -+ pHalData->ant_path = ODM_RF_PATH_A; ++ if (pHalData->PackageType == PACKAGE_QFN68) ++ pHalData->ant_path = ODM_RF_PATH_B; ++ else ++ pHalData->ant_path = ODM_RF_PATH_A; + } -+ } -+ else -+ { ++ } else { + pHalData->EEPROMBluetoothCoexist = false; + pHalData->EEPROMBluetoothType = BT_RTL8723B; + pHalData->EEPROMBluetoothAntNum = Ant_x1; @@ -69546,10 +67687,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + } + + if (padapter->registrypriv.ant_num > 0) { -+ DBG_8192C("%s: Apply driver defined antenna number(%d) to replace origin(%d)\n", ++ DBG_8192C( ++ "%s: Apply driver defined antenna number(%d) to replace origin(%d)\n", + __func__, + padapter->registrypriv.ant_num, -+ pHalData->EEPROMBluetoothAntNum ==Ant_x2?2:1); ++ pHalData->EEPROMBluetoothAntNum == Ant_x2 ? 2 : 1 ++ ); + + switch (padapter->registrypriv.ant_num) { + case 1: @@ -69559,32 +67702,32 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + pHalData->EEPROMBluetoothAntNum = Ant_x2; + break; + default: -+ DBG_8192C("%s: Discard invalid driver defined antenna number(%d)!\n", -+ __func__, padapter->registrypriv.ant_num); ++ DBG_8192C( ++ "%s: Discard invalid driver defined antenna number(%d)!\n", ++ __func__, ++ padapter->registrypriv.ant_num ++ ); + break; + } + } + + rtw_btcoex_SetBTCoexist(padapter, pHalData->EEPROMBluetoothCoexist); + rtw_btcoex_SetChipType(padapter, pHalData->EEPROMBluetoothType); -+ rtw_btcoex_SetPGAntNum(padapter, pHalData->EEPROMBluetoothAntNum ==Ant_x2?2:1); ++ rtw_btcoex_SetPGAntNum(padapter, pHalData->EEPROMBluetoothAntNum == Ant_x2 ? 2 : 1); + if (pHalData->EEPROMBluetoothAntNum == Ant_x1) -+ { + rtw_btcoex_SetSingleAntPath(padapter, pHalData->ant_path); -+ } + -+ DBG_8192C("%s: %s BT-coex, ant_num =%d\n", ++ DBG_8192C( ++ "%s: %s BT-coex, ant_num =%d\n", + __func__, -+ pHalData->EEPROMBluetoothCoexist ==true?"Enable":"Disable", -+ pHalData->EEPROMBluetoothAntNum ==Ant_x2?2:1); ++ pHalData->EEPROMBluetoothCoexist == true ? "Enable" : "Disable", ++ pHalData->EEPROMBluetoothAntNum == Ant_x2 ? 2 : 1 ++ ); +} + -+void -+Hal_EfuseParseEEPROMVer_8723B( -+struct adapter * padapter, -+u8* hwinfo, -+bool AutoLoadFail -+ ) ++void Hal_EfuseParseEEPROMVer_8723B( ++ struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail ++) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + @@ -69599,15 +67742,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + + -+void -+Hal_EfuseParsePackageType_8723B( -+struct adapter * padapter, -+u8* hwinfo, -+bool AutoLoadFail -+ ) ++void Hal_EfuseParsePackageType_8723B( ++ struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail ++) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ u8 package; ++ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); ++ u8 package; + u8 efuseContent; + + Efuse_PowerSwitch(padapter, false, true); @@ -69616,58 +67756,51 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + Efuse_PowerSwitch(padapter, false, false); + + package = efuseContent & 0x7; -+ switch (package) -+ { -+ case 0x4: -+ pHalData->PackageType = PACKAGE_TFBGA79; -+ break; -+ case 0x5: -+ pHalData->PackageType = PACKAGE_TFBGA90; -+ break; -+ case 0x6: -+ pHalData->PackageType = PACKAGE_QFN68; -+ break; -+ case 0x7: -+ pHalData->PackageType = PACKAGE_TFBGA80; -+ break; ++ switch (package) { ++ case 0x4: ++ pHalData->PackageType = PACKAGE_TFBGA79; ++ break; ++ case 0x5: ++ pHalData->PackageType = PACKAGE_TFBGA90; ++ break; ++ case 0x6: ++ pHalData->PackageType = PACKAGE_QFN68; ++ break; ++ case 0x7: ++ pHalData->PackageType = PACKAGE_TFBGA80; ++ break; + -+ default: -+ pHalData->PackageType = PACKAGE_DEFAULT; -+ break; ++ default: ++ pHalData->PackageType = PACKAGE_DEFAULT; ++ break; + } + + DBG_871X("PackageType = 0x%X\n", pHalData->PackageType); +} + + -+void -+Hal_EfuseParseVoltage_8723B( -+struct adapter * padapter, -+u8* hwinfo, -+bool AutoLoadFail -+ ) ++void Hal_EfuseParseVoltage_8723B( ++ struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail ++) +{ + struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter); + + /* memcpy(pEEPROM->adjuseVoltageVal, &hwinfo[EEPROM_Voltage_ADDR_8723B], 1); */ + DBG_871X("%s hwinfo[EEPROM_Voltage_ADDR_8723B] =%02x\n", __func__, hwinfo[EEPROM_Voltage_ADDR_8723B]); -+ pEEPROM->adjuseVoltageVal = (hwinfo[EEPROM_Voltage_ADDR_8723B] & 0xf0) >> 4 ; ++ pEEPROM->adjuseVoltageVal = (hwinfo[EEPROM_Voltage_ADDR_8723B] & 0xf0) >> 4; + DBG_871X("%s pEEPROM->adjuseVoltageVal =%x\n", __func__, pEEPROM->adjuseVoltageVal); +} + -+void -+Hal_EfuseParseChnlPlan_8723B( -+struct adapter * padapter, -+u8* hwinfo, -+bool AutoLoadFail -+ ) ++void Hal_EfuseParseChnlPlan_8723B( ++ struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail ++) +{ + padapter->mlmepriv.ChannelPlan = hal_com_config_channel_plan( -+ padapter -+ , hwinfo?hwinfo[EEPROM_ChannelPlan_8723B]:0xFF -+ , padapter->registrypriv.channel_plan -+ , RT_CHANNEL_DOMAIN_WORLD_NULL -+ , AutoLoadFail ++ padapter, ++ hwinfo ? hwinfo[EEPROM_ChannelPlan_8723B] : 0xFF, ++ padapter->registrypriv.channel_plan, ++ RT_CHANNEL_DOMAIN_WORLD_NULL, ++ AutoLoadFail + ); + + Hal_ChannelPlanToRegulation(padapter, padapter->mlmepriv.ChannelPlan); @@ -69675,66 +67808,50 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + RT_TRACE(_module_hci_hal_init_c_, _drv_notice_, ("EEPROM ChannelPlan = 0x%02x\n", padapter->mlmepriv.ChannelPlan)); +} + -+void -+Hal_EfuseParseCustomerID_8723B( -+struct adapter * padapter, -+u8* hwinfo, -+bool AutoLoadFail -+ ) ++void Hal_EfuseParseCustomerID_8723B( ++ struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail ++) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + +/* RT_TRACE(_module_hci_hal_init_c_, _drv_notice_, ("%s(): AutoLoadFail = %d\n", __func__, AutoLoadFail)); */ + if (!AutoLoadFail) -+ { + pHalData->EEPROMCustomerID = hwinfo[EEPROM_CustomID_8723B]; -+ } + else -+ { + pHalData->EEPROMCustomerID = 0; -+ } ++ + RT_TRACE(_module_hci_hal_init_c_, _drv_notice_, ("EEPROM Customer ID: 0x%2x\n", pHalData->EEPROMCustomerID)); +} + -+void -+Hal_EfuseParseAntennaDiversity_8723B( -+struct adapter * padapter, -+u8 * hwinfo, -+bool AutoLoadFail -+ ) ++void Hal_EfuseParseAntennaDiversity_8723B( ++ struct adapter *padapter, ++ u8 *hwinfo, ++ bool AutoLoadFail ++) +{ +} + -+void -+Hal_EfuseParseXtal_8723B( -+struct adapter * padapter, -+u8 * hwinfo, -+bool AutoLoadFail -+ ) ++void Hal_EfuseParseXtal_8723B( ++ struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail ++) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + +/* RT_TRACE(_module_hci_hal_init_c_, _drv_notice_, ("%s(): AutoLoadFail = %d\n", __func__, AutoLoadFail)); */ -+ if (!AutoLoadFail) -+ { ++ if (!AutoLoadFail) { + pHalData->CrystalCap = hwinfo[EEPROM_XTAL_8723B]; + if (pHalData->CrystalCap == 0xFF) + pHalData->CrystalCap = EEPROM_Default_CrystalCap_8723B; /* what value should 8812 set? */ -+ } -+ else -+ { ++ } else + pHalData->CrystalCap = EEPROM_Default_CrystalCap_8723B; -+ } ++ + RT_TRACE(_module_hci_hal_init_c_, _drv_notice_, ("EEPROM CrystalCap: 0x%2x\n", pHalData->CrystalCap)); +} + + -+void -+Hal_EfuseParseThermalMeter_8723B( -+ struct adapter *padapter, -+ u8 *PROMContent, -+ u8 AutoLoadFail -+ ) ++void Hal_EfuseParseThermalMeter_8723B( ++ struct adapter *padapter, u8 *PROMContent, u8 AutoLoadFail ++) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + @@ -69747,8 +67864,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + else + pHalData->EEPROMThermalMeter = EEPROM_Default_ThermalMeter_8723B; + -+ if ((pHalData->EEPROMThermalMeter == 0xff) || (true == AutoLoadFail)) -+ { ++ if ((pHalData->EEPROMThermalMeter == 0xff) || (true == AutoLoadFail)) { + pHalData->bAPKThermalMeterIgnore = true; + pHalData->EEPROMThermalMeter = EEPROM_Default_ThermalMeter_8723B; + } @@ -69758,21 +67874,19 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + +void Hal_ReadRFGainOffset( -+ struct adapter * Adapter, -+ u8* PROMContent, -+ bool AutoloadFail) ++ struct adapter *Adapter, u8 *PROMContent, bool AutoloadFail ++) +{ + /* */ + /* BB_RF Gain Offset from EEPROM */ + /* */ + + if (!AutoloadFail) { -+ Adapter->eeprompriv.EEPROMRFGainOffset =PROMContent[EEPROM_RF_GAIN_OFFSET]; ++ Adapter->eeprompriv.EEPROMRFGainOffset = PROMContent[EEPROM_RF_GAIN_OFFSET]; + DBG_871X("AutoloadFail =%x,\n", AutoloadFail); -+ Adapter->eeprompriv.EEPROMRFGainVal =EFUSE_Read1Byte(Adapter, EEPROM_RF_GAIN_VAL); ++ Adapter->eeprompriv.EEPROMRFGainVal = EFUSE_Read1Byte(Adapter, EEPROM_RF_GAIN_VAL); + DBG_871X("Adapter->eeprompriv.EEPROMRFGainVal =%x\n", Adapter->eeprompriv.EEPROMRFGainVal); -+ } -+ else { ++ } else { + Adapter->eeprompriv.EEPROMRFGainOffset = 0; + Adapter->eeprompriv.EEPROMRFGainVal = 0xFF; + DBG_871X("else AutoloadFail =%x,\n", AutoloadFail); @@ -69780,34 +67894,26 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + DBG_871X("EEPRORFGainOffset = 0x%02x\n", Adapter->eeprompriv.EEPROMRFGainOffset); +} + -+u8 -+BWMapping_8723B( -+struct adapter * Adapter, -+struct pkt_attrib *pattrib -+) ++u8 BWMapping_8723B(struct adapter *Adapter, struct pkt_attrib *pattrib) +{ + u8 BWSettingOfDesc = 0; + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + + /* DBG_871X("BWMapping pHalData->CurrentChannelBW %d, pattrib->bwmode %d\n", pHalData->CurrentChannelBW, pattrib->bwmode); */ + -+ if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_80) -+ { ++ if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_80) { + if (pattrib->bwmode == CHANNEL_WIDTH_80) + BWSettingOfDesc = 2; + else if (pattrib->bwmode == CHANNEL_WIDTH_40) + BWSettingOfDesc = 1; + else + BWSettingOfDesc = 0; -+ } -+ else if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_40) -+ { ++ } else if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_40) { + if ((pattrib->bwmode == CHANNEL_WIDTH_40) || (pattrib->bwmode == CHANNEL_WIDTH_80)) + BWSettingOfDesc = 1; + else + BWSettingOfDesc = 0; -+ } -+ else ++ } else + BWSettingOfDesc = 0; + + /* if (pTcb->bBTTxPacket) */ @@ -69816,30 +67922,24 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + return BWSettingOfDesc; +} + -+u8 SCMapping_8723B(struct adapter * Adapter, struct pkt_attrib *pattrib) ++u8 SCMapping_8723B(struct adapter *Adapter, struct pkt_attrib *pattrib) +{ + u8 SCSettingOfDesc = 0; + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + + /* DBG_871X("SCMapping: pHalData->CurrentChannelBW %d, pHalData->nCur80MhzPrimeSC %d, pHalData->nCur40MhzPrimeSC %d\n", pHalData->CurrentChannelBW, pHalData->nCur80MhzPrimeSC, pHalData->nCur40MhzPrimeSC); */ + -+ if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_80) -+ { -+ if (pattrib->bwmode == CHANNEL_WIDTH_80) -+ { ++ if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_80) { ++ if (pattrib->bwmode == CHANNEL_WIDTH_80) { + SCSettingOfDesc = VHT_DATA_SC_DONOT_CARE; -+ } -+ else if (pattrib->bwmode == CHANNEL_WIDTH_40) -+ { ++ } else if (pattrib->bwmode == CHANNEL_WIDTH_40) { + if (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) + SCSettingOfDesc = VHT_DATA_SC_40_LOWER_OF_80MHZ; + else if (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) + SCSettingOfDesc = VHT_DATA_SC_40_UPPER_OF_80MHZ; + else + DBG_871X("SCMapping: Not Correct Primary40MHz Setting\n"); -+ } -+ else -+ { ++ } else { + if ((pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) && (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER)) + SCSettingOfDesc = VHT_DATA_SC_20_LOWEST_OF_80MHZ; + else if ((pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) && (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER)) @@ -69851,33 +67951,21 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + else + DBG_871X("SCMapping: Not Correct Primary40MHz Setting\n"); + } -+ } -+ else if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_40) -+ { ++ } else if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_40) { + /* DBG_871X("SCMapping: HT Case: pHalData->CurrentChannelBW %d, pHalData->nCur40MhzPrimeSC %d\n", pHalData->CurrentChannelBW, pHalData->nCur40MhzPrimeSC); */ + -+ if (pattrib->bwmode == CHANNEL_WIDTH_40) -+ { ++ if (pattrib->bwmode == CHANNEL_WIDTH_40) { + SCSettingOfDesc = VHT_DATA_SC_DONOT_CARE; -+ } -+ else if (pattrib->bwmode == CHANNEL_WIDTH_20) -+ { -+ if (pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) -+ { ++ } else if (pattrib->bwmode == CHANNEL_WIDTH_20) { ++ if (pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) { + SCSettingOfDesc = VHT_DATA_SC_20_UPPER_OF_80MHZ; -+ } -+ else if (pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) -+ { ++ } else if (pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) { + SCSettingOfDesc = VHT_DATA_SC_20_LOWER_OF_80MHZ; -+ } -+ else -+ { ++ } else { + SCSettingOfDesc = VHT_DATA_SC_DONOT_CARE; + } + } -+ } -+ else -+ { ++ } else { + SCSettingOfDesc = VHT_DATA_SC_DONOT_CARE; + } + @@ -69886,7 +67974,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + +static void rtl8723b_cal_txdesc_chksum(struct tx_desc *ptxdesc) +{ -+ u16 *usPtr = (u16*)ptxdesc; ++ u16 *usPtr = (u16 *)ptxdesc; + u32 count; + u32 index; + u16 checksum = 0; @@ -69910,25 +67998,23 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 +static u8 fill_txdesc_sectype(struct pkt_attrib *pattrib) +{ + u8 sectype = 0; -+ if ((pattrib->encrypt > 0) && !pattrib->bswenc) -+ { -+ switch (pattrib->encrypt) -+ { -+ /* SEC_TYPE */ -+ case _WEP40_: -+ case _WEP104_: -+ case _TKIP_: -+ case _TKIP_WTMIC_: -+ sectype = 1; -+ break; ++ if ((pattrib->encrypt > 0) && !pattrib->bswenc) { ++ switch (pattrib->encrypt) { ++ /* SEC_TYPE */ ++ case _WEP40_: ++ case _WEP104_: ++ case _TKIP_: ++ case _TKIP_WTMIC_: ++ sectype = 1; ++ break; + -+ case _AES_: -+ sectype = 3; -+ break; ++ case _AES_: ++ sectype = 3; ++ break; + -+ case _NO_PRIVACY_: -+ default: -+ break; ++ case _NO_PRIVACY_: ++ default: ++ break; + } + } + return sectype; @@ -69938,23 +68024,21 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 +{ + /* DBG_8192C("cvs_mode =%d\n", pattrib->vcs_mode); */ + -+ if (pattrib->vcs_mode) -+ { -+ switch (pattrib->vcs_mode) -+ { -+ case RTS_CTS: -+ ptxdesc->rtsen = 1; -+ /* ENABLE HW RTS */ -+ ptxdesc->hw_rts_en = 1; -+ break; ++ if (pattrib->vcs_mode) { ++ switch (pattrib->vcs_mode) { ++ case RTS_CTS: ++ ptxdesc->rtsen = 1; ++ /* ENABLE HW RTS */ ++ ptxdesc->hw_rts_en = 1; ++ break; + -+ case CTS_TO_SELF: -+ ptxdesc->cts2self = 1; -+ break; ++ case CTS_TO_SELF: ++ ptxdesc->cts2self = 1; ++ break; + -+ case NONE_VCS: -+ default: -+ break; ++ case NONE_VCS: ++ default: ++ break; + } + + ptxdesc->rtsrate = 8; /* RTS Rate =24M */ @@ -69965,9 +68049,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + /* Set RTS BW */ + if (pattrib->ht_en) -+ { + ptxdesc->rts_sc = SCMapping_8723B(padapter, pattrib); -+ } + } +} + @@ -69975,8 +68057,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 +{ + /* DBG_8192C("bwmode =%d, ch_off =%d\n", pattrib->bwmode, pattrib->ch_offset); */ + -+ if (pattrib->ht_en) -+ { ++ if (pattrib->ht_en) { + ptxdesc->data_bw = BWMapping_8723B(padapter, pattrib); + + ptxdesc->data_sc = SCMapping_8723B(padapter, pattrib); @@ -69984,8 +68065,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 +} + +static void rtl8723b_fill_default_txdesc( -+ struct xmit_frame *pxmitframe, -+ u8 *pbuf) ++ struct xmit_frame *pxmitframe, u8 *pbuf ++) +{ + struct adapter *padapter; + struct hal_com_data *pHalData; @@ -70009,8 +68090,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + ptxdesc = (PTXDESC_8723B)pbuf; + -+ if (pxmitframe->frame_tag == DATA_FRAMETAG) -+ { ++ if (pxmitframe->frame_tag == DATA_FRAMETAG) { + u8 drv_userate = 0; + + ptxdesc->macid = pattrib->mac_id; /* CAM_ID(MAC_ID) */ @@ -70024,33 +68104,30 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + if (pattrib->icmp_pkt == 1 && padapter->registrypriv.wifi_spec == 1) + drv_userate = 1; + -+ if ((pattrib->ether_type != 0x888e) && ++ if ( ++ (pattrib->ether_type != 0x888e) && + (pattrib->ether_type != 0x0806) && + (pattrib->ether_type != 0x88B4) && + (pattrib->dhcp_pkt != 1) && + (drv_userate != 1) +#ifdef CONFIG_AUTO_AP_MODE -+ && (pattrib->pctrl != true) ++ && (pattrib->pctrl != true) +#endif -+ ) -+ { ++ ) { + /* Non EAP & ARP & DHCP type data packet */ + -+ if (pattrib->ampdu_en == true) -+ { ++ if (pattrib->ampdu_en == true) { + ptxdesc->agg_en = 1; /* AGG EN */ + ptxdesc->max_agg_num = 0x1f; + ptxdesc->ampdu_density = pattrib->ampdu_spacing; -+ } -+ else ++ } else + ptxdesc->bk = 1; /* AGG BK */ + + fill_txdesc_phy_8723b(padapter, pattrib, ptxdesc); + + ptxdesc->data_ratefb_lmt = 0x1F; + -+ if (pHalData->fw_ractrl == false) -+ { ++ if (pHalData->fw_ractrl == false) { + ptxdesc->userate = 1; + + if (pHalData->dmpriv.INIDATA_RATE[pattrib->mac_id] & BIT(7)) @@ -70076,9 +68153,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 +#ifdef CONFIG_CMCC_TEST + ptxdesc->data_short = 1; /* use cck short premble */ +#endif -+ } -+ else -+ { ++ } else { + /* EAP data packet and ARP packet. */ + /* Use the 1M data rate to send the EAP/ARP packet. */ + /* This will maybe make the handshake smooth. */ @@ -70092,9 +68167,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + } + + ptxdesc->usb_txagg_num = pxmitframe->agg_num; -+ } -+ else if (pxmitframe->frame_tag == MGNT_FRAMETAG) -+ { ++ } else if (pxmitframe->frame_tag == MGNT_FRAMETAG) { +/* RT_TRACE(_module_hal_xmit_c_, _drv_notice_, ("%s: MGNT_FRAMETAG\n", __func__)); */ + + ptxdesc->macid = pattrib->mac_id; /* CAM_ID(MAC_ID) */ @@ -70122,13 +68195,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + ptxdesc->spe_rpt = 1; + ptxdesc->sw_define = (u8)(GET_PRIMARY_ADAPTER(padapter)->xmitpriv.seq_no); + } -+ } -+ else if (pxmitframe->frame_tag == TXAGG_FRAMETAG) -+ { ++ } else if (pxmitframe->frame_tag == TXAGG_FRAMETAG) { + RT_TRACE(_module_hal_xmit_c_, _drv_warning_, ("%s: TXAGG_FRAMETAG\n", __func__)); -+ } -+ else -+ { ++ } else { + RT_TRACE(_module_hal_xmit_c_, _drv_warning_, ("%s: frame_tag = 0x%x\n", __func__, pxmitframe->frame_tag)); + + ptxdesc->macid = pattrib->mac_id; /* CAM_ID(MAC_ID) */ @@ -70142,7 +68211,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + ptxdesc->pktlen = pattrib->last_txcmdsz; + ptxdesc->offset = TXDESC_SIZE + OFFSET_SZ; + -+ if (bmcst) ptxdesc->bmc = 1; ++ if (bmcst) ++ ptxdesc->bmc = 1; + + /* 2009.11.05. tynli_test. Suggested by SD4 Filen for FW LPS. */ + /* (1) The sequence number of each non-Qos frame / broadcast / multicast / */ @@ -70152,11 +68222,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + /* (2) Enable HW SEQ control for beacon packet, because we use Hw beacon. */ + /* (3) Use HW Qos SEQ to control the seq num of Ext port non-Qos packets. */ + /* 2010.06.23. Added by tynli. */ -+ if (!pattrib->qos_en) -+ { -+ /* Hw set sequence number */ ++ if (!pattrib->qos_en) /* Hw set sequence number */ + ptxdesc->en_hwseq = 1; /* HWSEQ_EN */ -+ } +} + +/* @@ -70172,7 +68239,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + rtl8723b_fill_default_txdesc(pxmitframe, pbuf); + -+ pdesc = (struct tx_desc*)pbuf; ++ pdesc = (struct tx_desc *)pbuf; + pdesc->txdw0 = pdesc->txdw0; + pdesc->txdw1 = pdesc->txdw1; + pdesc->txdw2 = pdesc->txdw2; @@ -70196,11 +68263,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 +/* type1:pspoll, type2:null */ +void rtl8723b_fill_fake_txdesc( + struct adapter *padapter, -+ u8* pDesc, -+ u32 BufferLen, -+ u8 IsPsPoll, -+ u8 IsBTQosNull, -+ u8 bDataFrame) ++ u8 *pDesc, ++ u32 BufferLen, ++ u8 IsPsPoll, ++ u8 IsBTQosNull, ++ u8 bDataFrame ++) +{ + /* Clear all status */ + memset(pDesc, 0, TXDESC_SIZE); @@ -70214,18 +68282,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + SET_TX_DESC_QUEUE_SEL_8723B(pDesc, QSLT_MGNT); /* Fixed queue of Mgnt queue */ + + /* Set NAVUSEHDR to prevent Ps-poll AId filed to be changed to error vlaue by Hw. */ -+ if (true == IsPsPoll) -+ { ++ if (true == IsPsPoll) { + SET_TX_DESC_NAV_USE_HDR_8723B(pDesc, 1); -+ } -+ else -+ { ++ } else { + SET_TX_DESC_HWSEQ_EN_8723B(pDesc, 1); /* Hw set sequence number */ + SET_TX_DESC_HWSEQ_SEL_8723B(pDesc, 0); + } + -+ if (true ==IsBTQosNull) -+ { ++ if (true == IsBTQosNull) { + SET_TX_DESC_BT_INT_8723B(pDesc, 1); + } + @@ -70237,36 +68301,34 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + /* */ + /* Encrypt the data frame if under security mode excepct null data. Suggested by CCW. */ + /* */ -+ if (true ==bDataFrame) -+ { ++ if (true == bDataFrame) { + u32 EncAlg; + + EncAlg = padapter->securitypriv.dot11PrivacyAlgrthm; -+ switch (EncAlg) -+ { -+ case _NO_PRIVACY_: -+ SET_TX_DESC_SEC_TYPE_8723B(pDesc, 0x0); -+ break; -+ case _WEP40_: -+ case _WEP104_: -+ case _TKIP_: -+ SET_TX_DESC_SEC_TYPE_8723B(pDesc, 0x1); -+ break; -+ case _SMS4_: -+ SET_TX_DESC_SEC_TYPE_8723B(pDesc, 0x2); -+ break; -+ case _AES_: -+ SET_TX_DESC_SEC_TYPE_8723B(pDesc, 0x3); -+ break; -+ default: -+ SET_TX_DESC_SEC_TYPE_8723B(pDesc, 0x0); -+ break; ++ switch (EncAlg) { ++ case _NO_PRIVACY_: ++ SET_TX_DESC_SEC_TYPE_8723B(pDesc, 0x0); ++ break; ++ case _WEP40_: ++ case _WEP104_: ++ case _TKIP_: ++ SET_TX_DESC_SEC_TYPE_8723B(pDesc, 0x1); ++ break; ++ case _SMS4_: ++ SET_TX_DESC_SEC_TYPE_8723B(pDesc, 0x2); ++ break; ++ case _AES_: ++ SET_TX_DESC_SEC_TYPE_8723B(pDesc, 0x3); ++ break; ++ default: ++ SET_TX_DESC_SEC_TYPE_8723B(pDesc, 0x0); ++ break; + } + } + + /* USB interface drop packet if the checksum of descriptor isn't correct. */ + /* Using this checksum can let hardware recovery from packet bulk out error (e.g. Cancel URC, Bulk out error.). */ -+ rtl8723b_cal_txdesc_chksum((struct tx_desc*)pDesc); ++ rtl8723b_cal_txdesc_chksum((struct tx_desc *)pDesc); +} + +static void hw_var_set_opmode(struct adapter *padapter, u8 variable, u8 *val) @@ -70284,8 +68346,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + Set_MSR(padapter, mode); + DBG_871X("#### %s() -%d iface_type(0) mode = %d ####\n", __func__, __LINE__, mode); + -+ if ((mode == _HW_STATE_STATION_) || (mode == _HW_STATE_NOLINK_)) -+ { ++ if ((mode == _HW_STATE_STATION_) || (mode == _HW_STATE_NOLINK_)) { + { + StopTxBeacon(padapter); +#ifdef CONFIG_INTERRUPT_BASED_TXBCN @@ -70295,7 +68356,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 +#endif /* CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT */ + +#ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR -+ UpdateInterruptMask8812AU(padapter, true , 0, (IMR_TXBCN0ERR_8723B|IMR_TXBCN0OK_8723B)); ++ UpdateInterruptMask8812AU(padapter, true, 0, (IMR_TXBCN0ERR_8723B|IMR_TXBCN0OK_8723B)); +#endif /* CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR */ + +#endif /* CONFIG_INTERRUPT_BASED_TXBCN */ @@ -70304,21 +68365,17 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + /* disable atim wnd */ + rtw_write8(padapter, REG_BCN_CTRL, DIS_TSF_UDT|EN_BCN_FUNCTION|DIS_ATIM); + /* rtw_write8(padapter, REG_BCN_CTRL, 0x18); */ -+ } -+ else if ((mode == _HW_STATE_ADHOC_) /*|| (mode == _HW_STATE_AP_)*/) -+ { ++ } else if ((mode == _HW_STATE_ADHOC_) /*|| (mode == _HW_STATE_AP_)*/) { + ResumeTxBeacon(padapter); + rtw_write8(padapter, REG_BCN_CTRL, DIS_TSF_UDT|EN_BCN_FUNCTION|DIS_BCNQ_SUB); -+ } -+ else if (mode == _HW_STATE_AP_) -+ { ++ } else if (mode == _HW_STATE_AP_) { +#ifdef CONFIG_INTERRUPT_BASED_TXBCN +#ifdef CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT -+ UpdateInterruptMask8723BU(padapter, true , IMR_BCNDMAINT0_8723B, 0); ++ UpdateInterruptMask8723BU(padapter, true, IMR_BCNDMAINT0_8723B, 0); +#endif /* CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT */ + +#ifdef CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR -+ UpdateInterruptMask8723BU(padapter, true , (IMR_TXBCN0ERR_8723B|IMR_TXBCN0OK_8723B), 0); ++ UpdateInterruptMask8723BU(padapter, true, (IMR_TXBCN0ERR_8723B|IMR_TXBCN0OK_8723B), 0); +#endif /* CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR */ + +#endif /* CONFIG_INTERRUPT_BASED_TXBCN */ @@ -70355,8 +68412,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + rtw_hal_set_hwreg(padapter, HW_VAR_DL_BCN_SEL, NULL); + + /* select BCN on port 0 */ -+ rtw_write8(padapter, REG_CCK_CHECK_8723B, -+ (rtw_read8(padapter, REG_CCK_CHECK_8723B)& ~BIT_BCN_PORT_SEL)); ++ rtw_write8( ++ padapter, ++ REG_CCK_CHECK_8723B, ++ (rtw_read8(padapter, REG_CCK_CHECK_8723B)&~BIT_BCN_PORT_SEL) ++ ); + + /* dis BCN1 ATIM WND if if2 is station */ + val8 = rtw_read8(padapter, REG_BCN_CTRL_1); @@ -70374,9 +68434,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + reg_macid = REG_MACID; + + for (idx = 0 ; idx < 6; idx++) -+ { + rtw_write8(GET_PRIMARY_ADAPTER(padapter), (reg_macid+idx), val[idx]); -+ } +} + +static void hw_var_set_bssid(struct adapter *padapter, u8 variable, u8 *val) @@ -70387,9 +68445,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + reg_bssid = REG_BSSID; + + for (idx = 0 ; idx < 6; idx++) -+ { + rtw_write8(padapter, (reg_bssid+idx), val[idx]); -+ } +} + +static void hw_var_set_bcn_func(struct adapter *padapter, u8 variable, u8 *val) @@ -70399,11 +68455,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + bcn_ctrl_reg = REG_BCN_CTRL; + + if (*(u8 *)val) -+ { + rtw_write8(padapter, bcn_ctrl_reg, (EN_BCN_FUNCTION | EN_TXBCN_RPT)); -+ } -+ else -+ { ++ else { + u8 val8; + val8 = rtw_read8(padapter, bcn_ctrl_reg); + val8 &= ~(EN_BCN_FUNCTION | EN_TXBCN_RPT); @@ -70419,7 +68472,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 +static void hw_var_set_correct_tsf(struct adapter *padapter, u8 variable, u8 *val) +{ + u8 val8; -+ u64 tsf; ++ u64 tsf; + struct mlme_ext_priv *pmlmeext; + struct mlme_ext_info *pmlmeinfo; + @@ -70427,13 +68480,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + pmlmeext = &padapter->mlmeextpriv; + pmlmeinfo = &pmlmeext->mlmext_info; + -+ tsf = pmlmeext->TSFValue - rtw_modular64(pmlmeext->TSFValue, (pmlmeinfo->bcn_interval*1024)) -1024; /* us */ ++ tsf = pmlmeext->TSFValue-rtw_modular64(pmlmeext->TSFValue, (pmlmeinfo->bcn_interval*1024))-1024; /* us */ + -+ if (((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || -+ ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) -+ { ++ if ( ++ ((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ++ ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) ++ ) + StopTxBeacon(padapter); -+ } + + { + /* disable related TSF function */ @@ -70450,11 +68503,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + rtw_write8(padapter, REG_BCN_CTRL, val8); + } + -+ if (((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) -+ || ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)) -+ { ++ if ( ++ ((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) || ++ ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) ++ ) + ResumeTxBeacon(padapter); -+ } +} + +static void hw_var_set_mlme_disconnect(struct adapter *padapter, u8 variable, u8 *val) @@ -70495,21 +68548,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + value_rxfltmap2 = 0; + + if ((check_fwstate(pmlmepriv, WIFI_AP_STATE) == true)) -+ { + rcr_clear_bit = RCR_CBSSID_BCN; -+ } ++ + value_rcr = rtw_read32(padapter, REG_RCR); + -+ if (*((u8 *)val)) -+ { ++ if (*((u8 *)val)) { + /* under sitesurvey */ + value_rcr &= ~(rcr_clear_bit); + rtw_write32(padapter, REG_RCR, value_rcr); + + rtw_write16(padapter, REG_RXFLTMAP2, value_rxfltmap2); + -+ if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE)) -+ { ++ if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE)) { + /* disable update TSF */ + val8 = rtw_read8(padapter, reg_bcn_ctl); + val8 |= DIS_TSF_UDT; @@ -70518,18 +68568,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + /* Save orignal RRSR setting. */ + pHalData->RegRRSR = rtw_read16(padapter, REG_RRSR); -+ } -+ else -+ { ++ } else { + /* sitesurvey done */ + if (check_fwstate(pmlmepriv, (_FW_LINKED|WIFI_AP_STATE))) -+ { + /* enable to rx data frame */ + rtw_write16(padapter, REG_RXFLTMAP2, 0xFFFF); -+ } + -+ if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE)) -+ { ++ if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE)) { + /* enable update TSF */ + val8 = rtw_read8(padapter, reg_bcn_ctl); + val8 &= ~DIS_TSF_UDT; @@ -70562,8 +68607,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + pmlmepriv = &padapter->mlmepriv; + pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter); + -+ if (type == 0) /* prepare to join */ -+ { ++ if (type == 0) { /* prepare to join */ + /* enable to rx data frame.Accept all data frame */ + /* rtw_write32(padapter, REG_RCR, rtw_read32(padapter, REG_RCR)|RCR_ADF); */ + rtw_write16(padapter, REG_RXFLTMAP2, 0xFFFF); @@ -70576,29 +68620,19 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + rtw_write32(padapter, REG_RCR, val32); + + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) -+ { + RetryLimit = (pEEPROM->CustomerID == RT_CID_CCX) ? 7 : 48; -+ } + else /* Ad-hoc Mode */ -+ { + RetryLimit = 0x7; -+ } -+ } -+ else if (type == 1) /* joinbss_event call back when join res < 0 */ -+ { ++ } else if (type == 1) /* joinbss_event call back when join res < 0 */ + rtw_write16(padapter, REG_RXFLTMAP2, 0x00); -+ } -+ else if (type == 2) /* sta add event call back */ -+ { ++ else if (type == 2) { /* sta add event call back */ + /* enable update TSF */ + val8 = rtw_read8(padapter, REG_BCN_CTRL); + val8 &= ~DIS_TSF_UDT; + rtw_write8(padapter, REG_BCN_CTRL, val8); + + if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE)) -+ { + RetryLimit = 0x7; -+ } + } + + val16 = (RetryLimit << RETRY_LIMIT_SHORT_SHIFT) | (RetryLimit << RETRY_LIMIT_LONG_SHIFT); @@ -70626,9 +68660,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + rtw_ack_tx_done(&padapter->xmitpriv, RTW_SCTX_DONE_CCX_PKT_FAIL); + } +*/ -+ else { ++ else + rtw_ack_tx_done(&padapter->xmitpriv, RTW_SCTX_DONE_SUCCESS); -+ } +} + +s32 c2h_id_filter_ccx_8723b(u8 *buf) @@ -70654,38 +68687,36 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + goto exit; + } + -+ switch (pC2hEvent->id) -+ { -+ case C2H_AP_RPT_RSP: -+ break; -+ case C2H_DBG: -+ { -+ RT_TRACE(_module_hal_init_c_, _drv_info_, ("c2h_handler_8723b: %s\n", pC2hEvent->payload)); -+ } -+ break; ++ switch (pC2hEvent->id) { ++ case C2H_AP_RPT_RSP: ++ break; ++ case C2H_DBG: ++ { ++ RT_TRACE(_module_hal_init_c_, _drv_info_, ("c2h_handler_8723b: %s\n", pC2hEvent->payload)); ++ } ++ break; + -+ case C2H_CCX_TX_RPT: ++ case C2H_CCX_TX_RPT: +/* CCX_FwC2HTxRpt(padapter, QueueID, pC2hEvent->payload); */ -+ break; ++ break; + -+ case C2H_EXT_RA_RPT: ++ case C2H_EXT_RA_RPT: +/* C2HExtRaRptHandler(padapter, pC2hEvent->payload, C2hEvent.CmdLen); */ -+ break; ++ break; + -+ case C2H_HW_INFO_EXCH: -+ RT_TRACE(_module_hal_init_c_, _drv_info_, ("[BT], C2H_HW_INFO_EXCH\n")); -+ for (index = 0; index < pC2hEvent->plen; index++) -+ { -+ RT_TRACE(_module_hal_init_c_, _drv_info_, ("[BT], tmpBuf[%d]= 0x%x\n", index, pC2hEvent->payload[index])); -+ } -+ break; ++ case C2H_HW_INFO_EXCH: ++ RT_TRACE(_module_hal_init_c_, _drv_info_, ("[BT], C2H_HW_INFO_EXCH\n")); ++ for (index = 0; index < pC2hEvent->plen; index++) { ++ RT_TRACE(_module_hal_init_c_, _drv_info_, ("[BT], tmpBuf[%d]= 0x%x\n", index, pC2hEvent->payload[index])); ++ } ++ break; + -+ case C2H_8723B_BT_INFO: -+ rtw_btcoex_BtInfoNotify(padapter, pC2hEvent->plen, pC2hEvent->payload); -+ break; ++ case C2H_8723B_BT_INFO: ++ rtw_btcoex_BtInfoNotify(padapter, pC2hEvent->plen, pC2hEvent->payload); ++ break; + -+ default: -+ break; ++ default: ++ break; + } + + /* Clear event to notify FW we have read the command. */ @@ -70698,45 +68729,43 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + +static void process_c2h_event(struct adapter *padapter, PC2H_EVT_HDR pC2hEvent, u8 *c2hBuf) +{ -+ u8 index = 0; ++ u8 index = 0; + + if (c2hBuf == NULL) { + DBG_8192C("%s c2hbuff is NULL\n", __func__); + return; + } + -+ switch (pC2hEvent->CmdID) -+ { -+ case C2H_AP_RPT_RSP: -+ break; -+ case C2H_DBG: -+ { -+ RT_TRACE(_module_hal_init_c_, _drv_info_, ("C2HCommandHandler: %s\n", c2hBuf)); -+ } -+ break; ++ switch (pC2hEvent->CmdID) { ++ case C2H_AP_RPT_RSP: ++ break; ++ case C2H_DBG: ++ { ++ RT_TRACE(_module_hal_init_c_, _drv_info_, ("C2HCommandHandler: %s\n", c2hBuf)); ++ } ++ break; + -+ case C2H_CCX_TX_RPT: ++ case C2H_CCX_TX_RPT: +/* CCX_FwC2HTxRpt(padapter, QueueID, tmpBuf); */ -+ break; ++ break; + -+ case C2H_EXT_RA_RPT: ++ case C2H_EXT_RA_RPT: +/* C2HExtRaRptHandler(padapter, tmpBuf, C2hEvent.CmdLen); */ -+ break; ++ break; + -+ case C2H_HW_INFO_EXCH: -+ RT_TRACE(_module_hal_init_c_, _drv_info_, ("[BT], C2H_HW_INFO_EXCH\n")); -+ for (index = 0; index < pC2hEvent->CmdLen; index++) -+ { -+ RT_TRACE(_module_hal_init_c_, _drv_info_, ("[BT], tmpBuf[%d]= 0x%x\n", index, c2hBuf[index])); -+ } -+ break; ++ case C2H_HW_INFO_EXCH: ++ RT_TRACE(_module_hal_init_c_, _drv_info_, ("[BT], C2H_HW_INFO_EXCH\n")); ++ for (index = 0; index < pC2hEvent->CmdLen; index++) { ++ RT_TRACE(_module_hal_init_c_, _drv_info_, ("[BT], tmpBuf[%d]= 0x%x\n", index, c2hBuf[index])); ++ } ++ break; + -+ case C2H_8723B_BT_INFO: -+ rtw_btcoex_BtInfoNotify(padapter, pC2hEvent->CmdLen, c2hBuf); -+ break; ++ case C2H_8723B_BT_INFO: ++ rtw_btcoex_BtInfoNotify(padapter, pC2hEvent->CmdLen, c2hBuf); ++ break; + -+ default: -+ break; ++ default: ++ break; + } +} + @@ -70747,22 +68776,21 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 +#ifdef CONFIG_WOWLAN + struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); + -+ if (pwrpriv->wowlan_mode == true) -+ { ++ if (pwrpriv->wowlan_mode == true) { + DBG_871X("%s(): return because wowolan_mode ==true! CMDID =%d\n", __func__, pbuffer[0]); + return; + } +#endif + C2hEvent.CmdID = pbuffer[0]; + C2hEvent.CmdSeq = pbuffer[1]; -+ C2hEvent.CmdLen = length -2; ++ C2hEvent.CmdLen = length-2; + tmpBuf = pbuffer+2; + + /* DBG_871X("%s C2hEvent.CmdID:%x C2hEvent.CmdLen:%x C2hEvent.CmdSeq:%x\n", */ + /* __func__, C2hEvent.CmdID, C2hEvent.CmdLen, C2hEvent.CmdSeq); */ + RT_PRINT_DATA(_module_hal_init_c_, _drv_notice_, "C2HPacketHandler_8723B(): Command Content:\n", tmpBuf, C2hEvent.CmdLen); + -+ process_c2h_event(padapter,&C2hEvent, tmpBuf); ++ process_c2h_event(padapter, &C2hEvent, tmpBuf); + /* c2h_handler_8723b(padapter,&C2hEvent); */ + return; +} @@ -70873,20 +68901,19 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + case HW_VAR_MLME_JOIN: + hw_var_set_mlme_join(padapter, variable, val); + -+ switch (*val) -+ { -+ case 0: -+ /* prepare to join */ -+ rtw_btcoex_ConnectNotify(padapter, true); -+ break; -+ case 1: -+ /* joinbss_event callback when join res < 0 */ -+ rtw_btcoex_ConnectNotify(padapter, false); -+ break; -+ case 2: -+ /* sta add event callback */ ++ switch (*val) { ++ case 0: ++ /* prepare to join */ ++ rtw_btcoex_ConnectNotify(padapter, true); ++ break; ++ case 1: ++ /* joinbss_event callback when join res < 0 */ ++ rtw_btcoex_ConnectNotify(padapter, false); ++ break; ++ case 2: ++ /* sta add event callback */ +/* rtw_btcoex_MediaStatusNotify(padapter, RT_MEDIA_CONNECT); */ -+ break; ++ break; + } + break; + @@ -70905,7 +68932,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + break; + + case HW_VAR_BEACON_INTERVAL: -+ rtw_write16(padapter, REG_BCN_INTERVAL, *((u16*)val)); ++ rtw_write16(padapter, REG_BCN_INTERVAL, *((u16 *)val)); + break; + + case HW_VAR_SLOT_TIME: @@ -70930,7 +68957,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + /* Joseph marked out for Netgear 3500 TKIP channel 7 issue.(Temporarily) */ + /* regTmp = (pHalData->nCur40MhzPrimeSC)<<5; */ + regTmp = 0; -+ if (bShortPreamble) regTmp |= 0x80; ++ if (bShortPreamble) ++ regTmp |= 0x80; + rtw_write8(padapter, REG_RRSR+2, regTmp); + } + break; @@ -70943,18 +68971,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + u32 ulContent = 0; + u32 ulEncAlgo = CAM_AES; + -+ for (i = 0; iAcParam_BE = ((u32*)(val))[0]; -+ rtw_write32(padapter, REG_EDCA_BE_PARAM, *((u32*)val)); ++ pHalData->AcParam_BE = ((u32 *)(val))[0]; ++ rtw_write32(padapter, REG_EDCA_BE_PARAM, *((u32 *)val)); + break; + + case HW_VAR_AC_PARAM_BK: -+ rtw_write32(padapter, REG_EDCA_BK_PARAM, *((u32*)val)); ++ rtw_write32(padapter, REG_EDCA_BK_PARAM, *((u32 *)val)); + break; + + case HW_VAR_ACM_CTRL: @@ -71005,8 +69029,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + u8 ctrl = *((u8 *)val); + u8 hwctrl = 0; + -+ if (ctrl != 0) -+ { ++ if (ctrl != 0) { + hwctrl |= AcmHw_HwEn; + + if (ctrl & BIT(1)) /* BE */ @@ -71029,7 +69052,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + u32 AMPDULen = (*((u8 *)val)); + + if (AMPDULen < HT_AGG_SIZE_32K) -+ AMPDULen = (0x2000 << (*((u8 *)val))) -1; ++ AMPDULen = (0x2000 << (*((u8 *)val)))-1; + else + AMPDULen = 0x7fff; + @@ -71043,8 +69066,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + /* Forece leave RF low power mode for 1T1R to prevent conficting setting in Fw power */ + /* saving sequence. 2010.06.07. Added by tynli. Suggested by SD3 yschang. */ -+ if (psmode != PS_MODE_ACTIVE) -+ { ++ if (psmode != PS_MODE_ACTIVE) { + ODM_RF_Saving(&pHalData->odmpriv, true); + } + @@ -71067,7 +69089,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + case HW_VAR_INITIAL_GAIN: + { + DIG_T *pDigTable = &pHalData->odmpriv.DM_DigTable; -+ u32 rx_gain = *(u32*)val; ++ u32 rx_gain = *(u32 *)val; + + if (rx_gain == 0xff) {/* restore rx gain */ + ODM_Write_DIG(&pHalData->odmpriv, pDigTable->BackupIGValue); @@ -71083,7 +69105,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + break; + + case HW_VAR_EFUSE_BYTES: -+ pHalData->EfuseUsedBytes = *((u16*)val); ++ pHalData->EfuseUsedBytes = *((u16 *)val); + break; + + case HW_VAR_EFUSE_BT_USAGE: @@ -71094,9 +69116,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + case HW_VAR_EFUSE_BT_BYTES: +#ifdef HAL_EFUSE_MEMORY -+ pHalData->EfuseHal.BTEfuseUsedBytes = *((u16*)val); ++ pHalData->EfuseHal.BTEfuseUsedBytes = *((u16 *)val); +#else -+ BTEfuseUsedBytes = *((u16*)val); ++ BTEfuseUsedBytes = *((u16 *)val); +#endif + break; + @@ -71114,8 +69136,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + /* keep sn */ + padapter->xmitpriv.nqos_ssn = rtw_read16(padapter, REG_NQOS_SEQ); + -+ if (pwrpriv->bkeepfwalive != true) -+ { ++ if (pwrpriv->bkeepfwalive != true) { + /* RX DMA stop */ + val32 = rtw_read32(padapter, REG_RXPKT_NUM); + val32 |= RW_RELEASE_EN; @@ -71128,6 +69149,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + DBG_871X("%s: [HW_VAR_FIFO_CLEARN_UP] val =%x times:%d\n", __func__, val32, trycnt); + } while (--trycnt); ++ + if (trycnt == 0) { + DBG_8192C("[HW_VAR_FIFO_CLEARN_UP] Stop RX DMA failed......\n"); + } @@ -71147,10 +69169,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + case HW_VAR_NAV_UPPER: + { -+ u32 usNavUpper = *((u32*)val); ++ u32 usNavUpper = *((u32 *)val); + -+ if (usNavUpper > HAL_NAV_UPPER_UNIT_8723B * 0xFF) -+ { ++ if (usNavUpper > HAL_NAV_UPPER_UNIT_8723B * 0xFF) { + RT_TRACE(_module_hal_init_c_, _drv_notice_, ("The setting value (0x%08X us) of NAV_UPPER is larger than (%d * 0xFF)!!!\n", usNavUpper, HAL_NAV_UPPER_UNIT_8723B)); + break; + } @@ -71168,8 +69189,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + u8 mstatus, macId; + + mstatus = (u8) (mstatus_rpt & 0xFF); -+ macId = (u8)(mstatus_rpt >> 8) ; -+ rtl8723b_set_FwMediaStatusRpt_cmd(padapter , mstatus, macId); ++ macId = (u8)(mstatus_rpt >> 8); ++ rtl8723b_set_FwMediaStatusRpt_cmd(padapter, mstatus, macId); + } + break; + case HW_VAR_BCN_VALID: @@ -71196,18 +69217,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + case HW_VAR_DL_RSVD_PAGE: + if (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == true) -+ { + rtl8723b_download_BTCoex_AP_mode_rsvd_page(padapter); -+ } + else -+ { + rtl8723b_download_rsvd_page(padapter, RT_MEDIA_CONNECT); -+ } + break; + + case HW_VAR_MACID_SLEEP: + /* Input is MACID */ -+ val32 = *(u32*)val; ++ val32 = *(u32 *)val; + if (val32 > 31) { + DBG_8192C(FUNC_ADPT_FMT ": [HW_VAR_MACID_SLEEP] Invalid macid(%d)\n", + FUNC_ADPT_ARG(padapter), val32); @@ -71226,7 +69243,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + case HW_VAR_MACID_WAKEUP: + /* Input is MACID */ -+ val32 = *(u32*)val; ++ val32 = *(u32 *)val; + if (val32 > 31) { + DBG_8192C(FUNC_ADPT_FMT ": [HW_VAR_MACID_WAKEUP] Invalid macid(%d)\n", + FUNC_ADPT_ARG(padapter), val32); @@ -71264,7 +69281,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + { + /* BCN_VALID, BIT16 of REG_TDECTRL = BIT0 of REG_TDECTRL+2 */ + val8 = rtw_read8(padapter, REG_TDECTRL+2); -+ *val = (BIT(0) & val8) ? true:false; ++ *val = (BIT(0) & val8) ? true : false; + } + break; + @@ -71273,15 +69290,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + /* When we halt NIC, we should check if FW LPS is leave. */ + u32 valRCR; + -+ if ((padapter->bSurpriseRemoved == true) || -+ (adapter_to_pwrctl(padapter)->rf_pwrstate == rf_off)) -+ { ++ if ( ++ (padapter->bSurpriseRemoved == true) || ++ (adapter_to_pwrctl(padapter)->rf_pwrstate == rf_off) ++ ) { + /* If it is in HW/SW Radio OFF or IPS state, we do not check Fw LPS Leave, */ + /* because Fw is unload. */ + *val = true; -+ } -+ else -+ { ++ } else { + valRCR = rtw_read32(padapter, REG_RCR); + valRCR &= 0x00070000; + if (valRCR) @@ -71297,7 +69313,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + break; + + case HW_VAR_EFUSE_BYTES: -+ *((u16*)val) = pHalData->EfuseUsedBytes; ++ *((u16 *)val) = pHalData->EfuseUsedBytes; + break; + + case HW_VAR_EFUSE_BT_USAGE: @@ -71308,9 +69324,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + + case HW_VAR_EFUSE_BT_BYTES: +#ifdef HAL_EFUSE_MEMORY -+ *((u16*)val) = pHalData->EfuseHal.BTEfuseUsedBytes; ++ *((u16 *)val) = pHalData->EfuseHal.BTEfuseUsedBytes; +#else -+ *((u16*)val) = BTEfuseUsedBytes; ++ *((u16 *)val) = BTEfuseUsedBytes; +#endif + break; + @@ -71353,11 +69369,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + pHalData = GET_HAL_DATA(padapter); + bResult = _SUCCESS; + -+ switch (variable) -+ { -+ default: -+ bResult = SetHalDefVar(padapter, variable, pval); -+ break; ++ switch (variable) { ++ default: ++ bResult = SetHalDefVar(padapter, variable, pval); ++ break; + } + + return bResult; @@ -71376,106 +69391,102 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + pHalData = GET_HAL_DATA(padapter); + bResult = _SUCCESS; + -+ switch (variable) -+ { -+ case HAL_DEF_MAX_RECVBUF_SZ: -+ *((u32*)pval) = MAX_RECVBUF_SZ; -+ break; ++ switch (variable) { ++ case HAL_DEF_MAX_RECVBUF_SZ: ++ *((u32 *)pval) = MAX_RECVBUF_SZ; ++ break; + -+ case HAL_DEF_RX_PACKET_OFFSET: -+ *((u32*)pval) = RXDESC_SIZE + DRVINFO_SZ*8; -+ break; ++ case HAL_DEF_RX_PACKET_OFFSET: ++ *((u32 *)pval) = RXDESC_SIZE + DRVINFO_SZ*8; ++ break; + -+ case HW_VAR_MAX_RX_AMPDU_FACTOR: -+ /* Stanley@BB.SD3 suggests 16K can get stable performance */ -+ /* The experiment was done on SDIO interface */ -+ /* coding by Lucas@20130730 */ -+ *(u32*)pval = MAX_AMPDU_FACTOR_16K; -+ break; -+ case HAL_DEF_TX_LDPC: -+ case HAL_DEF_RX_LDPC: -+ *((u8 *)pval) = false; -+ break; -+ case HAL_DEF_TX_STBC: -+ *((u8 *)pval) = 0; -+ break; -+ case HAL_DEF_RX_STBC: -+ *((u8 *)pval) = 1; -+ break; -+ case HAL_DEF_EXPLICIT_BEAMFORMER: -+ case HAL_DEF_EXPLICIT_BEAMFORMEE: -+ *((u8 *)pval) = false; -+ break; ++ case HW_VAR_MAX_RX_AMPDU_FACTOR: ++ /* Stanley@BB.SD3 suggests 16K can get stable performance */ ++ /* The experiment was done on SDIO interface */ ++ /* coding by Lucas@20130730 */ ++ *(u32 *)pval = MAX_AMPDU_FACTOR_16K; ++ break; ++ case HAL_DEF_TX_LDPC: ++ case HAL_DEF_RX_LDPC: ++ *((u8 *)pval) = false; ++ break; ++ case HAL_DEF_TX_STBC: ++ *((u8 *)pval) = 0; ++ break; ++ case HAL_DEF_RX_STBC: ++ *((u8 *)pval) = 1; ++ break; ++ case HAL_DEF_EXPLICIT_BEAMFORMER: ++ case HAL_DEF_EXPLICIT_BEAMFORMEE: ++ *((u8 *)pval) = false; ++ break; + -+ case HW_DEF_RA_INFO_DUMP: -+ { -+ u8 mac_id = *(u8 *)pval; -+ u32 cmd; -+ u32 ra_info1, ra_info2; -+ u32 rate_mask1, rate_mask2; -+ u8 curr_tx_rate, curr_tx_sgi, hight_rate, lowest_rate; ++ case HW_DEF_RA_INFO_DUMP: ++ { ++ u8 mac_id = *(u8 *)pval; ++ u32 cmd; ++ u32 ra_info1, ra_info2; ++ u32 rate_mask1, rate_mask2; ++ u8 curr_tx_rate, curr_tx_sgi, hight_rate, lowest_rate; + -+ DBG_8192C("============ RA status check Mac_id:%d ===================\n", mac_id); ++ DBG_8192C("============ RA status check Mac_id:%d ===================\n", mac_id); + -+ cmd = 0x40000100 | mac_id; -+ rtw_write32(padapter, REG_HMEBOX_DBG_2_8723B, cmd); -+ msleep(10); -+ ra_info1 = rtw_read32(padapter, 0x2F0); -+ curr_tx_rate = ra_info1&0x7F; -+ curr_tx_sgi = (ra_info1>>7)&0x01; -+ DBG_8192C("[ ra_info1:0x%08x ] =>cur_tx_rate = %s, cur_sgi:%d, PWRSTS = 0x%02x \n", -+ ra_info1, -+ HDATA_RATE(curr_tx_rate), -+ curr_tx_sgi, -+ (ra_info1>>8) & 0x07); ++ cmd = 0x40000100 | mac_id; ++ rtw_write32(padapter, REG_HMEBOX_DBG_2_8723B, cmd); ++ msleep(10); ++ ra_info1 = rtw_read32(padapter, 0x2F0); ++ curr_tx_rate = ra_info1&0x7F; ++ curr_tx_sgi = (ra_info1>>7)&0x01; ++ DBG_8192C("[ ra_info1:0x%08x ] =>cur_tx_rate = %s, cur_sgi:%d, PWRSTS = 0x%02x \n", ++ ra_info1, ++ HDATA_RATE(curr_tx_rate), ++ curr_tx_sgi, ++ (ra_info1>>8) & 0x07); + -+ cmd = 0x40000400 | mac_id; -+ rtw_write32(padapter, REG_HMEBOX_DBG_2_8723B, cmd); -+ msleep(10); -+ ra_info1 = rtw_read32(padapter, 0x2F0); -+ ra_info2 = rtw_read32(padapter, 0x2F4); -+ rate_mask1 = rtw_read32(padapter, 0x2F8); -+ rate_mask2 = rtw_read32(padapter, 0x2FC); -+ hight_rate = ra_info2&0xFF; -+ lowest_rate = (ra_info2>>8) & 0xFF; ++ cmd = 0x40000400 | mac_id; ++ rtw_write32(padapter, REG_HMEBOX_DBG_2_8723B, cmd); ++ msleep(10); ++ ra_info1 = rtw_read32(padapter, 0x2F0); ++ ra_info2 = rtw_read32(padapter, 0x2F4); ++ rate_mask1 = rtw_read32(padapter, 0x2F8); ++ rate_mask2 = rtw_read32(padapter, 0x2FC); ++ hight_rate = ra_info2&0xFF; ++ lowest_rate = (ra_info2>>8) & 0xFF; + -+ DBG_8192C("[ ra_info1:0x%08x ] =>RSSI =%d, BW_setting = 0x%02x, DISRA = 0x%02x, VHT_EN = 0x%02x\n", -+ ra_info1, -+ ra_info1&0xFF, -+ (ra_info1>>8) & 0xFF, -+ (ra_info1>>16) & 0xFF, -+ (ra_info1>>24) & 0xFF); ++ DBG_8192C("[ ra_info1:0x%08x ] =>RSSI =%d, BW_setting = 0x%02x, DISRA = 0x%02x, VHT_EN = 0x%02x\n", ++ ra_info1, ++ ra_info1&0xFF, ++ (ra_info1>>8) & 0xFF, ++ (ra_info1>>16) & 0xFF, ++ (ra_info1>>24) & 0xFF); + -+ DBG_8192C("[ ra_info2:0x%08x ] =>hight_rate =%s, lowest_rate =%s, SGI = 0x%02x, RateID =%d\n", -+ ra_info2, -+ HDATA_RATE(hight_rate), -+ HDATA_RATE(lowest_rate), -+ (ra_info2>>16) & 0xFF, -+ (ra_info2>>24) & 0xFF); ++ DBG_8192C("[ ra_info2:0x%08x ] =>hight_rate =%s, lowest_rate =%s, SGI = 0x%02x, RateID =%d\n", ++ ra_info2, ++ HDATA_RATE(hight_rate), ++ HDATA_RATE(lowest_rate), ++ (ra_info2>>16) & 0xFF, ++ (ra_info2>>24) & 0xFF); + -+ DBG_8192C("rate_mask2 = 0x%08x, rate_mask1 = 0x%08x\n", rate_mask2, rate_mask1); ++ DBG_8192C("rate_mask2 = 0x%08x, rate_mask1 = 0x%08x\n", rate_mask2, rate_mask1); + -+ } -+ break; ++ } ++ break; + -+ case HAL_DEF_TX_PAGE_BOUNDARY: -+ if (!padapter->registrypriv.wifi_spec) -+ { -+ *(u8 *)pval = TX_PAGE_BOUNDARY_8723B; -+ } -+ else -+ { -+ *(u8 *)pval = WMM_NORMAL_TX_PAGE_BOUNDARY_8723B; -+ } -+ break; ++ case HAL_DEF_TX_PAGE_BOUNDARY: ++ if (!padapter->registrypriv.wifi_spec) { ++ *(u8 *)pval = TX_PAGE_BOUNDARY_8723B; ++ } else { ++ *(u8 *)pval = WMM_NORMAL_TX_PAGE_BOUNDARY_8723B; ++ } ++ break; + -+ case HAL_DEF_MACID_SLEEP: -+ *(u8 *)pval = true; /* support macid sleep */ -+ break; ++ case HAL_DEF_MACID_SLEEP: ++ *(u8 *)pval = true; /* support macid sleep */ ++ break; + -+ default: -+ bResult = GetHalDefVar(padapter, variable, pval); -+ break; ++ default: ++ bResult = GetHalDefVar(padapter, variable, pval); ++ break; + } + + return bResult; @@ -71495,8 +69506,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + struct xmit_priv *xmitpriv = &padapter->xmitpriv; + + xmitpriv->SdioXmitThread = kthread_run(rtl8723bs_xmit_thread, padapter, "RTWHALXT"); -+ if (IS_ERR(xmitpriv->SdioXmitThread)) -+ { ++ if (IS_ERR(xmitpriv->SdioXmitThread)) { + RT_TRACE(_module_hal_xmit_c_, _drv_err_, ("%s: start rtl8723bs_xmit_thread FAIL!!\n", __func__)); + } +#endif @@ -71518,13 +69528,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + +#if defined(CONFIG_CHECK_BT_HANG) +extern void check_bt_status_work(void *data); -+void rtl8723bs_init_checkbthang_workqueue(struct adapter * adapter) ++void rtl8723bs_init_checkbthang_workqueue(struct adapter *adapter) +{ + adapter->priv_checkbt_wq = alloc_workqueue("sdio_wq", 0, 0); -+ INIT_DELAYED_WORK(&adapter->checkbt_work, (void*)check_bt_status_work); ++ INIT_DELAYED_WORK(&adapter->checkbt_work, (void *)check_bt_status_work); +} + -+void rtl8723bs_free_checkbthang_workqueue(struct adapter * adapter) ++void rtl8723bs_free_checkbthang_workqueue(struct adapter *adapter) +{ + if (adapter->priv_checkbt_wq) { + cancel_delayed_work_sync(&adapter->checkbt_work); @@ -71534,23 +69544,22 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_hal_init.c linux-4.3-rtl872 + } +} + -+void rtl8723bs_cancle_checkbthang_workqueue(struct adapter * adapter) ++void rtl8723bs_cancle_checkbthang_workqueue(struct adapter *adapter) +{ -+ if (adapter->priv_checkbt_wq) { ++ if (adapter->priv_checkbt_wq) + cancel_delayed_work_sync(&adapter->checkbt_work); -+ } +} + -+void rtl8723bs_hal_check_bt_hang(struct adapter * adapter) ++void rtl8723bs_hal_check_bt_hang(struct adapter *adapter) +{ + if (adapter->priv_checkbt_wq) + queue_delayed_work(adapter->priv_checkbt_wq, &(adapter->checkbt_work), 0); +} +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c ---- linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,1070 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c +--- linux.old/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,1060 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -71595,7 +69604,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b +{ + u32 i; + -+ for (i = 0; i <=31; i++) { ++ for (i = 0; i <= 31; i++) { + if (((BitMask>>i) & 0x1) == 1) + break; + } @@ -71617,12 +69626,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b +* Return: u32 Data The readback register value +* Note: This function is equal to "GetRegSetting" in PHY programming guide +*/ -+u32 -+PHY_QueryBBReg_8723B( -+struct adapter *Adapter, -+u32 RegAddr, -+u32 BitMask -+ ) ++u32 PHY_QueryBBReg_8723B(struct adapter *Adapter, u32 RegAddr, u32 BitMask) +{ + u32 ReturnValue = 0, OriginalValue, BitShift; + @@ -71636,7 +69640,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + BitShift = phy_CalculateBitShift(BitMask); + ReturnValue = (OriginalValue & BitMask) >> BitShift; + -+ return (ReturnValue); ++ return ReturnValue; + +} + @@ -71659,16 +69663,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b +* Note: This function is equal to "PutRegSetting" in PHY programming guide +*/ + -+void -+PHY_SetBBReg_8723B( -+struct adapter *Adapter, -+u32 RegAddr, -+u32 BitMask, -+u32 Data -+ ) ++void PHY_SetBBReg_8723B( ++ struct adapter *Adapter, ++ u32 RegAddr, ++ u32 BitMask, ++ u32 Data ++) +{ -+ /* u16 BBWaitCounter = 0; */ -+ u32 OriginalValue, BitShift; ++ /* u16 BBWaitCounter = 0; */ ++ u32 OriginalValue, BitShift; + +#if (DISABLE_BB_RF == 1) + return; @@ -71676,7 +69679,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + + /* RT_TRACE(COMP_RF, DBG_TRACE, ("--->PHY_SetBBReg(): RegAddr(%#lx), BitMask(%#lx), Data(%#lx)\n", RegAddr, BitMask, Data)); */ + -+ if (BitMask!= bMaskDWord) {/* if not "double word" write */ ++ if (BitMask != bMaskDWord) { /* if not "double word" write */ + OriginalValue = rtw_read32(Adapter, RegAddr); + BitShift = phy_CalculateBitShift(BitMask); + Data = ((OriginalValue & (~BitMask)) | ((Data << BitShift) & BitMask)); @@ -71691,20 +69694,17 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b +/* 2. RF register R/W API */ +/* */ + -+static u32 -+phy_RFSerialRead_8723B( -+struct adapter * Adapter, -+enum RF_PATH eRFPath, -+u32 Offset -+ ) ++static u32 phy_RFSerialRead_8723B( ++ struct adapter *Adapter, enum RF_PATH eRFPath, u32 Offset ++) +{ + u32 retValue = 0; + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + struct bb_register_def *pPhyReg = &pHalData->PHYRegDef[eRFPath]; -+ u32 NewOffset; ++ u32 NewOffset; + u32 tmplong2; -+ u8 RfPiEnable = 0; -+ u32 MaskforPhySet = 0; ++ u8 RfPiEnable = 0; ++ u32 MaskforPhySet = 0; + int i = 0; + + /* */ @@ -71714,14 +69714,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + + NewOffset = Offset; + -+ if (eRFPath == RF_PATH_A) -+ { ++ if (eRFPath == RF_PATH_A) { + tmplong2 = PHY_QueryBBReg(Adapter, rFPGA0_XA_HSSIParameter2|MaskforPhySet, bMaskDWord);; + tmplong2 = (tmplong2 & (~bLSSIReadAddress)) | (NewOffset<<23) | bLSSIReadEdge; /* T65 RF */ + PHY_SetBBReg(Adapter, rFPGA0_XA_HSSIParameter2|MaskforPhySet, bMaskDWord, tmplong2&(~bLSSIReadEdge)); -+ } -+ else -+ { ++ } else { + tmplong2 = PHY_QueryBBReg(Adapter, rFPGA0_XB_HSSIParameter2|MaskforPhySet, bMaskDWord); + tmplong2 = (tmplong2 & (~bLSSIReadAddress)) | (NewOffset<<23) | bLSSIReadEdge; /* T65 RF */ + PHY_SetBBReg(Adapter, rFPGA0_XB_HSSIParameter2|MaskforPhySet, bMaskDWord, tmplong2&(~bLSSIReadEdge)); @@ -71733,7 +69730,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + + udelay(10); + -+ for (i = 0;i<2;i++) ++ for (i = 0; i < 2; i++) + udelay(MAX_STALL_TIME); + udelay(10); + @@ -71742,14 +69739,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + else if (eRFPath == RF_PATH_B) + RfPiEnable = (u8)PHY_QueryBBReg(Adapter, rFPGA0_XB_HSSIParameter1|MaskforPhySet, BIT8); + -+ if (RfPiEnable) -+ { /* Read from BBreg8b8, 12 bits for 8190, 20bits for T65 RF */ ++ if (RfPiEnable) { ++ /* Read from BBreg8b8, 12 bits for 8190, 20bits for T65 RF */ + retValue = PHY_QueryBBReg(Adapter, pPhyReg->rfLSSIReadBackPi|MaskforPhySet, bLSSIReadBackData); + + /* RT_DISP(FINIT, INIT_RF, ("Readback from RF-PI : 0x%x\n", retValue)); */ -+ } -+ else -+ { /* Read from BBreg8a0, 12 bits for 8190, 20 bits for T65 RF */ ++ } else { ++ /* Read from BBreg8a0, 12 bits for 8190, 20 bits for T65 RF */ + retValue = PHY_QueryBBReg(Adapter, pPhyReg->rfLSSIReadBack|MaskforPhySet, bLSSIReadBackData); + + /* RT_DISP(FINIT, INIT_RF, ("Readback from RF-SI : 0x%x\n", retValue)); */ @@ -71801,18 +69797,17 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + * + * +*/ -+static void -+phy_RFSerialWrite_8723B( -+struct adapter * Adapter, -+enum RF_PATH eRFPath, -+u32 Offset, -+u32 Data -+ ) ++static void phy_RFSerialWrite_8723B( ++ struct adapter *Adapter, ++ enum RF_PATH eRFPath, ++ u32 Offset, ++ u32 Data ++) +{ -+ u32 DataAndAddr = 0; -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ u32 DataAndAddr = 0; ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + struct bb_register_def *pPhyReg = &pHalData->PHYRegDef[eRFPath]; -+ u32 NewOffset; ++ u32 NewOffset; + + Offset &= 0xff; + @@ -71852,13 +69847,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b +* Return: u32 Readback value +* Note: This function is equal to "GetRFRegSetting" in PHY programming guide +*/ -+u32 -+PHY_QueryRFReg_8723B( -+struct adapter * Adapter, -+u8 eRFPath, -+u32 RegAddr, -+u32 BitMask -+ ) ++u32 PHY_QueryRFReg_8723B( ++ struct adapter *Adapter, ++ u8 eRFPath, ++ u32 RegAddr, ++ u32 BitMask ++) +{ + u32 Original_Value, Readback_Value, BitShift; + @@ -71871,7 +69865,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + BitShift = phy_CalculateBitShift(BitMask); + Readback_Value = (Original_Value & BitMask) >> BitShift; + -+ return (Readback_Value); ++ return Readback_Value; +} + +/** @@ -71892,27 +69886,25 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b +* Return: None +* Note: This function is equal to "PutRFRegSetting" in PHY programming guide +*/ -+void -+PHY_SetRFReg_8723B( -+struct adapter * Adapter, -+u8 eRFPath, -+u32 RegAddr, -+u32 BitMask, -+u32 Data -+ ) ++void PHY_SetRFReg_8723B( ++ struct adapter *Adapter, ++ u8 eRFPath, ++ u32 RegAddr, ++ u32 BitMask, ++ u32 Data ++) +{ -+ u32 Original_Value, BitShift; ++ u32 Original_Value, BitShift; + +#if (DISABLE_BB_RF == 1) + return; +#endif + + /* RF data is 12 bits only */ -+ if (BitMask != bRFRegOffsetMask) -+ { ++ if (BitMask != bRFRegOffsetMask) { + Original_Value = phy_RFSerialRead_8723B(Adapter, eRFPath, RegAddr); + BitShift = phy_CalculateBitShift(BitMask); -+ Data = ((Original_Value & (~BitMask)) | (Data<< BitShift)); ++ Data = ((Original_Value & (~BitMask)) | (Data<PHYRegDef[ODM_RF_PATH_A].rfHSSIPara2 = rFPGA0_XA_HSSIParameter2; /* wire control parameter2 */ + pHalData->PHYRegDef[ODM_RF_PATH_B].rfHSSIPara2 = rFPGA0_XB_HSSIParameter2; /* wire control parameter2 */ + -+ /* Tranceiver Readback LSSI/HSPI mode */ ++ /* Tranceiver Readback LSSI/HSPI mode */ + pHalData->PHYRegDef[ODM_RF_PATH_A].rfLSSIReadBack = rFPGA0_XA_LSSIReadBack; + pHalData->PHYRegDef[ODM_RF_PATH_B].rfLSSIReadBack = rFPGA0_XB_LSSIReadBack; + pHalData->PHYRegDef[ODM_RF_PATH_A].rfLSSIReadBackPi = TransceiverA_HSPI_Readback; @@ -72010,13 +70000,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + +} + -+static int -+phy_BB8723b_Config_ParaFile( -+struct adapter *Adapter -+ ) ++static int phy_BB8723b_Config_ParaFile(struct adapter *Adapter) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); -+ int rtStatus = _SUCCESS; ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ int rtStatus = _SUCCESS; + u8 sz8723BBRegFile[] = RTL8723B_PHY_REG; + u8 sz8723AGCTableFile[] = RTL8723B_AGC_TAB; + u8 sz8723BBBRegPgFile[] = RTL8723B_PHY_REG_PG; @@ -72024,7 +70011,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + u8 sz8723BRFTxPwrLmtFile[] = RTL8723B_TXPWR_LMT; + u8 *pszBBRegFile = NULL, *pszAGCTableFile = NULL, *pszBBRegPgFile = NULL, *pszBBRegMpFile = NULL, *pszRFTxPwrLmtFile = NULL; + -+ pszBBRegFile = sz8723BBRegFile ; ++ pszBBRegFile = sz8723BBRegFile; + pszAGCTableFile = sz8723AGCTableFile; + pszBBRegPgFile = sz8723BBBRegPgFile; + pszBBRegMpFile = sz8723BBRegMpFile; @@ -72032,9 +70019,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + + /* Read Tx Power Limit File */ + PHY_InitTxPowerLimit(Adapter); -+ if (Adapter->registrypriv.RegEnableTxPowerLimit == 1 || -+ (Adapter->registrypriv.RegEnableTxPowerLimit == 2 && pHalData->EEPROMRegulatory == 1)) -+ { ++ if ( ++ Adapter->registrypriv.RegEnableTxPowerLimit == 1 || ++ (Adapter->registrypriv.RegEnableTxPowerLimit == 2 && pHalData->EEPROMRegulatory == 1) ++ ) { +#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE + if (PHY_ConfigRFWithPowerLimitTableParaFile(Adapter, pszRFTxPwrLmtFile) == _FAIL) +#endif @@ -72067,9 +70055,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + + /* If EEPROM or EFUSE autoload OK, We must config by PHY_REG_PG.txt */ + PHY_InitTxPowerByRate(Adapter); -+ if (Adapter->registrypriv.RegEnableTxPowerByRate == 1 || -+ (Adapter->registrypriv.RegEnableTxPowerByRate == 2 && pHalData->EEPROMRegulatory != 2)) -+ { ++ if ( ++ Adapter->registrypriv.RegEnableTxPowerByRate == 1 || ++ (Adapter->registrypriv.RegEnableTxPowerByRate == 2 && pHalData->EEPROMRegulatory != 2) ++ ) { +#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE + if (phy_ConfigBBWithPgParaFile(Adapter, pszBBRegPgFile) == _FAIL) +#endif @@ -72081,8 +70070,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + if (pHalData->odmpriv.PhyRegPgValueType == PHY_REG_PG_EXACT_VALUE) + PHY_TxPowerByRateConfiguration(Adapter); + -+ if (Adapter->registrypriv.RegEnableTxPowerLimit == 1 || -+ (Adapter->registrypriv.RegEnableTxPowerLimit == 2 && pHalData->EEPROMRegulatory == 1)) ++ if ( ++ Adapter->registrypriv.RegEnableTxPowerLimit == 1 || ++ (Adapter->registrypriv.RegEnableTxPowerLimit == 2 && pHalData->EEPROMRegulatory == 1) ++ ) + PHY_ConvertTxPowerLimitToPowerIndex(Adapter); + + if (rtStatus != _SUCCESS) { @@ -72112,10 +70103,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b +} + + -+int -+PHY_BBConfig8723B( -+struct adapter *Adapter -+ ) ++int PHY_BBConfig8723B(struct adapter *Adapter) +{ + int rtStatus = _SUCCESS; + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); @@ -72152,9 +70140,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + return rtStatus; +} + -+static void phy_LCK_8723B( -+struct adapter *Adapter -+ ) ++static void phy_LCK_8723B(struct adapter *Adapter) +{ + PHY_SetRFReg(Adapter, RF_PATH_A, 0xB0, bRFRegOffsetMask, 0xDFBE0); + PHY_SetRFReg(Adapter, RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, 0x8C01); @@ -72162,12 +70148,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + PHY_SetRFReg(Adapter, RF_PATH_A, 0xB0, bRFRegOffsetMask, 0xDFFE0); +} + -+int -+PHY_RFConfig8723B( -+struct adapter *Adapter -+ ) ++int PHY_RFConfig8723B(struct adapter *Adapter) +{ -+ int rtStatus = _SUCCESS; ++ int rtStatus = _SUCCESS; + + /* */ + /* RF config */ @@ -72187,73 +70170,115 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + * <20120830, Kordan> + **************************************************************************************************************/ + -+void -+PHY_SetTxPowerIndex_8723B( -+struct adapter * Adapter, -+u32 PowerIndex, -+u8 RFPath, -+u8 Rate -+ ) ++void PHY_SetTxPowerIndex_8723B( ++ struct adapter *Adapter, ++ u32 PowerIndex, ++ u8 RFPath, ++ u8 Rate ++) +{ -+ if (RFPath == ODM_RF_PATH_A || RFPath == ODM_RF_PATH_B) -+ { -+ switch (Rate) -+ { -+ case MGN_1M: PHY_SetBBReg(Adapter, rTxAGC_A_CCK1_Mcs32, bMaskByte1, PowerIndex); break; -+ case MGN_2M: PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskByte1, PowerIndex); break; -+ case MGN_5_5M: PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskByte2, PowerIndex); break; -+ case MGN_11M: PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskByte3, PowerIndex); break; ++ if (RFPath == ODM_RF_PATH_A || RFPath == ODM_RF_PATH_B) { ++ switch (Rate) { ++ case MGN_1M: ++ PHY_SetBBReg(Adapter, rTxAGC_A_CCK1_Mcs32, bMaskByte1, PowerIndex); ++ break; ++ case MGN_2M: ++ PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskByte1, PowerIndex); ++ break; ++ case MGN_5_5M: ++ PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskByte2, PowerIndex); ++ break; ++ case MGN_11M: ++ PHY_SetBBReg(Adapter, rTxAGC_B_CCK11_A_CCK2_11, bMaskByte3, PowerIndex); ++ break; + -+ case MGN_6M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate18_06, bMaskByte0, PowerIndex); break; -+ case MGN_9M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate18_06, bMaskByte1, PowerIndex); break; -+ case MGN_12M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate18_06, bMaskByte2, PowerIndex); break; -+ case MGN_18M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate18_06, bMaskByte3, PowerIndex); break; ++ case MGN_6M: ++ PHY_SetBBReg(Adapter, rTxAGC_A_Rate18_06, bMaskByte0, PowerIndex); ++ break; ++ case MGN_9M: ++ PHY_SetBBReg(Adapter, rTxAGC_A_Rate18_06, bMaskByte1, PowerIndex); ++ break; ++ case MGN_12M: ++ PHY_SetBBReg(Adapter, rTxAGC_A_Rate18_06, bMaskByte2, PowerIndex); ++ break; ++ case MGN_18M: ++ PHY_SetBBReg(Adapter, rTxAGC_A_Rate18_06, bMaskByte3, PowerIndex); ++ break; + -+ case MGN_24M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate54_24, bMaskByte0, PowerIndex); break; -+ case MGN_36M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate54_24, bMaskByte1, PowerIndex); break; -+ case MGN_48M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate54_24, bMaskByte2, PowerIndex); break; -+ case MGN_54M: PHY_SetBBReg(Adapter, rTxAGC_A_Rate54_24, bMaskByte3, PowerIndex); break; ++ case MGN_24M: ++ PHY_SetBBReg(Adapter, rTxAGC_A_Rate54_24, bMaskByte0, PowerIndex); ++ break; ++ case MGN_36M: ++ PHY_SetBBReg(Adapter, rTxAGC_A_Rate54_24, bMaskByte1, PowerIndex); ++ break; ++ case MGN_48M: ++ PHY_SetBBReg(Adapter, rTxAGC_A_Rate54_24, bMaskByte2, PowerIndex); ++ break; ++ case MGN_54M: ++ PHY_SetBBReg(Adapter, rTxAGC_A_Rate54_24, bMaskByte3, PowerIndex); ++ break; + -+ case MGN_MCS0: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs03_Mcs00, bMaskByte0, PowerIndex); break; -+ case MGN_MCS1: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs03_Mcs00, bMaskByte1, PowerIndex); break; -+ case MGN_MCS2: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs03_Mcs00, bMaskByte2, PowerIndex); break; -+ case MGN_MCS3: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs03_Mcs00, bMaskByte3, PowerIndex); break; ++ case MGN_MCS0: ++ PHY_SetBBReg(Adapter, rTxAGC_A_Mcs03_Mcs00, bMaskByte0, PowerIndex); ++ break; ++ case MGN_MCS1: ++ PHY_SetBBReg(Adapter, rTxAGC_A_Mcs03_Mcs00, bMaskByte1, PowerIndex); ++ break; ++ case MGN_MCS2: ++ PHY_SetBBReg(Adapter, rTxAGC_A_Mcs03_Mcs00, bMaskByte2, PowerIndex); ++ break; ++ case MGN_MCS3: ++ PHY_SetBBReg(Adapter, rTxAGC_A_Mcs03_Mcs00, bMaskByte3, PowerIndex); ++ break; + -+ case MGN_MCS4: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs07_Mcs04, bMaskByte0, PowerIndex); break; -+ case MGN_MCS5: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs07_Mcs04, bMaskByte1, PowerIndex); break; -+ case MGN_MCS6: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs07_Mcs04, bMaskByte2, PowerIndex); break; -+ case MGN_MCS7: PHY_SetBBReg(Adapter, rTxAGC_A_Mcs07_Mcs04, bMaskByte3, PowerIndex); break; ++ case MGN_MCS4: ++ PHY_SetBBReg(Adapter, rTxAGC_A_Mcs07_Mcs04, bMaskByte0, PowerIndex); ++ break; ++ case MGN_MCS5: ++ PHY_SetBBReg(Adapter, rTxAGC_A_Mcs07_Mcs04, bMaskByte1, PowerIndex); ++ break; ++ case MGN_MCS6: ++ PHY_SetBBReg(Adapter, rTxAGC_A_Mcs07_Mcs04, bMaskByte2, PowerIndex); ++ break; ++ case MGN_MCS7: ++ PHY_SetBBReg(Adapter, rTxAGC_A_Mcs07_Mcs04, bMaskByte3, PowerIndex); ++ break; + -+ default: -+ DBG_871X("Invalid Rate!!\n"); -+ break; ++ default: ++ DBG_871X("Invalid Rate!!\n"); ++ break; + } -+ } -+ else -+ { ++ } else { + RT_TRACE(_module_hal_init_c_, _drv_err_, ("Invalid RFPath!!\n")); + } +} + -+u8 -+PHY_GetTxPowerIndex_8723B( -+struct adapter * padapter, -+u8 RFPath, -+u8 Rate, -+enum CHANNEL_WIDTH BandWidth, -+u8 Channel -+ ) ++u8 PHY_GetTxPowerIndex_8723B( ++ struct adapter *padapter, ++ u8 RFPath, ++ u8 Rate, ++ enum CHANNEL_WIDTH BandWidth, ++ u8 Channel ++) +{ -+ struct hal_com_data * pHalData = GET_HAL_DATA(padapter); -+ s8 txPower = 0, powerDiffByRate = 0, limit = 0; -+ bool bIn24G = false; ++ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); ++ s8 txPower = 0, powerDiffByRate = 0, limit = 0; ++ bool bIn24G = false; + + /* DBG_871X("===>%s\n", __func__); */ + + txPower = (s8) PHY_GetTxPowerIndexBase(padapter, RFPath, Rate, BandWidth, Channel, &bIn24G); + powerDiffByRate = PHY_GetTxPowerByRate(padapter, BAND_ON_2_4G, ODM_RF_PATH_A, RF_1TX, Rate); + -+ limit = PHY_GetTxPowerLimit(padapter, padapter->registrypriv.RegPwrTblSel, (u8)(!bIn24G), pHalData->CurrentChannelBW, RFPath, Rate, pHalData->CurrentChannel); ++ limit = PHY_GetTxPowerLimit( ++ padapter, ++ padapter->registrypriv.RegPwrTblSel, ++ (u8)(!bIn24G), ++ pHalData->CurrentChannelBW, ++ RFPath, ++ Rate, ++ pHalData->CurrentChannel ++ ); + + powerDiffByRate = powerDiffByRate > limit ? limit : powerDiffByRate; + txPower += powerDiffByRate; @@ -72267,21 +70292,16 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + return (u8) txPower; +} + -+void -+PHY_SetTxPowerLevel8723B( -+struct adapter * Adapter, -+u8 Channel -+ ) ++void PHY_SetTxPowerLevel8723B(struct adapter *Adapter, u8 Channel) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); -+ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; -+ pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; -+ u8 RFPath = ODM_RF_PATH_A; ++ PDM_ODM_T pDM_Odm = &pHalData->odmpriv; ++ pFAT_T pDM_FatTable = &pDM_Odm->DM_FatTable; ++ u8 RFPath = ODM_RF_PATH_A; + + if (pHalData->AntDivCfg) {/* antenna diversity Enable */ + RFPath = ((pDM_FatTable->RxIdleAnt == MAIN_ANT) ? ODM_RF_PATH_A : ODM_RF_PATH_B); -+ } -+ else { /* antenna diversity disable */ ++ } else { /* antenna diversity disable */ + RFPath = pHalData->ant_path; + } + @@ -72292,56 +70312,54 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + RT_TRACE(_module_hal_init_c_, _drv_info_, ("<==PHY_SetTxPowerLevel8723B()\n")); +} + -+void -+PHY_GetTxPowerLevel8723B( -+struct adapter * Adapter, -+ s32* powerlevel -+ ) ++void PHY_GetTxPowerLevel8723B(struct adapter *Adapter, s32 *powerlevel) +{ +} + -+static void -+phy_SetRegBW_8723B( -+struct adapter * Adapter, -+ enum CHANNEL_WIDTH CurrentBW ++static void phy_SetRegBW_8723B( ++ struct adapter *Adapter, enum CHANNEL_WIDTH CurrentBW +) +{ + u16 RegRfMod_BW, u2tmp = 0; + RegRfMod_BW = rtw_read16(Adapter, REG_TRXPTCL_CTL_8723B); + -+ switch (CurrentBW) -+ { -+ case CHANNEL_WIDTH_20: -+ rtw_write16(Adapter, REG_TRXPTCL_CTL_8723B, (RegRfMod_BW & 0xFE7F)); /* BIT 7 = 0, BIT 8 = 0 */ -+ break; ++ switch (CurrentBW) { ++ case CHANNEL_WIDTH_20: ++ rtw_write16(Adapter, REG_TRXPTCL_CTL_8723B, (RegRfMod_BW & 0xFE7F)); /* BIT 7 = 0, BIT 8 = 0 */ ++ break; + -+ case CHANNEL_WIDTH_40: -+ u2tmp = RegRfMod_BW | BIT7; -+ rtw_write16(Adapter, REG_TRXPTCL_CTL_8723B, (u2tmp & 0xFEFF)); /* BIT 7 = 1, BIT 8 = 0 */ -+ break; ++ case CHANNEL_WIDTH_40: ++ u2tmp = RegRfMod_BW | BIT7; ++ rtw_write16(Adapter, REG_TRXPTCL_CTL_8723B, (u2tmp & 0xFEFF)); /* BIT 7 = 1, BIT 8 = 0 */ ++ break; + -+ case CHANNEL_WIDTH_80: -+ u2tmp = RegRfMod_BW | BIT8; -+ rtw_write16(Adapter, REG_TRXPTCL_CTL_8723B, (u2tmp & 0xFF7F)); /* BIT 7 = 0, BIT 8 = 1 */ -+ break; ++ case CHANNEL_WIDTH_80: ++ u2tmp = RegRfMod_BW | BIT8; ++ rtw_write16(Adapter, REG_TRXPTCL_CTL_8723B, (u2tmp & 0xFF7F)); /* BIT 7 = 0, BIT 8 = 1 */ ++ break; + -+ default: -+ DBG_871X("phy_PostSetBWMode8723B(): unknown Bandwidth: %#X\n", CurrentBW); -+ break; ++ default: ++ DBG_871X("phy_PostSetBWMode8723B(): unknown Bandwidth: %#X\n", CurrentBW); ++ break; + } +} + -+static u8 -+phy_GetSecondaryChnl_8723B( -+struct adapter *Adapter -+) ++static u8 phy_GetSecondaryChnl_8723B(struct adapter *Adapter) +{ + u8 SCSettingOf40 = 0, SCSettingOf20 = 0; + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + -+ RT_TRACE(_module_hal_init_c_, _drv_info_, ("SCMapping: VHT Case: pHalData->CurrentChannelBW %d, pHalData->nCur80MhzPrimeSC %d, pHalData->nCur40MhzPrimeSC %d\n", pHalData->CurrentChannelBW, pHalData->nCur80MhzPrimeSC, pHalData->nCur40MhzPrimeSC)); -+ if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_80) -+ { ++ RT_TRACE( ++ _module_hal_init_c_, ++ _drv_info_, ++ ( ++ "SCMapping: VHT Case: pHalData->CurrentChannelBW %d, pHalData->nCur80MhzPrimeSC %d, pHalData->nCur40MhzPrimeSC %d\n", ++ pHalData->CurrentChannelBW, ++ pHalData->nCur80MhzPrimeSC, ++ pHalData->nCur40MhzPrimeSC ++ ) ++ ); ++ if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_80) { + if (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) + SCSettingOf40 = VHT_DATA_SC_40_LOWER_OF_80MHZ; + else if (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) @@ -72349,20 +70367,38 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + else + RT_TRACE(_module_hal_init_c_, _drv_err_, ("SCMapping: Not Correct Primary40MHz Setting\n")); + -+ if ((pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) && (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER)) ++ if ( ++ (pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) && ++ (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) ++ ) + SCSettingOf20 = VHT_DATA_SC_20_LOWEST_OF_80MHZ; -+ else if ((pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) && (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER)) ++ else if ( ++ (pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) && ++ (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) ++ ) + SCSettingOf20 = VHT_DATA_SC_20_LOWER_OF_80MHZ; -+ else if ((pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) && (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER)) ++ else if ( ++ (pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) && ++ (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) ++ ) + SCSettingOf20 = VHT_DATA_SC_20_UPPER_OF_80MHZ; -+ else if ((pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) && (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER)) ++ else if ( ++ (pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) && ++ (pHalData->nCur80MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) ++ ) + SCSettingOf20 = VHT_DATA_SC_20_UPPERST_OF_80MHZ; + else + RT_TRACE(_module_hal_init_c_, _drv_err_, ("SCMapping: Not Correct Primary40MHz Setting\n")); -+ } -+ else if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_40) -+ { -+ RT_TRACE(_module_hal_init_c_, _drv_info_, ("SCMapping: VHT Case: pHalData->CurrentChannelBW %d, pHalData->nCur40MhzPrimeSC %d\n", pHalData->CurrentChannelBW, pHalData->nCur40MhzPrimeSC)); ++ } else if (pHalData->CurrentChannelBW == CHANNEL_WIDTH_40) { ++ RT_TRACE( ++ _module_hal_init_c_, ++ _drv_info_, ++ ( ++ "SCMapping: VHT Case: pHalData->CurrentChannelBW %d, pHalData->nCur40MhzPrimeSC %d\n", ++ pHalData->CurrentChannelBW, ++ pHalData->nCur40MhzPrimeSC ++ ) ++ ); + + if (pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_UPPER) + SCSettingOf20 = VHT_DATA_SC_20_UPPER_OF_80MHZ; @@ -72376,13 +70412,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + return ((SCSettingOf40 << 4) | SCSettingOf20); +} + -+static void -+phy_PostSetBwMode8723B( -+struct adapter *Adapter -+) ++static void phy_PostSetBwMode8723B(struct adapter *Adapter) +{ -+ u8 SubChnlNum = 0; -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ u8 SubChnlNum = 0; ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + + + /* 3 Set Reg668 Reg440 BW */ @@ -72395,80 +70428,67 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + /* 3 */ + /* 3<2>Set PHY related register */ + /* 3 */ -+ switch (pHalData->CurrentChannelBW) -+ { -+ /* 20 MHz channel*/ -+ case CHANNEL_WIDTH_20: -+ PHY_SetBBReg(Adapter, rFPGA0_RFMOD, bRFMOD, 0x0); ++ switch (pHalData->CurrentChannelBW) { ++ /* 20 MHz channel*/ ++ case CHANNEL_WIDTH_20: ++ PHY_SetBBReg(Adapter, rFPGA0_RFMOD, bRFMOD, 0x0); + -+ PHY_SetBBReg(Adapter, rFPGA1_RFMOD, bRFMOD, 0x0); ++ PHY_SetBBReg(Adapter, rFPGA1_RFMOD, bRFMOD, 0x0); + +/* PHY_SetBBReg(Adapter, rFPGA0_AnalogParameter2, BIT10, 1); */ + -+ PHY_SetBBReg(Adapter, rOFDM0_TxPseudoNoiseWgt, (BIT31|BIT30), 0x0); -+ break; ++ PHY_SetBBReg(Adapter, rOFDM0_TxPseudoNoiseWgt, (BIT31|BIT30), 0x0); ++ break; + ++ /* 40 MHz channel*/ ++ case CHANNEL_WIDTH_40: ++ PHY_SetBBReg(Adapter, rFPGA0_RFMOD, bRFMOD, 0x1); + -+ /* 40 MHz channel*/ -+ case CHANNEL_WIDTH_40: -+ PHY_SetBBReg(Adapter, rFPGA0_RFMOD, bRFMOD, 0x1); ++ PHY_SetBBReg(Adapter, rFPGA1_RFMOD, bRFMOD, 0x1); + -+ PHY_SetBBReg(Adapter, rFPGA1_RFMOD, bRFMOD, 0x1); ++ /* Set Control channel to upper or lower. These settings are required only for 40MHz */ ++ PHY_SetBBReg(Adapter, rCCK0_System, bCCKSideBand, (pHalData->nCur40MhzPrimeSC>>1)); + -+ /* Set Control channel to upper or lower. These settings are required only for 40MHz */ -+ PHY_SetBBReg(Adapter, rCCK0_System, bCCKSideBand, (pHalData->nCur40MhzPrimeSC>>1)); ++ PHY_SetBBReg(Adapter, rOFDM1_LSTF, 0xC00, pHalData->nCur40MhzPrimeSC); + -+ PHY_SetBBReg(Adapter, rOFDM1_LSTF, 0xC00, pHalData->nCur40MhzPrimeSC); ++/* PHY_SetBBReg(Adapter, rFPGA0_AnalogParameter2, BIT10, 0); */ + -+/* PHY_SetBBReg(Adapter, rFPGA0_AnalogParameter2, BIT10, 0); */ ++ PHY_SetBBReg(Adapter, 0x818, (BIT26|BIT27), (pHalData->nCur40MhzPrimeSC == HAL_PRIME_CHNL_OFFSET_LOWER) ? 2 : 1); + -+ PHY_SetBBReg(Adapter, 0x818, (BIT26|BIT27), (pHalData->nCur40MhzPrimeSC ==HAL_PRIME_CHNL_OFFSET_LOWER)?2:1); -+ -+ break; -+ -+ -+ -+ default: -+ /*RT_TRACE(COMP_DBG, DBG_LOUD, ("phy_SetBWMode8723B(): unknown Bandwidth: %#X\n"\ -+ , pHalData->CurrentChannelBW));*/ -+ break; ++ break; + ++ default: ++ /*RT_TRACE(COMP_DBG, DBG_LOUD, ("phy_SetBWMode8723B(): unknown Bandwidth: %#X\n"\ ++ , pHalData->CurrentChannelBW));*/ ++ break; + } + + /* 3<3>Set RF related register */ + PHY_RF6052SetBandwidth8723B(Adapter, pHalData->CurrentChannelBW); +} + -+static void -+phy_SwChnl8723B( -+struct adapter * padapter -+ ) ++static void phy_SwChnl8723B(struct adapter *padapter) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ u8 channelToSW = pHalData->CurrentChannel; ++ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); ++ u8 channelToSW = pHalData->CurrentChannel; + -+ if (pHalData->rf_chip == RF_PSEUDO_11N) -+ { ++ if (pHalData->rf_chip == RF_PSEUDO_11N) { + /* RT_TRACE(COMP_MLME, DBG_LOUD, ("phy_SwChnl8723B: return for PSEUDO\n")); */ + return; + } -+ pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff00) | channelToSW ); ++ pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff00) | channelToSW); + PHY_SetRFReg(padapter, ODM_RF_PATH_A, RF_CHNLBW, 0x3FF, pHalData->RfRegChnlVal[0]); + PHY_SetRFReg(padapter, ODM_RF_PATH_B, RF_CHNLBW, 0x3FF, pHalData->RfRegChnlVal[0]); + + DBG_8192C("===>phy_SwChnl8723B: Channel = %d\n", channelToSW); +} + -+static void -+phy_SwChnlAndSetBwMode8723B( -+ struct adapter * Adapter -+) ++static void phy_SwChnlAndSetBwMode8723B(struct adapter *Adapter) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + + /* RT_TRACE(COMP_SCAN, DBG_LOUD, ("phy_SwChnlAndSetBwMode8723B(): bSwChnl %d, bSetChnlBW %d\n", pHalData->bSwChnl, pHalData->bSetChnlBW)); */ -+ if (Adapter->bNotifyChannelChange) -+ { ++ if (Adapter->bNotifyChannelChange) { + DBG_871X("[%s] bSwChnl =%d, ch =%d, bSetChnlBW =%d, bw =%d\n", + __func__, + pHalData->bSwChnl, @@ -72477,19 +70497,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + pHalData->CurrentChannelBW); + } + -+ if ((Adapter->bDriverStopped) || (Adapter->bSurpriseRemoved)) -+ { ++ if (Adapter->bDriverStopped || Adapter->bSurpriseRemoved) + return; -+ } + -+ if (pHalData->bSwChnl) -+ { ++ if (pHalData->bSwChnl) { + phy_SwChnl8723B(Adapter); + pHalData->bSwChnl = false; + } + -+ if (pHalData->bSetChnlBW) -+ { ++ if (pHalData->bSetChnlBW) { + phy_PostSetBwMode8723B(Adapter); + pHalData->bSetChnlBW = false; + } @@ -72497,38 +70513,35 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + PHY_SetTxPowerLevel8723B(Adapter, pHalData->CurrentChannel); +} + -+static void -+PHY_HandleSwChnlAndSetBW8723B( -+struct adapter * Adapter, -+bool bSwitchChannel, -+bool bSetBandWidth, -+u8 ChannelNum, -+enum CHANNEL_WIDTH ChnlWidth, -+enum EXTCHNL_OFFSET ExtChnlOffsetOf40MHz, -+enum EXTCHNL_OFFSET ExtChnlOffsetOf80MHz, -+u8 CenterFrequencyIndex1 ++static void PHY_HandleSwChnlAndSetBW8723B( ++ struct adapter *Adapter, ++ bool bSwitchChannel, ++ bool bSetBandWidth, ++ u8 ChannelNum, ++ enum CHANNEL_WIDTH ChnlWidth, ++ enum EXTCHNL_OFFSET ExtChnlOffsetOf40MHz, ++ enum EXTCHNL_OFFSET ExtChnlOffsetOf80MHz, ++ u8 CenterFrequencyIndex1 +) +{ + /* static bool bInitialzed = false; */ -+ struct hal_com_data * pHalData = GET_HAL_DATA(Adapter); -+ u8 tmpChannel = pHalData->CurrentChannel; -+ enum CHANNEL_WIDTH tmpBW = pHalData->CurrentChannelBW; -+ u8 tmpnCur40MhzPrimeSC = pHalData->nCur40MhzPrimeSC; -+ u8 tmpnCur80MhzPrimeSC = pHalData->nCur80MhzPrimeSC; -+ u8 tmpCenterFrequencyIndex1 =pHalData->CurrentCenterFrequencyIndex1; ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ u8 tmpChannel = pHalData->CurrentChannel; ++ enum CHANNEL_WIDTH tmpBW = pHalData->CurrentChannelBW; ++ u8 tmpnCur40MhzPrimeSC = pHalData->nCur40MhzPrimeSC; ++ u8 tmpnCur80MhzPrimeSC = pHalData->nCur80MhzPrimeSC; ++ u8 tmpCenterFrequencyIndex1 = pHalData->CurrentCenterFrequencyIndex1; + + /* DBG_871X("=> PHY_HandleSwChnlAndSetBW8812: bSwitchChannel %d, bSetBandWidth %d\n", bSwitchChannel, bSetBandWidth); */ + + /* check is swchnl or setbw */ -+ if (!bSwitchChannel && !bSetBandWidth) -+ { ++ if (!bSwitchChannel && !bSetBandWidth) { + DBG_871X("PHY_HandleSwChnlAndSetBW8812: not switch channel and not set bandwidth\n"); + return; + } + + /* skip change for channel or bandwidth is the same */ -+ if (bSwitchChannel) -+ { ++ if (bSwitchChannel) { + /* if (pHalData->CurrentChannel != ChannelNum) */ + { + if (HAL_IsLegalChannel(Adapter, ChannelNum)) @@ -72537,26 +70550,21 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + } + + if (bSetBandWidth) -+ { + pHalData->bSetChnlBW = true; -+ } + -+ if (!pHalData->bSetChnlBW && !pHalData->bSwChnl) -+ { ++ if (!pHalData->bSetChnlBW && !pHalData->bSwChnl) { + /* DBG_871X("<= PHY_HandleSwChnlAndSetBW8812: bSwChnl %d, bSetChnlBW %d\n", pHalData->bSwChnl, pHalData->bSetChnlBW); */ + return; + } + + -+ if (pHalData->bSwChnl) -+ { -+ pHalData->CurrentChannel =ChannelNum; ++ if (pHalData->bSwChnl) { ++ pHalData->CurrentChannel = ChannelNum; + pHalData->CurrentCenterFrequencyIndex1 = ChannelNum; + } + + -+ if (pHalData->bSetChnlBW) -+ { ++ if (pHalData->bSetChnlBW) { + pHalData->CurrentChannelBW = ChnlWidth; + pHalData->nCur40MhzPrimeSC = ExtChnlOffsetOf40MHz; + pHalData->nCur80MhzPrimeSC = ExtChnlOffsetOf80MHz; @@ -72564,19 +70572,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + } + + /* Switch workitem or set timer to do switch channel or setbandwidth operation */ -+ if ((!Adapter->bDriverStopped) && (!Adapter->bSurpriseRemoved)) -+ { ++ if ((!Adapter->bDriverStopped) && (!Adapter->bSurpriseRemoved)) { + phy_SwChnlAndSetBwMode8723B(Adapter); -+ } -+ else -+ { -+ if (pHalData->bSwChnl) -+ { ++ } else { ++ if (pHalData->bSwChnl) { + pHalData->CurrentChannel = tmpChannel; + pHalData->CurrentCenterFrequencyIndex1 = tmpChannel; + } -+ if (pHalData->bSetChnlBW) -+ { ++ ++ if (pHalData->bSetChnlBW) { + pHalData->CurrentChannelBW = tmpBW; + pHalData->nCur40MhzPrimeSC = tmpnCur40MhzPrimeSC; + pHalData->nCur80MhzPrimeSC = tmpnCur80MhzPrimeSC; @@ -72585,34 +70589,29 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + } +} + -+void -+PHY_SetBWMode8723B( -+struct adapter * Adapter, -+enum CHANNEL_WIDTH Bandwidth, /* 20M or 40M */ -+unsigned char Offset /* Upper, Lower, or Don't care */ ++void PHY_SetBWMode8723B( ++ struct adapter *Adapter, ++ enum CHANNEL_WIDTH Bandwidth, /* 20M or 40M */ ++ unsigned char Offset /* Upper, Lower, or Don't care */ +) +{ -+ struct hal_com_data * pHalData = GET_HAL_DATA(Adapter); ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + + PHY_HandleSwChnlAndSetBW8723B(Adapter, false, true, pHalData->CurrentChannel, Bandwidth, Offset, Offset, pHalData->CurrentChannel); +} + -+void -+PHY_SwChnl8723B(/* Call after initialization */ -+struct adapter *Adapter, -+u8 channel -+ ) ++/* Call after initialization */ ++void PHY_SwChnl8723B(struct adapter *Adapter, u8 channel) +{ + PHY_HandleSwChnlAndSetBW8723B(Adapter, true, false, channel, 0, 0, 0, channel); +} + -+void -+PHY_SetSwChnlBWMode8723B( -+struct adapter * Adapter, -+u8 channel, -+enum CHANNEL_WIDTH Bandwidth, -+u8 Offset40, -+u8 Offset80 ++void PHY_SetSwChnlBWMode8723B( ++ struct adapter *Adapter, ++ u8 channel, ++ enum CHANNEL_WIDTH Bandwidth, ++ u8 Offset40, ++ u8 Offset80 +) +{ + /* DBG_871X("%s() ===>\n", __func__); */ @@ -72621,10 +70620,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_phycfg.c linux-4.3-rtl8723b + + /* DBG_871X("<==%s()\n", __func__); */ +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_rf6052.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/rtl8723b_rf6052.c ---- linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_rf6052.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/rtl8723b_rf6052.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,241 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/rtl8723b_rf6052.c linux/3rdparty/rtl8723bs/hal/rtl8723b_rf6052.c +--- linux.old/3rdparty/rtl8723bs/hal/rtl8723b_rf6052.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/rtl8723b_rf6052.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,230 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -72689,50 +70688,45 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_rf6052.c linux-4.3-rtl8723b + * + * Note: For RF type 0222D + *---------------------------------------------------------------------------*/ -+void -+PHY_RF6052SetBandwidth8723B( -+struct adapter * Adapter, -+enum CHANNEL_WIDTH Bandwidth) /* 20M or 40M */ ++void PHY_RF6052SetBandwidth8723B( ++ struct adapter *Adapter, enum CHANNEL_WIDTH Bandwidth ++) /* 20M or 40M */ +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + -+ switch (Bandwidth) -+ { -+ case CHANNEL_WIDTH_20: -+ pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff3ff) | BIT10 | BIT11); -+ PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]); -+ PHY_SetRFReg(Adapter, ODM_RF_PATH_B, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]); -+ break; ++ switch (Bandwidth) { ++ case CHANNEL_WIDTH_20: ++ pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff3ff) | BIT10 | BIT11); ++ PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]); ++ PHY_SetRFReg(Adapter, ODM_RF_PATH_B, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]); ++ break; + -+ case CHANNEL_WIDTH_40: -+ pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff3ff) | BIT10); -+ PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]); -+ PHY_SetRFReg(Adapter, ODM_RF_PATH_B, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]); -+ break; ++ case CHANNEL_WIDTH_40: ++ pHalData->RfRegChnlVal[0] = ((pHalData->RfRegChnlVal[0] & 0xfffff3ff) | BIT10); ++ PHY_SetRFReg(Adapter, ODM_RF_PATH_A, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]); ++ PHY_SetRFReg(Adapter, ODM_RF_PATH_B, RF_CHNLBW, bRFRegOffsetMask, pHalData->RfRegChnlVal[0]); ++ break; + -+ default: -+ /* RT_TRACE(COMP_DBG, DBG_LOUD, ("PHY_SetRF8225Bandwidth(): unknown Bandwidth: %#X\n", Bandwidth)); */ -+ break; ++ default: ++ /* RT_TRACE(COMP_DBG, DBG_LOUD, ("PHY_SetRF8225Bandwidth(): unknown Bandwidth: %#X\n", Bandwidth)); */ ++ break; + } + +} + -+static int -+phy_RF6052_Config_ParaFile( -+struct adapter * Adapter -+ ) ++static int phy_RF6052_Config_ParaFile(struct adapter *Adapter) +{ -+ u32 u4RegValue = 0; -+ u8 eRFPath; ++ u32 u4RegValue = 0; ++ u8 eRFPath; + struct bb_register_def *pPhyReg; + -+ int rtStatus = _SUCCESS; -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ int rtStatus = _SUCCESS; ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + -+ static char sz8723RadioAFile[] = RTL8723B_PHY_RADIO_A; -+ static char sz8723RadioBFile[] = RTL8723B_PHY_RADIO_B; -+ static s8 sz8723BTxPwrTrackFile[] = RTL8723B_TXPWR_TRACK; -+ char *pszRadioAFile, *pszRadioBFile, *pszTxPwrTrackFile; ++ static char sz8723RadioAFile[] = RTL8723B_PHY_RADIO_A; ++ static char sz8723RadioBFile[] = RTL8723B_PHY_RADIO_B; ++ static s8 sz8723BTxPwrTrackFile[] = RTL8723B_TXPWR_TRACK; ++ char *pszRadioAFile, *pszRadioBFile, *pszTxPwrTrackFile; + + pszRadioAFile = sz8723RadioAFile; + pszRadioBFile = sz8723RadioBFile; @@ -72742,19 +70736,17 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_rf6052.c linux-4.3-rtl8723b + /* 3 <2> Initialize RF */ + /* 3----------------------------------------------------------------- */ + /* for (eRFPath = RF_PATH_A; eRFPath NumTotalRFPath; eRFPath++) */ -+ for (eRFPath = 0; eRFPath NumTotalRFPath; eRFPath++) -+ { ++ for (eRFPath = 0; eRFPath < pHalData->NumTotalRFPath; eRFPath++) { + + pPhyReg = &pHalData->PHYRegDef[eRFPath]; + + /*----Store original RFENV control type----*/ -+ switch (eRFPath) -+ { ++ switch (eRFPath) { + case RF_PATH_A: + case RF_PATH_C: + u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV); + break; -+ case RF_PATH_B : ++ case RF_PATH_B: + case RF_PATH_D: + u4RegValue = PHY_QueryBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV<<16); + break; @@ -72776,14 +70768,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_rf6052.c linux-4.3-rtl8723b + udelay(1);/* PlatformStallExecution(1); */ + + /*----Initialize RF fom connfiguration file----*/ -+ switch (eRFPath) -+ { ++ switch (eRFPath) { + case RF_PATH_A: +#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE + if (PHY_ConfigRFWithParaFile(Adapter, pszRadioAFile, eRFPath) == _FAIL) +#endif + { -+ if (HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, CONFIG_RF_RADIO, (ODM_RF_RADIO_PATH_E)eRFPath)) ++ if (HAL_STATUS_FAILURE == ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, CONFIG_RF_RADIO, (ODM_RF_RADIO_PATH_E)eRFPath)) + rtStatus = _FAIL; + } + break; @@ -72792,7 +70783,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_rf6052.c linux-4.3-rtl8723b + if (PHY_ConfigRFWithParaFile(Adapter, pszRadioBFile, eRFPath) == _FAIL) +#endif + { -+ if (HAL_STATUS_FAILURE ==ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, CONFIG_RF_RADIO, (ODM_RF_RADIO_PATH_E)eRFPath)) ++ if (HAL_STATUS_FAILURE == ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, CONFIG_RF_RADIO, (ODM_RF_RADIO_PATH_E)eRFPath)) + rtStatus = _FAIL; + } + break; @@ -72803,13 +70794,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_rf6052.c linux-4.3-rtl8723b + } + + /*----Restore RFENV control type----*/; -+ switch (eRFPath) -+ { ++ switch (eRFPath) { + case RF_PATH_A: + case RF_PATH_C: + PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV, u4RegValue); + break; -+ case RF_PATH_B : ++ case RF_PATH_B: + case RF_PATH_D: + PHY_SetBBReg(Adapter, pPhyReg->rfintfs, bRFSI_RFENV<<16, u4RegValue); + break; @@ -72841,12 +70831,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_rf6052.c linux-4.3-rtl8723b +} + + -+int -+PHY_RF6052_Config8723B( -+struct adapter * Adapter) ++int PHY_RF6052_Config8723B(struct adapter *Adapter) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); -+ int rtStatus = _SUCCESS; ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ int rtStatus = _SUCCESS; + + /* */ + /* Initialize general global value */ @@ -72866,10 +70854,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_rf6052.c linux-4.3-rtl8723b +} + +/* End of HalRf6052.c */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_rxdesc.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/rtl8723b_rxdesc.c ---- linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_rxdesc.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/rtl8723b_rxdesc.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,87 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/rtl8723b_rxdesc.c linux/3rdparty/rtl8723bs/hal/rtl8723b_rxdesc.c +--- linux.old/3rdparty/rtl8723bs/hal/rtl8723b_rxdesc.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/rtl8723b_rxdesc.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,86 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. @@ -72891,7 +70879,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_rxdesc.c linux-4.3-rtl8723b +static void process_rssi(struct adapter *padapter, union recv_frame *prframe) +{ + struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib; -+ struct signal_stat * signal_stat = &padapter->recvpriv.signal_strength_data; ++ struct signal_stat *signal_stat = &padapter->recvpriv.signal_strength_data; + + /* DBG_8192C("process_rssi => pattrib->rssil(%d) signal_strength(%d)\n ", pattrib->RecvSignalPower, pattrib->signal_strength); */ + /* if (pRfd->Status.bPacketToSelf || pRfd->Status.bPacketBeacon) */ @@ -72907,16 +70895,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_rxdesc.c linux-4.3-rtl8723b + signal_stat->avg_val = signal_stat->total_val / signal_stat->total_num; + } + -+}/* Process_UI_RSSI_8192C */ ++} /* Process_UI_RSSI_8192C */ + +static void process_link_qual(struct adapter *padapter, union recv_frame *prframe) +{ + struct rx_pkt_attrib *pattrib; -+ struct signal_stat * signal_stat; ++ struct signal_stat *signal_stat; + -+ if (prframe == NULL || padapter == NULL) { ++ if (prframe == NULL || padapter == NULL) + return; -+ } + + pattrib = &prframe->u.hdr.attrib; + signal_stat = &padapter->recvpriv.signal_qual_data; @@ -72932,7 +70919,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_rxdesc.c linux-4.3-rtl8723b + signal_stat->total_num++; + signal_stat->total_val += pattrib->phy_info.SignalQuality; + signal_stat->avg_val = signal_stat->total_val / signal_stat->total_num; -+}/* Process_UiLinkQuality8192S */ ++} /* Process_UiLinkQuality8192S */ + + +void rtl8723b_process_phy_info(struct adapter *padapter, void *prframe) @@ -72957,10 +70944,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723b_rxdesc.c linux-4.3-rtl8723b + #endif + +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c ---- linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,528 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c +--- linux.old/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,490 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. @@ -72993,12 +70980,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs +} + +static void update_recvframe_attrib( -+ struct adapter *padapter, -+ union recv_frame *precvframe, -+ struct recv_stat *prxstat) ++ struct adapter *padapter, union recv_frame *precvframe, struct recv_stat *prxstat ++) +{ -+ struct rx_pkt_attrib *pattrib; -+ struct recv_stat report; ++ struct rx_pkt_attrib *pattrib; ++ struct recv_stat report; + PRXREPORT prxreport = (PRXREPORT)&report; + + report.rxdw0 = prxstat->rxdw0; @@ -73015,8 +71001,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + pattrib->pkt_rpt_type = prxreport->c2h_ind?C2H_PACKET:NORMAL_RX; +/* DBG_871X("%s: pkt_rpt_type =%d\n", __func__, pattrib->pkt_rpt_type); */ + -+ if (pattrib->pkt_rpt_type == NORMAL_RX) -+ { ++ if (pattrib->pkt_rpt_type == NORMAL_RX) { + /* Normal rx packet */ + /* update rx report to recv_frame attribute */ + pattrib->pkt_len = (u16)prxreport->pktlen; @@ -73040,11 +71025,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + pattrib->mdata = (u8)prxreport->md; + + pattrib->data_rate = (u8)prxreport->rx_rate; -+ } -+ else -+ { ++ } else + pattrib->pkt_len = (u16)prxreport->pktlen; -+ } +} + +/* @@ -73053,22 +71035,22 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + *precvframe->u.hdr.rx_data should be ready! + */ +static void update_recvframe_phyinfo( -+ union recv_frame *precvframe, -+ struct phy_stat *pphy_status) ++ union recv_frame *precvframe, struct phy_stat *pphy_status ++) +{ -+ struct adapter * padapter = precvframe->u.hdr.adapter; -+ struct rx_pkt_attrib *pattrib = &precvframe->u.hdr.attrib; -+ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ PODM_PHY_INFO_T pPHYInfo = (PODM_PHY_INFO_T)(&pattrib->phy_info); ++ struct adapter *padapter = precvframe->u.hdr.adapter; ++ struct rx_pkt_attrib *pattrib = &precvframe->u.hdr.attrib; ++ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); ++ PODM_PHY_INFO_T pPHYInfo = (PODM_PHY_INFO_T)(&pattrib->phy_info); + -+ u8 *wlanhdr; -+ ODM_PACKET_INFO_T pkt_info; ++ u8 *wlanhdr; ++ ODM_PACKET_INFO_T pkt_info; + u8 *sa = NULL; + /* _irqL irqL; */ + struct sta_priv *pstapriv; + struct sta_info *psta; + -+ pkt_info.bPacketMatchBSSID =false; ++ pkt_info.bPacketMatchBSSID = false; + pkt_info.bPacketToSelf = false; + pkt_info.bPacketBeacon = false; + @@ -73089,8 +71071,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + + pstapriv = &padapter->stapriv; + psta = rtw_get_stainfo(pstapriv, sa); -+ if (psta) -+ { ++ if (psta) { + pkt_info.StationID = psta->mac_id; + /* DBG_8192C("%s ==> StationID(%d)\n", __func__, pkt_info.StationID); */ + } @@ -73098,28 +71079,23 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + + /* rtl8723b_query_rx_phy_status(precvframe, pphy_status); */ + /* spin_lock_bh(&pHalData->odm_stainfo_lock); */ -+ ODM_PhyStatusQuery(&pHalData->odmpriv, pPHYInfo, (u8 *)pphy_status,&(pkt_info)); -+ if (psta) psta->rssi = pattrib->phy_info.RecvSignalPower; ++ ODM_PhyStatusQuery(&pHalData->odmpriv, pPHYInfo, (u8 *)pphy_status, &(pkt_info)); ++ if (psta) ++ psta->rssi = pattrib->phy_info.RecvSignalPower; + /* spin_unlock_bh(&pHalData->odm_stainfo_lock); */ + precvframe->u.hdr.psta = NULL; -+ if (pkt_info.bPacketMatchBSSID && -+ (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == true)) -+ { -+ if (psta) -+ { ++ if ( ++ pkt_info.bPacketMatchBSSID && ++ (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == true) ++ ) { ++ if (psta) { + precvframe->u.hdr.psta = psta; + rtl8723b_process_phy_info(padapter, precvframe); -+ } -+ } -+ else if (pkt_info.bPacketToSelf || pkt_info.bPacketBeacon) -+ { -+ if (check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE) == true) -+ { -+ if (psta) -+ { -+ precvframe->u.hdr.psta = psta; -+ } + } ++ } else if (pkt_info.bPacketToSelf || pkt_info.bPacketBeacon) { ++ if (check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE) == true) ++ if (psta) ++ precvframe->u.hdr.psta = psta; + rtl8723b_process_phy_info(padapter, precvframe); + } +} @@ -73152,15 +71128,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + +static void rtl8723bs_recv_tasklet(void *priv) +{ -+ struct adapter * padapter; -+ struct hal_com_data * pHalData; -+ struct recv_priv *precvpriv; -+ struct recv_buf *precvbuf; -+ union recv_frame *precvframe; -+ struct rx_pkt_attrib *pattrib; ++ struct adapter *padapter; ++ struct hal_com_data *pHalData; ++ struct recv_priv *precvpriv; ++ struct recv_buf *precvbuf; ++ union recv_frame *precvframe; ++ struct rx_pkt_attrib *pattrib; + u8 *ptr; + u32 pkt_offset, skb_len, alloc_sz; -+ _pkt *pkt_copy = NULL; ++ _pkt *pkt_copy = NULL; + u8 shift_sz = 0, rx_report_sz = 0; + + @@ -73170,15 +71146,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + + do { + precvbuf = rtw_dequeue_recvbuf(&precvpriv->recv_buf_pending_queue); -+ if (NULL == precvbuf) break; ++ if (NULL == precvbuf) ++ break; + + ptr = precvbuf->pdata; + -+ while (ptr < precvbuf->ptail) -+ { ++ while (ptr < precvbuf->ptail) { + precvframe = rtw_alloc_recvframe(&precvpriv->free_recv_queue); -+ if (precvframe == NULL) -+ { ++ if (precvframe == NULL) { + DBG_8192C("%s: no enough recv frame!\n", __func__); + rtw_enqueue_recvbuf_to_head(precvbuf, &precvpriv->recv_buf_pending_queue); + @@ -73189,13 +71164,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + } + + /* rx desc parsing */ -+ update_recvframe_attrib(padapter, precvframe, (struct recv_stat*)ptr); ++ update_recvframe_attrib(padapter, precvframe, (struct recv_stat *)ptr); + + pattrib = &precvframe->u.hdr.attrib; + + /* fix Hardware RX data error, drop whole recv_buffer */ -+ if ((!(pHalData->ReceiveConfig & RCR_ACRC32)) && pattrib->crc_err) -+ { ++ if ((!(pHalData->ReceiveConfig & RCR_ACRC32)) && pattrib->crc_err) { + DBG_8192C("%s()-%d: RX Warning! rx CRC ERROR !!\n", __func__, __LINE__); + rtw_free_recvframe(precvframe, &precvpriv->free_recv_queue); + break; @@ -73210,25 +71184,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + break; + } + -+ if ((pattrib->crc_err) || (pattrib->icv_err)) -+ { ++ if ((pattrib->crc_err) || (pattrib->icv_err)) { + { + DBG_8192C("%s: crc_err =%d icv_err =%d, skip!\n", __func__, pattrib->crc_err, pattrib->icv_err); + } + rtw_free_recvframe(precvframe, &precvpriv->free_recv_queue); -+ } -+ else -+ { ++ } else { + /* Modified by Albert 20101213 */ + /* For 8 bytes IP header alignment. */ + if (pattrib->qos) /* Qos data, wireless lan header length is 26 */ -+ { + shift_sz = 6; -+ } + else -+ { + shift_sz = 0; -+ } + + skb_len = pattrib->pkt_len; + @@ -73239,8 +71206,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + alloc_sz = 1664; + else + alloc_sz = skb_len + 14; -+ } -+ else { ++ } else { + alloc_sz = skb_len; + /* 6 is for IP header 8 bytes alignment in QoS packet case. */ + /* 8 is for skb->data 4 bytes alignment. */ @@ -73249,8 +71215,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + + pkt_copy = rtw_skb_alloc(alloc_sz); + -+ if (pkt_copy) -+ { ++ if (pkt_copy) { + pkt_copy->dev = padapter->pnetdev; + precvframe->u.hdr.pkt = pkt_copy; + skb_reserve(pkt_copy, 8 - ((SIZE_PTR)(pkt_copy->data) & 7));/* force pkt_copy->data at 8-byte alignment address */ @@ -73259,29 +71224,23 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + precvframe->u.hdr.rx_head = pkt_copy->head; + precvframe->u.hdr.rx_data = precvframe->u.hdr.rx_tail = pkt_copy->data; + precvframe->u.hdr.rx_end = skb_end_pointer(pkt_copy); -+ } -+ else -+ { -+ if ((pattrib->mfrag == 1) && (pattrib->frag_num == 0)) -+ { ++ } else { ++ if ((pattrib->mfrag == 1) && (pattrib->frag_num == 0)) { + DBG_8192C("%s: alloc_skb fail, drop frag frame\n", __func__); + rtw_free_recvframe(precvframe, &precvpriv->free_recv_queue); + break; + } + + precvframe->u.hdr.pkt = rtw_skb_clone(precvbuf->pskb); -+ if (precvframe->u.hdr.pkt) -+ { -+ _pkt *pkt_clone = precvframe->u.hdr.pkt; ++ if (precvframe->u.hdr.pkt) { ++ _pkt *pkt_clone = precvframe->u.hdr.pkt; + + pkt_clone->data = ptr + rx_report_sz + pattrib->shift_sz; + skb_reset_tail_pointer(pkt_clone); + precvframe->u.hdr.rx_head = precvframe->u.hdr.rx_data = precvframe->u.hdr.rx_tail + = pkt_clone->data; + precvframe->u.hdr.rx_end = pkt_clone->data + skb_len; -+ } -+ else -+ { ++ } else { + DBG_8192C("%s: rtw_skb_clone fail\n", __func__); + rtw_free_recvframe(precvframe, &precvpriv->free_recv_queue); + break; @@ -73303,18 +71262,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + ptr += 4; + } + -+ if (pattrib->pkt_rpt_type == NORMAL_RX)/* Normal rx packet */ -+ { ++ if (pattrib->pkt_rpt_type == NORMAL_RX) { /* Normal rx packet */ + if (pattrib->physt) -+ update_recvframe_phyinfo(precvframe, (struct phy_stat*)ptr); ++ update_recvframe_phyinfo(precvframe, (struct phy_stat *)ptr); + -+ if (rtw_recv_entry(precvframe) != _SUCCESS) -+ { ++ if (rtw_recv_entry(precvframe) != _SUCCESS) { + RT_TRACE(_module_rtl871x_recv_c_, _drv_dump_, ("%s: rtw_recv_entry(precvframe) != _SUCCESS\n", __func__)); + } -+ } -+ else if (pattrib->pkt_rpt_type == C2H_PACKET) -+ { ++ } else if (pattrib->pkt_rpt_type == C2H_PACKET) { + C2H_EVT_HDR C2hEvent; + + u16 len_c2h = pattrib->pkt_len; @@ -73323,17 +71278,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + + C2hEvent.CmdID = pbuf_c2h[0]; + C2hEvent.CmdSeq = pbuf_c2h[1]; -+ C2hEvent.CmdLen = (len_c2h -2); ++ C2hEvent.CmdLen = (len_c2h-2); + pdata_c2h = pbuf_c2h+2; + + if (C2hEvent.CmdID == C2H_CCX_TX_RPT) -+ { + CCX_FwC2HTxRpt_8723b(padapter, pdata_c2h, C2hEvent.CmdLen); -+ } + else -+ { + rtl8723bs_c2h_packet_handler(padapter, precvframe->u.hdr.rx_data, pattrib->pkt_len); -+ } + + rtw_free_recvframe(precvframe, &precvpriv->free_recv_queue); + @@ -73360,10 +71311,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + */ +s32 rtl8723bs_init_recv_priv(struct adapter *padapter) +{ -+ s32 res; -+ u32 i, n; ++ s32 res; ++ u32 i, n; + struct recv_priv *precvpriv; -+ struct recv_buf *precvbuf; ++ struct recv_buf *precvbuf; + + + res = _SUCCESS; @@ -73384,9 +71335,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + precvpriv->precv_buf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(precvpriv->pallocated_recv_buf), 4); + + /* init each recv buffer */ -+ precvbuf = (struct recv_buf*)precvpriv->precv_buf; -+ for (i = 0; i < NR_RECVBUFF; i++) -+ { ++ precvbuf = (struct recv_buf *)precvpriv->precv_buf; ++ for (i = 0; i < NR_RECVBUFF; i++) { + res = initrecvbuf(precvbuf, padapter); + if (res == _FAIL) + break; @@ -73397,8 +71347,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + + precvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ); + -+ if (precvbuf->pskb) -+ { ++ if (precvbuf->pskb) { + precvbuf->pskb->dev = padapter->pnetdev; + + tmpaddr = (SIZE_PTR)precvbuf->pskb->data; @@ -73421,19 +71370,20 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + goto initbuferror; + + /* 3 2. init tasklet */ -+ tasklet_init(&precvpriv->recv_tasklet, -+ (void(*)(unsigned long))rtl8723bs_recv_tasklet, -+ (unsigned long)padapter); ++ tasklet_init( ++ &precvpriv->recv_tasklet, ++ (void(*)(unsigned long))rtl8723bs_recv_tasklet, ++ (unsigned long)padapter ++ ); + + goto exit; + +initbuferror: -+ precvbuf = (struct recv_buf*)precvpriv->precv_buf; ++ precvbuf = (struct recv_buf *)precvpriv->precv_buf; + if (precvbuf) { + n = precvpriv->free_recv_buf_queue_cnt; + precvpriv->free_recv_buf_queue_cnt = 0; -+ for (i = 0; i < n ; i++) -+ { ++ for (i = 0; i < n ; i++) { + list_del_init(&precvbuf->list); + rtw_os_recvbuf_resource_free(padapter, precvbuf); + precvbuf++; @@ -73459,9 +71409,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + */ +void rtl8723bs_free_recv_priv(struct adapter *padapter) +{ -+ u32 i, n; ++ u32 i, n; + struct recv_priv *precvpriv; -+ struct recv_buf *precvbuf; ++ struct recv_buf *precvbuf; + + + precvpriv = &padapter->recvpriv; @@ -73470,12 +71420,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + tasklet_kill(&precvpriv->recv_tasklet); + + /* 3 2. free all recv buffers */ -+ precvbuf = (struct recv_buf*)precvpriv->precv_buf; ++ precvbuf = (struct recv_buf *)precvpriv->precv_buf; + if (precvbuf) { + n = NR_RECVBUFF; + precvpriv->free_recv_buf_queue_cnt = 0; -+ for (i = 0; i < n ; i++) -+ { ++ for (i = 0; i < n ; i++) { + list_del_init(&precvbuf->list); + rtw_os_recvbuf_resource_free(padapter, precvbuf); + precvbuf++; @@ -73489,10 +71438,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_recv.c linux-4.3-rtl8723bs + precvpriv->pallocated_recv_buf = NULL; + } +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c ---- linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,652 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c +--- linux.old/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,686 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. @@ -73520,8 +71469,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux-4.3-rtl8723bs + + while (pHalData->SdioTxOQTFreeSpace < agg_num) + { -+ if ((padapter->bSurpriseRemoved == true) -+ || (padapter->bDriverStopped == true)) { ++ if ( ++ (padapter->bSurpriseRemoved == true) || ++ (padapter->bDriverStopped == true) ++ ) { + DBG_871X("%s: bSurpriseRemoved or bDriverStopped (wait TxOQT)\n", __func__); + return false; + } @@ -73572,23 +71523,22 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux-4.3-rtl8723bs + + /* translate fifo addr to queue index */ + switch (deviceId) { -+ case WLAN_TX_HIQ_DEVICE_ID: -+ PageIdx = HI_QUEUE_IDX; -+ break; ++ case WLAN_TX_HIQ_DEVICE_ID: ++ PageIdx = HI_QUEUE_IDX; ++ break; + -+ case WLAN_TX_MIQ_DEVICE_ID: -+ PageIdx = MID_QUEUE_IDX; -+ break; ++ case WLAN_TX_MIQ_DEVICE_ID: ++ PageIdx = MID_QUEUE_IDX; ++ break; + -+ case WLAN_TX_LOQ_DEVICE_ID: -+ PageIdx = LOW_QUEUE_IDX; -+ break; ++ case WLAN_TX_LOQ_DEVICE_ID: ++ PageIdx = LOW_QUEUE_IDX; ++ break; + } + +query_free_page: + /* check if hardware tx fifo page is enough */ -+ if (false == rtw_hal_sdio_query_tx_freepage(pri_padapter, PageIdx, pxmitbuf->pg_num)) -+ { ++ if (false == rtw_hal_sdio_query_tx_freepage(pri_padapter, PageIdx, pxmitbuf->pg_num)) { + if (!bUpdatePageNum) { + /* Total number of page is NOT available, so update current FIFO status */ + HalQueryTxBufferStatus8723BSdio(padapter); @@ -73601,17 +71551,20 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux-4.3-rtl8723bs + } + } + -+ if ((padapter->bSurpriseRemoved == true) -+ || (padapter->bDriverStopped == true)) { -+ RT_TRACE(_module_hal_xmit_c_, _drv_notice_, -+ ("%s: bSurpriseRemoved(wirte port)\n", __func__)); ++ if ( ++ (padapter->bSurpriseRemoved == true) || ++ (padapter->bDriverStopped == true) ++ ) { ++ RT_TRACE( ++ _module_hal_xmit_c_, ++ _drv_notice_, ++ ("%s: bSurpriseRemoved(wirte port)\n", __func__) ++ ); + goto free_xmitbuf; + } + + if (rtw_sdio_wait_enough_TxOQT_space(padapter, pxmitbuf->agg_num) == false) -+ { + goto free_xmitbuf; -+ } + + traffic_check_for_leave_lps(padapter, true, pxmitbuf->agg_num); + @@ -73643,7 +71596,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux-4.3-rtl8723bs +{ + struct xmit_priv *pxmitpriv; + u8 queue_empty, queue_pending; -+ s32 ret; ++ s32 ret; + + + pxmitpriv = &padapter->xmitpriv; @@ -73655,9 +71608,16 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux-4.3-rtl8723bs + + ret = (padapter->bDriverStopped == true) || (padapter->bSurpriseRemoved == true); + if (ret) { -+ RT_TRACE(_module_hal_xmit_c_, _drv_err_, -+ ("%s: bDriverStopped(%d) bSurpriseRemoved(%d)!\n", -+ __func__, padapter->bDriverStopped, padapter->bSurpriseRemoved)); ++ RT_TRACE( ++ _module_hal_xmit_c_, ++ _drv_err_, ++ ( ++ "%s: bDriverStopped(%d) bSurpriseRemoved(%d)!\n", ++ __func__, ++ padapter->bDriverStopped, ++ padapter->bSurpriseRemoved ++ ) ++ ); + return _FAIL; + } + @@ -73718,15 +71678,20 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux-4.3-rtl8723bs + for (idx = 0; idx<4; idx++) + inx[idx] = pxmitpriv->wmm_para_seq[idx]; + } else { -+ inx[0] = 0; inx[1] = 1; inx[2] = 2; inx[3] = 3; ++ inx[0] = 0; ++ inx[1] = 1; ++ inx[2] = 2; ++ inx[3] = 3; + } + + /* 0(VO), 1(VI), 2(BE), 3(BK) */ -+ for (idx = 0; idx < hwentry; idx++) -+ { ++ for (idx = 0; idx < hwentry; idx++) { + phwxmit = hwxmits + inx[idx]; + -+ if ((check_pending_xmitbuf(pxmitpriv) == true) && (padapter->mlmepriv.LinkDetectInfo.bHigherBusyTxTraffic == true)) { ++ if ( ++ (check_pending_xmitbuf(pxmitpriv) == true) && ++ (padapter->mlmepriv.LinkDetectInfo.bHigherBusyTxTraffic == true) ++ ) { + if ((phwxmit->accnt > 0) && (phwxmit->accnt < 5)) { + err = -2; + break; @@ -73741,38 +71706,44 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux-4.3-rtl8723bs + sta_plist = get_next(sta_phead); + /* because stop_sta_xmit may delete sta_plist at any time */ + /* so we should add lock here, or while loop can not exit */ -+ while (sta_phead != sta_plist) -+ { ++ while (sta_phead != sta_plist) { + ptxservq = LIST_CONTAINOR(sta_plist, struct tx_servq, tx_pending); + sta_plist = get_next(sta_plist); + +#ifdef DBG_XMIT_BUF -+ DBG_871X("%s idx:%d hwxmit_pkt_num:%d ptxservq_pkt_num:%d\n", __func__, idx, phwxmit->accnt, ptxservq->qcnt); -+ DBG_871X("%s free_xmit_extbuf_cnt =%d free_xmitbuf_cnt =%d free_xmitframe_cnt =%d\n", -+ __func__, pxmitpriv->free_xmit_extbuf_cnt, pxmitpriv->free_xmitbuf_cnt, -+ pxmitpriv->free_xmitframe_cnt); ++ DBG_871X( ++ "%s idx:%d hwxmit_pkt_num:%d ptxservq_pkt_num:%d\n", ++ __func__, ++ idx, ++ phwxmit->accnt, ++ ptxservq->qcnt ++ ); ++ DBG_871X( ++ "%s free_xmit_extbuf_cnt =%d free_xmitbuf_cnt =%d free_xmitframe_cnt =%d\n", ++ __func__, ++ pxmitpriv->free_xmit_extbuf_cnt, ++ pxmitpriv->free_xmitbuf_cnt, ++ pxmitpriv->free_xmitframe_cnt ++ ); +#endif + pframe_queue = &ptxservq->sta_pending; + + frame_phead = get_list_head(pframe_queue); + -+ while (list_empty(frame_phead) == false) -+ { ++ while (list_empty(frame_phead) == false) { + frame_plist = get_next(frame_phead); + pxmitframe = LIST_CONTAINOR(frame_plist, struct xmit_frame, list); + + /* check xmit_buf size enough or not */ + txlen = txdesc_size + rtw_wlan_pkt_size(pxmitframe); -+ if ((NULL == pxmitbuf) || -+ ((_RND(pxmitbuf->len, 8) + txlen) > max_xmit_len) -+ || (k >= (rtw_hal_sdio_max_txoqt_free_space(padapter)-1)) -+ ) -+ { -+ if (pxmitbuf) -+ { ++ if ( ++ (NULL == pxmitbuf) || ++ ((_RND(pxmitbuf->len, 8) + txlen) > max_xmit_len) || ++ (k >= (rtw_hal_sdio_max_txoqt_free_space(padapter)-1)) ++ ) { ++ if (pxmitbuf) { + /* pxmitbuf->priv_data will be NULL, and will crash here */ -+ if (pxmitbuf->len > 0 && pxmitbuf->priv_data) -+ { ++ if (pxmitbuf->len > 0 && pxmitbuf->priv_data) { + struct xmit_frame *pframe; + pframe = (struct xmit_frame*)pxmitbuf->priv_data; + pframe->agg_num = k; @@ -73783,9 +71754,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux-4.3-rtl8723bs + enqueue_pending_xmitbuf(pxmitpriv, pxmitbuf); + /* can not yield under lock */ + /* yield(); */ -+ } else { ++ } else + rtw_free_xmitbuf(pxmitpriv, pxmitbuf); -+ } + } + + pxmitbuf = rtw_alloc_xmitbuf(pxmitpriv); @@ -73802,10 +71772,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux-4.3-rtl8723bs + + /* ok to send, remove frame from queue */ + if (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == true) { -+ if ((pxmitframe->attrib.psta->state & WIFI_SLEEP_STATE) && -+ (pxmitframe->attrib.triggered == 0)) { -+ DBG_871X("%s: one not triggered pkt in queue when this STA sleep," -+ " break and goto next sta\n", __func__); ++ if ( ++ (pxmitframe->attrib.psta->state & WIFI_SLEEP_STATE) && ++ (pxmitframe->attrib.triggered == 0) ++ ) { ++ DBG_871X( ++ "%s: one not triggered pkt in queue when this STA sleep," ++ " break and goto next sta\n", ++ __func__ ++ ); + break; + } + } @@ -73850,13 +71825,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux-4.3-rtl8723bs + if (list_empty(&pframe_queue->queue)) + list_del_init(&ptxservq->tx_pending); + -+ if (err) break; ++ if (err) ++ break; + } + spin_unlock_bh(&pxmitpriv->lock); + + /* dump xmit_buf to hw tx fifo */ -+ if (pxmitbuf) -+ { ++ if (pxmitbuf) { + RT_TRACE(_module_hal_xmit_c_, _drv_info_, ("pxmitbuf->len =%d enqueue\n", pxmitbuf->len)); + + if (pxmitbuf->len > 0) { @@ -73875,7 +71850,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux-4.3-rtl8723bs + pxmitbuf = NULL; + } + -+ if (err) break; ++ if (err) ++ break; + } + + return err; @@ -73903,11 +71879,20 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux-4.3-rtl8723bs + } + +next: -+ if ((padapter->bDriverStopped == true) || -+ (padapter->bSurpriseRemoved == true)) { -+ RT_TRACE(_module_hal_xmit_c_, _drv_notice_, -+ ("%s: bDriverStopped(%d) bSurpriseRemoved(%d)\n", -+ __func__, padapter->bDriverStopped, padapter->bSurpriseRemoved)); ++ if ( ++ (padapter->bDriverStopped == true) || ++ (padapter->bSurpriseRemoved == true) ++ ) { ++ RT_TRACE( ++ _module_hal_xmit_c_, ++ _drv_notice_, ++ ( ++ "%s: bDriverStopped(%d) bSurpriseRemoved(%d)\n", ++ __func__, ++ padapter->bDriverStopped, ++ padapter->bSurpriseRemoved ++ ) ++ ); + return _FAIL; + } + @@ -73976,7 +71961,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux-4.3-rtl8723bs + thread_exit(); +} + -+s32 rtl8723bs_mgnt_xmit(struct adapter *padapter, struct xmit_frame *pmgntframe) ++s32 rtl8723bs_mgnt_xmit( ++ struct adapter *padapter, struct xmit_frame *pmgntframe ++) +{ + s32 ret = _SUCCESS; + struct pkt_attrib *pattrib; @@ -74004,18 +71991,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux-4.3-rtl8723bs + + pxmitbuf->priv_data = NULL; + -+ if (GetFrameSubType(pframe) ==WIFI_BEACON) /* dump beacon directly */ -+ { ++ if (GetFrameSubType(pframe) == WIFI_BEACON) { /* dump beacon directly */ + ret = rtw_write_port(padapter, pdvobjpriv->Queue2Pipe[pxmitbuf->ff_hwaddr], pxmitbuf->len, (u8 *)pxmitbuf); + if (ret != _SUCCESS) + rtw_sctx_done_err(&pxmitbuf->sctx, RTW_SCTX_DONE_WRITE_PORT_ERR); + + rtw_free_xmitbuf(pxmitpriv, pxmitbuf); -+ } -+ else -+ { ++ } else + enqueue_pending_xmitbuf(pxmitpriv, pxmitbuf); -+ } + + return ret; +} @@ -74028,7 +72011,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux-4.3-rtl8723bs + *true dump packet directly ok + *false enqueue, temporary can't transmit packets to hardware + */ -+s32 rtl8723bs_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe) ++s32 rtl8723bs_hal_xmit( ++ struct adapter *padapter, struct xmit_frame *pxmitframe ++) +{ + struct xmit_priv *pxmitpriv; + s32 err; @@ -74037,11 +72022,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux-4.3-rtl8723bs + pxmitframe->attrib.qsel = pxmitframe->attrib.priority; + pxmitpriv = &padapter->xmitpriv; + -+ if ((pxmitframe->frame_tag == DATA_FRAMETAG) && ++ if ( ++ (pxmitframe->frame_tag == DATA_FRAMETAG) && + (pxmitframe->attrib.ether_type != 0x0806) && + (pxmitframe->attrib.ether_type != 0x888e) && -+ (pxmitframe->attrib.dhcp_pkt != 1)) -+ { ++ (pxmitframe->attrib.dhcp_pkt != 1) ++ ) { + if (padapter->mlmepriv.LinkDetectInfo.bBusyTraffic == true) + rtw_issue_addbareq_cmd(padapter, pxmitframe); + } @@ -74062,19 +72048,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux-4.3-rtl8723bs + return false; +} + -+s32 rtl8723bs_hal_xmitframe_enqueue(struct adapter *padapter, struct xmit_frame *pxmitframe) ++s32 rtl8723bs_hal_xmitframe_enqueue( ++ struct adapter *padapter, struct xmit_frame *pxmitframe ++) +{ + struct xmit_priv *pxmitpriv = &padapter->xmitpriv; + s32 err; + -+ if ((err =rtw_xmitframe_enqueue(padapter, pxmitframe)) != _SUCCESS) -+ { ++ if ((err = rtw_xmitframe_enqueue(padapter, pxmitframe)) != _SUCCESS) { + rtw_free_xmitframe(pxmitpriv, pxmitframe); + + pxmitpriv->tx_drop++; -+ } -+ else -+ { ++ } else { +#ifdef CONFIG_SDIO_TX_TASKLET + tasklet_hi_schedule(&pxmitpriv->xmit_tasklet); +#else @@ -74124,8 +72109,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux-4.3-rtl8723bs + INIT_LIST_HEAD(&tmplist); + + spin_lock_bh(&pqueue->lock); -+ if (!list_empty(&pqueue->queue)) -+ { ++ if (!list_empty(&pqueue->queue)) { + /* Insert tmplist to end of queue, and delete phead */ + /* then tmplist become head of queue. */ + list_add_tail(&tmplist, phead); @@ -74134,21 +72118,20 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/rtl8723bs_xmit.c linux-4.3-rtl8723bs + spin_unlock_bh(&pqueue->lock); + + phead = &tmplist; -+ while (list_empty(phead) == false) -+ { ++ while (list_empty(phead) == false) { + plist = get_next(phead); + list_del_init(plist); + + pxmitbuf = LIST_CONTAINOR(plist, struct xmit_buf, list); -+ rtw_free_xmitframe(pxmitpriv, (struct xmit_frame*)pxmitbuf->priv_data); ++ rtw_free_xmitframe(pxmitpriv, (struct xmit_frame *)pxmitbuf->priv_data); + pxmitbuf->priv_data = NULL; + rtw_free_xmitbuf(pxmitpriv, pxmitbuf); + } +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/sdio_halinit.c ---- linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/sdio_halinit.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,1959 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/sdio_halinit.c linux/3rdparty/rtl8723bs/hal/sdio_halinit.c +--- linux.old/3rdparty/rtl8723bs/hal/sdio_halinit.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/sdio_halinit.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,1928 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. @@ -74185,8 +72168,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + + + rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); -+ if (bMacPwrCtrlOn == false) -+ { ++ if (bMacPwrCtrlOn == false) { + /* RSV_CTRL 0x1C[7:0] = 0x00 */ + /* unlock ISO/CLK/Power control register */ + rtw_write8(padapter, REG_RSV_CTRL, 0x0); @@ -74205,7 +72187,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 +#ifdef CONFIG_GPIO_WAKEUP +/* we set it high under init and fw will */ +/* give us Low Pulse when host wake up */ -+void HostWakeUpGpioClear(struct adapter * Adapter) ++void HostWakeUpGpioClear(struct adapter *Adapter) +{ + u32 value32; + @@ -74231,11 +72213,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + rtw_write8(padapter, REG_GPIO_PIN_CTRL + 2, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 2) | BIT(index)); + + /* set output value */ -+ if (OutPutValue) { ++ if (OutPutValue) + rtw_write8(padapter, REG_GPIO_PIN_CTRL + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 1) | BIT(index)); -+ } else { ++ else + rtw_write8(padapter, REG_GPIO_PIN_CTRL + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL + 1) & ~BIT(index)); -+ } + } else { + /* 88C Series: */ + /* index: 11~8 transform to 3~0 */ @@ -74252,11 +72233,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 2, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 2) | BIT(index)); + + /* set output value */ -+ if (OutPutValue) { ++ if (OutPutValue) + rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 1) | BIT(index)); -+ } else { ++ else + rtw_write8(padapter, REG_GPIO_PIN_CTRL_2 + 1, rtw_read8(padapter, REG_GPIO_PIN_CTRL_2 + 1) & ~BIT(index)); -+ } + } +} +#endif @@ -74290,8 +72270,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + /* only cmd52 can be used before power on(card enable) */ + ret = CardEnable(padapter); + if (ret == false) { -+ RT_TRACE(_module_hci_hal_init_c_, _drv_emerg_, -+ ("%s: run power on flow fail\n", __func__)); ++ RT_TRACE( ++ _module_hci_hal_init_c_, ++ _drv_emerg_, ++ ("%s: run power on flow fail\n", __func__) ++ ); + return _FAIL; + } + @@ -74315,8 +72298,16 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + rtw_write8(padapter, REG_CR, 0x00); + /* Enable MAC DMA/WMAC/SCHEDULE/SEC block */ + value16 = rtw_read16(padapter, REG_CR); -+ value16 |= (HCI_TXDMA_EN | HCI_RXDMA_EN | TXDMA_EN | RXDMA_EN -+ | PROTOCOL_EN | SCHEDULE_EN | ENSEC | CALTMR_EN); ++ value16 |= ( ++ HCI_TXDMA_EN | ++ HCI_RXDMA_EN | ++ TXDMA_EN | ++ RXDMA_EN | ++ PROTOCOL_EN | ++ SCHEDULE_EN | ++ ENSEC | ++ CALTMR_EN ++ ); + rtw_write16(padapter, REG_CR, value16); + + rtw_btcoex_PowerOnSetting(padapter); @@ -74370,30 +72361,25 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + +static void _InitQueueReservedPage(struct adapter *padapter) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); ++ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + struct registry_priv *pregistrypriv = &padapter->registrypriv; -+ u32 numHQ = 0; -+ u32 numLQ = 0; -+ u32 numNQ = 0; -+ u32 numPubQ; -+ u32 value32; -+ u8 value8; -+ bool bWiFiConfig = pregistrypriv->wifi_spec; ++ u32 numHQ = 0; ++ u32 numLQ = 0; ++ u32 numNQ = 0; ++ u32 numPubQ; ++ u32 value32; ++ u8 value8; ++ bool bWiFiConfig = pregistrypriv->wifi_spec; + + if (pHalData->OutEpQueueSel & TX_SELE_HQ) -+ { + numHQ = bWiFiConfig ? WMM_NORMAL_PAGE_NUM_HPQ_8723B : NORMAL_PAGE_NUM_HPQ_8723B; -+ } + + if (pHalData->OutEpQueueSel & TX_SELE_LQ) -+ { + numLQ = bWiFiConfig ? WMM_NORMAL_PAGE_NUM_LPQ_8723B : NORMAL_PAGE_NUM_LPQ_8723B; -+ } + + /* NOTE: This step shall be proceed before writting REG_RQPN. */ -+ if (pHalData->OutEpQueueSel & TX_SELE_NQ) { ++ if (pHalData->OutEpQueueSel & TX_SELE_NQ) + numNQ = bWiFiConfig ? WMM_NORMAL_PAGE_NUM_NPQ_8723B : NORMAL_PAGE_NUM_NPQ_8723B; -+ } + + numPubQ = TX_TOTAL_PAGE_NUMBER_8723B - numHQ - numLQ - numNQ; + @@ -74430,162 +72416,146 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + rtw_write8(padapter, REG_TDECTRL+1, txpktbuf_bndy); +} + -+static void -+_InitNormalChipRegPriority( -+struct adapter *Adapter, -+u16 beQ, -+u16 bkQ, -+u16 viQ, -+u16 voQ, -+u16 mgtQ, -+u16 hiQ -+ ) ++static void _InitNormalChipRegPriority( ++ struct adapter *Adapter, ++ u16 beQ, ++ u16 bkQ, ++ u16 viQ, ++ u16 voQ, ++ u16 mgtQ, ++ u16 hiQ ++) +{ -+ u16 value16 = (rtw_read16(Adapter, REG_TRXDMA_CTRL) & 0x7); ++ u16 value16 = (rtw_read16(Adapter, REG_TRXDMA_CTRL) & 0x7); + -+ value16 |= _TXDMA_BEQ_MAP(beQ) | _TXDMA_BKQ_MAP(bkQ) | -+ _TXDMA_VIQ_MAP(viQ) | _TXDMA_VOQ_MAP(voQ) | -+ _TXDMA_MGQ_MAP(mgtQ)| _TXDMA_HIQ_MAP(hiQ); ++ value16 |= ++ _TXDMA_BEQ_MAP(beQ) | ++ _TXDMA_BKQ_MAP(bkQ) | ++ _TXDMA_VIQ_MAP(viQ) | ++ _TXDMA_VOQ_MAP(voQ) | ++ _TXDMA_MGQ_MAP(mgtQ) | ++ _TXDMA_HIQ_MAP(hiQ); + + rtw_write16(Adapter, REG_TRXDMA_CTRL, value16); +} + -+static void -+_InitNormalChipOneOutEpPriority( -+struct adapter * Adapter -+ ) ++static void _InitNormalChipOneOutEpPriority(struct adapter *Adapter) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + + u16 value = 0; -+ switch (pHalData->OutEpQueueSel) -+ { -+ case TX_SELE_HQ: -+ value = QUEUE_HIGH; -+ break; -+ case TX_SELE_LQ: -+ value = QUEUE_LOW; -+ break; -+ case TX_SELE_NQ: -+ value = QUEUE_NORMAL; -+ break; -+ default: -+ /* RT_ASSERT(false, ("Shall not reach here!\n")); */ -+ break; ++ switch (pHalData->OutEpQueueSel) { ++ case TX_SELE_HQ: ++ value = QUEUE_HIGH; ++ break; ++ case TX_SELE_LQ: ++ value = QUEUE_LOW; ++ break; ++ case TX_SELE_NQ: ++ value = QUEUE_NORMAL; ++ break; ++ default: ++ /* RT_ASSERT(false, ("Shall not reach here!\n")); */ ++ break; + } + -+ _InitNormalChipRegPriority(Adapter, -+ value, -+ value, -+ value, -+ value, -+ value, -+ value -+ ); ++ _InitNormalChipRegPriority( ++ Adapter, value, value, value, value, value, value ++ ); + +} + -+static void -+_InitNormalChipTwoOutEpPriority( -+struct adapter * Adapter -+ ) ++static void _InitNormalChipTwoOutEpPriority(struct adapter *Adapter) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + struct registry_priv *pregistrypriv = &Adapter->registrypriv; -+ u16 beQ, bkQ, viQ, voQ, mgtQ, hiQ; ++ u16 beQ, bkQ, viQ, voQ, mgtQ, hiQ; + + + u16 valueHi = 0; + u16 valueLow = 0; + -+ switch (pHalData->OutEpQueueSel) -+ { -+ case (TX_SELE_HQ | TX_SELE_LQ): -+ valueHi = QUEUE_HIGH; -+ valueLow = QUEUE_LOW; -+ break; -+ case (TX_SELE_NQ | TX_SELE_LQ): -+ valueHi = QUEUE_NORMAL; -+ valueLow = QUEUE_LOW; -+ break; -+ case (TX_SELE_HQ | TX_SELE_NQ): -+ valueHi = QUEUE_HIGH; -+ valueLow = QUEUE_NORMAL; -+ break; -+ default: -+ /* RT_ASSERT(false, ("Shall not reach here!\n")); */ -+ break; ++ switch (pHalData->OutEpQueueSel) { ++ case (TX_SELE_HQ | TX_SELE_LQ): ++ valueHi = QUEUE_HIGH; ++ valueLow = QUEUE_LOW; ++ break; ++ case (TX_SELE_NQ | TX_SELE_LQ): ++ valueHi = QUEUE_NORMAL; ++ valueLow = QUEUE_LOW; ++ break; ++ case (TX_SELE_HQ | TX_SELE_NQ): ++ valueHi = QUEUE_HIGH; ++ valueLow = QUEUE_NORMAL; ++ break; ++ default: ++ /* RT_ASSERT(false, ("Shall not reach here!\n")); */ ++ break; + } + + if (!pregistrypriv->wifi_spec) { -+ beQ = valueLow; -+ bkQ = valueLow; -+ viQ = valueHi; -+ voQ = valueHi; -+ mgtQ = valueHi; -+ hiQ = valueHi; -+ } -+ else {/* for WMM , CONFIG_OUT_EP_WIFI_MODE */ -+ beQ = valueLow; -+ bkQ = valueHi; -+ viQ = valueHi; -+ voQ = valueLow; -+ mgtQ = valueHi; -+ hiQ = valueHi; ++ beQ = valueLow; ++ bkQ = valueLow; ++ viQ = valueHi; ++ voQ = valueHi; ++ mgtQ = valueHi; ++ hiQ = valueHi; ++ } else { ++ /* for WMM , CONFIG_OUT_EP_WIFI_MODE */ ++ beQ = valueLow; ++ bkQ = valueHi; ++ viQ = valueHi; ++ voQ = valueLow; ++ mgtQ = valueHi; ++ hiQ = valueHi; + } + + _InitNormalChipRegPriority(Adapter, beQ, bkQ, viQ, voQ, mgtQ, hiQ); + +} + -+static void -+_InitNormalChipThreeOutEpPriority( -+struct adapter *padapter -+ ) ++static void _InitNormalChipThreeOutEpPriority(struct adapter *padapter) +{ + struct registry_priv *pregistrypriv = &padapter->registrypriv; -+ u16 beQ, bkQ, viQ, voQ, mgtQ, hiQ; ++ u16 beQ, bkQ, viQ, voQ, mgtQ, hiQ; + -+ if (!pregistrypriv->wifi_spec) {/* typical setting */ -+ beQ = QUEUE_LOW; -+ bkQ = QUEUE_LOW; -+ viQ = QUEUE_NORMAL; -+ voQ = QUEUE_HIGH; -+ mgtQ = QUEUE_HIGH; -+ hiQ = QUEUE_HIGH; -+ } -+ else {/* for WMM */ -+ beQ = QUEUE_LOW; -+ bkQ = QUEUE_NORMAL; -+ viQ = QUEUE_NORMAL; -+ voQ = QUEUE_HIGH; -+ mgtQ = QUEUE_HIGH; -+ hiQ = QUEUE_HIGH; ++ if (!pregistrypriv->wifi_spec) { ++ /* typical setting */ ++ beQ = QUEUE_LOW; ++ bkQ = QUEUE_LOW; ++ viQ = QUEUE_NORMAL; ++ voQ = QUEUE_HIGH; ++ mgtQ = QUEUE_HIGH; ++ hiQ = QUEUE_HIGH; ++ } else { ++ /* for WMM */ ++ beQ = QUEUE_LOW; ++ bkQ = QUEUE_NORMAL; ++ viQ = QUEUE_NORMAL; ++ voQ = QUEUE_HIGH; ++ mgtQ = QUEUE_HIGH; ++ hiQ = QUEUE_HIGH; + } + _InitNormalChipRegPriority(padapter, beQ, bkQ, viQ, voQ, mgtQ, hiQ); +} + -+static void -+_InitNormalChipQueuePriority( -+struct adapter * Adapter -+ ) ++static void _InitNormalChipQueuePriority(struct adapter *Adapter) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + -+ switch (pHalData->OutEpNumber) -+ { -+ case 1: -+ _InitNormalChipOneOutEpPriority(Adapter); -+ break; -+ case 2: -+ _InitNormalChipTwoOutEpPriority(Adapter); -+ break; -+ case 3: -+ _InitNormalChipThreeOutEpPriority(Adapter); -+ break; -+ default: -+ /* RT_ASSERT(false, ("Shall not reach here!\n")); */ -+ break; ++ switch (pHalData->OutEpNumber) { ++ case 1: ++ _InitNormalChipOneOutEpPriority(Adapter); ++ break; ++ case 2: ++ _InitNormalChipTwoOutEpPriority(Adapter); ++ break; ++ case 3: ++ _InitNormalChipThreeOutEpPriority(Adapter); ++ break; ++ default: ++ /* RT_ASSERT(false, ("Shall not reach here!\n")); */ ++ break; + } + + @@ -74728,16 +72698,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + + pregistrypriv = &padapter->registrypriv; + -+ if (pregistrypriv->wifi_spec) -+ { ++ if (pregistrypriv->wifi_spec) { + /* 2010.04.27 hpfan */ + /* Adjust RxAggrTimeout to close to zero disable RxAggr, suggested by designer */ + /* Timeout value is calculated by 34 / (2^n) */ + valueDMATimeout = 0x06; + valueDMAPageCount = 0x06; -+ } -+ else -+ { ++ } else { + /* 20130530, Isaac@SD1 suggest 3 kinds of parameter */ + /* TX/RX Balance */ + valueDMATimeout = 0x06; @@ -74788,8 +72755,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 +{ + struct hal_com_data *pHalData; + struct mlme_ext_priv *pmlmeext; -+ u8 regBwOpMode = 0; -+ u32 regRATR = 0, regRRSR = 0; ++ u8 regBwOpMode = 0; ++ u32 regRATR = 0, regRRSR = 0; + + pHalData = GET_HAL_DATA(padapter); + pmlmeext = &padapter->mlmeextpriv; @@ -74798,42 +72765,41 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + /* */ + /* Set RRSR, RATR, and REG_BWOPMODE registers */ + /* */ -+ switch (pmlmeext->cur_wireless_mode) -+ { -+ case WIRELESS_MODE_B: -+ regBwOpMode = BW_OPMODE_20MHZ; -+ regRATR = RATE_ALL_CCK; -+ regRRSR = RATE_ALL_CCK; -+ break; -+ case WIRELESS_MODE_A: ++ switch (pmlmeext->cur_wireless_mode) { ++ case WIRELESS_MODE_B: ++ regBwOpMode = BW_OPMODE_20MHZ; ++ regRATR = RATE_ALL_CCK; ++ regRRSR = RATE_ALL_CCK; ++ break; ++ case WIRELESS_MODE_A: +/* RT_ASSERT(false, ("Error wireless a mode\n")); */ -+ break; -+ case WIRELESS_MODE_G: -+ regBwOpMode = BW_OPMODE_20MHZ; -+ regRATR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; -+ regRRSR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; -+ break; -+ case WIRELESS_MODE_AUTO: -+ regBwOpMode = BW_OPMODE_20MHZ; -+ regRATR = RATE_ALL_CCK | RATE_ALL_OFDM_AG | RATE_ALL_OFDM_1SS | RATE_ALL_OFDM_2SS; -+ regRRSR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; -+ break; -+ case WIRELESS_MODE_N_24G: -+ /* It support CCK rate by default. */ -+ /* CCK rate will be filtered out only when associated AP does not support it. */ -+ regBwOpMode = BW_OPMODE_20MHZ; -+ regRATR = RATE_ALL_CCK | RATE_ALL_OFDM_AG | RATE_ALL_OFDM_1SS | RATE_ALL_OFDM_2SS; -+ regRRSR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; -+ break; -+ case WIRELESS_MODE_N_5G: ++ break; ++ case WIRELESS_MODE_G: ++ regBwOpMode = BW_OPMODE_20MHZ; ++ regRATR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; ++ regRRSR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; ++ break; ++ case WIRELESS_MODE_AUTO: ++ regBwOpMode = BW_OPMODE_20MHZ; ++ regRATR = RATE_ALL_CCK | RATE_ALL_OFDM_AG | RATE_ALL_OFDM_1SS | RATE_ALL_OFDM_2SS; ++ regRRSR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; ++ break; ++ case WIRELESS_MODE_N_24G: ++ /* It support CCK rate by default. */ ++ /* CCK rate will be filtered out only when associated AP does not support it. */ ++ regBwOpMode = BW_OPMODE_20MHZ; ++ regRATR = RATE_ALL_CCK | RATE_ALL_OFDM_AG | RATE_ALL_OFDM_1SS | RATE_ALL_OFDM_2SS; ++ regRRSR = RATE_ALL_CCK | RATE_ALL_OFDM_AG; ++ break; ++ case WIRELESS_MODE_N_5G: +/* RT_ASSERT(false, ("Error wireless mode")); */ -+ regBwOpMode = BW_OPMODE_5G; -+ regRATR = RATE_ALL_OFDM_AG | RATE_ALL_OFDM_1SS | RATE_ALL_OFDM_2SS; -+ regRRSR = RATE_ALL_OFDM_AG; -+ break; ++ regBwOpMode = BW_OPMODE_5G; ++ regRATR = RATE_ALL_OFDM_AG | RATE_ALL_OFDM_1SS | RATE_ALL_OFDM_2SS; ++ regRRSR = RATE_ALL_OFDM_AG; ++ break; + -+ default: /* for MacOSX compiler warning. */ -+ break; ++ default: /* for MacOSX compiler warning. */ ++ break; + } + + rtw_write8(padapter, REG_BWOPMODE, regBwOpMode); @@ -74882,7 +72848,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 +/* */ +/* 2010/08/09 MH Add for power down check. */ +/* */ -+static bool HalDetectPwrDownMode(struct adapter * Adapter) ++static bool HalDetectPwrDownMode(struct adapter *Adapter) +{ + u8 tmpvalue; + struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); @@ -74893,13 +72859,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + + /* 2010/08/25 MH INF priority > PDN Efuse value. */ + if (tmpvalue & BIT4 && pwrctrlpriv->reg_pdnmode) -+ { + pHalData->pwrdown = true; -+ } + else -+ { + pHalData->pwrdown = false; -+ } + + DBG_8192C("HalDetectPwrDownMode(): PDN =%d\n", pHalData->pwrdown); + @@ -74919,9 +72881,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + pwrctrlpriv = adapter_to_pwrctl(padapter); + pregistrypriv = &padapter->registrypriv; + -+ if (adapter_to_pwrctl(padapter)->bips_processing == true -+ && adapter_to_pwrctl(padapter)->pre_ips_type == 0) -+ { ++ if ( ++ adapter_to_pwrctl(padapter)->bips_processing == true && ++ adapter_to_pwrctl(padapter)->pre_ips_type == 0 ++ ) { + unsigned long start_time; + u8 cpwm_orig, cpwm_now; + u8 val8, bMacPwrCtrlOn = true; @@ -74949,12 +72912,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + + rtw_hal_get_hwreg(padapter, HW_VAR_CPWM, &cpwm_now); + if ((cpwm_orig ^ cpwm_now) & 0x80) -+ { + break; -+ } + -+ if (jiffies_to_msecs(jiffies - start_time) > 100) -+ { ++ if (jiffies_to_msecs(jiffies - start_time) > 100) { + DBG_871X("%s: polling cpwm timeout when leaving IPS in FWLPS state\n", __func__); + break; + } @@ -75020,9 +72980,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + +/* SIC_Init(padapter); */ + -+ if (pwrctrlpriv->reg_rfoff == true) { ++ if (pwrctrlpriv->reg_rfoff == true) + pwrctrlpriv->rf_pwrstate = rf_off; -+ } + + /* 2010/08/09 MH We need to check if we need to turnon or off RF after detecting */ + /* HW GPIO pin. Before PHY_RFConfig8192C. */ @@ -75069,8 +73028,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + /* */ + /* Joseph Note: Keep RfRegChnlVal for later use. */ + /* */ -+ pHalData->RfRegChnlVal[0] = PHY_QueryRFReg(padapter, (enum RF_PATH)0, RF_CHNLBW, bRFRegOffsetMask); -+ pHalData->RfRegChnlVal[1] = PHY_QueryRFReg(padapter, (enum RF_PATH)1, RF_CHNLBW, bRFRegOffsetMask); ++ pHalData->RfRegChnlVal[0] = ++ PHY_QueryRFReg(padapter, (enum RF_PATH)0, RF_CHNLBW, bRFRegOffsetMask); ++ pHalData->RfRegChnlVal[1] = ++ PHY_QueryRFReg(padapter, (enum RF_PATH)1, RF_CHNLBW, bRFRegOffsetMask); + + + /* if (!pHalData->bMACFuncEnable) { */ @@ -75167,8 +73128,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + { + pwrctrlpriv->rf_pwrstate = rf_on; + -+ if (pwrctrlpriv->rf_pwrstate == rf_on) -+ { ++ if (pwrctrlpriv->rf_pwrstate == rf_on) { + struct pwrctrl_priv *pwrpriv; + unsigned long start_time; + u8 restore_iqk_rst; @@ -75193,8 +73153,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + + rtw_btcoex_IQKNotify(padapter, true); + -+ restore_iqk_rst = (pwrpriv->bips_processing ==true)?true:false; -+ b2Ant = pHalData->EEPROMBluetoothAntNum ==Ant_x2?true:false; ++ restore_iqk_rst = (pwrpriv->bips_processing == true) ? true : false; ++ b2Ant = pHalData->EEPROMBluetoothAntNum == Ant_x2 ? true : false; + PHY_IQCalibrate_8723B(padapter, false, restore_iqk_rst, b2Ant, pHalData->ant_path); + pHalData->odmpriv.RFCalibrateInfo.bIQKInitialized = true; + @@ -75270,15 +73230,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + +static u32 rtl8723bs_hal_deinit(struct adapter *padapter) +{ -+ struct dvobj_priv *psdpriv = padapter->dvobj; ++ struct dvobj_priv *psdpriv = padapter->dvobj; + struct debug_priv *pdbgpriv = &psdpriv->drv_dbg; + -+ if (padapter->hw_init_completed == true) -+ { -+ if (adapter_to_pwrctl(padapter)->bips_processing == true) -+ { -+ if (padapter->netif_up == true) -+ { ++ if (padapter->hw_init_completed == true) { ++ if (adapter_to_pwrctl(padapter)->bips_processing == true) { ++ if (padapter->netif_up == true) { + int cnt = 0; + u8 val8 = 0; + @@ -75286,15 +73243,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + + rtl8723b_set_FwPwrModeInIPS_cmd(padapter, 0x3); + /* poll 0x1cc to make sure H2C command already finished by FW; MAC_0x1cc = 0 means H2C done by FW. */ -+ do{ ++ do { + val8 = rtw_read8(padapter, REG_HMETFR); + cnt++; + DBG_871X("%s polling REG_HMETFR = 0x%x, cnt =%d\n", __func__, val8, cnt); + mdelay(10); -+ }while (cnt<100 && (val8!= 0)); ++ } while (cnt < 100 && (val8 != 0)); + /* H2C done, enter 32k */ -+ if (val8 == 0) -+ { ++ if (val8 == 0) { + /* ser rpwm to enter 32k */ + val8 = rtw_read8(padapter, SDIO_LOCAL_BASE|SDIO_REG_HRPWM1); + val8 += 0x80; @@ -75303,44 +73259,44 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + DBG_871X("%s: write rpwm =%02x\n", __func__, val8); + adapter_to_pwrctl(padapter)->tog = (val8 + 0x80) & 0x80; + cnt = val8 = 0; -+ do{ ++ do { + val8 = rtw_read8(padapter, REG_CR); + cnt++; + DBG_871X("%s polling 0x100 = 0x%x, cnt =%d\n", __func__, val8, cnt); + mdelay(10); -+ }while (cnt<100 && (val8!= 0xEA)); -+ } -+ else -+ { -+ DBG_871X("MAC_1C0 =%08x, MAC_1C4 =%08x, MAC_1C8 =%08x, MAC_1CC =%08x\n", rtw_read32(padapter, 0x1c0), rtw_read32(padapter, 0x1c4) -+ , rtw_read32(padapter, 0x1c8), rtw_read32(padapter, 0x1cc)); ++ } while (cnt < 100 && (val8 != 0xEA)); ++ } else { ++ DBG_871X( ++ "MAC_1C0 =%08x, MAC_1C4 =%08x, MAC_1C8 =%08x, MAC_1CC =%08x\n", ++ rtw_read32(padapter, 0x1c0), ++ rtw_read32(padapter, 0x1c4), ++ rtw_read32(padapter, 0x1c8), ++ rtw_read32(padapter, 0x1cc) ++ ); + } + -+ DBG_871X("polling done when entering IPS, check result : 0x100 = 0x%x, cnt =%d, MAC_1cc = 0x%02x\n" -+ , rtw_read8(padapter, REG_CR), cnt, rtw_read8(padapter, REG_HMETFR)); ++ DBG_871X( ++ "polling done when entering IPS, check result : 0x100 = 0x%x, cnt =%d, MAC_1cc = 0x%02x\n", ++ rtw_read8(padapter, REG_CR), ++ cnt, ++ rtw_read8(padapter, REG_HMETFR) ++ ); + + adapter_to_pwrctl(padapter)->pre_ips_type = 0; + -+ } -+ else -+ { ++ } else { + pdbgpriv->dbg_carddisable_cnt++; + CardDisableRTL8723BSdio(padapter); + + adapter_to_pwrctl(padapter)->pre_ips_type = 1; + } + -+ } -+ else -+ { ++ } else { + pdbgpriv->dbg_carddisable_cnt++; + CardDisableRTL8723BSdio(padapter); + } -+ } -+ else -+ { ++ } else + pdbgpriv->dbg_deinit_fail_cnt++; -+ } + + return _SUCCESS; +} @@ -75374,10 +73330,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + +static void rtl8723bs_interface_configure(struct adapter *padapter) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); -+ struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); ++ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); ++ struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); + struct registry_priv *pregistrypriv = &padapter->registrypriv; -+ bool bWiFiConfig = pregistrypriv->wifi_spec; ++ bool bWiFiConfig = pregistrypriv->wifi_spec; + + + pdvobjpriv->RtOutPipe[0] = WLAN_TX_HIQ_DEVICE_ID; @@ -75390,17 +73346,17 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + pHalData->OutEpNumber = SDIO_MAX_TX_QUEUE; + + switch (pHalData->OutEpNumber) { -+ case 3: -+ pHalData->OutEpQueueSel =TX_SELE_HQ| TX_SELE_LQ|TX_SELE_NQ; -+ break; -+ case 2: -+ pHalData->OutEpQueueSel =TX_SELE_HQ| TX_SELE_NQ; -+ break; -+ case 1: -+ pHalData->OutEpQueueSel =TX_SELE_HQ; -+ break; -+ default: -+ break; ++ case 3: ++ pHalData->OutEpQueueSel = TX_SELE_HQ | TX_SELE_LQ|TX_SELE_NQ; ++ break; ++ case 2: ++ pHalData->OutEpQueueSel = TX_SELE_HQ | TX_SELE_NQ; ++ break; ++ case 1: ++ pHalData->OutEpQueueSel = TX_SELE_HQ; ++ break; ++ default: ++ break; + } + + Hal_MappingOutPipe(padapter, pHalData->OutEpNumber); @@ -75415,24 +73371,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 +/* */ +/* Added by Roger, 2010.11.23. */ +/* */ -+static void -+_EfuseCellSel( -+struct adapter *padapter -+ ) ++static void _EfuseCellSel(struct adapter *padapter) +{ -+ u32 value32; ++ u32 value32; + + value32 = rtw_read32(padapter, EFUSE_TEST); + value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_WIFI_SEL_0); + rtw_write32(padapter, EFUSE_TEST, value32); +} + -+static void -+_ReadRFType( -+struct adapter *Adapter -+ ) ++static void _ReadRFType(struct adapter *Adapter) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); ++ struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); + +#if DISABLE_BB_RF + pHalData->rf_chip = RF_PSEUDO_11N; @@ -75442,64 +73392,58 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 +} + + -+static void -+Hal_EfuseParseMACAddr_8723BS( -+struct adapter * padapter, -+u8* hwinfo, -+bool AutoLoadFail -+ ) ++static void Hal_EfuseParseMACAddr_8723BS( ++ struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail ++) +{ -+ u16 i; -+ u8 sMacAddr[6] = {0x00, 0xE0, 0x4C, 0xb7, 0x23, 0x00}; ++ u16 i; ++ u8 sMacAddr[6] = {0x00, 0xE0, 0x4C, 0xb7, 0x23, 0x00}; + struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter); + -+ if (AutoLoadFail) -+ { ++ if (AutoLoadFail) { +/* sMacAddr[5] = (u8)GetRandomNumber(1, 254); */ -+ for (i = 0; i<6; i++) ++ for (i = 0; i < 6; i++) + pEEPROM->mac_addr[i] = sMacAddr[i]; -+ } -+ else -+ { ++ } else { + /* Read Permanent MAC address */ + memcpy(pEEPROM->mac_addr, &hwinfo[EEPROM_MAC_ADDR_8723BS], ETH_ALEN); + } +/* NicIFSetMacAddress(padapter, padapter->PermanentAddress); */ + -+ RT_TRACE(_module_hci_hal_init_c_, _drv_notice_, -+ ("Hal_EfuseParseMACAddr_8723BS: Permanent Address = %02x-%02x-%02x-%02x-%02x-%02x\n", -+ pEEPROM->mac_addr[0], pEEPROM->mac_addr[1], -+ pEEPROM->mac_addr[2], pEEPROM->mac_addr[3], -+ pEEPROM->mac_addr[4], pEEPROM->mac_addr[5])); ++ RT_TRACE( ++ _module_hci_hal_init_c_, ++ _drv_notice_, ++ ( ++ "Hal_EfuseParseMACAddr_8723BS: Permanent Address = %02x-%02x-%02x-%02x-%02x-%02x\n", ++ pEEPROM->mac_addr[0], ++ pEEPROM->mac_addr[1], ++ pEEPROM->mac_addr[2], ++ pEEPROM->mac_addr[3], ++ pEEPROM->mac_addr[4], ++ pEEPROM->mac_addr[5] ++ ) ++ ); +} + -+static void -+Hal_EfuseParseBoardType_8723BS( -+struct adapter * padapter, -+u8* hwinfo, -+bool AutoLoadFail -+ ) ++static void Hal_EfuseParseBoardType_8723BS( ++ struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail ++) +{ -+ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); ++ struct hal_com_data *pHalData = GET_HAL_DATA(padapter); + -+ if (!AutoLoadFail) -+ { ++ if (!AutoLoadFail) { + pHalData->BoardType = (hwinfo[EEPROM_RF_BOARD_OPTION_8723B] & 0xE0) >> 5; + if (pHalData->BoardType == 0xFF) + pHalData->BoardType = (EEPROM_DEFAULT_BOARD_OPTION&0xE0)>>5; -+ } -+ else ++ } else + pHalData->BoardType = 0; + RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("Board Type: 0x%2x\n", pHalData->BoardType)); +} + -+static void -+_ReadEfuseInfo8723BS( -+ struct adapter * padapter -+ ) ++static void _ReadEfuseInfo8723BS(struct adapter *padapter) +{ + struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter); -+ u8* hwinfo = NULL; ++ u8 *hwinfo = NULL; + + RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("====>_ReadEfuseInfo8723BS()\n")); + @@ -75525,10 +73469,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + /* */ + /* Read Bluetooth co-exist and initialize */ + /* */ ++ Hal_EfuseParsePackageType_8723B(padapter, hwinfo, pEEPROM->bautoload_fail_flag); + Hal_EfuseParseBTCoexistInfo_8723B(padapter, hwinfo, pEEPROM->bautoload_fail_flag); + Hal_EfuseParseChnlPlan_8723B(padapter, hwinfo, pEEPROM->bautoload_fail_flag); + Hal_EfuseParseXtal_8723B(padapter, hwinfo, pEEPROM->bautoload_fail_flag); -+ Hal_EfuseParsePackageType_8723B(padapter, hwinfo, pEEPROM->bautoload_fail_flag); + Hal_EfuseParseThermalMeter_8723B(padapter, hwinfo, pEEPROM->bautoload_fail_flag); + Hal_EfuseParseAntennaDiversity_8723B(padapter, hwinfo, pEEPROM->bautoload_fail_flag); + Hal_EfuseParseCustomerID_8723B(padapter, hwinfo, pEEPROM->bautoload_fail_flag); @@ -75544,9 +73488,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("<==== _ReadEfuseInfo8723BS()\n")); +} + -+static void _ReadPROMContent( -+ struct adapter * padapter -+ ) ++static void _ReadPROMContent(struct adapter *padapter) +{ + struct eeprom_priv *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter); + u8 eeValue; @@ -75567,10 +73509,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + _ReadEfuseInfo8723BS(padapter); +} + -+static void -+_InitOtherVariable( -+ struct adapter * Adapter -+ ) ++static void _InitOtherVariable(struct adapter *Adapter) +{ +} + @@ -75607,8 +73546,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + _ReadPROMContent(padapter); + _InitOtherVariable(padapter); + -+ if (padapter->hw_init_completed == false) -+ { ++ if (padapter->hw_init_completed == false) { + rtw_write8(padapter, 0x67, 0x00); /* for BT, Switch Ant control to BT */ + CardDisableRTL8723BSdio(padapter);/* for the power consumption issue, wifi ko module is loaded during booting, but wifi GUI is off */ + } @@ -75655,228 +73593,246 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + + pHalData = GET_HAL_DATA(padapter); + -+ switch (variable) -+ { -+ case HW_VAR_SET_RPWM: -+ /* rpwm value only use BIT0(clock bit) , BIT6(Ack bit), and BIT7(Toggle bit) */ -+ /* BIT0 value - 1: 32k, 0:40MHz. */ -+ /* BIT6 value - 1: report cpwm value after success set, 0:do not report. */ -+ /* BIT7 value - Toggle bit change. */ -+ { -+ val8 = *val; -+ val8 &= 0xC1; -+ rtw_write8(padapter, SDIO_LOCAL_BASE|SDIO_REG_HRPWM1, val8); -+ } -+ break; -+ case HW_VAR_SET_REQ_FW_PS: -+ { -+ u8 req_fw_ps = 0; -+ req_fw_ps = rtw_read8(padapter, 0x8f); -+ req_fw_ps |= 0x10; -+ rtw_write8(padapter, 0x8f, req_fw_ps); -+ } -+ break; -+ case HW_VAR_RXDMA_AGG_PG_TH: -+ val8 = *val; -+ break; -+ -+#ifdef CONFIG_WOWLAN -+ case HW_VAR_WOWLAN: ++ switch (variable) { ++ case HW_VAR_SET_RPWM: ++ /* rpwm value only use BIT0(clock bit) , BIT6(Ack bit), and BIT7(Toggle bit) */ ++ /* BIT0 value - 1: 32k, 0:40MHz. */ ++ /* BIT6 value - 1: report cpwm value after success set, 0:do not report. */ ++ /* BIT7 value - Toggle bit change. */ + { -+ poidparam = (struct wowlan_ioctl_param *)val; -+ switch (poidparam->subcode) { -+ case WOWLAN_ENABLE: -+ DBG_871X_LEVEL(_drv_always_, "WOWLAN_ENABLE\n"); -+ -+ /* backup data rate to register 0x8b for wowlan FW */ -+ rtw_write8(padapter, 0x8d, 1); -+ rtw_write8(padapter, 0x8c, 0); -+ rtw_write8(padapter, 0x8f, 0x40); -+ rtw_write8(padapter, 0x8b, -+ rtw_read8(padapter, 0x2f0)); -+ -+ /* 1. Download WOWLAN FW */ -+ DBG_871X_LEVEL(_drv_always_, "Re-download WoWlan FW!\n"); -+ SetFwRelatedForWoWLAN8723b(padapter, true); -+ -+ /* 2. RX DMA stop */ -+ DBG_871X_LEVEL(_drv_always_, "Pause DMA\n"); -+ rtw_write32(padapter, REG_RXPKT_NUM, (rtw_read32(padapter, REG_RXPKT_NUM)|RW_RELEASE_EN)); -+ do{ -+ if ((rtw_read32(padapter, REG_RXPKT_NUM)&RXDMA_IDLE)) { -+ DBG_871X_LEVEL(_drv_always_, "RX_DMA_IDLE is true\n"); -+ break; -+ } else { -+ /* If RX_DMA is not idle, receive one pkt from DMA */ -+ res = sdio_local_read(padapter, SDIO_REG_RX0_REQ_LEN, 4, (u8 *)&tmp); -+ len = le16_to_cpu(tmp); -+ DBG_871X_LEVEL(_drv_always_, "RX len:%d\n", len); -+ if (len > 0) -+ res = RecvOnePkt(padapter, len); -+ else -+ DBG_871X_LEVEL(_drv_always_, "read length fail %d\n", len); -+ -+ DBG_871X_LEVEL(_drv_always_, "RecvOnePkt Result: %d\n", res); -+ } -+ }while (trycnt--); -+ if (trycnt == 0) -+ DBG_871X_LEVEL(_drv_always_, "Stop RX DMA failed......\n"); -+ -+ /* 3. Clear IMR and ISR */ -+ DBG_871X_LEVEL(_drv_always_, "Clear IMR and ISR\n"); -+ tmp = 0; -+ sdio_local_write(padapter, SDIO_REG_HIMR_ON, 4, (u8 *)&tmp); -+ sdio_local_write(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); -+ sdio_local_read(padapter, SDIO_REG_HISR, 4, (u8 *)&tmp); -+ sdio_local_write(padapter, SDIO_REG_HISR, 4, (u8 *)&tmp); -+ -+ /* 4. Enable CPWM2 only */ -+ DBG_871X_LEVEL(_drv_always_, "Enable only CPWM2\n"); -+ sdio_local_read(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); -+ DBG_871X("DisableInterruptButCpwm28723BSdio(): Read SDIO_REG_HIMR: 0x%08x\n", tmp); -+ -+ himr = cpu_to_le32(SDIO_HIMR_DISABLED)|SDIO_HIMR_CPWM2_MSK; -+ sdio_local_write(padapter, SDIO_REG_HIMR, 4, (u8 *)&himr); -+ -+ sdio_local_read(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); -+ DBG_871X("DisableInterruptButCpwm28723BSdio(): Read again SDIO_REG_HIMR: 0x%08x\n", tmp); -+ -+ /* 5. Set Enable WOWLAN H2C command. */ -+ DBG_871X_LEVEL(_drv_always_, "Set Enable WOWLan cmd\n"); -+ rtl8723b_set_wowlan_cmd(padapter, 1); -+ -+ /* 6. Check EnableWoWlan CMD is ready */ -+ if (!pwrctl->wowlan_pno_enable) { -+ DBG_871X_LEVEL(_drv_always_, "Check EnableWoWlan CMD is ready\n"); -+ mstatus = rtw_read8(padapter, REG_WOW_CTRL); -+ trycnt = 10; -+ while (!(mstatus&BIT1) && trycnt>1) { -+ mstatus = rtw_read8(padapter, REG_WOW_CTRL); -+ DBG_871X("Loop index: %d :0x%02x\n", trycnt, mstatus); -+ trycnt --; -+ msleep(2); -+ } -+ } -+ break; -+ -+ case WOWLAN_DISABLE: -+ DBG_871X_LEVEL(_drv_always_, "WOWLAN_DISABLE\n"); -+ -+ psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(pmlmepriv)); -+ if (psta != NULL) -+ rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_DISCONNECT, psta->mac_id); -+ else -+ DBG_871X("psta is null\n"); -+ -+ /* 1. Read wakeup reason */ -+ pwrctl->wowlan_wake_reason = rtw_read8(padapter, REG_WOWLAN_WAKE_REASON); -+ DBG_871X_LEVEL(_drv_always_, "wakeup_reason: 0x%02x, mac_630 = 0x%08x, mac_634 = 0x%08x, mac_1c0 = 0x%08x, mac_1c4 = 0x%08x" -+ ", mac_494 = 0x%08x, , mac_498 = 0x%08x, mac_49c = 0x%08x, mac_608 = 0x%08x, mac_4a0 = 0x%08x, mac_4a4 = 0x%08x\n" -+ ", mac_1cc = 0x%08x, mac_2f0 = 0x%08x, mac_2f4 = 0x%08x, mac_2f8 = 0x%08x, mac_2fc = 0x%08x, mac_8c = 0x%08x" -+ , pwrctl->wowlan_wake_reason, rtw_read32(padapter, REG_WOWLAN_GTK_DBG1), rtw_read32(padapter, REG_WOWLAN_GTK_DBG2) -+ , rtw_read32(padapter, 0x1c0), rtw_read32(padapter, 0x1c4) -+ , rtw_read32(padapter, 0x494), rtw_read32(padapter, 0x498), rtw_read32(padapter, 0x49c), rtw_read32(padapter, 0x608) -+ , rtw_read32(padapter, 0x4a0), rtw_read32(padapter, 0x4a4) -+ , rtw_read32(padapter, 0x1cc), rtw_read32(padapter, 0x2f0), rtw_read32(padapter, 0x2f4), rtw_read32(padapter, 0x2f8) -+ , rtw_read32(padapter, 0x2fc), rtw_read32(padapter, 0x8c)); -+#ifdef CONFIG_PNO_SET_DEBUG -+ DBG_871X("0x1b9: 0x%02x, 0x632: 0x%02x\n", rtw_read8(padapter, 0x1b9), rtw_read8(padapter, 0x632)); -+ DBG_871X("0x4fc: 0x%02x, 0x4fd: 0x%02x\n", rtw_read8(padapter, 0x4fc), rtw_read8(padapter, 0x4fd)); -+ DBG_871X("TXDMA STATUS: 0x%08x\n", rtw_read32(padapter, REG_TXDMA_STATUS)); -+#endif -+ -+ { -+ /* 2. Set Disable WOWLAN H2C command. */ -+ DBG_871X_LEVEL(_drv_always_, "Set Disable WOWLan cmd\n"); -+ rtl8723b_set_wowlan_cmd(padapter, 0); -+ -+ /* 3. Check Disable WoWlan CMD ready. */ -+ DBG_871X_LEVEL(_drv_always_, "Check DisableWoWlan CMD is ready\n"); -+ mstatus = rtw_read8(padapter, REG_WOW_CTRL); -+ trycnt = 50; -+ while (mstatus&BIT1 && trycnt>1) { -+ mstatus = rtw_read8(padapter, REG_WOW_CTRL); -+ DBG_871X_LEVEL(_drv_always_, "Loop index: %d :0x%02x\n", trycnt, mstatus); -+ trycnt --; -+ msleep(10); -+ } -+ -+ if (mstatus & BIT1) { -+ DBG_871X_LEVEL(_drv_always_, "Disable WOW mode fail!!\n"); -+ DBG_871X("Set 0x690 = 0x00\n"); -+ rtw_write8(padapter, REG_WOW_CTRL, (rtw_read8(padapter, REG_WOW_CTRL)&0xf0)); -+ DBG_871X_LEVEL(_drv_always_, "Release RXDMA\n"); -+ rtw_write32(padapter, REG_RXPKT_NUM, (rtw_read32(padapter, REG_RXPKT_NUM)&(~RW_RELEASE_EN))); -+ } -+ -+ /* 3.1 read fw iv */ -+ iv_low = rtw_read32(padapter, REG_TXPKTBUF_IV_LOW); -+ /* only low two bytes is PN, check AES_IV macro for detail */ -+ iv_low &= 0xffff; -+ iv_high = rtw_read32(padapter, REG_TXPKTBUF_IV_HIGH); -+ /* get the real packet number */ -+ pwrctl->wowlan_fw_iv = iv_high << 16 | iv_low; -+ DBG_871X_LEVEL(_drv_always_, "fw_iv: 0x%016llx\n", pwrctl->wowlan_fw_iv); -+ /* Update TX iv data. */ -+ rtw_set_sec_pn(padapter); -+ -+ /* 3.2 read GTK index and key */ -+ if (psecuritypriv->binstallKCK_KEK == true && psecuritypriv->dot11PrivacyAlgrthm == _AES_) -+ { -+ u8 gtk_keyindex = 0; -+ u8 get_key[16]; -+ /* read gtk key index */ -+ gtk_keyindex = rtw_read8(padapter, 0x48c); -+ -+ if (gtk_keyindex < 4) -+ { -+ psecuritypriv->dot118021XGrpKeyid = gtk_keyindex; -+ read_cam(padapter , gtk_keyindex, get_key); -+ memcpy(psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey, get_key, 16); -+ DBG_871X_LEVEL(_drv_always_, "GTK (%d) = 0x%08x, 0x%08x, 0x%08x, 0x%08x\n", gtk_keyindex, -+ psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[0], -+ psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[1], -+ psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[2], -+ psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[3]); -+ } -+ else -+ DBG_871X_LEVEL(_drv_always_, "GTK index =%d\n", gtk_keyindex); -+ } -+ -+ /* 4. Re-download Normal FW. */ -+ DBG_871X_LEVEL(_drv_always_, "Re-download Normal FW!\n"); -+ SetFwRelatedForWoWLAN8723b(padapter, false); -+ } -+#ifdef CONFIG_GPIO_WAKEUP -+ DBG_871X_LEVEL(_drv_always_, "Set Wake GPIO to high for default.\n"); -+ HalSetOutPutGPIO(padapter, WAKEUP_GPIO_IDX, 1); -+#endif -+ -+ /* 5. Download reserved pages and report media status if needed. */ -+ if ((pwrctl->wowlan_wake_reason != FWDecisionDisconnect) && -+ (pwrctl->wowlan_wake_reason != Rx_Pairwisekey) && -+ (pwrctl->wowlan_wake_reason != Rx_DisAssoc) && -+ (pwrctl->wowlan_wake_reason != Rx_DeAuth)) -+ { -+ rtl8723b_set_FwJoinBssRpt_cmd(padapter, RT_MEDIA_CONNECT); -+ if (psta != NULL) -+ rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_CONNECT, psta->mac_id); -+ } -+#ifdef CONFIG_PNO_SUPPORT -+ rtw_write8(padapter, 0x1b8, 0); -+ DBG_871X("reset 0x1b8: %d\n", rtw_read8(padapter, 0x1b8)); -+ rtw_write8(padapter, 0x1b9, 0); -+ DBG_871X("reset 0x1b9: %d\n", rtw_read8(padapter, 0x1b9)); -+ rtw_write8(padapter, REG_PNO_STATUS, 0); -+ DBG_871X("reset REG_PNO_STATUS: %d\n", rtw_read8(padapter, REG_PNO_STATUS)); -+#endif -+ break; -+ -+ default: -+ break; -+ } ++ val8 = *val; ++ val8 &= 0xC1; ++ rtw_write8(padapter, SDIO_LOCAL_BASE|SDIO_REG_HRPWM1, val8); + } + break; ++ case HW_VAR_SET_REQ_FW_PS: ++ { ++ u8 req_fw_ps = 0; ++ req_fw_ps = rtw_read8(padapter, 0x8f); ++ req_fw_ps |= 0x10; ++ rtw_write8(padapter, 0x8f, req_fw_ps); ++ } ++ break; ++ case HW_VAR_RXDMA_AGG_PG_TH: ++ val8 = *val; ++ break; ++ ++#ifdef CONFIG_WOWLAN ++ case HW_VAR_WOWLAN: ++ { ++ poidparam = (struct wowlan_ioctl_param *)val; ++ switch (poidparam->subcode) { ++ case WOWLAN_ENABLE: ++ DBG_871X_LEVEL(_drv_always_, "WOWLAN_ENABLE\n"); ++ ++ /* backup data rate to register 0x8b for wowlan FW */ ++ rtw_write8(padapter, 0x8d, 1); ++ rtw_write8(padapter, 0x8c, 0); ++ rtw_write8(padapter, 0x8f, 0x40); ++ rtw_write8(padapter, 0x8b, ++ rtw_read8(padapter, 0x2f0)); ++ ++ /* 1. Download WOWLAN FW */ ++ DBG_871X_LEVEL(_drv_always_, "Re-download WoWlan FW!\n"); ++ SetFwRelatedForWoWLAN8723b(padapter, true); ++ ++ /* 2. RX DMA stop */ ++ DBG_871X_LEVEL(_drv_always_, "Pause DMA\n"); ++ rtw_write32(padapter, REG_RXPKT_NUM, (rtw_read32(padapter, REG_RXPKT_NUM)|RW_RELEASE_EN)); ++ do { ++ if ((rtw_read32(padapter, REG_RXPKT_NUM)&RXDMA_IDLE)) { ++ DBG_871X_LEVEL(_drv_always_, "RX_DMA_IDLE is true\n"); ++ break; ++ } else { ++ /* If RX_DMA is not idle, receive one pkt from DMA */ ++ res = sdio_local_read(padapter, SDIO_REG_RX0_REQ_LEN, 4, (u8 *)&tmp); ++ len = le16_to_cpu(tmp); ++ DBG_871X_LEVEL(_drv_always_, "RX len:%d\n", len); ++ if (len > 0) ++ res = RecvOnePkt(padapter, len); ++ else ++ DBG_871X_LEVEL(_drv_always_, "read length fail %d\n", len); ++ ++ DBG_871X_LEVEL(_drv_always_, "RecvOnePkt Result: %d\n", res); ++ } ++ } while (trycnt--); ++ if (trycnt == 0) ++ DBG_871X_LEVEL(_drv_always_, "Stop RX DMA failed......\n"); ++ ++ /* 3. Clear IMR and ISR */ ++ DBG_871X_LEVEL(_drv_always_, "Clear IMR and ISR\n"); ++ tmp = 0; ++ sdio_local_write(padapter, SDIO_REG_HIMR_ON, 4, (u8 *)&tmp); ++ sdio_local_write(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); ++ sdio_local_read(padapter, SDIO_REG_HISR, 4, (u8 *)&tmp); ++ sdio_local_write(padapter, SDIO_REG_HISR, 4, (u8 *)&tmp); ++ ++ /* 4. Enable CPWM2 only */ ++ DBG_871X_LEVEL(_drv_always_, "Enable only CPWM2\n"); ++ sdio_local_read(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); ++ DBG_871X("DisableInterruptButCpwm28723BSdio(): Read SDIO_REG_HIMR: 0x%08x\n", tmp); ++ ++ himr = cpu_to_le32(SDIO_HIMR_DISABLED)|SDIO_HIMR_CPWM2_MSK; ++ sdio_local_write(padapter, SDIO_REG_HIMR, 4, (u8 *)&himr); ++ ++ sdio_local_read(padapter, SDIO_REG_HIMR, 4, (u8 *)&tmp); ++ DBG_871X("DisableInterruptButCpwm28723BSdio(): Read again SDIO_REG_HIMR: 0x%08x\n", tmp); ++ ++ /* 5. Set Enable WOWLAN H2C command. */ ++ DBG_871X_LEVEL(_drv_always_, "Set Enable WOWLan cmd\n"); ++ rtl8723b_set_wowlan_cmd(padapter, 1); ++ ++ /* 6. Check EnableWoWlan CMD is ready */ ++ if (!pwrctl->wowlan_pno_enable) { ++ DBG_871X_LEVEL(_drv_always_, "Check EnableWoWlan CMD is ready\n"); ++ mstatus = rtw_read8(padapter, REG_WOW_CTRL); ++ trycnt = 10; ++ while (!(mstatus&BIT1) && trycnt > 1) { ++ mstatus = rtw_read8(padapter, REG_WOW_CTRL); ++ DBG_871X("Loop index: %d :0x%02x\n", trycnt, mstatus); ++ trycnt--; ++ msleep(2); ++ } ++ } ++ break; ++ ++ case WOWLAN_DISABLE: ++ DBG_871X_LEVEL(_drv_always_, "WOWLAN_DISABLE\n"); ++ ++ psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(pmlmepriv)); ++ if (psta != NULL) ++ rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_DISCONNECT, psta->mac_id); ++ else ++ DBG_871X("psta is null\n"); ++ ++ /* 1. Read wakeup reason */ ++ pwrctl->wowlan_wake_reason = rtw_read8(padapter, REG_WOWLAN_WAKE_REASON); ++ DBG_871X_LEVEL( ++ _drv_always_, ++ "wakeup_reason: 0x%02x, mac_630 = 0x%08x, mac_634 = 0x%08x, mac_1c0 = 0x%08x, mac_1c4 = 0x%08x" ++ ", mac_494 = 0x%08x, , mac_498 = 0x%08x, mac_49c = 0x%08x, mac_608 = 0x%08x, mac_4a0 = 0x%08x, mac_4a4 = 0x%08x\n" ++ ", mac_1cc = 0x%08x, mac_2f0 = 0x%08x, mac_2f4 = 0x%08x, mac_2f8 = 0x%08x, mac_2fc = 0x%08x, mac_8c = 0x%08x", ++ pwrctl->wowlan_wake_reason, ++ rtw_read32(padapter, REG_WOWLAN_GTK_DBG1), ++ rtw_read32(padapter, REG_WOWLAN_GTK_DBG2), ++ rtw_read32(padapter, 0x1c0), ++ rtw_read32(padapter, 0x1c4), ++ rtw_read32(padapter, 0x494), ++ rtw_read32(padapter, 0x498), ++ rtw_read32(padapter, 0x49c), ++ rtw_read32(padapter, 0x608), ++ rtw_read32(padapter, 0x4a0), ++ rtw_read32(padapter, 0x4a4), ++ rtw_read32(padapter, 0x1cc), ++ rtw_read32(padapter, 0x2f0), ++ rtw_read32(padapter, 0x2f4), ++ rtw_read32(padapter, 0x2f8), ++ rtw_read32(padapter, 0x2fc), ++ rtw_read32(padapter, 0x8c) ++ ); ++#ifdef CONFIG_PNO_SET_DEBUG ++ DBG_871X("0x1b9: 0x%02x, 0x632: 0x%02x\n", rtw_read8(padapter, 0x1b9), rtw_read8(padapter, 0x632)); ++ DBG_871X("0x4fc: 0x%02x, 0x4fd: 0x%02x\n", rtw_read8(padapter, 0x4fc), rtw_read8(padapter, 0x4fd)); ++ DBG_871X("TXDMA STATUS: 0x%08x\n", rtw_read32(padapter, REG_TXDMA_STATUS)); ++#endif ++ ++ { ++ /* 2. Set Disable WOWLAN H2C command. */ ++ DBG_871X_LEVEL(_drv_always_, "Set Disable WOWLan cmd\n"); ++ rtl8723b_set_wowlan_cmd(padapter, 0); ++ ++ /* 3. Check Disable WoWlan CMD ready. */ ++ DBG_871X_LEVEL(_drv_always_, "Check DisableWoWlan CMD is ready\n"); ++ mstatus = rtw_read8(padapter, REG_WOW_CTRL); ++ trycnt = 50; ++ while (mstatus&BIT1 && trycnt > 1) { ++ mstatus = rtw_read8(padapter, REG_WOW_CTRL); ++ DBG_871X_LEVEL(_drv_always_, "Loop index: %d :0x%02x\n", trycnt, mstatus); ++ trycnt--; ++ msleep(10); ++ } ++ ++ if (mstatus & BIT1) { ++ DBG_871X_LEVEL(_drv_always_, "Disable WOW mode fail!!\n"); ++ DBG_871X("Set 0x690 = 0x00\n"); ++ rtw_write8(padapter, REG_WOW_CTRL, (rtw_read8(padapter, REG_WOW_CTRL)&0xf0)); ++ DBG_871X_LEVEL(_drv_always_, "Release RXDMA\n"); ++ rtw_write32(padapter, REG_RXPKT_NUM, (rtw_read32(padapter, REG_RXPKT_NUM)&(~RW_RELEASE_EN))); ++ } ++ ++ /* 3.1 read fw iv */ ++ iv_low = rtw_read32(padapter, REG_TXPKTBUF_IV_LOW); ++ /* only low two bytes is PN, check AES_IV macro for detail */ ++ iv_low &= 0xffff; ++ iv_high = rtw_read32(padapter, REG_TXPKTBUF_IV_HIGH); ++ /* get the real packet number */ ++ pwrctl->wowlan_fw_iv = iv_high << 16 | iv_low; ++ DBG_871X_LEVEL(_drv_always_, "fw_iv: 0x%016llx\n", pwrctl->wowlan_fw_iv); ++ /* Update TX iv data. */ ++ rtw_set_sec_pn(padapter); ++ ++ /* 3.2 read GTK index and key */ ++ if ( ++ psecuritypriv->binstallKCK_KEK == true && ++ psecuritypriv->dot11PrivacyAlgrthm == _AES_ ++ ) { ++ u8 gtk_keyindex = 0; ++ u8 get_key[16]; ++ /* read gtk key index */ ++ gtk_keyindex = rtw_read8(padapter, 0x48c); ++ ++ if (gtk_keyindex < 4) { ++ psecuritypriv->dot118021XGrpKeyid = gtk_keyindex; ++ read_cam(padapter, gtk_keyindex, get_key); ++ memcpy(psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey, get_key, 16); ++ DBG_871X_LEVEL( ++ _drv_always_, ++ "GTK (%d) = 0x%08x, 0x%08x, 0x%08x, 0x%08x\n", ++ gtk_keyindex, ++ psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[0], ++ psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[1], ++ psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[2], ++ psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].lkey[3] ++ ); ++ } else ++ DBG_871X_LEVEL(_drv_always_, "GTK index =%d\n", gtk_keyindex); ++ } ++ ++ /* 4. Re-download Normal FW. */ ++ DBG_871X_LEVEL(_drv_always_, "Re-download Normal FW!\n"); ++ SetFwRelatedForWoWLAN8723b(padapter, false); ++ } ++#ifdef CONFIG_GPIO_WAKEUP ++ DBG_871X_LEVEL(_drv_always_, "Set Wake GPIO to high for default.\n"); ++ HalSetOutPutGPIO(padapter, WAKEUP_GPIO_IDX, 1); ++#endif ++ ++ /* 5. Download reserved pages and report media status if needed. */ ++ if ( ++ (pwrctl->wowlan_wake_reason != FWDecisionDisconnect) && ++ (pwrctl->wowlan_wake_reason != Rx_Pairwisekey) && ++ (pwrctl->wowlan_wake_reason != Rx_DisAssoc) && ++ (pwrctl->wowlan_wake_reason != Rx_DeAuth) ++ ) { ++ rtl8723b_set_FwJoinBssRpt_cmd(padapter, RT_MEDIA_CONNECT); ++ if (psta != NULL) ++ rtl8723b_set_FwMediaStatusRpt_cmd(padapter, RT_MEDIA_CONNECT, psta->mac_id); ++ } ++#ifdef CONFIG_PNO_SUPPORT ++ rtw_write8(padapter, 0x1b8, 0); ++ DBG_871X("reset 0x1b8: %d\n", rtw_read8(padapter, 0x1b8)); ++ rtw_write8(padapter, 0x1b9, 0); ++ DBG_871X("reset 0x1b9: %d\n", rtw_read8(padapter, 0x1b9)); ++ rtw_write8(padapter, REG_PNO_STATUS, 0); ++ DBG_871X("reset REG_PNO_STATUS: %d\n", rtw_read8(padapter, REG_PNO_STATUS)); ++#endif ++ break; ++ ++ default: ++ break; ++ } ++ } ++ break; +#endif /* CONFIG_WOWLAN */ +#ifdef CONFIG_AP_WOWLAN + case HW_VAR_AP_WOWLAN: @@ -75965,26 +73921,26 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + SetFwRelatedForWoWLAN8723b(padapter, false); + +#ifdef CONFIG_GPIO_WAKEUP -+ DBG_871X_LEVEL(_drv_always_, "Set Wake GPIO to high for default.\n"); -+ HalSetOutPutGPIO(padapter, WAKEUP_GPIO_IDX, 1); ++ DBG_871X_LEVEL(_drv_always_, "Set Wake GPIO to high for default.\n"); ++ HalSetOutPutGPIO(padapter, WAKEUP_GPIO_IDX, 1); +#endif /* CONFIG_GPIO_WAKEUP */ -+ rtl8723b_set_FwJoinBssRpt_cmd(padapter, RT_MEDIA_CONNECT); -+ issue_beacon(padapter, 0); -+ break; -+ default: -+ break; -+ } -+ } ++ rtl8723b_set_FwJoinBssRpt_cmd(padapter, RT_MEDIA_CONNECT); ++ issue_beacon(padapter, 0); + break; -+#endif /* CONFIG_AP_WOWLAN */ -+ case HW_VAR_DM_IN_LPS: -+ rtl8723b_hal_dm_in_lps(padapter); -+ break; + default: -+ SetHwReg8723B(padapter, variable, val); + break; + } +} ++ break; ++#endif /* CONFIG_AP_WOWLAN */ ++ case HW_VAR_DM_IN_LPS: ++ rtl8723b_hal_dm_in_lps(padapter); ++ break; ++ default: ++ SetHwReg8723B(padapter, variable, val); ++ break; ++ } ++} + +/* + * If variable not handled here, @@ -76000,7 +73956,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + case HW_VAR_FW_PS_STATE: + { + /* 3. read dword 0x88 driver read fw ps state */ -+ *((u16*)val) = rtw_read16(padapter, 0x88); ++ *((u16 *)val) = rtw_read16(padapter, 0x88); + } + break; + default: @@ -76025,29 +73981,25 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 +/* Description: */ +/* Query setting of specified variable. */ +/* */ -+static u8 -+GetHalDefVar8723BSDIO( -+struct adapter * Adapter, -+enum HAL_DEF_VARIABLE eVariable, -+void * pValue -+ ) ++static u8 GetHalDefVar8723BSDIO( ++ struct adapter *Adapter, enum HAL_DEF_VARIABLE eVariable, void *pValue ++) +{ + u8 bResult = _SUCCESS; + -+ switch (eVariable) -+ { -+ case HAL_DEF_IS_SUPPORT_ANT_DIV: -+ break; -+ case HAL_DEF_CURRENT_ANTENNA: -+ break; -+ case HW_VAR_MAX_RX_AMPDU_FACTOR: -+ /* Stanley@BB.SD3 suggests 16K can get stable performance */ -+ /* coding by Lucas@20130730 */ -+ *(u32*)pValue = MAX_AMPDU_FACTOR_16K; -+ break; -+ default: -+ bResult = GetHalDefVar8723B(Adapter, eVariable, pValue); -+ break; ++ switch (eVariable) { ++ case HAL_DEF_IS_SUPPORT_ANT_DIV: ++ break; ++ case HAL_DEF_CURRENT_ANTENNA: ++ break; ++ case HW_VAR_MAX_RX_AMPDU_FACTOR: ++ /* Stanley@BB.SD3 suggests 16K can get stable performance */ ++ /* coding by Lucas@20130730 */ ++ *(u32 *)pValue = MAX_AMPDU_FACTOR_16K; ++ break; ++ default: ++ bResult = GetHalDefVar8723B(Adapter, eVariable, pValue); ++ break; + } + + return bResult; @@ -76108,10 +74060,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_halinit.c linux-4.3-rtl8723bs/3 + pHalFunc->hal_checke_bt_hang = &rtl8723bs_hal_check_bt_hang; +#endif +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/sdio_ops.c ---- linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/hal/sdio_ops.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,1262 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/hal/sdio_ops.c linux/3rdparty/rtl8723bs/hal/sdio_ops.c +--- linux.old/3rdparty/rtl8723bs/hal/sdio_ops.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/hal/sdio_ops.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,1296 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. @@ -76142,40 +74094,39 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa +/* Creadted by Roger, 2011.01.31. */ +/* */ +static void HalSdioGetCmdAddr8723BSdio( -+struct adapter * padapter, -+u8 DeviceID, -+u32 Addr, -+ u32* pCmdAddr -+ ) ++ struct adapter *padapter, ++ u8 DeviceID, ++ u32 Addr, ++ u32 *pCmdAddr ++) +{ -+ switch (DeviceID) -+ { -+ case SDIO_LOCAL_DEVICE_ID: -+ *pCmdAddr = ((SDIO_LOCAL_DEVICE_ID << 13) | (Addr & SDIO_LOCAL_MSK)); -+ break; ++ switch (DeviceID) { ++ case SDIO_LOCAL_DEVICE_ID: ++ *pCmdAddr = ((SDIO_LOCAL_DEVICE_ID << 13) | (Addr & SDIO_LOCAL_MSK)); ++ break; + -+ case WLAN_IOREG_DEVICE_ID: -+ *pCmdAddr = ((WLAN_IOREG_DEVICE_ID << 13) | (Addr & WLAN_IOREG_MSK)); -+ break; ++ case WLAN_IOREG_DEVICE_ID: ++ *pCmdAddr = ((WLAN_IOREG_DEVICE_ID << 13) | (Addr & WLAN_IOREG_MSK)); ++ break; + -+ case WLAN_TX_HIQ_DEVICE_ID: -+ *pCmdAddr = ((WLAN_TX_HIQ_DEVICE_ID << 13) | (Addr & WLAN_FIFO_MSK)); -+ break; ++ case WLAN_TX_HIQ_DEVICE_ID: ++ *pCmdAddr = ((WLAN_TX_HIQ_DEVICE_ID << 13) | (Addr & WLAN_FIFO_MSK)); ++ break; + -+ case WLAN_TX_MIQ_DEVICE_ID: -+ *pCmdAddr = ((WLAN_TX_MIQ_DEVICE_ID << 13) | (Addr & WLAN_FIFO_MSK)); -+ break; ++ case WLAN_TX_MIQ_DEVICE_ID: ++ *pCmdAddr = ((WLAN_TX_MIQ_DEVICE_ID << 13) | (Addr & WLAN_FIFO_MSK)); ++ break; + -+ case WLAN_TX_LOQ_DEVICE_ID: -+ *pCmdAddr = ((WLAN_TX_LOQ_DEVICE_ID << 13) | (Addr & WLAN_FIFO_MSK)); -+ break; ++ case WLAN_TX_LOQ_DEVICE_ID: ++ *pCmdAddr = ((WLAN_TX_LOQ_DEVICE_ID << 13) | (Addr & WLAN_FIFO_MSK)); ++ break; + -+ case WLAN_RX0FF_DEVICE_ID: -+ *pCmdAddr = ((WLAN_RX0FF_DEVICE_ID << 13) | (Addr & WLAN_RX0FF_MSK)); -+ break; ++ case WLAN_RX0FF_DEVICE_ID: ++ *pCmdAddr = ((WLAN_RX0FF_DEVICE_ID << 13) | (Addr & WLAN_RX0FF_MSK)); ++ break; + -+ default: -+ break; ++ default: ++ break; + } +} + @@ -76186,40 +74137,39 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + + + pseudoId = (u16)(addr >> 16); -+ switch (pseudoId) -+ { -+ case 0x1025: -+ devideId = SDIO_LOCAL_DEVICE_ID; -+ break; ++ switch (pseudoId) { ++ case 0x1025: ++ devideId = SDIO_LOCAL_DEVICE_ID; ++ break; + -+ case 0x1026: -+ devideId = WLAN_IOREG_DEVICE_ID; -+ break; ++ case 0x1026: ++ devideId = WLAN_IOREG_DEVICE_ID; ++ break; + +/* case 0x1027: */ +/* devideId = SDIO_FIRMWARE_FIFO; */ +/* break; */ + -+ case 0x1031: -+ devideId = WLAN_TX_HIQ_DEVICE_ID; -+ break; ++ case 0x1031: ++ devideId = WLAN_TX_HIQ_DEVICE_ID; ++ break; + -+ case 0x1032: -+ devideId = WLAN_TX_MIQ_DEVICE_ID; -+ break; ++ case 0x1032: ++ devideId = WLAN_TX_MIQ_DEVICE_ID; ++ break; + -+ case 0x1033: -+ devideId = WLAN_TX_LOQ_DEVICE_ID; -+ break; ++ case 0x1033: ++ devideId = WLAN_TX_LOQ_DEVICE_ID; ++ break; + -+ case 0x1034: -+ devideId = WLAN_RX0FF_DEVICE_ID; -+ break; ++ case 0x1034: ++ devideId = WLAN_RX0FF_DEVICE_ID; ++ break; + -+ default: ++ default: +/* devideId = (u8)((addr >> 13) & 0xF); */ -+ devideId = WLAN_IOREG_DEVICE_ID; -+ break; ++ devideId = WLAN_IOREG_DEVICE_ID; ++ break; + } + + return devideId; @@ -76239,32 +74189,33 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + deviceId = get_deviceid(addr); + offset = 0; + -+ switch (deviceId) -+ { -+ case SDIO_LOCAL_DEVICE_ID: -+ offset = addr & SDIO_LOCAL_MSK; -+ break; ++ switch (deviceId) { ++ case SDIO_LOCAL_DEVICE_ID: ++ offset = addr & SDIO_LOCAL_MSK; ++ break; + -+ case WLAN_TX_HIQ_DEVICE_ID: -+ case WLAN_TX_MIQ_DEVICE_ID: -+ case WLAN_TX_LOQ_DEVICE_ID: -+ offset = addr & WLAN_FIFO_MSK; -+ break; ++ case WLAN_TX_HIQ_DEVICE_ID: ++ case WLAN_TX_MIQ_DEVICE_ID: ++ case WLAN_TX_LOQ_DEVICE_ID: ++ offset = addr & WLAN_FIFO_MSK; ++ break; + -+ case WLAN_RX0FF_DEVICE_ID: -+ offset = addr & WLAN_RX0FF_MSK; -+ break; ++ case WLAN_RX0FF_DEVICE_ID: ++ offset = addr & WLAN_RX0FF_MSK; ++ break; + -+ case WLAN_IOREG_DEVICE_ID: -+ default: -+ deviceId = WLAN_IOREG_DEVICE_ID; -+ offset = addr & WLAN_IOREG_MSK; -+ break; ++ case WLAN_IOREG_DEVICE_ID: ++ default: ++ deviceId = WLAN_IOREG_DEVICE_ID; ++ offset = addr & WLAN_IOREG_MSK; ++ break; + } + ftaddr = (deviceId << 13) | offset; + -+ if (pdeviceId) *pdeviceId = deviceId; -+ if (poffset) *poffset = offset; ++ if (pdeviceId) ++ *pdeviceId = deviceId; ++ if (poffset) ++ *poffset = offset; + + return ftaddr; +} @@ -76307,10 +74258,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + ftaddr = _cvrt2ftaddr(addr, &deviceId, &offset); + + rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); -+ if (((deviceId == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) -+ || (false == bMacPwrCtrlOn) -+ || (true == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode)) -+ { ++ if ( ++ ((deviceId == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) || ++ (false == bMacPwrCtrlOn) || ++ (true == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode) ++ ) { + err = sd_cmd52_read(pintfhdl, ftaddr, 4, (u8 *)&le_tmp); +#ifdef SDIO_DEBUG_IO + if (!err) { @@ -76364,10 +74316,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + ftaddr = _cvrt2ftaddr(addr, &deviceId, &offset); + + rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); -+ if (((deviceId == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) -+ || (false == bMacPwrCtrlOn) -+ || (true == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode)) -+ { ++ if ( ++ ((deviceId == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) || ++ (false == bMacPwrCtrlOn) || ++ (true == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode) ++ ) { + err = sd_cmd52_read(pintfhdl, ftaddr, cnt, pbuf); + return err; + } @@ -76383,7 +74336,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + ftaddr &= ~(u16)0x3; + n = cnt + shift; + ptmpbuf = rtw_malloc(n); -+ if (NULL == ptmpbuf) return -1; ++ if (NULL == ptmpbuf) ++ return -1; ++ + err = sd_read(pintfhdl, ftaddr, n, ptmpbuf); + if (!err) + memcpy(pbuf, ptmpbuf+shift, cnt); @@ -76433,8 +74388,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + ftaddr = _cvrt2ftaddr(addr, &deviceId, &offset); + + rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); -+ if (((deviceId == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) || -+ (!bMacPwrCtrlOn) || (adapter_to_pwrctl(padapter)->bFwCurrentInPSMode)) { ++ if ( ++ ((deviceId == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) || ++ (!bMacPwrCtrlOn) || ++ (adapter_to_pwrctl(padapter)->bFwCurrentInPSMode) ++ ) { + le_tmp = cpu_to_le32(val); + err = sd_cmd52_write(pintfhdl, ftaddr, 4, (u8 *)&le_tmp); + return err; @@ -76442,8 +74400,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + + /* 4 bytes alignment */ + shift = ftaddr & 0x3; -+ if (shift == 0) -+ { ++ if (shift == 0) { + sd_write32(pintfhdl, ftaddr, val, &err); + } else { + le_tmp = cpu_to_le32(val); @@ -76468,10 +74425,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + ftaddr = _cvrt2ftaddr(addr, &deviceId, &offset); + + rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); -+ if (((deviceId == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) -+ || (false == bMacPwrCtrlOn) -+ || (true == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode)) -+ { ++ if ( ++ ((deviceId == WLAN_IOREG_DEVICE_ID) && (offset < 0x100)) || ++ (false == bMacPwrCtrlOn) || ++ (true == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode) ++ ) { + err = sd_cmd52_write(pintfhdl, ftaddr, cnt, pbuf); + return err; + } @@ -76486,7 +74444,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + ftaddr &= ~(u16)0x3; + n = cnt + shift; + ptmpbuf = rtw_malloc(n); -+ if (NULL == ptmpbuf) return -1; ++ if (NULL == ptmpbuf) ++ return -1; + err = sd_read(pintfhdl, ftaddr, 4, ptmpbuf); + if (err) { + kfree(ptmpbuf); @@ -76504,7 +74463,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + return sd_f0_read8(pintfhdl, addr, NULL); +} + -+static void sdio_read_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem) ++static void sdio_read_mem( ++ struct intf_hdl *pintfhdl, ++ u32 addr, ++ u32 cnt, ++ u8 *rmem ++) +{ + s32 err; + @@ -76512,7 +74476,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + /* TODO: Report error is err not zero */ +} + -+static void sdio_write_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem) ++static void sdio_write_mem( ++ struct intf_hdl *pintfhdl, ++ u32 addr, ++ u32 cnt, ++ u8 *wmem ++) +{ + sdio_writeN(pintfhdl, addr, cnt, wmem); +} @@ -76537,7 +74506,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + struct intf_hdl *pintfhdl, + u32 addr, + u32 cnt, -+ u8 *mem) ++ u8 *mem ++) +{ + struct adapter *padapter; + PSDIO_DATA psdio; @@ -76584,7 +74554,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + } +#endif + -+ if (err) return _FAIL; ++ if (err) ++ return _FAIL; + return _SUCCESS; +} + @@ -76608,7 +74579,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + struct intf_hdl *pintfhdl, + u32 addr, + u32 cnt, -+ u8 *mem) ++ u8 *mem ++) +{ + struct adapter *padapter; + PSDIO_DATA psdio; @@ -76632,10 +74604,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + + err = sd_write(pintfhdl, addr, cnt, xmitbuf->pdata); + -+ rtw_sctx_done_err(&xmitbuf->sctx, -+ err ? RTW_SCTX_DONE_WRITE_PORT_ERR : RTW_SCTX_DONE_SUCCESS); ++ rtw_sctx_done_err( ++ &xmitbuf->sctx, ++ err ? RTW_SCTX_DONE_WRITE_PORT_ERR : RTW_SCTX_DONE_SUCCESS ++ ); + -+ if (err) return _FAIL; ++ if (err) ++ return _FAIL; + return _SUCCESS; +} + @@ -76662,24 +74637,24 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + */ +static s32 _sdio_local_read( + struct adapter *padapter, -+ u32 addr, -+ u32 cnt, -+ u8 *pbuf) ++ u32 addr, ++ u32 cnt, ++ u8 *pbuf ++) +{ -+ struct intf_hdl * pintfhdl; ++ struct intf_hdl *pintfhdl; + u8 bMacPwrCtrlOn; + s32 err; + u8 *ptmpbuf; + u32 n; + + -+ pintfhdl =&padapter->iopriv.intf; ++ pintfhdl = &padapter->iopriv.intf; + + HalSdioGetCmdAddr8723BSdio(padapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); + + rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); -+ if (false == bMacPwrCtrlOn) -+ { ++ if (false == bMacPwrCtrlOn) { + err = _sd_cmd52_read(pintfhdl, addr, cnt, pbuf); + return err; + } @@ -76704,24 +74679,26 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + */ +s32 sdio_local_read( + struct adapter *padapter, -+ u32 addr, -+ u32 cnt, -+ u8 *pbuf) ++ u32 addr, ++ u32 cnt, ++ u8 *pbuf ++) +{ -+ struct intf_hdl * pintfhdl; ++ struct intf_hdl *pintfhdl; + u8 bMacPwrCtrlOn; + s32 err; + u8 *ptmpbuf; + u32 n; + -+ pintfhdl =&padapter->iopriv.intf; ++ pintfhdl = &padapter->iopriv.intf; + + HalSdioGetCmdAddr8723BSdio(padapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); + + rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); -+ if ((false == bMacPwrCtrlOn) -+ || (true == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode)) -+ { ++ if ( ++ (false == bMacPwrCtrlOn) || ++ (true == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode) ++ ) { + err = sd_cmd52_read(pintfhdl, addr, cnt, pbuf); + return err; + } @@ -76746,11 +74723,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + */ +s32 sdio_local_write( + struct adapter *padapter, -+ u32 addr, -+ u32 cnt, -+ u8 *pbuf) ++ u32 addr, ++ u32 cnt, ++ u8 *pbuf ++) +{ -+ struct intf_hdl * pintfhdl; ++ struct intf_hdl *pintfhdl; + u8 bMacPwrCtrlOn; + s32 err; + u8 *ptmpbuf; @@ -76761,14 +74739,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + if (cnt & 0x3) + DBG_8192C("%s, size must be the multiple of 4\n", __func__); + -+ pintfhdl =&padapter->iopriv.intf; ++ pintfhdl = &padapter->iopriv.intf; + + HalSdioGetCmdAddr8723BSdio(padapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); + + rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn); -+ if ((false == bMacPwrCtrlOn) -+ || (true == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode)) -+ { ++ if ( ++ (false == bMacPwrCtrlOn) || ++ (true == adapter_to_pwrctl(padapter)->bFwCurrentInPSMode) ++ ) { + err = sd_cmd52_write(pintfhdl, addr, cnt, pbuf); + return err; + } @@ -76789,7 +74768,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa +u8 SdioLocalCmd52Read1Byte(struct adapter *padapter, u32 addr) +{ + u8 val = 0; -+ struct intf_hdl * pintfhdl =&padapter->iopriv.intf; ++ struct intf_hdl *pintfhdl = &padapter->iopriv.intf; + + HalSdioGetCmdAddr8723BSdio(padapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); + sd_cmd52_read(pintfhdl, addr, 1, &val); @@ -76800,7 +74779,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa +static u16 SdioLocalCmd52Read2Byte(struct adapter *padapter, u32 addr) +{ + __le16 val = 0; -+ struct intf_hdl * pintfhdl =&padapter->iopriv.intf; ++ struct intf_hdl *pintfhdl = &padapter->iopriv.intf; + + HalSdioGetCmdAddr8723BSdio(padapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); + sd_cmd52_read(pintfhdl, addr, 2, (u8 *)&val); @@ -76813,7 +74792,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + + u8 bMacPwrCtrlOn; + u32 val = 0; -+ struct intf_hdl * pintfhdl =&padapter->iopriv.intf; ++ struct intf_hdl *pintfhdl = &padapter->iopriv.intf; + __le32 le_tmp; + + HalSdioGetCmdAddr8723BSdio(padapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); @@ -76829,7 +74808,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + +void SdioLocalCmd52Write1Byte(struct adapter *padapter, u32 addr, u8 v) +{ -+ struct intf_hdl * pintfhdl =&padapter->iopriv.intf; ++ struct intf_hdl *pintfhdl = &padapter->iopriv.intf; + + HalSdioGetCmdAddr8723BSdio(padapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); + sd_cmd52_write(pintfhdl, addr, 1, &v); @@ -76837,7 +74816,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + +static void SdioLocalCmd52Write4Byte(struct adapter *padapter, u32 addr, u32 v) +{ -+ struct intf_hdl * pintfhdl =&padapter->iopriv.intf; ++ struct intf_hdl *pintfhdl = &padapter->iopriv.intf; + __le32 le_tmp; + + HalSdioGetCmdAddr8723BSdio(padapter, SDIO_LOCAL_DEVICE_ID, addr, &addr); @@ -76858,15 +74837,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + + /* decide how many bytes need to be read */ + hisr_len = 0; -+ while (himr) -+ { ++ while (himr) { + hisr_len++; + himr >>= 8; + } + + hisr = 0; -+ while (hisr_len != 0) -+ { ++ while (hisr_len != 0) { + hisr_len--; + val8 = SdioLocalCmd52Read1Byte(padapter, SDIO_REG_HISR+hisr_len); + hisr |= (val8 << (8*hisr_len)); @@ -76959,8 +74936,8 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + clear = rtw_zmalloc(4); + + /* Clear corresponding HISR Content if needed */ -+ *(__le32*)clear = cpu_to_le32(pHalData->sdio_hisr & MASK_SDIO_HISR_CLEAR); -+ if (*(__le32*)clear) { ++ *(__le32 *)clear = cpu_to_le32(pHalData->sdio_hisr & MASK_SDIO_HISR_CLEAR); ++ if (*(__le32 *)clear) { + /* Perform write one clear operation */ + sdio_local_write(padapter, SDIO_REG_HISR, 4, clear); + } @@ -76990,15 +74967,29 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + himr = cpu_to_le32(pHalData->sdio_himr); + sdio_local_write(padapter, SDIO_REG_HIMR, 4, (u8 *)&himr); + -+ RT_TRACE(_module_hci_ops_c_, _drv_notice_, -+ ("%s: enable SDIO HIMR = 0x%08X\n", __func__, pHalData->sdio_himr)); ++ RT_TRACE( ++ _module_hci_ops_c_, ++ _drv_notice_, ++ ( ++ "%s: enable SDIO HIMR = 0x%08X\n", ++ __func__, ++ pHalData->sdio_himr ++ ) ++ ); + + /* Update current system IMR settings */ + tmp = rtw_read32(padapter, REG_HSIMR); + rtw_write32(padapter, REG_HSIMR, tmp | pHalData->SysIntrMask); + -+ RT_TRACE(_module_hci_ops_c_, _drv_notice_, -+ ("%s: enable HSIMR = 0x%08X\n", __func__, pHalData->SysIntrMask)); ++ RT_TRACE( ++ _module_hci_ops_c_, ++ _drv_notice_, ++ ( ++ "%s: enable HSIMR = 0x%08X\n", ++ __func__, ++ pHalData->SysIntrMask ++ ) ++ ); + + /* */ + /* There are some C2H CMDs have been sent before system interrupt is enabled, e.g., C2H, CPWM. */ @@ -77036,8 +75027,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa +/* */ +u8 CheckIPSStatus(struct adapter *padapter) +{ -+ DBG_871X("%s(): Read 0x100 = 0x%02x 0x86 = 0x%02x\n", __func__, -+ rtw_read8(padapter, 0x100), rtw_read8(padapter, 0x86)); ++ DBG_871X( ++ "%s(): Read 0x100 = 0x%02x 0x86 = 0x%02x\n", ++ __func__, ++ rtw_read8(padapter, 0x100), ++ rtw_read8(padapter, 0x86) ++ ); + + if (rtw_read8(padapter, 0x100) == 0xEA) + return true; @@ -77045,7 +75040,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + return false; +} + -+static struct recv_buf* sd_recv_rxfifo(struct adapter *padapter, u32 size) ++static struct recv_buf *sd_recv_rxfifo(struct adapter *padapter, u32 size) +{ + u32 readsize, ret; + u8 *preadbuf; @@ -77072,8 +75067,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + + precvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ); + -+ if (precvbuf->pskb) -+ { ++ if (precvbuf->pskb) { + precvbuf->pskb->dev = padapter->pnetdev; + + tmpaddr = (SIZE_PTR)precvbuf->pskb->data; @@ -77126,7 +75120,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa +{ + struct hal_com_data *phal; + struct dvobj_priv *dvobj; -+ struct intf_hdl * pintfhdl =&padapter->iopriv.intf; ++ struct intf_hdl *pintfhdl = &padapter->iopriv.intf; + struct pwrctrl_priv *pwrctl; + + @@ -77134,15 +75128,14 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + dvobj = adapter_to_dvobj(padapter); + pwrctl = dvobj_to_pwrctl(dvobj); + -+ if (phal->sdio_hisr & SDIO_HISR_AVAL) -+ { ++ if (phal->sdio_hisr & SDIO_HISR_AVAL) { + u8 freepage[4]; + + _sdio_local_read(padapter, SDIO_REG_FREE_TXPG, 4, freepage); + up(&(padapter->xmitpriv.xmit_sema)); + } -+ if (phal->sdio_hisr & SDIO_HISR_CPWM1) -+ { ++ ++ if (phal->sdio_hisr & SDIO_HISR_CPWM1) { + struct reportpwrstate_parm report; + + u8 bcancelled; @@ -77154,41 +75147,37 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + _set_workitem(&(pwrctl->cpwm_event)); + } + -+ if (phal->sdio_hisr & SDIO_HISR_TXERR) -+ { ++ if (phal->sdio_hisr & SDIO_HISR_TXERR) { + u8 *status; + u32 addr; + + status = rtw_malloc(4); -+ if (status) -+ { ++ if (status) { + addr = REG_TXDMA_STATUS; + HalSdioGetCmdAddr8723BSdio(padapter, WLAN_IOREG_DEVICE_ID, addr, &addr); + _sd_read(pintfhdl, addr, 4, status); + _sd_write(pintfhdl, addr, 4, status); -+ DBG_8192C("%s: SDIO_HISR_TXERR (0x%08x)\n", __func__, le32_to_cpu(*(u32*)status)); ++ DBG_8192C("%s: SDIO_HISR_TXERR (0x%08x)\n", __func__, le32_to_cpu(*(u32 *)status)); + kfree(status); + } else { + DBG_8192C("%s: SDIO_HISR_TXERR, but can't allocate memory to read status!\n", __func__); + } + } + -+ if (phal->sdio_hisr & SDIO_HISR_TXBCNOK) -+ { ++ if (phal->sdio_hisr & SDIO_HISR_TXBCNOK) { + DBG_8192C("%s: SDIO_HISR_TXBCNOK\n", __func__); + } + -+ if (phal->sdio_hisr & SDIO_HISR_TXBCNERR) -+ { ++ if (phal->sdio_hisr & SDIO_HISR_TXBCNERR) { + DBG_8192C("%s: SDIO_HISR_TXBCNERR\n", __func__); + } +#ifndef CONFIG_C2H_PACKET_EN -+ if (phal->sdio_hisr & SDIO_HISR_C2HCMD) -+ { ++ if (phal->sdio_hisr & SDIO_HISR_C2HCMD) { + struct c2h_evt_hdr_88xx *c2h_evt; + + DBG_8192C("%s: C2H Command\n", __func__); -+ if ((c2h_evt = (struct c2h_evt_hdr_88xx*)rtw_zmalloc(16)) != NULL) { ++ c2h_evt = (struct c2h_evt_hdr_88xx *)rtw_zmalloc(16); ++ if (c2h_evt != NULL) { + if (rtw_hal_c2h_evt_read(padapter, (u8 *)c2h_evt) == _SUCCESS) { + if (c2h_id_filter_ccx_8723b((u8 *)c2h_evt)) { + /* Handle CCX report here */ @@ -77200,24 +75189,22 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + } + } else { + /* Error handling for malloc fail */ -+ if (rtw_cbuf_push(padapter->evtpriv.c2h_queue, (void*)NULL) != _SUCCESS) ++ if (rtw_cbuf_push(padapter->evtpriv.c2h_queue, (void *)NULL) != _SUCCESS) + DBG_871X("%s rtw_cbuf_push fail\n", __func__); + _set_workitem(&padapter->evtpriv.c2h_wk); + } + } +#endif + -+ if (phal->sdio_hisr & SDIO_HISR_RXFOVW) -+ { ++ if (phal->sdio_hisr & SDIO_HISR_RXFOVW) { + DBG_8192C("%s: Rx Overflow\n", __func__); + } -+ if (phal->sdio_hisr & SDIO_HISR_RXERR) -+ { ++ ++ if (phal->sdio_hisr & SDIO_HISR_RXERR) { + DBG_8192C("%s: Rx Error\n", __func__); + } + -+ if (phal->sdio_hisr & SDIO_HISR_RX_REQUEST) -+ { ++ if (phal->sdio_hisr & SDIO_HISR_RX_REQUEST) { + struct recv_buf *precvbuf; + int alloc_fail_time = 0; + u32 hisr; @@ -77226,21 +75213,18 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + phal->sdio_hisr ^= SDIO_HISR_RX_REQUEST; + do { + phal->SdioRxFIFOSize = SdioLocalCmd52Read2Byte(padapter, SDIO_REG_RX0_REQ_LEN); -+ if (phal->SdioRxFIFOSize != 0) -+ { ++ if (phal->SdioRxFIFOSize != 0) { + precvbuf = sd_recv_rxfifo(padapter, phal->SdioRxFIFOSize); + if (precvbuf) + sd_rxhandler(padapter, precvbuf); -+ else -+ { ++ else { + alloc_fail_time++; + DBG_871X("precvbuf is Null for %d times because alloc memory failed\n", alloc_fail_time); + if (alloc_fail_time >= 10) + break; + } + phal->SdioRxFIFOSize = 0; -+ } -+ else ++ } else + break; + + hisr = 0; @@ -77261,8 +75245,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + struct hal_com_data *phal; + + -+ if ((padapter->bDriverStopped == true) || -+ (padapter->bSurpriseRemoved == true)) ++ if ( ++ (padapter->bDriverStopped == true) || ++ (padapter->bSurpriseRemoved == true) ++ ) + return; + + phal = GET_HAL_DATA(padapter); @@ -77270,8 +75256,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + phal->sdio_hisr = 0; + ReadInterrupt8723BSdio(padapter, &phal->sdio_hisr); + -+ if (phal->sdio_hisr & phal->sdio_himr) -+ { ++ if (phal->sdio_hisr & phal->sdio_himr) { + u32 v32; + + phal->sdio_hisr &= phal->sdio_himr; @@ -77332,6 +75317,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa +u8 HalQueryTxOQTBufferStatus8723BSdio(struct adapter *padapter) +{ + struct hal_com_data *pHalData = GET_HAL_DATA(padapter); ++ + pHalData->SdioTxOQTFreeSpace = SdioLocalCmd52Read1Byte(padapter, SDIO_REG_OQT_FREE_PG); + return true; +} @@ -77374,10 +75360,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/hal/sdio_ops.c linux-4.3-rtl8723bs/3rdpa + return res; +} +#endif /* CONFIG_WOWLAN */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/autoconf.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/autoconf.h ---- linux-4.3/3rdparty/rtl8723bs/include/autoconf.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/autoconf.h 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,67 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/include/autoconf.h linux/3rdparty/rtl8723bs/include/autoconf.h +--- linux.old/3rdparty/rtl8723bs/include/autoconf.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/autoconf.h 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,71 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. @@ -77403,6 +75389,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/autoconf.h linux-4.3-rtl8723bs/3 + */ +/* define CONFIG_DEBUG_CFG80211 */ + ++#ifndef CONFIG_WIRELESS_EXT ++#error CONFIG_WIRELESS_EXT needs to be enabled for this driver to work ++#endif ++ +/* + * Auto Config Section + */ @@ -77445,9 +75435,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/autoconf.h linux-4.3-rtl8723bs/3 + +/* define DBG_XMIT_BUF */ +/* define DBG_XMIT_BUF_EXT */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/basic_types.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/basic_types.h ---- linux-4.3/3rdparty/rtl8723bs/include/basic_types.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/basic_types.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/basic_types.h linux/3rdparty/rtl8723bs/include/basic_types.h +--- linux.old/3rdparty/rtl8723bs/include/basic_types.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/basic_types.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,209 @@ +/****************************************************************************** + * @@ -77658,9 +75648,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/basic_types.h linux-4.3-rtl8723b +#define TEST_FLAGS(__Flag, __testFlags) (((__Flag) & (__testFlags)) == (__testFlags)) + +#endif /* __BASIC_TYPES_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/cmd_osdep.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/cmd_osdep.h ---- linux-4.3/3rdparty/rtl8723bs/include/cmd_osdep.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/cmd_osdep.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/cmd_osdep.h linux/3rdparty/rtl8723bs/include/cmd_osdep.h +--- linux.old/3rdparty/rtl8723bs/include/cmd_osdep.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/cmd_osdep.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,26 @@ +/****************************************************************************** + * @@ -77688,9 +75678,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/cmd_osdep.h linux-4.3-rtl8723bs/ +extern struct cmd_obj *_rtw_dequeue_cmd(struct __queue *queue); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/drv_conf.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/drv_conf.h ---- linux-4.3/3rdparty/rtl8723bs/include/drv_conf.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/drv_conf.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/drv_conf.h linux/3rdparty/rtl8723bs/include/drv_conf.h +--- linux.old/3rdparty/rtl8723bs/include/drv_conf.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/drv_conf.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,37 @@ +/****************************************************************************** + * @@ -77729,9 +75719,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/drv_conf.h linux-4.3-rtl8723bs/3 +//#include + +#endif // __DRV_CONF_H__ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/drv_types.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/drv_types.h ---- linux-4.3/3rdparty/rtl8723bs/include/drv_types.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/drv_types.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/drv_types.h linux/3rdparty/rtl8723bs/include/drv_types.h +--- linux.old/3rdparty/rtl8723bs/include/drv_types.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/drv_types.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,720 @@ +/****************************************************************************** + * @@ -78453,9 +76443,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/drv_types.h linux-4.3-rtl8723bs/ +extern u8 g_fwdl_chksum_fail; + +#endif /* __DRV_TYPES_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/drv_types_sdio.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/drv_types_sdio.h ---- linux-4.3/3rdparty/rtl8723bs/include/drv_types_sdio.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/drv_types_sdio.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/drv_types_sdio.h linux/3rdparty/rtl8723bs/include/drv_types_sdio.h +--- linux.old/3rdparty/rtl8723bs/include/drv_types_sdio.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/drv_types_sdio.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,39 @@ +/****************************************************************************** + * @@ -78496,9 +76486,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/drv_types_sdio.h linux-4.3-rtl87 +} SDIO_DATA, *PSDIO_DATA; + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/ethernet.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/ethernet.h ---- linux-4.3/3rdparty/rtl8723bs/include/ethernet.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/ethernet.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/ethernet.h linux/3rdparty/rtl8723bs/include/ethernet.h +--- linux.old/3rdparty/rtl8723bs/include/ethernet.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/ethernet.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,22 @@ +/****************************************************************************** + * @@ -78522,9 +76512,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/ethernet.h linux-4.3-rtl8723bs/3 +#define LLC_HEADER_SIZE 6 /* LLC Header Length */ + +#endif /* #ifndef __INC_ETHERNET_H */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/Hal8192CPhyReg.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/Hal8192CPhyReg.h ---- linux-4.3/3rdparty/rtl8723bs/include/Hal8192CPhyReg.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/Hal8192CPhyReg.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/Hal8192CPhyReg.h linux/3rdparty/rtl8723bs/include/Hal8192CPhyReg.h +--- linux.old/3rdparty/rtl8723bs/include/Hal8192CPhyReg.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/Hal8192CPhyReg.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,1126 @@ +/****************************************************************************** + * @@ -79652,9 +77642,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/Hal8192CPhyReg.h linux-4.3-rtl87 + + +#endif /* __INC_HAL8192SPHYREG_H */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/Hal8723BPhyCfg.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/Hal8723BPhyCfg.h ---- linux-4.3/3rdparty/rtl8723bs/include/Hal8723BPhyCfg.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/Hal8723BPhyCfg.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/Hal8723BPhyCfg.h linux/3rdparty/rtl8723bs/include/Hal8723BPhyCfg.h +--- linux.old/3rdparty/rtl8723bs/include/Hal8723BPhyCfg.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/Hal8723BPhyCfg.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,128 @@ +/****************************************************************************** + * @@ -79784,9 +77774,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/Hal8723BPhyCfg.h linux-4.3-rtl87 +/*--------------------------Exported Function prototype End---------------------*/ + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/Hal8723BPhyReg.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/Hal8723BPhyReg.h ---- linux-4.3/3rdparty/rtl8723bs/include/Hal8723BPhyReg.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/Hal8723BPhyReg.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/Hal8723BPhyReg.h linux/3rdparty/rtl8723bs/include/Hal8723BPhyReg.h +--- linux.old/3rdparty/rtl8723bs/include/Hal8723BPhyReg.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/Hal8723BPhyReg.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,77 @@ +/****************************************************************************** + * @@ -79865,9 +77855,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/Hal8723BPhyReg.h linux-4.3-rtl87 +#define rPm_Rx3_AntB 0xbf8 + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/Hal8723BPwrSeq.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/Hal8723BPwrSeq.h ---- linux-4.3/3rdparty/rtl8723bs/include/Hal8723BPwrSeq.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/Hal8723BPwrSeq.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/Hal8723BPwrSeq.h linux/3rdparty/rtl8723bs/include/Hal8723BPwrSeq.h +--- linux.old/3rdparty/rtl8723bs/include/Hal8723BPwrSeq.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/Hal8723BPwrSeq.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,232 @@ +#ifndef REALTEK_POWER_SEQUENCE_8723B +#define REALTEK_POWER_SEQUENCE_8723B @@ -80101,9 +78091,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/Hal8723BPwrSeq.h linux-4.3-rtl87 +extern WLAN_PWR_CFG rtl8723B_enter_swlps_flow[RTL8723B_TRANS_ACT_TO_SWLPS_STEPS+RTL8723B_TRANS_END_STEPS]; +extern WLAN_PWR_CFG rtl8723B_leave_swlps_flow[RTL8723B_TRANS_SWLPS_TO_ACT_STEPS+RTL8723B_TRANS_END_STEPS]; +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_btcoex.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_btcoex.h ---- linux-4.3/3rdparty/rtl8723bs/include/hal_btcoex.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_btcoex.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/hal_btcoex.h linux/3rdparty/rtl8723bs/include/hal_btcoex.h +--- linux.old/3rdparty/rtl8723bs/include/hal_btcoex.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/hal_btcoex.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,68 @@ +/****************************************************************************** + * @@ -80173,9 +78163,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_btcoex.h linux-4.3-rtl8723bs +u32 hal_btcoex_GetDBG(struct adapter *, u8 *pStrBuf, u32 bufSize); + +#endif /* !__HAL_BTCOEX_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_com.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_com.h ---- linux-4.3/3rdparty/rtl8723bs/include/hal_com.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_com.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/hal_com.h linux/3rdparty/rtl8723bs/include/hal_com.h +--- linux.old/3rdparty/rtl8723bs/include/hal_com.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/hal_com.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,309 @@ +/****************************************************************************** + * @@ -80486,9 +78476,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_com.h linux-4.3-rtl8723bs/3r +#endif + +#endif /* __HAL_COMMON_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_com_h2c.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_com_h2c.h ---- linux-4.3/3rdparty/rtl8723bs/include/hal_com_h2c.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_com_h2c.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/hal_com_h2c.h linux/3rdparty/rtl8723bs/include/hal_com_h2c.h +--- linux.old/3rdparty/rtl8723bs/include/hal_com_h2c.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/hal_com_h2c.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,293 @@ +/****************************************************************************** + * @@ -80783,9 +78773,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_com_h2c.h linux-4.3-rtl8723b +void rtw_get_sec_iv(struct adapter *padapter, u8*pcur_dot11txpn, u8 *StaAddr); +void rtw_set_sec_pn(struct adapter *padapter); +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_com_phycfg.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_com_phycfg.h ---- linux-4.3/3rdparty/rtl8723bs/include/hal_com_phycfg.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_com_phycfg.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/hal_com_phycfg.h linux/3rdparty/rtl8723bs/include/hal_com_phycfg.h +--- linux.old/3rdparty/rtl8723bs/include/hal_com_phycfg.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/hal_com_phycfg.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,275 @@ +/****************************************************************************** + * @@ -81062,9 +79052,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_com_phycfg.h linux-4.3-rtl87 +#endif /* CONFIG_LOAD_PHY_PARA_FROM_FILE */ + +#endif /* __HAL_COMMON_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_com_reg.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_com_reg.h ---- linux-4.3/3rdparty/rtl8723bs/include/hal_com_reg.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_com_reg.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/hal_com_reg.h linux/3rdparty/rtl8723bs/include/hal_com_reg.h +--- linux.old/3rdparty/rtl8723bs/include/hal_com_reg.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/hal_com_reg.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,1725 @@ +/****************************************************************************** + * @@ -82791,9 +80781,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_com_reg.h linux-4.3-rtl8723b +#define HAL_8188E_HW_GPIO_WPS_BIT BIT7 + +#endif /* __HAL_COMMON_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_data.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_data.h ---- linux-4.3/3rdparty/rtl8723bs/include/hal_data.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_data.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/hal_data.h linux/3rdparty/rtl8723bs/include/hal_data.h +--- linux.old/3rdparty/rtl8723bs/include/hal_data.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/hal_data.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,485 @@ +/****************************************************************************** + * @@ -83280,9 +81270,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_data.h linux-4.3-rtl8723bs/3 +#define GET_RF_TYPE(__padapter) (GET_HAL_DATA(__padapter)->rf_type) + +#endif /* __HAL_DATA_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_intf.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_intf.h ---- linux-4.3/3rdparty/rtl8723bs/include/hal_intf.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_intf.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/hal_intf.h linux/3rdparty/rtl8723bs/include/hal_intf.h +--- linux.old/3rdparty/rtl8723bs/include/hal_intf.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/hal_intf.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,410 @@ +/****************************************************************************** + * @@ -83694,9 +81684,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_intf.h linux-4.3-rtl8723bs/3 +s32 rtw_hal_fill_h2c_cmd(struct adapter *, u8 ElementID, u32 CmdLen, u8 *pCmdBuffer); + +#endif /* __HAL_INTF_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_pg.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_pg.h ---- linux-4.3/3rdparty/rtl8723bs/include/hal_pg.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_pg.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/hal_pg.h linux/3rdparty/rtl8723bs/include/hal_pg.h +--- linux.old/3rdparty/rtl8723bs/include/hal_pg.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/hal_pg.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,81 @@ +/****************************************************************************** + * @@ -83779,9 +81769,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_pg.h linux-4.3-rtl8723bs/3rd +}; + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_phy.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_phy.h ---- linux-4.3/3rdparty/rtl8723bs/include/hal_phy.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_phy.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/hal_phy.h linux/3rdparty/rtl8723bs/include/hal_phy.h +--- linux.old/3rdparty/rtl8723bs/include/hal_phy.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/hal_phy.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,183 @@ +/****************************************************************************** + * @@ -83966,9 +81956,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_phy.h linux-4.3-rtl8723bs/3r +/*--------------------------Exported Function prototype---------------------*/ + +#endif /* __HAL_COMMON_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_phy_reg.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_phy_reg.h ---- linux-4.3/3rdparty/rtl8723bs/include/hal_phy_reg.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_phy_reg.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/hal_phy_reg.h linux/3rdparty/rtl8723bs/include/hal_phy_reg.h +--- linux.old/3rdparty/rtl8723bs/include/hal_phy_reg.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/hal_phy_reg.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,25 @@ +/****************************************************************************** + * @@ -83995,9 +81985,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_phy_reg.h linux-4.3-rtl8723b +/* endif */ + +#endif /* __HAL_PHY_REG_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/HalPwrSeqCmd.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/HalPwrSeqCmd.h ---- linux-4.3/3rdparty/rtl8723bs/include/HalPwrSeqCmd.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/HalPwrSeqCmd.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/HalPwrSeqCmd.h linux/3rdparty/rtl8723bs/include/HalPwrSeqCmd.h +--- linux.old/3rdparty/rtl8723bs/include/HalPwrSeqCmd.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/HalPwrSeqCmd.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,132 @@ +/****************************************************************************** + * @@ -84131,9 +82121,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/HalPwrSeqCmd.h linux-4.3-rtl8723 + WLAN_PWR_CFG PwrCfgCmd[]); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_sdio.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_sdio.h ---- linux-4.3/3rdparty/rtl8723bs/include/hal_sdio.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/hal_sdio.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/hal_sdio.h linux/3rdparty/rtl8723bs/include/hal_sdio.h +--- linux.old/3rdparty/rtl8723bs/include/hal_sdio.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/hal_sdio.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,26 @@ +/****************************************************************************** + * @@ -84161,9 +82151,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/hal_sdio.h linux-4.3-rtl8723bs/3 +u32 rtw_hal_get_sdio_tx_max_length(struct adapter *padapter, u8 queue_idx); + +#endif /* __RTW_LED_H_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/HalVerDef.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/HalVerDef.h ---- linux-4.3/3rdparty/rtl8723bs/include/HalVerDef.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/HalVerDef.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/HalVerDef.h linux/3rdparty/rtl8723bs/include/HalVerDef.h +--- linux.old/3rdparty/rtl8723bs/include/HalVerDef.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/HalVerDef.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,127 @@ +/****************************************************************************** + * @@ -84292,9 +82282,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/HalVerDef.h linux-4.3-rtl8723bs/ +#define IS_2T2R(version) ((GET_CVID_RF_TYPE(version) == RF_TYPE_2T2R)? true : false) + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/ieee80211.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/ieee80211.h ---- linux-4.3/3rdparty/rtl8723bs/include/ieee80211.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/ieee80211.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/ieee80211.h linux/3rdparty/rtl8723bs/include/ieee80211.h +--- linux.old/3rdparty/rtl8723bs/include/ieee80211.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/ieee80211.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,1345 @@ +/****************************************************************************** + * @@ -85633,7 +83623,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/ieee80211.h linux-4.3-rtl8723bs/ + +void rtw_get_bcn_info(struct wlan_network *pnetwork); + -+void rtw_macaddr_cfg(u8 *mac_addr); ++void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr); + +u16 rtw_mcs_rate(u8 rf_type, u8 bw_40MHz, u8 short_GI, unsigned char * MCS_rate); + @@ -85641,9 +83631,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/ieee80211.h linux-4.3-rtl8723bs/ +const char *action_public_str(u8 action); + +#endif /* IEEE80211_H */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/ioctl_cfg80211.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/ioctl_cfg80211.h ---- linux-4.3/3rdparty/rtl8723bs/include/ioctl_cfg80211.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/ioctl_cfg80211.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/ioctl_cfg80211.h linux/3rdparty/rtl8723bs/include/ioctl_cfg80211.h +--- linux.old/3rdparty/rtl8723bs/include/ioctl_cfg80211.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/ioctl_cfg80211.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,132 @@ +/****************************************************************************** + * @@ -85777,9 +83767,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/ioctl_cfg80211.h linux-4.3-rtl87 +#define rtw_cfg80211_remain_on_channel_expired(adapter, cookie, chan, chan_type, gfp) cfg80211_remain_on_channel_expired((adapter)->rtw_wdev, cookie, chan, gfp) + +#endif /* __IOCTL_CFG80211_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/mlme_osdep.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/mlme_osdep.h ---- linux-4.3/3rdparty/rtl8723bs/include/mlme_osdep.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/mlme_osdep.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/mlme_osdep.h linux/3rdparty/rtl8723bs/include/mlme_osdep.h +--- linux.old/3rdparty/rtl8723bs/include/mlme_osdep.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/mlme_osdep.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,27 @@ +/****************************************************************************** + * @@ -85808,9 +83798,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/mlme_osdep.h linux-4.3-rtl8723bs +void rtw_reset_securitypriv(struct adapter *adapter); + +#endif /* _MLME_OSDEP_H_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/osdep_intf.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/osdep_intf.h ---- linux-4.3/3rdparty/rtl8723bs/include/osdep_intf.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/osdep_intf.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/osdep_intf.h linux/3rdparty/rtl8723bs/include/osdep_intf.h +--- linux.old/3rdparty/rtl8723bs/include/osdep_intf.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/osdep_intf.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,88 @@ +/****************************************************************************** + * @@ -85900,9 +83890,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/osdep_intf.h linux-4.3-rtl8723bs +int rtw_resume_common(struct adapter *padapter); + +#endif /* _OSDEP_INTF_H_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/osdep_service.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/osdep_service.h ---- linux-4.3/3rdparty/rtl8723bs/include/osdep_service.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/osdep_service.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/osdep_service.h linux/3rdparty/rtl8723bs/include/osdep_service.h +--- linux.old/3rdparty/rtl8723bs/include/osdep_service.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/osdep_service.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,281 @@ +/****************************************************************************** + * @@ -86185,9 +84175,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/osdep_service.h linux-4.3-rtl872 +#define rtw_sprintf(buf, size, format, arg...) snprintf(buf, size, format, ##arg) + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/osdep_service_linux.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/osdep_service_linux.h ---- linux-4.3/3rdparty/rtl8723bs/include/osdep_service_linux.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/osdep_service_linux.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/osdep_service_linux.h linux/3rdparty/rtl8723bs/include/osdep_service_linux.h +--- linux.old/3rdparty/rtl8723bs/include/osdep_service_linux.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/osdep_service_linux.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,178 @@ +/****************************************************************************** + * @@ -86367,9 +84357,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/osdep_service_linux.h linux-4.3- +extern struct net_device * rtw_alloc_etherdev(int sizeof_priv); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/recv_osdep.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/recv_osdep.h ---- linux-4.3/3rdparty/rtl8723bs/include/recv_osdep.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/recv_osdep.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/recv_osdep.h linux/3rdparty/rtl8723bs/include/recv_osdep.h +--- linux.old/3rdparty/rtl8723bs/include/recv_osdep.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/recv_osdep.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,48 @@ +/****************************************************************************** + * @@ -86419,9 +84409,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/recv_osdep.h linux-4.3-rtl8723bs + + +#endif /* */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtl8192c_recv.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtl8192c_recv.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtl8192c_recv.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtl8192c_recv.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtl8192c_recv.h linux/3rdparty/rtl8723bs/include/rtl8192c_recv.h +--- linux.old/3rdparty/rtl8723bs/include/rtl8192c_recv.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtl8192c_recv.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,50 @@ +/****************************************************************************** + * @@ -86473,9 +84463,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtl8192c_recv.h linux-4.3-rtl872 +void rtl8192c_query_rx_desc_status(union recv_frame *precvframe, struct recv_stat *pdesc); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtl8192c_rf.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtl8192c_rf.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtl8192c_rf.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtl8192c_rf.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtl8192c_rf.h linux/3rdparty/rtl8723bs/include/rtl8192c_rf.h +--- linux.old/3rdparty/rtl8723bs/include/rtl8192c_rf.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtl8192c_rf.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,39 @@ +/****************************************************************************** + * @@ -86516,9 +84506,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtl8192c_rf.h linux-4.3-rtl8723b + + +#endif/* End of HalRf.h */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_cmd.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtl8723b_cmd.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_cmd.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtl8723b_cmd.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtl8723b_cmd.h linux/3rdparty/rtl8723bs/include/rtl8723b_cmd.h +--- linux.old/3rdparty/rtl8723bs/include/rtl8723b_cmd.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtl8723b_cmd.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,199 @@ +/****************************************************************************** + * @@ -86719,9 +84709,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_cmd.h linux-4.3-rtl8723 + +#define FillH2CCmd FillH2CCmd8723B +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_dm.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtl8723b_dm.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_dm.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtl8723b_dm.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtl8723b_dm.h linux/3rdparty/rtl8723bs/include/rtl8723b_dm.h +--- linux.old/3rdparty/rtl8723bs/include/rtl8723b_dm.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtl8723b_dm.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,41 @@ +/****************************************************************************** + * @@ -86764,9 +84754,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_dm.h linux-4.3-rtl8723b + + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_hal.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtl8723b_hal.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_hal.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtl8723b_hal.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtl8723b_hal.h linux/3rdparty/rtl8723bs/include/rtl8723b_hal.h +--- linux.old/3rdparty/rtl8723bs/include/rtl8723b_hal.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtl8723b_hal.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,279 @@ +/****************************************************************************** + * @@ -87047,9 +85037,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_hal.h linux-4.3-rtl8723 +void Hal_ReadRFGainOffset(struct adapter *padapter, u8 *hwinfo, bool AutoLoadFail); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_recv.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtl8723b_recv.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_recv.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtl8723b_recv.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtl8723b_recv.h linux/3rdparty/rtl8723bs/include/rtl8723b_recv.h +--- linux.old/3rdparty/rtl8723bs/include/rtl8723b_recv.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtl8723b_recv.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,144 @@ +/****************************************************************************** + * @@ -87195,9 +85185,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_recv.h linux-4.3-rtl872 +void rtl8723b_process_phy_info(struct adapter *padapter, void *prframe); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_rf.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtl8723b_rf.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_rf.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtl8723b_rf.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtl8723b_rf.h linux/3rdparty/rtl8723bs/include/rtl8723b_rf.h +--- linux.old/3rdparty/rtl8723bs/include/rtl8723b_rf.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtl8723b_rf.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,26 @@ +/****************************************************************************** + * @@ -87225,9 +85215,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_rf.h linux-4.3-rtl8723b + enum CHANNEL_WIDTH Bandwidth); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_spec.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtl8723b_spec.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_spec.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtl8723b_spec.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtl8723b_spec.h linux/3rdparty/rtl8723bs/include/rtl8723b_spec.h +--- linux.old/3rdparty/rtl8723bs/include/rtl8723b_spec.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtl8723b_spec.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,262 @@ +/****************************************************************************** + * @@ -87491,9 +85481,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_spec.h linux-4.3-rtl872 +#define IMR_RXFOVW_8723B BIT8 /* Receive FIFO Overflow */ + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_xmit.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtl8723b_xmit.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_xmit.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtl8723b_xmit.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtl8723b_xmit.h linux/3rdparty/rtl8723bs/include/rtl8723b_xmit.h +--- linux.old/3rdparty/rtl8723bs/include/rtl8723b_xmit.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtl8723b_xmit.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,458 @@ +/****************************************************************************** + * @@ -87953,9 +85943,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtl8723b_xmit.h linux-4.3-rtl872 +u8 SCMapping_8723B(struct adapter * Adapter, struct pkt_attrib *pattrib); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_ap.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_ap.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_ap.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_ap.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_ap.h linux/3rdparty/rtl8723bs/include/rtw_ap.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_ap.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_ap.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,47 @@ +/****************************************************************************** + * @@ -88004,9 +85994,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_ap.h linux-4.3-rtl8723bs/3rd + +#endif +void update_bmc_sta(struct adapter *padapter); -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_beamforming.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_beamforming.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_beamforming.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_beamforming.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_beamforming.h linux/3rdparty/rtl8723bs/include/rtw_beamforming.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_beamforming.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_beamforming.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,135 @@ +/****************************************************************************** + * @@ -88143,9 +86133,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_beamforming.h linux-4.3-rtl8 +u8 beamforming_wk_cmd(struct adapter *padapter, s32 type, u8 *pbuf, s32 size, u8 enqueue); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_br_ext.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_br_ext.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_br_ext.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_br_ext.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_br_ext.h linux/3rdparty/rtl8723bs/include/rtw_br_ext.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_br_ext.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_br_ext.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,63 @@ +/****************************************************************************** + * @@ -88210,9 +86200,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_br_ext.h linux-4.3-rtl8723bs +void nat25_db_cleanup(struct adapter *priv); + +#endif /* _RTW_BR_EXT_H_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_btcoex.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_btcoex.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_btcoex.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_btcoex.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_btcoex.h linux/3rdparty/rtl8723bs/include/rtw_btcoex.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_btcoex.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_btcoex.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,64 @@ +/****************************************************************************** + * @@ -88278,9 +86268,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_btcoex.h linux-4.3-rtl8723bs +void rtw_btcoex_LPS_Leave(struct adapter *); + +#endif /* __RTW_BTCOEX_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_byteorder.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_byteorder.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_byteorder.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_byteorder.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_byteorder.h linux/3rdparty/rtl8723bs/include/rtw_byteorder.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_byteorder.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_byteorder.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,24 @@ +/****************************************************************************** + * @@ -88306,9 +86296,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_byteorder.h linux-4.3-rtl872 +#endif + +#endif /* _RTL871X_BYTEORDER_H_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_cmd.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_cmd.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_cmd.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_cmd.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_cmd.h linux/3rdparty/rtl8723bs/include/rtw_cmd.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_cmd.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_cmd.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,980 @@ +/****************************************************************************** + * @@ -89290,9 +87280,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_cmd.h linux-4.3-rtl8723bs/3r +#define _SetRFReg_CMD_ _Write_RFREG_CMD_ + +#endif /* _CMD_H_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_debug.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_debug.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_debug.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_debug.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_debug.h linux/3rdparty/rtl8723bs/include/rtw_debug.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_debug.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_debug.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,355 @@ +/****************************************************************************** + * @@ -89649,9 +87639,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_debug.h linux-4.3-rtl8723bs/ +#endif /* CONFIG_PROC_DEBUG */ + +#endif /* __RTW_DEBUG_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_eeprom.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_eeprom.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_eeprom.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_eeprom.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_eeprom.h linux/3rdparty/rtl8723bs/include/rtw_eeprom.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_eeprom.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_eeprom.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,128 @@ +/****************************************************************************** + * @@ -89781,9 +87771,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_eeprom.h linux-4.3-rtl8723bs +}; + +#endif /* __RTL871X_EEPROM_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_efuse.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_efuse.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_efuse.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_efuse.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_efuse.h linux/3rdparty/rtl8723bs/include/rtw_efuse.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_efuse.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_efuse.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,132 @@ +/****************************************************************************** + * @@ -89917,9 +87907,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_efuse.h linux-4.3-rtl8723bs/ +u32 Rtw_Hal_readPGDataFromConfigFile(struct adapter *padapter); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_event.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_event.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_event.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_event.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_event.h linux/3rdparty/rtl8723bs/include/rtw_event.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_event.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_event.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,117 @@ +/****************************************************************************** + * @@ -90038,9 +88028,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_event.h linux-4.3-rtl8723bs/ + + +#endif /* _WLANEVENT_H_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_ht.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_ht.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_ht.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_ht.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_ht.h linux/3rdparty/rtl8723bs/include/rtw_ht.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_ht.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_ht.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,118 @@ +/****************************************************************************** + * @@ -90160,9 +88150,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_ht.h linux-4.3-rtl8723bs/3rd +#define GET_HT_CAP_TXBF_EXPLICIT_COMP_FEEDBACK_CAP(_pEleStart) LE_BITS_TO_4BYTE((_pEleStart)+21, 15, 2) + +#endif /* _RTL871X_HT_H_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_ioctl.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_ioctl.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_ioctl.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_ioctl.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_ioctl.h linux/3rdparty/rtl8723bs/include/rtw_ioctl.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_ioctl.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_ioctl.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,80 @@ +/****************************************************************************** + * @@ -90244,9 +88234,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_ioctl.h linux-4.3-rtl8723bs/ +extern struct iw_handler_def rtw_handlers_def; + +#endif /* #ifndef __INC_CEINFO_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_ioctl_set.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_ioctl_set.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_ioctl_set.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_ioctl_set.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_ioctl_set.h linux/3rdparty/rtl8723bs/include/rtw_ioctl_set.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_ioctl_set.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_ioctl_set.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,41 @@ +/****************************************************************************** + * @@ -90289,9 +88279,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_ioctl_set.h linux-4.3-rtl872 +u16 rtw_get_cur_max_rate(struct adapter *adapter); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_io.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_io.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_io.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_io.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_io.h linux/3rdparty/rtl8723bs/include/rtw_io.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_io.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_io.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,373 @@ +/****************************************************************************** + * @@ -90666,9 +88656,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_io.h linux-4.3-rtl8723bs/3rd + rtw_read32(_a, _b) + +#endif /* _RTL8711_IO_H_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_mlme_ext.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_mlme_ext.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_mlme_ext.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_mlme_ext.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_mlme_ext.h linux/3rdparty/rtl8723bs/include/rtw_mlme_ext.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_mlme_ext.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_mlme_ext.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,888 @@ +/****************************************************************************** + * @@ -91558,9 +89548,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_mlme_ext.h linux-4.3-rtl8723 +#endif/* _RTL8192C_CMD_C_ */ + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_mlme.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_mlme.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_mlme.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_mlme.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_mlme.h linux/3rdparty/rtl8723bs/include/rtw_mlme.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_mlme.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_mlme.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,695 @@ +/****************************************************************************** + * @@ -92257,9 +90247,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_mlme.h linux-4.3-rtl8723bs/3 +void rtw_sta_media_status_rpt(struct adapter *adapter, struct sta_info *psta, u32 mstatus); + +#endif /* __RTL871X_MLME_H_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_mp.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_mp.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_mp.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_mp.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_mp.h linux/3rdparty/rtl8723bs/include/rtw_mp.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_mp.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_mp.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,512 @@ +/****************************************************************************** + * @@ -92773,9 +90763,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_mp.h linux-4.3-rtl8723bs/3rd +u8 MptToMgntRate(u32 MptRateIdx); + +#endif /* _RTW_MP_H_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_odm.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_odm.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_odm.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_odm.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_odm.h linux/3rdparty/rtl8723bs/include/rtw_odm.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_odm.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_odm.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,36 @@ +/****************************************************************************** + * @@ -92813,9 +90803,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_odm.h linux-4.3-rtl8723bs/3r + s8 IGI_Base, bool ForceEDCCA, u8 AdapEn_RSSI, u8 IGI_LowerBound); +void rtw_odm_get_perpkt_rssi(void *sel, struct adapter *adapter); +#endif /* __RTW_ODM_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_pwrctrl.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_pwrctrl.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_pwrctrl.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_pwrctrl.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_pwrctrl.h linux/3rdparty/rtl8723bs/include/rtw_pwrctrl.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_pwrctrl.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_pwrctrl.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,375 @@ +/****************************************************************************** + * @@ -93192,9 +91182,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_pwrctrl.h linux-4.3-rtl8723b +u32 rtw_ps_deny_get(struct adapter *padapter); + +#endif /* __RTL871X_PWRCTRL_H_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_qos.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_qos.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_qos.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_qos.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_qos.h linux/3rdparty/rtl8723bs/include/rtw_qos.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_qos.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_qos.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,27 @@ +/****************************************************************************** + * @@ -93223,9 +91213,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_qos.h linux-4.3-rtl8723bs/3r + + +#endif /* _RTL871X_QOS_H_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_recv.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_recv.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_recv.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_recv.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_recv.h linux/3rdparty/rtl8723bs/include/rtw_recv.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_recv.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_recv.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,553 @@ +/****************************************************************************** + * @@ -93780,9 +91770,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_recv.h linux-4.3-rtl8723bs/3 +extern void mgt_dispatcher(struct adapter *padapter, union recv_frame *precv_frame); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_rf.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_rf.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_rf.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_rf.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_rf.h linux/3rdparty/rtl8723bs/include/rtw_rf.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_rf.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_rf.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,159 @@ +/****************************************************************************** + * @@ -93943,9 +91933,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_rf.h linux-4.3-rtl8723bs/3rd +u32 rtw_ch2freq(u32 ch); + +#endif /* _RTL8711_RF_H_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_security.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_security.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_security.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_security.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_security.h linux/3rdparty/rtl8723bs/include/rtw_security.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_security.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_security.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,440 @@ +/****************************************************************************** + * @@ -94387,16 +92377,16 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_security.h linux-4.3-rtl8723 +u8 rtw_handle_tkip_countermeasure(struct adapter * adapter, const char *caller); + +#endif /* __RTL871X_SECURITY_H_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_version.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_version.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_version.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_version.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_version.h linux/3rdparty/rtl8723bs/include/rtw_version.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_version.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_version.h 2016-04-29 18:14:02.000000000 +0300 @@ -0,0 +1,2 @@ +#define DRIVERVERSION "v4.3.5.5_12290.20140916_BTCOEX20140507-4E40" +#define BTCOEXVERSION "BTCOEX20140507-4E40" -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_wifi_regd.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_wifi_regd.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_wifi_regd.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_wifi_regd.h 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,28 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_wifi_regd.h linux/3rdparty/rtl8723bs/include/rtw_wifi_regd.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_wifi_regd.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_wifi_regd.h 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,35 @@ +/****************************************************************************** + * + * Copyright(c) 2009-2010 Realtek Corporation. @@ -94406,6 +92396,13 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_wifi_regd.h linux-4.3-rtl872 +#ifndef __RTW_WIFI_REGD_H__ +#define __RTW_WIFI_REGD_H__ + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)) ++#define ieee80211_band nl80211_band ++#define IEEE80211_BAND_2GHZ NL80211_BAND_2GHZ ++#define IEEE80211_BAND_5GHZ NL80211_BAND_5GHZ ++#define IEEE80211_NUM_BANDS NUM_NL80211_BANDS ++#endif ++ +struct country_code_to_enum_rd { + u16 countrycode; + const char *iso_name; @@ -94425,9 +92422,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_wifi_regd.h linux-4.3-rtl872 + + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_xmit.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_xmit.h ---- linux-4.3/3rdparty/rtl8723bs/include/rtw_xmit.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/rtw_xmit.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/rtw_xmit.h linux/3rdparty/rtl8723bs/include/rtw_xmit.h +--- linux.old/3rdparty/rtl8723bs/include/rtw_xmit.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/rtw_xmit.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,528 @@ +/****************************************************************************** + * @@ -94957,9 +92954,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/rtw_xmit.h linux-4.3-rtl8723bs/3 +#include + +#endif /* _RTL871X_XMIT_H_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/sdio_hal.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/sdio_hal.h ---- linux-4.3/3rdparty/rtl8723bs/include/sdio_hal.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/sdio_hal.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/sdio_hal.h linux/3rdparty/rtl8723bs/include/sdio_hal.h +--- linux.old/3rdparty/rtl8723bs/include/sdio_hal.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/sdio_hal.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,28 @@ +/****************************************************************************** + * @@ -94989,9 +92986,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/sdio_hal.h linux-4.3-rtl8723bs/3 +void rtl8723bs_set_hal_ops(struct adapter *padapter); + +#endif /* __SDIO_HAL_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/sdio_ops.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/sdio_ops.h ---- linux-4.3/3rdparty/rtl8723bs/include/sdio_ops.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/sdio_ops.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/sdio_ops.h linux/3rdparty/rtl8723bs/include/sdio_ops.h +--- linux.old/3rdparty/rtl8723bs/include/sdio_ops.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/sdio_ops.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,49 @@ +/****************************************************************************** + * @@ -95042,9 +93039,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/sdio_ops.h linux-4.3-rtl8723bs/3 +#endif /* CONFIG_WOWLAN */ + +#endif /* !__SDIO_OPS_H__ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/sdio_ops_linux.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/sdio_ops_linux.h ---- linux-4.3/3rdparty/rtl8723bs/include/sdio_ops_linux.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/sdio_ops_linux.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/sdio_ops_linux.h linux/3rdparty/rtl8723bs/include/sdio_ops_linux.h +--- linux.old/3rdparty/rtl8723bs/include/sdio_ops_linux.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/sdio_ops_linux.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,40 @@ +/****************************************************************************** + * @@ -95086,9 +93083,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/sdio_ops_linux.h linux-4.3-rtl87 + +void rtw_sdio_set_irq_thd(struct dvobj_priv *dvobj, void *thd_hdl); +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/sdio_osintf.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/sdio_osintf.h ---- linux-4.3/3rdparty/rtl8723bs/include/sdio_osintf.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/sdio_osintf.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/sdio_osintf.h linux/3rdparty/rtl8723bs/include/sdio_osintf.h +--- linux.old/3rdparty/rtl8723bs/include/sdio_osintf.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/sdio_osintf.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,24 @@ +/****************************************************************************** + * @@ -95114,9 +93111,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/sdio_osintf.h linux-4.3-rtl8723b +void sd_c2h_hdl(struct adapter *padapter); + +#endif -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/sta_info.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/sta_info.h ---- linux-4.3/3rdparty/rtl8723bs/include/sta_info.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/sta_info.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/sta_info.h linux/3rdparty/rtl8723bs/include/sta_info.h +--- linux.old/3rdparty/rtl8723bs/include/sta_info.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/sta_info.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,392 @@ +/****************************************************************************** + * @@ -95510,9 +93507,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/sta_info.h linux-4.3-rtl8723bs/3 +extern u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr); + +#endif /* _STA_INFO_H_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/wifi.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/wifi.h ---- linux-4.3/3rdparty/rtl8723bs/include/wifi.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/wifi.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/wifi.h linux/3rdparty/rtl8723bs/include/wifi.h +--- linux.old/3rdparty/rtl8723bs/include/wifi.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/wifi.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,1158 @@ +/****************************************************************************** + * @@ -96672,9 +94669,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/wifi.h linux-4.3-rtl8723bs/3rdpa +}; + +#endif /* _WIFI_H_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/wlan_bssdef.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/wlan_bssdef.h ---- linux-4.3/3rdparty/rtl8723bs/include/wlan_bssdef.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/wlan_bssdef.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/wlan_bssdef.h linux/3rdparty/rtl8723bs/include/wlan_bssdef.h +--- linux.old/3rdparty/rtl8723bs/include/wlan_bssdef.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/wlan_bssdef.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,278 @@ +/****************************************************************************** + * @@ -96954,9 +94951,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/wlan_bssdef.h linux-4.3-rtl8723b +#define NUM_PMKID_CACHE NUM_PRE_AUTH_KEY + +#endif /* ifndef WLAN_BSSDEF_H_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/xmit_osdep.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/xmit_osdep.h ---- linux-4.3/3rdparty/rtl8723bs/include/xmit_osdep.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/include/xmit_osdep.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/include/xmit_osdep.h linux/3rdparty/rtl8723bs/include/xmit_osdep.h +--- linux.old/3rdparty/rtl8723bs/include/xmit_osdep.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/include/xmit_osdep.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,54 @@ +/****************************************************************************** + * @@ -97012,9 +95009,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/include/xmit_osdep.h linux-4.3-rtl8723bs +extern void rtw_os_xmit_complete(struct adapter *padapter, struct xmit_frame *pxframe); + +#endif /* __XMIT_OSDEP_H_ */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/Kconfig linux-4.3-rtl8723bs/3rdparty/rtl8723bs/Kconfig ---- linux-4.3/3rdparty/rtl8723bs/Kconfig 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/Kconfig 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/Kconfig linux/3rdparty/rtl8723bs/Kconfig +--- linux.old/3rdparty/rtl8723bs/Kconfig 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/Kconfig 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,11 @@ +config RTL8723BS + tristate "Realtek 8723B SDIO or SPI WiFi" @@ -97027,10 +95024,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/Kconfig linux-4.3-rtl8723bs/3rdparty/rtl + default n + ---help--- + Use memory preallocated in platform -diff -Nurp linux-4.3/3rdparty/rtl8723bs/Makefile linux-4.3-rtl8723bs/3rdparty/rtl8723bs/Makefile ---- linux-4.3/3rdparty/rtl8723bs/Makefile 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/Makefile 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,250 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/Makefile linux/3rdparty/rtl8723bs/Makefile +--- linux.old/3rdparty/rtl8723bs/Makefile 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/Makefile 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,251 @@ +EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS) +EXTRA_CFLAGS += -O1 +#EXTRA_CFLAGS += -O3 @@ -97198,7 +95195,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/Makefile linux-4.3-rtl8723bs/3rdparty/rt +endif + +ifeq ($(CONFIG_PLATFORM_I386_PC), y) -+SUBARCH := $(shell uname -m | sed -e s/i.86/i386/) ++SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ | sed -e s/armv7l/arm/) +ARCH ?= $(SUBARCH) +CROSS_COMPILE ?= +KVER := $(shell uname -r) @@ -97253,6 +95250,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/Makefile linux-4.3-rtl8723bs/3rdparty/rt + +install: + install -p -m 644 $(MODULE_NAME).ko $(MODDESTDIR) ++ @mkdir -p /lib/firmware/rtlwifi/ + @cp -n rtl8723bs_nic.bin /lib/firmware/rtlwifi/rtl8723bs_nic.bin + @cp -n rtl8723bs_wowlan.bin /lib/firmware/rtlwifi/rtl8723bs_wowlan.bin + /sbin/depmod -a ${KVER} @@ -97276,15 +95274,15 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/Makefile linux-4.3-rtl8723bs/3rdparty/rt +clean: + @rm -fr hal/*/*.mod.c hal/*/*.mod hal/*/*.o hal/*/.*.cmd hal/*/*.ko \ + hal/*.mod.c hal/*.mod hal/*.o hal/.*.cmd hal/*.ko \ -+ core/*.mod.c core/*.mod *.o core/.*.cmd core/*.ko \ ++ core/*.mod.c core/*.mod core/*.o core/.*.cmd core/*.ko \ + os_dep/*.mod.c os_dep/*.mod os_dep/*.o os_dep/.*.cmd *.ko \ + platform/*.mod.c platform/*.mod platform/*.o platform/.*.cmd platform/*.ko \ + Module.symvers Module.markers modules.order *.mod.c *.mod *.o .*.cmd *.ko *~ .tmp_versions \ + cppcheck.log -diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/ioctl_cfg80211.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/ioctl_cfg80211.c ---- linux-4.3/3rdparty/rtl8723bs/os_dep/ioctl_cfg80211.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/ioctl_cfg80211.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,3599 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/os_dep/ioctl_cfg80211.c linux/3rdparty/rtl8723bs/os_dep/ioctl_cfg80211.c +--- linux.old/3rdparty/rtl8723bs/os_dep/ioctl_cfg80211.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/os_dep/ioctl_cfg80211.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,3608 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. @@ -98686,6 +96684,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/ioctl_cfg80211.c linux-4.3-rtl872 +void rtw_cfg80211_indicate_scan_done(struct adapter *adapter, bool aborted) +{ + struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter); ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)) ++ struct cfg80211_scan_info info = { ++ .aborted = aborted ++ }; ++#endif + + spin_lock_bh(&pwdev_priv->scan_req_lock); + if (pwdev_priv->scan_request != NULL) { @@ -98700,7 +96703,11 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/ioctl_cfg80211.c linux-4.3-rtl872 + } + else + { ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)) ++ cfg80211_scan_done(pwdev_priv->scan_request, &info); ++#else + cfg80211_scan_done(pwdev_priv->scan_request, aborted); ++#endif + } + + pwdev_priv->scan_request = NULL; @@ -100884,9 +98891,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/ioctl_cfg80211.c linux-4.3-rtl872 + + wiphy_unregister(wdev->wiphy); +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/ioctl_linux.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/ioctl_linux.c ---- linux-4.3/3rdparty/rtl8723bs/os_dep/ioctl_linux.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/ioctl_linux.c 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/os_dep/ioctl_linux.c linux/3rdparty/rtl8723bs/os_dep/ioctl_linux.c +--- linux.old/3rdparty/rtl8723bs/os_dep/ioctl_linux.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/os_dep/ioctl_linux.c 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,5820 @@ +/****************************************************************************** + * @@ -106708,9 +104715,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/ioctl_linux.c linux-4.3-rtl8723bs + + return ret; +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/mlme_linux.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/mlme_linux.c ---- linux-4.3/3rdparty/rtl8723bs/os_dep/mlme_linux.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/mlme_linux.c 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/os_dep/mlme_linux.c linux/3rdparty/rtl8723bs/os_dep/mlme_linux.c +--- linux.old/3rdparty/rtl8723bs/os_dep/mlme_linux.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/os_dep/mlme_linux.c 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,206 @@ +/****************************************************************************** + * @@ -106918,9 +104925,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/mlme_linux.c linux-4.3-rtl8723bs/ + _init_timer(&pmlmeext->link_timer, padapter->pnetdev, link_timer_hdl, padapter); + _init_timer(&pmlmeext->sa_query_timer, padapter->pnetdev, sa_query_timer_hdl, padapter); +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/osdep_service.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/osdep_service.c ---- linux-4.3/3rdparty/rtl8723bs/os_dep/osdep_service.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/osdep_service.c 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/os_dep/osdep_service.c linux/3rdparty/rtl8723bs/os_dep/osdep_service.c +--- linux.old/3rdparty/rtl8723bs/os_dep/osdep_service.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/os_dep/osdep_service.c 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,481 @@ +/****************************************************************************** + * @@ -107403,9 +105410,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/osdep_service.c linux-4.3-rtl8723 + + return cbuf; +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/os_intfs.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/os_intfs.c ---- linux-4.3/3rdparty/rtl8723bs/os_dep/os_intfs.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/os_intfs.c 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/os_dep/os_intfs.c linux/3rdparty/rtl8723bs/os_dep/os_intfs.c +--- linux.old/3rdparty/rtl8723bs/os_dep/os_intfs.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/os_dep/os_intfs.c 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,1916 @@ +/****************************************************************************** + * @@ -109323,9 +107330,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/os_intfs.c linux-4.3-rtl8723bs/3r + + return ret; +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/recv_linux.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/recv_linux.c ---- linux-4.3/3rdparty/rtl8723bs/os_dep/recv_linux.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/recv_linux.c 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/os_dep/recv_linux.c linux/3rdparty/rtl8723bs/os_dep/recv_linux.c +--- linux.old/3rdparty/rtl8723bs/os_dep/recv_linux.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/os_dep/recv_linux.c 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,366 @@ +/****************************************************************************** + * @@ -109693,9 +107700,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/recv_linux.c linux-4.3-rtl8723bs/ + _init_timer(&(preorder_ctrl->reordering_ctrl_timer), padapter->pnetdev, rtw_reordering_ctrl_timeout_handler, preorder_ctrl); + +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/rtw_proc.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/rtw_proc.c ---- linux-4.3/3rdparty/rtl8723bs/os_dep/rtw_proc.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/rtw_proc.c 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/os_dep/rtw_proc.c linux/3rdparty/rtl8723bs/os_dep/rtw_proc.c +--- linux.old/3rdparty/rtl8723bs/os_dep/rtw_proc.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/os_dep/rtw_proc.c 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,786 @@ +/****************************************************************************** + * @@ -110483,9 +108490,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/rtw_proc.c linux-4.3-rtl8723bs/3r +} + +#endif /* CONFIG_PROC_DEBUG */ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/rtw_proc.h linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/rtw_proc.h ---- linux-4.3/3rdparty/rtl8723bs/os_dep/rtw_proc.h 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/rtw_proc.h 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/os_dep/rtw_proc.h linux/3rdparty/rtl8723bs/os_dep/rtw_proc.h +--- linux.old/3rdparty/rtl8723bs/os_dep/rtw_proc.h 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/os_dep/rtw_proc.h 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,45 @@ +/****************************************************************************** + * @@ -110532,10 +108539,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/rtw_proc.h linux-4.3-rtl8723bs/3r +#endif //!CONFIG_PROC_DEBUG + +#endif //__RTW_PROC_H__ -diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/sdio_intf.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/sdio_intf.c ---- linux-4.3/3rdparty/rtl8723bs/os_dep/sdio_intf.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/sdio_intf.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,725 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/os_dep/sdio_intf.c linux/3rdparty/rtl8723bs/os_dep/sdio_intf.c +--- linux.old/3rdparty/rtl8723bs/os_dep/sdio_intf.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/os_dep/sdio_intf.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,727 @@ +/****************************************************************************** + * + * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. @@ -110867,6 +108874,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/sdio_intf.c linux-4.3-rtl8723bs/3 + int status = _FAIL; + struct net_device *pnetdev; + struct adapter *padapter = NULL; ++ PSDIO_DATA psdio = &dvobj->intf_data; + + if ((padapter = (struct adapter *)vzalloc(sizeof(*padapter))) == NULL) { + goto exit; @@ -110931,7 +108939,7 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/sdio_intf.c linux-4.3-rtl8723bs/3 + + /* 3 8. get WLan MAC address */ + /* set mac addr */ -+ rtw_macaddr_cfg(padapter->eeprompriv.mac_addr); ++ rtw_macaddr_cfg(&psdio->func->dev, padapter->eeprompriv.mac_addr); + + rtw_hal_disable_interrupt(padapter); + @@ -111018,11 +109026,12 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/sdio_intf.c linux-4.3-rtl8723bs/3 + switch (func->device) { + case 0x0523: + case 0x0623: ++ case 0x0626: + case 0xb723: + break; + default: -+ pr_info("RTL8723BS: Found unrecognized vendor 0x%x, device 0x%x\n", -+ func->vendor, func->device); ++ pr_info("RTL8723BS: Found unrecognized device 0x%x for vendor 0x%x\n", ++ func->device, func->vendor); + goto exit; + } + break; @@ -111261,9 +109270,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/sdio_intf.c linux-4.3-rtl8723bs/3 + +module_init(rtw_drv_entry); +module_exit(rtw_drv_halt); -diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/sdio_ops_linux.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/sdio_ops_linux.c ---- linux-4.3/3rdparty/rtl8723bs/os_dep/sdio_ops_linux.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/sdio_ops_linux.c 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/os_dep/sdio_ops_linux.c linux/3rdparty/rtl8723bs/os_dep/sdio_ops_linux.c +--- linux.old/3rdparty/rtl8723bs/os_dep/sdio_ops_linux.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/os_dep/sdio_ops_linux.c 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,599 @@ +/****************************************************************************** + * @@ -111864,10 +109873,10 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/sdio_ops_linux.c linux-4.3-rtl872 + sdio_release_host(func); + return err; +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/wifi_regd.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/wifi_regd.c ---- linux-4.3/3rdparty/rtl8723bs/os_dep/wifi_regd.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/wifi_regd.c 2015-11-21 19:42:45.000000000 +0200 -@@ -0,0 +1,218 @@ +diff -Nurp linux.old/3rdparty/rtl8723bs/os_dep/wifi_regd.c linux/3rdparty/rtl8723bs/os_dep/wifi_regd.c +--- linux.old/3rdparty/rtl8723bs/os_dep/wifi_regd.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/os_dep/wifi_regd.c 2017-01-20 22:14:45.000000000 +0200 +@@ -0,0 +1,164 @@ +/****************************************************************************** + * + * Copyright(c) 2009-2010 Realtek Corporation. @@ -111916,60 +109925,6 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/wifi_regd.c linux-4.3-rtl8723bs/3 + } +}; + -+static const struct ieee80211_regdomain rtw_regdom_11 = { -+ .n_reg_rules = 1, -+ .alpha2 = "99", -+ .reg_rules = { -+ RTW_2GHZ_CH01_11, -+ } -+}; -+ -+static const struct ieee80211_regdomain rtw_regdom_12_13 = { -+ .n_reg_rules = 2, -+ .alpha2 = "99", -+ .reg_rules = { -+ RTW_2GHZ_CH01_11, -+ RTW_2GHZ_CH12_13, -+ } -+}; -+ -+static const struct ieee80211_regdomain rtw_regdom_no_midband = { -+ .n_reg_rules = 3, -+ .alpha2 = "99", -+ .reg_rules = { -+ RTW_2GHZ_CH01_11, -+ } -+}; -+ -+static const struct ieee80211_regdomain rtw_regdom_60_64 = { -+ .n_reg_rules = 3, -+ .alpha2 = "99", -+ .reg_rules = { -+ RTW_2GHZ_CH01_11, -+ RTW_2GHZ_CH12_13, -+ } -+}; -+ -+static const struct ieee80211_regdomain rtw_regdom_14_60_64 = { -+ .n_reg_rules = 4, -+ .alpha2 = "99", -+ .reg_rules = { -+ RTW_2GHZ_CH01_11, -+ RTW_2GHZ_CH12_13, -+ RTW_2GHZ_CH14, -+ } -+}; -+ -+static const struct ieee80211_regdomain rtw_regdom_14 = { -+ .n_reg_rules = 3, -+ .alpha2 = "99", -+ .reg_rules = { -+ RTW_2GHZ_CH01_11, -+ RTW_2GHZ_CH12_13, -+ RTW_2GHZ_CH14, -+ } -+}; -+ +static int rtw_ieee80211_channel_to_frequency(int chan, int band) +{ + /* see 802.11 17.3.8.3.2 and Annex J @@ -112086,9 +110041,9 @@ diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/wifi_regd.c linux-4.3-rtl8723bs/3 + + _rtw_reg_notifier_apply(wiphy, request, reg); +} -diff -Nurp linux-4.3/3rdparty/rtl8723bs/os_dep/xmit_linux.c linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/xmit_linux.c ---- linux-4.3/3rdparty/rtl8723bs/os_dep/xmit_linux.c 1970-01-01 02:00:00.000000000 +0200 -+++ linux-4.3-rtl8723bs/3rdparty/rtl8723bs/os_dep/xmit_linux.c 2015-11-21 19:42:45.000000000 +0200 +diff -Nurp linux.old/3rdparty/rtl8723bs/os_dep/xmit_linux.c linux/3rdparty/rtl8723bs/os_dep/xmit_linux.c +--- linux.old/3rdparty/rtl8723bs/os_dep/xmit_linux.c 1970-01-01 02:00:00.000000000 +0200 ++++ linux/3rdparty/rtl8723bs/os_dep/xmit_linux.c 2017-01-20 22:14:45.000000000 +0200 @@ -0,0 +1,298 @@ +/****************************************************************************** + * diff --git a/kernel/kernel/files/patches/mageia/fs-aufs-4.8-modular.patch b/kernel/kernel/files/patches/mageia/fs-aufs-4.8-modular.patch deleted file mode 100644 index 62a3b4f0..00000000 --- a/kernel/kernel/files/patches/mageia/fs-aufs-4.8-modular.patch +++ /dev/null @@ -1,394 +0,0 @@ - - fs/aufs/Kconfig | 2 +- - fs/dcache.c | 1 + - fs/exec.c | 1 + - fs/fcntl.c | 1 + - fs/file_table.c | 4 ++++ - fs/inode.c | 1 + - fs/namespace.c | 2 ++ - fs/notify/group.c | 4 ++++ - fs/notify/mark.c | 4 ++++ - fs/open.c | 2 ++ - fs/read_write.c | 2 ++ - fs/splice.c | 2 ++ - fs/xattr.c | 1 + - kernel/task_work.c | 1 + - security/commoncap.c | 2 ++ - security/device_cgroup.c | 2 ++ - security/security.c | 10 ++++++++++ - 17 files changed, 41 insertions(+), 1 deletion(-) - -diff -Nurp linux-4.8-aufs/fs/aufs/Kconfig linux-4.8-aufs-mod/fs/aufs/Kconfig ---- linux-4.8-aufs/fs/aufs/Kconfig 2016-07-04 19:02:29.246286120 +0300 -+++ linux-4.8-aufs-mod/fs/aufs/Kconfig 2016-07-04 19:03:53.653714965 +0300 -@@ -1,5 +1,5 @@ - config AUFS_FS -- bool "Aufs (Advanced multi layered unification filesystem) support" -+ tristate "Aufs (Advanced multi layered unification filesystem) support" - help - Aufs is a stackable unification filesystem such as Unionfs, - which unifies several directories and provides a merged single -diff -Nurp linux-4.8-aufs/fs/dcache.c linux-4.8-aufs-mod/fs/dcache.c ---- linux-4.8-aufs/fs/dcache.c 2016-07-04 19:02:29.260286196 +0300 -+++ linux-4.8-aufs-mod/fs/dcache.c 2016-07-04 19:03:53.653714965 +0300 -@@ -1310,6 +1310,7 @@ rename_retry: - seq = 1; - goto again; - } -+EXPORT_SYMBOL_GPL(d_walk); - - /* - * Search for at least 1 mount point in the dentry's subdirs. -diff -Nurp linux-4.8-aufs/fs/exec.c linux-4.8-aufs-mod/fs/exec.c ---- linux-4.8-aufs/fs/exec.c 2016-07-04 17:58:15.707773651 +0300 -+++ linux-4.8-aufs-mod/fs/exec.c 2016-07-04 19:03:53.654714970 +0300 -@@ -104,6 +104,7 @@ bool path_noexec(const struct path *path - return (path->mnt->mnt_flags & MNT_NOEXEC) || - (path->mnt->mnt_sb->s_iflags & SB_I_NOEXEC); - } -+EXPORT_SYMBOL_GPL(path_noexec); - - #ifdef CONFIG_USELIB - /* -diff -Nurp linux-4.8-aufs/fs/fcntl.c linux-4.8-aufs-mod/fs/fcntl.c ---- linux-4.8-aufs/fs/fcntl.c 2016-07-04 19:02:29.260286196 +0300 -+++ linux-4.8-aufs-mod/fs/fcntl.c 2016-07-04 19:03:53.654714970 +0300 -@@ -82,6 +82,7 @@ int setfl(int fd, struct file * filp, un - out: - return error; - } -+EXPORT_SYMBOL_GPL(setfl); - - static void f_modown(struct file *filp, struct pid *pid, enum pid_type type, - int force) -diff -Nurp linux-4.8-aufs/fs/file_table.c linux-4.8-aufs-mod/fs/file_table.c ---- linux-4.8-aufs/fs/file_table.c 2016-05-16 01:43:13.000000000 +0300 -+++ linux-4.8-aufs-mod/fs/file_table.c 2016-07-04 19:03:53.654714970 +0300 -@@ -147,6 +147,7 @@ over: - } - return ERR_PTR(-ENFILE); - } -+EXPORT_SYMBOL_GPL(get_empty_filp); - - /** - * alloc_file - allocate and initialize a 'struct file' -@@ -258,6 +259,7 @@ void flush_delayed_fput(void) - { - delayed_fput(NULL); - } -+EXPORT_SYMBOL_GPL(flush_delayed_fput); - - static DECLARE_DELAYED_WORK(delayed_fput_work, delayed_fput); - -@@ -300,6 +302,7 @@ void __fput_sync(struct file *file) - } - - EXPORT_SYMBOL(fput); -+EXPORT_SYMBOL_GPL(__fput_sync); - - void put_filp(struct file *file) - { -@@ -308,6 +311,7 @@ void put_filp(struct file *file) - file_free(file); - } - } -+EXPORT_SYMBOL_GPL(put_filp); - - void __init files_init(void) - { -diff -Nurp linux-4.8-aufs/fs/inode.c linux-4.8-aufs-mod/fs/inode.c ---- linux-4.8-aufs/fs/inode.c 2016-07-04 19:02:29.261286202 +0300 -+++ linux-4.8-aufs-mod/fs/inode.c 2016-07-04 20:51:39.805168596 +0300 -@@ -1600,6 +1600,7 @@ int update_time(struct inode *inode, str - - return update_time(inode, time, flags); - } -+EXPORT_SYMBOL_GPL(update_time); - - /** - * touch_atime - update the access time -diff -Nurp linux-4.8-aufs/fs/namespace.c linux-4.8-aufs-mod/fs/namespace.c ---- linux-4.8-aufs/fs/namespace.c 2016-07-04 17:58:15.729773645 +0300 -+++ linux-4.8-aufs-mod/fs/namespace.c 2016-07-04 19:03:53.654714970 +0300 -@@ -463,6 +463,7 @@ void __mnt_drop_write(struct vfsmount *m - mnt_dec_writers(real_mount(mnt)); - preempt_enable(); - } -+EXPORT_SYMBOL_GPL(__mnt_drop_write); - - /** - * mnt_drop_write - give up write access to a mount -@@ -1812,6 +1813,7 @@ int iterate_mounts(int (*f)(struct vfsmo - } - return 0; - } -+EXPORT_SYMBOL_GPL(iterate_mounts); - - static void cleanup_group_ids(struct mount *mnt, struct mount *end) - { -diff -Nurp linux-4.8-aufs/fs/notify/group.c linux-4.8-aufs-mod/fs/notify/group.c ---- linux-4.8-aufs/fs/notify/group.c 2016-07-04 17:58:15.742773641 +0300 -+++ linux-4.8-aufs-mod/fs/notify/group.c 2016-07-04 19:03:53.655714975 +0300 -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - - #include - #include "fsnotify.h" -@@ -81,6 +82,7 @@ void fsnotify_get_group(struct fsnotify_ - { - atomic_inc(&group->refcnt); - } -+EXPORT_SYMBOL_GPL(fsnotify_get_group); - - /* - * Drop a reference to a group. Free it if it's through. -@@ -90,6 +92,7 @@ void fsnotify_put_group(struct fsnotify_ - if (atomic_dec_and_test(&group->refcnt)) - fsnotify_final_destroy_group(group); - } -+EXPORT_SYMBOL_GPL(fsnotify_put_group); - - /* - * Create a new fsnotify_group and hold a reference for the group returned. -@@ -118,6 +121,7 @@ struct fsnotify_group *fsnotify_alloc_gr - - return group; - } -+EXPORT_SYMBOL_GPL(fsnotify_alloc_group); - - int fsnotify_fasync(int fd, struct file *file, int on) - { -diff -Nurp linux-4.8-aufs/fs/notify/mark.c linux-4.8-aufs-mod/fs/notify/mark.c ---- linux-4.8-aufs/fs/notify/mark.c 2016-07-04 17:58:15.742773641 +0300 -+++ linux-4.8-aufs-mod/fs/notify/mark.c 2016-07-04 19:03:53.655714975 +0300 -@@ -113,6 +113,7 @@ void fsnotify_put_mark(struct fsnotify_m - mark->free_mark(mark); - } - } -+EXPORT_SYMBOL_GPL(fsnotify_put_mark); - - /* Calculate mask of events for a list of marks */ - u32 fsnotify_recalc_mask(struct hlist_head *head) -@@ -230,6 +231,7 @@ void fsnotify_destroy_mark(struct fsnoti - mutex_unlock(&group->mark_mutex); - fsnotify_free_mark(mark); - } -+EXPORT_SYMBOL_GPL(fsnotify_destroy_mark); - - void fsnotify_destroy_marks(struct hlist_head *head, spinlock_t *lock) - { -@@ -415,6 +417,7 @@ err: - - return ret; - } -+EXPORT_SYMBOL_GPL(fsnotify_add_mark); - - int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group, - struct inode *inode, struct vfsmount *mnt, int allow_dups) -@@ -521,6 +524,7 @@ void fsnotify_duplicate_mark(struct fsno - new->mask = old->mask; - new->free_mark = old->free_mark; - } -+EXPORT_SYMBOL_GPL(fsnotify_init_mark); - - /* - * Nothing fancy, just initialize lists and locks and counters. -diff -Nurp linux-4.8-aufs/fs/open.c linux-4.8-aufs-mod/fs/open.c ---- linux-4.8-aufs/fs/open.c 2016-07-04 17:58:15.746773640 +0300 -+++ linux-4.8-aufs-mod/fs/open.c 2016-07-04 19:03:53.655714975 +0300 -@@ -64,6 +64,7 @@ int do_truncate(struct dentry *dentry, l - inode_unlock(dentry->d_inode); - return ret; - } -+EXPORT_SYMBOL_GPL(do_truncate); - - long vfs_truncate(const struct path *path, loff_t length) - { -@@ -678,6 +679,7 @@ int open_check_o_direct(struct file *f) - } - return 0; - } -+EXPORT_SYMBOL_GPL(open_check_o_direct); - - static int do_dentry_open(struct file *f, - struct inode *inode, -diff -Nurp linux-4.8-aufs/fs/read_write.c linux-4.8-aufs-mod/fs/read_write.c ---- linux-4.8-aufs/fs/read_write.c 2016-07-04 19:02:29.262286207 +0300 -+++ linux-4.8-aufs-mod/fs/read_write.c 2016-07-04 19:03:53.655714975 +0300 -@@ -525,6 +525,7 @@ vfs_readf_t vfs_readf(struct file *file) - return new_sync_read; - return ERR_PTR(-ENOSYS); - } -+EXPORT_SYMBOL_GPL(vfs_readf); - - vfs_writef_t vfs_writef(struct file *file) - { -@@ -536,6 +537,7 @@ vfs_writef_t vfs_writef(struct file *fil - return new_sync_write; - return ERR_PTR(-ENOSYS); - } -+EXPORT_SYMBOL_GPL(vfs_writef); - - ssize_t __kernel_write(struct file *file, const char *buf, size_t count, loff_t *pos) - { -diff -Nurp linux-4.8-aufs/fs/splice.c linux-4.8-aufs-mod/fs/splice.c ---- linux-4.8-aufs/fs/splice.c 2016-07-04 19:02:29.262286207 +0300 -+++ linux-4.8-aufs-mod/fs/splice.c 2016-07-04 19:03:53.656714979 +0300 -@@ -1124,6 +1124,7 @@ long do_splice_from(struct pipe_inode_in - - return splice_write(pipe, out, ppos, len, flags); - } -+EXPORT_SYMBOL_GPL(do_splice_from); - - /* - * Attempt to initiate a splice from a file to a pipe. -@@ -1153,6 +1154,7 @@ long do_splice_to(struct file *in, loff_ - - return splice_read(in, ppos, pipe, len, flags); - } -+EXPORT_SYMBOL_GPL(do_splice_to); - - /** - * splice_direct_to_actor - splices data directly between two non-pipes -diff -Nurp linux-4.8-aufs/fs/xattr.c linux-4.8-aufs-mod/fs/xattr.c ---- linux-4.8-aufs/fs/xattr.c 2016-07-04 17:58:15.754773638 +0300 -+++ linux-4.8-aufs-mod/fs/xattr.c 2016-07-04 19:03:53.656714979 +0300 -@@ -207,6 +207,7 @@ vfs_getxattr_alloc(struct dentry *dentry - *xattr_value = value; - return error; - } -+EXPORT_SYMBOL_GPL(vfs_getxattr_alloc); - - ssize_t - vfs_getxattr(struct dentry *dentry, const char *name, void *value, size_t size) -diff -Nurp linux-4.8-aufs/kernel/task_work.c linux-4.8-aufs-mod/kernel/task_work.c ---- linux-4.8-aufs/kernel/task_work.c 2016-05-16 01:43:13.000000000 +0300 -+++ linux-4.8-aufs-mod/kernel/task_work.c 2016-07-04 19:03:53.656714979 +0300 -@@ -118,3 +118,4 @@ void task_work_run(void) - } while (work); - } - } -+EXPORT_SYMBOL_GPL(task_work_run); -diff -Nurp linux-4.8-aufs/security/commoncap.c linux-4.8-aufs-mod/security/commoncap.c ---- linux-4.8-aufs/security/commoncap.c 2016-07-04 17:58:15.945773585 +0300 -+++ linux-4.8-aufs-mod/security/commoncap.c 2016-07-04 19:03:53.656714979 +0300 -@@ -1058,12 +1058,14 @@ int cap_mmap_addr(unsigned long addr) - } - return ret; - } -+EXPORT_SYMBOL_GPL(cap_mmap_addr); - - int cap_mmap_file(struct file *file, unsigned long reqprot, - unsigned long prot, unsigned long flags) - { - return 0; - } -+EXPORT_SYMBOL_GPL(cap_mmap_file); - - #ifdef CONFIG_SECURITY - -diff -Nurp linux-4.8-aufs/security/device_cgroup.c linux-4.8-aufs-mod/security/device_cgroup.c ---- linux-4.8-aufs/security/device_cgroup.c 2016-05-16 01:43:13.000000000 +0300 -+++ linux-4.8-aufs-mod/security/device_cgroup.c 2016-07-04 19:03:53.656714979 +0300 -@@ -7,6 +7,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -849,6 +850,7 @@ int __devcgroup_inode_permission(struct - return __devcgroup_check_permission(type, imajor(inode), iminor(inode), - access); - } -+EXPORT_SYMBOL_GPL(__devcgroup_inode_permission); - - int devcgroup_inode_mknod(int mode, dev_t dev) - { -diff -Nurp linux-4.8-aufs/security/security.c linux-4.8-aufs-mod/security/security.c ---- linux-4.8-aufs/security/security.c 2016-07-04 17:58:15.948773584 +0300 -+++ linux-4.8-aufs-mod/security/security.c 2016-07-04 19:03:53.657714984 +0300 -@@ -434,6 +434,7 @@ int security_path_rmdir(const struct pat - return 0; - return call_int_hook(path_rmdir, 0, dir, dentry); - } -+EXPORT_SYMBOL_GPL(security_path_rmdir); - - int security_path_unlink(const struct path *dir, struct dentry *dentry) - { -@@ -450,6 +451,7 @@ int security_path_symlink(const struct p - return 0; - return call_int_hook(path_symlink, 0, dir, dentry, old_name); - } -+EXPORT_SYMBOL_GPL(security_path_symlink); - - int security_path_link(struct dentry *old_dentry, const struct path *new_dir, - struct dentry *new_dentry) -@@ -458,6 +460,7 @@ int security_path_link(struct dentry *ol - return 0; - return call_int_hook(path_link, 0, old_dentry, new_dir, new_dentry); - } -+EXPORT_SYMBOL_GPL(security_path_link); - - int security_path_rename(const struct path *old_dir, struct dentry *old_dentry, - const struct path *new_dir, struct dentry *new_dentry, -@@ -485,6 +488,7 @@ int security_path_truncate(const struct - return 0; - return call_int_hook(path_truncate, 0, path); - } -+EXPORT_SYMBOL_GPL(security_path_truncate); - - int security_path_chmod(const struct path *path, umode_t mode) - { -@@ -492,6 +496,7 @@ int security_path_chmod(const struct pat - return 0; - return call_int_hook(path_chmod, 0, path, mode); - } -+EXPORT_SYMBOL_GPL(security_path_chmod); - - int security_path_chown(const struct path *path, kuid_t uid, kgid_t gid) - { -@@ -499,6 +504,7 @@ int security_path_chown(const struct pat - return 0; - return call_int_hook(path_chown, 0, path, uid, gid); - } -+EXPORT_SYMBOL_GPL(security_path_chown); - - int security_path_chroot(const struct path *path) - { -@@ -584,6 +590,7 @@ int security_inode_readlink(struct dentr - return 0; - return call_int_hook(inode_readlink, 0, dentry); - } -+EXPORT_SYMBOL_GPL(security_inode_readlink); - - int security_inode_follow_link(struct dentry *dentry, struct inode *inode, - bool rcu) -@@ -599,6 +606,7 @@ int security_inode_permission(struct ino - return 0; - return call_int_hook(inode_permission, 0, inode, mask); - } -+EXPORT_SYMBOL_GPL(security_inode_permission); - - int security_inode_setattr(struct dentry *dentry, struct iattr *attr) - { -@@ -737,6 +745,7 @@ int security_file_permission(struct file - - return fsnotify_perm(file, mask); - } -+EXPORT_SYMBOL_GPL(security_file_permission); - - int security_file_alloc(struct file *file) - { -@@ -796,6 +805,7 @@ int security_mmap_file(struct file *file - return ret; - return ima_file_mmap(file, prot); - } -+EXPORT_SYMBOL_GPL(security_mmap_file); - - int security_mmap_addr(unsigned long addr) - { diff --git a/kernel/kernel/files/patches/mageia/fs-aufs-4.8.patch b/kernel/kernel/files/patches/mageia/fs-aufs-4.8.patch deleted file mode 100644 index 1efb3528..00000000 --- a/kernel/kernel/files/patches/mageia/fs-aufs-4.8.patch +++ /dev/null @@ -1,34922 +0,0 @@ - - Documentation/ABI/testing/debugfs-aufs | 50 - Documentation/ABI/testing/sysfs-aufs | 31 - Documentation/filesystems/aufs/README | 392 +++ - Documentation/filesystems/aufs/design/01intro.txt | 157 + - Documentation/filesystems/aufs/design/02struct.txt | 245 ++ - Documentation/filesystems/aufs/design/03atomic_open.txt | 72 - Documentation/filesystems/aufs/design/03lookup.txt | 100 - Documentation/filesystems/aufs/design/04branch.txt | 61 - Documentation/filesystems/aufs/design/05wbr_policy.txt | 51 - Documentation/filesystems/aufs/design/06fhsm.txt | 105 - Documentation/filesystems/aufs/design/06mmap.txt | 59 - Documentation/filesystems/aufs/design/06xattr.txt | 81 - Documentation/filesystems/aufs/design/07export.txt | 45 - Documentation/filesystems/aufs/design/08shwh.txt | 39 - Documentation/filesystems/aufs/design/10dynop.txt | 34 - MAINTAINERS | 13 - drivers/block/loop.c | 18 - fs/Kconfig | 1 - fs/Makefile | 1 - fs/aufs/Kconfig | 185 + - fs/aufs/Makefile | 36 - fs/aufs/aufs.h | 46 - fs/aufs/branch.c | 1399 ++++++++++++ - fs/aufs/branch.h | 296 ++ - fs/aufs/cpup.c | 1378 +++++++++++ - fs/aufs/cpup.h | 81 - fs/aufs/dbgaufs.c | 425 +++ - fs/aufs/dbgaufs.h | 35 - fs/aufs/dcsub.c | 212 + - fs/aufs/dcsub.h | 123 + - fs/aufs/debug.c | 427 +++ - fs/aufs/debug.h | 212 + - fs/aufs/dentry.c | 1117 +++++++++ - fs/aufs/dentry.h | 242 ++ - fs/aufs/dinfo.c | 540 ++++ - fs/aufs/dir.c | 749 ++++++ - fs/aufs/dir.h | 124 + - fs/aufs/dynop.c | 358 +++ - fs/aufs/dynop.h | 61 - fs/aufs/export.c | 824 +++++++ - fs/aufs/f_op.c | 759 ++++++ - fs/aufs/fhsm.c | 412 +++ - fs/aufs/file.c | 844 +++++++ - fs/aufs/file.h | 281 ++ - fs/aufs/finfo.c | 138 + - fs/aufs/fstype.h | 387 +++ - fs/aufs/hfsnotify.c | 274 ++ - fs/aufs/hfsplus.c | 43 - fs/aufs/hnotify.c | 710 ++++++ - fs/aufs/i_op.c | 1438 ++++++++++++ - fs/aufs/i_op_add.c | 911 +++++++ - fs/aufs/i_op_del.c | 498 ++++ - fs/aufs/i_op_ren.c | 1002 ++++++++ - fs/aufs/iinfo.c | 272 ++ - fs/aufs/inode.c | 506 ++++ - fs/aufs/inode.h | 687 +++++ - fs/aufs/ioctl.c | 206 + - fs/aufs/loop.c | 134 + - fs/aufs/loop.h | 39 - fs/aufs/magic.mk | 30 - fs/aufs/module.c | 319 ++ - fs/aufs/module.h | 143 + - fs/aufs/mvdown.c | 691 +++++ - fs/aufs/opts.c | 1847 ++++++++++++++++ - fs/aufs/opts.h | 198 + - fs/aufs/plink.c | 501 ++++ - fs/aufs/poll.c | 39 - fs/aufs/posix_acl.c | 85 - fs/aufs/procfs.c | 156 + - fs/aufs/rdu.c | 368 +++ - fs/aufs/rwsem.h | 185 + - fs/aufs/sbinfo.c | 342 ++ - fs/aufs/spl.h | 100 - fs/aufs/super.c | 1025 ++++++++ - fs/aufs/super.h | 625 +++++ - fs/aufs/sysaufs.c | 91 - fs/aufs/sysaufs.h | 88 - fs/aufs/sysfs.c | 340 ++ - fs/aufs/sysrq.c | 144 + - fs/aufs/vdir.c | 887 +++++++ - fs/aufs/vfsub.c | 871 +++++++ - fs/aufs/vfsub.h | 303 ++ - fs/aufs/wbr_policy.c | 752 ++++++ - fs/aufs/whout.c | 1047 +++++++++ - fs/aufs/whout.h | 72 - fs/aufs/wkq.c | 200 + - fs/aufs/wkq.h | 80 - fs/aufs/xattr.c | 334 ++ - fs/aufs/xino.c | 1305 +++++++++++ - fs/dcache.c | 2 - fs/fcntl.c | 4 - fs/inode.c | 2 - fs/proc/base.c | 2 - fs/proc/nommu.c | 5 - fs/proc/task_mmu.c | 7 - fs/proc/task_nommu.c | 5 - fs/read_write.c | 22 - fs/splice.c | 10 - include/linux/file.h | 1 - include/linux/fs.h | 9 - include/linux/mm.h | 22 - include/linux/mm_types.h | 2 - include/linux/splice.h | 6 - include/uapi/linux/Kbuild | 1 - include/uapi/linux/aufs_type.h | 406 +++ - kernel/fork.c | 2 - mm/Makefile | 2 - mm/filemap.c | 2 - mm/memory.c | 2 - mm/mmap.c | 33 - mm/nommu.c | 10 - mm/prfile.c | 86 - 112 files changed, 33747 insertions(+), 30 deletions(-) - Documentation/ABI/testing/debugfs-aufs | 50 + - Documentation/ABI/testing/sysfs-aufs | 31 + - Documentation/filesystems/aufs/README | 392 +++++ - Documentation/filesystems/aufs/design/01intro.txt | 157 ++ - Documentation/filesystems/aufs/design/02struct.txt | 245 +++ - .../filesystems/aufs/design/03atomic_open.txt | 72 + - Documentation/filesystems/aufs/design/03lookup.txt | 100 ++ - Documentation/filesystems/aufs/design/04branch.txt | 61 + - .../filesystems/aufs/design/05wbr_policy.txt | 51 + - Documentation/filesystems/aufs/design/06fhsm.txt | 105 ++ - Documentation/filesystems/aufs/design/06mmap.txt | 59 + - Documentation/filesystems/aufs/design/06xattr.txt | 81 + - Documentation/filesystems/aufs/design/07export.txt | 45 + - Documentation/filesystems/aufs/design/08shwh.txt | 39 + - Documentation/filesystems/aufs/design/10dynop.txt | 34 + - MAINTAINERS | 13 + - drivers/block/loop.c | 18 + - fs/Kconfig | 1 + - fs/Makefile | 1 + - fs/aufs/Kconfig | 185 ++ - fs/aufs/Makefile | 36 + - fs/aufs/aufs.h | 46 + - fs/aufs/branch.c | 1399 +++++++++++++++ - fs/aufs/branch.h | 296 ++++ - fs/aufs/cpup.c | 1378 +++++++++++++++ - fs/aufs/cpup.h | 81 + - fs/aufs/dbgaufs.c | 425 +++++ - fs/aufs/dbgaufs.h | 35 + - fs/aufs/dcsub.c | 212 +++ - fs/aufs/dcsub.h | 123 ++ - fs/aufs/debug.c | 427 +++++ - fs/aufs/debug.h | 212 +++ - fs/aufs/dentry.c | 1117 ++++++++++++ - fs/aufs/dentry.h | 242 +++ - fs/aufs/dinfo.c | 540 ++++++ - fs/aufs/dir.c | 749 ++++++++ - fs/aufs/dir.h | 124 ++ - fs/aufs/dynop.c | 358 ++++ - fs/aufs/dynop.h | 61 + - fs/aufs/export.c | 824 +++++++++ - fs/aufs/f_op.c | 759 ++++++++ - fs/aufs/fhsm.c | 412 +++++ - fs/aufs/file.c | 844 +++++++++ - fs/aufs/file.h | 281 +++ - fs/aufs/finfo.c | 138 ++ - fs/aufs/fstype.h | 387 ++++ - fs/aufs/hfsnotify.c | 274 +++ - fs/aufs/hfsplus.c | 43 + - fs/aufs/hnotify.c | 710 ++++++++ - fs/aufs/i_op.c | 1438 +++++++++++++++ - fs/aufs/i_op_add.c | 911 ++++++++++ - fs/aufs/i_op_del.c | 498 ++++++ - fs/aufs/i_op_ren.c | 1002 +++++++++++ - fs/aufs/iinfo.c | 272 +++ - fs/aufs/inode.c | 506 ++++++ - fs/aufs/inode.h | 687 ++++++++ - fs/aufs/ioctl.c | 206 +++ - fs/aufs/loop.c | 134 ++ - fs/aufs/loop.h | 39 + - fs/aufs/magic.mk | 30 + - fs/aufs/module.c | 319 ++++ - fs/aufs/module.h | 143 ++ - fs/aufs/mvdown.c | 691 ++++++++ - fs/aufs/opts.c | 1847 ++++++++++++++++++++ - fs/aufs/opts.h | 198 +++ - fs/aufs/plink.c | 501 ++++++ - fs/aufs/poll.c | 39 + - fs/aufs/posix_acl.c | 85 + - fs/aufs/procfs.c | 156 ++ - fs/aufs/rdu.c | 368 ++++ - fs/aufs/rwsem.h | 185 ++ - fs/aufs/sbinfo.c | 342 ++++ - fs/aufs/spl.h | 100 ++ - fs/aufs/super.c | 1025 +++++++++++ - fs/aufs/super.h | 625 +++++++ - fs/aufs/sysaufs.c | 91 + - fs/aufs/sysaufs.h | 88 + - fs/aufs/sysfs.c | 340 ++++ - fs/aufs/sysrq.c | 144 ++ - fs/aufs/vdir.c | 887 ++++++++++ - fs/aufs/vfsub.c | 871 +++++++++ - fs/aufs/vfsub.h | 303 ++++ - fs/aufs/wbr_policy.c | 752 ++++++++ - fs/aufs/whout.c | 1047 +++++++++++ - fs/aufs/whout.h | 72 + - fs/aufs/wkq.c | 200 +++ - fs/aufs/wkq.h | 80 + - fs/aufs/xattr.c | 334 ++++ - fs/aufs/xino.c | 1305 ++++++++++++++ - fs/dcache.c | 2 +- - fs/fcntl.c | 4 +- - fs/inode.c | 2 +- - fs/proc/base.c | 2 +- - fs/proc/nommu.c | 5 +- - fs/proc/task_mmu.c | 7 +- - fs/proc/task_nommu.c | 5 +- - fs/read_write.c | 22 + - fs/splice.c | 10 +- - include/linux/file.h | 1 + - include/linux/fs.h | 9 + - include/linux/mm.h | 22 + - include/linux/mm_types.h | 2 + - include/linux/splice.h | 6 + - include/uapi/linux/Kbuild | 1 + - include/uapi/linux/aufs_type.h | 406 +++++ - kernel/fork.c | 2 +- - mm/Makefile | 2 +- - mm/filemap.c | 2 +- - mm/memory.c | 2 +- - mm/mmap.c | 33 +- - mm/nommu.c | 10 +- - mm/prfile.c | 86 + - 112 files changed, 33747 insertions(+), 30 deletions(-) - -diff --git a/Documentation/ABI/testing/debugfs-aufs b/Documentation/ABI/testing/debugfs-aufs -new file mode 100644 -index 0000000..99642d1 ---- /dev/null -+++ b/Documentation/ABI/testing/debugfs-aufs -@@ -0,0 +1,50 @@ -+What: /debug/aufs/si_/ -+Date: March 2009 -+Contact: J. R. Okajima -+Description: -+ Under /debug/aufs, a directory named si_ is created -+ per aufs mount, where is a unique id generated -+ internally. -+ -+What: /debug/aufs/si_/plink -+Date: Apr 2013 -+Contact: J. R. Okajima -+Description: -+ It has three lines and shows the information about the -+ pseudo-link. The first line is a single number -+ representing a number of buckets. The second line is a -+ number of pseudo-links per buckets (separated by a -+ blank). The last line is a single number representing a -+ total number of psedo-links. -+ When the aufs mount option 'noplink' is specified, it -+ will show "1\n0\n0\n". -+ -+What: /debug/aufs/si_/xib -+Date: March 2009 -+Contact: J. R. Okajima -+Description: -+ It shows the consumed blocks by xib (External Inode Number -+ Bitmap), its block size and file size. -+ When the aufs mount option 'noxino' is specified, it -+ will be empty. About XINO files, see the aufs manual. -+ -+What: /debug/aufs/si_/xino0, xino1 ... xinoN -+Date: March 2009 -+Contact: J. R. Okajima -+Description: -+ It shows the consumed blocks by xino (External Inode Number -+ Translation Table), its link count, block size and file -+ size. -+ When the aufs mount option 'noxino' is specified, it -+ will be empty. About XINO files, see the aufs manual. -+ -+What: /debug/aufs/si_/xigen -+Date: March 2009 -+Contact: J. R. Okajima -+Description: -+ It shows the consumed blocks by xigen (External Inode -+ Generation Table), its block size and file size. -+ If CONFIG_AUFS_EXPORT is disabled, this entry will not -+ be created. -+ When the aufs mount option 'noxino' is specified, it -+ will be empty. About XINO files, see the aufs manual. -diff --git a/Documentation/ABI/testing/sysfs-aufs b/Documentation/ABI/testing/sysfs-aufs -new file mode 100644 -index 0000000..82f9518 ---- /dev/null -+++ b/Documentation/ABI/testing/sysfs-aufs -@@ -0,0 +1,31 @@ -+What: /sys/fs/aufs/si_/ -+Date: March 2009 -+Contact: J. R. Okajima -+Description: -+ Under /sys/fs/aufs, a directory named si_ is created -+ per aufs mount, where is a unique id generated -+ internally. -+ -+What: /sys/fs/aufs/si_/br0, br1 ... brN -+Date: March 2009 -+Contact: J. R. Okajima -+Description: -+ It shows the abolute path of a member directory (which -+ is called branch) in aufs, and its permission. -+ -+What: /sys/fs/aufs/si_/brid0, brid1 ... bridN -+Date: July 2013 -+Contact: J. R. Okajima -+Description: -+ It shows the id of a member directory (which is called -+ branch) in aufs. -+ -+What: /sys/fs/aufs/si_/xi_path -+Date: March 2009 -+Contact: J. R. Okajima -+Description: -+ It shows the abolute path of XINO (External Inode Number -+ Bitmap, Translation Table and Generation Table) file -+ even if it is the default path. -+ When the aufs mount option 'noxino' is specified, it -+ will be empty. About XINO files, see the aufs manual. -diff --git a/Documentation/filesystems/aufs/README b/Documentation/filesystems/aufs/README -new file mode 100644 -index 0000000..36df674 ---- /dev/null -+++ b/Documentation/filesystems/aufs/README -@@ -0,0 +1,392 @@ -+ -+Aufs4 -- advanced multi layered unification filesystem version 4.x -+http://aufs.sf.net -+Junjiro R. Okajima -+ -+ -+0. Introduction -+---------------------------------------- -+In the early days, aufs was entirely re-designed and re-implemented -+Unionfs Version 1.x series. Adding many original ideas, approaches, -+improvements and implementations, it becomes totally different from -+Unionfs while keeping the basic features. -+Recently, Unionfs Version 2.x series begin taking some of the same -+approaches to aufs1's. -+Unionfs is being developed by Professor Erez Zadok at Stony Brook -+University and his team. -+ -+Aufs4 supports linux-4.0 and later, and for linux-3.x series try aufs3. -+If you want older kernel version support, try aufs2-2.6.git or -+aufs2-standalone.git repository, aufs1 from CVS on SourceForge. -+ -+Note: it becomes clear that "Aufs was rejected. Let's give it up." -+ According to Christoph Hellwig, linux rejects all union-type -+ filesystems but UnionMount. -+ -+ -+PS. Al Viro seems have a plan to merge aufs as well as overlayfs and -+ UnionMount, and he pointed out an issue around a directory mutex -+ lock and aufs addressed it. But it is still unsure whether aufs will -+ be merged (or any other union solution). -+ -+ -+ -+1. Features -+---------------------------------------- -+- unite several directories into a single virtual filesystem. The member -+ directory is called as a branch. -+- you can specify the permission flags to the branch, which are 'readonly', -+ 'readwrite' and 'whiteout-able.' -+- by upper writable branch, internal copyup and whiteout, files/dirs on -+ readonly branch are modifiable logically. -+- dynamic branch manipulation, add, del. -+- etc... -+ -+Also there are many enhancements in aufs, such as: -+- test only the highest one for the directory permission (dirperm1) -+- copyup on open (coo=) -+- 'move' policy for copy-up between two writable branches, after -+ checking free space. -+- xattr, acl -+- readdir(3) in userspace. -+- keep inode number by external inode number table -+- keep the timestamps of file/dir in internal copyup operation -+- seekable directory, supporting NFS readdir. -+- whiteout is hardlinked in order to reduce the consumption of inodes -+ on branch -+- do not copyup, nor create a whiteout when it is unnecessary -+- revert a single systemcall when an error occurs in aufs -+- remount interface instead of ioctl -+- maintain /etc/mtab by an external command, /sbin/mount.aufs. -+- loopback mounted filesystem as a branch -+- kernel thread for removing the dir who has a plenty of whiteouts -+- support copyup sparse file (a file which has a 'hole' in it) -+- default permission flags for branches -+- selectable permission flags for ro branch, whether whiteout can -+ exist or not -+- export via NFS. -+- support /fs/aufs and /aufs. -+- support multiple writable branches, some policies to select one -+ among multiple writable branches. -+- a new semantics for link(2) and rename(2) to support multiple -+ writable branches. -+- no glibc changes are required. -+- pseudo hardlink (hardlink over branches) -+- allow a direct access manually to a file on branch, e.g. bypassing aufs. -+ including NFS or remote filesystem branch. -+- userspace wrapper for pathconf(3)/fpathconf(3) with _PC_LINK_MAX. -+- and more... -+ -+Currently these features are dropped temporary from aufs4. -+See design/08plan.txt in detail. -+- nested mount, i.e. aufs as readonly no-whiteout branch of another aufs -+ (robr) -+- statistics of aufs thread (/sys/fs/aufs/stat) -+ -+Features or just an idea in the future (see also design/*.txt), -+- reorder the branch index without del/re-add. -+- permanent xino files for NFSD -+- an option for refreshing the opened files after add/del branches -+- light version, without branch manipulation. (unnecessary?) -+- copyup in userspace -+- inotify in userspace -+- readv/writev -+ -+ -+2. Download -+---------------------------------------- -+There are three GIT trees for aufs4, aufs4-linux.git, -+aufs4-standalone.git, and aufs-util.git. Note that there is no "4" in -+"aufs-util.git." -+While the aufs-util is always necessary, you need either of aufs4-linux -+or aufs4-standalone. -+ -+The aufs4-linux tree includes the whole linux mainline GIT tree, -+git://git.kernel.org/.../torvalds/linux.git. -+And you cannot select CONFIG_AUFS_FS=m for this version, eg. you cannot -+build aufs4 as an external kernel module. -+Several extra patches are not included in this tree. Only -+aufs4-standalone tree contains them. They are described in the later -+section "Configuration and Compilation." -+ -+On the other hand, the aufs4-standalone tree has only aufs source files -+and necessary patches, and you can select CONFIG_AUFS_FS=m. -+But you need to apply all aufs patches manually. -+ -+You will find GIT branches whose name is in form of "aufs4.x" where "x" -+represents the linux kernel version, "linux-4.x". For instance, -+"aufs4.0" is for linux-4.0. For latest "linux-4.x-rcN", use -+"aufs4.x-rcN" branch. -+ -+o aufs4-linux tree -+$ git clone --reference /your/linux/git/tree \ -+ git://github.com/sfjro/aufs4-linux.git aufs4-linux.git -+- if you don't have linux GIT tree, then remove "--reference ..." -+$ cd aufs4-linux.git -+$ git checkout origin/aufs4.0 -+ -+Or You may want to directly git-pull aufs into your linux GIT tree, and -+leave the patch-work to GIT. -+$ cd /your/linux/git/tree -+$ git remote add aufs4 git://github.com/sfjro/aufs4-linux.git -+$ git fetch aufs4 -+$ git checkout -b my4.0 v4.0 -+$ (add your local change...) -+$ git pull aufs4 aufs4.0 -+- now you have v4.0 + your_changes + aufs4.0 in you my4.0 branch. -+- you may need to solve some conflicts between your_changes and -+ aufs4.0. in this case, git-rerere is recommended so that you can -+ solve the similar conflicts automatically when you upgrade to 4.1 or -+ later in the future. -+ -+o aufs4-standalone tree -+$ git clone git://github.com/sfjro/aufs4-standalone.git aufs4-standalone.git -+$ cd aufs4-standalone.git -+$ git checkout origin/aufs4.0 -+ -+o aufs-util tree -+$ git clone git://git.code.sf.net/p/aufs/aufs-util aufs-util.git -+- note that the public aufs-util.git is on SourceForge instead of -+ GitHUB. -+$ cd aufs-util.git -+$ git checkout origin/aufs4.0 -+ -+Note: The 4.x-rcN branch is to be used with `rc' kernel versions ONLY. -+The minor version number, 'x' in '4.x', of aufs may not always -+follow the minor version number of the kernel. -+Because changes in the kernel that cause the use of a new -+minor version number do not always require changes to aufs-util. -+ -+Since aufs-util has its own minor version number, you may not be -+able to find a GIT branch in aufs-util for your kernel's -+exact minor version number. -+In this case, you should git-checkout the branch for the -+nearest lower number. -+ -+For (an unreleased) example: -+If you are using "linux-4.10" and the "aufs4.10" branch -+does not exist in aufs-util repository, then "aufs4.9", "aufs4.8" -+or something numerically smaller is the branch for your kernel. -+ -+Also you can view all branches by -+ $ git branch -a -+ -+ -+3. Configuration and Compilation -+---------------------------------------- -+Make sure you have git-checkout'ed the correct branch. -+ -+For aufs4-linux tree, -+- enable CONFIG_AUFS_FS. -+- set other aufs configurations if necessary. -+ -+For aufs4-standalone tree, -+There are several ways to build. -+ -+1. -+- apply ./aufs4-kbuild.patch to your kernel source files. -+- apply ./aufs4-base.patch too. -+- apply ./aufs4-mmap.patch too. -+- apply ./aufs4-standalone.patch too, if you have a plan to set -+ CONFIG_AUFS_FS=m. otherwise you don't need ./aufs4-standalone.patch. -+- copy ./{Documentation,fs,include/uapi/linux/aufs_type.h} files to your -+ kernel source tree. Never copy $PWD/include/uapi/linux/Kbuild. -+- enable CONFIG_AUFS_FS, you can select either -+ =m or =y. -+- and build your kernel as usual. -+- install the built kernel. -+ Note: Since linux-3.9, every filesystem module requires an alias -+ "fs-". You should make sure that "fs-aufs" is listed in your -+ modules.aliases file if you set CONFIG_AUFS_FS=m. -+- install the header files too by "make headers_install" to the -+ directory where you specify. By default, it is $PWD/usr. -+ "make help" shows a brief note for headers_install. -+- and reboot your system. -+ -+2. -+- module only (CONFIG_AUFS_FS=m). -+- apply ./aufs4-base.patch to your kernel source files. -+- apply ./aufs4-mmap.patch too. -+- apply ./aufs4-standalone.patch too. -+- build your kernel, don't forget "make headers_install", and reboot. -+- edit ./config.mk and set other aufs configurations if necessary. -+ Note: You should read $PWD/fs/aufs/Kconfig carefully which describes -+ every aufs configurations. -+- build the module by simple "make". -+ Note: Since linux-3.9, every filesystem module requires an alias -+ "fs-". You should make sure that "fs-aufs" is listed in your -+ modules.aliases file. -+- you can specify ${KDIR} make variable which points to your kernel -+ source tree. -+- install the files -+ + run "make install" to install the aufs module, or copy the built -+ $PWD/aufs.ko to /lib/modules/... and run depmod -a (or reboot simply). -+ + run "make install_headers" (instead of headers_install) to install -+ the modified aufs header file (you can specify DESTDIR which is -+ available in aufs standalone version's Makefile only), or copy -+ $PWD/usr/include/linux/aufs_type.h to /usr/include/linux or wherever -+ you like manually. By default, the target directory is $PWD/usr. -+- no need to apply aufs4-kbuild.patch, nor copying source files to your -+ kernel source tree. -+ -+Note: The header file aufs_type.h is necessary to build aufs-util -+ as well as "make headers_install" in the kernel source tree. -+ headers_install is subject to be forgotten, but it is essentially -+ necessary, not only for building aufs-util. -+ You may not meet problems without headers_install in some older -+ version though. -+ -+And then, -+- read README in aufs-util, build and install it -+- note that your distribution may contain an obsoleted version of -+ aufs_type.h in /usr/include/linux or something. When you build aufs -+ utilities, make sure that your compiler refers the correct aufs header -+ file which is built by "make headers_install." -+- if you want to use readdir(3) in userspace or pathconf(3) wrapper, -+ then run "make install_ulib" too. And refer to the aufs manual in -+ detail. -+ -+There several other patches in aufs4-standalone.git. They are all -+optional. When you meet some problems, they will help you. -+- aufs4-loopback.patch -+ Supports a nested loopback mount in a branch-fs. This patch is -+ unnecessary until aufs produces a message like "you may want to try -+ another patch for loopback file". -+- vfs-ino.patch -+ Modifies a system global kernel internal function get_next_ino() in -+ order to stop assigning 0 for an inode-number. Not directly related to -+ aufs, but recommended generally. -+- tmpfs-idr.patch -+ Keeps the tmpfs inode number as the lowest value. Effective to reduce -+ the size of aufs XINO files for tmpfs branch. Also it prevents the -+ duplication of inode number, which is important for backup tools and -+ other utilities. When you find aufs XINO files for tmpfs branch -+ growing too much, try this patch. -+- lockdep-debug.patch -+ Because aufs is not only an ordinary filesystem (callee of VFS), but -+ also a caller of VFS functions for branch filesystems, subclassing of -+ the internal locks for LOCKDEP is necessary. LOCKDEP is a debugging -+ feature of linux kernel. If you enable CONFIG_LOCKDEP, then you will -+ need to apply this debug patch to expand several constant values. -+ If don't know what LOCKDEP, then you don't have apply this patch. -+ -+ -+4. Usage -+---------------------------------------- -+At first, make sure aufs-util are installed, and please read the aufs -+manual, aufs.5 in aufs-util.git tree. -+$ man -l aufs.5 -+ -+And then, -+$ mkdir /tmp/rw /tmp/aufs -+# mount -t aufs -o br=/tmp/rw:${HOME} none /tmp/aufs -+ -+Here is another example. The result is equivalent. -+# mount -t aufs -o br=/tmp/rw=rw:${HOME}=ro none /tmp/aufs -+ Or -+# mount -t aufs -o br:/tmp/rw none /tmp/aufs -+# mount -o remount,append:${HOME} /tmp/aufs -+ -+Then, you can see whole tree of your home dir through /tmp/aufs. If -+you modify a file under /tmp/aufs, the one on your home directory is -+not affected, instead the same named file will be newly created under -+/tmp/rw. And all of your modification to a file will be applied to -+the one under /tmp/rw. This is called the file based Copy on Write -+(COW) method. -+Aufs mount options are described in aufs.5. -+If you run chroot or something and make your aufs as a root directory, -+then you need to customize the shutdown script. See the aufs manual in -+detail. -+ -+Additionally, there are some sample usages of aufs which are a -+diskless system with network booting, and LiveCD over NFS. -+See sample dir in CVS tree on SourceForge. -+ -+ -+5. Contact -+---------------------------------------- -+When you have any problems or strange behaviour in aufs, please let me -+know with: -+- /proc/mounts (instead of the output of mount(8)) -+- /sys/module/aufs/* -+- /sys/fs/aufs/* (if you have them) -+- /debug/aufs/* (if you have them) -+- linux kernel version -+ if your kernel is not plain, for example modified by distributor, -+ the url where i can download its source is necessary too. -+- aufs version which was printed at loading the module or booting the -+ system, instead of the date you downloaded. -+- configuration (define/undefine CONFIG_AUFS_xxx) -+- kernel configuration or /proc/config.gz (if you have it) -+- behaviour which you think to be incorrect -+- actual operation, reproducible one is better -+- mailto: aufs-users at lists.sourceforge.net -+ -+Usually, I don't watch the Public Areas(Bugs, Support Requests, Patches, -+and Feature Requests) on SourceForge. Please join and write to -+aufs-users ML. -+ -+ -+6. Acknowledgements -+---------------------------------------- -+Thanks to everyone who have tried and are using aufs, whoever -+have reported a bug or any feedback. -+ -+Especially donators: -+Tomas Matejicek(slax.org) made a donation (much more than once). -+ Since Apr 2010, Tomas M (the author of Slax and Linux Live -+ scripts) is making "doubling" donations. -+ Unfortunately I cannot list all of the donators, but I really -+ appreciate. -+ It ends Aug 2010, but the ordinary donation URL is still available. -+ -+Dai Itasaka made a donation (2007/8). -+Chuck Smith made a donation (2008/4, 10 and 12). -+Henk Schoneveld made a donation (2008/9). -+Chih-Wei Huang, ASUS, CTC donated Eee PC 4G (2008/10). -+Francois Dupoux made a donation (2008/11). -+Bruno Cesar Ribas and Luis Carlos Erpen de Bona, C3SL serves public -+ aufs2 GIT tree (2009/2). -+William Grant made a donation (2009/3). -+Patrick Lane made a donation (2009/4). -+The Mail Archive (mail-archive.com) made donations (2009/5). -+Nippy Networks (Ed Wildgoose) made a donation (2009/7). -+New Dream Network, LLC (www.dreamhost.com) made a donation (2009/11). -+Pavel Pronskiy made a donation (2011/2). -+Iridium and Inmarsat satellite phone retailer (www.mailasail.com), Nippy -+ Networks (Ed Wildgoose) made a donation for hardware (2011/3). -+Max Lekomcev (DOM-TV project) made a donation (2011/7, 12, 2012/3, 6 and -+11). -+Sam Liddicott made a donation (2011/9). -+Era Scarecrow made a donation (2013/4). -+Bor Ratajc made a donation (2013/4). -+Alessandro Gorreta made a donation (2013/4). -+POIRETTE Marc made a donation (2013/4). -+Alessandro Gorreta made a donation (2013/4). -+lauri kasvandik made a donation (2013/5). -+"pemasu from Finland" made a donation (2013/7). -+The Parted Magic Project made a donation (2013/9 and 11). -+Pavel Barta made a donation (2013/10). -+Nikolay Pertsev made a donation (2014/5). -+James B made a donation (2014/7 and 2015/7). -+Stefano Di Biase made a donation (2014/8). -+Daniel Epellei made a donation (2015/1). -+OmegaPhil made a donation (2016/1). -+Tomasz Szewczyk made a donation (2016/4). -+ -+Thank you very much. -+Donations are always, including future donations, very important and -+helpful for me to keep on developing aufs. -+ -+ -+7. -+---------------------------------------- -+If you are an experienced user, no explanation is needed. Aufs is -+just a linux filesystem. -+ -+ -+Enjoy! -+ -+# Local variables: ; -+# mode: text; -+# End: ; -diff --git a/Documentation/filesystems/aufs/design/01intro.txt b/Documentation/filesystems/aufs/design/01intro.txt -new file mode 100644 -index 0000000..5d01214 ---- /dev/null -+++ b/Documentation/filesystems/aufs/design/01intro.txt -@@ -0,0 +1,157 @@ -+ -+# Copyright (C) 2005-2016 Junjiro R. Okajima -+ -+Introduction -+---------------------------------------- -+ -+aufs [ei ju: ef es] | [a u f s] -+1. abbrev. for "advanced multi-layered unification filesystem". -+2. abbrev. for "another unionfs". -+3. abbrev. for "auf das" in German which means "on the" in English. -+ Ex. "Butter aufs Brot"(G) means "butter onto bread"(E). -+ But "Filesystem aufs Filesystem" is hard to understand. -+ -+AUFS is a filesystem with features: -+- multi layered stackable unification filesystem, the member directory -+ is called as a branch. -+- branch permission and attribute, 'readonly', 'real-readonly', -+ 'readwrite', 'whiteout-able', 'link-able whiteout', etc. and their -+ combination. -+- internal "file copy-on-write". -+- logical deletion, whiteout. -+- dynamic branch manipulation, adding, deleting and changing permission. -+- allow bypassing aufs, user's direct branch access. -+- external inode number translation table and bitmap which maintains the -+ persistent aufs inode number. -+- seekable directory, including NFS readdir. -+- file mapping, mmap and sharing pages. -+- pseudo-link, hardlink over branches. -+- loopback mounted filesystem as a branch. -+- several policies to select one among multiple writable branches. -+- revert a single systemcall when an error occurs in aufs. -+- and more... -+ -+ -+Multi Layered Stackable Unification Filesystem -+---------------------------------------------------------------------- -+Most people already knows what it is. -+It is a filesystem which unifies several directories and provides a -+merged single directory. When users access a file, the access will be -+passed/re-directed/converted (sorry, I am not sure which English word is -+correct) to the real file on the member filesystem. The member -+filesystem is called 'lower filesystem' or 'branch' and has a mode -+'readonly' and 'readwrite.' And the deletion for a file on the lower -+readonly branch is handled by creating 'whiteout' on the upper writable -+branch. -+ -+On LKML, there have been discussions about UnionMount (Jan Blunck, -+Bharata B Rao and Valerie Aurora) and Unionfs (Erez Zadok). They took -+different approaches to implement the merged-view. -+The former tries putting it into VFS, and the latter implements as a -+separate filesystem. -+(If I misunderstand about these implementations, please let me know and -+I shall correct it. Because it is a long time ago when I read their -+source files last time). -+ -+UnionMount's approach will be able to small, but may be hard to share -+branches between several UnionMount since the whiteout in it is -+implemented in the inode on branch filesystem and always -+shared. According to Bharata's post, readdir does not seems to be -+finished yet. -+There are several missing features known in this implementations such as -+- for users, the inode number may change silently. eg. copy-up. -+- link(2) may break by copy-up. -+- read(2) may get an obsoleted filedata (fstat(2) too). -+- fcntl(F_SETLK) may be broken by copy-up. -+- unnecessary copy-up may happen, for example mmap(MAP_PRIVATE) after -+ open(O_RDWR). -+ -+In linux-3.18, "overlay" filesystem (formerly known as "overlayfs") was -+merged into mainline. This is another implementation of UnionMount as a -+separated filesystem. All the limitations and known problems which -+UnionMount are equally inherited to "overlay" filesystem. -+ -+Unionfs has a longer history. When I started implementing a stackable -+filesystem (Aug 2005), it already existed. It has virtual super_block, -+inode, dentry and file objects and they have an array pointing lower -+same kind objects. After contributing many patches for Unionfs, I -+re-started my project AUFS (Jun 2006). -+ -+In AUFS, the structure of filesystem resembles to Unionfs, but I -+implemented my own ideas, approaches and enhancements and it became -+totally different one. -+ -+Comparing DM snapshot and fs based implementation -+- the number of bytes to be copied between devices is much smaller. -+- the type of filesystem must be one and only. -+- the fs must be writable, no readonly fs, even for the lower original -+ device. so the compression fs will not be usable. but if we use -+ loopback mount, we may address this issue. -+ for instance, -+ mount /cdrom/squashfs.img /sq -+ losetup /sq/ext2.img -+ losetup /somewhere/cow -+ dmsetup "snapshot /dev/loop0 /dev/loop1 ..." -+- it will be difficult (or needs more operations) to extract the -+ difference between the original device and COW. -+- DM snapshot-merge may help a lot when users try merging. in the -+ fs-layer union, users will use rsync(1). -+ -+You may want to read my old paper "Filesystems in LiveCD" -+(http://aufs.sourceforge.net/aufs2/report/sq/sq.pdf). -+ -+ -+Several characters/aspects/persona of aufs -+---------------------------------------------------------------------- -+ -+Aufs has several characters, aspects or persona. -+1. a filesystem, callee of VFS helper -+2. sub-VFS, caller of VFS helper for branches -+3. a virtual filesystem which maintains persistent inode number -+4. reader/writer of files on branches such like an application -+ -+1. Callee of VFS Helper -+As an ordinary linux filesystem, aufs is a callee of VFS. For instance, -+unlink(2) from an application reaches sys_unlink() kernel function and -+then vfs_unlink() is called. vfs_unlink() is one of VFS helper and it -+calls filesystem specific unlink operation. Actually aufs implements the -+unlink operation but it behaves like a redirector. -+ -+2. Caller of VFS Helper for Branches -+aufs_unlink() passes the unlink request to the branch filesystem as if -+it were called from VFS. So the called unlink operation of the branch -+filesystem acts as usual. As a caller of VFS helper, aufs should handle -+every necessary pre/post operation for the branch filesystem. -+- acquire the lock for the parent dir on a branch -+- lookup in a branch -+- revalidate dentry on a branch -+- mnt_want_write() for a branch -+- vfs_unlink() for a branch -+- mnt_drop_write() for a branch -+- release the lock on a branch -+ -+3. Persistent Inode Number -+One of the most important issue for a filesystem is to maintain inode -+numbers. This is particularly important to support exporting a -+filesystem via NFS. Aufs is a virtual filesystem which doesn't have a -+backend block device for its own. But some storage is necessary to -+keep and maintain the inode numbers. It may be a large space and may not -+suit to keep in memory. Aufs rents some space from its first writable -+branch filesystem (by default) and creates file(s) on it. These files -+are created by aufs internally and removed soon (currently) keeping -+opened. -+Note: Because these files are removed, they are totally gone after -+ unmounting aufs. It means the inode numbers are not persistent -+ across unmount or reboot. I have a plan to make them really -+ persistent which will be important for aufs on NFS server. -+ -+4. Read/Write Files Internally (copy-on-write) -+Because a branch can be readonly, when you write a file on it, aufs will -+"copy-up" it to the upper writable branch internally. And then write the -+originally requested thing to the file. Generally kernel doesn't -+open/read/write file actively. In aufs, even a single write may cause a -+internal "file copy". This behaviour is very similar to cp(1) command. -+ -+Some people may think it is better to pass such work to user space -+helper, instead of doing in kernel space. Actually I am still thinking -+about it. But currently I have implemented it in kernel space. -diff --git a/Documentation/filesystems/aufs/design/02struct.txt b/Documentation/filesystems/aufs/design/02struct.txt -new file mode 100644 -index 0000000..783328a ---- /dev/null -+++ b/Documentation/filesystems/aufs/design/02struct.txt -@@ -0,0 +1,245 @@ -+ -+# Copyright (C) 2005-2016 Junjiro R. Okajima -+ -+Basic Aufs Internal Structure -+ -+Superblock/Inode/Dentry/File Objects -+---------------------------------------------------------------------- -+As like an ordinary filesystem, aufs has its own -+superblock/inode/dentry/file objects. All these objects have a -+dynamically allocated array and store the same kind of pointers to the -+lower filesystem, branch. -+For example, when you build a union with one readwrite branch and one -+readonly, mounted /au, /rw and /ro respectively. -+- /au = /rw + /ro -+- /ro/fileA exists but /rw/fileA -+ -+Aufs lookup operation finds /ro/fileA and gets dentry for that. These -+pointers are stored in a aufs dentry. The array in aufs dentry will be, -+- [0] = NULL (because /rw/fileA doesn't exist) -+- [1] = /ro/fileA -+ -+This style of an array is essentially same to the aufs -+superblock/inode/dentry/file objects. -+ -+Because aufs supports manipulating branches, ie. add/delete/change -+branches dynamically, these objects has its own generation. When -+branches are changed, the generation in aufs superblock is -+incremented. And a generation in other object are compared when it is -+accessed. When a generation in other objects are obsoleted, aufs -+refreshes the internal array. -+ -+ -+Superblock -+---------------------------------------------------------------------- -+Additionally aufs superblock has some data for policies to select one -+among multiple writable branches, XIB files, pseudo-links and kobject. -+See below in detail. -+About the policies which supports copy-down a directory, see -+wbr_policy.txt too. -+ -+ -+Branch and XINO(External Inode Number Translation Table) -+---------------------------------------------------------------------- -+Every branch has its own xino (external inode number translation table) -+file. The xino file is created and unlinked by aufs internally. When two -+members of a union exist on the same filesystem, they share the single -+xino file. -+The struct of a xino file is simple, just a sequence of aufs inode -+numbers which is indexed by the lower inode number. -+In the above sample, assume the inode number of /ro/fileA is i111 and -+aufs assigns the inode number i999 for fileA. Then aufs writes 999 as -+4(8) bytes at 111 * 4(8) bytes offset in the xino file. -+ -+When the inode numbers are not contiguous, the xino file will be sparse -+which has a hole in it and doesn't consume as much disk space as it -+might appear. If your branch filesystem consumes disk space for such -+holes, then you should specify 'xino=' option at mounting aufs. -+ -+Aufs has a mount option to free the disk blocks for such holes in XINO -+files on tmpfs or ramdisk. But it is not so effective actually. If you -+meet a problem of disk shortage due to XINO files, then you should try -+"tmpfs-ino.patch" (and "vfs-ino.patch" too) in aufs4-standalone.git. -+The patch localizes the assignment inumbers per tmpfs-mount and avoid -+the holes in XINO files. -+ -+Also a writable branch has three kinds of "whiteout bases". All these -+are existed when the branch is joined to aufs, and their names are -+whiteout-ed doubly, so that users will never see their names in aufs -+hierarchy. -+1. a regular file which will be hardlinked to all whiteouts. -+2. a directory to store a pseudo-link. -+3. a directory to store an "orphan"-ed file temporary. -+ -+1. Whiteout Base -+ When you remove a file on a readonly branch, aufs handles it as a -+ logical deletion and creates a whiteout on the upper writable branch -+ as a hardlink of this file in order not to consume inode on the -+ writable branch. -+2. Pseudo-link Dir -+ See below, Pseudo-link. -+3. Step-Parent Dir -+ When "fileC" exists on the lower readonly branch only and it is -+ opened and removed with its parent dir, and then user writes -+ something into it, then aufs copies-up fileC to this -+ directory. Because there is no other dir to store fileC. After -+ creating a file under this dir, the file is unlinked. -+ -+Because aufs supports manipulating branches, ie. add/delete/change -+dynamically, a branch has its own id. When the branch order changes, -+aufs finds the new index by searching the branch id. -+ -+ -+Pseudo-link -+---------------------------------------------------------------------- -+Assume "fileA" exists on the lower readonly branch only and it is -+hardlinked to "fileB" on the branch. When you write something to fileA, -+aufs copies-up it to the upper writable branch. Additionally aufs -+creates a hardlink under the Pseudo-link Directory of the writable -+branch. The inode of a pseudo-link is kept in aufs super_block as a -+simple list. If fileB is read after unlinking fileA, aufs returns -+filedata from the pseudo-link instead of the lower readonly -+branch. Because the pseudo-link is based upon the inode, to keep the -+inode number by xino (see above) is essentially necessary. -+ -+All the hardlinks under the Pseudo-link Directory of the writable branch -+should be restored in a proper location later. Aufs provides a utility -+to do this. The userspace helpers executed at remounting and unmounting -+aufs by default. -+During this utility is running, it puts aufs into the pseudo-link -+maintenance mode. In this mode, only the process which began the -+maintenance mode (and its child processes) is allowed to operate in -+aufs. Some other processes which are not related to the pseudo-link will -+be allowed to run too, but the rest have to return an error or wait -+until the maintenance mode ends. If a process already acquires an inode -+mutex (in VFS), it has to return an error. -+ -+ -+XIB(external inode number bitmap) -+---------------------------------------------------------------------- -+Addition to the xino file per a branch, aufs has an external inode number -+bitmap in a superblock object. It is also an internal file such like a -+xino file. -+It is a simple bitmap to mark whether the aufs inode number is in-use or -+not. -+To reduce the file I/O, aufs prepares a single memory page to cache xib. -+ -+As well as XINO files, aufs has a feature to truncate/refresh XIB to -+reduce the number of consumed disk blocks for these files. -+ -+ -+Virtual or Vertical Dir, and Readdir in Userspace -+---------------------------------------------------------------------- -+In order to support multiple layers (branches), aufs readdir operation -+constructs a virtual dir block on memory. For readdir, aufs calls -+vfs_readdir() internally for each dir on branches, merges their entries -+with eliminating the whiteout-ed ones, and sets it to file (dir) -+object. So the file object has its entry list until it is closed. The -+entry list will be updated when the file position is zero and becomes -+obsoleted. This decision is made in aufs automatically. -+ -+The dynamically allocated memory block for the name of entries has a -+unit of 512 bytes (by default) and stores the names contiguously (no -+padding). Another block for each entry is handled by kmem_cache too. -+During building dir blocks, aufs creates hash list and judging whether -+the entry is whiteouted by its upper branch or already listed. -+The merged result is cached in the corresponding inode object and -+maintained by a customizable life-time option. -+ -+Some people may call it can be a security hole or invite DoS attack -+since the opened and once readdir-ed dir (file object) holds its entry -+list and becomes a pressure for system memory. But I'd say it is similar -+to files under /proc or /sys. The virtual files in them also holds a -+memory page (generally) while they are opened. When an idea to reduce -+memory for them is introduced, it will be applied to aufs too. -+For those who really hate this situation, I've developed readdir(3) -+library which operates this merging in userspace. You just need to set -+LD_PRELOAD environment variable, and aufs will not consume no memory in -+kernel space for readdir(3). -+ -+ -+Workqueue -+---------------------------------------------------------------------- -+Aufs sometimes requires privilege access to a branch. For instance, -+in copy-up/down operation. When a user process is going to make changes -+to a file which exists in the lower readonly branch only, and the mode -+of one of ancestor directories may not be writable by a user -+process. Here aufs copy-up the file with its ancestors and they may -+require privilege to set its owner/group/mode/etc. -+This is a typical case of a application character of aufs (see -+Introduction). -+ -+Aufs uses workqueue synchronously for this case. It creates its own -+workqueue. The workqueue is a kernel thread and has privilege. Aufs -+passes the request to call mkdir or write (for example), and wait for -+its completion. This approach solves a problem of a signal handler -+simply. -+If aufs didn't adopt the workqueue and changed the privilege of the -+process, then the process may receive the unexpected SIGXFSZ or other -+signals. -+ -+Also aufs uses the system global workqueue ("events" kernel thread) too -+for asynchronous tasks, such like handling inotify/fsnotify, re-creating a -+whiteout base and etc. This is unrelated to a privilege. -+Most of aufs operation tries acquiring a rw_semaphore for aufs -+superblock at the beginning, at the same time waits for the completion -+of all queued asynchronous tasks. -+ -+ -+Whiteout -+---------------------------------------------------------------------- -+The whiteout in aufs is very similar to Unionfs's. That is represented -+by its filename. UnionMount takes an approach of a file mode, but I am -+afraid several utilities (find(1) or something) will have to support it. -+ -+Basically the whiteout represents "logical deletion" which stops aufs to -+lookup further, but also it represents "dir is opaque" which also stop -+further lookup. -+ -+In aufs, rmdir(2) and rename(2) for dir uses whiteout alternatively. -+In order to make several functions in a single systemcall to be -+revertible, aufs adopts an approach to rename a directory to a temporary -+unique whiteouted name. -+For example, in rename(2) dir where the target dir already existed, aufs -+renames the target dir to a temporary unique whiteouted name before the -+actual rename on a branch, and then handles other actions (make it opaque, -+update the attributes, etc). If an error happens in these actions, aufs -+simply renames the whiteouted name back and returns an error. If all are -+succeeded, aufs registers a function to remove the whiteouted unique -+temporary name completely and asynchronously to the system global -+workqueue. -+ -+ -+Copy-up -+---------------------------------------------------------------------- -+It is a well-known feature or concept. -+When user modifies a file on a readonly branch, aufs operate "copy-up" -+internally and makes change to the new file on the upper writable branch. -+When the trigger systemcall does not update the timestamps of the parent -+dir, aufs reverts it after copy-up. -+ -+ -+Move-down (aufs3.9 and later) -+---------------------------------------------------------------------- -+"Copy-up" is one of the essential feature in aufs. It copies a file from -+the lower readonly branch to the upper writable branch when a user -+changes something about the file. -+"Move-down" is an opposite action of copy-up. Basically this action is -+ran manually instead of automatically and internally. -+For desgin and implementation, aufs has to consider these issues. -+- whiteout for the file may exist on the lower branch. -+- ancestor directories may not exist on the lower branch. -+- diropq for the ancestor directories may exist on the upper branch. -+- free space on the lower branch will reduce. -+- another access to the file may happen during moving-down, including -+ UDBA (see "Revalidate Dentry and UDBA"). -+- the file should not be hard-linked nor pseudo-linked. they should be -+ handled by auplink utility later. -+ -+Sometimes users want to move-down a file from the upper writable branch -+to the lower readonly or writable branch. For instance, -+- the free space of the upper writable branch is going to run out. -+- create a new intermediate branch between the upper and lower branch. -+- etc. -+ -+For this purpose, use "aumvdown" command in aufs-util.git. -diff --git a/Documentation/filesystems/aufs/design/03atomic_open.txt b/Documentation/filesystems/aufs/design/03atomic_open.txt -new file mode 100644 -index 0000000..741ad6d ---- /dev/null -+++ b/Documentation/filesystems/aufs/design/03atomic_open.txt -@@ -0,0 +1,72 @@ -+ -+# Copyright (C) 2015-2016 Junjiro R. Okajima -+ -+Support for a branch who has its ->atomic_open() -+---------------------------------------------------------------------- -+The filesystems who implement its ->atomic_open() are not majority. For -+example NFSv4 does, and aufs should call NFSv4 ->atomic_open, -+particularly for open(O_CREAT|O_EXCL, 0400) case. Other than -+->atomic_open(), NFSv4 returns an error for this open(2). While I am not -+sure whether all filesystems who have ->atomic_open() behave like this, -+but NFSv4 surely returns the error. -+ -+In order to support ->atomic_open() for aufs, there are a few -+approaches. -+ -+A. Introduce aufs_atomic_open() -+ - calls one of VFS:do_last(), lookup_open() or atomic_open() for -+ branch fs. -+B. Introduce aufs_atomic_open() calling create, open and chmod. this is -+ an aufs user Pip Cet's approach -+ - calls aufs_create(), VFS finish_open() and notify_change(). -+ - pass fake-mode to finish_open(), and then correct the mode by -+ notify_change(). -+C. Extend aufs_open() to call branch fs's ->atomic_open() -+ - no aufs_atomic_open(). -+ - aufs_lookup() registers the TID to an aufs internal object. -+ - aufs_create() does nothing when the matching TID is registered, but -+ registers the mode. -+ - aufs_open() calls branch fs's ->atomic_open() when the matching -+ TID is registered. -+D. Extend aufs_open() to re-try branch fs's ->open() with superuser's -+ credential -+ - no aufs_atomic_open(). -+ - aufs_create() registers the TID to an internal object. this info -+ represents "this process created this file just now." -+ - when aufs gets EACCES from branch fs's ->open(), then confirm the -+ registered TID and re-try open() with superuser's credential. -+ -+Pros and cons for each approach. -+ -+A. -+ - straightforward but highly depends upon VFS internal. -+ - the atomic behavaiour is kept. -+ - some of parameters such as nameidata are hard to reproduce for -+ branch fs. -+ - large overhead. -+B. -+ - easy to implement. -+ - the atomic behavaiour is lost. -+C. -+ - the atomic behavaiour is kept. -+ - dirty and tricky. -+ - VFS checks whether the file is created correctly after calling -+ ->create(), which means this approach doesn't work. -+D. -+ - easy to implement. -+ - the atomic behavaiour is lost. -+ - to open a file with superuser's credential and give it to a user -+ process is a bad idea, since the file object keeps the credential -+ in it. It may affect LSM or something. This approach doesn't work -+ either. -+ -+The approach A is ideal, but it hard to implement. So here is a -+variation of A, which is to be implemented. -+ -+A-1. Introduce aufs_atomic_open() -+ - calls branch fs ->atomic_open() if exists. otherwise calls -+ vfs_create() and finish_open(). -+ - the demerit is that the several checks after branch fs -+ ->atomic_open() are lost. in the ordinary case, the checks are -+ done by VFS:do_last(), lookup_open() and atomic_open(). some can -+ be implemented in aufs, but not all I am afraid. -diff --git a/Documentation/filesystems/aufs/design/03lookup.txt b/Documentation/filesystems/aufs/design/03lookup.txt -new file mode 100644 -index 0000000..5b6b000 ---- /dev/null -+++ b/Documentation/filesystems/aufs/design/03lookup.txt -@@ -0,0 +1,100 @@ -+ -+# Copyright (C) 2005-2016 Junjiro R. Okajima -+ -+Lookup in a Branch -+---------------------------------------------------------------------- -+Since aufs has a character of sub-VFS (see Introduction), it operates -+lookup for branches as VFS does. It may be a heavy work. But almost all -+lookup operation in aufs is the simplest case, ie. lookup only an entry -+directly connected to its parent. Digging down the directory hierarchy -+is unnecessary. VFS has a function lookup_one_len() for that use, and -+aufs calls it. -+ -+When a branch is a remote filesystem, aufs basically relies upon its -+->d_revalidate(), also aufs forces the hardest revalidate tests for -+them. -+For d_revalidate, aufs implements three levels of revalidate tests. See -+"Revalidate Dentry and UDBA" in detail. -+ -+ -+Test Only the Highest One for the Directory Permission (dirperm1 option) -+---------------------------------------------------------------------- -+Let's try case study. -+- aufs has two branches, upper readwrite and lower readonly. -+ /au = /rw + /ro -+- "dirA" exists under /ro, but /rw. and its mode is 0700. -+- user invoked "chmod a+rx /au/dirA" -+- the internal copy-up is activated and "/rw/dirA" is created and its -+ permission bits are set to world readable. -+- then "/au/dirA" becomes world readable? -+ -+In this case, /ro/dirA is still 0700 since it exists in readonly branch, -+or it may be a natively readonly filesystem. If aufs respects the lower -+branch, it should not respond readdir request from other users. But user -+allowed it by chmod. Should really aufs rejects showing the entries -+under /ro/dirA? -+ -+To be honest, I don't have a good solution for this case. So aufs -+implements 'dirperm1' and 'nodirperm1' mount options, and leave it to -+users. -+When dirperm1 is specified, aufs checks only the highest one for the -+directory permission, and shows the entries. Otherwise, as usual, checks -+every dir existing on all branches and rejects the request. -+ -+As a side effect, dirperm1 option improves the performance of aufs -+because the number of permission check is reduced when the number of -+branch is many. -+ -+ -+Revalidate Dentry and UDBA (User's Direct Branch Access) -+---------------------------------------------------------------------- -+Generally VFS helpers re-validate a dentry as a part of lookup. -+0. digging down the directory hierarchy. -+1. lock the parent dir by its i_mutex. -+2. lookup the final (child) entry. -+3. revalidate it. -+4. call the actual operation (create, unlink, etc.) -+5. unlock the parent dir -+ -+If the filesystem implements its ->d_revalidate() (step 3), then it is -+called. Actually aufs implements it and checks the dentry on a branch is -+still valid. -+But it is not enough. Because aufs has to release the lock for the -+parent dir on a branch at the end of ->lookup() (step 2) and -+->d_revalidate() (step 3) while the i_mutex of the aufs dir is still -+held by VFS. -+If the file on a branch is changed directly, eg. bypassing aufs, after -+aufs released the lock, then the subsequent operation may cause -+something unpleasant result. -+ -+This situation is a result of VFS architecture, ->lookup() and -+->d_revalidate() is separated. But I never say it is wrong. It is a good -+design from VFS's point of view. It is just not suitable for sub-VFS -+character in aufs. -+ -+Aufs supports such case by three level of revalidation which is -+selectable by user. -+1. Simple Revalidate -+ Addition to the native flow in VFS's, confirm the child-parent -+ relationship on the branch just after locking the parent dir on the -+ branch in the "actual operation" (step 4). When this validation -+ fails, aufs returns EBUSY. ->d_revalidate() (step 3) in aufs still -+ checks the validation of the dentry on branches. -+2. Monitor Changes Internally by Inotify/Fsnotify -+ Addition to above, in the "actual operation" (step 4) aufs re-lookup -+ the dentry on the branch, and returns EBUSY if it finds different -+ dentry. -+ Additionally, aufs sets the inotify/fsnotify watch for every dir on branches -+ during it is in cache. When the event is notified, aufs registers a -+ function to kernel 'events' thread by schedule_work(). And the -+ function sets some special status to the cached aufs dentry and inode -+ private data. If they are not cached, then aufs has nothing to -+ do. When the same file is accessed through aufs (step 0-3) later, -+ aufs will detect the status and refresh all necessary data. -+ In this mode, aufs has to ignore the event which is fired by aufs -+ itself. -+3. No Extra Validation -+ This is the simplest test and doesn't add any additional revalidation -+ test, and skip the revalidation in step 4. It is useful and improves -+ aufs performance when system surely hide the aufs branches from user, -+ by over-mounting something (or another method). -diff --git a/Documentation/filesystems/aufs/design/04branch.txt b/Documentation/filesystems/aufs/design/04branch.txt -new file mode 100644 -index 0000000..e68f4d3 ---- /dev/null -+++ b/Documentation/filesystems/aufs/design/04branch.txt -@@ -0,0 +1,61 @@ -+ -+# Copyright (C) 2005-2016 Junjiro R. Okajima -+ -+Branch Manipulation -+ -+Since aufs supports dynamic branch manipulation, ie. add/remove a branch -+and changing its permission/attribute, there are a lot of works to do. -+ -+ -+Add a Branch -+---------------------------------------------------------------------- -+o Confirm the adding dir exists outside of aufs, including loopback -+ mount, and its various attributes. -+o Initialize the xino file and whiteout bases if necessary. -+ See struct.txt. -+ -+o Check the owner/group/mode of the directory -+ When the owner/group/mode of the adding directory differs from the -+ existing branch, aufs issues a warning because it may impose a -+ security risk. -+ For example, when a upper writable branch has a world writable empty -+ top directory, a malicious user can create any files on the writable -+ branch directly, like copy-up and modify manually. If something like -+ /etc/{passwd,shadow} exists on the lower readonly branch but the upper -+ writable branch, and the writable branch is world-writable, then a -+ malicious guy may create /etc/passwd on the writable branch directly -+ and the infected file will be valid in aufs. -+ I am afraid it can be a security issue, but aufs can do nothing except -+ producing a warning. -+ -+ -+Delete a Branch -+---------------------------------------------------------------------- -+o Confirm the deleting branch is not busy -+ To be general, there is one merit to adopt "remount" interface to -+ manipulate branches. It is to discard caches. At deleting a branch, -+ aufs checks the still cached (and connected) dentries and inodes. If -+ there are any, then they are all in-use. An inode without its -+ corresponding dentry can be alive alone (for example, inotify/fsnotify case). -+ -+ For the cached one, aufs checks whether the same named entry exists on -+ other branches. -+ If the cached one is a directory, because aufs provides a merged view -+ to users, as long as one dir is left on any branch aufs can show the -+ dir to users. In this case, the branch can be removed from aufs. -+ Otherwise aufs rejects deleting the branch. -+ -+ If any file on the deleting branch is opened by aufs, then aufs -+ rejects deleting. -+ -+ -+Modify the Permission of a Branch -+---------------------------------------------------------------------- -+o Re-initialize or remove the xino file and whiteout bases if necessary. -+ See struct.txt. -+ -+o rw --> ro: Confirm the modifying branch is not busy -+ Aufs rejects the request if any of these conditions are true. -+ - a file on the branch is mmap-ed. -+ - a regular file on the branch is opened for write and there is no -+ same named entry on the upper branch. -diff --git a/Documentation/filesystems/aufs/design/05wbr_policy.txt b/Documentation/filesystems/aufs/design/05wbr_policy.txt -new file mode 100644 -index 0000000..1726d5d ---- /dev/null -+++ b/Documentation/filesystems/aufs/design/05wbr_policy.txt -@@ -0,0 +1,51 @@ -+ -+# Copyright (C) 2005-2016 Junjiro R. Okajima -+ -+Policies to Select One among Multiple Writable Branches -+---------------------------------------------------------------------- -+When the number of writable branch is more than one, aufs has to decide -+the target branch for file creation or copy-up. By default, the highest -+writable branch which has the parent (or ancestor) dir of the target -+file is chosen (top-down-parent policy). -+By user's request, aufs implements some other policies to select the -+writable branch, for file creation several policies, round-robin, -+most-free-space, and other policies. For copy-up, top-down-parent, -+bottom-up-parent, bottom-up and others. -+ -+As expected, the round-robin policy selects the branch in circular. When -+you have two writable branches and creates 10 new files, 5 files will be -+created for each branch. mkdir(2) systemcall is an exception. When you -+create 10 new directories, all will be created on the same branch. -+And the most-free-space policy selects the one which has most free -+space among the writable branches. The amount of free space will be -+checked by aufs internally, and users can specify its time interval. -+ -+The policies for copy-up is more simple, -+top-down-parent is equivalent to the same named on in create policy, -+bottom-up-parent selects the writable branch where the parent dir -+exists and the nearest upper one from the copyup-source, -+bottom-up selects the nearest upper writable branch from the -+copyup-source, regardless the existence of the parent dir. -+ -+There are some rules or exceptions to apply these policies. -+- If there is a readonly branch above the policy-selected branch and -+ the parent dir is marked as opaque (a variation of whiteout), or the -+ target (creating) file is whiteout-ed on the upper readonly branch, -+ then the result of the policy is ignored and the target file will be -+ created on the nearest upper writable branch than the readonly branch. -+- If there is a writable branch above the policy-selected branch and -+ the parent dir is marked as opaque or the target file is whiteouted -+ on the branch, then the result of the policy is ignored and the target -+ file will be created on the highest one among the upper writable -+ branches who has diropq or whiteout. In case of whiteout, aufs removes -+ it as usual. -+- link(2) and rename(2) systemcalls are exceptions in every policy. -+ They try selecting the branch where the source exists as possible -+ since copyup a large file will take long time. If it can't be, -+ ie. the branch where the source exists is readonly, then they will -+ follow the copyup policy. -+- There is an exception for rename(2) when the target exists. -+ If the rename target exists, aufs compares the index of the branches -+ where the source and the target exists and selects the higher -+ one. If the selected branch is readonly, then aufs follows the -+ copyup policy. -diff --git a/Documentation/filesystems/aufs/design/06fhsm.txt b/Documentation/filesystems/aufs/design/06fhsm.txt -new file mode 100644 -index 0000000..84b46dc ---- /dev/null -+++ b/Documentation/filesystems/aufs/design/06fhsm.txt -@@ -0,0 +1,105 @@ -+ -+# Copyright (C) 2011-2016 Junjiro R. Okajima -+ -+File-based Hierarchical Storage Management (FHSM) -+---------------------------------------------------------------------- -+Hierarchical Storage Management (or HSM) is a well-known feature in the -+storage world. Aufs provides this feature as file-based with multiple -+writable branches, based upon the principle of "Colder, the Lower". -+Here the word "colder" means that the less used files, and "lower" means -+that the position in the order of the stacked branches vertically. -+These multiple writable branches are prioritized, ie. the topmost one -+should be the fastest drive and be used heavily. -+ -+o Characters in aufs FHSM story -+- aufs itself and a new branch attribute. -+- a new ioctl interface to move-down and to establish a connection with -+ the daemon ("move-down" is a converse of "copy-up"). -+- userspace tool and daemon. -+ -+The userspace daemon establishes a connection with aufs and waits for -+the notification. The notified information is very similar to struct -+statfs containing the number of consumed blocks and inodes. -+When the consumed blocks/inodes of a branch exceeds the user-specified -+upper watermark, the daemon activates its move-down process until the -+consumed blocks/inodes reaches the user-specified lower watermark. -+ -+The actual move-down is done by aufs based upon the request from -+user-space since we need to maintain the inode number and the internal -+pointer arrays in aufs. -+ -+Currently aufs FHSM handles the regular files only. Additionally they -+must not be hard-linked nor pseudo-linked. -+ -+ -+o Cowork of aufs and the user-space daemon -+ During the userspace daemon established the connection, aufs sends a -+ small notification to it whenever aufs writes something into the -+ writable branch. But it may cost high since aufs issues statfs(2) -+ internally. So user can specify a new option to cache the -+ info. Actually the notification is controlled by these factors. -+ + the specified cache time. -+ + classified as "force" by aufs internally. -+ Until the specified time expires, aufs doesn't send the info -+ except the forced cases. When aufs decide forcing, the info is always -+ notified to userspace. -+ For example, the number of free inodes is generally large enough and -+ the shortage of it happens rarely. So aufs doesn't force the -+ notification when creating a new file, directory and others. This is -+ the typical case which aufs doesn't force. -+ When aufs writes the actual filedata and the files consumes any of new -+ blocks, the aufs forces notifying. -+ -+ -+o Interfaces in aufs -+- New branch attribute. -+ + fhsm -+ Specifies that the branch is managed by FHSM feature. In other word, -+ participant in the FHSM. -+ When nofhsm is set to the branch, it will not be the source/target -+ branch of the move-down operation. This attribute is set -+ independently from coo and moo attributes, and if you want full -+ FHSM, you should specify them as well. -+- New mount option. -+ + fhsm_sec -+ Specifies a second to suppress many less important info to be -+ notified. -+- New ioctl. -+ + AUFS_CTL_FHSM_FD -+ create a new file descriptor which userspace can read the notification -+ (a subset of struct statfs) from aufs. -+- Module parameter 'brs' -+ It has to be set to 1. Otherwise the new mount option 'fhsm' will not -+ be set. -+- mount helpers /sbin/mount.aufs and /sbin/umount.aufs -+ When there are two or more branches with fhsm attributes, -+ /sbin/mount.aufs invokes the user-space daemon and /sbin/umount.aufs -+ terminates it. As a result of remounting and branch-manipulation, the -+ number of branches with fhsm attribute can be one. In this case, -+ /sbin/mount.aufs will terminate the user-space daemon. -+ -+ -+Finally the operation is done as these steps in kernel-space. -+- make sure that, -+ + no one else is using the file. -+ + the file is not hard-linked. -+ + the file is not pseudo-linked. -+ + the file is a regular file. -+ + the parent dir is not opaqued. -+- find the target writable branch. -+- make sure the file is not whiteout-ed by the upper (than the target) -+ branch. -+- make the parent dir on the target branch. -+- mutex lock the inode on the branch. -+- unlink the whiteout on the target branch (if exists). -+- lookup and create the whiteout-ed temporary name on the target branch. -+- copy the file as the whiteout-ed temporary name on the target branch. -+- rename the whiteout-ed temporary name to the original name. -+- unlink the file on the source branch. -+- maintain the internal pointer array and the external inode number -+ table (XINO). -+- maintain the timestamps and other attributes of the parent dir and the -+ file. -+ -+And of course, in every step, an error may happen. So the operation -+should restore the original file state after an error happens. -diff --git a/Documentation/filesystems/aufs/design/06mmap.txt b/Documentation/filesystems/aufs/design/06mmap.txt -new file mode 100644 -index 0000000..991c0b1 ---- /dev/null -+++ b/Documentation/filesystems/aufs/design/06mmap.txt -@@ -0,0 +1,59 @@ -+ -+# Copyright (C) 2005-2016 Junjiro R. Okajima -+ -+mmap(2) -- File Memory Mapping -+---------------------------------------------------------------------- -+In aufs, the file-mapped pages are handled by a branch fs directly, no -+interaction with aufs. It means aufs_mmap() calls the branch fs's -+->mmap(). -+This approach is simple and good, but there is one problem. -+Under /proc, several entries show the mmapped files by its path (with -+device and inode number), and the printed path will be the path on the -+branch fs's instead of virtual aufs's. -+This is not a problem in most cases, but some utilities lsof(1) (and its -+user) may expect the path on aufs. -+ -+To address this issue, aufs adds a new member called vm_prfile in struct -+vm_area_struct (and struct vm_region). The original vm_file points to -+the file on the branch fs in order to handle everything correctly as -+usual. The new vm_prfile points to a virtual file in aufs, and the -+show-functions in procfs refers to vm_prfile if it is set. -+Also we need to maintain several other places where touching vm_file -+such like -+- fork()/clone() copies vma and the reference count of vm_file is -+ incremented. -+- merging vma maintains the ref count too. -+ -+This is not a good approach. It just fakes the printed path. But it -+leaves all behaviour around f_mapping unchanged. This is surely an -+advantage. -+Actually aufs had adopted another complicated approach which calls -+generic_file_mmap() and handles struct vm_operations_struct. In this -+approach, aufs met a hard problem and I could not solve it without -+switching the approach. -+ -+There may be one more another approach which is -+- bind-mount the branch-root onto the aufs-root internally -+- grab the new vfsmount (ie. struct mount) -+- lazy-umount the branch-root internally -+- in open(2) the aufs-file, open the branch-file with the hidden -+ vfsmount (instead of the original branch's vfsmount) -+- ideally this "bind-mount and lazy-umount" should be done atomically, -+ but it may be possible from userspace by the mount helper. -+ -+Adding the internal hidden vfsmount and using it in opening a file, the -+file path under /proc will be printed correctly. This approach looks -+smarter, but is not possible I am afraid. -+- aufs-root may be bind-mount later. when it happens, another hidden -+ vfsmount will be required. -+- it is hard to get the chance to bind-mount and lazy-umount -+ + in kernel-space, FS can have vfsmount in open(2) via -+ file->f_path, and aufs can know its vfsmount. But several locks are -+ already acquired, and if aufs tries to bind-mount and lazy-umount -+ here, then it may cause a deadlock. -+ + in user-space, bind-mount doesn't invoke the mount helper. -+- since /proc shows dev and ino, aufs has to give vma these info. it -+ means a new member vm_prinode will be necessary. this is essentially -+ equivalent to vm_prfile described above. -+ -+I have to give up this "looks-smater" approach. -diff --git a/Documentation/filesystems/aufs/design/06xattr.txt b/Documentation/filesystems/aufs/design/06xattr.txt -new file mode 100644 -index 0000000..7bfa94f ---- /dev/null -+++ b/Documentation/filesystems/aufs/design/06xattr.txt -@@ -0,0 +1,81 @@ -+ -+# Copyright (C) 2014-2016 Junjiro R. Okajima -+ -+Listing XATTR/EA and getting the value -+---------------------------------------------------------------------- -+For the inode standard attributes (owner, group, timestamps, etc.), aufs -+shows the values from the topmost existing file. This behaviour is good -+for the non-dir entries since the bahaviour exactly matches the shown -+information. But for the directories, aufs considers all the same named -+entries on the lower branches. Which means, if one of the lower entry -+rejects readdir call, then aufs returns an error even if the topmost -+entry allows it. This behaviour is necessary to respect the branch fs's -+security, but can make users confused since the user-visible standard -+attributes don't match the behaviour. -+To address this issue, aufs has a mount option called dirperm1 which -+checks the permission for the topmost entry only, and ignores the lower -+entry's permission. -+ -+A similar issue can happen around XATTR. -+getxattr(2) and listxattr(2) families behave as if dirperm1 option is -+always set. Otherwise these very unpleasant situation would happen. -+- listxattr(2) may return the duplicated entries. -+- users may not be able to remove or reset the XATTR forever, -+ -+ -+XATTR/EA support in the internal (copy,move)-(up,down) -+---------------------------------------------------------------------- -+Generally the extended attributes of inode are categorized as these. -+- "security" for LSM and capability. -+- "system" for posix ACL, 'acl' mount option is required for the branch -+ fs generally. -+- "trusted" for userspace, CAP_SYS_ADMIN is required. -+- "user" for userspace, 'user_xattr' mount option is required for the -+ branch fs generally. -+ -+Moreover there are some other categories. Aufs handles these rather -+unpopular categories as the ordinary ones, ie. there is no special -+condition nor exception. -+ -+In copy-up, the support for XATTR on the dst branch may differ from the -+src branch. In this case, the copy-up operation will get an error and -+the original user operation which triggered the copy-up will fail. It -+can happen that even all copy-up will fail. -+When both of src and dst branches support XATTR and if an error occurs -+during copying XATTR, then the copy-up should fail obviously. That is a -+good reason and aufs should return an error to userspace. But when only -+the src branch support that XATTR, aufs should not return an error. -+For example, the src branch supports ACL but the dst branch doesn't -+because the dst branch may natively un-support it or temporary -+un-support it due to "noacl" mount option. Of course, the dst branch fs -+may NOT return an error even if the XATTR is not supported. It is -+totally up to the branch fs. -+ -+Anyway when the aufs internal copy-up gets an error from the dst branch -+fs, then aufs tries removing the just copied entry and returns the error -+to the userspace. The worst case of this situation will be all copy-up -+will fail. -+ -+For the copy-up operation, there two basic approaches. -+- copy the specified XATTR only (by category above), and return the -+ error unconditionally if it happens. -+- copy all XATTR, and ignore the error on the specified category only. -+ -+In order to support XATTR and to implement the correct behaviour, aufs -+chooses the latter approach and introduces some new branch attributes, -+"icexsec", "icexsys", "icextr", "icexusr", and "icexoth". -+They correspond to the XATTR namespaces (see above). Additionally, to be -+convenient, "icex" is also provided which means all "icex*" attributes -+are set (here the word "icex" stands for "ignore copy-error on XATTR"). -+ -+The meaning of these attributes is to ignore the error from setting -+XATTR on that branch. -+Note that aufs tries copying all XATTR unconditionally, and ignores the -+error from the dst branch according to the specified attributes. -+ -+Some XATTR may have its default value. The default value may come from -+the parent dir or the environment. If the default value is set at the -+file creating-time, it will be overwritten by copy-up. -+Some contradiction may happen I am afraid. -+Do we need another attribute to stop copying XATTR? I am unsure. For -+now, aufs implements the branch attributes to ignore the error. -diff --git a/Documentation/filesystems/aufs/design/07export.txt b/Documentation/filesystems/aufs/design/07export.txt -new file mode 100644 -index 0000000..c23930b ---- /dev/null -+++ b/Documentation/filesystems/aufs/design/07export.txt -@@ -0,0 +1,45 @@ -+ -+# Copyright (C) 2005-2016 Junjiro R. Okajima -+ -+Export Aufs via NFS -+---------------------------------------------------------------------- -+Here is an approach. -+- like xino/xib, add a new file 'xigen' which stores aufs inode -+ generation. -+- iget_locked(): initialize aufs inode generation for a new inode, and -+ store it in xigen file. -+- destroy_inode(): increment aufs inode generation and store it in xigen -+ file. it is necessary even if it is not unlinked, because any data of -+ inode may be changed by UDBA. -+- encode_fh(): for a root dir, simply return FILEID_ROOT. otherwise -+ build file handle by -+ + branch id (4 bytes) -+ + superblock generation (4 bytes) -+ + inode number (4 or 8 bytes) -+ + parent dir inode number (4 or 8 bytes) -+ + inode generation (4 bytes)) -+ + return value of exportfs_encode_fh() for the parent on a branch (4 -+ bytes) -+ + file handle for a branch (by exportfs_encode_fh()) -+- fh_to_dentry(): -+ + find the index of a branch from its id in handle, and check it is -+ still exist in aufs. -+ + 1st level: get the inode number from handle and search it in cache. -+ + 2nd level: if not found in cache, get the parent inode number from -+ the handle and search it in cache. and then open the found parent -+ dir, find the matching inode number by vfs_readdir() and get its -+ name, and call lookup_one_len() for the target dentry. -+ + 3rd level: if the parent dir is not cached, call -+ exportfs_decode_fh() for a branch and get the parent on a branch, -+ build a pathname of it, convert it a pathname in aufs, call -+ path_lookup(). now aufs gets a parent dir dentry, then handle it as -+ the 2nd level. -+ + to open the dir, aufs needs struct vfsmount. aufs keeps vfsmount -+ for every branch, but not itself. to get this, (currently) aufs -+ searches in current->nsproxy->mnt_ns list. it may not be a good -+ idea, but I didn't get other approach. -+ + test the generation of the gotten inode. -+- every inode operation: they may get EBUSY due to UDBA. in this case, -+ convert it into ESTALE for NFSD. -+- readdir(): call lockdep_on/off() because filldir in NFSD calls -+ lookup_one_len(), vfs_getattr(), encode_fh() and others. -diff --git a/Documentation/filesystems/aufs/design/08shwh.txt b/Documentation/filesystems/aufs/design/08shwh.txt -new file mode 100644 -index 0000000..ad58ebe ---- /dev/null -+++ b/Documentation/filesystems/aufs/design/08shwh.txt -@@ -0,0 +1,39 @@ -+ -+# Copyright (C) 2005-2016 Junjiro R. Okajima -+ -+Show Whiteout Mode (shwh) -+---------------------------------------------------------------------- -+Generally aufs hides the name of whiteouts. But in some cases, to show -+them is very useful for users. For instance, creating a new middle layer -+(branch) by merging existing layers. -+ -+(borrowing aufs1 HOW-TO from a user, Michael Towers) -+When you have three branches, -+- Bottom: 'system', squashfs (underlying base system), read-only -+- Middle: 'mods', squashfs, read-only -+- Top: 'overlay', ram (tmpfs), read-write -+ -+The top layer is loaded at boot time and saved at shutdown, to preserve -+the changes made to the system during the session. -+When larger changes have been made, or smaller changes have accumulated, -+the size of the saved top layer data grows. At this point, it would be -+nice to be able to merge the two overlay branches ('mods' and 'overlay') -+and rewrite the 'mods' squashfs, clearing the top layer and thus -+restoring save and load speed. -+ -+This merging is simplified by the use of another aufs mount, of just the -+two overlay branches using the 'shwh' option. -+# mount -t aufs -o ro,shwh,br:/livesys/overlay=ro+wh:/livesys/mods=rr+wh \ -+ aufs /livesys/merge_union -+ -+A merged view of these two branches is then available at -+/livesys/merge_union, and the new feature is that the whiteouts are -+visible! -+Note that in 'shwh' mode the aufs mount must be 'ro', which will disable -+writing to all branches. Also the default mode for all branches is 'ro'. -+It is now possible to save the combined contents of the two overlay -+branches to a new squashfs, e.g.: -+# mksquashfs /livesys/merge_union /path/to/newmods.squash -+ -+This new squashfs archive can be stored on the boot device and the -+initramfs will use it to replace the old one at the next boot. -diff --git a/Documentation/filesystems/aufs/design/10dynop.txt b/Documentation/filesystems/aufs/design/10dynop.txt -new file mode 100644 -index 0000000..49afc58 ---- /dev/null -+++ b/Documentation/filesystems/aufs/design/10dynop.txt -@@ -0,0 +1,34 @@ -+ -+# Copyright (C) 2010-2016 Junjiro R. Okajima -+ -+Dynamically customizable FS operations -+---------------------------------------------------------------------- -+Generally FS operations (struct inode_operations, struct -+address_space_operations, struct file_operations, etc.) are defined as -+"static const", but it never means that FS have only one set of -+operation. Some FS have multiple sets of them. For instance, ext2 has -+three sets, one for XIP, for NOBH, and for normal. -+Since aufs overrides and redirects these operations, sometimes aufs has -+to change its behaviour according to the branch FS type. More importantly -+VFS acts differently if a function (member in the struct) is set or -+not. It means aufs should have several sets of operations and select one -+among them according to the branch FS definition. -+ -+In order to solve this problem and not to affect the behaviour of VFS, -+aufs defines these operations dynamically. For instance, aufs defines -+dummy direct_IO function for struct address_space_operations, but it may -+not be set to the address_space_operations actually. When the branch FS -+doesn't have it, aufs doesn't set it to its address_space_operations -+while the function definition itself is still alive. So the behaviour -+itself will not change, and it will return an error when direct_IO is -+not set. -+ -+The lifetime of these dynamically generated operation object is -+maintained by aufs branch object. When the branch is removed from aufs, -+the reference counter of the object is decremented. When it reaches -+zero, the dynamically generated operation object will be freed. -+ -+This approach is designed to support AIO (io_submit), Direct I/O and -+XIP (DAX) mainly. -+Currently this approach is applied to address_space_operations for -+regular files only. -diff --git a/MAINTAINERS b/MAINTAINERS -index f593300..8a17054 100644 ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -2256,6 +2256,19 @@ F: include/linux/audit.h - F: include/uapi/linux/audit.h - F: kernel/audit* - -+AUFS (advanced multi layered unification filesystem) FILESYSTEM -+M: "J. R. Okajima" -+L: linux-unionfs@vger.kernel.org -+L: aufs-users@lists.sourceforge.net (members only) -+W: http://aufs.sourceforge.net -+T: git://github.com/sfjro/aufs4-linux.git -+S: Supported -+F: Documentation/filesystems/aufs/ -+F: Documentation/ABI/testing/debugfs-aufs -+F: Documentation/ABI/testing/sysfs-aufs -+F: fs/aufs/ -+F: include/uapi/linux/aufs_type.h -+ - AUXILIARY DISPLAY DRIVERS - M: Miguel Ojeda Sandonis - W: http://miguelojeda.es/auxdisplay.htm -diff --git a/drivers/block/loop.c b/drivers/block/loop.c -index c9f2107..005e292 100644 ---- a/drivers/block/loop.c -+++ b/drivers/block/loop.c -@@ -701,6 +701,24 @@ static inline int is_loop_device(struct file *file) - return i && S_ISBLK(i->i_mode) && MAJOR(i->i_rdev) == LOOP_MAJOR; - } - -+/* -+ * for AUFS -+ * no get/put for file. -+ */ -+struct file *loop_backing_file(struct super_block *sb) -+{ -+ struct file *ret; -+ struct loop_device *l; -+ -+ ret = NULL; -+ if (MAJOR(sb->s_dev) == LOOP_MAJOR) { -+ l = sb->s_bdev->bd_disk->private_data; -+ ret = l->lo_backing_file; -+ } -+ return ret; -+} -+EXPORT_SYMBOL_GPL(loop_backing_file); -+ - /* loop sysfs attributes */ - - static ssize_t loop_attr_show(struct device *dev, char *page, -diff --git a/fs/Kconfig b/fs/Kconfig -index 2bc7ad7..3049386 100644 ---- a/fs/Kconfig -+++ b/fs/Kconfig -@@ -245,6 +245,7 @@ source "fs/pstore/Kconfig" - source "fs/sysv/Kconfig" - source "fs/ufs/Kconfig" - source "fs/exofs/Kconfig" -+source "fs/aufs/Kconfig" - - endif # MISC_FILESYSTEMS - -diff --git a/fs/Makefile b/fs/Makefile -index ed2b632..aa6d14b 100644 ---- a/fs/Makefile -+++ b/fs/Makefile -@@ -129,3 +129,4 @@ obj-y += exofs/ # Multiple modules - obj-$(CONFIG_CEPH_FS) += ceph/ - obj-$(CONFIG_PSTORE) += pstore/ - obj-$(CONFIG_EFIVAR_FS) += efivarfs/ -+obj-$(CONFIG_AUFS_FS) += aufs/ -diff --git a/fs/aufs/Kconfig b/fs/aufs/Kconfig -new file mode 100644 -index 0000000..a4efb8b ---- /dev/null -+++ b/fs/aufs/Kconfig -@@ -0,0 +1,185 @@ -+config AUFS_FS -+ bool "Aufs (Advanced multi layered unification filesystem) support" -+ help -+ Aufs is a stackable unification filesystem such as Unionfs, -+ which unifies several directories and provides a merged single -+ directory. -+ In the early days, aufs was entirely re-designed and -+ re-implemented Unionfs Version 1.x series. Introducing many -+ original ideas, approaches and improvements, it becomes totally -+ different from Unionfs while keeping the basic features. -+ -+if AUFS_FS -+choice -+ prompt "Maximum number of branches" -+ default AUFS_BRANCH_MAX_127 -+ help -+ Specifies the maximum number of branches (or member directories) -+ in a single aufs. The larger value consumes more system -+ resources and has a minor impact to performance. -+config AUFS_BRANCH_MAX_127 -+ bool "127" -+ help -+ Specifies the maximum number of branches (or member directories) -+ in a single aufs. The larger value consumes more system -+ resources and has a minor impact to performance. -+config AUFS_BRANCH_MAX_511 -+ bool "511" -+ help -+ Specifies the maximum number of branches (or member directories) -+ in a single aufs. The larger value consumes more system -+ resources and has a minor impact to performance. -+config AUFS_BRANCH_MAX_1023 -+ bool "1023" -+ help -+ Specifies the maximum number of branches (or member directories) -+ in a single aufs. The larger value consumes more system -+ resources and has a minor impact to performance. -+config AUFS_BRANCH_MAX_32767 -+ bool "32767" -+ help -+ Specifies the maximum number of branches (or member directories) -+ in a single aufs. The larger value consumes more system -+ resources and has a minor impact to performance. -+endchoice -+ -+config AUFS_SBILIST -+ bool -+ depends on AUFS_MAGIC_SYSRQ || PROC_FS -+ default y -+ help -+ Automatic configuration for internal use. -+ When aufs supports Magic SysRq or /proc, enabled automatically. -+ -+config AUFS_HNOTIFY -+ bool "Detect direct branch access (bypassing aufs)" -+ help -+ If you want to modify files on branches directly, eg. bypassing aufs, -+ and want aufs to detect the changes of them fully, then enable this -+ option and use 'udba=notify' mount option. -+ Currently there is only one available configuration, "fsnotify". -+ It will have a negative impact to the performance. -+ See detail in aufs.5. -+ -+choice -+ prompt "method" if AUFS_HNOTIFY -+ default AUFS_HFSNOTIFY -+config AUFS_HFSNOTIFY -+ bool "fsnotify" -+ select FSNOTIFY -+endchoice -+ -+config AUFS_EXPORT -+ bool "NFS-exportable aufs" -+ depends on EXPORTFS = y -+ help -+ If you want to export your mounted aufs via NFS, then enable this -+ option. There are several requirements for this configuration. -+ See detail in aufs.5. -+ -+config AUFS_INO_T_64 -+ bool -+ depends on AUFS_EXPORT -+ depends on 64BIT && !(ALPHA || S390) -+ default y -+ help -+ Automatic configuration for internal use. -+ /* typedef unsigned long/int __kernel_ino_t */ -+ /* alpha and s390x are int */ -+ -+config AUFS_XATTR -+ bool "support for XATTR/EA (including Security Labels)" -+ help -+ If your branch fs supports XATTR/EA and you want to make them -+ available in aufs too, then enable this opsion and specify the -+ branch attributes for EA. -+ See detail in aufs.5. -+ -+config AUFS_FHSM -+ bool "File-based Hierarchical Storage Management" -+ help -+ Hierarchical Storage Management (or HSM) is a well-known feature -+ in the storage world. Aufs provides this feature as file-based. -+ with multiple branches. -+ These multiple branches are prioritized, ie. the topmost one -+ should be the fastest drive and be used heavily. -+ -+config AUFS_RDU -+ bool "Readdir in userspace" -+ help -+ Aufs has two methods to provide a merged view for a directory, -+ by a user-space library and by kernel-space natively. The latter -+ is always enabled but sometimes large and slow. -+ If you enable this option, install the library in aufs2-util -+ package, and set some environment variables for your readdir(3), -+ then the work will be handled in user-space which generally -+ shows better performance in most cases. -+ See detail in aufs.5. -+ -+config AUFS_SHWH -+ bool "Show whiteouts" -+ help -+ If you want to make the whiteouts in aufs visible, then enable -+ this option and specify 'shwh' mount option. Although it may -+ sounds like philosophy or something, but in technically it -+ simply shows the name of whiteout with keeping its behaviour. -+ -+config AUFS_BR_RAMFS -+ bool "Ramfs (initramfs/rootfs) as an aufs branch" -+ help -+ If you want to use ramfs as an aufs branch fs, then enable this -+ option. Generally tmpfs is recommended. -+ Aufs prohibited them to be a branch fs by default, because -+ initramfs becomes unusable after switch_root or something -+ generally. If you sets initramfs as an aufs branch and boot your -+ system by switch_root, you will meet a problem easily since the -+ files in initramfs may be inaccessible. -+ Unless you are going to use ramfs as an aufs branch fs without -+ switch_root or something, leave it N. -+ -+config AUFS_BR_FUSE -+ bool "Fuse fs as an aufs branch" -+ depends on FUSE_FS -+ select AUFS_POLL -+ help -+ If you want to use fuse-based userspace filesystem as an aufs -+ branch fs, then enable this option. -+ It implements the internal poll(2) operation which is -+ implemented by fuse only (curretnly). -+ -+config AUFS_POLL -+ bool -+ help -+ Automatic configuration for internal use. -+ -+config AUFS_BR_HFSPLUS -+ bool "Hfsplus as an aufs branch" -+ depends on HFSPLUS_FS -+ default y -+ help -+ If you want to use hfsplus fs as an aufs branch fs, then enable -+ this option. This option introduces a small overhead at -+ copying-up a file on hfsplus. -+ -+config AUFS_BDEV_LOOP -+ bool -+ depends on BLK_DEV_LOOP -+ default y -+ help -+ Automatic configuration for internal use. -+ Convert =[ym] into =y. -+ -+config AUFS_DEBUG -+ bool "Debug aufs" -+ help -+ Enable this to compile aufs internal debug code. -+ It will have a negative impact to the performance. -+ -+config AUFS_MAGIC_SYSRQ -+ bool -+ depends on AUFS_DEBUG && MAGIC_SYSRQ -+ default y -+ help -+ Automatic configuration for internal use. -+ When aufs supports Magic SysRq, enabled automatically. -+endif -diff --git a/fs/aufs/Makefile b/fs/aufs/Makefile -new file mode 100644 -index 0000000..c7efb62 ---- /dev/null -+++ b/fs/aufs/Makefile -@@ -0,0 +1,36 @@ -+ -+include ${srctree}/${src}/magic.mk -+ -+# cf. include/linux/kernel.h -+# enable pr_debug -+ccflags-y += -DDEBUG -+# sparse requires the full pathname -+ccflags-y += -include ${srctree}/include/uapi/linux/aufs_type.h -+ -+obj-$(CONFIG_AUFS_FS) += aufs.o -+aufs-y := module.o sbinfo.o super.o branch.o xino.o sysaufs.o opts.o \ -+ wkq.o vfsub.o dcsub.o \ -+ cpup.o whout.o wbr_policy.o \ -+ dinfo.o dentry.o \ -+ dynop.o \ -+ finfo.o file.o f_op.o \ -+ dir.o vdir.o \ -+ iinfo.o inode.o i_op.o i_op_add.o i_op_del.o i_op_ren.o \ -+ mvdown.o ioctl.o -+ -+# all are boolean -+aufs-$(CONFIG_PROC_FS) += procfs.o plink.o -+aufs-$(CONFIG_SYSFS) += sysfs.o -+aufs-$(CONFIG_DEBUG_FS) += dbgaufs.o -+aufs-$(CONFIG_AUFS_BDEV_LOOP) += loop.o -+aufs-$(CONFIG_AUFS_HNOTIFY) += hnotify.o -+aufs-$(CONFIG_AUFS_HFSNOTIFY) += hfsnotify.o -+aufs-$(CONFIG_AUFS_EXPORT) += export.o -+aufs-$(CONFIG_AUFS_XATTR) += xattr.o -+aufs-$(CONFIG_FS_POSIX_ACL) += posix_acl.o -+aufs-$(CONFIG_AUFS_FHSM) += fhsm.o -+aufs-$(CONFIG_AUFS_POLL) += poll.o -+aufs-$(CONFIG_AUFS_RDU) += rdu.o -+aufs-$(CONFIG_AUFS_BR_HFSPLUS) += hfsplus.o -+aufs-$(CONFIG_AUFS_DEBUG) += debug.o -+aufs-$(CONFIG_AUFS_MAGIC_SYSRQ) += sysrq.o -diff --git a/fs/aufs/aufs.h b/fs/aufs/aufs.h -new file mode 100644 -index 0000000..49f43b4 ---- /dev/null -+++ b/fs/aufs/aufs.h -@@ -0,0 +1,46 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * all header files -+ */ -+ -+#ifndef __AUFS_H__ -+#define __AUFS_H__ -+ -+#ifdef __KERNEL__ -+ -+#define AuStub(type, name, body, ...) \ -+ static inline type name(__VA_ARGS__) { body; } -+ -+#define AuStubVoid(name, ...) \ -+ AuStub(void, name, , __VA_ARGS__) -+#define AuStubInt0(name, ...) \ -+ AuStub(int, name, return 0, __VA_ARGS__) -+ -+#include "debug.h" -+ -+#include "branch.h" -+#include "cpup.h" -+#include "dcsub.h" -+#include "dbgaufs.h" -+#include "dentry.h" -+#include "dir.h" -+#include "dynop.h" -+#include "file.h" -+#include "fstype.h" -+#include "inode.h" -+#include "loop.h" -+#include "module.h" -+#include "opts.h" -+#include "rwsem.h" -+#include "spl.h" -+#include "super.h" -+#include "sysaufs.h" -+#include "vfsub.h" -+#include "whout.h" -+#include "wkq.h" -+ -+#endif /* __KERNEL__ */ -+#endif /* __AUFS_H__ */ -diff --git a/fs/aufs/branch.c b/fs/aufs/branch.c -new file mode 100644 -index 0000000..3bfbe5b ---- /dev/null -+++ b/fs/aufs/branch.c -@@ -0,0 +1,1399 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * branch management -+ */ -+ -+#include -+#include -+#include "aufs.h" -+ -+/* -+ * free a single branch -+ */ -+static void au_br_do_free(struct au_branch *br) -+{ -+ int i; -+ struct au_wbr *wbr; -+ struct au_dykey **key; -+ -+ au_hnotify_fin_br(br); -+ -+ if (br->br_xino.xi_file) -+ fput(br->br_xino.xi_file); -+ mutex_destroy(&br->br_xino.xi_nondir_mtx); -+ -+ AuDebugOn(au_br_count(br)); -+ au_br_count_fin(br); -+ -+ wbr = br->br_wbr; -+ if (wbr) { -+ for (i = 0; i < AuBrWh_Last; i++) -+ dput(wbr->wbr_wh[i]); -+ AuDebugOn(atomic_read(&wbr->wbr_wh_running)); -+ AuRwDestroy(&wbr->wbr_wh_rwsem); -+ } -+ -+ if (br->br_fhsm) { -+ au_br_fhsm_fin(br->br_fhsm); -+ au_delayed_kfree(br->br_fhsm); -+ } -+ -+ key = br->br_dykey; -+ for (i = 0; i < AuBrDynOp; i++, key++) -+ if (*key) -+ au_dy_put(*key); -+ else -+ break; -+ -+ /* recursive lock, s_umount of branch's */ -+ lockdep_off(); -+ path_put(&br->br_path); -+ lockdep_on(); -+ if (wbr) -+ au_delayed_kfree(wbr); -+ au_delayed_kfree(br); -+} -+ -+/* -+ * frees all branches -+ */ -+void au_br_free(struct au_sbinfo *sbinfo) -+{ -+ aufs_bindex_t bmax; -+ struct au_branch **br; -+ -+ AuRwMustWriteLock(&sbinfo->si_rwsem); -+ -+ bmax = sbinfo->si_bbot + 1; -+ br = sbinfo->si_branch; -+ while (bmax--) -+ au_br_do_free(*br++); -+} -+ -+/* -+ * find the index of a branch which is specified by @br_id. -+ */ -+int au_br_index(struct super_block *sb, aufs_bindex_t br_id) -+{ -+ aufs_bindex_t bindex, bbot; -+ -+ bbot = au_sbbot(sb); -+ for (bindex = 0; bindex <= bbot; bindex++) -+ if (au_sbr_id(sb, bindex) == br_id) -+ return bindex; -+ return -1; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * add a branch -+ */ -+ -+static int test_overlap(struct super_block *sb, struct dentry *h_adding, -+ struct dentry *h_root) -+{ -+ if (unlikely(h_adding == h_root -+ || au_test_loopback_overlap(sb, h_adding))) -+ return 1; -+ if (h_adding->d_sb != h_root->d_sb) -+ return 0; -+ return au_test_subdir(h_adding, h_root) -+ || au_test_subdir(h_root, h_adding); -+} -+ -+/* -+ * returns a newly allocated branch. @new_nbranch is a number of branches -+ * after adding a branch. -+ */ -+static struct au_branch *au_br_alloc(struct super_block *sb, int new_nbranch, -+ int perm) -+{ -+ struct au_branch *add_branch; -+ struct dentry *root; -+ struct inode *inode; -+ int err; -+ -+ err = -ENOMEM; -+ root = sb->s_root; -+ add_branch = kzalloc(sizeof(*add_branch), GFP_NOFS); -+ if (unlikely(!add_branch)) -+ goto out; -+ -+ err = au_hnotify_init_br(add_branch, perm); -+ if (unlikely(err)) -+ goto out_br; -+ -+ if (au_br_writable(perm)) { -+ /* may be freed separately at changing the branch permission */ -+ add_branch->br_wbr = kzalloc(sizeof(*add_branch->br_wbr), -+ GFP_NOFS); -+ if (unlikely(!add_branch->br_wbr)) -+ goto out_hnotify; -+ } -+ -+ if (au_br_fhsm(perm)) { -+ err = au_fhsm_br_alloc(add_branch); -+ if (unlikely(err)) -+ goto out_wbr; -+ } -+ -+ err = au_sbr_realloc(au_sbi(sb), new_nbranch, /*may_shrink*/0); -+ if (!err) -+ err = au_di_realloc(au_di(root), new_nbranch, /*may_shrink*/0); -+ if (!err) { -+ inode = d_inode(root); -+ err = au_hinode_realloc(au_ii(inode), new_nbranch, /*may_shrink*/0); -+ } -+ if (!err) -+ return add_branch; /* success */ -+ -+out_wbr: -+ if (add_branch->br_wbr) -+ au_delayed_kfree(add_branch->br_wbr); -+out_hnotify: -+ au_hnotify_fin_br(add_branch); -+out_br: -+ au_delayed_kfree(add_branch); -+out: -+ return ERR_PTR(err); -+} -+ -+/* -+ * test if the branch permission is legal or not. -+ */ -+static int test_br(struct inode *inode, int brperm, char *path) -+{ -+ int err; -+ -+ err = (au_br_writable(brperm) && IS_RDONLY(inode)); -+ if (!err) -+ goto out; -+ -+ err = -EINVAL; -+ pr_err("write permission for readonly mount or inode, %s\n", path); -+ -+out: -+ return err; -+} -+ -+/* -+ * returns: -+ * 0: success, the caller will add it -+ * plus: success, it is already unified, the caller should ignore it -+ * minus: error -+ */ -+static int test_add(struct super_block *sb, struct au_opt_add *add, int remount) -+{ -+ int err; -+ aufs_bindex_t bbot, bindex; -+ struct dentry *root, *h_dentry; -+ struct inode *inode, *h_inode; -+ -+ root = sb->s_root; -+ bbot = au_sbbot(sb); -+ if (unlikely(bbot >= 0 -+ && au_find_dbindex(root, add->path.dentry) >= 0)) { -+ err = 1; -+ if (!remount) { -+ err = -EINVAL; -+ pr_err("%s duplicated\n", add->pathname); -+ } -+ goto out; -+ } -+ -+ err = -ENOSPC; /* -E2BIG; */ -+ if (unlikely(AUFS_BRANCH_MAX <= add->bindex -+ || AUFS_BRANCH_MAX - 1 <= bbot)) { -+ pr_err("number of branches exceeded %s\n", add->pathname); -+ goto out; -+ } -+ -+ err = -EDOM; -+ if (unlikely(add->bindex < 0 || bbot + 1 < add->bindex)) { -+ pr_err("bad index %d\n", add->bindex); -+ goto out; -+ } -+ -+ inode = d_inode(add->path.dentry); -+ err = -ENOENT; -+ if (unlikely(!inode->i_nlink)) { -+ pr_err("no existence %s\n", add->pathname); -+ goto out; -+ } -+ -+ err = -EINVAL; -+ if (unlikely(inode->i_sb == sb)) { -+ pr_err("%s must be outside\n", add->pathname); -+ goto out; -+ } -+ -+ if (unlikely(au_test_fs_unsuppoted(inode->i_sb))) { -+ pr_err("unsupported filesystem, %s (%s)\n", -+ add->pathname, au_sbtype(inode->i_sb)); -+ goto out; -+ } -+ -+ if (unlikely(inode->i_sb->s_stack_depth)) { -+ pr_err("already stacked, %s (%s)\n", -+ add->pathname, au_sbtype(inode->i_sb)); -+ goto out; -+ } -+ -+ err = test_br(d_inode(add->path.dentry), add->perm, add->pathname); -+ if (unlikely(err)) -+ goto out; -+ -+ if (bbot < 0) -+ return 0; /* success */ -+ -+ err = -EINVAL; -+ for (bindex = 0; bindex <= bbot; bindex++) -+ if (unlikely(test_overlap(sb, add->path.dentry, -+ au_h_dptr(root, bindex)))) { -+ pr_err("%s is overlapped\n", add->pathname); -+ goto out; -+ } -+ -+ err = 0; -+ if (au_opt_test(au_mntflags(sb), WARN_PERM)) { -+ h_dentry = au_h_dptr(root, 0); -+ h_inode = d_inode(h_dentry); -+ if ((h_inode->i_mode & S_IALLUGO) != (inode->i_mode & S_IALLUGO) -+ || !uid_eq(h_inode->i_uid, inode->i_uid) -+ || !gid_eq(h_inode->i_gid, inode->i_gid)) -+ pr_warn("uid/gid/perm %s %u/%u/0%o, %u/%u/0%o\n", -+ add->pathname, -+ i_uid_read(inode), i_gid_read(inode), -+ (inode->i_mode & S_IALLUGO), -+ i_uid_read(h_inode), i_gid_read(h_inode), -+ (h_inode->i_mode & S_IALLUGO)); -+ } -+ -+out: -+ return err; -+} -+ -+/* -+ * initialize or clean the whiteouts for an adding branch -+ */ -+static int au_br_init_wh(struct super_block *sb, struct au_branch *br, -+ int new_perm) -+{ -+ int err, old_perm; -+ aufs_bindex_t bindex; -+ struct inode *h_inode; -+ struct au_wbr *wbr; -+ struct au_hinode *hdir; -+ struct dentry *h_dentry; -+ -+ err = vfsub_mnt_want_write(au_br_mnt(br)); -+ if (unlikely(err)) -+ goto out; -+ -+ wbr = br->br_wbr; -+ old_perm = br->br_perm; -+ br->br_perm = new_perm; -+ hdir = NULL; -+ h_inode = NULL; -+ bindex = au_br_index(sb, br->br_id); -+ if (0 <= bindex) { -+ hdir = au_hi(d_inode(sb->s_root), bindex); -+ au_hn_inode_lock_nested(hdir, AuLsc_I_PARENT); -+ } else { -+ h_dentry = au_br_dentry(br); -+ h_inode = d_inode(h_dentry); -+ inode_lock_nested(h_inode, AuLsc_I_PARENT); -+ } -+ if (!wbr) -+ err = au_wh_init(br, sb); -+ else { -+ wbr_wh_write_lock(wbr); -+ err = au_wh_init(br, sb); -+ wbr_wh_write_unlock(wbr); -+ } -+ if (hdir) -+ au_hn_inode_unlock(hdir); -+ else -+ inode_unlock(h_inode); -+ vfsub_mnt_drop_write(au_br_mnt(br)); -+ br->br_perm = old_perm; -+ -+ if (!err && wbr && !au_br_writable(new_perm)) { -+ au_delayed_kfree(wbr); -+ br->br_wbr = NULL; -+ } -+ -+out: -+ return err; -+} -+ -+static int au_wbr_init(struct au_branch *br, struct super_block *sb, -+ int perm) -+{ -+ int err; -+ struct kstatfs kst; -+ struct au_wbr *wbr; -+ -+ wbr = br->br_wbr; -+ au_rw_init(&wbr->wbr_wh_rwsem); -+ atomic_set(&wbr->wbr_wh_running, 0); -+ -+ /* -+ * a limit for rmdir/rename a dir -+ * cf. AUFS_MAX_NAMELEN in include/uapi/linux/aufs_type.h -+ */ -+ err = vfs_statfs(&br->br_path, &kst); -+ if (unlikely(err)) -+ goto out; -+ err = -EINVAL; -+ if (kst.f_namelen >= NAME_MAX) -+ err = au_br_init_wh(sb, br, perm); -+ else -+ pr_err("%pd(%s), unsupported namelen %ld\n", -+ au_br_dentry(br), -+ au_sbtype(au_br_dentry(br)->d_sb), kst.f_namelen); -+ -+out: -+ return err; -+} -+ -+/* initialize a new branch */ -+static int au_br_init(struct au_branch *br, struct super_block *sb, -+ struct au_opt_add *add) -+{ -+ int err; -+ struct inode *h_inode; -+ -+ err = 0; -+ mutex_init(&br->br_xino.xi_nondir_mtx); -+ br->br_perm = add->perm; -+ br->br_path = add->path; /* set first, path_get() later */ -+ spin_lock_init(&br->br_dykey_lock); -+ au_br_count_init(br); -+ atomic_set(&br->br_xino_running, 0); -+ br->br_id = au_new_br_id(sb); -+ AuDebugOn(br->br_id < 0); -+ -+ if (au_br_writable(add->perm)) { -+ err = au_wbr_init(br, sb, add->perm); -+ if (unlikely(err)) -+ goto out_err; -+ } -+ -+ if (au_opt_test(au_mntflags(sb), XINO)) { -+ h_inode = d_inode(add->path.dentry); -+ err = au_xino_br(sb, br, h_inode->i_ino, -+ au_sbr(sb, 0)->br_xino.xi_file, /*do_test*/1); -+ if (unlikely(err)) { -+ AuDebugOn(br->br_xino.xi_file); -+ goto out_err; -+ } -+ } -+ -+ sysaufs_br_init(br); -+ path_get(&br->br_path); -+ goto out; /* success */ -+ -+out_err: -+ memset(&br->br_path, 0, sizeof(br->br_path)); -+out: -+ return err; -+} -+ -+static void au_br_do_add_brp(struct au_sbinfo *sbinfo, aufs_bindex_t bindex, -+ struct au_branch *br, aufs_bindex_t bbot, -+ aufs_bindex_t amount) -+{ -+ struct au_branch **brp; -+ -+ AuRwMustWriteLock(&sbinfo->si_rwsem); -+ -+ brp = sbinfo->si_branch + bindex; -+ memmove(brp + 1, brp, sizeof(*brp) * amount); -+ *brp = br; -+ sbinfo->si_bbot++; -+ if (unlikely(bbot < 0)) -+ sbinfo->si_bbot = 0; -+} -+ -+static void au_br_do_add_hdp(struct au_dinfo *dinfo, aufs_bindex_t bindex, -+ aufs_bindex_t bbot, aufs_bindex_t amount) -+{ -+ struct au_hdentry *hdp; -+ -+ AuRwMustWriteLock(&dinfo->di_rwsem); -+ -+ hdp = au_hdentry(dinfo, bindex); -+ memmove(hdp + 1, hdp, sizeof(*hdp) * amount); -+ au_h_dentry_init(hdp); -+ dinfo->di_bbot++; -+ if (unlikely(bbot < 0)) -+ dinfo->di_btop = 0; -+} -+ -+static void au_br_do_add_hip(struct au_iinfo *iinfo, aufs_bindex_t bindex, -+ aufs_bindex_t bbot, aufs_bindex_t amount) -+{ -+ struct au_hinode *hip; -+ -+ AuRwMustWriteLock(&iinfo->ii_rwsem); -+ -+ hip = au_hinode(iinfo, bindex); -+ memmove(hip + 1, hip, sizeof(*hip) * amount); -+ au_hinode_init(hip); -+ iinfo->ii_bbot++; -+ if (unlikely(bbot < 0)) -+ iinfo->ii_btop = 0; -+} -+ -+static void au_br_do_add(struct super_block *sb, struct au_branch *br, -+ aufs_bindex_t bindex) -+{ -+ struct dentry *root, *h_dentry; -+ struct inode *root_inode, *h_inode; -+ aufs_bindex_t bbot, amount; -+ -+ root = sb->s_root; -+ root_inode = d_inode(root); -+ bbot = au_sbbot(sb); -+ amount = bbot + 1 - bindex; -+ h_dentry = au_br_dentry(br); -+ au_sbilist_lock(); -+ au_br_do_add_brp(au_sbi(sb), bindex, br, bbot, amount); -+ au_br_do_add_hdp(au_di(root), bindex, bbot, amount); -+ au_br_do_add_hip(au_ii(root_inode), bindex, bbot, amount); -+ au_set_h_dptr(root, bindex, dget(h_dentry)); -+ h_inode = d_inode(h_dentry); -+ au_set_h_iptr(root_inode, bindex, au_igrab(h_inode), /*flags*/0); -+ au_sbilist_unlock(); -+} -+ -+int au_br_add(struct super_block *sb, struct au_opt_add *add, int remount) -+{ -+ int err; -+ aufs_bindex_t bbot, add_bindex; -+ struct dentry *root, *h_dentry; -+ struct inode *root_inode; -+ struct au_branch *add_branch; -+ -+ root = sb->s_root; -+ root_inode = d_inode(root); -+ IMustLock(root_inode); -+ IiMustWriteLock(root_inode); -+ err = test_add(sb, add, remount); -+ if (unlikely(err < 0)) -+ goto out; -+ if (err) { -+ err = 0; -+ goto out; /* success */ -+ } -+ -+ bbot = au_sbbot(sb); -+ add_branch = au_br_alloc(sb, bbot + 2, add->perm); -+ err = PTR_ERR(add_branch); -+ if (IS_ERR(add_branch)) -+ goto out; -+ -+ err = au_br_init(add_branch, sb, add); -+ if (unlikely(err)) { -+ au_br_do_free(add_branch); -+ goto out; -+ } -+ -+ add_bindex = add->bindex; -+ if (!remount) -+ au_br_do_add(sb, add_branch, add_bindex); -+ else { -+ sysaufs_brs_del(sb, add_bindex); -+ au_br_do_add(sb, add_branch, add_bindex); -+ sysaufs_brs_add(sb, add_bindex); -+ } -+ -+ h_dentry = add->path.dentry; -+ if (!add_bindex) { -+ au_cpup_attr_all(root_inode, /*force*/1); -+ sb->s_maxbytes = h_dentry->d_sb->s_maxbytes; -+ } else -+ au_add_nlink(root_inode, d_inode(h_dentry)); -+ -+ /* -+ * this test/set prevents aufs from handling unnecesary notify events -+ * of xino files, in case of re-adding a writable branch which was -+ * once detached from aufs. -+ */ -+ if (au_xino_brid(sb) < 0 -+ && au_br_writable(add_branch->br_perm) -+ && !au_test_fs_bad_xino(h_dentry->d_sb) -+ && add_branch->br_xino.xi_file -+ && add_branch->br_xino.xi_file->f_path.dentry->d_parent == h_dentry) -+ au_xino_brid_set(sb, add_branch->br_id); -+ -+out: -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static unsigned long long au_farray_cb(struct super_block *sb, void *a, -+ unsigned long long max __maybe_unused, -+ void *arg) -+{ -+ unsigned long long n; -+ struct file **p, *f; -+ struct au_sphlhead *files; -+ struct au_finfo *finfo; -+ -+ n = 0; -+ p = a; -+ files = &au_sbi(sb)->si_files; -+ spin_lock(&files->spin); -+ hlist_for_each_entry(finfo, &files->head, fi_hlist) { -+ f = finfo->fi_file; -+ if (file_count(f) -+ && !special_file(file_inode(f)->i_mode)) { -+ get_file(f); -+ *p++ = f; -+ n++; -+ AuDebugOn(n > max); -+ } -+ } -+ spin_unlock(&files->spin); -+ -+ return n; -+} -+ -+static struct file **au_farray_alloc(struct super_block *sb, -+ unsigned long long *max) -+{ -+ *max = au_nfiles(sb); -+ return au_array_alloc(max, au_farray_cb, sb, /*arg*/NULL); -+} -+ -+static void au_farray_free(struct file **a, unsigned long long max) -+{ -+ unsigned long long ull; -+ -+ for (ull = 0; ull < max; ull++) -+ if (a[ull]) -+ fput(a[ull]); -+ kvfree(a); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * delete a branch -+ */ -+ -+/* to show the line number, do not make it inlined function */ -+#define AuVerbose(do_info, fmt, ...) do { \ -+ if (do_info) \ -+ pr_info(fmt, ##__VA_ARGS__); \ -+} while (0) -+ -+static int au_test_ibusy(struct inode *inode, aufs_bindex_t btop, -+ aufs_bindex_t bbot) -+{ -+ return (inode && !S_ISDIR(inode->i_mode)) || btop == bbot; -+} -+ -+static int au_test_dbusy(struct dentry *dentry, aufs_bindex_t btop, -+ aufs_bindex_t bbot) -+{ -+ return au_test_ibusy(d_inode(dentry), btop, bbot); -+} -+ -+/* -+ * test if the branch is deletable or not. -+ */ -+static int test_dentry_busy(struct dentry *root, aufs_bindex_t bindex, -+ unsigned int sigen, const unsigned int verbose) -+{ -+ int err, i, j, ndentry; -+ aufs_bindex_t btop, bbot; -+ struct au_dcsub_pages dpages; -+ struct au_dpage *dpage; -+ struct dentry *d; -+ -+ err = au_dpages_init(&dpages, GFP_NOFS); -+ if (unlikely(err)) -+ goto out; -+ err = au_dcsub_pages(&dpages, root, NULL, NULL); -+ if (unlikely(err)) -+ goto out_dpages; -+ -+ for (i = 0; !err && i < dpages.ndpage; i++) { -+ dpage = dpages.dpages + i; -+ ndentry = dpage->ndentry; -+ for (j = 0; !err && j < ndentry; j++) { -+ d = dpage->dentries[j]; -+ AuDebugOn(au_dcount(d) <= 0); -+ if (!au_digen_test(d, sigen)) { -+ di_read_lock_child(d, AuLock_IR); -+ if (unlikely(au_dbrange_test(d))) { -+ di_read_unlock(d, AuLock_IR); -+ continue; -+ } -+ } else { -+ di_write_lock_child(d); -+ if (unlikely(au_dbrange_test(d))) { -+ di_write_unlock(d); -+ continue; -+ } -+ err = au_reval_dpath(d, sigen); -+ if (!err) -+ di_downgrade_lock(d, AuLock_IR); -+ else { -+ di_write_unlock(d); -+ break; -+ } -+ } -+ -+ /* AuDbgDentry(d); */ -+ btop = au_dbtop(d); -+ bbot = au_dbbot(d); -+ if (btop <= bindex -+ && bindex <= bbot -+ && au_h_dptr(d, bindex) -+ && au_test_dbusy(d, btop, bbot)) { -+ err = -EBUSY; -+ AuVerbose(verbose, "busy %pd\n", d); -+ AuDbgDentry(d); -+ } -+ di_read_unlock(d, AuLock_IR); -+ } -+ } -+ -+out_dpages: -+ au_dpages_free(&dpages); -+out: -+ return err; -+} -+ -+static int test_inode_busy(struct super_block *sb, aufs_bindex_t bindex, -+ unsigned int sigen, const unsigned int verbose) -+{ -+ int err; -+ unsigned long long max, ull; -+ struct inode *i, **array; -+ aufs_bindex_t btop, bbot; -+ -+ array = au_iarray_alloc(sb, &max); -+ err = PTR_ERR(array); -+ if (IS_ERR(array)) -+ goto out; -+ -+ err = 0; -+ AuDbg("b%d\n", bindex); -+ for (ull = 0; !err && ull < max; ull++) { -+ i = array[ull]; -+ if (unlikely(!i)) -+ break; -+ if (i->i_ino == AUFS_ROOT_INO) -+ continue; -+ -+ /* AuDbgInode(i); */ -+ if (au_iigen(i, NULL) == sigen) -+ ii_read_lock_child(i); -+ else { -+ ii_write_lock_child(i); -+ err = au_refresh_hinode_self(i); -+ au_iigen_dec(i); -+ if (!err) -+ ii_downgrade_lock(i); -+ else { -+ ii_write_unlock(i); -+ break; -+ } -+ } -+ -+ btop = au_ibtop(i); -+ bbot = au_ibbot(i); -+ if (btop <= bindex -+ && bindex <= bbot -+ && au_h_iptr(i, bindex) -+ && au_test_ibusy(i, btop, bbot)) { -+ err = -EBUSY; -+ AuVerbose(verbose, "busy i%lu\n", i->i_ino); -+ AuDbgInode(i); -+ } -+ ii_read_unlock(i); -+ } -+ au_iarray_free(array, max); -+ -+out: -+ return err; -+} -+ -+static int test_children_busy(struct dentry *root, aufs_bindex_t bindex, -+ const unsigned int verbose) -+{ -+ int err; -+ unsigned int sigen; -+ -+ sigen = au_sigen(root->d_sb); -+ DiMustNoWaiters(root); -+ IiMustNoWaiters(d_inode(root)); -+ di_write_unlock(root); -+ err = test_dentry_busy(root, bindex, sigen, verbose); -+ if (!err) -+ err = test_inode_busy(root->d_sb, bindex, sigen, verbose); -+ di_write_lock_child(root); /* aufs_write_lock() calls ..._child() */ -+ -+ return err; -+} -+ -+static int test_dir_busy(struct file *file, aufs_bindex_t br_id, -+ struct file **to_free, int *idx) -+{ -+ int err; -+ unsigned char matched, root; -+ aufs_bindex_t bindex, bbot; -+ struct au_fidir *fidir; -+ struct au_hfile *hfile; -+ -+ err = 0; -+ root = IS_ROOT(file->f_path.dentry); -+ if (root) { -+ get_file(file); -+ to_free[*idx] = file; -+ (*idx)++; -+ goto out; -+ } -+ -+ matched = 0; -+ fidir = au_fi(file)->fi_hdir; -+ AuDebugOn(!fidir); -+ bbot = au_fbbot_dir(file); -+ for (bindex = au_fbtop(file); bindex <= bbot; bindex++) { -+ hfile = fidir->fd_hfile + bindex; -+ if (!hfile->hf_file) -+ continue; -+ -+ if (hfile->hf_br->br_id == br_id) { -+ matched = 1; -+ break; -+ } -+ } -+ if (matched) -+ err = -EBUSY; -+ -+out: -+ return err; -+} -+ -+static int test_file_busy(struct super_block *sb, aufs_bindex_t br_id, -+ struct file **to_free, int opened) -+{ -+ int err, idx; -+ unsigned long long ull, max; -+ aufs_bindex_t btop; -+ struct file *file, **array; -+ struct dentry *root; -+ struct au_hfile *hfile; -+ -+ array = au_farray_alloc(sb, &max); -+ err = PTR_ERR(array); -+ if (IS_ERR(array)) -+ goto out; -+ -+ err = 0; -+ idx = 0; -+ root = sb->s_root; -+ di_write_unlock(root); -+ for (ull = 0; ull < max; ull++) { -+ file = array[ull]; -+ if (unlikely(!file)) -+ break; -+ -+ /* AuDbg("%pD\n", file); */ -+ fi_read_lock(file); -+ btop = au_fbtop(file); -+ if (!d_is_dir(file->f_path.dentry)) { -+ hfile = &au_fi(file)->fi_htop; -+ if (hfile->hf_br->br_id == br_id) -+ err = -EBUSY; -+ } else -+ err = test_dir_busy(file, br_id, to_free, &idx); -+ fi_read_unlock(file); -+ if (unlikely(err)) -+ break; -+ } -+ di_write_lock_child(root); -+ au_farray_free(array, max); -+ AuDebugOn(idx > opened); -+ -+out: -+ return err; -+} -+ -+static void br_del_file(struct file **to_free, unsigned long long opened, -+ aufs_bindex_t br_id) -+{ -+ unsigned long long ull; -+ aufs_bindex_t bindex, btop, bbot, bfound; -+ struct file *file; -+ struct au_fidir *fidir; -+ struct au_hfile *hfile; -+ -+ for (ull = 0; ull < opened; ull++) { -+ file = to_free[ull]; -+ if (unlikely(!file)) -+ break; -+ -+ /* AuDbg("%pD\n", file); */ -+ AuDebugOn(!d_is_dir(file->f_path.dentry)); -+ bfound = -1; -+ fidir = au_fi(file)->fi_hdir; -+ AuDebugOn(!fidir); -+ fi_write_lock(file); -+ btop = au_fbtop(file); -+ bbot = au_fbbot_dir(file); -+ for (bindex = btop; bindex <= bbot; bindex++) { -+ hfile = fidir->fd_hfile + bindex; -+ if (!hfile->hf_file) -+ continue; -+ -+ if (hfile->hf_br->br_id == br_id) { -+ bfound = bindex; -+ break; -+ } -+ } -+ AuDebugOn(bfound < 0); -+ au_set_h_fptr(file, bfound, NULL); -+ if (bfound == btop) { -+ for (btop++; btop <= bbot; btop++) -+ if (au_hf_dir(file, btop)) { -+ au_set_fbtop(file, btop); -+ break; -+ } -+ } -+ fi_write_unlock(file); -+ } -+} -+ -+static void au_br_do_del_brp(struct au_sbinfo *sbinfo, -+ const aufs_bindex_t bindex, -+ const aufs_bindex_t bbot) -+{ -+ struct au_branch **brp, **p; -+ -+ AuRwMustWriteLock(&sbinfo->si_rwsem); -+ -+ brp = sbinfo->si_branch + bindex; -+ if (bindex < bbot) -+ memmove(brp, brp + 1, sizeof(*brp) * (bbot - bindex)); -+ sbinfo->si_branch[0 + bbot] = NULL; -+ sbinfo->si_bbot--; -+ -+ p = au_krealloc(sbinfo->si_branch, sizeof(*p) * bbot, AuGFP_SBILIST, -+ /*may_shrink*/1); -+ if (p) -+ sbinfo->si_branch = p; -+ /* harmless error */ -+} -+ -+static void au_br_do_del_hdp(struct au_dinfo *dinfo, const aufs_bindex_t bindex, -+ const aufs_bindex_t bbot) -+{ -+ struct au_hdentry *hdp, *p; -+ -+ AuRwMustWriteLock(&dinfo->di_rwsem); -+ -+ hdp = au_hdentry(dinfo, bindex); -+ if (bindex < bbot) -+ memmove(hdp, hdp + 1, sizeof(*hdp) * (bbot - bindex)); -+ /* au_h_dentry_init(au_hdentry(dinfo, bbot); */ -+ dinfo->di_bbot--; -+ -+ p = au_krealloc(dinfo->di_hdentry, sizeof(*p) * bbot, AuGFP_SBILIST, -+ /*may_shrink*/1); -+ if (p) -+ dinfo->di_hdentry = p; -+ /* harmless error */ -+} -+ -+static void au_br_do_del_hip(struct au_iinfo *iinfo, const aufs_bindex_t bindex, -+ const aufs_bindex_t bbot) -+{ -+ struct au_hinode *hip, *p; -+ -+ AuRwMustWriteLock(&iinfo->ii_rwsem); -+ -+ hip = au_hinode(iinfo, bindex); -+ if (bindex < bbot) -+ memmove(hip, hip + 1, sizeof(*hip) * (bbot - bindex)); -+ /* au_hinode_init(au_hinode(iinfo, bbot)); */ -+ iinfo->ii_bbot--; -+ -+ p = au_krealloc(iinfo->ii_hinode, sizeof(*p) * bbot, AuGFP_SBILIST, -+ /*may_shrink*/1); -+ if (p) -+ iinfo->ii_hinode = p; -+ /* harmless error */ -+} -+ -+static void au_br_do_del(struct super_block *sb, aufs_bindex_t bindex, -+ struct au_branch *br) -+{ -+ aufs_bindex_t bbot; -+ struct au_sbinfo *sbinfo; -+ struct dentry *root, *h_root; -+ struct inode *inode, *h_inode; -+ struct au_hinode *hinode; -+ -+ SiMustWriteLock(sb); -+ -+ root = sb->s_root; -+ inode = d_inode(root); -+ sbinfo = au_sbi(sb); -+ bbot = sbinfo->si_bbot; -+ -+ h_root = au_h_dptr(root, bindex); -+ hinode = au_hi(inode, bindex); -+ h_inode = au_igrab(hinode->hi_inode); -+ au_hiput(hinode); -+ -+ au_sbilist_lock(); -+ au_br_do_del_brp(sbinfo, bindex, bbot); -+ au_br_do_del_hdp(au_di(root), bindex, bbot); -+ au_br_do_del_hip(au_ii(inode), bindex, bbot); -+ au_sbilist_unlock(); -+ -+ dput(h_root); -+ iput(h_inode); -+ au_br_do_free(br); -+} -+ -+static unsigned long long empty_cb(struct super_block *sb, void *array, -+ unsigned long long max, void *arg) -+{ -+ return max; -+} -+ -+int au_br_del(struct super_block *sb, struct au_opt_del *del, int remount) -+{ -+ int err, rerr, i; -+ unsigned long long opened; -+ unsigned int mnt_flags; -+ aufs_bindex_t bindex, bbot, br_id; -+ unsigned char do_wh, verbose; -+ struct au_branch *br; -+ struct au_wbr *wbr; -+ struct dentry *root; -+ struct file **to_free; -+ -+ err = 0; -+ opened = 0; -+ to_free = NULL; -+ root = sb->s_root; -+ bindex = au_find_dbindex(root, del->h_path.dentry); -+ if (bindex < 0) { -+ if (remount) -+ goto out; /* success */ -+ err = -ENOENT; -+ pr_err("%s no such branch\n", del->pathname); -+ goto out; -+ } -+ AuDbg("bindex b%d\n", bindex); -+ -+ err = -EBUSY; -+ mnt_flags = au_mntflags(sb); -+ verbose = !!au_opt_test(mnt_flags, VERBOSE); -+ bbot = au_sbbot(sb); -+ if (unlikely(!bbot)) { -+ AuVerbose(verbose, "no more branches left\n"); -+ goto out; -+ } -+ br = au_sbr(sb, bindex); -+ AuDebugOn(!path_equal(&br->br_path, &del->h_path)); -+ -+ br_id = br->br_id; -+ opened = au_br_count(br); -+ if (unlikely(opened)) { -+ to_free = au_array_alloc(&opened, empty_cb, sb, NULL); -+ err = PTR_ERR(to_free); -+ if (IS_ERR(to_free)) -+ goto out; -+ -+ err = test_file_busy(sb, br_id, to_free, opened); -+ if (unlikely(err)) { -+ AuVerbose(verbose, "%llu file(s) opened\n", opened); -+ goto out; -+ } -+ } -+ -+ wbr = br->br_wbr; -+ do_wh = wbr && (wbr->wbr_whbase || wbr->wbr_plink || wbr->wbr_orph); -+ if (do_wh) { -+ /* instead of WbrWhMustWriteLock(wbr) */ -+ SiMustWriteLock(sb); -+ for (i = 0; i < AuBrWh_Last; i++) { -+ dput(wbr->wbr_wh[i]); -+ wbr->wbr_wh[i] = NULL; -+ } -+ } -+ -+ err = test_children_busy(root, bindex, verbose); -+ if (unlikely(err)) { -+ if (do_wh) -+ goto out_wh; -+ goto out; -+ } -+ -+ err = 0; -+ if (to_free) { -+ /* -+ * now we confirmed the branch is deletable. -+ * let's free the remaining opened dirs on the branch. -+ */ -+ di_write_unlock(root); -+ br_del_file(to_free, opened, br_id); -+ di_write_lock_child(root); -+ } -+ -+ if (!remount) -+ au_br_do_del(sb, bindex, br); -+ else { -+ sysaufs_brs_del(sb, bindex); -+ au_br_do_del(sb, bindex, br); -+ sysaufs_brs_add(sb, bindex); -+ } -+ -+ if (!bindex) { -+ au_cpup_attr_all(d_inode(root), /*force*/1); -+ sb->s_maxbytes = au_sbr_sb(sb, 0)->s_maxbytes; -+ } else -+ au_sub_nlink(d_inode(root), d_inode(del->h_path.dentry)); -+ if (au_opt_test(mnt_flags, PLINK)) -+ au_plink_half_refresh(sb, br_id); -+ -+ if (au_xino_brid(sb) == br_id) -+ au_xino_brid_set(sb, -1); -+ goto out; /* success */ -+ -+out_wh: -+ /* revert */ -+ rerr = au_br_init_wh(sb, br, br->br_perm); -+ if (rerr) -+ pr_warn("failed re-creating base whiteout, %s. (%d)\n", -+ del->pathname, rerr); -+out: -+ if (to_free) -+ au_farray_free(to_free, opened); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int au_ibusy(struct super_block *sb, struct aufs_ibusy __user *arg) -+{ -+ int err; -+ aufs_bindex_t btop, bbot; -+ struct aufs_ibusy ibusy; -+ struct inode *inode, *h_inode; -+ -+ err = -EPERM; -+ if (unlikely(!capable(CAP_SYS_ADMIN))) -+ goto out; -+ -+ err = copy_from_user(&ibusy, arg, sizeof(ibusy)); -+ if (!err) -+ err = !access_ok(VERIFY_WRITE, &arg->h_ino, sizeof(arg->h_ino)); -+ if (unlikely(err)) { -+ err = -EFAULT; -+ AuTraceErr(err); -+ goto out; -+ } -+ -+ err = -EINVAL; -+ si_read_lock(sb, AuLock_FLUSH); -+ if (unlikely(ibusy.bindex < 0 || ibusy.bindex > au_sbbot(sb))) -+ goto out_unlock; -+ -+ err = 0; -+ ibusy.h_ino = 0; /* invalid */ -+ inode = ilookup(sb, ibusy.ino); -+ if (!inode -+ || inode->i_ino == AUFS_ROOT_INO -+ || au_is_bad_inode(inode)) -+ goto out_unlock; -+ -+ ii_read_lock_child(inode); -+ btop = au_ibtop(inode); -+ bbot = au_ibbot(inode); -+ if (btop <= ibusy.bindex && ibusy.bindex <= bbot) { -+ h_inode = au_h_iptr(inode, ibusy.bindex); -+ if (h_inode && au_test_ibusy(inode, btop, bbot)) -+ ibusy.h_ino = h_inode->i_ino; -+ } -+ ii_read_unlock(inode); -+ iput(inode); -+ -+out_unlock: -+ si_read_unlock(sb); -+ if (!err) { -+ err = __put_user(ibusy.h_ino, &arg->h_ino); -+ if (unlikely(err)) { -+ err = -EFAULT; -+ AuTraceErr(err); -+ } -+ } -+out: -+ return err; -+} -+ -+long au_ibusy_ioctl(struct file *file, unsigned long arg) -+{ -+ return au_ibusy(file->f_path.dentry->d_sb, (void __user *)arg); -+} -+ -+#ifdef CONFIG_COMPAT -+long au_ibusy_compat_ioctl(struct file *file, unsigned long arg) -+{ -+ return au_ibusy(file->f_path.dentry->d_sb, compat_ptr(arg)); -+} -+#endif -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * change a branch permission -+ */ -+ -+static void au_warn_ima(void) -+{ -+#ifdef CONFIG_IMA -+ /* since it doesn't support mark_files_ro() */ -+ AuWarn1("RW -> RO makes IMA to produce wrong message\n"); -+#endif -+} -+ -+static int do_need_sigen_inc(int a, int b) -+{ -+ return au_br_whable(a) && !au_br_whable(b); -+} -+ -+static int need_sigen_inc(int old, int new) -+{ -+ return do_need_sigen_inc(old, new) -+ || do_need_sigen_inc(new, old); -+} -+ -+static int au_br_mod_files_ro(struct super_block *sb, aufs_bindex_t bindex) -+{ -+ int err, do_warn; -+ unsigned int mnt_flags; -+ unsigned long long ull, max; -+ aufs_bindex_t br_id; -+ unsigned char verbose, writer; -+ struct file *file, *hf, **array; -+ struct au_hfile *hfile; -+ -+ mnt_flags = au_mntflags(sb); -+ verbose = !!au_opt_test(mnt_flags, VERBOSE); -+ -+ array = au_farray_alloc(sb, &max); -+ err = PTR_ERR(array); -+ if (IS_ERR(array)) -+ goto out; -+ -+ do_warn = 0; -+ br_id = au_sbr_id(sb, bindex); -+ for (ull = 0; ull < max; ull++) { -+ file = array[ull]; -+ if (unlikely(!file)) -+ break; -+ -+ /* AuDbg("%pD\n", file); */ -+ fi_read_lock(file); -+ if (unlikely(au_test_mmapped(file))) { -+ err = -EBUSY; -+ AuVerbose(verbose, "mmapped %pD\n", file); -+ AuDbgFile(file); -+ FiMustNoWaiters(file); -+ fi_read_unlock(file); -+ goto out_array; -+ } -+ -+ hfile = &au_fi(file)->fi_htop; -+ hf = hfile->hf_file; -+ if (!d_is_reg(file->f_path.dentry) -+ || !(file->f_mode & FMODE_WRITE) -+ || hfile->hf_br->br_id != br_id -+ || !(hf->f_mode & FMODE_WRITE)) -+ array[ull] = NULL; -+ else { -+ do_warn = 1; -+ get_file(file); -+ } -+ -+ FiMustNoWaiters(file); -+ fi_read_unlock(file); -+ fput(file); -+ } -+ -+ err = 0; -+ if (do_warn) -+ au_warn_ima(); -+ -+ for (ull = 0; ull < max; ull++) { -+ file = array[ull]; -+ if (!file) -+ continue; -+ -+ /* todo: already flushed? */ -+ /* -+ * fs/super.c:mark_files_ro() is gone, but aufs keeps its -+ * approach which resets f_mode and calls mnt_drop_write() and -+ * file_release_write() for each file, because the branch -+ * attribute in aufs world is totally different from the native -+ * fs rw/ro mode. -+ */ -+ /* fi_read_lock(file); */ -+ hfile = &au_fi(file)->fi_htop; -+ hf = hfile->hf_file; -+ /* fi_read_unlock(file); */ -+ spin_lock(&hf->f_lock); -+ writer = !!(hf->f_mode & FMODE_WRITER); -+ hf->f_mode &= ~(FMODE_WRITE | FMODE_WRITER); -+ spin_unlock(&hf->f_lock); -+ if (writer) { -+ put_write_access(file_inode(hf)); -+ __mnt_drop_write(hf->f_path.mnt); -+ } -+ } -+ -+out_array: -+ au_farray_free(array, max); -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+int au_br_mod(struct super_block *sb, struct au_opt_mod *mod, int remount, -+ int *do_refresh) -+{ -+ int err, rerr; -+ aufs_bindex_t bindex; -+ struct dentry *root; -+ struct au_branch *br; -+ struct au_br_fhsm *bf; -+ -+ root = sb->s_root; -+ bindex = au_find_dbindex(root, mod->h_root); -+ if (bindex < 0) { -+ if (remount) -+ return 0; /* success */ -+ err = -ENOENT; -+ pr_err("%s no such branch\n", mod->path); -+ goto out; -+ } -+ AuDbg("bindex b%d\n", bindex); -+ -+ err = test_br(d_inode(mod->h_root), mod->perm, mod->path); -+ if (unlikely(err)) -+ goto out; -+ -+ br = au_sbr(sb, bindex); -+ AuDebugOn(mod->h_root != au_br_dentry(br)); -+ if (br->br_perm == mod->perm) -+ return 0; /* success */ -+ -+ /* pre-allocate for non-fhsm --> fhsm */ -+ bf = NULL; -+ if (!au_br_fhsm(br->br_perm) && au_br_fhsm(mod->perm)) { -+ err = au_fhsm_br_alloc(br); -+ if (unlikely(err)) -+ goto out; -+ bf = br->br_fhsm; -+ br->br_fhsm = NULL; -+ } -+ -+ if (au_br_writable(br->br_perm)) { -+ /* remove whiteout base */ -+ err = au_br_init_wh(sb, br, mod->perm); -+ if (unlikely(err)) -+ goto out_bf; -+ -+ if (!au_br_writable(mod->perm)) { -+ /* rw --> ro, file might be mmapped */ -+ DiMustNoWaiters(root); -+ IiMustNoWaiters(d_inode(root)); -+ di_write_unlock(root); -+ err = au_br_mod_files_ro(sb, bindex); -+ /* aufs_write_lock() calls ..._child() */ -+ di_write_lock_child(root); -+ -+ if (unlikely(err)) { -+ rerr = -ENOMEM; -+ br->br_wbr = kzalloc(sizeof(*br->br_wbr), -+ GFP_NOFS); -+ if (br->br_wbr) -+ rerr = au_wbr_init(br, sb, br->br_perm); -+ if (unlikely(rerr)) { -+ AuIOErr("nested error %d (%d)\n", -+ rerr, err); -+ br->br_perm = mod->perm; -+ } -+ } -+ } -+ } else if (au_br_writable(mod->perm)) { -+ /* ro --> rw */ -+ err = -ENOMEM; -+ br->br_wbr = kzalloc(sizeof(*br->br_wbr), GFP_NOFS); -+ if (br->br_wbr) { -+ err = au_wbr_init(br, sb, mod->perm); -+ if (unlikely(err)) { -+ au_delayed_kfree(br->br_wbr); -+ br->br_wbr = NULL; -+ } -+ } -+ } -+ if (unlikely(err)) -+ goto out_bf; -+ -+ if (au_br_fhsm(br->br_perm)) { -+ if (!au_br_fhsm(mod->perm)) { -+ /* fhsm --> non-fhsm */ -+ au_br_fhsm_fin(br->br_fhsm); -+ au_delayed_kfree(br->br_fhsm); -+ br->br_fhsm = NULL; -+ } -+ } else if (au_br_fhsm(mod->perm)) -+ /* non-fhsm --> fhsm */ -+ br->br_fhsm = bf; -+ -+ *do_refresh |= need_sigen_inc(br->br_perm, mod->perm); -+ br->br_perm = mod->perm; -+ goto out; /* success */ -+ -+out_bf: -+ if (bf) -+ au_delayed_kfree(bf); -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+int au_br_stfs(struct au_branch *br, struct aufs_stfs *stfs) -+{ -+ int err; -+ struct kstatfs kstfs; -+ -+ err = vfs_statfs(&br->br_path, &kstfs); -+ if (!err) { -+ stfs->f_blocks = kstfs.f_blocks; -+ stfs->f_bavail = kstfs.f_bavail; -+ stfs->f_files = kstfs.f_files; -+ stfs->f_ffree = kstfs.f_ffree; -+ } -+ -+ return err; -+} -diff --git a/fs/aufs/branch.h b/fs/aufs/branch.h -new file mode 100644 -index 0000000..32a4d8f ---- /dev/null -+++ b/fs/aufs/branch.h -@@ -0,0 +1,296 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * branch filesystems and xino for them -+ */ -+ -+#ifndef __AUFS_BRANCH_H__ -+#define __AUFS_BRANCH_H__ -+ -+#ifdef __KERNEL__ -+ -+#include -+#include "dynop.h" -+#include "rwsem.h" -+#include "super.h" -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* a xino file */ -+struct au_xino_file { -+ struct file *xi_file; -+ struct mutex xi_nondir_mtx; -+ -+ /* todo: make xino files an array to support huge inode number */ -+ -+#ifdef CONFIG_DEBUG_FS -+ struct dentry *xi_dbgaufs; -+#endif -+}; -+ -+/* File-based Hierarchical Storage Management */ -+struct au_br_fhsm { -+#ifdef CONFIG_AUFS_FHSM -+ struct mutex bf_lock; -+ unsigned long bf_jiffy; -+ struct aufs_stfs bf_stfs; -+ int bf_readable; -+#endif -+}; -+ -+/* members for writable branch only */ -+enum {AuBrWh_BASE, AuBrWh_PLINK, AuBrWh_ORPH, AuBrWh_Last}; -+struct au_wbr { -+ struct au_rwsem wbr_wh_rwsem; -+ struct dentry *wbr_wh[AuBrWh_Last]; -+ atomic_t wbr_wh_running; -+#define wbr_whbase wbr_wh[AuBrWh_BASE] /* whiteout base */ -+#define wbr_plink wbr_wh[AuBrWh_PLINK] /* pseudo-link dir */ -+#define wbr_orph wbr_wh[AuBrWh_ORPH] /* dir for orphans */ -+ -+ /* mfs mode */ -+ unsigned long long wbr_bytes; -+}; -+ -+/* ext2 has 3 types of operations at least, ext3 has 4 */ -+#define AuBrDynOp (AuDyLast * 4) -+ -+#ifdef CONFIG_AUFS_HFSNOTIFY -+/* support for asynchronous destruction */ -+struct au_br_hfsnotify { -+ struct fsnotify_group *hfsn_group; -+}; -+#endif -+ -+/* sysfs entries */ -+struct au_brsysfs { -+ char name[16]; -+ struct attribute attr; -+}; -+ -+enum { -+ AuBrSysfs_BR, -+ AuBrSysfs_BRID, -+ AuBrSysfs_Last -+}; -+ -+/* protected by superblock rwsem */ -+struct au_branch { -+ struct au_xino_file br_xino; -+ -+ aufs_bindex_t br_id; -+ -+ int br_perm; -+ struct path br_path; -+ spinlock_t br_dykey_lock; -+ struct au_dykey *br_dykey[AuBrDynOp]; -+ struct percpu_counter br_count; -+ -+ struct au_wbr *br_wbr; -+ struct au_br_fhsm *br_fhsm; -+ -+ /* xino truncation */ -+ atomic_t br_xino_running; -+ -+#ifdef CONFIG_AUFS_HFSNOTIFY -+ struct au_br_hfsnotify *br_hfsn; -+#endif -+ -+#ifdef CONFIG_SYSFS -+ /* entries under sysfs per mount-point */ -+ struct au_brsysfs br_sysfs[AuBrSysfs_Last]; -+#endif -+}; -+ -+/* ---------------------------------------------------------------------- */ -+ -+static inline struct vfsmount *au_br_mnt(struct au_branch *br) -+{ -+ return br->br_path.mnt; -+} -+ -+static inline struct dentry *au_br_dentry(struct au_branch *br) -+{ -+ return br->br_path.dentry; -+} -+ -+static inline struct super_block *au_br_sb(struct au_branch *br) -+{ -+ return au_br_mnt(br)->mnt_sb; -+} -+ -+static inline void au_br_get(struct au_branch *br) -+{ -+ percpu_counter_inc(&br->br_count); -+} -+ -+static inline void au_br_put(struct au_branch *br) -+{ -+ percpu_counter_dec(&br->br_count); -+} -+ -+static inline s64 au_br_count(struct au_branch *br) -+{ -+ return percpu_counter_sum(&br->br_count); -+} -+ -+static inline void au_br_count_init(struct au_branch *br) -+{ -+ percpu_counter_init(&br->br_count, 0, GFP_NOFS); -+} -+ -+static inline void au_br_count_fin(struct au_branch *br) -+{ -+ percpu_counter_destroy(&br->br_count); -+} -+ -+static inline int au_br_rdonly(struct au_branch *br) -+{ -+ return ((au_br_sb(br)->s_flags & MS_RDONLY) -+ || !au_br_writable(br->br_perm)) -+ ? -EROFS : 0; -+} -+ -+static inline int au_br_hnotifyable(int brperm __maybe_unused) -+{ -+#ifdef CONFIG_AUFS_HNOTIFY -+ return !(brperm & AuBrPerm_RR); -+#else -+ return 0; -+#endif -+} -+ -+static inline int au_br_test_oflag(int oflag, struct au_branch *br) -+{ -+ int err, exec_flag; -+ -+ err = 0; -+ exec_flag = oflag & __FMODE_EXEC; -+ if (unlikely(exec_flag && (au_br_mnt(br)->mnt_flags & MNT_NOEXEC))) -+ err = -EACCES; -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* branch.c */ -+struct au_sbinfo; -+void au_br_free(struct au_sbinfo *sinfo); -+int au_br_index(struct super_block *sb, aufs_bindex_t br_id); -+struct au_opt_add; -+int au_br_add(struct super_block *sb, struct au_opt_add *add, int remount); -+struct au_opt_del; -+int au_br_del(struct super_block *sb, struct au_opt_del *del, int remount); -+long au_ibusy_ioctl(struct file *file, unsigned long arg); -+#ifdef CONFIG_COMPAT -+long au_ibusy_compat_ioctl(struct file *file, unsigned long arg); -+#endif -+struct au_opt_mod; -+int au_br_mod(struct super_block *sb, struct au_opt_mod *mod, int remount, -+ int *do_refresh); -+struct aufs_stfs; -+int au_br_stfs(struct au_branch *br, struct aufs_stfs *stfs); -+ -+/* xino.c */ -+static const loff_t au_loff_max = LLONG_MAX; -+ -+int au_xib_trunc(struct super_block *sb); -+ssize_t xino_fread(vfs_readf_t func, struct file *file, void *buf, size_t size, -+ loff_t *pos); -+ssize_t xino_fwrite(vfs_writef_t func, struct file *file, void *buf, -+ size_t size, loff_t *pos); -+struct file *au_xino_create2(struct file *base_file, struct file *copy_src); -+struct file *au_xino_create(struct super_block *sb, char *fname, int silent); -+ino_t au_xino_new_ino(struct super_block *sb); -+void au_xino_delete_inode(struct inode *inode, const int unlinked); -+int au_xino_write(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino, -+ ino_t ino); -+int au_xino_read(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino, -+ ino_t *ino); -+int au_xino_br(struct super_block *sb, struct au_branch *br, ino_t hino, -+ struct file *base_file, int do_test); -+int au_xino_trunc(struct super_block *sb, aufs_bindex_t bindex); -+ -+struct au_opt_xino; -+int au_xino_set(struct super_block *sb, struct au_opt_xino *xino, int remount); -+void au_xino_clr(struct super_block *sb); -+struct file *au_xino_def(struct super_block *sb); -+int au_xino_path(struct seq_file *seq, struct file *file); -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* Superblock to branch */ -+static inline -+aufs_bindex_t au_sbr_id(struct super_block *sb, aufs_bindex_t bindex) -+{ -+ return au_sbr(sb, bindex)->br_id; -+} -+ -+static inline -+struct vfsmount *au_sbr_mnt(struct super_block *sb, aufs_bindex_t bindex) -+{ -+ return au_br_mnt(au_sbr(sb, bindex)); -+} -+ -+static inline -+struct super_block *au_sbr_sb(struct super_block *sb, aufs_bindex_t bindex) -+{ -+ return au_br_sb(au_sbr(sb, bindex)); -+} -+ -+static inline void au_sbr_get(struct super_block *sb, aufs_bindex_t bindex) -+{ -+ au_br_get(au_sbr(sb, bindex)); -+} -+ -+static inline void au_sbr_put(struct super_block *sb, aufs_bindex_t bindex) -+{ -+ au_br_put(au_sbr(sb, bindex)); -+} -+ -+static inline int au_sbr_perm(struct super_block *sb, aufs_bindex_t bindex) -+{ -+ return au_sbr(sb, bindex)->br_perm; -+} -+ -+static inline int au_sbr_whable(struct super_block *sb, aufs_bindex_t bindex) -+{ -+ return au_br_whable(au_sbr_perm(sb, bindex)); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * wbr_wh_read_lock, wbr_wh_write_lock -+ * wbr_wh_read_unlock, wbr_wh_write_unlock, wbr_wh_downgrade_lock -+ */ -+AuSimpleRwsemFuncs(wbr_wh, struct au_wbr *wbr, &wbr->wbr_wh_rwsem); -+ -+#define WbrWhMustNoWaiters(wbr) AuRwMustNoWaiters(&wbr->wbr_wh_rwsem) -+#define WbrWhMustAnyLock(wbr) AuRwMustAnyLock(&wbr->wbr_wh_rwsem) -+#define WbrWhMustWriteLock(wbr) AuRwMustWriteLock(&wbr->wbr_wh_rwsem) -+ -+/* ---------------------------------------------------------------------- */ -+ -+#ifdef CONFIG_AUFS_FHSM -+static inline void au_br_fhsm_init(struct au_br_fhsm *brfhsm) -+{ -+ mutex_init(&brfhsm->bf_lock); -+ brfhsm->bf_jiffy = 0; -+ brfhsm->bf_readable = 0; -+} -+ -+static inline void au_br_fhsm_fin(struct au_br_fhsm *brfhsm) -+{ -+ mutex_destroy(&brfhsm->bf_lock); -+} -+#else -+AuStubVoid(au_br_fhsm_init, struct au_br_fhsm *brfhsm) -+AuStubVoid(au_br_fhsm_fin, struct au_br_fhsm *brfhsm) -+#endif -+ -+#endif /* __KERNEL__ */ -+#endif /* __AUFS_BRANCH_H__ */ -diff --git a/fs/aufs/cpup.c b/fs/aufs/cpup.c -new file mode 100644 -index 0000000..598a4d6 ---- /dev/null -+++ b/fs/aufs/cpup.c -@@ -0,0 +1,1378 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * copy-up functions, see wbr_policy.c for copy-down -+ */ -+ -+#include -+#include -+#include -+#include "aufs.h" -+ -+void au_cpup_attr_flags(struct inode *dst, unsigned int iflags) -+{ -+ const unsigned int mask = S_DEAD | S_SWAPFILE | S_PRIVATE -+ | S_NOATIME | S_NOCMTIME | S_AUTOMOUNT; -+ -+ BUILD_BUG_ON(sizeof(iflags) != sizeof(dst->i_flags)); -+ -+ dst->i_flags |= iflags & ~mask; -+ if (au_test_fs_notime(dst->i_sb)) -+ dst->i_flags |= S_NOATIME | S_NOCMTIME; -+} -+ -+void au_cpup_attr_timesizes(struct inode *inode) -+{ -+ struct inode *h_inode; -+ -+ h_inode = au_h_iptr(inode, au_ibtop(inode)); -+ fsstack_copy_attr_times(inode, h_inode); -+ fsstack_copy_inode_size(inode, h_inode); -+} -+ -+void au_cpup_attr_nlink(struct inode *inode, int force) -+{ -+ struct inode *h_inode; -+ struct super_block *sb; -+ aufs_bindex_t bindex, bbot; -+ -+ sb = inode->i_sb; -+ bindex = au_ibtop(inode); -+ h_inode = au_h_iptr(inode, bindex); -+ if (!force -+ && !S_ISDIR(h_inode->i_mode) -+ && au_opt_test(au_mntflags(sb), PLINK) -+ && au_plink_test(inode)) -+ return; -+ -+ /* -+ * 0 can happen in revalidating. -+ * h_inode->i_mutex may not be held here, but it is harmless since once -+ * i_nlink reaches 0, it will never become positive except O_TMPFILE -+ * case. -+ * todo: O_TMPFILE+linkat(AT_SYMLINK_FOLLOW) bypassing aufs may cause -+ * the incorrect link count. -+ */ -+ set_nlink(inode, h_inode->i_nlink); -+ -+ /* -+ * fewer nlink makes find(1) noisy, but larger nlink doesn't. -+ * it may includes whplink directory. -+ */ -+ if (S_ISDIR(h_inode->i_mode)) { -+ bbot = au_ibbot(inode); -+ for (bindex++; bindex <= bbot; bindex++) { -+ h_inode = au_h_iptr(inode, bindex); -+ if (h_inode) -+ au_add_nlink(inode, h_inode); -+ } -+ } -+} -+ -+void au_cpup_attr_changeable(struct inode *inode) -+{ -+ struct inode *h_inode; -+ -+ h_inode = au_h_iptr(inode, au_ibtop(inode)); -+ inode->i_mode = h_inode->i_mode; -+ inode->i_uid = h_inode->i_uid; -+ inode->i_gid = h_inode->i_gid; -+ au_cpup_attr_timesizes(inode); -+ au_cpup_attr_flags(inode, h_inode->i_flags); -+} -+ -+void au_cpup_igen(struct inode *inode, struct inode *h_inode) -+{ -+ struct au_iinfo *iinfo = au_ii(inode); -+ -+ IiMustWriteLock(inode); -+ -+ iinfo->ii_higen = h_inode->i_generation; -+ iinfo->ii_hsb1 = h_inode->i_sb; -+} -+ -+void au_cpup_attr_all(struct inode *inode, int force) -+{ -+ struct inode *h_inode; -+ -+ h_inode = au_h_iptr(inode, au_ibtop(inode)); -+ au_cpup_attr_changeable(inode); -+ if (inode->i_nlink > 0) -+ au_cpup_attr_nlink(inode, force); -+ inode->i_rdev = h_inode->i_rdev; -+ inode->i_blkbits = h_inode->i_blkbits; -+ au_cpup_igen(inode, h_inode); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* Note: dt_dentry and dt_h_dentry are not dget/dput-ed */ -+ -+/* keep the timestamps of the parent dir when cpup */ -+void au_dtime_store(struct au_dtime *dt, struct dentry *dentry, -+ struct path *h_path) -+{ -+ struct inode *h_inode; -+ -+ dt->dt_dentry = dentry; -+ dt->dt_h_path = *h_path; -+ h_inode = d_inode(h_path->dentry); -+ dt->dt_atime = h_inode->i_atime; -+ dt->dt_mtime = h_inode->i_mtime; -+ /* smp_mb(); */ -+} -+ -+void au_dtime_revert(struct au_dtime *dt) -+{ -+ struct iattr attr; -+ int err; -+ -+ attr.ia_atime = dt->dt_atime; -+ attr.ia_mtime = dt->dt_mtime; -+ attr.ia_valid = ATTR_FORCE | ATTR_MTIME | ATTR_MTIME_SET -+ | ATTR_ATIME | ATTR_ATIME_SET; -+ -+ /* no delegation since this is a directory */ -+ err = vfsub_notify_change(&dt->dt_h_path, &attr, /*delegated*/NULL); -+ if (unlikely(err)) -+ pr_warn("restoring timestamps failed(%d). ignored\n", err); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* internal use only */ -+struct au_cpup_reg_attr { -+ int valid; -+ struct kstat st; -+ unsigned int iflags; /* inode->i_flags */ -+}; -+ -+static noinline_for_stack -+int cpup_iattr(struct dentry *dst, aufs_bindex_t bindex, struct dentry *h_src, -+ struct au_cpup_reg_attr *h_src_attr) -+{ -+ int err, sbits, icex; -+ unsigned int mnt_flags; -+ unsigned char verbose; -+ struct iattr ia; -+ struct path h_path; -+ struct inode *h_isrc, *h_idst; -+ struct kstat *h_st; -+ struct au_branch *br; -+ -+ h_path.dentry = au_h_dptr(dst, bindex); -+ h_idst = d_inode(h_path.dentry); -+ br = au_sbr(dst->d_sb, bindex); -+ h_path.mnt = au_br_mnt(br); -+ h_isrc = d_inode(h_src); -+ ia.ia_valid = ATTR_FORCE | ATTR_UID | ATTR_GID -+ | ATTR_ATIME | ATTR_MTIME -+ | ATTR_ATIME_SET | ATTR_MTIME_SET; -+ if (h_src_attr && h_src_attr->valid) { -+ h_st = &h_src_attr->st; -+ ia.ia_uid = h_st->uid; -+ ia.ia_gid = h_st->gid; -+ ia.ia_atime = h_st->atime; -+ ia.ia_mtime = h_st->mtime; -+ if (h_idst->i_mode != h_st->mode -+ && !S_ISLNK(h_idst->i_mode)) { -+ ia.ia_valid |= ATTR_MODE; -+ ia.ia_mode = h_st->mode; -+ } -+ sbits = !!(h_st->mode & (S_ISUID | S_ISGID)); -+ au_cpup_attr_flags(h_idst, h_src_attr->iflags); -+ } else { -+ ia.ia_uid = h_isrc->i_uid; -+ ia.ia_gid = h_isrc->i_gid; -+ ia.ia_atime = h_isrc->i_atime; -+ ia.ia_mtime = h_isrc->i_mtime; -+ if (h_idst->i_mode != h_isrc->i_mode -+ && !S_ISLNK(h_idst->i_mode)) { -+ ia.ia_valid |= ATTR_MODE; -+ ia.ia_mode = h_isrc->i_mode; -+ } -+ sbits = !!(h_isrc->i_mode & (S_ISUID | S_ISGID)); -+ au_cpup_attr_flags(h_idst, h_isrc->i_flags); -+ } -+ /* no delegation since it is just created */ -+ err = vfsub_notify_change(&h_path, &ia, /*delegated*/NULL); -+ -+ /* is this nfs only? */ -+ if (!err && sbits && au_test_nfs(h_path.dentry->d_sb)) { -+ ia.ia_valid = ATTR_FORCE | ATTR_MODE; -+ ia.ia_mode = h_isrc->i_mode; -+ err = vfsub_notify_change(&h_path, &ia, /*delegated*/NULL); -+ } -+ -+ icex = br->br_perm & AuBrAttr_ICEX; -+ if (!err) { -+ mnt_flags = au_mntflags(dst->d_sb); -+ verbose = !!au_opt_test(mnt_flags, VERBOSE); -+ err = au_cpup_xattr(h_path.dentry, h_src, icex, verbose); -+ } -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int au_do_copy_file(struct file *dst, struct file *src, loff_t len, -+ char *buf, unsigned long blksize) -+{ -+ int err; -+ size_t sz, rbytes, wbytes; -+ unsigned char all_zero; -+ char *p, *zp; -+ struct inode *h_inode; -+ /* reduce stack usage */ -+ struct iattr *ia; -+ -+ zp = page_address(ZERO_PAGE(0)); -+ if (unlikely(!zp)) -+ return -ENOMEM; /* possible? */ -+ -+ err = 0; -+ all_zero = 0; -+ while (len) { -+ AuDbg("len %lld\n", len); -+ sz = blksize; -+ if (len < blksize) -+ sz = len; -+ -+ rbytes = 0; -+ /* todo: signal_pending? */ -+ while (!rbytes || err == -EAGAIN || err == -EINTR) { -+ rbytes = vfsub_read_k(src, buf, sz, &src->f_pos); -+ err = rbytes; -+ } -+ if (unlikely(err < 0)) -+ break; -+ -+ all_zero = 0; -+ if (len >= rbytes && rbytes == blksize) -+ all_zero = !memcmp(buf, zp, rbytes); -+ if (!all_zero) { -+ wbytes = rbytes; -+ p = buf; -+ while (wbytes) { -+ size_t b; -+ -+ b = vfsub_write_k(dst, p, wbytes, &dst->f_pos); -+ err = b; -+ /* todo: signal_pending? */ -+ if (unlikely(err == -EAGAIN || err == -EINTR)) -+ continue; -+ if (unlikely(err < 0)) -+ break; -+ wbytes -= b; -+ p += b; -+ } -+ if (unlikely(err < 0)) -+ break; -+ } else { -+ loff_t res; -+ -+ AuLabel(hole); -+ res = vfsub_llseek(dst, rbytes, SEEK_CUR); -+ err = res; -+ if (unlikely(res < 0)) -+ break; -+ } -+ len -= rbytes; -+ err = 0; -+ } -+ -+ /* the last block may be a hole */ -+ if (!err && all_zero) { -+ AuLabel(last hole); -+ -+ err = 1; -+ if (au_test_nfs(dst->f_path.dentry->d_sb)) { -+ /* nfs requires this step to make last hole */ -+ /* is this only nfs? */ -+ do { -+ /* todo: signal_pending? */ -+ err = vfsub_write_k(dst, "\0", 1, &dst->f_pos); -+ } while (err == -EAGAIN || err == -EINTR); -+ if (err == 1) -+ dst->f_pos--; -+ } -+ -+ if (err == 1) { -+ ia = (void *)buf; -+ ia->ia_size = dst->f_pos; -+ ia->ia_valid = ATTR_SIZE | ATTR_FILE; -+ ia->ia_file = dst; -+ h_inode = file_inode(dst); -+ inode_lock_nested(h_inode, AuLsc_I_CHILD2); -+ /* no delegation since it is just created */ -+ err = vfsub_notify_change(&dst->f_path, ia, -+ /*delegated*/NULL); -+ inode_unlock(h_inode); -+ } -+ } -+ -+ return err; -+} -+ -+int au_copy_file(struct file *dst, struct file *src, loff_t len) -+{ -+ int err; -+ unsigned long blksize; -+ unsigned char do_kfree; -+ char *buf; -+ -+ err = -ENOMEM; -+ blksize = dst->f_path.dentry->d_sb->s_blocksize; -+ if (!blksize || PAGE_SIZE < blksize) -+ blksize = PAGE_SIZE; -+ AuDbg("blksize %lu\n", blksize); -+ do_kfree = (blksize != PAGE_SIZE && blksize >= sizeof(struct iattr *)); -+ if (do_kfree) -+ buf = kmalloc(blksize, GFP_NOFS); -+ else -+ buf = (void *)__get_free_page(GFP_NOFS); -+ if (unlikely(!buf)) -+ goto out; -+ -+ if (len > (1 << 22)) -+ AuDbg("copying a large file %lld\n", (long long)len); -+ -+ src->f_pos = 0; -+ dst->f_pos = 0; -+ err = au_do_copy_file(dst, src, len, buf, blksize); -+ if (do_kfree) -+ au_delayed_kfree(buf); -+ else -+ au_delayed_free_page((unsigned long)buf); -+ -+out: -+ return err; -+} -+ -+/* -+ * to support a sparse file which is opened with O_APPEND, -+ * we need to close the file. -+ */ -+static int au_cp_regular(struct au_cp_generic *cpg) -+{ -+ int err, i; -+ enum { SRC, DST }; -+ struct { -+ aufs_bindex_t bindex; -+ unsigned int flags; -+ struct dentry *dentry; -+ int force_wr; -+ struct file *file; -+ void *label; -+ } *f, file[] = { -+ { -+ .bindex = cpg->bsrc, -+ .flags = O_RDONLY | O_NOATIME | O_LARGEFILE, -+ .label = &&out -+ }, -+ { -+ .bindex = cpg->bdst, -+ .flags = O_WRONLY | O_NOATIME | O_LARGEFILE, -+ .force_wr = !!au_ftest_cpup(cpg->flags, RWDST), -+ .label = &&out_src -+ } -+ }; -+ struct super_block *sb; -+ struct inode *h_src_inode; -+ struct task_struct *tsk = current; -+ -+ /* bsrc branch can be ro/rw. */ -+ sb = cpg->dentry->d_sb; -+ f = file; -+ for (i = 0; i < 2; i++, f++) { -+ f->dentry = au_h_dptr(cpg->dentry, f->bindex); -+ f->file = au_h_open(cpg->dentry, f->bindex, f->flags, -+ /*file*/NULL, f->force_wr); -+ err = PTR_ERR(f->file); -+ if (IS_ERR(f->file)) -+ goto *f->label; -+ } -+ -+ /* try stopping to update while we copyup */ -+ h_src_inode = d_inode(file[SRC].dentry); -+ if (!au_test_nfs(h_src_inode->i_sb)) -+ IMustLock(h_src_inode); -+ err = au_copy_file(file[DST].file, file[SRC].file, cpg->len); -+ -+ /* i wonder if we had O_NO_DELAY_FPUT flag */ -+ if (tsk->flags & PF_KTHREAD) -+ __fput_sync(file[DST].file); -+ else { -+ WARN(1, "%pD\nPlease report this warning to aufs-users ML", -+ file[DST].file); -+ fput(file[DST].file); -+ /* -+ * too bad. -+ * we have to call both since we don't know which place the file -+ * was added to. -+ */ -+ task_work_run(); -+ flush_delayed_fput(); -+ } -+ au_sbr_put(sb, file[DST].bindex); -+ -+out_src: -+ fput(file[SRC].file); -+ au_sbr_put(sb, file[SRC].bindex); -+out: -+ return err; -+} -+ -+static int au_do_cpup_regular(struct au_cp_generic *cpg, -+ struct au_cpup_reg_attr *h_src_attr) -+{ -+ int err, rerr; -+ loff_t l; -+ struct path h_path; -+ struct inode *h_src_inode, *h_dst_inode; -+ -+ err = 0; -+ h_src_inode = au_h_iptr(d_inode(cpg->dentry), cpg->bsrc); -+ l = i_size_read(h_src_inode); -+ if (cpg->len == -1 || l < cpg->len) -+ cpg->len = l; -+ if (cpg->len) { -+ /* try stopping to update while we are referencing */ -+ inode_lock_nested(h_src_inode, AuLsc_I_CHILD); -+ au_pin_hdir_unlock(cpg->pin); -+ -+ h_path.dentry = au_h_dptr(cpg->dentry, cpg->bsrc); -+ h_path.mnt = au_sbr_mnt(cpg->dentry->d_sb, cpg->bsrc); -+ h_src_attr->iflags = h_src_inode->i_flags; -+ if (!au_test_nfs(h_src_inode->i_sb)) -+ err = vfs_getattr(&h_path, &h_src_attr->st); -+ else { -+ inode_unlock(h_src_inode); -+ err = vfs_getattr(&h_path, &h_src_attr->st); -+ inode_lock_nested(h_src_inode, AuLsc_I_CHILD); -+ } -+ if (unlikely(err)) { -+ inode_unlock(h_src_inode); -+ goto out; -+ } -+ h_src_attr->valid = 1; -+ if (!au_test_nfs(h_src_inode->i_sb)) { -+ err = au_cp_regular(cpg); -+ inode_unlock(h_src_inode); -+ } else { -+ inode_unlock(h_src_inode); -+ err = au_cp_regular(cpg); -+ } -+ rerr = au_pin_hdir_relock(cpg->pin); -+ if (!err && rerr) -+ err = rerr; -+ } -+ if (!err && (h_src_inode->i_state & I_LINKABLE)) { -+ h_path.dentry = au_h_dptr(cpg->dentry, cpg->bdst); -+ h_dst_inode = d_inode(h_path.dentry); -+ spin_lock(&h_dst_inode->i_lock); -+ h_dst_inode->i_state |= I_LINKABLE; -+ spin_unlock(&h_dst_inode->i_lock); -+ } -+ -+out: -+ return err; -+} -+ -+static int au_do_cpup_symlink(struct path *h_path, struct dentry *h_src, -+ struct inode *h_dir) -+{ -+ int err, symlen; -+ mm_segment_t old_fs; -+ union { -+ char *k; -+ char __user *u; -+ } sym; -+ struct inode *h_inode = d_inode(h_src); -+ const struct inode_operations *h_iop = h_inode->i_op; -+ -+ err = -ENOSYS; -+ if (unlikely(!h_iop->readlink)) -+ goto out; -+ -+ err = -ENOMEM; -+ sym.k = (void *)__get_free_page(GFP_NOFS); -+ if (unlikely(!sym.k)) -+ goto out; -+ -+ /* unnecessary to support mmap_sem since symlink is not mmap-able */ -+ old_fs = get_fs(); -+ set_fs(KERNEL_DS); -+ symlen = h_iop->readlink(h_src, sym.u, PATH_MAX); -+ err = symlen; -+ set_fs(old_fs); -+ -+ if (symlen > 0) { -+ sym.k[symlen] = 0; -+ err = vfsub_symlink(h_dir, h_path, sym.k); -+ } -+ au_delayed_free_page((unsigned long)sym.k); -+ -+out: -+ return err; -+} -+ -+/* -+ * regardless 'acl' option, reset all ACL. -+ * All ACL will be copied up later from the original entry on the lower branch. -+ */ -+static int au_reset_acl(struct inode *h_dir, struct path *h_path, umode_t mode) -+{ -+ int err; -+ struct dentry *h_dentry; -+ struct inode *h_inode; -+ -+ h_dentry = h_path->dentry; -+ h_inode = d_inode(h_dentry); -+ /* forget_all_cached_acls(h_inode)); */ -+ err = vfsub_removexattr(h_dentry, XATTR_NAME_POSIX_ACL_ACCESS); -+ AuTraceErr(err); -+ if (err == -EOPNOTSUPP) -+ err = 0; -+ if (!err) -+ err = vfsub_acl_chmod(h_inode, mode); -+ -+ AuTraceErr(err); -+ return err; -+} -+ -+static int au_do_cpup_dir(struct au_cp_generic *cpg, struct dentry *dst_parent, -+ struct inode *h_dir, struct path *h_path) -+{ -+ int err; -+ struct inode *dir, *inode; -+ -+ err = vfsub_removexattr(h_path->dentry, XATTR_NAME_POSIX_ACL_DEFAULT); -+ AuTraceErr(err); -+ if (err == -EOPNOTSUPP) -+ err = 0; -+ if (unlikely(err)) -+ goto out; -+ -+ /* -+ * strange behaviour from the users view, -+ * particularry setattr case -+ */ -+ dir = d_inode(dst_parent); -+ if (au_ibtop(dir) == cpg->bdst) -+ au_cpup_attr_nlink(dir, /*force*/1); -+ inode = d_inode(cpg->dentry); -+ au_cpup_attr_nlink(inode, /*force*/1); -+ -+out: -+ return err; -+} -+ -+static noinline_for_stack -+int cpup_entry(struct au_cp_generic *cpg, struct dentry *dst_parent, -+ struct au_cpup_reg_attr *h_src_attr) -+{ -+ int err; -+ umode_t mode; -+ unsigned int mnt_flags; -+ unsigned char isdir, isreg, force; -+ const unsigned char do_dt = !!au_ftest_cpup(cpg->flags, DTIME); -+ struct au_dtime dt; -+ struct path h_path; -+ struct dentry *h_src, *h_dst, *h_parent; -+ struct inode *h_inode, *h_dir; -+ struct super_block *sb; -+ -+ /* bsrc branch can be ro/rw. */ -+ h_src = au_h_dptr(cpg->dentry, cpg->bsrc); -+ h_inode = d_inode(h_src); -+ AuDebugOn(h_inode != au_h_iptr(d_inode(cpg->dentry), cpg->bsrc)); -+ -+ /* try stopping to be referenced while we are creating */ -+ h_dst = au_h_dptr(cpg->dentry, cpg->bdst); -+ if (au_ftest_cpup(cpg->flags, RENAME)) -+ AuDebugOn(strncmp(h_dst->d_name.name, AUFS_WH_PFX, -+ AUFS_WH_PFX_LEN)); -+ h_parent = h_dst->d_parent; /* dir inode is locked */ -+ h_dir = d_inode(h_parent); -+ IMustLock(h_dir); -+ AuDebugOn(h_parent != h_dst->d_parent); -+ -+ sb = cpg->dentry->d_sb; -+ h_path.mnt = au_sbr_mnt(sb, cpg->bdst); -+ if (do_dt) { -+ h_path.dentry = h_parent; -+ au_dtime_store(&dt, dst_parent, &h_path); -+ } -+ h_path.dentry = h_dst; -+ -+ isreg = 0; -+ isdir = 0; -+ mode = h_inode->i_mode; -+ switch (mode & S_IFMT) { -+ case S_IFREG: -+ isreg = 1; -+ err = vfsub_create(h_dir, &h_path, S_IRUSR | S_IWUSR, -+ /*want_excl*/true); -+ if (!err) -+ err = au_do_cpup_regular(cpg, h_src_attr); -+ break; -+ case S_IFDIR: -+ isdir = 1; -+ err = vfsub_mkdir(h_dir, &h_path, mode); -+ if (!err) -+ err = au_do_cpup_dir(cpg, dst_parent, h_dir, &h_path); -+ break; -+ case S_IFLNK: -+ err = au_do_cpup_symlink(&h_path, h_src, h_dir); -+ break; -+ case S_IFCHR: -+ case S_IFBLK: -+ AuDebugOn(!capable(CAP_MKNOD)); -+ /*FALLTHROUGH*/ -+ case S_IFIFO: -+ case S_IFSOCK: -+ err = vfsub_mknod(h_dir, &h_path, mode, h_inode->i_rdev); -+ break; -+ default: -+ AuIOErr("Unknown inode type 0%o\n", mode); -+ err = -EIO; -+ } -+ if (!err) -+ err = au_reset_acl(h_dir, &h_path, mode); -+ -+ mnt_flags = au_mntflags(sb); -+ if (!au_opt_test(mnt_flags, UDBA_NONE) -+ && !isdir -+ && au_opt_test(mnt_flags, XINO) -+ && (h_inode->i_nlink == 1 -+ || (h_inode->i_state & I_LINKABLE)) -+ /* todo: unnecessary? */ -+ /* && d_inode(cpg->dentry)->i_nlink == 1 */ -+ && cpg->bdst < cpg->bsrc -+ && !au_ftest_cpup(cpg->flags, KEEPLINO)) -+ au_xino_write(sb, cpg->bsrc, h_inode->i_ino, /*ino*/0); -+ /* ignore this error */ -+ -+ if (!err) { -+ force = 0; -+ if (isreg) { -+ force = !!cpg->len; -+ if (cpg->len == -1) -+ force = !!i_size_read(h_inode); -+ } -+ au_fhsm_wrote(sb, cpg->bdst, force); -+ } -+ -+ if (do_dt) -+ au_dtime_revert(&dt); -+ return err; -+} -+ -+static int au_do_ren_after_cpup(struct au_cp_generic *cpg, struct path *h_path) -+{ -+ int err; -+ struct dentry *dentry, *h_dentry, *h_parent, *parent; -+ struct inode *h_dir; -+ aufs_bindex_t bdst; -+ -+ dentry = cpg->dentry; -+ bdst = cpg->bdst; -+ h_dentry = au_h_dptr(dentry, bdst); -+ if (!au_ftest_cpup(cpg->flags, OVERWRITE)) { -+ dget(h_dentry); -+ au_set_h_dptr(dentry, bdst, NULL); -+ err = au_lkup_neg(dentry, bdst, /*wh*/0); -+ if (!err) -+ h_path->dentry = dget(au_h_dptr(dentry, bdst)); -+ au_set_h_dptr(dentry, bdst, h_dentry); -+ } else { -+ err = 0; -+ parent = dget_parent(dentry); -+ h_parent = au_h_dptr(parent, bdst); -+ dput(parent); -+ h_path->dentry = vfsub_lkup_one(&dentry->d_name, h_parent); -+ if (IS_ERR(h_path->dentry)) -+ err = PTR_ERR(h_path->dentry); -+ } -+ if (unlikely(err)) -+ goto out; -+ -+ h_parent = h_dentry->d_parent; /* dir inode is locked */ -+ h_dir = d_inode(h_parent); -+ IMustLock(h_dir); -+ AuDbg("%pd %pd\n", h_dentry, h_path->dentry); -+ /* no delegation since it is just created */ -+ err = vfsub_rename(h_dir, h_dentry, h_dir, h_path, /*delegated*/NULL); -+ dput(h_path->dentry); -+ -+out: -+ return err; -+} -+ -+/* -+ * copyup the @dentry from @bsrc to @bdst. -+ * the caller must set the both of lower dentries. -+ * @len is for truncating when it is -1 copyup the entire file. -+ * in link/rename cases, @dst_parent may be different from the real one. -+ * basic->bsrc can be larger than basic->bdst. -+ */ -+static int au_cpup_single(struct au_cp_generic *cpg, struct dentry *dst_parent) -+{ -+ int err, rerr; -+ aufs_bindex_t old_ibtop; -+ unsigned char isdir, plink; -+ struct dentry *h_src, *h_dst, *h_parent; -+ struct inode *dst_inode, *h_dir, *inode, *delegated, *src_inode; -+ struct super_block *sb; -+ struct au_branch *br; -+ /* to reuduce stack size */ -+ struct { -+ struct au_dtime dt; -+ struct path h_path; -+ struct au_cpup_reg_attr h_src_attr; -+ } *a; -+ -+ err = -ENOMEM; -+ a = kmalloc(sizeof(*a), GFP_NOFS); -+ if (unlikely(!a)) -+ goto out; -+ a->h_src_attr.valid = 0; -+ -+ sb = cpg->dentry->d_sb; -+ br = au_sbr(sb, cpg->bdst); -+ a->h_path.mnt = au_br_mnt(br); -+ h_dst = au_h_dptr(cpg->dentry, cpg->bdst); -+ h_parent = h_dst->d_parent; /* dir inode is locked */ -+ h_dir = d_inode(h_parent); -+ IMustLock(h_dir); -+ -+ h_src = au_h_dptr(cpg->dentry, cpg->bsrc); -+ inode = d_inode(cpg->dentry); -+ -+ if (!dst_parent) -+ dst_parent = dget_parent(cpg->dentry); -+ else -+ dget(dst_parent); -+ -+ plink = !!au_opt_test(au_mntflags(sb), PLINK); -+ dst_inode = au_h_iptr(inode, cpg->bdst); -+ if (dst_inode) { -+ if (unlikely(!plink)) { -+ err = -EIO; -+ AuIOErr("hi%lu(i%lu) exists on b%d " -+ "but plink is disabled\n", -+ dst_inode->i_ino, inode->i_ino, cpg->bdst); -+ goto out_parent; -+ } -+ -+ if (dst_inode->i_nlink) { -+ const int do_dt = au_ftest_cpup(cpg->flags, DTIME); -+ -+ h_src = au_plink_lkup(inode, cpg->bdst); -+ err = PTR_ERR(h_src); -+ if (IS_ERR(h_src)) -+ goto out_parent; -+ if (unlikely(d_is_negative(h_src))) { -+ err = -EIO; -+ AuIOErr("i%lu exists on b%d " -+ "but not pseudo-linked\n", -+ inode->i_ino, cpg->bdst); -+ dput(h_src); -+ goto out_parent; -+ } -+ -+ if (do_dt) { -+ a->h_path.dentry = h_parent; -+ au_dtime_store(&a->dt, dst_parent, &a->h_path); -+ } -+ -+ a->h_path.dentry = h_dst; -+ delegated = NULL; -+ err = vfsub_link(h_src, h_dir, &a->h_path, &delegated); -+ if (!err && au_ftest_cpup(cpg->flags, RENAME)) -+ err = au_do_ren_after_cpup(cpg, &a->h_path); -+ if (do_dt) -+ au_dtime_revert(&a->dt); -+ if (unlikely(err == -EWOULDBLOCK)) { -+ pr_warn("cannot retry for NFSv4 delegation" -+ " for an internal link\n"); -+ iput(delegated); -+ } -+ dput(h_src); -+ goto out_parent; -+ } else -+ /* todo: cpup_wh_file? */ -+ /* udba work */ -+ au_update_ibrange(inode, /*do_put_zero*/1); -+ } -+ -+ isdir = S_ISDIR(inode->i_mode); -+ old_ibtop = au_ibtop(inode); -+ err = cpup_entry(cpg, dst_parent, &a->h_src_attr); -+ if (unlikely(err)) -+ goto out_rev; -+ dst_inode = d_inode(h_dst); -+ inode_lock_nested(dst_inode, AuLsc_I_CHILD2); -+ /* todo: necessary? */ -+ /* au_pin_hdir_unlock(cpg->pin); */ -+ -+ err = cpup_iattr(cpg->dentry, cpg->bdst, h_src, &a->h_src_attr); -+ if (unlikely(err)) { -+ /* todo: necessary? */ -+ /* au_pin_hdir_relock(cpg->pin); */ /* ignore an error */ -+ inode_unlock(dst_inode); -+ goto out_rev; -+ } -+ -+ if (cpg->bdst < old_ibtop) { -+ if (S_ISREG(inode->i_mode)) { -+ err = au_dy_iaop(inode, cpg->bdst, dst_inode); -+ if (unlikely(err)) { -+ /* ignore an error */ -+ /* au_pin_hdir_relock(cpg->pin); */ -+ inode_unlock(dst_inode); -+ goto out_rev; -+ } -+ } -+ au_set_ibtop(inode, cpg->bdst); -+ } else -+ au_set_ibbot(inode, cpg->bdst); -+ au_set_h_iptr(inode, cpg->bdst, au_igrab(dst_inode), -+ au_hi_flags(inode, isdir)); -+ -+ /* todo: necessary? */ -+ /* err = au_pin_hdir_relock(cpg->pin); */ -+ inode_unlock(dst_inode); -+ if (unlikely(err)) -+ goto out_rev; -+ -+ src_inode = d_inode(h_src); -+ if (!isdir -+ && (src_inode->i_nlink > 1 -+ || src_inode->i_state & I_LINKABLE) -+ && plink) -+ au_plink_append(inode, cpg->bdst, h_dst); -+ -+ if (au_ftest_cpup(cpg->flags, RENAME)) { -+ a->h_path.dentry = h_dst; -+ err = au_do_ren_after_cpup(cpg, &a->h_path); -+ } -+ if (!err) -+ goto out_parent; /* success */ -+ -+ /* revert */ -+out_rev: -+ a->h_path.dentry = h_parent; -+ au_dtime_store(&a->dt, dst_parent, &a->h_path); -+ a->h_path.dentry = h_dst; -+ rerr = 0; -+ if (d_is_positive(h_dst)) { -+ if (!isdir) { -+ /* no delegation since it is just created */ -+ rerr = vfsub_unlink(h_dir, &a->h_path, -+ /*delegated*/NULL, /*force*/0); -+ } else -+ rerr = vfsub_rmdir(h_dir, &a->h_path); -+ } -+ au_dtime_revert(&a->dt); -+ if (rerr) { -+ AuIOErr("failed removing broken entry(%d, %d)\n", err, rerr); -+ err = -EIO; -+ } -+out_parent: -+ dput(dst_parent); -+ au_delayed_kfree(a); -+out: -+ return err; -+} -+ -+#if 0 /* reserved */ -+struct au_cpup_single_args { -+ int *errp; -+ struct au_cp_generic *cpg; -+ struct dentry *dst_parent; -+}; -+ -+static void au_call_cpup_single(void *args) -+{ -+ struct au_cpup_single_args *a = args; -+ -+ au_pin_hdir_acquire_nest(a->cpg->pin); -+ *a->errp = au_cpup_single(a->cpg, a->dst_parent); -+ au_pin_hdir_release(a->cpg->pin); -+} -+#endif -+ -+/* -+ * prevent SIGXFSZ in copy-up. -+ * testing CAP_MKNOD is for generic fs, -+ * but CAP_FSETID is for xfs only, currently. -+ */ -+static int au_cpup_sio_test(struct au_pin *pin, umode_t mode) -+{ -+ int do_sio; -+ struct super_block *sb; -+ struct inode *h_dir; -+ -+ do_sio = 0; -+ sb = au_pinned_parent(pin)->d_sb; -+ if (!au_wkq_test() -+ && (!au_sbi(sb)->si_plink_maint_pid -+ || au_plink_maint(sb, AuLock_NOPLM))) { -+ switch (mode & S_IFMT) { -+ case S_IFREG: -+ /* no condition about RLIMIT_FSIZE and the file size */ -+ do_sio = 1; -+ break; -+ case S_IFCHR: -+ case S_IFBLK: -+ do_sio = !capable(CAP_MKNOD); -+ break; -+ } -+ if (!do_sio) -+ do_sio = ((mode & (S_ISUID | S_ISGID)) -+ && !capable(CAP_FSETID)); -+ /* this workaround may be removed in the future */ -+ if (!do_sio) { -+ h_dir = au_pinned_h_dir(pin); -+ do_sio = h_dir->i_mode & S_ISVTX; -+ } -+ } -+ -+ return do_sio; -+} -+ -+#if 0 /* reserved */ -+int au_sio_cpup_single(struct au_cp_generic *cpg, struct dentry *dst_parent) -+{ -+ int err, wkq_err; -+ struct dentry *h_dentry; -+ -+ h_dentry = au_h_dptr(cpg->dentry, cpg->bsrc); -+ if (!au_cpup_sio_test(pin, d_inode(h_dentry)->i_mode)) -+ err = au_cpup_single(cpg, dst_parent); -+ else { -+ struct au_cpup_single_args args = { -+ .errp = &err, -+ .cpg = cpg, -+ .dst_parent = dst_parent -+ }; -+ wkq_err = au_wkq_wait(au_call_cpup_single, &args); -+ if (unlikely(wkq_err)) -+ err = wkq_err; -+ } -+ -+ return err; -+} -+#endif -+ -+/* -+ * copyup the @dentry from the first active lower branch to @bdst, -+ * using au_cpup_single(). -+ */ -+static int au_cpup_simple(struct au_cp_generic *cpg) -+{ -+ int err; -+ unsigned int flags_orig; -+ struct dentry *dentry; -+ -+ AuDebugOn(cpg->bsrc < 0); -+ -+ dentry = cpg->dentry; -+ DiMustWriteLock(dentry); -+ -+ err = au_lkup_neg(dentry, cpg->bdst, /*wh*/1); -+ if (!err) { -+ flags_orig = cpg->flags; -+ au_fset_cpup(cpg->flags, RENAME); -+ err = au_cpup_single(cpg, NULL); -+ cpg->flags = flags_orig; -+ if (!err) -+ return 0; /* success */ -+ -+ /* revert */ -+ au_set_h_dptr(dentry, cpg->bdst, NULL); -+ au_set_dbtop(dentry, cpg->bsrc); -+ } -+ -+ return err; -+} -+ -+struct au_cpup_simple_args { -+ int *errp; -+ struct au_cp_generic *cpg; -+}; -+ -+static void au_call_cpup_simple(void *args) -+{ -+ struct au_cpup_simple_args *a = args; -+ -+ au_pin_hdir_acquire_nest(a->cpg->pin); -+ *a->errp = au_cpup_simple(a->cpg); -+ au_pin_hdir_release(a->cpg->pin); -+} -+ -+static int au_do_sio_cpup_simple(struct au_cp_generic *cpg) -+{ -+ int err, wkq_err; -+ struct dentry *dentry, *parent; -+ struct file *h_file; -+ struct inode *h_dir; -+ -+ dentry = cpg->dentry; -+ h_file = NULL; -+ if (au_ftest_cpup(cpg->flags, HOPEN)) { -+ AuDebugOn(cpg->bsrc < 0); -+ h_file = au_h_open_pre(dentry, cpg->bsrc, /*force_wr*/0); -+ err = PTR_ERR(h_file); -+ if (IS_ERR(h_file)) -+ goto out; -+ } -+ -+ parent = dget_parent(dentry); -+ h_dir = au_h_iptr(d_inode(parent), cpg->bdst); -+ if (!au_test_h_perm_sio(h_dir, MAY_EXEC | MAY_WRITE) -+ && !au_cpup_sio_test(cpg->pin, d_inode(dentry)->i_mode)) -+ err = au_cpup_simple(cpg); -+ else { -+ struct au_cpup_simple_args args = { -+ .errp = &err, -+ .cpg = cpg -+ }; -+ wkq_err = au_wkq_wait(au_call_cpup_simple, &args); -+ if (unlikely(wkq_err)) -+ err = wkq_err; -+ } -+ -+ dput(parent); -+ if (h_file) -+ au_h_open_post(dentry, cpg->bsrc, h_file); -+ -+out: -+ return err; -+} -+ -+int au_sio_cpup_simple(struct au_cp_generic *cpg) -+{ -+ aufs_bindex_t bsrc, bbot; -+ struct dentry *dentry, *h_dentry; -+ -+ if (cpg->bsrc < 0) { -+ dentry = cpg->dentry; -+ bbot = au_dbbot(dentry); -+ for (bsrc = cpg->bdst + 1; bsrc <= bbot; bsrc++) { -+ h_dentry = au_h_dptr(dentry, bsrc); -+ if (h_dentry) { -+ AuDebugOn(d_is_negative(h_dentry)); -+ break; -+ } -+ } -+ AuDebugOn(bsrc > bbot); -+ cpg->bsrc = bsrc; -+ } -+ AuDebugOn(cpg->bsrc <= cpg->bdst); -+ return au_do_sio_cpup_simple(cpg); -+} -+ -+int au_sio_cpdown_simple(struct au_cp_generic *cpg) -+{ -+ AuDebugOn(cpg->bdst <= cpg->bsrc); -+ return au_do_sio_cpup_simple(cpg); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * copyup the deleted file for writing. -+ */ -+static int au_do_cpup_wh(struct au_cp_generic *cpg, struct dentry *wh_dentry, -+ struct file *file) -+{ -+ int err; -+ unsigned int flags_orig; -+ aufs_bindex_t bsrc_orig; -+ struct au_dinfo *dinfo; -+ struct { -+ struct au_hdentry *hd; -+ struct dentry *h_dentry; -+ } hdst, hsrc; -+ -+ dinfo = au_di(cpg->dentry); -+ AuRwMustWriteLock(&dinfo->di_rwsem); -+ -+ bsrc_orig = cpg->bsrc; -+ cpg->bsrc = dinfo->di_btop; -+ hdst.hd = au_hdentry(dinfo, cpg->bdst); -+ hdst.h_dentry = hdst.hd->hd_dentry; -+ hdst.hd->hd_dentry = wh_dentry; -+ dinfo->di_btop = cpg->bdst; -+ -+ hsrc.h_dentry = NULL; -+ if (file) { -+ hsrc.hd = au_hdentry(dinfo, cpg->bsrc); -+ hsrc.h_dentry = hsrc.hd->hd_dentry; -+ hsrc.hd->hd_dentry = au_hf_top(file)->f_path.dentry; -+ } -+ flags_orig = cpg->flags; -+ cpg->flags = !AuCpup_DTIME; -+ err = au_cpup_single(cpg, /*h_parent*/NULL); -+ cpg->flags = flags_orig; -+ if (file) { -+ if (!err) -+ err = au_reopen_nondir(file); -+ hsrc.hd->hd_dentry = hsrc.h_dentry; -+ } -+ hdst.hd->hd_dentry = hdst.h_dentry; -+ dinfo->di_btop = cpg->bsrc; -+ cpg->bsrc = bsrc_orig; -+ -+ return err; -+} -+ -+static int au_cpup_wh(struct au_cp_generic *cpg, struct file *file) -+{ -+ int err; -+ aufs_bindex_t bdst; -+ struct au_dtime dt; -+ struct dentry *dentry, *parent, *h_parent, *wh_dentry; -+ struct au_branch *br; -+ struct path h_path; -+ -+ dentry = cpg->dentry; -+ bdst = cpg->bdst; -+ br = au_sbr(dentry->d_sb, bdst); -+ parent = dget_parent(dentry); -+ h_parent = au_h_dptr(parent, bdst); -+ wh_dentry = au_whtmp_lkup(h_parent, br, &dentry->d_name); -+ err = PTR_ERR(wh_dentry); -+ if (IS_ERR(wh_dentry)) -+ goto out; -+ -+ h_path.dentry = h_parent; -+ h_path.mnt = au_br_mnt(br); -+ au_dtime_store(&dt, parent, &h_path); -+ err = au_do_cpup_wh(cpg, wh_dentry, file); -+ if (unlikely(err)) -+ goto out_wh; -+ -+ dget(wh_dentry); -+ h_path.dentry = wh_dentry; -+ if (!d_is_dir(wh_dentry)) { -+ /* no delegation since it is just created */ -+ err = vfsub_unlink(d_inode(h_parent), &h_path, -+ /*delegated*/NULL, /*force*/0); -+ } else -+ err = vfsub_rmdir(d_inode(h_parent), &h_path); -+ if (unlikely(err)) { -+ AuIOErr("failed remove copied-up tmp file %pd(%d)\n", -+ wh_dentry, err); -+ err = -EIO; -+ } -+ au_dtime_revert(&dt); -+ au_set_hi_wh(d_inode(dentry), bdst, wh_dentry); -+ -+out_wh: -+ dput(wh_dentry); -+out: -+ dput(parent); -+ return err; -+} -+ -+struct au_cpup_wh_args { -+ int *errp; -+ struct au_cp_generic *cpg; -+ struct file *file; -+}; -+ -+static void au_call_cpup_wh(void *args) -+{ -+ struct au_cpup_wh_args *a = args; -+ -+ au_pin_hdir_acquire_nest(a->cpg->pin); -+ *a->errp = au_cpup_wh(a->cpg, a->file); -+ au_pin_hdir_release(a->cpg->pin); -+} -+ -+int au_sio_cpup_wh(struct au_cp_generic *cpg, struct file *file) -+{ -+ int err, wkq_err; -+ aufs_bindex_t bdst; -+ struct dentry *dentry, *parent, *h_orph, *h_parent; -+ struct inode *dir, *h_dir, *h_tmpdir; -+ struct au_wbr *wbr; -+ struct au_pin wh_pin, *pin_orig; -+ -+ dentry = cpg->dentry; -+ bdst = cpg->bdst; -+ parent = dget_parent(dentry); -+ dir = d_inode(parent); -+ h_orph = NULL; -+ h_parent = NULL; -+ h_dir = au_igrab(au_h_iptr(dir, bdst)); -+ h_tmpdir = h_dir; -+ pin_orig = NULL; -+ if (!h_dir->i_nlink) { -+ wbr = au_sbr(dentry->d_sb, bdst)->br_wbr; -+ h_orph = wbr->wbr_orph; -+ -+ h_parent = dget(au_h_dptr(parent, bdst)); -+ au_set_h_dptr(parent, bdst, dget(h_orph)); -+ h_tmpdir = d_inode(h_orph); -+ au_set_h_iptr(dir, bdst, au_igrab(h_tmpdir), /*flags*/0); -+ -+ inode_lock_nested(h_tmpdir, AuLsc_I_PARENT3); -+ /* todo: au_h_open_pre()? */ -+ -+ pin_orig = cpg->pin; -+ au_pin_init(&wh_pin, dentry, bdst, AuLsc_DI_PARENT, -+ AuLsc_I_PARENT3, cpg->pin->udba, AuPin_DI_LOCKED); -+ cpg->pin = &wh_pin; -+ } -+ -+ if (!au_test_h_perm_sio(h_tmpdir, MAY_EXEC | MAY_WRITE) -+ && !au_cpup_sio_test(cpg->pin, d_inode(dentry)->i_mode)) -+ err = au_cpup_wh(cpg, file); -+ else { -+ struct au_cpup_wh_args args = { -+ .errp = &err, -+ .cpg = cpg, -+ .file = file -+ }; -+ wkq_err = au_wkq_wait(au_call_cpup_wh, &args); -+ if (unlikely(wkq_err)) -+ err = wkq_err; -+ } -+ -+ if (h_orph) { -+ inode_unlock(h_tmpdir); -+ /* todo: au_h_open_post()? */ -+ au_set_h_iptr(dir, bdst, au_igrab(h_dir), /*flags*/0); -+ au_set_h_dptr(parent, bdst, h_parent); -+ AuDebugOn(!pin_orig); -+ cpg->pin = pin_orig; -+ } -+ iput(h_dir); -+ dput(parent); -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * generic routine for both of copy-up and copy-down. -+ */ -+/* cf. revalidate function in file.c */ -+int au_cp_dirs(struct dentry *dentry, aufs_bindex_t bdst, -+ int (*cp)(struct dentry *dentry, aufs_bindex_t bdst, -+ struct au_pin *pin, -+ struct dentry *h_parent, void *arg), -+ void *arg) -+{ -+ int err; -+ struct au_pin pin; -+ struct dentry *d, *parent, *h_parent, *real_parent, *h_dentry; -+ -+ err = 0; -+ parent = dget_parent(dentry); -+ if (IS_ROOT(parent)) -+ goto out; -+ -+ au_pin_init(&pin, dentry, bdst, AuLsc_DI_PARENT2, AuLsc_I_PARENT2, -+ au_opt_udba(dentry->d_sb), AuPin_MNT_WRITE); -+ -+ /* do not use au_dpage */ -+ real_parent = parent; -+ while (1) { -+ dput(parent); -+ parent = dget_parent(dentry); -+ h_parent = au_h_dptr(parent, bdst); -+ if (h_parent) -+ goto out; /* success */ -+ -+ /* find top dir which is necessary to cpup */ -+ do { -+ d = parent; -+ dput(parent); -+ parent = dget_parent(d); -+ di_read_lock_parent3(parent, !AuLock_IR); -+ h_parent = au_h_dptr(parent, bdst); -+ di_read_unlock(parent, !AuLock_IR); -+ } while (!h_parent); -+ -+ if (d != real_parent) -+ di_write_lock_child3(d); -+ -+ /* somebody else might create while we were sleeping */ -+ h_dentry = au_h_dptr(d, bdst); -+ if (!h_dentry || d_is_negative(h_dentry)) { -+ if (h_dentry) -+ au_update_dbtop(d); -+ -+ au_pin_set_dentry(&pin, d); -+ err = au_do_pin(&pin); -+ if (!err) { -+ err = cp(d, bdst, &pin, h_parent, arg); -+ au_unpin(&pin); -+ } -+ } -+ -+ if (d != real_parent) -+ di_write_unlock(d); -+ if (unlikely(err)) -+ break; -+ } -+ -+out: -+ dput(parent); -+ return err; -+} -+ -+static int au_cpup_dir(struct dentry *dentry, aufs_bindex_t bdst, -+ struct au_pin *pin, -+ struct dentry *h_parent __maybe_unused, -+ void *arg __maybe_unused) -+{ -+ struct au_cp_generic cpg = { -+ .dentry = dentry, -+ .bdst = bdst, -+ .bsrc = -1, -+ .len = 0, -+ .pin = pin, -+ .flags = AuCpup_DTIME -+ }; -+ return au_sio_cpup_simple(&cpg); -+} -+ -+int au_cpup_dirs(struct dentry *dentry, aufs_bindex_t bdst) -+{ -+ return au_cp_dirs(dentry, bdst, au_cpup_dir, NULL); -+} -+ -+int au_test_and_cpup_dirs(struct dentry *dentry, aufs_bindex_t bdst) -+{ -+ int err; -+ struct dentry *parent; -+ struct inode *dir; -+ -+ parent = dget_parent(dentry); -+ dir = d_inode(parent); -+ err = 0; -+ if (au_h_iptr(dir, bdst)) -+ goto out; -+ -+ di_read_unlock(parent, AuLock_IR); -+ di_write_lock_parent(parent); -+ /* someone else might change our inode while we were sleeping */ -+ if (!au_h_iptr(dir, bdst)) -+ err = au_cpup_dirs(dentry, bdst); -+ di_downgrade_lock(parent, AuLock_IR); -+ -+out: -+ dput(parent); -+ return err; -+} -diff --git a/fs/aufs/cpup.h b/fs/aufs/cpup.h -new file mode 100644 -index 0000000..ccba2c4 ---- /dev/null -+++ b/fs/aufs/cpup.h -@@ -0,0 +1,81 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * copy-up/down functions -+ */ -+ -+#ifndef __AUFS_CPUP_H__ -+#define __AUFS_CPUP_H__ -+ -+#ifdef __KERNEL__ -+ -+#include -+ -+struct inode; -+struct file; -+struct au_pin; -+ -+void au_cpup_attr_flags(struct inode *dst, unsigned int iflags); -+void au_cpup_attr_timesizes(struct inode *inode); -+void au_cpup_attr_nlink(struct inode *inode, int force); -+void au_cpup_attr_changeable(struct inode *inode); -+void au_cpup_igen(struct inode *inode, struct inode *h_inode); -+void au_cpup_attr_all(struct inode *inode, int force); -+ -+/* ---------------------------------------------------------------------- */ -+ -+struct au_cp_generic { -+ struct dentry *dentry; -+ aufs_bindex_t bdst, bsrc; -+ loff_t len; -+ struct au_pin *pin; -+ unsigned int flags; -+}; -+ -+/* cpup flags */ -+#define AuCpup_DTIME 1 /* do dtime_store/revert */ -+#define AuCpup_KEEPLINO (1 << 1) /* do not clear the lower xino, -+ for link(2) */ -+#define AuCpup_RENAME (1 << 2) /* rename after cpup */ -+#define AuCpup_HOPEN (1 << 3) /* call h_open_pre/post() in -+ cpup */ -+#define AuCpup_OVERWRITE (1 << 4) /* allow overwriting the -+ existing entry */ -+#define AuCpup_RWDST (1 << 5) /* force write target even if -+ the branch is marked as RO */ -+ -+#define au_ftest_cpup(flags, name) ((flags) & AuCpup_##name) -+#define au_fset_cpup(flags, name) \ -+ do { (flags) |= AuCpup_##name; } while (0) -+#define au_fclr_cpup(flags, name) \ -+ do { (flags) &= ~AuCpup_##name; } while (0) -+ -+int au_copy_file(struct file *dst, struct file *src, loff_t len); -+int au_sio_cpup_simple(struct au_cp_generic *cpg); -+int au_sio_cpdown_simple(struct au_cp_generic *cpg); -+int au_sio_cpup_wh(struct au_cp_generic *cpg, struct file *file); -+ -+int au_cp_dirs(struct dentry *dentry, aufs_bindex_t bdst, -+ int (*cp)(struct dentry *dentry, aufs_bindex_t bdst, -+ struct au_pin *pin, -+ struct dentry *h_parent, void *arg), -+ void *arg); -+int au_cpup_dirs(struct dentry *dentry, aufs_bindex_t bdst); -+int au_test_and_cpup_dirs(struct dentry *dentry, aufs_bindex_t bdst); -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* keep timestamps when copyup */ -+struct au_dtime { -+ struct dentry *dt_dentry; -+ struct path dt_h_path; -+ struct timespec dt_atime, dt_mtime; -+}; -+void au_dtime_store(struct au_dtime *dt, struct dentry *dentry, -+ struct path *h_path); -+void au_dtime_revert(struct au_dtime *dt); -+ -+#endif /* __KERNEL__ */ -+#endif /* __AUFS_CPUP_H__ */ -diff --git a/fs/aufs/dbgaufs.c b/fs/aufs/dbgaufs.c -new file mode 100644 -index 0000000..4db01e8 ---- /dev/null -+++ b/fs/aufs/dbgaufs.c -@@ -0,0 +1,425 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * debugfs interface -+ */ -+ -+#include -+#include "aufs.h" -+ -+#ifndef CONFIG_SYSFS -+#error DEBUG_FS depends upon SYSFS -+#endif -+ -+static struct dentry *dbgaufs; -+static const mode_t dbgaufs_mode = S_IRUSR | S_IRGRP | S_IROTH; -+ -+/* 20 is max digits length of ulong 64 */ -+struct dbgaufs_arg { -+ int n; -+ char a[20 * 4]; -+}; -+ -+/* -+ * common function for all XINO files -+ */ -+static int dbgaufs_xi_release(struct inode *inode __maybe_unused, -+ struct file *file) -+{ -+ au_delayed_kfree(file->private_data); -+ return 0; -+} -+ -+static int dbgaufs_xi_open(struct file *xf, struct file *file, int do_fcnt) -+{ -+ int err; -+ struct kstat st; -+ struct dbgaufs_arg *p; -+ -+ err = -ENOMEM; -+ p = kmalloc(sizeof(*p), GFP_NOFS); -+ if (unlikely(!p)) -+ goto out; -+ -+ err = 0; -+ p->n = 0; -+ file->private_data = p; -+ if (!xf) -+ goto out; -+ -+ err = vfs_getattr(&xf->f_path, &st); -+ if (!err) { -+ if (do_fcnt) -+ p->n = snprintf -+ (p->a, sizeof(p->a), "%ld, %llux%lu %lld\n", -+ (long)file_count(xf), st.blocks, st.blksize, -+ (long long)st.size); -+ else -+ p->n = snprintf(p->a, sizeof(p->a), "%llux%lu %lld\n", -+ st.blocks, st.blksize, -+ (long long)st.size); -+ AuDebugOn(p->n >= sizeof(p->a)); -+ } else { -+ p->n = snprintf(p->a, sizeof(p->a), "err %d\n", err); -+ err = 0; -+ } -+ -+out: -+ return err; -+ -+} -+ -+static ssize_t dbgaufs_xi_read(struct file *file, char __user *buf, -+ size_t count, loff_t *ppos) -+{ -+ struct dbgaufs_arg *p; -+ -+ p = file->private_data; -+ return simple_read_from_buffer(buf, count, ppos, p->a, p->n); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+struct dbgaufs_plink_arg { -+ int n; -+ char a[]; -+}; -+ -+static int dbgaufs_plink_release(struct inode *inode __maybe_unused, -+ struct file *file) -+{ -+ au_delayed_free_page((unsigned long)file->private_data); -+ return 0; -+} -+ -+static int dbgaufs_plink_open(struct inode *inode, struct file *file) -+{ -+ int err, i, limit; -+ unsigned long n, sum; -+ struct dbgaufs_plink_arg *p; -+ struct au_sbinfo *sbinfo; -+ struct super_block *sb; -+ struct au_sphlhead *sphl; -+ -+ err = -ENOMEM; -+ p = (void *)get_zeroed_page(GFP_NOFS); -+ if (unlikely(!p)) -+ goto out; -+ -+ err = -EFBIG; -+ sbinfo = inode->i_private; -+ sb = sbinfo->si_sb; -+ si_noflush_read_lock(sb); -+ if (au_opt_test(au_mntflags(sb), PLINK)) { -+ limit = PAGE_SIZE - sizeof(p->n); -+ -+ /* the number of buckets */ -+ n = snprintf(p->a + p->n, limit, "%d\n", AuPlink_NHASH); -+ p->n += n; -+ limit -= n; -+ -+ sum = 0; -+ for (i = 0, sphl = sbinfo->si_plink; -+ i < AuPlink_NHASH; -+ i++, sphl++) { -+ n = au_sphl_count(sphl); -+ sum += n; -+ -+ n = snprintf(p->a + p->n, limit, "%lu ", n); -+ p->n += n; -+ limit -= n; -+ if (unlikely(limit <= 0)) -+ goto out_free; -+ } -+ p->a[p->n - 1] = '\n'; -+ -+ /* the sum of plinks */ -+ n = snprintf(p->a + p->n, limit, "%lu\n", sum); -+ p->n += n; -+ limit -= n; -+ if (unlikely(limit <= 0)) -+ goto out_free; -+ } else { -+#define str "1\n0\n0\n" -+ p->n = sizeof(str) - 1; -+ strcpy(p->a, str); -+#undef str -+ } -+ si_read_unlock(sb); -+ -+ err = 0; -+ file->private_data = p; -+ goto out; /* success */ -+ -+out_free: -+ au_delayed_free_page((unsigned long)p); -+out: -+ return err; -+} -+ -+static ssize_t dbgaufs_plink_read(struct file *file, char __user *buf, -+ size_t count, loff_t *ppos) -+{ -+ struct dbgaufs_plink_arg *p; -+ -+ p = file->private_data; -+ return simple_read_from_buffer(buf, count, ppos, p->a, p->n); -+} -+ -+static const struct file_operations dbgaufs_plink_fop = { -+ .owner = THIS_MODULE, -+ .open = dbgaufs_plink_open, -+ .release = dbgaufs_plink_release, -+ .read = dbgaufs_plink_read -+}; -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int dbgaufs_xib_open(struct inode *inode, struct file *file) -+{ -+ int err; -+ struct au_sbinfo *sbinfo; -+ struct super_block *sb; -+ -+ sbinfo = inode->i_private; -+ sb = sbinfo->si_sb; -+ si_noflush_read_lock(sb); -+ err = dbgaufs_xi_open(sbinfo->si_xib, file, /*do_fcnt*/0); -+ si_read_unlock(sb); -+ return err; -+} -+ -+static const struct file_operations dbgaufs_xib_fop = { -+ .owner = THIS_MODULE, -+ .open = dbgaufs_xib_open, -+ .release = dbgaufs_xi_release, -+ .read = dbgaufs_xi_read -+}; -+ -+/* ---------------------------------------------------------------------- */ -+ -+#define DbgaufsXi_PREFIX "xi" -+ -+static int dbgaufs_xino_open(struct inode *inode, struct file *file) -+{ -+ int err; -+ long l; -+ struct au_sbinfo *sbinfo; -+ struct super_block *sb; -+ struct file *xf; -+ struct qstr *name; -+ -+ err = -ENOENT; -+ xf = NULL; -+ name = &file->f_path.dentry->d_name; -+ if (unlikely(name->len < sizeof(DbgaufsXi_PREFIX) -+ || memcmp(name->name, DbgaufsXi_PREFIX, -+ sizeof(DbgaufsXi_PREFIX) - 1))) -+ goto out; -+ err = kstrtol(name->name + sizeof(DbgaufsXi_PREFIX) - 1, 10, &l); -+ if (unlikely(err)) -+ goto out; -+ -+ sbinfo = inode->i_private; -+ sb = sbinfo->si_sb; -+ si_noflush_read_lock(sb); -+ if (l <= au_sbbot(sb)) { -+ xf = au_sbr(sb, (aufs_bindex_t)l)->br_xino.xi_file; -+ err = dbgaufs_xi_open(xf, file, /*do_fcnt*/1); -+ } else -+ err = -ENOENT; -+ si_read_unlock(sb); -+ -+out: -+ return err; -+} -+ -+static const struct file_operations dbgaufs_xino_fop = { -+ .owner = THIS_MODULE, -+ .open = dbgaufs_xino_open, -+ .release = dbgaufs_xi_release, -+ .read = dbgaufs_xi_read -+}; -+ -+void dbgaufs_brs_del(struct super_block *sb, aufs_bindex_t bindex) -+{ -+ aufs_bindex_t bbot; -+ struct au_branch *br; -+ struct au_xino_file *xi; -+ -+ if (!au_sbi(sb)->si_dbgaufs) -+ return; -+ -+ bbot = au_sbbot(sb); -+ for (; bindex <= bbot; bindex++) { -+ br = au_sbr(sb, bindex); -+ xi = &br->br_xino; -+ /* debugfs acquires the parent i_mutex */ -+ lockdep_off(); -+ debugfs_remove(xi->xi_dbgaufs); -+ lockdep_on(); -+ xi->xi_dbgaufs = NULL; -+ } -+} -+ -+void dbgaufs_brs_add(struct super_block *sb, aufs_bindex_t bindex) -+{ -+ struct au_sbinfo *sbinfo; -+ struct dentry *parent; -+ struct au_branch *br; -+ struct au_xino_file *xi; -+ aufs_bindex_t bbot; -+ char name[sizeof(DbgaufsXi_PREFIX) + 5]; /* "xi" bindex NULL */ -+ -+ sbinfo = au_sbi(sb); -+ parent = sbinfo->si_dbgaufs; -+ if (!parent) -+ return; -+ -+ bbot = au_sbbot(sb); -+ for (; bindex <= bbot; bindex++) { -+ snprintf(name, sizeof(name), DbgaufsXi_PREFIX "%d", bindex); -+ br = au_sbr(sb, bindex); -+ xi = &br->br_xino; -+ AuDebugOn(xi->xi_dbgaufs); -+ /* debugfs acquires the parent i_mutex */ -+ lockdep_off(); -+ xi->xi_dbgaufs = debugfs_create_file(name, dbgaufs_mode, parent, -+ sbinfo, &dbgaufs_xino_fop); -+ lockdep_on(); -+ /* ignore an error */ -+ if (unlikely(!xi->xi_dbgaufs)) -+ AuWarn1("failed %s under debugfs\n", name); -+ } -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+#ifdef CONFIG_AUFS_EXPORT -+static int dbgaufs_xigen_open(struct inode *inode, struct file *file) -+{ -+ int err; -+ struct au_sbinfo *sbinfo; -+ struct super_block *sb; -+ -+ sbinfo = inode->i_private; -+ sb = sbinfo->si_sb; -+ si_noflush_read_lock(sb); -+ err = dbgaufs_xi_open(sbinfo->si_xigen, file, /*do_fcnt*/0); -+ si_read_unlock(sb); -+ return err; -+} -+ -+static const struct file_operations dbgaufs_xigen_fop = { -+ .owner = THIS_MODULE, -+ .open = dbgaufs_xigen_open, -+ .release = dbgaufs_xi_release, -+ .read = dbgaufs_xi_read -+}; -+ -+static int dbgaufs_xigen_init(struct au_sbinfo *sbinfo) -+{ -+ int err; -+ -+ /* -+ * This function is a dynamic '__init' function actually, -+ * so the tiny check for si_rwsem is unnecessary. -+ */ -+ /* AuRwMustWriteLock(&sbinfo->si_rwsem); */ -+ -+ err = -EIO; -+ sbinfo->si_dbgaufs_xigen = debugfs_create_file -+ ("xigen", dbgaufs_mode, sbinfo->si_dbgaufs, sbinfo, -+ &dbgaufs_xigen_fop); -+ if (sbinfo->si_dbgaufs_xigen) -+ err = 0; -+ -+ return err; -+} -+#else -+static int dbgaufs_xigen_init(struct au_sbinfo *sbinfo) -+{ -+ return 0; -+} -+#endif /* CONFIG_AUFS_EXPORT */ -+ -+/* ---------------------------------------------------------------------- */ -+ -+void dbgaufs_si_fin(struct au_sbinfo *sbinfo) -+{ -+ /* -+ * This function is a dynamic '__fin' function actually, -+ * so the tiny check for si_rwsem is unnecessary. -+ */ -+ /* AuRwMustWriteLock(&sbinfo->si_rwsem); */ -+ -+ debugfs_remove_recursive(sbinfo->si_dbgaufs); -+ sbinfo->si_dbgaufs = NULL; -+ kobject_put(&sbinfo->si_kobj); -+} -+ -+int dbgaufs_si_init(struct au_sbinfo *sbinfo) -+{ -+ int err; -+ char name[SysaufsSiNameLen]; -+ -+ /* -+ * This function is a dynamic '__init' function actually, -+ * so the tiny check for si_rwsem is unnecessary. -+ */ -+ /* AuRwMustWriteLock(&sbinfo->si_rwsem); */ -+ -+ err = -ENOENT; -+ if (!dbgaufs) { -+ AuErr1("/debug/aufs is uninitialized\n"); -+ goto out; -+ } -+ -+ err = -EIO; -+ sysaufs_name(sbinfo, name); -+ sbinfo->si_dbgaufs = debugfs_create_dir(name, dbgaufs); -+ if (unlikely(!sbinfo->si_dbgaufs)) -+ goto out; -+ kobject_get(&sbinfo->si_kobj); -+ -+ sbinfo->si_dbgaufs_xib = debugfs_create_file -+ ("xib", dbgaufs_mode, sbinfo->si_dbgaufs, sbinfo, -+ &dbgaufs_xib_fop); -+ if (unlikely(!sbinfo->si_dbgaufs_xib)) -+ goto out_dir; -+ -+ sbinfo->si_dbgaufs_plink = debugfs_create_file -+ ("plink", dbgaufs_mode, sbinfo->si_dbgaufs, sbinfo, -+ &dbgaufs_plink_fop); -+ if (unlikely(!sbinfo->si_dbgaufs_plink)) -+ goto out_dir; -+ -+ err = dbgaufs_xigen_init(sbinfo); -+ if (!err) -+ goto out; /* success */ -+ -+out_dir: -+ dbgaufs_si_fin(sbinfo); -+out: -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+void dbgaufs_fin(void) -+{ -+ debugfs_remove(dbgaufs); -+} -+ -+int __init dbgaufs_init(void) -+{ -+ int err; -+ -+ err = -EIO; -+ dbgaufs = debugfs_create_dir(AUFS_NAME, NULL); -+ if (dbgaufs) -+ err = 0; -+ return err; -+} -diff --git a/fs/aufs/dbgaufs.h b/fs/aufs/dbgaufs.h -new file mode 100644 -index 0000000..81f272e ---- /dev/null -+++ b/fs/aufs/dbgaufs.h -@@ -0,0 +1,35 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * debugfs interface -+ */ -+ -+#ifndef __DBGAUFS_H__ -+#define __DBGAUFS_H__ -+ -+#ifdef __KERNEL__ -+ -+struct super_block; -+struct au_sbinfo; -+ -+#ifdef CONFIG_DEBUG_FS -+/* dbgaufs.c */ -+void dbgaufs_brs_del(struct super_block *sb, aufs_bindex_t bindex); -+void dbgaufs_brs_add(struct super_block *sb, aufs_bindex_t bindex); -+void dbgaufs_si_fin(struct au_sbinfo *sbinfo); -+int dbgaufs_si_init(struct au_sbinfo *sbinfo); -+void dbgaufs_fin(void); -+int __init dbgaufs_init(void); -+#else -+AuStubVoid(dbgaufs_brs_del, struct super_block *sb, aufs_bindex_t bindex) -+AuStubVoid(dbgaufs_brs_add, struct super_block *sb, aufs_bindex_t bindex) -+AuStubVoid(dbgaufs_si_fin, struct au_sbinfo *sbinfo) -+AuStubInt0(dbgaufs_si_init, struct au_sbinfo *sbinfo) -+AuStubVoid(dbgaufs_fin, void) -+AuStubInt0(__init dbgaufs_init, void) -+#endif /* CONFIG_DEBUG_FS */ -+ -+#endif /* __KERNEL__ */ -+#endif /* __DBGAUFS_H__ */ -diff --git a/fs/aufs/dcsub.c b/fs/aufs/dcsub.c -new file mode 100644 -index 0000000..5d46398 ---- /dev/null -+++ b/fs/aufs/dcsub.c -@@ -0,0 +1,212 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * sub-routines for dentry cache -+ */ -+ -+#include "aufs.h" -+ -+static void au_dpage_free(struct au_dpage *dpage) -+{ -+ int i; -+ struct dentry **p; -+ -+ p = dpage->dentries; -+ for (i = 0; i < dpage->ndentry; i++) -+ dput(*p++); -+ au_delayed_free_page((unsigned long)dpage->dentries); -+} -+ -+int au_dpages_init(struct au_dcsub_pages *dpages, gfp_t gfp) -+{ -+ int err; -+ void *p; -+ -+ err = -ENOMEM; -+ dpages->dpages = kmalloc(sizeof(*dpages->dpages), gfp); -+ if (unlikely(!dpages->dpages)) -+ goto out; -+ -+ p = (void *)__get_free_page(gfp); -+ if (unlikely(!p)) -+ goto out_dpages; -+ -+ dpages->dpages[0].ndentry = 0; -+ dpages->dpages[0].dentries = p; -+ dpages->ndpage = 1; -+ return 0; /* success */ -+ -+out_dpages: -+ au_delayed_kfree(dpages->dpages); -+out: -+ return err; -+} -+ -+void au_dpages_free(struct au_dcsub_pages *dpages) -+{ -+ int i; -+ struct au_dpage *p; -+ -+ p = dpages->dpages; -+ for (i = 0; i < dpages->ndpage; i++) -+ au_dpage_free(p++); -+ au_delayed_kfree(dpages->dpages); -+} -+ -+static int au_dpages_append(struct au_dcsub_pages *dpages, -+ struct dentry *dentry, gfp_t gfp) -+{ -+ int err, sz; -+ struct au_dpage *dpage; -+ void *p; -+ -+ dpage = dpages->dpages + dpages->ndpage - 1; -+ sz = PAGE_SIZE / sizeof(dentry); -+ if (unlikely(dpage->ndentry >= sz)) { -+ AuLabel(new dpage); -+ err = -ENOMEM; -+ sz = dpages->ndpage * sizeof(*dpages->dpages); -+ p = au_kzrealloc(dpages->dpages, sz, -+ sz + sizeof(*dpages->dpages), gfp, -+ /*may_shrink*/0); -+ if (unlikely(!p)) -+ goto out; -+ -+ dpages->dpages = p; -+ dpage = dpages->dpages + dpages->ndpage; -+ p = (void *)__get_free_page(gfp); -+ if (unlikely(!p)) -+ goto out; -+ -+ dpage->ndentry = 0; -+ dpage->dentries = p; -+ dpages->ndpage++; -+ } -+ -+ AuDebugOn(au_dcount(dentry) <= 0); -+ dpage->dentries[dpage->ndentry++] = dget_dlock(dentry); -+ return 0; /* success */ -+ -+out: -+ return err; -+} -+ -+/* todo: BAD approach */ -+/* copied from linux/fs/dcache.c */ -+enum d_walk_ret { -+ D_WALK_CONTINUE, -+ D_WALK_QUIT, -+ D_WALK_NORETRY, -+ D_WALK_SKIP, -+}; -+ -+extern void d_walk(struct dentry *parent, void *data, -+ enum d_walk_ret (*enter)(void *, struct dentry *), -+ void (*finish)(void *)); -+ -+struct ac_dpages_arg { -+ int err; -+ struct au_dcsub_pages *dpages; -+ struct super_block *sb; -+ au_dpages_test test; -+ void *arg; -+}; -+ -+static enum d_walk_ret au_call_dpages_append(void *_arg, struct dentry *dentry) -+{ -+ enum d_walk_ret ret; -+ struct ac_dpages_arg *arg = _arg; -+ -+ ret = D_WALK_CONTINUE; -+ if (dentry->d_sb == arg->sb -+ && !IS_ROOT(dentry) -+ && au_dcount(dentry) > 0 -+ && au_di(dentry) -+ && (!arg->test || arg->test(dentry, arg->arg))) { -+ arg->err = au_dpages_append(arg->dpages, dentry, GFP_ATOMIC); -+ if (unlikely(arg->err)) -+ ret = D_WALK_QUIT; -+ } -+ -+ return ret; -+} -+ -+int au_dcsub_pages(struct au_dcsub_pages *dpages, struct dentry *root, -+ au_dpages_test test, void *arg) -+{ -+ struct ac_dpages_arg args = { -+ .err = 0, -+ .dpages = dpages, -+ .sb = root->d_sb, -+ .test = test, -+ .arg = arg -+ }; -+ -+ d_walk(root, &args, au_call_dpages_append, NULL); -+ -+ return args.err; -+} -+ -+int au_dcsub_pages_rev(struct au_dcsub_pages *dpages, struct dentry *dentry, -+ int do_include, au_dpages_test test, void *arg) -+{ -+ int err; -+ -+ err = 0; -+ write_seqlock(&rename_lock); -+ spin_lock(&dentry->d_lock); -+ if (do_include -+ && au_dcount(dentry) > 0 -+ && (!test || test(dentry, arg))) -+ err = au_dpages_append(dpages, dentry, GFP_ATOMIC); -+ spin_unlock(&dentry->d_lock); -+ if (unlikely(err)) -+ goto out; -+ -+ /* -+ * RCU for vfsmount is unnecessary since this is a traverse in a single -+ * mount -+ */ -+ while (!IS_ROOT(dentry)) { -+ dentry = dentry->d_parent; /* rename_lock is locked */ -+ spin_lock(&dentry->d_lock); -+ if (au_dcount(dentry) > 0 -+ && (!test || test(dentry, arg))) -+ err = au_dpages_append(dpages, dentry, GFP_ATOMIC); -+ spin_unlock(&dentry->d_lock); -+ if (unlikely(err)) -+ break; -+ } -+ -+out: -+ write_sequnlock(&rename_lock); -+ return err; -+} -+ -+static inline int au_dcsub_dpages_aufs(struct dentry *dentry, void *arg) -+{ -+ return au_di(dentry) && dentry->d_sb == arg; -+} -+ -+int au_dcsub_pages_rev_aufs(struct au_dcsub_pages *dpages, -+ struct dentry *dentry, int do_include) -+{ -+ return au_dcsub_pages_rev(dpages, dentry, do_include, -+ au_dcsub_dpages_aufs, dentry->d_sb); -+} -+ -+int au_test_subdir(struct dentry *d1, struct dentry *d2) -+{ -+ struct path path[2] = { -+ { -+ .dentry = d1 -+ }, -+ { -+ .dentry = d2 -+ } -+ }; -+ -+ return path_is_under(path + 0, path + 1); -+} -diff --git a/fs/aufs/dcsub.h b/fs/aufs/dcsub.h -new file mode 100644 -index 0000000..5d2cf66 ---- /dev/null -+++ b/fs/aufs/dcsub.h -@@ -0,0 +1,123 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * sub-routines for dentry cache -+ */ -+ -+#ifndef __AUFS_DCSUB_H__ -+#define __AUFS_DCSUB_H__ -+ -+#ifdef __KERNEL__ -+ -+#include -+#include -+ -+struct au_dpage { -+ int ndentry; -+ struct dentry **dentries; -+}; -+ -+struct au_dcsub_pages { -+ int ndpage; -+ struct au_dpage *dpages; -+}; -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* dcsub.c */ -+int au_dpages_init(struct au_dcsub_pages *dpages, gfp_t gfp); -+void au_dpages_free(struct au_dcsub_pages *dpages); -+typedef int (*au_dpages_test)(struct dentry *dentry, void *arg); -+int au_dcsub_pages(struct au_dcsub_pages *dpages, struct dentry *root, -+ au_dpages_test test, void *arg); -+int au_dcsub_pages_rev(struct au_dcsub_pages *dpages, struct dentry *dentry, -+ int do_include, au_dpages_test test, void *arg); -+int au_dcsub_pages_rev_aufs(struct au_dcsub_pages *dpages, -+ struct dentry *dentry, int do_include); -+int au_test_subdir(struct dentry *d1, struct dentry *d2); -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * todo: in linux-3.13, several similar (but faster) helpers are added to -+ * include/linux/dcache.h. Try them (in the future). -+ */ -+ -+static inline int au_d_hashed_positive(struct dentry *d) -+{ -+ int err; -+ struct inode *inode = d_inode(d); -+ -+ err = 0; -+ if (unlikely(d_unhashed(d) -+ || d_is_negative(d) -+ || !inode->i_nlink)) -+ err = -ENOENT; -+ return err; -+} -+ -+static inline int au_d_linkable(struct dentry *d) -+{ -+ int err; -+ struct inode *inode = d_inode(d); -+ -+ err = au_d_hashed_positive(d); -+ if (err -+ && d_is_positive(d) -+ && (inode->i_state & I_LINKABLE)) -+ err = 0; -+ return err; -+} -+ -+static inline int au_d_alive(struct dentry *d) -+{ -+ int err; -+ struct inode *inode; -+ -+ err = 0; -+ if (!IS_ROOT(d)) -+ err = au_d_hashed_positive(d); -+ else { -+ inode = d_inode(d); -+ if (unlikely(d_unlinked(d) -+ || d_is_negative(d) -+ || !inode->i_nlink)) -+ err = -ENOENT; -+ } -+ return err; -+} -+ -+static inline int au_alive_dir(struct dentry *d) -+{ -+ int err; -+ -+ err = au_d_alive(d); -+ if (unlikely(err || IS_DEADDIR(d_inode(d)))) -+ err = -ENOENT; -+ return err; -+} -+ -+static inline int au_qstreq(struct qstr *a, struct qstr *b) -+{ -+ return a->len == b->len -+ && !memcmp(a->name, b->name, a->len); -+} -+ -+/* -+ * by the commit -+ * 360f547 2015-01-25 dcache: let the dentry count go down to zero without -+ * taking d_lock -+ * the type of d_lockref.count became int, but the inlined function d_count() -+ * still returns unsigned int. -+ * I don't know why. Maybe it is for every d_count() users? -+ * Anyway au_dcount() lives on. -+ */ -+static inline int au_dcount(struct dentry *d) -+{ -+ return (int)d_count(d); -+} -+ -+#endif /* __KERNEL__ */ -+#endif /* __AUFS_DCSUB_H__ */ -diff --git a/fs/aufs/debug.c b/fs/aufs/debug.c -new file mode 100644 -index 0000000..443fee3 ---- /dev/null -+++ b/fs/aufs/debug.c -@@ -0,0 +1,427 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * debug print functions -+ */ -+ -+#include "aufs.h" -+ -+/* Returns 0, or -errno. arg is in kp->arg. */ -+static int param_atomic_t_set(const char *val, const struct kernel_param *kp) -+{ -+ int err, n; -+ -+ err = kstrtoint(val, 0, &n); -+ if (!err) { -+ if (n > 0) -+ au_debug_on(); -+ else -+ au_debug_off(); -+ } -+ return err; -+} -+ -+/* Returns length written or -errno. Buffer is 4k (ie. be short!) */ -+static int param_atomic_t_get(char *buffer, const struct kernel_param *kp) -+{ -+ atomic_t *a; -+ -+ a = kp->arg; -+ return sprintf(buffer, "%d", atomic_read(a)); -+} -+ -+static struct kernel_param_ops param_ops_atomic_t = { -+ .set = param_atomic_t_set, -+ .get = param_atomic_t_get -+ /* void (*free)(void *arg) */ -+}; -+ -+atomic_t aufs_debug = ATOMIC_INIT(0); -+MODULE_PARM_DESC(debug, "debug print"); -+module_param_named(debug, aufs_debug, atomic_t, S_IRUGO | S_IWUSR | S_IWGRP); -+ -+DEFINE_MUTEX(au_dbg_mtx); /* just to serialize the dbg msgs */ -+char *au_plevel = KERN_DEBUG; -+#define dpri(fmt, ...) do { \ -+ if ((au_plevel \ -+ && strcmp(au_plevel, KERN_DEBUG)) \ -+ || au_debug_test()) \ -+ printk("%s" fmt, au_plevel, ##__VA_ARGS__); \ -+} while (0) -+ -+/* ---------------------------------------------------------------------- */ -+ -+void au_dpri_whlist(struct au_nhash *whlist) -+{ -+ unsigned long ul, n; -+ struct hlist_head *head; -+ struct au_vdir_wh *pos; -+ -+ n = whlist->nh_num; -+ head = whlist->nh_head; -+ for (ul = 0; ul < n; ul++) { -+ hlist_for_each_entry(pos, head, wh_hash) -+ dpri("b%d, %.*s, %d\n", -+ pos->wh_bindex, -+ pos->wh_str.len, pos->wh_str.name, -+ pos->wh_str.len); -+ head++; -+ } -+} -+ -+void au_dpri_vdir(struct au_vdir *vdir) -+{ -+ unsigned long ul; -+ union au_vdir_deblk_p p; -+ unsigned char *o; -+ -+ if (!vdir || IS_ERR(vdir)) { -+ dpri("err %ld\n", PTR_ERR(vdir)); -+ return; -+ } -+ -+ dpri("deblk %u, nblk %lu, deblk %p, last{%lu, %p}, ver %lu\n", -+ vdir->vd_deblk_sz, vdir->vd_nblk, vdir->vd_deblk, -+ vdir->vd_last.ul, vdir->vd_last.p.deblk, vdir->vd_version); -+ for (ul = 0; ul < vdir->vd_nblk; ul++) { -+ p.deblk = vdir->vd_deblk[ul]; -+ o = p.deblk; -+ dpri("[%lu]: %p\n", ul, o); -+ } -+} -+ -+static int do_pri_inode(aufs_bindex_t bindex, struct inode *inode, int hn, -+ struct dentry *wh) -+{ -+ char *n = NULL; -+ int l = 0; -+ -+ if (!inode || IS_ERR(inode)) { -+ dpri("i%d: err %ld\n", bindex, PTR_ERR(inode)); -+ return -1; -+ } -+ -+ /* the type of i_blocks depends upon CONFIG_LBDAF */ -+ BUILD_BUG_ON(sizeof(inode->i_blocks) != sizeof(unsigned long) -+ && sizeof(inode->i_blocks) != sizeof(u64)); -+ if (wh) { -+ n = (void *)wh->d_name.name; -+ l = wh->d_name.len; -+ } -+ -+ dpri("i%d: %p, i%lu, %s, cnt %d, nl %u, 0%o, sz %llu, blk %llu," -+ " hn %d, ct %lld, np %lu, st 0x%lx, f 0x%x, v %llu, g %x%s%.*s\n", -+ bindex, inode, -+ inode->i_ino, inode->i_sb ? au_sbtype(inode->i_sb) : "??", -+ atomic_read(&inode->i_count), inode->i_nlink, inode->i_mode, -+ i_size_read(inode), (unsigned long long)inode->i_blocks, -+ hn, (long long)timespec_to_ns(&inode->i_ctime) & 0x0ffff, -+ inode->i_mapping ? inode->i_mapping->nrpages : 0, -+ inode->i_state, inode->i_flags, inode->i_version, -+ inode->i_generation, -+ l ? ", wh " : "", l, n); -+ return 0; -+} -+ -+void au_dpri_inode(struct inode *inode) -+{ -+ struct au_iinfo *iinfo; -+ struct au_hinode *hi; -+ aufs_bindex_t bindex; -+ int err, hn; -+ -+ err = do_pri_inode(-1, inode, -1, NULL); -+ if (err || !au_test_aufs(inode->i_sb) || au_is_bad_inode(inode)) -+ return; -+ -+ iinfo = au_ii(inode); -+ dpri("i-1: btop %d, bbot %d, gen %d\n", -+ iinfo->ii_btop, iinfo->ii_bbot, au_iigen(inode, NULL)); -+ if (iinfo->ii_btop < 0) -+ return; -+ hn = 0; -+ for (bindex = iinfo->ii_btop; bindex <= iinfo->ii_bbot; bindex++) { -+ hi = au_hinode(iinfo, bindex); -+ hn = !!au_hn(hi); -+ do_pri_inode(bindex, hi->hi_inode, hn, hi->hi_whdentry); -+ } -+} -+ -+void au_dpri_dalias(struct inode *inode) -+{ -+ struct dentry *d; -+ -+ spin_lock(&inode->i_lock); -+ hlist_for_each_entry(d, &inode->i_dentry, d_u.d_alias) -+ au_dpri_dentry(d); -+ spin_unlock(&inode->i_lock); -+} -+ -+static int do_pri_dentry(aufs_bindex_t bindex, struct dentry *dentry) -+{ -+ struct dentry *wh = NULL; -+ int hn; -+ struct inode *inode; -+ struct au_iinfo *iinfo; -+ struct au_hinode *hi; -+ -+ if (!dentry || IS_ERR(dentry)) { -+ dpri("d%d: err %ld\n", bindex, PTR_ERR(dentry)); -+ return -1; -+ } -+ /* do not call dget_parent() here */ -+ /* note: access d_xxx without d_lock */ -+ dpri("d%d: %p, %pd2?, %s, cnt %d, flags 0x%x, %shashed\n", -+ bindex, dentry, dentry, -+ dentry->d_sb ? au_sbtype(dentry->d_sb) : "??", -+ au_dcount(dentry), dentry->d_flags, -+ d_unhashed(dentry) ? "un" : ""); -+ hn = -1; -+ inode = NULL; -+ if (d_is_positive(dentry)) -+ inode = d_inode(dentry); -+ if (inode -+ && au_test_aufs(dentry->d_sb) -+ && bindex >= 0 -+ && !au_is_bad_inode(inode)) { -+ iinfo = au_ii(inode); -+ hi = au_hinode(iinfo, bindex); -+ hn = !!au_hn(hi); -+ wh = hi->hi_whdentry; -+ } -+ do_pri_inode(bindex, inode, hn, wh); -+ return 0; -+} -+ -+void au_dpri_dentry(struct dentry *dentry) -+{ -+ struct au_dinfo *dinfo; -+ aufs_bindex_t bindex; -+ int err; -+ -+ err = do_pri_dentry(-1, dentry); -+ if (err || !au_test_aufs(dentry->d_sb)) -+ return; -+ -+ dinfo = au_di(dentry); -+ if (!dinfo) -+ return; -+ dpri("d-1: btop %d, bbot %d, bwh %d, bdiropq %d, gen %d, tmp %d\n", -+ dinfo->di_btop, dinfo->di_bbot, -+ dinfo->di_bwh, dinfo->di_bdiropq, au_digen(dentry), -+ dinfo->di_tmpfile); -+ if (dinfo->di_btop < 0) -+ return; -+ for (bindex = dinfo->di_btop; bindex <= dinfo->di_bbot; bindex++) -+ do_pri_dentry(bindex, au_hdentry(dinfo, bindex)->hd_dentry); -+} -+ -+static int do_pri_file(aufs_bindex_t bindex, struct file *file) -+{ -+ char a[32]; -+ -+ if (!file || IS_ERR(file)) { -+ dpri("f%d: err %ld\n", bindex, PTR_ERR(file)); -+ return -1; -+ } -+ a[0] = 0; -+ if (bindex < 0 -+ && !IS_ERR_OR_NULL(file->f_path.dentry) -+ && au_test_aufs(file->f_path.dentry->d_sb) -+ && au_fi(file)) -+ snprintf(a, sizeof(a), ", gen %d, mmapped %d", -+ au_figen(file), atomic_read(&au_fi(file)->fi_mmapped)); -+ dpri("f%d: mode 0x%x, flags 0%o, cnt %ld, v %llu, pos %llu%s\n", -+ bindex, file->f_mode, file->f_flags, (long)file_count(file), -+ file->f_version, file->f_pos, a); -+ if (!IS_ERR_OR_NULL(file->f_path.dentry)) -+ do_pri_dentry(bindex, file->f_path.dentry); -+ return 0; -+} -+ -+void au_dpri_file(struct file *file) -+{ -+ struct au_finfo *finfo; -+ struct au_fidir *fidir; -+ struct au_hfile *hfile; -+ aufs_bindex_t bindex; -+ int err; -+ -+ err = do_pri_file(-1, file); -+ if (err -+ || IS_ERR_OR_NULL(file->f_path.dentry) -+ || !au_test_aufs(file->f_path.dentry->d_sb)) -+ return; -+ -+ finfo = au_fi(file); -+ if (!finfo) -+ return; -+ if (finfo->fi_btop < 0) -+ return; -+ fidir = finfo->fi_hdir; -+ if (!fidir) -+ do_pri_file(finfo->fi_btop, finfo->fi_htop.hf_file); -+ else -+ for (bindex = finfo->fi_btop; -+ bindex >= 0 && bindex <= fidir->fd_bbot; -+ bindex++) { -+ hfile = fidir->fd_hfile + bindex; -+ do_pri_file(bindex, hfile ? hfile->hf_file : NULL); -+ } -+} -+ -+static int do_pri_br(aufs_bindex_t bindex, struct au_branch *br) -+{ -+ struct vfsmount *mnt; -+ struct super_block *sb; -+ -+ if (!br || IS_ERR(br)) -+ goto out; -+ mnt = au_br_mnt(br); -+ if (!mnt || IS_ERR(mnt)) -+ goto out; -+ sb = mnt->mnt_sb; -+ if (!sb || IS_ERR(sb)) -+ goto out; -+ -+ dpri("s%d: {perm 0x%x, id %d, cnt %lld, wbr %p}, " -+ "%s, dev 0x%02x%02x, flags 0x%lx, cnt %d, active %d, " -+ "xino %d\n", -+ bindex, br->br_perm, br->br_id, au_br_count(br), -+ br->br_wbr, au_sbtype(sb), MAJOR(sb->s_dev), MINOR(sb->s_dev), -+ sb->s_flags, sb->s_count, -+ atomic_read(&sb->s_active), !!br->br_xino.xi_file); -+ return 0; -+ -+out: -+ dpri("s%d: err %ld\n", bindex, PTR_ERR(br)); -+ return -1; -+} -+ -+void au_dpri_sb(struct super_block *sb) -+{ -+ struct au_sbinfo *sbinfo; -+ aufs_bindex_t bindex; -+ int err; -+ /* to reuduce stack size */ -+ struct { -+ struct vfsmount mnt; -+ struct au_branch fake; -+ } *a; -+ -+ /* this function can be called from magic sysrq */ -+ a = kzalloc(sizeof(*a), GFP_ATOMIC); -+ if (unlikely(!a)) { -+ dpri("no memory\n"); -+ return; -+ } -+ -+ a->mnt.mnt_sb = sb; -+ a->fake.br_path.mnt = &a->mnt; -+ au_br_count_init(&a->fake); -+ err = do_pri_br(-1, &a->fake); -+ au_br_count_fin(&a->fake); -+ au_delayed_kfree(a); -+ dpri("dev 0x%x\n", sb->s_dev); -+ if (err || !au_test_aufs(sb)) -+ return; -+ -+ sbinfo = au_sbi(sb); -+ if (!sbinfo) -+ return; -+ dpri("nw %d, gen %u, kobj %d\n", -+ atomic_read(&sbinfo->si_nowait.nw_len), sbinfo->si_generation, -+ atomic_read(&sbinfo->si_kobj.kref.refcount)); -+ for (bindex = 0; bindex <= sbinfo->si_bbot; bindex++) -+ do_pri_br(bindex, sbinfo->si_branch[0 + bindex]); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+void __au_dbg_verify_dinode(struct dentry *dentry, const char *func, int line) -+{ -+ struct inode *h_inode, *inode = d_inode(dentry); -+ struct dentry *h_dentry; -+ aufs_bindex_t bindex, bbot, bi; -+ -+ if (!inode /* || au_di(dentry)->di_lsc == AuLsc_DI_TMP */) -+ return; -+ -+ bbot = au_dbbot(dentry); -+ bi = au_ibbot(inode); -+ if (bi < bbot) -+ bbot = bi; -+ bindex = au_dbtop(dentry); -+ bi = au_ibtop(inode); -+ if (bi > bindex) -+ bindex = bi; -+ -+ for (; bindex <= bbot; bindex++) { -+ h_dentry = au_h_dptr(dentry, bindex); -+ if (!h_dentry) -+ continue; -+ h_inode = au_h_iptr(inode, bindex); -+ if (unlikely(h_inode != d_inode(h_dentry))) { -+ au_debug_on(); -+ AuDbg("b%d, %s:%d\n", bindex, func, line); -+ AuDbgDentry(dentry); -+ AuDbgInode(inode); -+ au_debug_off(); -+ BUG(); -+ } -+ } -+} -+ -+void au_dbg_verify_gen(struct dentry *parent, unsigned int sigen) -+{ -+ int err, i, j; -+ struct au_dcsub_pages dpages; -+ struct au_dpage *dpage; -+ struct dentry **dentries; -+ -+ err = au_dpages_init(&dpages, GFP_NOFS); -+ AuDebugOn(err); -+ err = au_dcsub_pages_rev_aufs(&dpages, parent, /*do_include*/1); -+ AuDebugOn(err); -+ for (i = dpages.ndpage - 1; !err && i >= 0; i--) { -+ dpage = dpages.dpages + i; -+ dentries = dpage->dentries; -+ for (j = dpage->ndentry - 1; !err && j >= 0; j--) -+ AuDebugOn(au_digen_test(dentries[j], sigen)); -+ } -+ au_dpages_free(&dpages); -+} -+ -+void au_dbg_verify_kthread(void) -+{ -+ if (au_wkq_test()) { -+ au_dbg_blocked(); -+ /* -+ * It may be recursive, but udba=notify between two aufs mounts, -+ * where a single ro branch is shared, is not a problem. -+ */ -+ /* WARN_ON(1); */ -+ } -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+int __init au_debug_init(void) -+{ -+ aufs_bindex_t bindex; -+ struct au_vdir_destr destr; -+ -+ bindex = -1; -+ AuDebugOn(bindex >= 0); -+ -+ destr.len = -1; -+ AuDebugOn(destr.len < NAME_MAX); -+ -+#ifdef CONFIG_4KSTACKS -+ pr_warn("CONFIG_4KSTACKS is defined.\n"); -+#endif -+ -+ return 0; -+} -diff --git a/fs/aufs/debug.h b/fs/aufs/debug.h -new file mode 100644 -index 0000000..0567f31 ---- /dev/null -+++ b/fs/aufs/debug.h -@@ -0,0 +1,212 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * debug print functions -+ */ -+ -+#ifndef __AUFS_DEBUG_H__ -+#define __AUFS_DEBUG_H__ -+ -+#ifdef __KERNEL__ -+ -+#include -+#include -+#include -+#include -+ -+#ifdef CONFIG_AUFS_DEBUG -+#define AuDebugOn(a) BUG_ON(a) -+ -+/* module parameter */ -+extern atomic_t aufs_debug; -+static inline void au_debug_on(void) -+{ -+ atomic_inc(&aufs_debug); -+} -+static inline void au_debug_off(void) -+{ -+ atomic_dec_if_positive(&aufs_debug); -+} -+ -+static inline int au_debug_test(void) -+{ -+ return atomic_read(&aufs_debug) > 0; -+} -+#else -+#define AuDebugOn(a) do {} while (0) -+AuStubVoid(au_debug_on, void) -+AuStubVoid(au_debug_off, void) -+AuStubInt0(au_debug_test, void) -+#endif /* CONFIG_AUFS_DEBUG */ -+ -+#define param_check_atomic_t(name, p) __param_check(name, p, atomic_t) -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* debug print */ -+ -+#define AuDbg(fmt, ...) do { \ -+ if (au_debug_test()) \ -+ pr_debug("DEBUG: " fmt, ##__VA_ARGS__); \ -+} while (0) -+#define AuLabel(l) AuDbg(#l "\n") -+#define AuIOErr(fmt, ...) pr_err("I/O Error, " fmt, ##__VA_ARGS__) -+#define AuWarn1(fmt, ...) do { \ -+ static unsigned char _c; \ -+ if (!_c++) \ -+ pr_warn(fmt, ##__VA_ARGS__); \ -+} while (0) -+ -+#define AuErr1(fmt, ...) do { \ -+ static unsigned char _c; \ -+ if (!_c++) \ -+ pr_err(fmt, ##__VA_ARGS__); \ -+} while (0) -+ -+#define AuIOErr1(fmt, ...) do { \ -+ static unsigned char _c; \ -+ if (!_c++) \ -+ AuIOErr(fmt, ##__VA_ARGS__); \ -+} while (0) -+ -+#define AuUnsupportMsg "This operation is not supported." \ -+ " Please report this application to aufs-users ML." -+#define AuUnsupport(fmt, ...) do { \ -+ pr_err(AuUnsupportMsg "\n" fmt, ##__VA_ARGS__); \ -+ dump_stack(); \ -+} while (0) -+ -+#define AuTraceErr(e) do { \ -+ if (unlikely((e) < 0)) \ -+ AuDbg("err %d\n", (int)(e)); \ -+} while (0) -+ -+#define AuTraceErrPtr(p) do { \ -+ if (IS_ERR(p)) \ -+ AuDbg("err %ld\n", PTR_ERR(p)); \ -+} while (0) -+ -+/* dirty macros for debug print, use with "%.*s" and caution */ -+#define AuLNPair(qstr) (qstr)->len, (qstr)->name -+ -+/* ---------------------------------------------------------------------- */ -+ -+struct dentry; -+#ifdef CONFIG_AUFS_DEBUG -+extern struct mutex au_dbg_mtx; -+extern char *au_plevel; -+struct au_nhash; -+void au_dpri_whlist(struct au_nhash *whlist); -+struct au_vdir; -+void au_dpri_vdir(struct au_vdir *vdir); -+struct inode; -+void au_dpri_inode(struct inode *inode); -+void au_dpri_dalias(struct inode *inode); -+void au_dpri_dentry(struct dentry *dentry); -+struct file; -+void au_dpri_file(struct file *filp); -+struct super_block; -+void au_dpri_sb(struct super_block *sb); -+ -+#define au_dbg_verify_dinode(d) __au_dbg_verify_dinode(d, __func__, __LINE__) -+void __au_dbg_verify_dinode(struct dentry *dentry, const char *func, int line); -+void au_dbg_verify_gen(struct dentry *parent, unsigned int sigen); -+void au_dbg_verify_kthread(void); -+ -+int __init au_debug_init(void); -+ -+#define AuDbgWhlist(w) do { \ -+ mutex_lock(&au_dbg_mtx); \ -+ AuDbg(#w "\n"); \ -+ au_dpri_whlist(w); \ -+ mutex_unlock(&au_dbg_mtx); \ -+} while (0) -+ -+#define AuDbgVdir(v) do { \ -+ mutex_lock(&au_dbg_mtx); \ -+ AuDbg(#v "\n"); \ -+ au_dpri_vdir(v); \ -+ mutex_unlock(&au_dbg_mtx); \ -+} while (0) -+ -+#define AuDbgInode(i) do { \ -+ mutex_lock(&au_dbg_mtx); \ -+ AuDbg(#i "\n"); \ -+ au_dpri_inode(i); \ -+ mutex_unlock(&au_dbg_mtx); \ -+} while (0) -+ -+#define AuDbgDAlias(i) do { \ -+ mutex_lock(&au_dbg_mtx); \ -+ AuDbg(#i "\n"); \ -+ au_dpri_dalias(i); \ -+ mutex_unlock(&au_dbg_mtx); \ -+} while (0) -+ -+#define AuDbgDentry(d) do { \ -+ mutex_lock(&au_dbg_mtx); \ -+ AuDbg(#d "\n"); \ -+ au_dpri_dentry(d); \ -+ mutex_unlock(&au_dbg_mtx); \ -+} while (0) -+ -+#define AuDbgFile(f) do { \ -+ mutex_lock(&au_dbg_mtx); \ -+ AuDbg(#f "\n"); \ -+ au_dpri_file(f); \ -+ mutex_unlock(&au_dbg_mtx); \ -+} while (0) -+ -+#define AuDbgSb(sb) do { \ -+ mutex_lock(&au_dbg_mtx); \ -+ AuDbg(#sb "\n"); \ -+ au_dpri_sb(sb); \ -+ mutex_unlock(&au_dbg_mtx); \ -+} while (0) -+ -+#define AuDbgSym(addr) do { \ -+ char sym[KSYM_SYMBOL_LEN]; \ -+ sprint_symbol(sym, (unsigned long)addr); \ -+ AuDbg("%s\n", sym); \ -+} while (0) -+#else -+AuStubVoid(au_dbg_verify_dinode, struct dentry *dentry) -+AuStubVoid(au_dbg_verify_gen, struct dentry *parent, unsigned int sigen) -+AuStubVoid(au_dbg_verify_kthread, void) -+AuStubInt0(__init au_debug_init, void) -+ -+#define AuDbgWhlist(w) do {} while (0) -+#define AuDbgVdir(v) do {} while (0) -+#define AuDbgInode(i) do {} while (0) -+#define AuDbgDAlias(i) do {} while (0) -+#define AuDbgDentry(d) do {} while (0) -+#define AuDbgFile(f) do {} while (0) -+#define AuDbgSb(sb) do {} while (0) -+#define AuDbgSym(addr) do {} while (0) -+#endif /* CONFIG_AUFS_DEBUG */ -+ -+/* ---------------------------------------------------------------------- */ -+ -+#ifdef CONFIG_AUFS_MAGIC_SYSRQ -+int __init au_sysrq_init(void); -+void au_sysrq_fin(void); -+ -+#ifdef CONFIG_HW_CONSOLE -+#define au_dbg_blocked() do { \ -+ WARN_ON(1); \ -+ handle_sysrq('w'); \ -+} while (0) -+#else -+AuStubVoid(au_dbg_blocked, void) -+#endif -+ -+#else -+AuStubInt0(__init au_sysrq_init, void) -+AuStubVoid(au_sysrq_fin, void) -+AuStubVoid(au_dbg_blocked, void) -+#endif /* CONFIG_AUFS_MAGIC_SYSRQ */ -+ -+#endif /* __KERNEL__ */ -+#endif /* __AUFS_DEBUG_H__ */ -diff --git a/fs/aufs/dentry.c b/fs/aufs/dentry.c -new file mode 100644 -index 0000000..5eb4f36 ---- /dev/null -+++ b/fs/aufs/dentry.c -@@ -0,0 +1,1117 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * lookup and dentry operations -+ */ -+ -+#include -+#include "aufs.h" -+ -+struct au_do_lookup_args { -+ unsigned int flags; -+ mode_t type; -+}; -+ -+/* -+ * returns positive/negative dentry, NULL or an error. -+ * NULL means whiteout-ed or not-found. -+ */ -+static struct dentry* -+au_do_lookup(struct dentry *h_parent, struct dentry *dentry, -+ aufs_bindex_t bindex, struct qstr *wh_name, -+ struct au_do_lookup_args *args) -+{ -+ struct dentry *h_dentry; -+ struct inode *h_inode; -+ struct au_branch *br; -+ int wh_found, opq; -+ unsigned char wh_able; -+ const unsigned char allow_neg = !!au_ftest_lkup(args->flags, ALLOW_NEG); -+ const unsigned char ignore_perm = !!au_ftest_lkup(args->flags, -+ IGNORE_PERM); -+ -+ wh_found = 0; -+ br = au_sbr(dentry->d_sb, bindex); -+ wh_able = !!au_br_whable(br->br_perm); -+ if (wh_able) -+ wh_found = au_wh_test(h_parent, wh_name, ignore_perm); -+ h_dentry = ERR_PTR(wh_found); -+ if (!wh_found) -+ goto real_lookup; -+ if (unlikely(wh_found < 0)) -+ goto out; -+ -+ /* We found a whiteout */ -+ /* au_set_dbbot(dentry, bindex); */ -+ au_set_dbwh(dentry, bindex); -+ if (!allow_neg) -+ return NULL; /* success */ -+ -+real_lookup: -+ if (!ignore_perm) -+ h_dentry = vfsub_lkup_one(&dentry->d_name, h_parent); -+ else -+ h_dentry = au_sio_lkup_one(&dentry->d_name, h_parent); -+ if (IS_ERR(h_dentry)) { -+ if (PTR_ERR(h_dentry) == -ENAMETOOLONG -+ && !allow_neg) -+ h_dentry = NULL; -+ goto out; -+ } -+ -+ h_inode = d_inode(h_dentry); -+ if (d_is_negative(h_dentry)) { -+ if (!allow_neg) -+ goto out_neg; -+ } else if (wh_found -+ || (args->type && args->type != (h_inode->i_mode & S_IFMT))) -+ goto out_neg; -+ -+ if (au_dbbot(dentry) <= bindex) -+ au_set_dbbot(dentry, bindex); -+ if (au_dbtop(dentry) < 0 || bindex < au_dbtop(dentry)) -+ au_set_dbtop(dentry, bindex); -+ au_set_h_dptr(dentry, bindex, h_dentry); -+ -+ if (!d_is_dir(h_dentry) -+ || !wh_able -+ || (d_really_is_positive(dentry) && !d_is_dir(dentry))) -+ goto out; /* success */ -+ -+ inode_lock_nested(h_inode, AuLsc_I_CHILD); -+ opq = au_diropq_test(h_dentry); -+ inode_unlock(h_inode); -+ if (opq > 0) -+ au_set_dbdiropq(dentry, bindex); -+ else if (unlikely(opq < 0)) { -+ au_set_h_dptr(dentry, bindex, NULL); -+ h_dentry = ERR_PTR(opq); -+ } -+ goto out; -+ -+out_neg: -+ dput(h_dentry); -+ h_dentry = NULL; -+out: -+ return h_dentry; -+} -+ -+static int au_test_shwh(struct super_block *sb, const struct qstr *name) -+{ -+ if (unlikely(!au_opt_test(au_mntflags(sb), SHWH) -+ && !strncmp(name->name, AUFS_WH_PFX, AUFS_WH_PFX_LEN))) -+ return -EPERM; -+ return 0; -+} -+ -+/* -+ * returns the number of lower positive dentries, -+ * otherwise an error. -+ * can be called at unlinking with @type is zero. -+ */ -+int au_lkup_dentry(struct dentry *dentry, aufs_bindex_t btop, -+ unsigned int flags) -+{ -+ int npositive, err; -+ aufs_bindex_t bindex, btail, bdiropq; -+ unsigned char isdir, dirperm1; -+ struct qstr whname; -+ struct au_do_lookup_args args = { -+ .flags = flags -+ }; -+ const struct qstr *name = &dentry->d_name; -+ struct dentry *parent; -+ struct super_block *sb; -+ -+ sb = dentry->d_sb; -+ err = au_test_shwh(sb, name); -+ if (unlikely(err)) -+ goto out; -+ -+ err = au_wh_name_alloc(&whname, name); -+ if (unlikely(err)) -+ goto out; -+ -+ isdir = !!d_is_dir(dentry); -+ dirperm1 = !!au_opt_test(au_mntflags(sb), DIRPERM1); -+ -+ npositive = 0; -+ parent = dget_parent(dentry); -+ btail = au_dbtaildir(parent); -+ for (bindex = btop; bindex <= btail; bindex++) { -+ struct dentry *h_parent, *h_dentry; -+ struct inode *h_inode, *h_dir; -+ -+ h_dentry = au_h_dptr(dentry, bindex); -+ if (h_dentry) { -+ if (d_is_positive(h_dentry)) -+ npositive++; -+ break; -+ } -+ h_parent = au_h_dptr(parent, bindex); -+ if (!h_parent || !d_is_dir(h_parent)) -+ continue; -+ -+ h_dir = d_inode(h_parent); -+ inode_lock_nested(h_dir, AuLsc_I_PARENT); -+ h_dentry = au_do_lookup(h_parent, dentry, bindex, &whname, -+ &args); -+ inode_unlock(h_dir); -+ err = PTR_ERR(h_dentry); -+ if (IS_ERR(h_dentry)) -+ goto out_parent; -+ if (h_dentry) -+ au_fclr_lkup(args.flags, ALLOW_NEG); -+ if (dirperm1) -+ au_fset_lkup(args.flags, IGNORE_PERM); -+ -+ if (au_dbwh(dentry) == bindex) -+ break; -+ if (!h_dentry) -+ continue; -+ if (d_is_negative(h_dentry)) -+ continue; -+ h_inode = d_inode(h_dentry); -+ npositive++; -+ if (!args.type) -+ args.type = h_inode->i_mode & S_IFMT; -+ if (args.type != S_IFDIR) -+ break; -+ else if (isdir) { -+ /* the type of lower may be different */ -+ bdiropq = au_dbdiropq(dentry); -+ if (bdiropq >= 0 && bdiropq <= bindex) -+ break; -+ } -+ } -+ -+ if (npositive) { -+ AuLabel(positive); -+ au_update_dbtop(dentry); -+ } -+ err = npositive; -+ if (unlikely(!au_opt_test(au_mntflags(sb), UDBA_NONE) -+ && au_dbtop(dentry) < 0)) { -+ err = -EIO; -+ AuIOErr("both of real entry and whiteout found, %pd, err %d\n", -+ dentry, err); -+ } -+ -+out_parent: -+ dput(parent); -+ au_delayed_kfree(whname.name); -+out: -+ return err; -+} -+ -+struct dentry *au_sio_lkup_one(struct qstr *name, struct dentry *parent) -+{ -+ struct dentry *dentry; -+ int wkq_err; -+ -+ if (!au_test_h_perm_sio(d_inode(parent), MAY_EXEC)) -+ dentry = vfsub_lkup_one(name, parent); -+ else { -+ struct vfsub_lkup_one_args args = { -+ .errp = &dentry, -+ .name = name, -+ .parent = parent -+ }; -+ -+ wkq_err = au_wkq_wait(vfsub_call_lkup_one, &args); -+ if (unlikely(wkq_err)) -+ dentry = ERR_PTR(wkq_err); -+ } -+ -+ return dentry; -+} -+ -+/* -+ * lookup @dentry on @bindex which should be negative. -+ */ -+int au_lkup_neg(struct dentry *dentry, aufs_bindex_t bindex, int wh) -+{ -+ int err; -+ struct dentry *parent, *h_parent, *h_dentry; -+ struct au_branch *br; -+ -+ parent = dget_parent(dentry); -+ h_parent = au_h_dptr(parent, bindex); -+ br = au_sbr(dentry->d_sb, bindex); -+ if (wh) -+ h_dentry = au_whtmp_lkup(h_parent, br, &dentry->d_name); -+ else -+ h_dentry = au_sio_lkup_one(&dentry->d_name, h_parent); -+ err = PTR_ERR(h_dentry); -+ if (IS_ERR(h_dentry)) -+ goto out; -+ if (unlikely(d_is_positive(h_dentry))) { -+ err = -EIO; -+ AuIOErr("%pd should be negative on b%d.\n", h_dentry, bindex); -+ dput(h_dentry); -+ goto out; -+ } -+ -+ err = 0; -+ if (bindex < au_dbtop(dentry)) -+ au_set_dbtop(dentry, bindex); -+ if (au_dbbot(dentry) < bindex) -+ au_set_dbbot(dentry, bindex); -+ au_set_h_dptr(dentry, bindex, h_dentry); -+ -+out: -+ dput(parent); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* subset of struct inode */ -+struct au_iattr { -+ unsigned long i_ino; -+ /* unsigned int i_nlink; */ -+ kuid_t i_uid; -+ kgid_t i_gid; -+ u64 i_version; -+/* -+ loff_t i_size; -+ blkcnt_t i_blocks; -+*/ -+ umode_t i_mode; -+}; -+ -+static void au_iattr_save(struct au_iattr *ia, struct inode *h_inode) -+{ -+ ia->i_ino = h_inode->i_ino; -+ /* ia->i_nlink = h_inode->i_nlink; */ -+ ia->i_uid = h_inode->i_uid; -+ ia->i_gid = h_inode->i_gid; -+ ia->i_version = h_inode->i_version; -+/* -+ ia->i_size = h_inode->i_size; -+ ia->i_blocks = h_inode->i_blocks; -+*/ -+ ia->i_mode = (h_inode->i_mode & S_IFMT); -+} -+ -+static int au_iattr_test(struct au_iattr *ia, struct inode *h_inode) -+{ -+ return ia->i_ino != h_inode->i_ino -+ /* || ia->i_nlink != h_inode->i_nlink */ -+ || !uid_eq(ia->i_uid, h_inode->i_uid) -+ || !gid_eq(ia->i_gid, h_inode->i_gid) -+ || ia->i_version != h_inode->i_version -+/* -+ || ia->i_size != h_inode->i_size -+ || ia->i_blocks != h_inode->i_blocks -+*/ -+ || ia->i_mode != (h_inode->i_mode & S_IFMT); -+} -+ -+static int au_h_verify_dentry(struct dentry *h_dentry, struct dentry *h_parent, -+ struct au_branch *br) -+{ -+ int err; -+ struct au_iattr ia; -+ struct inode *h_inode; -+ struct dentry *h_d; -+ struct super_block *h_sb; -+ -+ err = 0; -+ memset(&ia, -1, sizeof(ia)); -+ h_sb = h_dentry->d_sb; -+ h_inode = NULL; -+ if (d_is_positive(h_dentry)) { -+ h_inode = d_inode(h_dentry); -+ au_iattr_save(&ia, h_inode); -+ } else if (au_test_nfs(h_sb) || au_test_fuse(h_sb)) -+ /* nfs d_revalidate may return 0 for negative dentry */ -+ /* fuse d_revalidate always return 0 for negative dentry */ -+ goto out; -+ -+ /* main purpose is namei.c:cached_lookup() and d_revalidate */ -+ h_d = vfsub_lkup_one(&h_dentry->d_name, h_parent); -+ err = PTR_ERR(h_d); -+ if (IS_ERR(h_d)) -+ goto out; -+ -+ err = 0; -+ if (unlikely(h_d != h_dentry -+ || d_inode(h_d) != h_inode -+ || (h_inode && au_iattr_test(&ia, h_inode)))) -+ err = au_busy_or_stale(); -+ dput(h_d); -+ -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+int au_h_verify(struct dentry *h_dentry, unsigned int udba, struct inode *h_dir, -+ struct dentry *h_parent, struct au_branch *br) -+{ -+ int err; -+ -+ err = 0; -+ if (udba == AuOpt_UDBA_REVAL -+ && !au_test_fs_remote(h_dentry->d_sb)) { -+ IMustLock(h_dir); -+ err = (d_inode(h_dentry->d_parent) != h_dir); -+ } else if (udba != AuOpt_UDBA_NONE) -+ err = au_h_verify_dentry(h_dentry, h_parent, br); -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int au_do_refresh_hdentry(struct dentry *dentry, struct dentry *parent) -+{ -+ int err; -+ aufs_bindex_t new_bindex, bindex, bbot, bwh, bdiropq; -+ struct au_hdentry tmp, *p, *q; -+ struct au_dinfo *dinfo; -+ struct super_block *sb; -+ -+ DiMustWriteLock(dentry); -+ -+ sb = dentry->d_sb; -+ dinfo = au_di(dentry); -+ bbot = dinfo->di_bbot; -+ bwh = dinfo->di_bwh; -+ bdiropq = dinfo->di_bdiropq; -+ bindex = dinfo->di_btop; -+ p = au_hdentry(dinfo, bindex); -+ for (; bindex <= bbot; bindex++, p++) { -+ if (!p->hd_dentry) -+ continue; -+ -+ new_bindex = au_br_index(sb, p->hd_id); -+ if (new_bindex == bindex) -+ continue; -+ -+ if (dinfo->di_bwh == bindex) -+ bwh = new_bindex; -+ if (dinfo->di_bdiropq == bindex) -+ bdiropq = new_bindex; -+ if (new_bindex < 0) { -+ au_hdput(p); -+ p->hd_dentry = NULL; -+ continue; -+ } -+ -+ /* swap two lower dentries, and loop again */ -+ q = au_hdentry(dinfo, new_bindex); -+ tmp = *q; -+ *q = *p; -+ *p = tmp; -+ if (tmp.hd_dentry) { -+ bindex--; -+ p--; -+ } -+ } -+ -+ dinfo->di_bwh = -1; -+ if (bwh >= 0 && bwh <= au_sbbot(sb) && au_sbr_whable(sb, bwh)) -+ dinfo->di_bwh = bwh; -+ -+ dinfo->di_bdiropq = -1; -+ if (bdiropq >= 0 -+ && bdiropq <= au_sbbot(sb) -+ && au_sbr_whable(sb, bdiropq)) -+ dinfo->di_bdiropq = bdiropq; -+ -+ err = -EIO; -+ dinfo->di_btop = -1; -+ dinfo->di_bbot = -1; -+ bbot = au_dbbot(parent); -+ bindex = 0; -+ p = au_hdentry(dinfo, bindex); -+ for (; bindex <= bbot; bindex++, p++) -+ if (p->hd_dentry) { -+ dinfo->di_btop = bindex; -+ break; -+ } -+ -+ if (dinfo->di_btop >= 0) { -+ bindex = bbot; -+ p = au_hdentry(dinfo, bindex); -+ for (; bindex >= 0; bindex--, p--) -+ if (p->hd_dentry) { -+ dinfo->di_bbot = bindex; -+ err = 0; -+ break; -+ } -+ } -+ -+ return err; -+} -+ -+static void au_do_hide(struct dentry *dentry) -+{ -+ struct inode *inode; -+ -+ if (d_really_is_positive(dentry)) { -+ inode = d_inode(dentry); -+ if (!d_is_dir(dentry)) { -+ if (inode->i_nlink && !d_unhashed(dentry)) -+ drop_nlink(inode); -+ } else { -+ clear_nlink(inode); -+ /* stop next lookup */ -+ inode->i_flags |= S_DEAD; -+ } -+ smp_mb(); /* necessary? */ -+ } -+ d_drop(dentry); -+} -+ -+static int au_hide_children(struct dentry *parent) -+{ -+ int err, i, j, ndentry; -+ struct au_dcsub_pages dpages; -+ struct au_dpage *dpage; -+ struct dentry *dentry; -+ -+ err = au_dpages_init(&dpages, GFP_NOFS); -+ if (unlikely(err)) -+ goto out; -+ err = au_dcsub_pages(&dpages, parent, NULL, NULL); -+ if (unlikely(err)) -+ goto out_dpages; -+ -+ /* in reverse order */ -+ for (i = dpages.ndpage - 1; i >= 0; i--) { -+ dpage = dpages.dpages + i; -+ ndentry = dpage->ndentry; -+ for (j = ndentry - 1; j >= 0; j--) { -+ dentry = dpage->dentries[j]; -+ if (dentry != parent) -+ au_do_hide(dentry); -+ } -+ } -+ -+out_dpages: -+ au_dpages_free(&dpages); -+out: -+ return err; -+} -+ -+static void au_hide(struct dentry *dentry) -+{ -+ int err; -+ -+ AuDbgDentry(dentry); -+ if (d_is_dir(dentry)) { -+ /* shrink_dcache_parent(dentry); */ -+ err = au_hide_children(dentry); -+ if (unlikely(err)) -+ AuIOErr("%pd, failed hiding children, ignored %d\n", -+ dentry, err); -+ } -+ au_do_hide(dentry); -+} -+ -+/* -+ * By adding a dirty branch, a cached dentry may be affected in various ways. -+ * -+ * a dirty branch is added -+ * - on the top of layers -+ * - in the middle of layers -+ * - to the bottom of layers -+ * -+ * on the added branch there exists -+ * - a whiteout -+ * - a diropq -+ * - a same named entry -+ * + exist -+ * * negative --> positive -+ * * positive --> positive -+ * - type is unchanged -+ * - type is changed -+ * + doesn't exist -+ * * negative --> negative -+ * * positive --> negative (rejected by au_br_del() for non-dir case) -+ * - none -+ */ -+static int au_refresh_by_dinfo(struct dentry *dentry, struct au_dinfo *dinfo, -+ struct au_dinfo *tmp) -+{ -+ int err; -+ aufs_bindex_t bindex, bbot; -+ struct { -+ struct dentry *dentry; -+ struct inode *inode; -+ mode_t mode; -+ } orig_h, tmp_h = { -+ .dentry = NULL -+ }; -+ struct au_hdentry *hd; -+ struct inode *inode, *h_inode; -+ struct dentry *h_dentry; -+ -+ err = 0; -+ AuDebugOn(dinfo->di_btop < 0); -+ orig_h.mode = 0; -+ orig_h.dentry = au_hdentry(dinfo, dinfo->di_btop)->hd_dentry; -+ orig_h.inode = NULL; -+ if (d_is_positive(orig_h.dentry)) { -+ orig_h.inode = d_inode(orig_h.dentry); -+ orig_h.mode = orig_h.inode->i_mode & S_IFMT; -+ } -+ if (tmp->di_btop >= 0) { -+ tmp_h.dentry = au_hdentry(tmp, tmp->di_btop)->hd_dentry; -+ if (d_is_positive(tmp_h.dentry)) { -+ tmp_h.inode = d_inode(tmp_h.dentry); -+ tmp_h.mode = tmp_h.inode->i_mode & S_IFMT; -+ } -+ } -+ -+ inode = NULL; -+ if (d_really_is_positive(dentry)) -+ inode = d_inode(dentry); -+ if (!orig_h.inode) { -+ AuDbg("nagative originally\n"); -+ if (inode) { -+ au_hide(dentry); -+ goto out; -+ } -+ AuDebugOn(inode); -+ AuDebugOn(dinfo->di_btop != dinfo->di_bbot); -+ AuDebugOn(dinfo->di_bdiropq != -1); -+ -+ if (!tmp_h.inode) { -+ AuDbg("negative --> negative\n"); -+ /* should have only one negative lower */ -+ if (tmp->di_btop >= 0 -+ && tmp->di_btop < dinfo->di_btop) { -+ AuDebugOn(tmp->di_btop != tmp->di_bbot); -+ AuDebugOn(dinfo->di_btop != dinfo->di_bbot); -+ au_set_h_dptr(dentry, dinfo->di_btop, NULL); -+ au_di_cp(dinfo, tmp); -+ hd = au_hdentry(tmp, tmp->di_btop); -+ au_set_h_dptr(dentry, tmp->di_btop, -+ dget(hd->hd_dentry)); -+ } -+ au_dbg_verify_dinode(dentry); -+ } else { -+ AuDbg("negative --> positive\n"); -+ /* -+ * similar to the behaviour of creating with bypassing -+ * aufs. -+ * unhash it in order to force an error in the -+ * succeeding create operation. -+ * we should not set S_DEAD here. -+ */ -+ d_drop(dentry); -+ /* au_di_swap(tmp, dinfo); */ -+ au_dbg_verify_dinode(dentry); -+ } -+ } else { -+ AuDbg("positive originally\n"); -+ /* inode may be NULL */ -+ AuDebugOn(inode && (inode->i_mode & S_IFMT) != orig_h.mode); -+ if (!tmp_h.inode) { -+ AuDbg("positive --> negative\n"); -+ /* or bypassing aufs */ -+ au_hide(dentry); -+ if (tmp->di_bwh >= 0 && tmp->di_bwh <= dinfo->di_btop) -+ dinfo->di_bwh = tmp->di_bwh; -+ if (inode) -+ err = au_refresh_hinode_self(inode); -+ au_dbg_verify_dinode(dentry); -+ } else if (orig_h.mode == tmp_h.mode) { -+ AuDbg("positive --> positive, same type\n"); -+ if (!S_ISDIR(orig_h.mode) -+ && dinfo->di_btop > tmp->di_btop) { -+ /* -+ * similar to the behaviour of removing and -+ * creating. -+ */ -+ au_hide(dentry); -+ if (inode) -+ err = au_refresh_hinode_self(inode); -+ au_dbg_verify_dinode(dentry); -+ } else { -+ /* fill empty slots */ -+ if (dinfo->di_btop > tmp->di_btop) -+ dinfo->di_btop = tmp->di_btop; -+ if (dinfo->di_bbot < tmp->di_bbot) -+ dinfo->di_bbot = tmp->di_bbot; -+ dinfo->di_bwh = tmp->di_bwh; -+ dinfo->di_bdiropq = tmp->di_bdiropq; -+ bbot = dinfo->di_bbot; -+ bindex = tmp->di_btop; -+ hd = au_hdentry(tmp, bindex); -+ for (; bindex <= bbot; bindex++, hd++) { -+ if (au_h_dptr(dentry, bindex)) -+ continue; -+ h_dentry = hd->hd_dentry; -+ if (!h_dentry) -+ continue; -+ AuDebugOn(d_is_negative(h_dentry)); -+ h_inode = d_inode(h_dentry); -+ AuDebugOn(orig_h.mode -+ != (h_inode->i_mode -+ & S_IFMT)); -+ au_set_h_dptr(dentry, bindex, -+ dget(h_dentry)); -+ } -+ if (inode) -+ err = au_refresh_hinode(inode, dentry); -+ au_dbg_verify_dinode(dentry); -+ } -+ } else { -+ AuDbg("positive --> positive, different type\n"); -+ /* similar to the behaviour of removing and creating */ -+ au_hide(dentry); -+ if (inode) -+ err = au_refresh_hinode_self(inode); -+ au_dbg_verify_dinode(dentry); -+ } -+ } -+ -+out: -+ return err; -+} -+ -+void au_refresh_dop(struct dentry *dentry, int force_reval) -+{ -+ const struct dentry_operations *dop -+ = force_reval ? &aufs_dop : dentry->d_sb->s_d_op; -+ static const unsigned int mask -+ = DCACHE_OP_REVALIDATE | DCACHE_OP_WEAK_REVALIDATE; -+ -+ BUILD_BUG_ON(sizeof(mask) != sizeof(dentry->d_flags)); -+ -+ if (dentry->d_op == dop) -+ return; -+ -+ AuDbg("%pd\n", dentry); -+ spin_lock(&dentry->d_lock); -+ if (dop == &aufs_dop) -+ dentry->d_flags |= mask; -+ else -+ dentry->d_flags &= ~mask; -+ dentry->d_op = dop; -+ spin_unlock(&dentry->d_lock); -+} -+ -+int au_refresh_dentry(struct dentry *dentry, struct dentry *parent) -+{ -+ int err, ebrange, nbr; -+ unsigned int sigen; -+ struct au_dinfo *dinfo, *tmp; -+ struct super_block *sb; -+ struct inode *inode; -+ -+ DiMustWriteLock(dentry); -+ AuDebugOn(IS_ROOT(dentry)); -+ AuDebugOn(d_really_is_negative(parent)); -+ -+ sb = dentry->d_sb; -+ sigen = au_sigen(sb); -+ err = au_digen_test(parent, sigen); -+ if (unlikely(err)) -+ goto out; -+ -+ nbr = au_sbbot(sb) + 1; -+ dinfo = au_di(dentry); -+ err = au_di_realloc(dinfo, nbr, /*may_shrink*/0); -+ if (unlikely(err)) -+ goto out; -+ ebrange = au_dbrange_test(dentry); -+ if (!ebrange) -+ ebrange = au_do_refresh_hdentry(dentry, parent); -+ -+ if (d_unhashed(dentry) || ebrange /* || dinfo->di_tmpfile */) { -+ AuDebugOn(au_dbtop(dentry) < 0 && au_dbbot(dentry) >= 0); -+ if (d_really_is_positive(dentry)) { -+ inode = d_inode(dentry); -+ err = au_refresh_hinode_self(inode); -+ } -+ au_dbg_verify_dinode(dentry); -+ if (!err) -+ goto out_dgen; /* success */ -+ goto out; -+ } -+ -+ /* temporary dinfo */ -+ AuDbgDentry(dentry); -+ err = -ENOMEM; -+ tmp = au_di_alloc(sb, AuLsc_DI_TMP); -+ if (unlikely(!tmp)) -+ goto out; -+ au_di_swap(tmp, dinfo); -+ /* returns the number of positive dentries */ -+ /* -+ * if current working dir is removed, it returns an error. -+ * but the dentry is legal. -+ */ -+ err = au_lkup_dentry(dentry, /*btop*/0, AuLkup_ALLOW_NEG); -+ AuDbgDentry(dentry); -+ au_di_swap(tmp, dinfo); -+ if (err == -ENOENT) -+ err = 0; -+ if (err >= 0) { -+ /* compare/refresh by dinfo */ -+ AuDbgDentry(dentry); -+ err = au_refresh_by_dinfo(dentry, dinfo, tmp); -+ au_dbg_verify_dinode(dentry); -+ AuTraceErr(err); -+ } -+ au_di_realloc(dinfo, nbr, /*may_shrink*/1); /* harmless if err */ -+ au_rw_write_unlock(&tmp->di_rwsem); -+ au_di_free(tmp); -+ if (unlikely(err)) -+ goto out; -+ -+out_dgen: -+ au_update_digen(dentry); -+out: -+ if (unlikely(err && !(dentry->d_flags & DCACHE_NFSFS_RENAMED))) { -+ AuIOErr("failed refreshing %pd, %d\n", dentry, err); -+ AuDbgDentry(dentry); -+ } -+ AuTraceErr(err); -+ return err; -+} -+ -+static int au_do_h_d_reval(struct dentry *h_dentry, unsigned int flags, -+ struct dentry *dentry, aufs_bindex_t bindex) -+{ -+ int err, valid; -+ -+ err = 0; -+ if (!(h_dentry->d_flags & DCACHE_OP_REVALIDATE)) -+ goto out; -+ -+ AuDbg("b%d\n", bindex); -+ /* -+ * gave up supporting LOOKUP_CREATE/OPEN for lower fs, -+ * due to whiteout and branch permission. -+ */ -+ flags &= ~(/*LOOKUP_PARENT |*/ LOOKUP_OPEN | LOOKUP_CREATE -+ | LOOKUP_FOLLOW | LOOKUP_EXCL); -+ /* it may return tri-state */ -+ valid = h_dentry->d_op->d_revalidate(h_dentry, flags); -+ -+ if (unlikely(valid < 0)) -+ err = valid; -+ else if (!valid) -+ err = -EINVAL; -+ -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+/* todo: remove this */ -+static int h_d_revalidate(struct dentry *dentry, struct inode *inode, -+ unsigned int flags, int do_udba) -+{ -+ int err; -+ umode_t mode, h_mode; -+ aufs_bindex_t bindex, btail, btop, ibs, ibe; -+ unsigned char plus, unhashed, is_root, h_plus, h_nfs, tmpfile; -+ struct inode *h_inode, *h_cached_inode; -+ struct dentry *h_dentry; -+ struct qstr *name, *h_name; -+ -+ err = 0; -+ plus = 0; -+ mode = 0; -+ ibs = -1; -+ ibe = -1; -+ unhashed = !!d_unhashed(dentry); -+ is_root = !!IS_ROOT(dentry); -+ name = &dentry->d_name; -+ tmpfile = au_di(dentry)->di_tmpfile; -+ -+ /* -+ * Theoretically, REVAL test should be unnecessary in case of -+ * {FS,I}NOTIFY. -+ * But {fs,i}notify doesn't fire some necessary events, -+ * IN_ATTRIB for atime/nlink/pageio -+ * Let's do REVAL test too. -+ */ -+ if (do_udba && inode) { -+ mode = (inode->i_mode & S_IFMT); -+ plus = (inode->i_nlink > 0); -+ ibs = au_ibtop(inode); -+ ibe = au_ibbot(inode); -+ } -+ -+ btop = au_dbtop(dentry); -+ btail = btop; -+ if (inode && S_ISDIR(inode->i_mode)) -+ btail = au_dbtaildir(dentry); -+ for (bindex = btop; bindex <= btail; bindex++) { -+ h_dentry = au_h_dptr(dentry, bindex); -+ if (!h_dentry) -+ continue; -+ -+ AuDbg("b%d, %pd\n", bindex, h_dentry); -+ h_nfs = !!au_test_nfs(h_dentry->d_sb); -+ spin_lock(&h_dentry->d_lock); -+ h_name = &h_dentry->d_name; -+ if (unlikely(do_udba -+ && !is_root -+ && ((!h_nfs -+ && (unhashed != !!d_unhashed(h_dentry) -+ || (!tmpfile -+ && !au_qstreq(name, h_name)) -+ )) -+ || (h_nfs -+ && !(flags & LOOKUP_OPEN) -+ && (h_dentry->d_flags -+ & DCACHE_NFSFS_RENAMED))) -+ )) { -+ int h_unhashed; -+ -+ h_unhashed = d_unhashed(h_dentry); -+ spin_unlock(&h_dentry->d_lock); -+ AuDbg("unhash 0x%x 0x%x, %pd %pd\n", -+ unhashed, h_unhashed, dentry, h_dentry); -+ goto err; -+ } -+ spin_unlock(&h_dentry->d_lock); -+ -+ err = au_do_h_d_reval(h_dentry, flags, dentry, bindex); -+ if (unlikely(err)) -+ /* do not goto err, to keep the errno */ -+ break; -+ -+ /* todo: plink too? */ -+ if (!do_udba) -+ continue; -+ -+ /* UDBA tests */ -+ if (unlikely(!!inode != d_is_positive(h_dentry))) -+ goto err; -+ -+ h_inode = NULL; -+ if (d_is_positive(h_dentry)) -+ h_inode = d_inode(h_dentry); -+ h_plus = plus; -+ h_mode = mode; -+ h_cached_inode = h_inode; -+ if (h_inode) { -+ h_mode = (h_inode->i_mode & S_IFMT); -+ h_plus = (h_inode->i_nlink > 0); -+ } -+ if (inode && ibs <= bindex && bindex <= ibe) -+ h_cached_inode = au_h_iptr(inode, bindex); -+ -+ if (!h_nfs) { -+ if (unlikely(plus != h_plus && !tmpfile)) -+ goto err; -+ } else { -+ if (unlikely(!(h_dentry->d_flags & DCACHE_NFSFS_RENAMED) -+ && !is_root -+ && !IS_ROOT(h_dentry) -+ && unhashed != d_unhashed(h_dentry))) -+ goto err; -+ } -+ if (unlikely(mode != h_mode -+ || h_cached_inode != h_inode)) -+ goto err; -+ continue; -+ -+err: -+ err = -EINVAL; -+ break; -+ } -+ -+ AuTraceErr(err); -+ return err; -+} -+ -+/* todo: consolidate with do_refresh() and au_reval_for_attr() */ -+static int simple_reval_dpath(struct dentry *dentry, unsigned int sigen) -+{ -+ int err; -+ struct dentry *parent; -+ -+ if (!au_digen_test(dentry, sigen)) -+ return 0; -+ -+ parent = dget_parent(dentry); -+ di_read_lock_parent(parent, AuLock_IR); -+ AuDebugOn(au_digen_test(parent, sigen)); -+ au_dbg_verify_gen(parent, sigen); -+ err = au_refresh_dentry(dentry, parent); -+ di_read_unlock(parent, AuLock_IR); -+ dput(parent); -+ AuTraceErr(err); -+ return err; -+} -+ -+int au_reval_dpath(struct dentry *dentry, unsigned int sigen) -+{ -+ int err; -+ struct dentry *d, *parent; -+ -+ if (!au_ftest_si(au_sbi(dentry->d_sb), FAILED_REFRESH_DIR)) -+ return simple_reval_dpath(dentry, sigen); -+ -+ /* slow loop, keep it simple and stupid */ -+ /* cf: au_cpup_dirs() */ -+ err = 0; -+ parent = NULL; -+ while (au_digen_test(dentry, sigen)) { -+ d = dentry; -+ while (1) { -+ dput(parent); -+ parent = dget_parent(d); -+ if (!au_digen_test(parent, sigen)) -+ break; -+ d = parent; -+ } -+ -+ if (d != dentry) -+ di_write_lock_child2(d); -+ -+ /* someone might update our dentry while we were sleeping */ -+ if (au_digen_test(d, sigen)) { -+ /* -+ * todo: consolidate with simple_reval_dpath(), -+ * do_refresh() and au_reval_for_attr(). -+ */ -+ di_read_lock_parent(parent, AuLock_IR); -+ err = au_refresh_dentry(d, parent); -+ di_read_unlock(parent, AuLock_IR); -+ } -+ -+ if (d != dentry) -+ di_write_unlock(d); -+ dput(parent); -+ if (unlikely(err)) -+ break; -+ } -+ -+ return err; -+} -+ -+/* -+ * if valid returns 1, otherwise 0. -+ */ -+static int aufs_d_revalidate(struct dentry *dentry, unsigned int flags) -+{ -+ int valid, err; -+ unsigned int sigen; -+ unsigned char do_udba; -+ struct super_block *sb; -+ struct inode *inode; -+ -+ /* todo: support rcu-walk? */ -+ if (flags & LOOKUP_RCU) -+ return -ECHILD; -+ -+ valid = 0; -+ if (unlikely(!au_di(dentry))) -+ goto out; -+ -+ valid = 1; -+ sb = dentry->d_sb; -+ /* -+ * todo: very ugly -+ * i_mutex of parent dir may be held, -+ * but we should not return 'invalid' due to busy. -+ */ -+ err = aufs_read_lock(dentry, AuLock_FLUSH | AuLock_DW | AuLock_NOPLM); -+ if (unlikely(err)) { -+ valid = err; -+ AuTraceErr(err); -+ goto out; -+ } -+ inode = NULL; -+ if (d_really_is_positive(dentry)) -+ inode = d_inode(dentry); -+ if (unlikely(inode && au_is_bad_inode(inode))) { -+ err = -EINVAL; -+ AuTraceErr(err); -+ goto out_dgrade; -+ } -+ if (unlikely(au_dbrange_test(dentry))) { -+ err = -EINVAL; -+ AuTraceErr(err); -+ goto out_dgrade; -+ } -+ -+ sigen = au_sigen(sb); -+ if (au_digen_test(dentry, sigen)) { -+ AuDebugOn(IS_ROOT(dentry)); -+ err = au_reval_dpath(dentry, sigen); -+ if (unlikely(err)) { -+ AuTraceErr(err); -+ goto out_dgrade; -+ } -+ } -+ di_downgrade_lock(dentry, AuLock_IR); -+ -+ err = -EINVAL; -+ if (!(flags & (LOOKUP_OPEN | LOOKUP_EMPTY)) -+ && inode -+ && !(inode->i_state && I_LINKABLE) -+ && (IS_DEADDIR(inode) || !inode->i_nlink)) { -+ AuTraceErr(err); -+ goto out_inval; -+ } -+ -+ do_udba = !au_opt_test(au_mntflags(sb), UDBA_NONE); -+ if (do_udba && inode) { -+ aufs_bindex_t btop = au_ibtop(inode); -+ struct inode *h_inode; -+ -+ if (btop >= 0) { -+ h_inode = au_h_iptr(inode, btop); -+ if (h_inode && au_test_higen(inode, h_inode)) { -+ AuTraceErr(err); -+ goto out_inval; -+ } -+ } -+ } -+ -+ err = h_d_revalidate(dentry, inode, flags, do_udba); -+ if (unlikely(!err && do_udba && au_dbtop(dentry) < 0)) { -+ err = -EIO; -+ AuDbg("both of real entry and whiteout found, %p, err %d\n", -+ dentry, err); -+ } -+ goto out_inval; -+ -+out_dgrade: -+ di_downgrade_lock(dentry, AuLock_IR); -+out_inval: -+ aufs_read_unlock(dentry, AuLock_IR); -+ AuTraceErr(err); -+ valid = !err; -+out: -+ if (!valid) { -+ AuDbg("%pd invalid, %d\n", dentry, valid); -+ d_drop(dentry); -+ } -+ return valid; -+} -+ -+static void aufs_d_release(struct dentry *dentry) -+{ -+ if (au_di(dentry)) { -+ au_di_fin(dentry); -+ au_hn_di_reinit(dentry); -+ } -+} -+ -+const struct dentry_operations aufs_dop = { -+ .d_revalidate = aufs_d_revalidate, -+ .d_weak_revalidate = aufs_d_revalidate, -+ .d_release = aufs_d_release -+}; -+ -+/* aufs_dop without d_revalidate */ -+const struct dentry_operations aufs_dop_noreval = { -+ .d_release = aufs_d_release -+}; -diff --git a/fs/aufs/dentry.h b/fs/aufs/dentry.h -new file mode 100644 -index 0000000..01211d2 ---- /dev/null -+++ b/fs/aufs/dentry.h -@@ -0,0 +1,242 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * lookup and dentry operations -+ */ -+ -+#ifndef __AUFS_DENTRY_H__ -+#define __AUFS_DENTRY_H__ -+ -+#ifdef __KERNEL__ -+ -+#include -+#include "rwsem.h" -+ -+struct au_hdentry { -+ struct dentry *hd_dentry; -+ aufs_bindex_t hd_id; -+}; -+ -+struct au_dinfo { -+ atomic_t di_generation; -+ -+ struct au_rwsem di_rwsem; -+ aufs_bindex_t di_btop, di_bbot, di_bwh, di_bdiropq; -+ unsigned char di_tmpfile; /* to allow the different name */ -+ union { -+ struct au_hdentry *di_hdentry; -+ struct llist_node di_lnode; /* delayed free */ -+ }; -+} ____cacheline_aligned_in_smp; -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* flags for au_lkup_dentry() */ -+#define AuLkup_ALLOW_NEG 1 -+#define AuLkup_IGNORE_PERM (1 << 1) -+#define au_ftest_lkup(flags, name) ((flags) & AuLkup_##name) -+#define au_fset_lkup(flags, name) \ -+ do { (flags) |= AuLkup_##name; } while (0) -+#define au_fclr_lkup(flags, name) \ -+ do { (flags) &= ~AuLkup_##name; } while (0) -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* dentry.c */ -+extern const struct dentry_operations aufs_dop, aufs_dop_noreval; -+struct au_branch; -+struct dentry *au_sio_lkup_one(struct qstr *name, struct dentry *parent); -+int au_h_verify(struct dentry *h_dentry, unsigned int udba, struct inode *h_dir, -+ struct dentry *h_parent, struct au_branch *br); -+ -+int au_lkup_dentry(struct dentry *dentry, aufs_bindex_t btop, -+ unsigned int flags); -+int au_lkup_neg(struct dentry *dentry, aufs_bindex_t bindex, int wh); -+int au_refresh_dentry(struct dentry *dentry, struct dentry *parent); -+int au_reval_dpath(struct dentry *dentry, unsigned int sigen); -+void au_refresh_dop(struct dentry *dentry, int force_reval); -+ -+/* dinfo.c */ -+void au_di_init_once(void *_di); -+struct au_dinfo *au_di_alloc(struct super_block *sb, unsigned int lsc); -+void au_di_free(struct au_dinfo *dinfo); -+void au_di_swap(struct au_dinfo *a, struct au_dinfo *b); -+void au_di_cp(struct au_dinfo *dst, struct au_dinfo *src); -+int au_di_init(struct dentry *dentry); -+void au_di_fin(struct dentry *dentry); -+int au_di_realloc(struct au_dinfo *dinfo, int nbr, int may_shrink); -+ -+void di_read_lock(struct dentry *d, int flags, unsigned int lsc); -+void di_read_unlock(struct dentry *d, int flags); -+void di_downgrade_lock(struct dentry *d, int flags); -+void di_write_lock(struct dentry *d, unsigned int lsc); -+void di_write_unlock(struct dentry *d); -+void di_write_lock2_child(struct dentry *d1, struct dentry *d2, int isdir); -+void di_write_lock2_parent(struct dentry *d1, struct dentry *d2, int isdir); -+void di_write_unlock2(struct dentry *d1, struct dentry *d2); -+ -+struct dentry *au_h_dptr(struct dentry *dentry, aufs_bindex_t bindex); -+struct dentry *au_h_d_alias(struct dentry *dentry, aufs_bindex_t bindex); -+aufs_bindex_t au_dbtail(struct dentry *dentry); -+aufs_bindex_t au_dbtaildir(struct dentry *dentry); -+ -+void au_set_h_dptr(struct dentry *dentry, aufs_bindex_t bindex, -+ struct dentry *h_dentry); -+int au_digen_test(struct dentry *dentry, unsigned int sigen); -+int au_dbrange_test(struct dentry *dentry); -+void au_update_digen(struct dentry *dentry); -+void au_update_dbrange(struct dentry *dentry, int do_put_zero); -+void au_update_dbtop(struct dentry *dentry); -+void au_update_dbbot(struct dentry *dentry); -+int au_find_dbindex(struct dentry *dentry, struct dentry *h_dentry); -+ -+/* ---------------------------------------------------------------------- */ -+ -+static inline struct au_dinfo *au_di(struct dentry *dentry) -+{ -+ return dentry->d_fsdata; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* lock subclass for dinfo */ -+enum { -+ AuLsc_DI_CHILD, /* child first */ -+ AuLsc_DI_CHILD2, /* rename(2), link(2), and cpup at hnotify */ -+ AuLsc_DI_CHILD3, /* copyup dirs */ -+ AuLsc_DI_PARENT, -+ AuLsc_DI_PARENT2, -+ AuLsc_DI_PARENT3, -+ AuLsc_DI_TMP /* temp for replacing dinfo */ -+}; -+ -+/* -+ * di_read_lock_child, di_write_lock_child, -+ * di_read_lock_child2, di_write_lock_child2, -+ * di_read_lock_child3, di_write_lock_child3, -+ * di_read_lock_parent, di_write_lock_parent, -+ * di_read_lock_parent2, di_write_lock_parent2, -+ * di_read_lock_parent3, di_write_lock_parent3, -+ */ -+#define AuReadLockFunc(name, lsc) \ -+static inline void di_read_lock_##name(struct dentry *d, int flags) \ -+{ di_read_lock(d, flags, AuLsc_DI_##lsc); } -+ -+#define AuWriteLockFunc(name, lsc) \ -+static inline void di_write_lock_##name(struct dentry *d) \ -+{ di_write_lock(d, AuLsc_DI_##lsc); } -+ -+#define AuRWLockFuncs(name, lsc) \ -+ AuReadLockFunc(name, lsc) \ -+ AuWriteLockFunc(name, lsc) -+ -+AuRWLockFuncs(child, CHILD); -+AuRWLockFuncs(child2, CHILD2); -+AuRWLockFuncs(child3, CHILD3); -+AuRWLockFuncs(parent, PARENT); -+AuRWLockFuncs(parent2, PARENT2); -+AuRWLockFuncs(parent3, PARENT3); -+ -+#undef AuReadLockFunc -+#undef AuWriteLockFunc -+#undef AuRWLockFuncs -+ -+#define DiMustNoWaiters(d) AuRwMustNoWaiters(&au_di(d)->di_rwsem) -+#define DiMustAnyLock(d) AuRwMustAnyLock(&au_di(d)->di_rwsem) -+#define DiMustWriteLock(d) AuRwMustWriteLock(&au_di(d)->di_rwsem) -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* todo: memory barrier? */ -+static inline unsigned int au_digen(struct dentry *d) -+{ -+ return atomic_read(&au_di(d)->di_generation); -+} -+ -+static inline void au_h_dentry_init(struct au_hdentry *hdentry) -+{ -+ hdentry->hd_dentry = NULL; -+} -+ -+static inline struct au_hdentry *au_hdentry(struct au_dinfo *di, -+ aufs_bindex_t bindex) -+{ -+ return di->di_hdentry + bindex; -+} -+ -+static inline void au_hdput(struct au_hdentry *hd) -+{ -+ if (hd) -+ dput(hd->hd_dentry); -+} -+ -+static inline aufs_bindex_t au_dbtop(struct dentry *dentry) -+{ -+ DiMustAnyLock(dentry); -+ return au_di(dentry)->di_btop; -+} -+ -+static inline aufs_bindex_t au_dbbot(struct dentry *dentry) -+{ -+ DiMustAnyLock(dentry); -+ return au_di(dentry)->di_bbot; -+} -+ -+static inline aufs_bindex_t au_dbwh(struct dentry *dentry) -+{ -+ DiMustAnyLock(dentry); -+ return au_di(dentry)->di_bwh; -+} -+ -+static inline aufs_bindex_t au_dbdiropq(struct dentry *dentry) -+{ -+ DiMustAnyLock(dentry); -+ return au_di(dentry)->di_bdiropq; -+} -+ -+/* todo: hard/soft set? */ -+static inline void au_set_dbtop(struct dentry *dentry, aufs_bindex_t bindex) -+{ -+ DiMustWriteLock(dentry); -+ au_di(dentry)->di_btop = bindex; -+} -+ -+static inline void au_set_dbbot(struct dentry *dentry, aufs_bindex_t bindex) -+{ -+ DiMustWriteLock(dentry); -+ au_di(dentry)->di_bbot = bindex; -+} -+ -+static inline void au_set_dbwh(struct dentry *dentry, aufs_bindex_t bindex) -+{ -+ DiMustWriteLock(dentry); -+ /* dbwh can be outside of btop - bbot range */ -+ au_di(dentry)->di_bwh = bindex; -+} -+ -+static inline void au_set_dbdiropq(struct dentry *dentry, aufs_bindex_t bindex) -+{ -+ DiMustWriteLock(dentry); -+ au_di(dentry)->di_bdiropq = bindex; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+#ifdef CONFIG_AUFS_HNOTIFY -+static inline void au_digen_dec(struct dentry *d) -+{ -+ atomic_dec(&au_di(d)->di_generation); -+} -+ -+static inline void au_hn_di_reinit(struct dentry *dentry) -+{ -+ dentry->d_fsdata = NULL; -+} -+#else -+AuStubVoid(au_hn_di_reinit, struct dentry *dentry __maybe_unused) -+#endif /* CONFIG_AUFS_HNOTIFY */ -+ -+#endif /* __KERNEL__ */ -+#endif /* __AUFS_DENTRY_H__ */ -diff --git a/fs/aufs/dinfo.c b/fs/aufs/dinfo.c -new file mode 100644 -index 0000000..2626c0c ---- /dev/null -+++ b/fs/aufs/dinfo.c -@@ -0,0 +1,540 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * dentry private data -+ */ -+ -+#include "aufs.h" -+ -+void au_di_init_once(void *_dinfo) -+{ -+ struct au_dinfo *dinfo = _dinfo; -+ -+ au_rw_init(&dinfo->di_rwsem); -+} -+ -+struct au_dinfo *au_di_alloc(struct super_block *sb, unsigned int lsc) -+{ -+ struct au_dinfo *dinfo; -+ int nbr, i; -+ -+ dinfo = au_cache_alloc_dinfo(); -+ if (unlikely(!dinfo)) -+ goto out; -+ -+ nbr = au_sbbot(sb) + 1; -+ if (nbr <= 0) -+ nbr = 1; -+ dinfo->di_hdentry = kcalloc(nbr, sizeof(*dinfo->di_hdentry), GFP_NOFS); -+ if (dinfo->di_hdentry) { -+ au_rw_write_lock_nested(&dinfo->di_rwsem, lsc); -+ dinfo->di_btop = -1; -+ dinfo->di_bbot = -1; -+ dinfo->di_bwh = -1; -+ dinfo->di_bdiropq = -1; -+ dinfo->di_tmpfile = 0; -+ for (i = 0; i < nbr; i++) -+ dinfo->di_hdentry[i].hd_id = -1; -+ goto out; -+ } -+ -+ au_cache_dfree_dinfo(dinfo); -+ dinfo = NULL; -+ -+out: -+ return dinfo; -+} -+ -+void au_di_free(struct au_dinfo *dinfo) -+{ -+ struct au_hdentry *p; -+ aufs_bindex_t bbot, bindex; -+ -+ /* dentry may not be revalidated */ -+ bindex = dinfo->di_btop; -+ if (bindex >= 0) { -+ bbot = dinfo->di_bbot; -+ p = au_hdentry(dinfo, bindex); -+ while (bindex++ <= bbot) -+ au_hdput(p++); -+ } -+ au_delayed_kfree(dinfo->di_hdentry); -+ au_cache_dfree_dinfo(dinfo); -+} -+ -+void au_di_swap(struct au_dinfo *a, struct au_dinfo *b) -+{ -+ struct au_hdentry *p; -+ aufs_bindex_t bi; -+ -+ AuRwMustWriteLock(&a->di_rwsem); -+ AuRwMustWriteLock(&b->di_rwsem); -+ -+#define DiSwap(v, name) \ -+ do { \ -+ v = a->di_##name; \ -+ a->di_##name = b->di_##name; \ -+ b->di_##name = v; \ -+ } while (0) -+ -+ DiSwap(p, hdentry); -+ DiSwap(bi, btop); -+ DiSwap(bi, bbot); -+ DiSwap(bi, bwh); -+ DiSwap(bi, bdiropq); -+ /* smp_mb(); */ -+ -+#undef DiSwap -+} -+ -+void au_di_cp(struct au_dinfo *dst, struct au_dinfo *src) -+{ -+ AuRwMustWriteLock(&dst->di_rwsem); -+ AuRwMustWriteLock(&src->di_rwsem); -+ -+ dst->di_btop = src->di_btop; -+ dst->di_bbot = src->di_bbot; -+ dst->di_bwh = src->di_bwh; -+ dst->di_bdiropq = src->di_bdiropq; -+ /* smp_mb(); */ -+} -+ -+int au_di_init(struct dentry *dentry) -+{ -+ int err; -+ struct super_block *sb; -+ struct au_dinfo *dinfo; -+ -+ err = 0; -+ sb = dentry->d_sb; -+ dinfo = au_di_alloc(sb, AuLsc_DI_CHILD); -+ if (dinfo) { -+ atomic_set(&dinfo->di_generation, au_sigen(sb)); -+ /* smp_mb(); */ /* atomic_set */ -+ dentry->d_fsdata = dinfo; -+ } else -+ err = -ENOMEM; -+ -+ return err; -+} -+ -+void au_di_fin(struct dentry *dentry) -+{ -+ struct au_dinfo *dinfo; -+ -+ dinfo = au_di(dentry); -+ AuRwDestroy(&dinfo->di_rwsem); -+ au_di_free(dinfo); -+} -+ -+int au_di_realloc(struct au_dinfo *dinfo, int nbr, int may_shrink) -+{ -+ int err, sz; -+ struct au_hdentry *hdp; -+ -+ AuRwMustWriteLock(&dinfo->di_rwsem); -+ -+ err = -ENOMEM; -+ sz = sizeof(*hdp) * (dinfo->di_bbot + 1); -+ if (!sz) -+ sz = sizeof(*hdp); -+ hdp = au_kzrealloc(dinfo->di_hdentry, sz, sizeof(*hdp) * nbr, GFP_NOFS, -+ may_shrink); -+ if (hdp) { -+ dinfo->di_hdentry = hdp; -+ err = 0; -+ } -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static void do_ii_write_lock(struct inode *inode, unsigned int lsc) -+{ -+ switch (lsc) { -+ case AuLsc_DI_CHILD: -+ ii_write_lock_child(inode); -+ break; -+ case AuLsc_DI_CHILD2: -+ ii_write_lock_child2(inode); -+ break; -+ case AuLsc_DI_CHILD3: -+ ii_write_lock_child3(inode); -+ break; -+ case AuLsc_DI_PARENT: -+ ii_write_lock_parent(inode); -+ break; -+ case AuLsc_DI_PARENT2: -+ ii_write_lock_parent2(inode); -+ break; -+ case AuLsc_DI_PARENT3: -+ ii_write_lock_parent3(inode); -+ break; -+ default: -+ BUG(); -+ } -+} -+ -+static void do_ii_read_lock(struct inode *inode, unsigned int lsc) -+{ -+ switch (lsc) { -+ case AuLsc_DI_CHILD: -+ ii_read_lock_child(inode); -+ break; -+ case AuLsc_DI_CHILD2: -+ ii_read_lock_child2(inode); -+ break; -+ case AuLsc_DI_CHILD3: -+ ii_read_lock_child3(inode); -+ break; -+ case AuLsc_DI_PARENT: -+ ii_read_lock_parent(inode); -+ break; -+ case AuLsc_DI_PARENT2: -+ ii_read_lock_parent2(inode); -+ break; -+ case AuLsc_DI_PARENT3: -+ ii_read_lock_parent3(inode); -+ break; -+ default: -+ BUG(); -+ } -+} -+ -+void di_read_lock(struct dentry *d, int flags, unsigned int lsc) -+{ -+ struct inode *inode; -+ -+ au_rw_read_lock_nested(&au_di(d)->di_rwsem, lsc); -+ if (d_really_is_positive(d)) { -+ inode = d_inode(d); -+ if (au_ftest_lock(flags, IW)) -+ do_ii_write_lock(inode, lsc); -+ else if (au_ftest_lock(flags, IR)) -+ do_ii_read_lock(inode, lsc); -+ } -+} -+ -+void di_read_unlock(struct dentry *d, int flags) -+{ -+ struct inode *inode; -+ -+ if (d_really_is_positive(d)) { -+ inode = d_inode(d); -+ if (au_ftest_lock(flags, IW)) { -+ au_dbg_verify_dinode(d); -+ ii_write_unlock(inode); -+ } else if (au_ftest_lock(flags, IR)) { -+ au_dbg_verify_dinode(d); -+ ii_read_unlock(inode); -+ } -+ } -+ au_rw_read_unlock(&au_di(d)->di_rwsem); -+} -+ -+void di_downgrade_lock(struct dentry *d, int flags) -+{ -+ if (d_really_is_positive(d) && au_ftest_lock(flags, IR)) -+ ii_downgrade_lock(d_inode(d)); -+ au_rw_dgrade_lock(&au_di(d)->di_rwsem); -+} -+ -+void di_write_lock(struct dentry *d, unsigned int lsc) -+{ -+ au_rw_write_lock_nested(&au_di(d)->di_rwsem, lsc); -+ if (d_really_is_positive(d)) -+ do_ii_write_lock(d_inode(d), lsc); -+} -+ -+void di_write_unlock(struct dentry *d) -+{ -+ au_dbg_verify_dinode(d); -+ if (d_really_is_positive(d)) -+ ii_write_unlock(d_inode(d)); -+ au_rw_write_unlock(&au_di(d)->di_rwsem); -+} -+ -+void di_write_lock2_child(struct dentry *d1, struct dentry *d2, int isdir) -+{ -+ AuDebugOn(d1 == d2 -+ || d_inode(d1) == d_inode(d2) -+ || d1->d_sb != d2->d_sb); -+ -+ if (isdir && au_test_subdir(d1, d2)) { -+ di_write_lock_child(d1); -+ di_write_lock_child2(d2); -+ } else { -+ /* there should be no races */ -+ di_write_lock_child(d2); -+ di_write_lock_child2(d1); -+ } -+} -+ -+void di_write_lock2_parent(struct dentry *d1, struct dentry *d2, int isdir) -+{ -+ AuDebugOn(d1 == d2 -+ || d_inode(d1) == d_inode(d2) -+ || d1->d_sb != d2->d_sb); -+ -+ if (isdir && au_test_subdir(d1, d2)) { -+ di_write_lock_parent(d1); -+ di_write_lock_parent2(d2); -+ } else { -+ /* there should be no races */ -+ di_write_lock_parent(d2); -+ di_write_lock_parent2(d1); -+ } -+} -+ -+void di_write_unlock2(struct dentry *d1, struct dentry *d2) -+{ -+ di_write_unlock(d1); -+ if (d_inode(d1) == d_inode(d2)) -+ au_rw_write_unlock(&au_di(d2)->di_rwsem); -+ else -+ di_write_unlock(d2); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+struct dentry *au_h_dptr(struct dentry *dentry, aufs_bindex_t bindex) -+{ -+ struct dentry *d; -+ -+ DiMustAnyLock(dentry); -+ -+ if (au_dbtop(dentry) < 0 || bindex < au_dbtop(dentry)) -+ return NULL; -+ AuDebugOn(bindex < 0); -+ d = au_hdentry(au_di(dentry), bindex)->hd_dentry; -+ AuDebugOn(d && au_dcount(d) <= 0); -+ return d; -+} -+ -+/* -+ * extended version of au_h_dptr(). -+ * returns a hashed and positive (or linkable) h_dentry in bindex, NULL, or -+ * error. -+ */ -+struct dentry *au_h_d_alias(struct dentry *dentry, aufs_bindex_t bindex) -+{ -+ struct dentry *h_dentry; -+ struct inode *inode, *h_inode; -+ -+ AuDebugOn(d_really_is_negative(dentry)); -+ -+ h_dentry = NULL; -+ if (au_dbtop(dentry) <= bindex -+ && bindex <= au_dbbot(dentry)) -+ h_dentry = au_h_dptr(dentry, bindex); -+ if (h_dentry && !au_d_linkable(h_dentry)) { -+ dget(h_dentry); -+ goto out; /* success */ -+ } -+ -+ inode = d_inode(dentry); -+ AuDebugOn(bindex < au_ibtop(inode)); -+ AuDebugOn(au_ibbot(inode) < bindex); -+ h_inode = au_h_iptr(inode, bindex); -+ h_dentry = d_find_alias(h_inode); -+ if (h_dentry) { -+ if (!IS_ERR(h_dentry)) { -+ if (!au_d_linkable(h_dentry)) -+ goto out; /* success */ -+ dput(h_dentry); -+ } else -+ goto out; -+ } -+ -+ if (au_opt_test(au_mntflags(dentry->d_sb), PLINK)) { -+ h_dentry = au_plink_lkup(inode, bindex); -+ AuDebugOn(!h_dentry); -+ if (!IS_ERR(h_dentry)) { -+ if (!au_d_hashed_positive(h_dentry)) -+ goto out; /* success */ -+ dput(h_dentry); -+ h_dentry = NULL; -+ } -+ } -+ -+out: -+ AuDbgDentry(h_dentry); -+ return h_dentry; -+} -+ -+aufs_bindex_t au_dbtail(struct dentry *dentry) -+{ -+ aufs_bindex_t bbot, bwh; -+ -+ bbot = au_dbbot(dentry); -+ if (0 <= bbot) { -+ bwh = au_dbwh(dentry); -+ if (!bwh) -+ return bwh; -+ if (0 < bwh && bwh < bbot) -+ return bwh - 1; -+ } -+ return bbot; -+} -+ -+aufs_bindex_t au_dbtaildir(struct dentry *dentry) -+{ -+ aufs_bindex_t bbot, bopq; -+ -+ bbot = au_dbtail(dentry); -+ if (0 <= bbot) { -+ bopq = au_dbdiropq(dentry); -+ if (0 <= bopq && bopq < bbot) -+ bbot = bopq; -+ } -+ return bbot; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+void au_set_h_dptr(struct dentry *dentry, aufs_bindex_t bindex, -+ struct dentry *h_dentry) -+{ -+ struct au_dinfo *dinfo; -+ struct au_hdentry *hd; -+ struct au_branch *br; -+ -+ DiMustWriteLock(dentry); -+ -+ dinfo = au_di(dentry); -+ hd = au_hdentry(dinfo, bindex); -+ au_hdput(hd); -+ hd->hd_dentry = h_dentry; -+ if (h_dentry) { -+ br = au_sbr(dentry->d_sb, bindex); -+ hd->hd_id = br->br_id; -+ } -+} -+ -+int au_dbrange_test(struct dentry *dentry) -+{ -+ int err; -+ aufs_bindex_t btop, bbot; -+ -+ err = 0; -+ btop = au_dbtop(dentry); -+ bbot = au_dbbot(dentry); -+ if (btop >= 0) -+ AuDebugOn(bbot < 0 && btop > bbot); -+ else { -+ err = -EIO; -+ AuDebugOn(bbot >= 0); -+ } -+ -+ return err; -+} -+ -+int au_digen_test(struct dentry *dentry, unsigned int sigen) -+{ -+ int err; -+ -+ err = 0; -+ if (unlikely(au_digen(dentry) != sigen -+ || au_iigen_test(d_inode(dentry), sigen))) -+ err = -EIO; -+ -+ return err; -+} -+ -+void au_update_digen(struct dentry *dentry) -+{ -+ atomic_set(&au_di(dentry)->di_generation, au_sigen(dentry->d_sb)); -+ /* smp_mb(); */ /* atomic_set */ -+} -+ -+void au_update_dbrange(struct dentry *dentry, int do_put_zero) -+{ -+ struct au_dinfo *dinfo; -+ struct dentry *h_d; -+ struct au_hdentry *hdp; -+ aufs_bindex_t bindex, bbot; -+ -+ DiMustWriteLock(dentry); -+ -+ dinfo = au_di(dentry); -+ if (!dinfo || dinfo->di_btop < 0) -+ return; -+ -+ if (do_put_zero) { -+ bbot = dinfo->di_bbot; -+ bindex = dinfo->di_btop; -+ hdp = au_hdentry(dinfo, bindex); -+ for (; bindex <= bbot; bindex++, hdp++) { -+ h_d = hdp->hd_dentry; -+ if (h_d && d_is_negative(h_d)) -+ au_set_h_dptr(dentry, bindex, NULL); -+ } -+ } -+ -+ dinfo->di_btop = 0; -+ hdp = au_hdentry(dinfo, dinfo->di_btop); -+ for (; dinfo->di_btop <= dinfo->di_bbot; dinfo->di_btop++, hdp++) -+ if (hdp->hd_dentry) -+ break; -+ if (dinfo->di_btop > dinfo->di_bbot) { -+ dinfo->di_btop = -1; -+ dinfo->di_bbot = -1; -+ return; -+ } -+ -+ hdp = au_hdentry(dinfo, dinfo->di_bbot); -+ for (; dinfo->di_bbot >= 0; dinfo->di_bbot--, hdp--) -+ if (hdp->hd_dentry) -+ break; -+ AuDebugOn(dinfo->di_btop > dinfo->di_bbot || dinfo->di_bbot < 0); -+} -+ -+void au_update_dbtop(struct dentry *dentry) -+{ -+ aufs_bindex_t bindex, bbot; -+ struct dentry *h_dentry; -+ -+ bbot = au_dbbot(dentry); -+ for (bindex = au_dbtop(dentry); bindex <= bbot; bindex++) { -+ h_dentry = au_h_dptr(dentry, bindex); -+ if (!h_dentry) -+ continue; -+ if (d_is_positive(h_dentry)) { -+ au_set_dbtop(dentry, bindex); -+ return; -+ } -+ au_set_h_dptr(dentry, bindex, NULL); -+ } -+} -+ -+void au_update_dbbot(struct dentry *dentry) -+{ -+ aufs_bindex_t bindex, btop; -+ struct dentry *h_dentry; -+ -+ btop = au_dbtop(dentry); -+ for (bindex = au_dbbot(dentry); bindex >= btop; bindex--) { -+ h_dentry = au_h_dptr(dentry, bindex); -+ if (!h_dentry) -+ continue; -+ if (d_is_positive(h_dentry)) { -+ au_set_dbbot(dentry, bindex); -+ return; -+ } -+ au_set_h_dptr(dentry, bindex, NULL); -+ } -+} -+ -+int au_find_dbindex(struct dentry *dentry, struct dentry *h_dentry) -+{ -+ aufs_bindex_t bindex, bbot; -+ -+ bbot = au_dbbot(dentry); -+ for (bindex = au_dbtop(dentry); bindex <= bbot; bindex++) -+ if (au_h_dptr(dentry, bindex) == h_dentry) -+ return bindex; -+ return -1; -+} -diff --git a/fs/aufs/dir.c b/fs/aufs/dir.c -new file mode 100644 -index 0000000..395563e ---- /dev/null -+++ b/fs/aufs/dir.c -@@ -0,0 +1,749 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * directory operations -+ */ -+ -+#include -+#include "aufs.h" -+ -+void au_add_nlink(struct inode *dir, struct inode *h_dir) -+{ -+ unsigned int nlink; -+ -+ AuDebugOn(!S_ISDIR(dir->i_mode) || !S_ISDIR(h_dir->i_mode)); -+ -+ nlink = dir->i_nlink; -+ nlink += h_dir->i_nlink - 2; -+ if (h_dir->i_nlink < 2) -+ nlink += 2; -+ smp_mb(); /* for i_nlink */ -+ /* 0 can happen in revaliding */ -+ set_nlink(dir, nlink); -+} -+ -+void au_sub_nlink(struct inode *dir, struct inode *h_dir) -+{ -+ unsigned int nlink; -+ -+ AuDebugOn(!S_ISDIR(dir->i_mode) || !S_ISDIR(h_dir->i_mode)); -+ -+ nlink = dir->i_nlink; -+ nlink -= h_dir->i_nlink - 2; -+ if (h_dir->i_nlink < 2) -+ nlink -= 2; -+ smp_mb(); /* for i_nlink */ -+ /* nlink == 0 means the branch-fs is broken */ -+ set_nlink(dir, nlink); -+} -+ -+loff_t au_dir_size(struct file *file, struct dentry *dentry) -+{ -+ loff_t sz; -+ aufs_bindex_t bindex, bbot; -+ struct file *h_file; -+ struct dentry *h_dentry; -+ -+ sz = 0; -+ if (file) { -+ AuDebugOn(!d_is_dir(file->f_path.dentry)); -+ -+ bbot = au_fbbot_dir(file); -+ for (bindex = au_fbtop(file); -+ bindex <= bbot && sz < KMALLOC_MAX_SIZE; -+ bindex++) { -+ h_file = au_hf_dir(file, bindex); -+ if (h_file && file_inode(h_file)) -+ sz += vfsub_f_size_read(h_file); -+ } -+ } else { -+ AuDebugOn(!dentry); -+ AuDebugOn(!d_is_dir(dentry)); -+ -+ bbot = au_dbtaildir(dentry); -+ for (bindex = au_dbtop(dentry); -+ bindex <= bbot && sz < KMALLOC_MAX_SIZE; -+ bindex++) { -+ h_dentry = au_h_dptr(dentry, bindex); -+ if (h_dentry && d_is_positive(h_dentry)) -+ sz += i_size_read(d_inode(h_dentry)); -+ } -+ } -+ if (sz < KMALLOC_MAX_SIZE) -+ sz = roundup_pow_of_two(sz); -+ if (sz > KMALLOC_MAX_SIZE) -+ sz = KMALLOC_MAX_SIZE; -+ else if (sz < NAME_MAX) { -+ BUILD_BUG_ON(AUFS_RDBLK_DEF < NAME_MAX); -+ sz = AUFS_RDBLK_DEF; -+ } -+ return sz; -+} -+ -+struct au_dir_ts_arg { -+ struct dentry *dentry; -+ aufs_bindex_t brid; -+}; -+ -+static void au_do_dir_ts(void *arg) -+{ -+ struct au_dir_ts_arg *a = arg; -+ struct au_dtime dt; -+ struct path h_path; -+ struct inode *dir, *h_dir; -+ struct super_block *sb; -+ struct au_branch *br; -+ struct au_hinode *hdir; -+ int err; -+ aufs_bindex_t btop, bindex; -+ -+ sb = a->dentry->d_sb; -+ if (d_really_is_negative(a->dentry)) -+ goto out; -+ /* no dir->i_mutex lock */ -+ aufs_read_lock(a->dentry, AuLock_DW); /* noflush */ -+ -+ dir = d_inode(a->dentry); -+ btop = au_ibtop(dir); -+ bindex = au_br_index(sb, a->brid); -+ if (bindex < btop) -+ goto out_unlock; -+ -+ br = au_sbr(sb, bindex); -+ h_path.dentry = au_h_dptr(a->dentry, bindex); -+ if (!h_path.dentry) -+ goto out_unlock; -+ h_path.mnt = au_br_mnt(br); -+ au_dtime_store(&dt, a->dentry, &h_path); -+ -+ br = au_sbr(sb, btop); -+ if (!au_br_writable(br->br_perm)) -+ goto out_unlock; -+ h_path.dentry = au_h_dptr(a->dentry, btop); -+ h_path.mnt = au_br_mnt(br); -+ err = vfsub_mnt_want_write(h_path.mnt); -+ if (err) -+ goto out_unlock; -+ hdir = au_hi(dir, btop); -+ au_hn_inode_lock_nested(hdir, AuLsc_I_PARENT); -+ h_dir = au_h_iptr(dir, btop); -+ if (h_dir->i_nlink -+ && timespec_compare(&h_dir->i_mtime, &dt.dt_mtime) < 0) { -+ dt.dt_h_path = h_path; -+ au_dtime_revert(&dt); -+ } -+ au_hn_inode_unlock(hdir); -+ vfsub_mnt_drop_write(h_path.mnt); -+ au_cpup_attr_timesizes(dir); -+ -+out_unlock: -+ aufs_read_unlock(a->dentry, AuLock_DW); -+out: -+ dput(a->dentry); -+ au_nwt_done(&au_sbi(sb)->si_nowait); -+ au_delayed_kfree(arg); -+} -+ -+void au_dir_ts(struct inode *dir, aufs_bindex_t bindex) -+{ -+ int perm, wkq_err; -+ aufs_bindex_t btop; -+ struct au_dir_ts_arg *arg; -+ struct dentry *dentry; -+ struct super_block *sb; -+ -+ IMustLock(dir); -+ -+ dentry = d_find_any_alias(dir); -+ AuDebugOn(!dentry); -+ sb = dentry->d_sb; -+ btop = au_ibtop(dir); -+ if (btop == bindex) { -+ au_cpup_attr_timesizes(dir); -+ goto out; -+ } -+ -+ perm = au_sbr_perm(sb, btop); -+ if (!au_br_writable(perm)) -+ goto out; -+ -+ arg = kmalloc(sizeof(*arg), GFP_NOFS); -+ if (!arg) -+ goto out; -+ -+ arg->dentry = dget(dentry); /* will be dput-ted by au_do_dir_ts() */ -+ arg->brid = au_sbr_id(sb, bindex); -+ wkq_err = au_wkq_nowait(au_do_dir_ts, arg, sb, /*flags*/0); -+ if (unlikely(wkq_err)) { -+ pr_err("wkq %d\n", wkq_err); -+ dput(dentry); -+ au_delayed_kfree(arg); -+ } -+ -+out: -+ dput(dentry); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int reopen_dir(struct file *file) -+{ -+ int err; -+ unsigned int flags; -+ aufs_bindex_t bindex, btail, btop; -+ struct dentry *dentry, *h_dentry; -+ struct file *h_file; -+ -+ /* open all lower dirs */ -+ dentry = file->f_path.dentry; -+ btop = au_dbtop(dentry); -+ for (bindex = au_fbtop(file); bindex < btop; bindex++) -+ au_set_h_fptr(file, bindex, NULL); -+ au_set_fbtop(file, btop); -+ -+ btail = au_dbtaildir(dentry); -+ for (bindex = au_fbbot_dir(file); btail < bindex; bindex--) -+ au_set_h_fptr(file, bindex, NULL); -+ au_set_fbbot_dir(file, btail); -+ -+ flags = vfsub_file_flags(file); -+ for (bindex = btop; bindex <= btail; bindex++) { -+ h_dentry = au_h_dptr(dentry, bindex); -+ if (!h_dentry) -+ continue; -+ h_file = au_hf_dir(file, bindex); -+ if (h_file) -+ continue; -+ -+ h_file = au_h_open(dentry, bindex, flags, file, /*force_wr*/0); -+ err = PTR_ERR(h_file); -+ if (IS_ERR(h_file)) -+ goto out; /* close all? */ -+ au_set_h_fptr(file, bindex, h_file); -+ } -+ au_update_figen(file); -+ /* todo: necessary? */ -+ /* file->f_ra = h_file->f_ra; */ -+ err = 0; -+ -+out: -+ return err; -+} -+ -+static int do_open_dir(struct file *file, int flags, struct file *h_file) -+{ -+ int err; -+ aufs_bindex_t bindex, btail; -+ struct dentry *dentry, *h_dentry; -+ struct vfsmount *mnt; -+ -+ FiMustWriteLock(file); -+ AuDebugOn(h_file); -+ -+ err = 0; -+ mnt = file->f_path.mnt; -+ dentry = file->f_path.dentry; -+ file->f_version = d_inode(dentry)->i_version; -+ bindex = au_dbtop(dentry); -+ au_set_fbtop(file, bindex); -+ btail = au_dbtaildir(dentry); -+ au_set_fbbot_dir(file, btail); -+ for (; !err && bindex <= btail; bindex++) { -+ h_dentry = au_h_dptr(dentry, bindex); -+ if (!h_dentry) -+ continue; -+ -+ err = vfsub_test_mntns(mnt, h_dentry->d_sb); -+ if (unlikely(err)) -+ break; -+ h_file = au_h_open(dentry, bindex, flags, file, /*force_wr*/0); -+ if (IS_ERR(h_file)) { -+ err = PTR_ERR(h_file); -+ break; -+ } -+ au_set_h_fptr(file, bindex, h_file); -+ } -+ au_update_figen(file); -+ /* todo: necessary? */ -+ /* file->f_ra = h_file->f_ra; */ -+ if (!err) -+ return 0; /* success */ -+ -+ /* close all */ -+ for (bindex = au_fbtop(file); bindex <= btail; bindex++) -+ au_set_h_fptr(file, bindex, NULL); -+ au_set_fbtop(file, -1); -+ au_set_fbbot_dir(file, -1); -+ -+ return err; -+} -+ -+static int aufs_open_dir(struct inode *inode __maybe_unused, -+ struct file *file) -+{ -+ int err; -+ struct super_block *sb; -+ struct au_fidir *fidir; -+ -+ err = -ENOMEM; -+ sb = file->f_path.dentry->d_sb; -+ si_read_lock(sb, AuLock_FLUSH); -+ fidir = au_fidir_alloc(sb); -+ if (fidir) { -+ struct au_do_open_args args = { -+ .open = do_open_dir, -+ .fidir = fidir -+ }; -+ err = au_do_open(file, &args); -+ if (unlikely(err)) -+ au_delayed_kfree(fidir); -+ } -+ si_read_unlock(sb); -+ return err; -+} -+ -+static int aufs_release_dir(struct inode *inode __maybe_unused, -+ struct file *file) -+{ -+ struct au_vdir *vdir_cache; -+ struct au_finfo *finfo; -+ struct au_fidir *fidir; -+ struct au_hfile *hf; -+ aufs_bindex_t bindex, bbot; -+ int execed, delayed; -+ -+ delayed = (current->flags & PF_KTHREAD) || in_interrupt(); -+ finfo = au_fi(file); -+ fidir = finfo->fi_hdir; -+ if (fidir) { -+ au_sphl_del(&finfo->fi_hlist, -+ &au_sbi(file->f_path.dentry->d_sb)->si_files); -+ vdir_cache = fidir->fd_vdir_cache; /* lock-free */ -+ if (vdir_cache) -+ au_vdir_free(vdir_cache, delayed); -+ -+ bindex = finfo->fi_btop; -+ if (bindex >= 0) { -+ execed = vfsub_file_execed(file); -+ hf = fidir->fd_hfile + bindex; -+ /* -+ * calls fput() instead of filp_close(), -+ * since no dnotify or lock for the lower file. -+ */ -+ bbot = fidir->fd_bbot; -+ for (; bindex <= bbot; bindex++, hf++) -+ if (hf->hf_file) -+ au_hfput(hf, execed); -+ } -+ au_delayed_kfree(fidir); -+ finfo->fi_hdir = NULL; -+ } -+ au_finfo_fin(file, delayed); -+ return 0; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int au_do_flush_dir(struct file *file, fl_owner_t id) -+{ -+ int err; -+ aufs_bindex_t bindex, bbot; -+ struct file *h_file; -+ -+ err = 0; -+ bbot = au_fbbot_dir(file); -+ for (bindex = au_fbtop(file); !err && bindex <= bbot; bindex++) { -+ h_file = au_hf_dir(file, bindex); -+ if (h_file) -+ err = vfsub_flush(h_file, id); -+ } -+ return err; -+} -+ -+static int aufs_flush_dir(struct file *file, fl_owner_t id) -+{ -+ return au_do_flush(file, id, au_do_flush_dir); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int au_do_fsync_dir_no_file(struct dentry *dentry, int datasync) -+{ -+ int err; -+ aufs_bindex_t bbot, bindex; -+ struct inode *inode; -+ struct super_block *sb; -+ -+ err = 0; -+ sb = dentry->d_sb; -+ inode = d_inode(dentry); -+ IMustLock(inode); -+ bbot = au_dbbot(dentry); -+ for (bindex = au_dbtop(dentry); !err && bindex <= bbot; bindex++) { -+ struct path h_path; -+ -+ if (au_test_ro(sb, bindex, inode)) -+ continue; -+ h_path.dentry = au_h_dptr(dentry, bindex); -+ if (!h_path.dentry) -+ continue; -+ -+ h_path.mnt = au_sbr_mnt(sb, bindex); -+ err = vfsub_fsync(NULL, &h_path, datasync); -+ } -+ -+ return err; -+} -+ -+static int au_do_fsync_dir(struct file *file, int datasync) -+{ -+ int err; -+ aufs_bindex_t bbot, bindex; -+ struct file *h_file; -+ struct super_block *sb; -+ struct inode *inode; -+ -+ err = au_reval_and_lock_fdi(file, reopen_dir, /*wlock*/1); -+ if (unlikely(err)) -+ goto out; -+ -+ inode = file_inode(file); -+ sb = inode->i_sb; -+ bbot = au_fbbot_dir(file); -+ for (bindex = au_fbtop(file); !err && bindex <= bbot; bindex++) { -+ h_file = au_hf_dir(file, bindex); -+ if (!h_file || au_test_ro(sb, bindex, inode)) -+ continue; -+ -+ err = vfsub_fsync(h_file, &h_file->f_path, datasync); -+ } -+ -+out: -+ return err; -+} -+ -+/* -+ * @file may be NULL -+ */ -+static int aufs_fsync_dir(struct file *file, loff_t start, loff_t end, -+ int datasync) -+{ -+ int err; -+ struct dentry *dentry; -+ struct inode *inode; -+ struct super_block *sb; -+ -+ err = 0; -+ dentry = file->f_path.dentry; -+ inode = d_inode(dentry); -+ inode_lock(inode); -+ sb = dentry->d_sb; -+ si_noflush_read_lock(sb); -+ if (file) -+ err = au_do_fsync_dir(file, datasync); -+ else { -+ di_write_lock_child(dentry); -+ err = au_do_fsync_dir_no_file(dentry, datasync); -+ } -+ au_cpup_attr_timesizes(inode); -+ di_write_unlock(dentry); -+ if (file) -+ fi_write_unlock(file); -+ -+ si_read_unlock(sb); -+ inode_unlock(inode); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int aufs_iterate_shared(struct file *file, struct dir_context *ctx) -+{ -+ int err; -+ struct dentry *dentry; -+ struct inode *inode, *h_inode; -+ struct super_block *sb; -+ -+ AuDbg("%pD, ctx{%pf, %llu}\n", file, ctx->actor, ctx->pos); -+ -+ dentry = file->f_path.dentry; -+ inode = d_inode(dentry); -+ IMustLock(inode); -+ -+ sb = dentry->d_sb; -+ si_read_lock(sb, AuLock_FLUSH); -+ err = au_reval_and_lock_fdi(file, reopen_dir, /*wlock*/1); -+ if (unlikely(err)) -+ goto out; -+ err = au_alive_dir(dentry); -+ if (!err) -+ err = au_vdir_init(file); -+ di_downgrade_lock(dentry, AuLock_IR); -+ if (unlikely(err)) -+ goto out_unlock; -+ -+ h_inode = au_h_iptr(inode, au_ibtop(inode)); -+ if (!au_test_nfsd()) { -+ err = au_vdir_fill_de(file, ctx); -+ fsstack_copy_attr_atime(inode, h_inode); -+ } else { -+ /* -+ * nfsd filldir may call lookup_one_len(), vfs_getattr(), -+ * encode_fh() and others. -+ */ -+ atomic_inc(&h_inode->i_count); -+ di_read_unlock(dentry, AuLock_IR); -+ si_read_unlock(sb); -+ err = au_vdir_fill_de(file, ctx); -+ fsstack_copy_attr_atime(inode, h_inode); -+ fi_write_unlock(file); -+ iput(h_inode); -+ -+ AuTraceErr(err); -+ return err; -+ } -+ -+out_unlock: -+ di_read_unlock(dentry, AuLock_IR); -+ fi_write_unlock(file); -+out: -+ si_read_unlock(sb); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+#define AuTestEmpty_WHONLY 1 -+#define AuTestEmpty_CALLED (1 << 1) -+#define AuTestEmpty_SHWH (1 << 2) -+#define au_ftest_testempty(flags, name) ((flags) & AuTestEmpty_##name) -+#define au_fset_testempty(flags, name) \ -+ do { (flags) |= AuTestEmpty_##name; } while (0) -+#define au_fclr_testempty(flags, name) \ -+ do { (flags) &= ~AuTestEmpty_##name; } while (0) -+ -+#ifndef CONFIG_AUFS_SHWH -+#undef AuTestEmpty_SHWH -+#define AuTestEmpty_SHWH 0 -+#endif -+ -+struct test_empty_arg { -+ struct dir_context ctx; -+ struct au_nhash *whlist; -+ unsigned int flags; -+ int err; -+ aufs_bindex_t bindex; -+}; -+ -+static int test_empty_cb(struct dir_context *ctx, const char *__name, -+ int namelen, loff_t offset __maybe_unused, u64 ino, -+ unsigned int d_type) -+{ -+ struct test_empty_arg *arg = container_of(ctx, struct test_empty_arg, -+ ctx); -+ char *name = (void *)__name; -+ -+ arg->err = 0; -+ au_fset_testempty(arg->flags, CALLED); -+ /* smp_mb(); */ -+ if (name[0] == '.' -+ && (namelen == 1 || (name[1] == '.' && namelen == 2))) -+ goto out; /* success */ -+ -+ if (namelen <= AUFS_WH_PFX_LEN -+ || memcmp(name, AUFS_WH_PFX, AUFS_WH_PFX_LEN)) { -+ if (au_ftest_testempty(arg->flags, WHONLY) -+ && !au_nhash_test_known_wh(arg->whlist, name, namelen)) -+ arg->err = -ENOTEMPTY; -+ goto out; -+ } -+ -+ name += AUFS_WH_PFX_LEN; -+ namelen -= AUFS_WH_PFX_LEN; -+ if (!au_nhash_test_known_wh(arg->whlist, name, namelen)) -+ arg->err = au_nhash_append_wh -+ (arg->whlist, name, namelen, ino, d_type, arg->bindex, -+ au_ftest_testempty(arg->flags, SHWH)); -+ -+out: -+ /* smp_mb(); */ -+ AuTraceErr(arg->err); -+ return arg->err; -+} -+ -+static int do_test_empty(struct dentry *dentry, struct test_empty_arg *arg) -+{ -+ int err; -+ struct file *h_file; -+ -+ h_file = au_h_open(dentry, arg->bindex, -+ O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_LARGEFILE, -+ /*file*/NULL, /*force_wr*/0); -+ err = PTR_ERR(h_file); -+ if (IS_ERR(h_file)) -+ goto out; -+ -+ err = 0; -+ if (!au_opt_test(au_mntflags(dentry->d_sb), UDBA_NONE) -+ && !file_inode(h_file)->i_nlink) -+ goto out_put; -+ -+ do { -+ arg->err = 0; -+ au_fclr_testempty(arg->flags, CALLED); -+ /* smp_mb(); */ -+ err = vfsub_iterate_dir(h_file, &arg->ctx); -+ if (err >= 0) -+ err = arg->err; -+ } while (!err && au_ftest_testempty(arg->flags, CALLED)); -+ -+out_put: -+ fput(h_file); -+ au_sbr_put(dentry->d_sb, arg->bindex); -+out: -+ return err; -+} -+ -+struct do_test_empty_args { -+ int *errp; -+ struct dentry *dentry; -+ struct test_empty_arg *arg; -+}; -+ -+static void call_do_test_empty(void *args) -+{ -+ struct do_test_empty_args *a = args; -+ *a->errp = do_test_empty(a->dentry, a->arg); -+} -+ -+static int sio_test_empty(struct dentry *dentry, struct test_empty_arg *arg) -+{ -+ int err, wkq_err; -+ struct dentry *h_dentry; -+ struct inode *h_inode; -+ -+ h_dentry = au_h_dptr(dentry, arg->bindex); -+ h_inode = d_inode(h_dentry); -+ /* todo: i_mode changes anytime? */ -+ inode_lock_nested(h_inode, AuLsc_I_CHILD); -+ err = au_test_h_perm_sio(h_inode, MAY_EXEC | MAY_READ); -+ inode_unlock(h_inode); -+ if (!err) -+ err = do_test_empty(dentry, arg); -+ else { -+ struct do_test_empty_args args = { -+ .errp = &err, -+ .dentry = dentry, -+ .arg = arg -+ }; -+ unsigned int flags = arg->flags; -+ -+ wkq_err = au_wkq_wait(call_do_test_empty, &args); -+ if (unlikely(wkq_err)) -+ err = wkq_err; -+ arg->flags = flags; -+ } -+ -+ return err; -+} -+ -+int au_test_empty_lower(struct dentry *dentry) -+{ -+ int err; -+ unsigned int rdhash; -+ aufs_bindex_t bindex, btop, btail; -+ struct au_nhash whlist; -+ struct test_empty_arg arg = { -+ .ctx = { -+ .actor = test_empty_cb -+ } -+ }; -+ int (*test_empty)(struct dentry *dentry, struct test_empty_arg *arg); -+ -+ SiMustAnyLock(dentry->d_sb); -+ -+ rdhash = au_sbi(dentry->d_sb)->si_rdhash; -+ if (!rdhash) -+ rdhash = au_rdhash_est(au_dir_size(/*file*/NULL, dentry)); -+ err = au_nhash_alloc(&whlist, rdhash, GFP_NOFS); -+ if (unlikely(err)) -+ goto out; -+ -+ arg.flags = 0; -+ arg.whlist = &whlist; -+ btop = au_dbtop(dentry); -+ if (au_opt_test(au_mntflags(dentry->d_sb), SHWH)) -+ au_fset_testempty(arg.flags, SHWH); -+ test_empty = do_test_empty; -+ if (au_opt_test(au_mntflags(dentry->d_sb), DIRPERM1)) -+ test_empty = sio_test_empty; -+ arg.bindex = btop; -+ err = test_empty(dentry, &arg); -+ if (unlikely(err)) -+ goto out_whlist; -+ -+ au_fset_testempty(arg.flags, WHONLY); -+ btail = au_dbtaildir(dentry); -+ for (bindex = btop + 1; !err && bindex <= btail; bindex++) { -+ struct dentry *h_dentry; -+ -+ h_dentry = au_h_dptr(dentry, bindex); -+ if (h_dentry && d_is_positive(h_dentry)) { -+ arg.bindex = bindex; -+ err = test_empty(dentry, &arg); -+ } -+ } -+ -+out_whlist: -+ au_nhash_wh_free(&whlist); -+out: -+ return err; -+} -+ -+int au_test_empty(struct dentry *dentry, struct au_nhash *whlist) -+{ -+ int err; -+ struct test_empty_arg arg = { -+ .ctx = { -+ .actor = test_empty_cb -+ } -+ }; -+ aufs_bindex_t bindex, btail; -+ -+ err = 0; -+ arg.whlist = whlist; -+ arg.flags = AuTestEmpty_WHONLY; -+ if (au_opt_test(au_mntflags(dentry->d_sb), SHWH)) -+ au_fset_testempty(arg.flags, SHWH); -+ btail = au_dbtaildir(dentry); -+ for (bindex = au_dbtop(dentry); !err && bindex <= btail; bindex++) { -+ struct dentry *h_dentry; -+ -+ h_dentry = au_h_dptr(dentry, bindex); -+ if (h_dentry && d_is_positive(h_dentry)) { -+ arg.bindex = bindex; -+ err = sio_test_empty(dentry, &arg); -+ } -+ } -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+const struct file_operations aufs_dir_fop = { -+ .owner = THIS_MODULE, -+ .llseek = default_llseek, -+ .read = generic_read_dir, -+ .iterate_shared = aufs_iterate_shared, -+ .unlocked_ioctl = aufs_ioctl_dir, -+#ifdef CONFIG_COMPAT -+ .compat_ioctl = aufs_compat_ioctl_dir, -+#endif -+ .open = aufs_open_dir, -+ .release = aufs_release_dir, -+ .flush = aufs_flush_dir, -+ .fsync = aufs_fsync_dir -+}; -diff --git a/fs/aufs/dir.h b/fs/aufs/dir.h -new file mode 100644 -index 0000000..4f3945a ---- /dev/null -+++ b/fs/aufs/dir.h -@@ -0,0 +1,124 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * directory operations -+ */ -+ -+#ifndef __AUFS_DIR_H__ -+#define __AUFS_DIR_H__ -+ -+#ifdef __KERNEL__ -+ -+#include -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* need to be faster and smaller */ -+ -+struct au_nhash { -+ unsigned int nh_num; -+ struct hlist_head *nh_head; -+}; -+ -+struct au_vdir_destr { -+ unsigned char len; -+ unsigned char name[0]; -+} __packed; -+ -+struct au_vdir_dehstr { -+ struct hlist_node hash; -+ union { -+ struct au_vdir_destr *str; -+ struct llist_node lnode; /* delayed free */ -+ }; -+} ____cacheline_aligned_in_smp; -+ -+struct au_vdir_de { -+ ino_t de_ino; -+ unsigned char de_type; -+ /* caution: packed */ -+ struct au_vdir_destr de_str; -+} __packed; -+ -+struct au_vdir_wh { -+ struct hlist_node wh_hash; -+#ifdef CONFIG_AUFS_SHWH -+ ino_t wh_ino; -+ aufs_bindex_t wh_bindex; -+ unsigned char wh_type; -+#else -+ aufs_bindex_t wh_bindex; -+#endif -+ /* caution: packed */ -+ struct au_vdir_destr wh_str; -+} __packed; -+ -+union au_vdir_deblk_p { -+ unsigned char *deblk; -+ struct au_vdir_de *de; -+}; -+ -+struct au_vdir { -+ unsigned char **vd_deblk; -+ unsigned long vd_nblk; -+ struct { -+ unsigned long ul; -+ union au_vdir_deblk_p p; -+ } vd_last; -+ -+ unsigned long vd_version; -+ unsigned int vd_deblk_sz; -+ union { -+ unsigned long vd_jiffy; -+ struct llist_node vd_lnode; /* delayed free */ -+ }; -+} ____cacheline_aligned_in_smp; -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* dir.c */ -+extern const struct file_operations aufs_dir_fop; -+void au_add_nlink(struct inode *dir, struct inode *h_dir); -+void au_sub_nlink(struct inode *dir, struct inode *h_dir); -+loff_t au_dir_size(struct file *file, struct dentry *dentry); -+void au_dir_ts(struct inode *dir, aufs_bindex_t bsrc); -+int au_test_empty_lower(struct dentry *dentry); -+int au_test_empty(struct dentry *dentry, struct au_nhash *whlist); -+ -+/* vdir.c */ -+unsigned int au_rdhash_est(loff_t sz); -+int au_nhash_alloc(struct au_nhash *nhash, unsigned int num_hash, gfp_t gfp); -+void au_nhash_wh_free(struct au_nhash *whlist); -+int au_nhash_test_longer_wh(struct au_nhash *whlist, aufs_bindex_t btgt, -+ int limit); -+int au_nhash_test_known_wh(struct au_nhash *whlist, char *name, int nlen); -+int au_nhash_append_wh(struct au_nhash *whlist, char *name, int nlen, ino_t ino, -+ unsigned int d_type, aufs_bindex_t bindex, -+ unsigned char shwh); -+void au_vdir_free(struct au_vdir *vdir, int atonce); -+int au_vdir_init(struct file *file); -+int au_vdir_fill_de(struct file *file, struct dir_context *ctx); -+ -+/* ioctl.c */ -+long aufs_ioctl_dir(struct file *file, unsigned int cmd, unsigned long arg); -+ -+#ifdef CONFIG_AUFS_RDU -+/* rdu.c */ -+long au_rdu_ioctl(struct file *file, unsigned int cmd, unsigned long arg); -+#ifdef CONFIG_COMPAT -+long au_rdu_compat_ioctl(struct file *file, unsigned int cmd, -+ unsigned long arg); -+#endif -+#else -+AuStub(long, au_rdu_ioctl, return -EINVAL, struct file *file, -+ unsigned int cmd, unsigned long arg) -+#ifdef CONFIG_COMPAT -+AuStub(long, au_rdu_compat_ioctl, return -EINVAL, struct file *file, -+ unsigned int cmd, unsigned long arg) -+#endif -+#endif -+ -+#endif /* __KERNEL__ */ -+#endif /* __AUFS_DIR_H__ */ -diff --git a/fs/aufs/dynop.c b/fs/aufs/dynop.c -new file mode 100644 -index 0000000..eb0e1a7 ---- /dev/null -+++ b/fs/aufs/dynop.c -@@ -0,0 +1,358 @@ -+/* -+ * Copyright (C) 2010-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * dynamically customizable operations for regular files -+ */ -+ -+#include "aufs.h" -+ -+#define DyPrSym(key) AuDbgSym(key->dk_op.dy_hop) -+ -+/* -+ * How large will these lists be? -+ * Usually just a few elements, 20-30 at most for each, I guess. -+ */ -+static struct au_sphlhead dynop[AuDyLast]; -+ -+static struct au_dykey *dy_gfind_get(struct au_sphlhead *sphl, const void *h_op) -+{ -+ struct au_dykey *key, *tmp; -+ struct hlist_head *head; -+ -+ key = NULL; -+ head = &sphl->head; -+ rcu_read_lock(); -+ hlist_for_each_entry_rcu(tmp, head, dk_hnode) -+ if (tmp->dk_op.dy_hop == h_op) { -+ key = tmp; -+ kref_get(&key->dk_kref); -+ break; -+ } -+ rcu_read_unlock(); -+ -+ return key; -+} -+ -+static struct au_dykey *dy_bradd(struct au_branch *br, struct au_dykey *key) -+{ -+ struct au_dykey **k, *found; -+ const void *h_op = key->dk_op.dy_hop; -+ int i; -+ -+ found = NULL; -+ k = br->br_dykey; -+ for (i = 0; i < AuBrDynOp; i++) -+ if (k[i]) { -+ if (k[i]->dk_op.dy_hop == h_op) { -+ found = k[i]; -+ break; -+ } -+ } else -+ break; -+ if (!found) { -+ spin_lock(&br->br_dykey_lock); -+ for (; i < AuBrDynOp; i++) -+ if (k[i]) { -+ if (k[i]->dk_op.dy_hop == h_op) { -+ found = k[i]; -+ break; -+ } -+ } else { -+ k[i] = key; -+ break; -+ } -+ spin_unlock(&br->br_dykey_lock); -+ BUG_ON(i == AuBrDynOp); /* expand the array */ -+ } -+ -+ return found; -+} -+ -+/* kref_get() if @key is already added */ -+static struct au_dykey *dy_gadd(struct au_sphlhead *sphl, struct au_dykey *key) -+{ -+ struct au_dykey *tmp, *found; -+ struct hlist_head *head; -+ const void *h_op = key->dk_op.dy_hop; -+ -+ found = NULL; -+ head = &sphl->head; -+ spin_lock(&sphl->spin); -+ hlist_for_each_entry(tmp, head, dk_hnode) -+ if (tmp->dk_op.dy_hop == h_op) { -+ kref_get(&tmp->dk_kref); -+ found = tmp; -+ break; -+ } -+ if (!found) -+ hlist_add_head_rcu(&key->dk_hnode, head); -+ spin_unlock(&sphl->spin); -+ -+ if (!found) -+ DyPrSym(key); -+ return found; -+} -+ -+static void dy_free_rcu(struct rcu_head *rcu) -+{ -+ struct au_dykey *key; -+ -+ key = container_of(rcu, struct au_dykey, dk_rcu); -+ DyPrSym(key); -+ kfree(key); /* not delayed */ -+} -+ -+static void dy_free(struct kref *kref) -+{ -+ struct au_dykey *key; -+ struct au_sphlhead *sphl; -+ -+ key = container_of(kref, struct au_dykey, dk_kref); -+ sphl = dynop + key->dk_op.dy_type; -+ au_sphl_del_rcu(&key->dk_hnode, sphl); -+ call_rcu(&key->dk_rcu, dy_free_rcu); -+} -+ -+void au_dy_put(struct au_dykey *key) -+{ -+ kref_put(&key->dk_kref, dy_free); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+#define DyDbgSize(cnt, op) AuDebugOn(cnt != sizeof(op)/sizeof(void *)) -+ -+#ifdef CONFIG_AUFS_DEBUG -+#define DyDbgDeclare(cnt) unsigned int cnt = 0 -+#define DyDbgInc(cnt) do { cnt++; } while (0) -+#else -+#define DyDbgDeclare(cnt) do {} while (0) -+#define DyDbgInc(cnt) do {} while (0) -+#endif -+ -+#define DySet(func, dst, src, h_op, h_sb) do { \ -+ DyDbgInc(cnt); \ -+ if (h_op->func) { \ -+ if (src.func) \ -+ dst.func = src.func; \ -+ else \ -+ AuDbg("%s %s\n", au_sbtype(h_sb), #func); \ -+ } \ -+} while (0) -+ -+#define DySetForce(func, dst, src) do { \ -+ AuDebugOn(!src.func); \ -+ DyDbgInc(cnt); \ -+ dst.func = src.func; \ -+} while (0) -+ -+#define DySetAop(func) \ -+ DySet(func, dyaop->da_op, aufs_aop, h_aop, h_sb) -+#define DySetAopForce(func) \ -+ DySetForce(func, dyaop->da_op, aufs_aop) -+ -+static void dy_aop(struct au_dykey *key, const void *h_op, -+ struct super_block *h_sb __maybe_unused) -+{ -+ struct au_dyaop *dyaop = (void *)key; -+ const struct address_space_operations *h_aop = h_op; -+ DyDbgDeclare(cnt); -+ -+ AuDbg("%s\n", au_sbtype(h_sb)); -+ -+ DySetAop(writepage); -+ DySetAopForce(readpage); /* force */ -+ DySetAop(writepages); -+ DySetAop(set_page_dirty); -+ DySetAop(readpages); -+ DySetAop(write_begin); -+ DySetAop(write_end); -+ DySetAop(bmap); -+ DySetAop(invalidatepage); -+ DySetAop(releasepage); -+ DySetAop(freepage); -+ /* this one will be changed according to an aufs mount option */ -+ DySetAop(direct_IO); -+ DySetAop(migratepage); -+ DySetAop(isolate_page); -+ DySetAop(putback_page); -+ DySetAop(launder_page); -+ DySetAop(is_partially_uptodate); -+ DySetAop(is_dirty_writeback); -+ DySetAop(error_remove_page); -+ DySetAop(swap_activate); -+ DySetAop(swap_deactivate); -+ -+ DyDbgSize(cnt, *h_aop); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static void dy_bug(struct kref *kref) -+{ -+ BUG(); -+} -+ -+static struct au_dykey *dy_get(struct au_dynop *op, struct au_branch *br) -+{ -+ struct au_dykey *key, *old; -+ struct au_sphlhead *sphl; -+ struct op { -+ unsigned int sz; -+ void (*set)(struct au_dykey *key, const void *h_op, -+ struct super_block *h_sb __maybe_unused); -+ }; -+ static const struct op a[] = { -+ [AuDy_AOP] = { -+ .sz = sizeof(struct au_dyaop), -+ .set = dy_aop -+ } -+ }; -+ const struct op *p; -+ -+ sphl = dynop + op->dy_type; -+ key = dy_gfind_get(sphl, op->dy_hop); -+ if (key) -+ goto out_add; /* success */ -+ -+ p = a + op->dy_type; -+ key = kzalloc(p->sz, GFP_NOFS); -+ if (unlikely(!key)) { -+ key = ERR_PTR(-ENOMEM); -+ goto out; -+ } -+ -+ key->dk_op.dy_hop = op->dy_hop; -+ kref_init(&key->dk_kref); -+ p->set(key, op->dy_hop, au_br_sb(br)); -+ old = dy_gadd(sphl, key); -+ if (old) { -+ au_delayed_kfree(key); -+ key = old; -+ } -+ -+out_add: -+ old = dy_bradd(br, key); -+ if (old) -+ /* its ref-count should never be zero here */ -+ kref_put(&key->dk_kref, dy_bug); -+out: -+ return key; -+} -+ -+/* ---------------------------------------------------------------------- */ -+/* -+ * Aufs prohibits O_DIRECT by defaut even if the branch supports it. -+ * This behaviour is necessary to return an error from open(O_DIRECT) instead -+ * of the succeeding I/O. The dio mount option enables O_DIRECT and makes -+ * open(O_DIRECT) always succeed, but the succeeding I/O may return an error. -+ * See the aufs manual in detail. -+ */ -+static void dy_adx(struct au_dyaop *dyaop, int do_dx) -+{ -+ if (!do_dx) -+ dyaop->da_op.direct_IO = NULL; -+ else -+ dyaop->da_op.direct_IO = aufs_aop.direct_IO; -+} -+ -+static struct au_dyaop *dy_aget(struct au_branch *br, -+ const struct address_space_operations *h_aop, -+ int do_dx) -+{ -+ struct au_dyaop *dyaop; -+ struct au_dynop op; -+ -+ op.dy_type = AuDy_AOP; -+ op.dy_haop = h_aop; -+ dyaop = (void *)dy_get(&op, br); -+ if (IS_ERR(dyaop)) -+ goto out; -+ dy_adx(dyaop, do_dx); -+ -+out: -+ return dyaop; -+} -+ -+int au_dy_iaop(struct inode *inode, aufs_bindex_t bindex, -+ struct inode *h_inode) -+{ -+ int err, do_dx; -+ struct super_block *sb; -+ struct au_branch *br; -+ struct au_dyaop *dyaop; -+ -+ AuDebugOn(!S_ISREG(h_inode->i_mode)); -+ IiMustWriteLock(inode); -+ -+ sb = inode->i_sb; -+ br = au_sbr(sb, bindex); -+ do_dx = !!au_opt_test(au_mntflags(sb), DIO); -+ dyaop = dy_aget(br, h_inode->i_mapping->a_ops, do_dx); -+ err = PTR_ERR(dyaop); -+ if (IS_ERR(dyaop)) -+ /* unnecessary to call dy_fput() */ -+ goto out; -+ -+ err = 0; -+ inode->i_mapping->a_ops = &dyaop->da_op; -+ -+out: -+ return err; -+} -+ -+/* -+ * Is it safe to replace a_ops during the inode/file is in operation? -+ * Yes, I hope so. -+ */ -+int au_dy_irefresh(struct inode *inode) -+{ -+ int err; -+ aufs_bindex_t btop; -+ struct inode *h_inode; -+ -+ err = 0; -+ if (S_ISREG(inode->i_mode)) { -+ btop = au_ibtop(inode); -+ h_inode = au_h_iptr(inode, btop); -+ err = au_dy_iaop(inode, btop, h_inode); -+ } -+ return err; -+} -+ -+void au_dy_arefresh(int do_dx) -+{ -+ struct au_sphlhead *sphl; -+ struct hlist_head *head; -+ struct au_dykey *key; -+ -+ sphl = dynop + AuDy_AOP; -+ head = &sphl->head; -+ spin_lock(&sphl->spin); -+ hlist_for_each_entry(key, head, dk_hnode) -+ dy_adx((void *)key, do_dx); -+ spin_unlock(&sphl->spin); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+void __init au_dy_init(void) -+{ -+ int i; -+ -+ /* make sure that 'struct au_dykey *' can be any type */ -+ BUILD_BUG_ON(offsetof(struct au_dyaop, da_key)); -+ -+ for (i = 0; i < AuDyLast; i++) -+ au_sphl_init(dynop + i); -+} -+ -+void au_dy_fin(void) -+{ -+ int i; -+ -+ for (i = 0; i < AuDyLast; i++) -+ WARN_ON(!hlist_empty(&dynop[i].head)); -+} -diff --git a/fs/aufs/dynop.h b/fs/aufs/dynop.h -new file mode 100644 -index 0000000..5db2da2 ---- /dev/null -+++ b/fs/aufs/dynop.h -@@ -0,0 +1,61 @@ -+/* -+ * Copyright (C) 2010-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * dynamically customizable operations (for regular files only) -+ */ -+ -+#ifndef __AUFS_DYNOP_H__ -+#define __AUFS_DYNOP_H__ -+ -+#ifdef __KERNEL__ -+ -+#include -+#include -+ -+enum {AuDy_AOP, AuDyLast}; -+ -+struct au_dynop { -+ int dy_type; -+ union { -+ const void *dy_hop; -+ const struct address_space_operations *dy_haop; -+ }; -+}; -+ -+struct au_dykey { -+ union { -+ struct hlist_node dk_hnode; -+ struct rcu_head dk_rcu; -+ }; -+ struct au_dynop dk_op; -+ -+ /* -+ * during I am in the branch local array, kref is gotten. when the -+ * branch is removed, kref is put. -+ */ -+ struct kref dk_kref; -+}; -+ -+/* stop unioning since their sizes are very different from each other */ -+struct au_dyaop { -+ struct au_dykey da_key; -+ struct address_space_operations da_op; /* not const */ -+}; -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* dynop.c */ -+struct au_branch; -+void au_dy_put(struct au_dykey *key); -+int au_dy_iaop(struct inode *inode, aufs_bindex_t bindex, -+ struct inode *h_inode); -+int au_dy_irefresh(struct inode *inode); -+void au_dy_arefresh(int do_dio); -+ -+void __init au_dy_init(void); -+void au_dy_fin(void); -+ -+#endif /* __KERNEL__ */ -+#endif /* __AUFS_DYNOP_H__ */ -diff --git a/fs/aufs/export.c b/fs/aufs/export.c -new file mode 100644 -index 0000000..6b5a7be ---- /dev/null -+++ b/fs/aufs/export.c -@@ -0,0 +1,824 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * export via nfs -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include "../fs/mount.h" -+#include "aufs.h" -+ -+union conv { -+#ifdef CONFIG_AUFS_INO_T_64 -+ __u32 a[2]; -+#else -+ __u32 a[1]; -+#endif -+ ino_t ino; -+}; -+ -+static ino_t decode_ino(__u32 *a) -+{ -+ union conv u; -+ -+ BUILD_BUG_ON(sizeof(u.ino) != sizeof(u.a)); -+ u.a[0] = a[0]; -+#ifdef CONFIG_AUFS_INO_T_64 -+ u.a[1] = a[1]; -+#endif -+ return u.ino; -+} -+ -+static void encode_ino(__u32 *a, ino_t ino) -+{ -+ union conv u; -+ -+ u.ino = ino; -+ a[0] = u.a[0]; -+#ifdef CONFIG_AUFS_INO_T_64 -+ a[1] = u.a[1]; -+#endif -+} -+ -+/* NFS file handle */ -+enum { -+ Fh_br_id, -+ Fh_sigen, -+#ifdef CONFIG_AUFS_INO_T_64 -+ /* support 64bit inode number */ -+ Fh_ino1, -+ Fh_ino2, -+ Fh_dir_ino1, -+ Fh_dir_ino2, -+#else -+ Fh_ino1, -+ Fh_dir_ino1, -+#endif -+ Fh_igen, -+ Fh_h_type, -+ Fh_tail, -+ -+ Fh_ino = Fh_ino1, -+ Fh_dir_ino = Fh_dir_ino1 -+}; -+ -+static int au_test_anon(struct dentry *dentry) -+{ -+ /* note: read d_flags without d_lock */ -+ return !!(dentry->d_flags & DCACHE_DISCONNECTED); -+} -+ -+int au_test_nfsd(void) -+{ -+ int ret; -+ struct task_struct *tsk = current; -+ char comm[sizeof(tsk->comm)]; -+ -+ ret = 0; -+ if (tsk->flags & PF_KTHREAD) { -+ get_task_comm(comm, tsk); -+ ret = !strcmp(comm, "nfsd"); -+ } -+ -+ return ret; -+} -+ -+/* ---------------------------------------------------------------------- */ -+/* inode generation external table */ -+ -+void au_xigen_inc(struct inode *inode) -+{ -+ loff_t pos; -+ ssize_t sz; -+ __u32 igen; -+ struct super_block *sb; -+ struct au_sbinfo *sbinfo; -+ -+ sb = inode->i_sb; -+ AuDebugOn(!au_opt_test(au_mntflags(sb), XINO)); -+ -+ sbinfo = au_sbi(sb); -+ pos = inode->i_ino; -+ pos *= sizeof(igen); -+ igen = inode->i_generation + 1; -+ sz = xino_fwrite(sbinfo->si_xwrite, sbinfo->si_xigen, &igen, -+ sizeof(igen), &pos); -+ if (sz == sizeof(igen)) -+ return; /* success */ -+ -+ if (unlikely(sz >= 0)) -+ AuIOErr("xigen error (%zd)\n", sz); -+} -+ -+int au_xigen_new(struct inode *inode) -+{ -+ int err; -+ loff_t pos; -+ ssize_t sz; -+ struct super_block *sb; -+ struct au_sbinfo *sbinfo; -+ struct file *file; -+ -+ err = 0; -+ /* todo: dirty, at mount time */ -+ if (inode->i_ino == AUFS_ROOT_INO) -+ goto out; -+ sb = inode->i_sb; -+ SiMustAnyLock(sb); -+ if (unlikely(!au_opt_test(au_mntflags(sb), XINO))) -+ goto out; -+ -+ err = -EFBIG; -+ pos = inode->i_ino; -+ if (unlikely(au_loff_max / sizeof(inode->i_generation) - 1 < pos)) { -+ AuIOErr1("too large i%lld\n", pos); -+ goto out; -+ } -+ pos *= sizeof(inode->i_generation); -+ -+ err = 0; -+ sbinfo = au_sbi(sb); -+ file = sbinfo->si_xigen; -+ BUG_ON(!file); -+ -+ if (vfsub_f_size_read(file) -+ < pos + sizeof(inode->i_generation)) { -+ inode->i_generation = atomic_inc_return(&sbinfo->si_xigen_next); -+ sz = xino_fwrite(sbinfo->si_xwrite, file, &inode->i_generation, -+ sizeof(inode->i_generation), &pos); -+ } else -+ sz = xino_fread(sbinfo->si_xread, file, &inode->i_generation, -+ sizeof(inode->i_generation), &pos); -+ if (sz == sizeof(inode->i_generation)) -+ goto out; /* success */ -+ -+ err = sz; -+ if (unlikely(sz >= 0)) { -+ err = -EIO; -+ AuIOErr("xigen error (%zd)\n", sz); -+ } -+ -+out: -+ return err; -+} -+ -+int au_xigen_set(struct super_block *sb, struct file *base) -+{ -+ int err; -+ struct au_sbinfo *sbinfo; -+ struct file *file; -+ -+ SiMustWriteLock(sb); -+ -+ sbinfo = au_sbi(sb); -+ file = au_xino_create2(base, sbinfo->si_xigen); -+ err = PTR_ERR(file); -+ if (IS_ERR(file)) -+ goto out; -+ err = 0; -+ if (sbinfo->si_xigen) -+ fput(sbinfo->si_xigen); -+ sbinfo->si_xigen = file; -+ -+out: -+ return err; -+} -+ -+void au_xigen_clr(struct super_block *sb) -+{ -+ struct au_sbinfo *sbinfo; -+ -+ SiMustWriteLock(sb); -+ -+ sbinfo = au_sbi(sb); -+ if (sbinfo->si_xigen) { -+ fput(sbinfo->si_xigen); -+ sbinfo->si_xigen = NULL; -+ } -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static struct dentry *decode_by_ino(struct super_block *sb, ino_t ino, -+ ino_t dir_ino) -+{ -+ struct dentry *dentry, *d; -+ struct inode *inode; -+ unsigned int sigen; -+ -+ dentry = NULL; -+ inode = ilookup(sb, ino); -+ if (!inode) -+ goto out; -+ -+ dentry = ERR_PTR(-ESTALE); -+ sigen = au_sigen(sb); -+ if (unlikely(au_is_bad_inode(inode) -+ || IS_DEADDIR(inode) -+ || sigen != au_iigen(inode, NULL))) -+ goto out_iput; -+ -+ dentry = NULL; -+ if (!dir_ino || S_ISDIR(inode->i_mode)) -+ dentry = d_find_alias(inode); -+ else { -+ spin_lock(&inode->i_lock); -+ hlist_for_each_entry(d, &inode->i_dentry, d_u.d_alias) { -+ spin_lock(&d->d_lock); -+ if (!au_test_anon(d) -+ && d_inode(d->d_parent)->i_ino == dir_ino) { -+ dentry = dget_dlock(d); -+ spin_unlock(&d->d_lock); -+ break; -+ } -+ spin_unlock(&d->d_lock); -+ } -+ spin_unlock(&inode->i_lock); -+ } -+ if (unlikely(dentry && au_digen_test(dentry, sigen))) { -+ /* need to refresh */ -+ dput(dentry); -+ dentry = NULL; -+ } -+ -+out_iput: -+ iput(inode); -+out: -+ AuTraceErrPtr(dentry); -+ return dentry; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* todo: dirty? */ -+/* if exportfs_decode_fh() passed vfsmount*, we could be happy */ -+ -+struct au_compare_mnt_args { -+ /* input */ -+ struct super_block *sb; -+ -+ /* output */ -+ struct vfsmount *mnt; -+}; -+ -+static int au_compare_mnt(struct vfsmount *mnt, void *arg) -+{ -+ struct au_compare_mnt_args *a = arg; -+ -+ if (mnt->mnt_sb != a->sb) -+ return 0; -+ a->mnt = mntget(mnt); -+ return 1; -+} -+ -+static struct vfsmount *au_mnt_get(struct super_block *sb) -+{ -+ int err; -+ struct path root; -+ struct au_compare_mnt_args args = { -+ .sb = sb -+ }; -+ -+ get_fs_root(current->fs, &root); -+ rcu_read_lock(); -+ err = iterate_mounts(au_compare_mnt, &args, root.mnt); -+ rcu_read_unlock(); -+ path_put(&root); -+ AuDebugOn(!err); -+ AuDebugOn(!args.mnt); -+ return args.mnt; -+} -+ -+struct au_nfsd_si_lock { -+ unsigned int sigen; -+ aufs_bindex_t bindex, br_id; -+ unsigned char force_lock; -+}; -+ -+static int si_nfsd_read_lock(struct super_block *sb, -+ struct au_nfsd_si_lock *nsi_lock) -+{ -+ int err; -+ aufs_bindex_t bindex; -+ -+ si_read_lock(sb, AuLock_FLUSH); -+ -+ /* branch id may be wrapped around */ -+ err = 0; -+ bindex = au_br_index(sb, nsi_lock->br_id); -+ if (bindex >= 0 && nsi_lock->sigen + AUFS_BRANCH_MAX > au_sigen(sb)) -+ goto out; /* success */ -+ -+ err = -ESTALE; -+ bindex = -1; -+ if (!nsi_lock->force_lock) -+ si_read_unlock(sb); -+ -+out: -+ nsi_lock->bindex = bindex; -+ return err; -+} -+ -+struct find_name_by_ino { -+ struct dir_context ctx; -+ int called, found; -+ ino_t ino; -+ char *name; -+ int namelen; -+}; -+ -+static int -+find_name_by_ino(struct dir_context *ctx, const char *name, int namelen, -+ loff_t offset, u64 ino, unsigned int d_type) -+{ -+ struct find_name_by_ino *a = container_of(ctx, struct find_name_by_ino, -+ ctx); -+ -+ a->called++; -+ if (a->ino != ino) -+ return 0; -+ -+ memcpy(a->name, name, namelen); -+ a->namelen = namelen; -+ a->found = 1; -+ return 1; -+} -+ -+static struct dentry *au_lkup_by_ino(struct path *path, ino_t ino, -+ struct au_nfsd_si_lock *nsi_lock) -+{ -+ struct dentry *dentry, *parent; -+ struct file *file; -+ struct inode *dir; -+ struct find_name_by_ino arg = { -+ .ctx = { -+ .actor = find_name_by_ino -+ } -+ }; -+ int err; -+ -+ parent = path->dentry; -+ if (nsi_lock) -+ si_read_unlock(parent->d_sb); -+ file = vfsub_dentry_open(path, au_dir_roflags); -+ dentry = (void *)file; -+ if (IS_ERR(file)) -+ goto out; -+ -+ dentry = ERR_PTR(-ENOMEM); -+ arg.name = (void *)__get_free_page(GFP_NOFS); -+ if (unlikely(!arg.name)) -+ goto out_file; -+ arg.ino = ino; -+ arg.found = 0; -+ do { -+ arg.called = 0; -+ /* smp_mb(); */ -+ err = vfsub_iterate_dir(file, &arg.ctx); -+ } while (!err && !arg.found && arg.called); -+ dentry = ERR_PTR(err); -+ if (unlikely(err)) -+ goto out_name; -+ /* instead of ENOENT */ -+ dentry = ERR_PTR(-ESTALE); -+ if (!arg.found) -+ goto out_name; -+ -+ /* do not call vfsub_lkup_one() */ -+ dir = d_inode(parent); -+ dentry = vfsub_lookup_one_len_unlocked(arg.name, parent, arg.namelen); -+ AuTraceErrPtr(dentry); -+ if (IS_ERR(dentry)) -+ goto out_name; -+ AuDebugOn(au_test_anon(dentry)); -+ if (unlikely(d_really_is_negative(dentry))) { -+ dput(dentry); -+ dentry = ERR_PTR(-ENOENT); -+ } -+ -+out_name: -+ au_delayed_free_page((unsigned long)arg.name); -+out_file: -+ fput(file); -+out: -+ if (unlikely(nsi_lock -+ && si_nfsd_read_lock(parent->d_sb, nsi_lock) < 0)) -+ if (!IS_ERR(dentry)) { -+ dput(dentry); -+ dentry = ERR_PTR(-ESTALE); -+ } -+ AuTraceErrPtr(dentry); -+ return dentry; -+} -+ -+static struct dentry *decode_by_dir_ino(struct super_block *sb, ino_t ino, -+ ino_t dir_ino, -+ struct au_nfsd_si_lock *nsi_lock) -+{ -+ struct dentry *dentry; -+ struct path path; -+ -+ if (dir_ino != AUFS_ROOT_INO) { -+ path.dentry = decode_by_ino(sb, dir_ino, 0); -+ dentry = path.dentry; -+ if (!path.dentry || IS_ERR(path.dentry)) -+ goto out; -+ AuDebugOn(au_test_anon(path.dentry)); -+ } else -+ path.dentry = dget(sb->s_root); -+ -+ path.mnt = au_mnt_get(sb); -+ dentry = au_lkup_by_ino(&path, ino, nsi_lock); -+ path_put(&path); -+ -+out: -+ AuTraceErrPtr(dentry); -+ return dentry; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int h_acceptable(void *expv, struct dentry *dentry) -+{ -+ return 1; -+} -+ -+static char *au_build_path(struct dentry *h_parent, struct path *h_rootpath, -+ char *buf, int len, struct super_block *sb) -+{ -+ char *p; -+ int n; -+ struct path path; -+ -+ p = d_path(h_rootpath, buf, len); -+ if (IS_ERR(p)) -+ goto out; -+ n = strlen(p); -+ -+ path.mnt = h_rootpath->mnt; -+ path.dentry = h_parent; -+ p = d_path(&path, buf, len); -+ if (IS_ERR(p)) -+ goto out; -+ if (n != 1) -+ p += n; -+ -+ path.mnt = au_mnt_get(sb); -+ path.dentry = sb->s_root; -+ p = d_path(&path, buf, len - strlen(p)); -+ mntput(path.mnt); -+ if (IS_ERR(p)) -+ goto out; -+ if (n != 1) -+ p[strlen(p)] = '/'; -+ -+out: -+ AuTraceErrPtr(p); -+ return p; -+} -+ -+static -+struct dentry *decode_by_path(struct super_block *sb, ino_t ino, __u32 *fh, -+ int fh_len, struct au_nfsd_si_lock *nsi_lock) -+{ -+ struct dentry *dentry, *h_parent, *root; -+ struct super_block *h_sb; -+ char *pathname, *p; -+ struct vfsmount *h_mnt; -+ struct au_branch *br; -+ int err; -+ struct path path; -+ -+ br = au_sbr(sb, nsi_lock->bindex); -+ h_mnt = au_br_mnt(br); -+ h_sb = h_mnt->mnt_sb; -+ /* todo: call lower fh_to_dentry()? fh_to_parent()? */ -+ lockdep_off(); -+ h_parent = exportfs_decode_fh(h_mnt, (void *)(fh + Fh_tail), -+ fh_len - Fh_tail, fh[Fh_h_type], -+ h_acceptable, /*context*/NULL); -+ lockdep_on(); -+ dentry = h_parent; -+ if (unlikely(!h_parent || IS_ERR(h_parent))) { -+ AuWarn1("%s decode_fh failed, %ld\n", -+ au_sbtype(h_sb), PTR_ERR(h_parent)); -+ goto out; -+ } -+ dentry = NULL; -+ if (unlikely(au_test_anon(h_parent))) { -+ AuWarn1("%s decode_fh returned a disconnected dentry\n", -+ au_sbtype(h_sb)); -+ goto out_h_parent; -+ } -+ -+ dentry = ERR_PTR(-ENOMEM); -+ pathname = (void *)__get_free_page(GFP_NOFS); -+ if (unlikely(!pathname)) -+ goto out_h_parent; -+ -+ root = sb->s_root; -+ path.mnt = h_mnt; -+ di_read_lock_parent(root, !AuLock_IR); -+ path.dentry = au_h_dptr(root, nsi_lock->bindex); -+ di_read_unlock(root, !AuLock_IR); -+ p = au_build_path(h_parent, &path, pathname, PAGE_SIZE, sb); -+ dentry = (void *)p; -+ if (IS_ERR(p)) -+ goto out_pathname; -+ -+ si_read_unlock(sb); -+ err = vfsub_kern_path(p, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path); -+ dentry = ERR_PTR(err); -+ if (unlikely(err)) -+ goto out_relock; -+ -+ dentry = ERR_PTR(-ENOENT); -+ AuDebugOn(au_test_anon(path.dentry)); -+ if (unlikely(d_really_is_negative(path.dentry))) -+ goto out_path; -+ -+ if (ino != d_inode(path.dentry)->i_ino) -+ dentry = au_lkup_by_ino(&path, ino, /*nsi_lock*/NULL); -+ else -+ dentry = dget(path.dentry); -+ -+out_path: -+ path_put(&path); -+out_relock: -+ if (unlikely(si_nfsd_read_lock(sb, nsi_lock) < 0)) -+ if (!IS_ERR(dentry)) { -+ dput(dentry); -+ dentry = ERR_PTR(-ESTALE); -+ } -+out_pathname: -+ au_delayed_free_page((unsigned long)pathname); -+out_h_parent: -+ dput(h_parent); -+out: -+ AuTraceErrPtr(dentry); -+ return dentry; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static struct dentry * -+aufs_fh_to_dentry(struct super_block *sb, struct fid *fid, int fh_len, -+ int fh_type) -+{ -+ struct dentry *dentry; -+ __u32 *fh = fid->raw; -+ struct au_branch *br; -+ ino_t ino, dir_ino; -+ struct au_nfsd_si_lock nsi_lock = { -+ .force_lock = 0 -+ }; -+ -+ dentry = ERR_PTR(-ESTALE); -+ /* it should never happen, but the file handle is unreliable */ -+ if (unlikely(fh_len < Fh_tail)) -+ goto out; -+ nsi_lock.sigen = fh[Fh_sigen]; -+ nsi_lock.br_id = fh[Fh_br_id]; -+ -+ /* branch id may be wrapped around */ -+ br = NULL; -+ if (unlikely(si_nfsd_read_lock(sb, &nsi_lock))) -+ goto out; -+ nsi_lock.force_lock = 1; -+ -+ /* is this inode still cached? */ -+ ino = decode_ino(fh + Fh_ino); -+ /* it should never happen */ -+ if (unlikely(ino == AUFS_ROOT_INO)) -+ goto out_unlock; -+ -+ dir_ino = decode_ino(fh + Fh_dir_ino); -+ dentry = decode_by_ino(sb, ino, dir_ino); -+ if (IS_ERR(dentry)) -+ goto out_unlock; -+ if (dentry) -+ goto accept; -+ -+ /* is the parent dir cached? */ -+ br = au_sbr(sb, nsi_lock.bindex); -+ au_br_get(br); -+ dentry = decode_by_dir_ino(sb, ino, dir_ino, &nsi_lock); -+ if (IS_ERR(dentry)) -+ goto out_unlock; -+ if (dentry) -+ goto accept; -+ -+ /* lookup path */ -+ dentry = decode_by_path(sb, ino, fh, fh_len, &nsi_lock); -+ if (IS_ERR(dentry)) -+ goto out_unlock; -+ if (unlikely(!dentry)) -+ /* todo?: make it ESTALE */ -+ goto out_unlock; -+ -+accept: -+ if (!au_digen_test(dentry, au_sigen(sb)) -+ && d_inode(dentry)->i_generation == fh[Fh_igen]) -+ goto out_unlock; /* success */ -+ -+ dput(dentry); -+ dentry = ERR_PTR(-ESTALE); -+out_unlock: -+ if (br) -+ au_br_put(br); -+ si_read_unlock(sb); -+out: -+ AuTraceErrPtr(dentry); -+ return dentry; -+} -+ -+#if 0 /* reserved for future use */ -+/* support subtreecheck option */ -+static struct dentry *aufs_fh_to_parent(struct super_block *sb, struct fid *fid, -+ int fh_len, int fh_type) -+{ -+ struct dentry *parent; -+ __u32 *fh = fid->raw; -+ ino_t dir_ino; -+ -+ dir_ino = decode_ino(fh + Fh_dir_ino); -+ parent = decode_by_ino(sb, dir_ino, 0); -+ if (IS_ERR(parent)) -+ goto out; -+ if (!parent) -+ parent = decode_by_path(sb, au_br_index(sb, fh[Fh_br_id]), -+ dir_ino, fh, fh_len); -+ -+out: -+ AuTraceErrPtr(parent); -+ return parent; -+} -+#endif -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int aufs_encode_fh(struct inode *inode, __u32 *fh, int *max_len, -+ struct inode *dir) -+{ -+ int err; -+ aufs_bindex_t bindex; -+ struct super_block *sb, *h_sb; -+ struct dentry *dentry, *parent, *h_parent; -+ struct inode *h_dir; -+ struct au_branch *br; -+ -+ err = -ENOSPC; -+ if (unlikely(*max_len <= Fh_tail)) { -+ AuWarn1("NFSv2 client (max_len %d)?\n", *max_len); -+ goto out; -+ } -+ -+ err = FILEID_ROOT; -+ if (inode->i_ino == AUFS_ROOT_INO) { -+ AuDebugOn(inode->i_ino != AUFS_ROOT_INO); -+ goto out; -+ } -+ -+ h_parent = NULL; -+ sb = inode->i_sb; -+ err = si_read_lock(sb, AuLock_FLUSH); -+ if (unlikely(err)) -+ goto out; -+ -+#ifdef CONFIG_AUFS_DEBUG -+ if (unlikely(!au_opt_test(au_mntflags(sb), XINO))) -+ AuWarn1("NFS-exporting requires xino\n"); -+#endif -+ err = -EIO; -+ parent = NULL; -+ ii_read_lock_child(inode); -+ bindex = au_ibtop(inode); -+ if (!dir) { -+ dentry = d_find_any_alias(inode); -+ if (unlikely(!dentry)) -+ goto out_unlock; -+ AuDebugOn(au_test_anon(dentry)); -+ parent = dget_parent(dentry); -+ dput(dentry); -+ if (unlikely(!parent)) -+ goto out_unlock; -+ if (d_really_is_positive(parent)) -+ dir = d_inode(parent); -+ } -+ -+ ii_read_lock_parent(dir); -+ h_dir = au_h_iptr(dir, bindex); -+ ii_read_unlock(dir); -+ if (unlikely(!h_dir)) -+ goto out_parent; -+ h_parent = d_find_any_alias(h_dir); -+ if (unlikely(!h_parent)) -+ goto out_hparent; -+ -+ err = -EPERM; -+ br = au_sbr(sb, bindex); -+ h_sb = au_br_sb(br); -+ if (unlikely(!h_sb->s_export_op)) { -+ AuErr1("%s branch is not exportable\n", au_sbtype(h_sb)); -+ goto out_hparent; -+ } -+ -+ fh[Fh_br_id] = br->br_id; -+ fh[Fh_sigen] = au_sigen(sb); -+ encode_ino(fh + Fh_ino, inode->i_ino); -+ encode_ino(fh + Fh_dir_ino, dir->i_ino); -+ fh[Fh_igen] = inode->i_generation; -+ -+ *max_len -= Fh_tail; -+ fh[Fh_h_type] = exportfs_encode_fh(h_parent, (void *)(fh + Fh_tail), -+ max_len, -+ /*connectable or subtreecheck*/0); -+ err = fh[Fh_h_type]; -+ *max_len += Fh_tail; -+ /* todo: macros? */ -+ if (err != FILEID_INVALID) -+ err = 99; -+ else -+ AuWarn1("%s encode_fh failed\n", au_sbtype(h_sb)); -+ -+out_hparent: -+ dput(h_parent); -+out_parent: -+ dput(parent); -+out_unlock: -+ ii_read_unlock(inode); -+ si_read_unlock(sb); -+out: -+ if (unlikely(err < 0)) -+ err = FILEID_INVALID; -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int aufs_commit_metadata(struct inode *inode) -+{ -+ int err; -+ aufs_bindex_t bindex; -+ struct super_block *sb; -+ struct inode *h_inode; -+ int (*f)(struct inode *inode); -+ -+ sb = inode->i_sb; -+ si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLMW); -+ ii_write_lock_child(inode); -+ bindex = au_ibtop(inode); -+ AuDebugOn(bindex < 0); -+ h_inode = au_h_iptr(inode, bindex); -+ -+ f = h_inode->i_sb->s_export_op->commit_metadata; -+ if (f) -+ err = f(h_inode); -+ else { -+ struct writeback_control wbc = { -+ .sync_mode = WB_SYNC_ALL, -+ .nr_to_write = 0 /* metadata only */ -+ }; -+ -+ err = sync_inode(h_inode, &wbc); -+ } -+ -+ au_cpup_attr_timesizes(inode); -+ ii_write_unlock(inode); -+ si_read_unlock(sb); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static struct export_operations aufs_export_op = { -+ .fh_to_dentry = aufs_fh_to_dentry, -+ /* .fh_to_parent = aufs_fh_to_parent, */ -+ .encode_fh = aufs_encode_fh, -+ .commit_metadata = aufs_commit_metadata -+}; -+ -+void au_export_init(struct super_block *sb) -+{ -+ struct au_sbinfo *sbinfo; -+ __u32 u; -+ -+ BUILD_BUG_ON_MSG(IS_BUILTIN(CONFIG_AUFS_FS) -+ && IS_MODULE(CONFIG_EXPORTFS), -+ AUFS_NAME ": unsupported configuration " -+ "CONFIG_EXPORTFS=m and CONFIG_AUFS_FS=y"); -+ -+ sb->s_export_op = &aufs_export_op; -+ sbinfo = au_sbi(sb); -+ sbinfo->si_xigen = NULL; -+ get_random_bytes(&u, sizeof(u)); -+ BUILD_BUG_ON(sizeof(u) != sizeof(int)); -+ atomic_set(&sbinfo->si_xigen_next, u); -+} -diff --git a/fs/aufs/f_op.c b/fs/aufs/f_op.c -new file mode 100644 -index 0000000..00475fb ---- /dev/null -+++ b/fs/aufs/f_op.c -@@ -0,0 +1,759 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * file and vm operations -+ */ -+ -+#include -+#include -+#include -+#include -+#include "aufs.h" -+ -+int au_do_open_nondir(struct file *file, int flags, struct file *h_file) -+{ -+ int err; -+ aufs_bindex_t bindex; -+ struct dentry *dentry, *h_dentry; -+ struct au_finfo *finfo; -+ struct inode *h_inode; -+ -+ FiMustWriteLock(file); -+ -+ err = 0; -+ dentry = file->f_path.dentry; -+ AuDebugOn(IS_ERR_OR_NULL(dentry)); -+ finfo = au_fi(file); -+ memset(&finfo->fi_htop, 0, sizeof(finfo->fi_htop)); -+ atomic_set(&finfo->fi_mmapped, 0); -+ bindex = au_dbtop(dentry); -+ if (!h_file) { -+ h_dentry = au_h_dptr(dentry, bindex); -+ err = vfsub_test_mntns(file->f_path.mnt, h_dentry->d_sb); -+ if (unlikely(err)) -+ goto out; -+ h_file = au_h_open(dentry, bindex, flags, file, /*force_wr*/0); -+ } else { -+ h_dentry = h_file->f_path.dentry; -+ err = vfsub_test_mntns(file->f_path.mnt, h_dentry->d_sb); -+ if (unlikely(err)) -+ goto out; -+ get_file(h_file); -+ } -+ if (IS_ERR(h_file)) -+ err = PTR_ERR(h_file); -+ else { -+ if ((flags & __O_TMPFILE) -+ && !(flags & O_EXCL)) { -+ h_inode = file_inode(h_file); -+ spin_lock(&h_inode->i_lock); -+ h_inode->i_state |= I_LINKABLE; -+ spin_unlock(&h_inode->i_lock); -+ } -+ au_set_fbtop(file, bindex); -+ au_set_h_fptr(file, bindex, h_file); -+ au_update_figen(file); -+ /* todo: necessary? */ -+ /* file->f_ra = h_file->f_ra; */ -+ } -+ -+out: -+ return err; -+} -+ -+static int aufs_open_nondir(struct inode *inode __maybe_unused, -+ struct file *file) -+{ -+ int err; -+ struct super_block *sb; -+ struct au_do_open_args args = { -+ .open = au_do_open_nondir -+ }; -+ -+ AuDbg("%pD, f_flags 0x%x, f_mode 0x%x\n", -+ file, vfsub_file_flags(file), file->f_mode); -+ -+ sb = file->f_path.dentry->d_sb; -+ si_read_lock(sb, AuLock_FLUSH); -+ err = au_do_open(file, &args); -+ si_read_unlock(sb); -+ return err; -+} -+ -+int aufs_release_nondir(struct inode *inode __maybe_unused, struct file *file) -+{ -+ struct au_finfo *finfo; -+ aufs_bindex_t bindex; -+ int delayed; -+ -+ finfo = au_fi(file); -+ au_sphl_del(&finfo->fi_hlist, -+ &au_sbi(file->f_path.dentry->d_sb)->si_files); -+ bindex = finfo->fi_btop; -+ if (bindex >= 0) -+ au_set_h_fptr(file, bindex, NULL); -+ -+ delayed = (current->flags & PF_KTHREAD) || in_interrupt(); -+ au_finfo_fin(file, delayed); -+ return 0; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int au_do_flush_nondir(struct file *file, fl_owner_t id) -+{ -+ int err; -+ struct file *h_file; -+ -+ err = 0; -+ h_file = au_hf_top(file); -+ if (h_file) -+ err = vfsub_flush(h_file, id); -+ return err; -+} -+ -+static int aufs_flush_nondir(struct file *file, fl_owner_t id) -+{ -+ return au_do_flush(file, id, au_do_flush_nondir); -+} -+ -+/* ---------------------------------------------------------------------- */ -+/* -+ * read and write functions acquire [fdi]_rwsem once, but release before -+ * mmap_sem. This is because to stop a race condition between mmap(2). -+ * Releasing these aufs-rwsem should be safe, no branch-mamagement (by keeping -+ * si_rwsem), no harmful copy-up should happen. Actually copy-up may happen in -+ * read functions after [fdi]_rwsem are released, but it should be harmless. -+ */ -+ -+/* Callers should call au_read_post() or fput() in the end */ -+struct file *au_read_pre(struct file *file, int keep_fi) -+{ -+ struct file *h_file; -+ int err; -+ -+ err = au_reval_and_lock_fdi(file, au_reopen_nondir, /*wlock*/0); -+ if (!err) { -+ di_read_unlock(file->f_path.dentry, AuLock_IR); -+ h_file = au_hf_top(file); -+ get_file(h_file); -+ if (!keep_fi) -+ fi_read_unlock(file); -+ } else -+ h_file = ERR_PTR(err); -+ -+ return h_file; -+} -+ -+static void au_read_post(struct inode *inode, struct file *h_file) -+{ -+ /* update without lock, I don't think it a problem */ -+ fsstack_copy_attr_atime(inode, file_inode(h_file)); -+ fput(h_file); -+} -+ -+struct au_write_pre { -+ blkcnt_t blks; -+ aufs_bindex_t btop; -+}; -+ -+/* -+ * return with iinfo is write-locked -+ * callers should call au_write_post() or iinfo_write_unlock() + fput() in the -+ * end -+ */ -+static struct file *au_write_pre(struct file *file, int do_ready, -+ struct au_write_pre *wpre) -+{ -+ struct file *h_file; -+ struct dentry *dentry; -+ int err; -+ struct au_pin pin; -+ -+ err = au_reval_and_lock_fdi(file, au_reopen_nondir, /*wlock*/1); -+ h_file = ERR_PTR(err); -+ if (unlikely(err)) -+ goto out; -+ -+ dentry = file->f_path.dentry; -+ if (do_ready) { -+ err = au_ready_to_write(file, -1, &pin); -+ if (unlikely(err)) { -+ h_file = ERR_PTR(err); -+ di_write_unlock(dentry); -+ goto out_fi; -+ } -+ } -+ -+ di_downgrade_lock(dentry, /*flags*/0); -+ if (wpre) -+ wpre->btop = au_fbtop(file); -+ h_file = au_hf_top(file); -+ get_file(h_file); -+ if (wpre) -+ wpre->blks = file_inode(h_file)->i_blocks; -+ if (do_ready) -+ au_unpin(&pin); -+ di_read_unlock(dentry, /*flags*/0); -+ -+out_fi: -+ fi_write_unlock(file); -+out: -+ return h_file; -+} -+ -+static void au_write_post(struct inode *inode, struct file *h_file, -+ struct au_write_pre *wpre, ssize_t written) -+{ -+ struct inode *h_inode; -+ -+ au_cpup_attr_timesizes(inode); -+ AuDebugOn(au_ibtop(inode) != wpre->btop); -+ h_inode = file_inode(h_file); -+ inode->i_mode = h_inode->i_mode; -+ ii_write_unlock(inode); -+ fput(h_file); -+ -+ /* AuDbg("blks %llu, %llu\n", (u64)blks, (u64)h_inode->i_blocks); */ -+ if (written > 0) -+ au_fhsm_wrote(inode->i_sb, wpre->btop, -+ /*force*/h_inode->i_blocks > wpre->blks); -+} -+ -+static ssize_t aufs_read(struct file *file, char __user *buf, size_t count, -+ loff_t *ppos) -+{ -+ ssize_t err; -+ struct inode *inode; -+ struct file *h_file; -+ struct super_block *sb; -+ -+ inode = file_inode(file); -+ sb = inode->i_sb; -+ si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLMW); -+ -+ h_file = au_read_pre(file, /*keep_fi*/0); -+ err = PTR_ERR(h_file); -+ if (IS_ERR(h_file)) -+ goto out; -+ -+ /* filedata may be obsoleted by concurrent copyup, but no problem */ -+ err = vfsub_read_u(h_file, buf, count, ppos); -+ /* todo: necessary? */ -+ /* file->f_ra = h_file->f_ra; */ -+ au_read_post(inode, h_file); -+ -+out: -+ si_read_unlock(sb); -+ return err; -+} -+ -+/* -+ * todo: very ugly -+ * it locks both of i_mutex and si_rwsem for read in safe. -+ * if the plink maintenance mode continues forever (that is the problem), -+ * may loop forever. -+ */ -+static void au_mtx_and_read_lock(struct inode *inode) -+{ -+ int err; -+ struct super_block *sb = inode->i_sb; -+ -+ while (1) { -+ inode_lock(inode); -+ err = si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLM); -+ if (!err) -+ break; -+ inode_unlock(inode); -+ si_read_lock(sb, AuLock_NOPLMW); -+ si_read_unlock(sb); -+ } -+} -+ -+static ssize_t aufs_write(struct file *file, const char __user *ubuf, -+ size_t count, loff_t *ppos) -+{ -+ ssize_t err; -+ struct au_write_pre wpre; -+ struct inode *inode; -+ struct file *h_file; -+ char __user *buf = (char __user *)ubuf; -+ -+ inode = file_inode(file); -+ au_mtx_and_read_lock(inode); -+ -+ h_file = au_write_pre(file, /*do_ready*/1, &wpre); -+ err = PTR_ERR(h_file); -+ if (IS_ERR(h_file)) -+ goto out; -+ -+ err = vfsub_write_u(h_file, buf, count, ppos); -+ au_write_post(inode, h_file, &wpre, err); -+ -+out: -+ si_read_unlock(inode->i_sb); -+ inode_unlock(inode); -+ return err; -+} -+ -+static ssize_t au_do_iter(struct file *h_file, int rw, struct kiocb *kio, -+ struct iov_iter *iov_iter) -+{ -+ ssize_t err; -+ struct file *file; -+ ssize_t (*iter)(struct kiocb *, struct iov_iter *); -+ -+ err = security_file_permission(h_file, rw); -+ if (unlikely(err)) -+ goto out; -+ -+ err = -ENOSYS; -+ iter = NULL; -+ if (rw == MAY_READ) -+ iter = h_file->f_op->read_iter; -+ else if (rw == MAY_WRITE) -+ iter = h_file->f_op->write_iter; -+ -+ file = kio->ki_filp; -+ kio->ki_filp = h_file; -+ if (iter) { -+ lockdep_off(); -+ err = iter(kio, iov_iter); -+ lockdep_on(); -+ } else -+ /* currently there is no such fs */ -+ WARN_ON_ONCE(1); -+ kio->ki_filp = file; -+ -+out: -+ return err; -+} -+ -+static ssize_t aufs_read_iter(struct kiocb *kio, struct iov_iter *iov_iter) -+{ -+ ssize_t err; -+ struct file *file, *h_file; -+ struct inode *inode; -+ struct super_block *sb; -+ -+ file = kio->ki_filp; -+ inode = file_inode(file); -+ sb = inode->i_sb; -+ si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLMW); -+ -+ h_file = au_read_pre(file, /*keep_fi*/1); -+ err = PTR_ERR(h_file); -+ if (IS_ERR(h_file)) -+ goto out; -+ -+ if (au_test_loopback_kthread()) { -+ au_warn_loopback(h_file->f_path.dentry->d_sb); -+ if (file->f_mapping != h_file->f_mapping) { -+ file->f_mapping = h_file->f_mapping; -+ smp_mb(); /* unnecessary? */ -+ } -+ } -+ fi_read_unlock(file); -+ -+ err = au_do_iter(h_file, MAY_READ, kio, iov_iter); -+ /* todo: necessary? */ -+ /* file->f_ra = h_file->f_ra; */ -+ au_read_post(inode, h_file); -+ -+out: -+ si_read_unlock(sb); -+ return err; -+} -+ -+static ssize_t aufs_write_iter(struct kiocb *kio, struct iov_iter *iov_iter) -+{ -+ ssize_t err; -+ struct au_write_pre wpre; -+ struct inode *inode; -+ struct file *file, *h_file; -+ -+ file = kio->ki_filp; -+ inode = file_inode(file); -+ au_mtx_and_read_lock(inode); -+ -+ h_file = au_write_pre(file, /*do_ready*/1, &wpre); -+ err = PTR_ERR(h_file); -+ if (IS_ERR(h_file)) -+ goto out; -+ -+ err = au_do_iter(h_file, MAY_WRITE, kio, iov_iter); -+ au_write_post(inode, h_file, &wpre, err); -+ -+out: -+ si_read_unlock(inode->i_sb); -+ inode_unlock(inode); -+ return err; -+} -+ -+static ssize_t aufs_splice_read(struct file *file, loff_t *ppos, -+ struct pipe_inode_info *pipe, size_t len, -+ unsigned int flags) -+{ -+ ssize_t err; -+ struct file *h_file; -+ struct inode *inode; -+ struct super_block *sb; -+ -+ inode = file_inode(file); -+ sb = inode->i_sb; -+ si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLMW); -+ -+ h_file = au_read_pre(file, /*keep_fi*/0); -+ err = PTR_ERR(h_file); -+ if (IS_ERR(h_file)) -+ goto out; -+ -+ err = vfsub_splice_to(h_file, ppos, pipe, len, flags); -+ /* todo: necessasry? */ -+ /* file->f_ra = h_file->f_ra; */ -+ au_read_post(inode, h_file); -+ -+out: -+ si_read_unlock(sb); -+ return err; -+} -+ -+static ssize_t -+aufs_splice_write(struct pipe_inode_info *pipe, struct file *file, loff_t *ppos, -+ size_t len, unsigned int flags) -+{ -+ ssize_t err; -+ struct au_write_pre wpre; -+ struct inode *inode; -+ struct file *h_file; -+ -+ inode = file_inode(file); -+ au_mtx_and_read_lock(inode); -+ -+ h_file = au_write_pre(file, /*do_ready*/1, &wpre); -+ err = PTR_ERR(h_file); -+ if (IS_ERR(h_file)) -+ goto out; -+ -+ err = vfsub_splice_from(pipe, h_file, ppos, len, flags); -+ au_write_post(inode, h_file, &wpre, err); -+ -+out: -+ si_read_unlock(inode->i_sb); -+ inode_unlock(inode); -+ return err; -+} -+ -+static long aufs_fallocate(struct file *file, int mode, loff_t offset, -+ loff_t len) -+{ -+ long err; -+ struct au_write_pre wpre; -+ struct inode *inode; -+ struct file *h_file; -+ -+ inode = file_inode(file); -+ au_mtx_and_read_lock(inode); -+ -+ h_file = au_write_pre(file, /*do_ready*/1, &wpre); -+ err = PTR_ERR(h_file); -+ if (IS_ERR(h_file)) -+ goto out; -+ -+ lockdep_off(); -+ err = vfs_fallocate(h_file, mode, offset, len); -+ lockdep_on(); -+ au_write_post(inode, h_file, &wpre, /*written*/1); -+ -+out: -+ si_read_unlock(inode->i_sb); -+ inode_unlock(inode); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * The locking order around current->mmap_sem. -+ * - in most and regular cases -+ * file I/O syscall -- aufs_read() or something -+ * -- si_rwsem for read -- mmap_sem -+ * (Note that [fdi]i_rwsem are released before mmap_sem). -+ * - in mmap case -+ * mmap(2) -- mmap_sem -- aufs_mmap() -- si_rwsem for read -- [fdi]i_rwsem -+ * This AB-BA order is definitly bad, but is not a problem since "si_rwsem for -+ * read" allows muliple processes to acquire it and [fdi]i_rwsem are not held in -+ * file I/O. Aufs needs to stop lockdep in aufs_mmap() though. -+ * It means that when aufs acquires si_rwsem for write, the process should never -+ * acquire mmap_sem. -+ * -+ * Actually aufs_iterate() holds [fdi]i_rwsem before mmap_sem, but this is not a -+ * problem either since any directory is not able to be mmap-ed. -+ * The similar scenario is applied to aufs_readlink() too. -+ */ -+ -+#if 0 /* stop calling security_file_mmap() */ -+/* cf. linux/include/linux/mman.h: calc_vm_prot_bits() */ -+#define AuConv_VM_PROT(f, b) _calc_vm_trans(f, VM_##b, PROT_##b) -+ -+static unsigned long au_arch_prot_conv(unsigned long flags) -+{ -+ /* currently ppc64 only */ -+#ifdef CONFIG_PPC64 -+ /* cf. linux/arch/powerpc/include/asm/mman.h */ -+ AuDebugOn(arch_calc_vm_prot_bits(-1) != VM_SAO); -+ return AuConv_VM_PROT(flags, SAO); -+#else -+ AuDebugOn(arch_calc_vm_prot_bits(-1)); -+ return 0; -+#endif -+} -+ -+static unsigned long au_prot_conv(unsigned long flags) -+{ -+ return AuConv_VM_PROT(flags, READ) -+ | AuConv_VM_PROT(flags, WRITE) -+ | AuConv_VM_PROT(flags, EXEC) -+ | au_arch_prot_conv(flags); -+} -+ -+/* cf. linux/include/linux/mman.h: calc_vm_flag_bits() */ -+#define AuConv_VM_MAP(f, b) _calc_vm_trans(f, VM_##b, MAP_##b) -+ -+static unsigned long au_flag_conv(unsigned long flags) -+{ -+ return AuConv_VM_MAP(flags, GROWSDOWN) -+ | AuConv_VM_MAP(flags, DENYWRITE) -+ | AuConv_VM_MAP(flags, LOCKED); -+} -+#endif -+ -+static int aufs_mmap(struct file *file, struct vm_area_struct *vma) -+{ -+ int err; -+ const unsigned char wlock -+ = (file->f_mode & FMODE_WRITE) && (vma->vm_flags & VM_SHARED); -+ struct super_block *sb; -+ struct file *h_file; -+ struct inode *inode; -+ -+ AuDbgVmRegion(file, vma); -+ -+ inode = file_inode(file); -+ sb = inode->i_sb; -+ lockdep_off(); -+ si_read_lock(sb, AuLock_NOPLMW); -+ -+ h_file = au_write_pre(file, wlock, /*wpre*/NULL); -+ lockdep_on(); -+ err = PTR_ERR(h_file); -+ if (IS_ERR(h_file)) -+ goto out; -+ -+ err = 0; -+ au_set_mmapped(file); -+ au_vm_file_reset(vma, h_file); -+ /* -+ * we cannot call security_mmap_file() here since it may acquire -+ * mmap_sem or i_mutex. -+ * -+ * err = security_mmap_file(h_file, au_prot_conv(vma->vm_flags), -+ * au_flag_conv(vma->vm_flags)); -+ */ -+ if (!err) -+ err = h_file->f_op->mmap(h_file, vma); -+ if (!err) { -+ au_vm_prfile_set(vma, file); -+ fsstack_copy_attr_atime(inode, file_inode(h_file)); -+ goto out_fput; /* success */ -+ } -+ au_unset_mmapped(file); -+ au_vm_file_reset(vma, file); -+ -+out_fput: -+ lockdep_off(); -+ ii_write_unlock(inode); -+ lockdep_on(); -+ fput(h_file); -+out: -+ lockdep_off(); -+ si_read_unlock(sb); -+ lockdep_on(); -+ AuTraceErr(err); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int aufs_fsync_nondir(struct file *file, loff_t start, loff_t end, -+ int datasync) -+{ -+ int err; -+ struct au_write_pre wpre; -+ struct inode *inode; -+ struct file *h_file; -+ -+ err = 0; /* -EBADF; */ /* posix? */ -+ if (unlikely(!(file->f_mode & FMODE_WRITE))) -+ goto out; -+ -+ inode = file_inode(file); -+ au_mtx_and_read_lock(inode); -+ -+ h_file = au_write_pre(file, /*do_ready*/1, &wpre); -+ err = PTR_ERR(h_file); -+ if (IS_ERR(h_file)) -+ goto out_unlock; -+ -+ err = vfsub_fsync(h_file, &h_file->f_path, datasync); -+ au_write_post(inode, h_file, &wpre, /*written*/0); -+ -+out_unlock: -+ si_read_unlock(inode->i_sb); -+ inode_unlock(inode); -+out: -+ return err; -+} -+ -+/* no one supports this operation, currently */ -+#if 0 -+static int aufs_aio_fsync_nondir(struct kiocb *kio, int datasync) -+{ -+ int err; -+ struct au_write_pre wpre; -+ struct inode *inode, *h_inode; -+ struct file *file, *h_file; -+ -+ err = 0; /* -EBADF; */ /* posix? */ -+ if (unlikely(!(file->f_mode & FMODE_WRITE))) -+ goto out; -+ -+ file = kio->ki_filp; -+ inode = file_inode(file); -+ au_mtx_and_read_lock(inode); -+ -+ h_file = au_write_pre(file, /*do_ready*/1, &wpre); -+ err = PTR_ERR(h_file); -+ if (IS_ERR(h_file)) -+ goto out_unlock; -+ -+ err = -ENOSYS; -+ h_file = au_hf_top(file); -+ if (h_file->f_op->aio_fsync) { -+ h_inode = file_inode(h_file); -+ if (!is_sync_kiocb(kio)) { -+ get_file(h_file); -+ fput(file); -+ } -+ kio->ki_filp = h_file; -+ err = h_file->f_op->aio_fsync(kio, datasync); -+ inode_lock_nested(h_inode, AuLsc_I_CHILD); -+ if (!err) -+ vfsub_update_h_iattr(&h_file->f_path, /*did*/NULL); -+ /*ignore*/ -+ inode_unlock(h_inode); -+ } -+ au_write_post(inode, h_file, &wpre, /*written*/0); -+ -+out_unlock: -+ si_read_unlock(inode->sb); -+ inode_unlock(inode); -+out: -+ return err; -+} -+#endif -+ -+static int aufs_fasync(int fd, struct file *file, int flag) -+{ -+ int err; -+ struct file *h_file; -+ struct super_block *sb; -+ -+ sb = file->f_path.dentry->d_sb; -+ si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLMW); -+ -+ h_file = au_read_pre(file, /*keep_fi*/0); -+ err = PTR_ERR(h_file); -+ if (IS_ERR(h_file)) -+ goto out; -+ -+ if (h_file->f_op->fasync) -+ err = h_file->f_op->fasync(fd, h_file, flag); -+ fput(h_file); /* instead of au_read_post() */ -+ -+out: -+ si_read_unlock(sb); -+ return err; -+} -+ -+static int aufs_setfl(struct file *file, unsigned long arg) -+{ -+ int err; -+ struct file *h_file; -+ struct super_block *sb; -+ -+ sb = file->f_path.dentry->d_sb; -+ si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLMW); -+ -+ h_file = au_read_pre(file, /*keep_fi*/0); -+ err = PTR_ERR(h_file); -+ if (IS_ERR(h_file)) -+ goto out; -+ -+ arg |= vfsub_file_flags(file) & FASYNC; /* stop calling h_file->fasync */ -+ err = setfl(/*unused fd*/-1, h_file, arg); -+ fput(h_file); /* instead of au_read_post() */ -+ -+out: -+ si_read_unlock(sb); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* no one supports this operation, currently */ -+#if 0 -+static ssize_t aufs_sendpage(struct file *file, struct page *page, int offset, -+ size_t len, loff_t *pos, int more) -+{ -+} -+#endif -+ -+/* ---------------------------------------------------------------------- */ -+ -+const struct file_operations aufs_file_fop = { -+ .owner = THIS_MODULE, -+ -+ .llseek = default_llseek, -+ -+ .read = aufs_read, -+ .write = aufs_write, -+ .read_iter = aufs_read_iter, -+ .write_iter = aufs_write_iter, -+ -+#ifdef CONFIG_AUFS_POLL -+ .poll = aufs_poll, -+#endif -+ .unlocked_ioctl = aufs_ioctl_nondir, -+#ifdef CONFIG_COMPAT -+ .compat_ioctl = aufs_compat_ioctl_nondir, -+#endif -+ .mmap = aufs_mmap, -+ .open = aufs_open_nondir, -+ .flush = aufs_flush_nondir, -+ .release = aufs_release_nondir, -+ .fsync = aufs_fsync_nondir, -+ /* .aio_fsync = aufs_aio_fsync_nondir, */ -+ .fasync = aufs_fasync, -+ /* .sendpage = aufs_sendpage, */ -+ .setfl = aufs_setfl, -+ .splice_write = aufs_splice_write, -+ .splice_read = aufs_splice_read, -+#if 0 -+ .aio_splice_write = aufs_aio_splice_write, -+ .aio_splice_read = aufs_aio_splice_read, -+#endif -+ .fallocate = aufs_fallocate -+}; -diff --git a/fs/aufs/fhsm.c b/fs/aufs/fhsm.c -new file mode 100644 -index 0000000..e3cb6ed ---- /dev/null -+++ b/fs/aufs/fhsm.c -@@ -0,0 +1,412 @@ -+/* -+ * Copyright (C) 2011-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * File-based Hierarchy Storage Management -+ */ -+ -+#include -+#include -+#include -+#include -+#include "aufs.h" -+ -+static aufs_bindex_t au_fhsm_bottom(struct super_block *sb) -+{ -+ struct au_sbinfo *sbinfo; -+ struct au_fhsm *fhsm; -+ -+ SiMustAnyLock(sb); -+ -+ sbinfo = au_sbi(sb); -+ fhsm = &sbinfo->si_fhsm; -+ AuDebugOn(!fhsm); -+ return fhsm->fhsm_bottom; -+} -+ -+void au_fhsm_set_bottom(struct super_block *sb, aufs_bindex_t bindex) -+{ -+ struct au_sbinfo *sbinfo; -+ struct au_fhsm *fhsm; -+ -+ SiMustWriteLock(sb); -+ -+ sbinfo = au_sbi(sb); -+ fhsm = &sbinfo->si_fhsm; -+ AuDebugOn(!fhsm); -+ fhsm->fhsm_bottom = bindex; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int au_fhsm_test_jiffy(struct au_sbinfo *sbinfo, struct au_branch *br) -+{ -+ struct au_br_fhsm *bf; -+ -+ bf = br->br_fhsm; -+ MtxMustLock(&bf->bf_lock); -+ -+ return !bf->bf_readable -+ || time_after(jiffies, -+ bf->bf_jiffy + sbinfo->si_fhsm.fhsm_expire); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static void au_fhsm_notify(struct super_block *sb, int val) -+{ -+ struct au_sbinfo *sbinfo; -+ struct au_fhsm *fhsm; -+ -+ SiMustAnyLock(sb); -+ -+ sbinfo = au_sbi(sb); -+ fhsm = &sbinfo->si_fhsm; -+ if (au_fhsm_pid(fhsm) -+ && atomic_read(&fhsm->fhsm_readable) != -1) { -+ atomic_set(&fhsm->fhsm_readable, val); -+ if (val) -+ wake_up(&fhsm->fhsm_wqh); -+ } -+} -+ -+static int au_fhsm_stfs(struct super_block *sb, aufs_bindex_t bindex, -+ struct aufs_stfs *rstfs, int do_lock, int do_notify) -+{ -+ int err; -+ struct au_branch *br; -+ struct au_br_fhsm *bf; -+ -+ br = au_sbr(sb, bindex); -+ AuDebugOn(au_br_rdonly(br)); -+ bf = br->br_fhsm; -+ AuDebugOn(!bf); -+ -+ if (do_lock) -+ mutex_lock(&bf->bf_lock); -+ else -+ MtxMustLock(&bf->bf_lock); -+ -+ /* sb->s_root for NFS is unreliable */ -+ err = au_br_stfs(br, &bf->bf_stfs); -+ if (unlikely(err)) { -+ AuErr1("FHSM failed (%d), b%d, ignored.\n", bindex, err); -+ goto out; -+ } -+ -+ bf->bf_jiffy = jiffies; -+ bf->bf_readable = 1; -+ if (do_notify) -+ au_fhsm_notify(sb, /*val*/1); -+ if (rstfs) -+ *rstfs = bf->bf_stfs; -+ -+out: -+ if (do_lock) -+ mutex_unlock(&bf->bf_lock); -+ au_fhsm_notify(sb, /*val*/1); -+ -+ return err; -+} -+ -+void au_fhsm_wrote(struct super_block *sb, aufs_bindex_t bindex, int force) -+{ -+ int err; -+ struct au_sbinfo *sbinfo; -+ struct au_fhsm *fhsm; -+ struct au_branch *br; -+ struct au_br_fhsm *bf; -+ -+ AuDbg("b%d, force %d\n", bindex, force); -+ SiMustAnyLock(sb); -+ -+ sbinfo = au_sbi(sb); -+ fhsm = &sbinfo->si_fhsm; -+ if (!au_ftest_si(sbinfo, FHSM) -+ || fhsm->fhsm_bottom == bindex) -+ return; -+ -+ br = au_sbr(sb, bindex); -+ bf = br->br_fhsm; -+ AuDebugOn(!bf); -+ mutex_lock(&bf->bf_lock); -+ if (force -+ || au_fhsm_pid(fhsm) -+ || au_fhsm_test_jiffy(sbinfo, br)) -+ err = au_fhsm_stfs(sb, bindex, /*rstfs*/NULL, /*do_lock*/0, -+ /*do_notify*/1); -+ mutex_unlock(&bf->bf_lock); -+} -+ -+void au_fhsm_wrote_all(struct super_block *sb, int force) -+{ -+ aufs_bindex_t bindex, bbot; -+ struct au_branch *br; -+ -+ /* exclude the bottom */ -+ bbot = au_fhsm_bottom(sb); -+ for (bindex = 0; bindex < bbot; bindex++) { -+ br = au_sbr(sb, bindex); -+ if (au_br_fhsm(br->br_perm)) -+ au_fhsm_wrote(sb, bindex, force); -+ } -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static unsigned int au_fhsm_poll(struct file *file, -+ struct poll_table_struct *wait) -+{ -+ unsigned int mask; -+ struct au_sbinfo *sbinfo; -+ struct au_fhsm *fhsm; -+ -+ mask = 0; -+ sbinfo = file->private_data; -+ fhsm = &sbinfo->si_fhsm; -+ poll_wait(file, &fhsm->fhsm_wqh, wait); -+ if (atomic_read(&fhsm->fhsm_readable)) -+ mask = POLLIN /* | POLLRDNORM */; -+ -+ AuTraceErr((int)mask); -+ return mask; -+} -+ -+static int au_fhsm_do_read_one(struct aufs_stbr __user *stbr, -+ struct aufs_stfs *stfs, __s16 brid) -+{ -+ int err; -+ -+ err = copy_to_user(&stbr->stfs, stfs, sizeof(*stfs)); -+ if (!err) -+ err = __put_user(brid, &stbr->brid); -+ if (unlikely(err)) -+ err = -EFAULT; -+ -+ return err; -+} -+ -+static ssize_t au_fhsm_do_read(struct super_block *sb, -+ struct aufs_stbr __user *stbr, size_t count) -+{ -+ ssize_t err; -+ int nstbr; -+ aufs_bindex_t bindex, bbot; -+ struct au_branch *br; -+ struct au_br_fhsm *bf; -+ -+ /* except the bottom branch */ -+ err = 0; -+ nstbr = 0; -+ bbot = au_fhsm_bottom(sb); -+ for (bindex = 0; !err && bindex < bbot; bindex++) { -+ br = au_sbr(sb, bindex); -+ if (!au_br_fhsm(br->br_perm)) -+ continue; -+ -+ bf = br->br_fhsm; -+ mutex_lock(&bf->bf_lock); -+ if (bf->bf_readable) { -+ err = -EFAULT; -+ if (count >= sizeof(*stbr)) -+ err = au_fhsm_do_read_one(stbr++, &bf->bf_stfs, -+ br->br_id); -+ if (!err) { -+ bf->bf_readable = 0; -+ count -= sizeof(*stbr); -+ nstbr++; -+ } -+ } -+ mutex_unlock(&bf->bf_lock); -+ } -+ if (!err) -+ err = sizeof(*stbr) * nstbr; -+ -+ return err; -+} -+ -+static ssize_t au_fhsm_read(struct file *file, char __user *buf, size_t count, -+ loff_t *pos) -+{ -+ ssize_t err; -+ int readable; -+ aufs_bindex_t nfhsm, bindex, bbot; -+ struct au_sbinfo *sbinfo; -+ struct au_fhsm *fhsm; -+ struct au_branch *br; -+ struct super_block *sb; -+ -+ err = 0; -+ sbinfo = file->private_data; -+ fhsm = &sbinfo->si_fhsm; -+need_data: -+ spin_lock_irq(&fhsm->fhsm_wqh.lock); -+ if (!atomic_read(&fhsm->fhsm_readable)) { -+ if (vfsub_file_flags(file) & O_NONBLOCK) -+ err = -EAGAIN; -+ else -+ err = wait_event_interruptible_locked_irq -+ (fhsm->fhsm_wqh, -+ atomic_read(&fhsm->fhsm_readable)); -+ } -+ spin_unlock_irq(&fhsm->fhsm_wqh.lock); -+ if (unlikely(err)) -+ goto out; -+ -+ /* sb may already be dead */ -+ au_rw_read_lock(&sbinfo->si_rwsem); -+ readable = atomic_read(&fhsm->fhsm_readable); -+ if (readable > 0) { -+ sb = sbinfo->si_sb; -+ AuDebugOn(!sb); -+ /* exclude the bottom branch */ -+ nfhsm = 0; -+ bbot = au_fhsm_bottom(sb); -+ for (bindex = 0; bindex < bbot; bindex++) { -+ br = au_sbr(sb, bindex); -+ if (au_br_fhsm(br->br_perm)) -+ nfhsm++; -+ } -+ err = -EMSGSIZE; -+ if (nfhsm * sizeof(struct aufs_stbr) <= count) { -+ atomic_set(&fhsm->fhsm_readable, 0); -+ err = au_fhsm_do_read(sbinfo->si_sb, (void __user *)buf, -+ count); -+ } -+ } -+ au_rw_read_unlock(&sbinfo->si_rwsem); -+ if (!readable) -+ goto need_data; -+ -+out: -+ return err; -+} -+ -+static int au_fhsm_release(struct inode *inode, struct file *file) -+{ -+ struct au_sbinfo *sbinfo; -+ struct au_fhsm *fhsm; -+ -+ /* sb may already be dead */ -+ sbinfo = file->private_data; -+ fhsm = &sbinfo->si_fhsm; -+ spin_lock(&fhsm->fhsm_spin); -+ fhsm->fhsm_pid = 0; -+ spin_unlock(&fhsm->fhsm_spin); -+ kobject_put(&sbinfo->si_kobj); -+ -+ return 0; -+} -+ -+static const struct file_operations au_fhsm_fops = { -+ .owner = THIS_MODULE, -+ .llseek = noop_llseek, -+ .read = au_fhsm_read, -+ .poll = au_fhsm_poll, -+ .release = au_fhsm_release -+}; -+ -+int au_fhsm_fd(struct super_block *sb, int oflags) -+{ -+ int err, fd; -+ struct au_sbinfo *sbinfo; -+ struct au_fhsm *fhsm; -+ -+ err = -EPERM; -+ if (unlikely(!capable(CAP_SYS_ADMIN))) -+ goto out; -+ -+ err = -EINVAL; -+ if (unlikely(oflags & ~(O_CLOEXEC | O_NONBLOCK))) -+ goto out; -+ -+ err = 0; -+ sbinfo = au_sbi(sb); -+ fhsm = &sbinfo->si_fhsm; -+ spin_lock(&fhsm->fhsm_spin); -+ if (!fhsm->fhsm_pid) -+ fhsm->fhsm_pid = current->pid; -+ else -+ err = -EBUSY; -+ spin_unlock(&fhsm->fhsm_spin); -+ if (unlikely(err)) -+ goto out; -+ -+ oflags |= O_RDONLY; -+ /* oflags |= FMODE_NONOTIFY; */ -+ fd = anon_inode_getfd("[aufs_fhsm]", &au_fhsm_fops, sbinfo, oflags); -+ err = fd; -+ if (unlikely(fd < 0)) -+ goto out_pid; -+ -+ /* succeed reglardless 'fhsm' status */ -+ kobject_get(&sbinfo->si_kobj); -+ si_noflush_read_lock(sb); -+ if (au_ftest_si(sbinfo, FHSM)) -+ au_fhsm_wrote_all(sb, /*force*/0); -+ si_read_unlock(sb); -+ goto out; /* success */ -+ -+out_pid: -+ spin_lock(&fhsm->fhsm_spin); -+ fhsm->fhsm_pid = 0; -+ spin_unlock(&fhsm->fhsm_spin); -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+int au_fhsm_br_alloc(struct au_branch *br) -+{ -+ int err; -+ -+ err = 0; -+ br->br_fhsm = kmalloc(sizeof(*br->br_fhsm), GFP_NOFS); -+ if (br->br_fhsm) -+ au_br_fhsm_init(br->br_fhsm); -+ else -+ err = -ENOMEM; -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+void au_fhsm_fin(struct super_block *sb) -+{ -+ au_fhsm_notify(sb, /*val*/-1); -+} -+ -+void au_fhsm_init(struct au_sbinfo *sbinfo) -+{ -+ struct au_fhsm *fhsm; -+ -+ fhsm = &sbinfo->si_fhsm; -+ spin_lock_init(&fhsm->fhsm_spin); -+ init_waitqueue_head(&fhsm->fhsm_wqh); -+ atomic_set(&fhsm->fhsm_readable, 0); -+ fhsm->fhsm_expire -+ = msecs_to_jiffies(AUFS_FHSM_CACHE_DEF_SEC * MSEC_PER_SEC); -+ fhsm->fhsm_bottom = -1; -+} -+ -+void au_fhsm_set(struct au_sbinfo *sbinfo, unsigned int sec) -+{ -+ sbinfo->si_fhsm.fhsm_expire -+ = msecs_to_jiffies(sec * MSEC_PER_SEC); -+} -+ -+void au_fhsm_show(struct seq_file *seq, struct au_sbinfo *sbinfo) -+{ -+ unsigned int u; -+ -+ if (!au_ftest_si(sbinfo, FHSM)) -+ return; -+ -+ u = jiffies_to_msecs(sbinfo->si_fhsm.fhsm_expire) / MSEC_PER_SEC; -+ if (u != AUFS_FHSM_CACHE_DEF_SEC) -+ seq_printf(seq, ",fhsm_sec=%u", u); -+} -diff --git a/fs/aufs/file.c b/fs/aufs/file.c -new file mode 100644 -index 0000000..bfc1d1b ---- /dev/null -+++ b/fs/aufs/file.c -@@ -0,0 +1,844 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * handling file/dir, and address_space operation -+ */ -+ -+#ifdef CONFIG_AUFS_DEBUG -+#include -+#endif -+#include -+#include "aufs.h" -+ -+/* drop flags for writing */ -+unsigned int au_file_roflags(unsigned int flags) -+{ -+ flags &= ~(O_WRONLY | O_RDWR | O_APPEND | O_CREAT | O_TRUNC); -+ flags |= O_RDONLY | O_NOATIME; -+ return flags; -+} -+ -+/* common functions to regular file and dir */ -+struct file *au_h_open(struct dentry *dentry, aufs_bindex_t bindex, int flags, -+ struct file *file, int force_wr) -+{ -+ struct file *h_file; -+ struct dentry *h_dentry; -+ struct inode *h_inode; -+ struct super_block *sb; -+ struct au_branch *br; -+ struct path h_path; -+ int err; -+ -+ /* a race condition can happen between open and unlink/rmdir */ -+ h_file = ERR_PTR(-ENOENT); -+ h_dentry = au_h_dptr(dentry, bindex); -+ if (au_test_nfsd() && (!h_dentry || d_is_negative(h_dentry))) -+ goto out; -+ h_inode = d_inode(h_dentry); -+ spin_lock(&h_dentry->d_lock); -+ err = (!d_unhashed(dentry) && d_unlinked(h_dentry)) -+ /* || !d_inode(dentry)->i_nlink */ -+ ; -+ spin_unlock(&h_dentry->d_lock); -+ if (unlikely(err)) -+ goto out; -+ -+ sb = dentry->d_sb; -+ br = au_sbr(sb, bindex); -+ err = au_br_test_oflag(flags, br); -+ h_file = ERR_PTR(err); -+ if (unlikely(err)) -+ goto out; -+ -+ /* drop flags for writing */ -+ if (au_test_ro(sb, bindex, d_inode(dentry))) { -+ if (force_wr && !(flags & O_WRONLY)) -+ force_wr = 0; -+ flags = au_file_roflags(flags); -+ if (force_wr) { -+ h_file = ERR_PTR(-EROFS); -+ flags = au_file_roflags(flags); -+ if (unlikely(vfsub_native_ro(h_inode) -+ || IS_APPEND(h_inode))) -+ goto out; -+ flags &= ~O_ACCMODE; -+ flags |= O_WRONLY; -+ } -+ } -+ flags &= ~O_CREAT; -+ au_br_get(br); -+ h_path.dentry = h_dentry; -+ h_path.mnt = au_br_mnt(br); -+ h_file = vfsub_dentry_open(&h_path, flags); -+ if (IS_ERR(h_file)) -+ goto out_br; -+ -+ if (flags & __FMODE_EXEC) { -+ err = deny_write_access(h_file); -+ if (unlikely(err)) { -+ fput(h_file); -+ h_file = ERR_PTR(err); -+ goto out_br; -+ } -+ } -+ fsnotify_open(h_file); -+ goto out; /* success */ -+ -+out_br: -+ au_br_put(br); -+out: -+ return h_file; -+} -+ -+static int au_cmoo(struct dentry *dentry) -+{ -+ int err, cmoo; -+ unsigned int udba; -+ struct path h_path; -+ struct au_pin pin; -+ struct au_cp_generic cpg = { -+ .dentry = dentry, -+ .bdst = -1, -+ .bsrc = -1, -+ .len = -1, -+ .pin = &pin, -+ .flags = AuCpup_DTIME | AuCpup_HOPEN -+ }; -+ struct inode *delegated; -+ struct super_block *sb; -+ struct au_sbinfo *sbinfo; -+ struct au_fhsm *fhsm; -+ pid_t pid; -+ struct au_branch *br; -+ struct dentry *parent; -+ struct au_hinode *hdir; -+ -+ DiMustWriteLock(dentry); -+ IiMustWriteLock(d_inode(dentry)); -+ -+ err = 0; -+ if (IS_ROOT(dentry)) -+ goto out; -+ cpg.bsrc = au_dbtop(dentry); -+ if (!cpg.bsrc) -+ goto out; -+ -+ sb = dentry->d_sb; -+ sbinfo = au_sbi(sb); -+ fhsm = &sbinfo->si_fhsm; -+ pid = au_fhsm_pid(fhsm); -+ if (pid -+ && (current->pid == pid -+ || current->real_parent->pid == pid)) -+ goto out; -+ -+ br = au_sbr(sb, cpg.bsrc); -+ cmoo = au_br_cmoo(br->br_perm); -+ if (!cmoo) -+ goto out; -+ if (!d_is_reg(dentry)) -+ cmoo &= AuBrAttr_COO_ALL; -+ if (!cmoo) -+ goto out; -+ -+ parent = dget_parent(dentry); -+ di_write_lock_parent(parent); -+ err = au_wbr_do_copyup_bu(dentry, cpg.bsrc - 1); -+ cpg.bdst = err; -+ if (unlikely(err < 0)) { -+ err = 0; /* there is no upper writable branch */ -+ goto out_dgrade; -+ } -+ AuDbg("bsrc %d, bdst %d\n", cpg.bsrc, cpg.bdst); -+ -+ /* do not respect the coo attrib for the target branch */ -+ err = au_cpup_dirs(dentry, cpg.bdst); -+ if (unlikely(err)) -+ goto out_dgrade; -+ -+ di_downgrade_lock(parent, AuLock_IR); -+ udba = au_opt_udba(sb); -+ err = au_pin(&pin, dentry, cpg.bdst, udba, -+ AuPin_DI_LOCKED | AuPin_MNT_WRITE); -+ if (unlikely(err)) -+ goto out_parent; -+ -+ err = au_sio_cpup_simple(&cpg); -+ au_unpin(&pin); -+ if (unlikely(err)) -+ goto out_parent; -+ if (!(cmoo & AuBrWAttr_MOO)) -+ goto out_parent; /* success */ -+ -+ err = au_pin(&pin, dentry, cpg.bsrc, udba, -+ AuPin_DI_LOCKED | AuPin_MNT_WRITE); -+ if (unlikely(err)) -+ goto out_parent; -+ -+ h_path.mnt = au_br_mnt(br); -+ h_path.dentry = au_h_dptr(dentry, cpg.bsrc); -+ hdir = au_hi(d_inode(parent), cpg.bsrc); -+ delegated = NULL; -+ err = vfsub_unlink(hdir->hi_inode, &h_path, &delegated, /*force*/1); -+ au_unpin(&pin); -+ /* todo: keep h_dentry or not? */ -+ if (unlikely(err == -EWOULDBLOCK)) { -+ pr_warn("cannot retry for NFSv4 delegation" -+ " for an internal unlink\n"); -+ iput(delegated); -+ } -+ if (unlikely(err)) { -+ pr_err("unlink %pd after coo failed (%d), ignored\n", -+ dentry, err); -+ err = 0; -+ } -+ goto out_parent; /* success */ -+ -+out_dgrade: -+ di_downgrade_lock(parent, AuLock_IR); -+out_parent: -+ di_read_unlock(parent, AuLock_IR); -+ dput(parent); -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+int au_do_open(struct file *file, struct au_do_open_args *args) -+{ -+ int err, no_lock = args->no_lock; -+ struct dentry *dentry; -+ struct au_finfo *finfo; -+ -+ if (!no_lock) -+ err = au_finfo_init(file, args->fidir); -+ else { -+ lockdep_off(); -+ err = au_finfo_init(file, args->fidir); -+ lockdep_on(); -+ } -+ if (unlikely(err)) -+ goto out; -+ -+ dentry = file->f_path.dentry; -+ AuDebugOn(IS_ERR_OR_NULL(dentry)); -+ if (!no_lock) { -+ di_write_lock_child(dentry); -+ err = au_cmoo(dentry); -+ di_downgrade_lock(dentry, AuLock_IR); -+ if (!err) -+ err = args->open(file, vfsub_file_flags(file), NULL); -+ di_read_unlock(dentry, AuLock_IR); -+ } else { -+ err = au_cmoo(dentry); -+ if (!err) -+ err = args->open(file, vfsub_file_flags(file), -+ args->h_file); -+ if (!err && au_fbtop(file) != au_dbtop(dentry)) -+ /* -+ * cmoo happens after h_file was opened. -+ * need to refresh file later. -+ */ -+ atomic_dec(&au_fi(file)->fi_generation); -+ } -+ -+ finfo = au_fi(file); -+ if (!err) { -+ finfo->fi_file = file; -+ au_sphl_add(&finfo->fi_hlist, -+ &au_sbi(file->f_path.dentry->d_sb)->si_files); -+ } -+ if (!no_lock) -+ fi_write_unlock(file); -+ else { -+ lockdep_off(); -+ fi_write_unlock(file); -+ lockdep_on(); -+ } -+ if (unlikely(err)) { -+ finfo->fi_hdir = NULL; -+ au_finfo_fin(file, /*atonce*/0); -+ } -+ -+out: -+ return err; -+} -+ -+int au_reopen_nondir(struct file *file) -+{ -+ int err; -+ aufs_bindex_t btop; -+ struct dentry *dentry; -+ struct file *h_file, *h_file_tmp; -+ -+ dentry = file->f_path.dentry; -+ btop = au_dbtop(dentry); -+ h_file_tmp = NULL; -+ if (au_fbtop(file) == btop) { -+ h_file = au_hf_top(file); -+ if (file->f_mode == h_file->f_mode) -+ return 0; /* success */ -+ h_file_tmp = h_file; -+ get_file(h_file_tmp); -+ au_set_h_fptr(file, btop, NULL); -+ } -+ AuDebugOn(au_fi(file)->fi_hdir); -+ /* -+ * it can happen -+ * file exists on both of rw and ro -+ * open --> dbtop and fbtop are both 0 -+ * prepend a branch as rw, "rw" become ro -+ * remove rw/file -+ * delete the top branch, "rw" becomes rw again -+ * --> dbtop is 1, fbtop is still 0 -+ * write --> fbtop is 0 but dbtop is 1 -+ */ -+ /* AuDebugOn(au_fbtop(file) < btop); */ -+ -+ h_file = au_h_open(dentry, btop, vfsub_file_flags(file) & ~O_TRUNC, -+ file, /*force_wr*/0); -+ err = PTR_ERR(h_file); -+ if (IS_ERR(h_file)) { -+ if (h_file_tmp) { -+ au_sbr_get(dentry->d_sb, btop); -+ au_set_h_fptr(file, btop, h_file_tmp); -+ h_file_tmp = NULL; -+ } -+ goto out; /* todo: close all? */ -+ } -+ -+ err = 0; -+ au_set_fbtop(file, btop); -+ au_set_h_fptr(file, btop, h_file); -+ au_update_figen(file); -+ /* todo: necessary? */ -+ /* file->f_ra = h_file->f_ra; */ -+ -+out: -+ if (h_file_tmp) -+ fput(h_file_tmp); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int au_reopen_wh(struct file *file, aufs_bindex_t btgt, -+ struct dentry *hi_wh) -+{ -+ int err; -+ aufs_bindex_t btop; -+ struct au_dinfo *dinfo; -+ struct dentry *h_dentry; -+ struct au_hdentry *hdp; -+ -+ dinfo = au_di(file->f_path.dentry); -+ AuRwMustWriteLock(&dinfo->di_rwsem); -+ -+ btop = dinfo->di_btop; -+ dinfo->di_btop = btgt; -+ hdp = au_hdentry(dinfo, btgt); -+ h_dentry = hdp->hd_dentry; -+ hdp->hd_dentry = hi_wh; -+ err = au_reopen_nondir(file); -+ hdp->hd_dentry = h_dentry; -+ dinfo->di_btop = btop; -+ -+ return err; -+} -+ -+static int au_ready_to_write_wh(struct file *file, loff_t len, -+ aufs_bindex_t bcpup, struct au_pin *pin) -+{ -+ int err; -+ struct inode *inode, *h_inode; -+ struct dentry *h_dentry, *hi_wh; -+ struct au_cp_generic cpg = { -+ .dentry = file->f_path.dentry, -+ .bdst = bcpup, -+ .bsrc = -1, -+ .len = len, -+ .pin = pin -+ }; -+ -+ au_update_dbtop(cpg.dentry); -+ inode = d_inode(cpg.dentry); -+ h_inode = NULL; -+ if (au_dbtop(cpg.dentry) <= bcpup -+ && au_dbbot(cpg.dentry) >= bcpup) { -+ h_dentry = au_h_dptr(cpg.dentry, bcpup); -+ if (h_dentry && d_is_positive(h_dentry)) -+ h_inode = d_inode(h_dentry); -+ } -+ hi_wh = au_hi_wh(inode, bcpup); -+ if (!hi_wh && !h_inode) -+ err = au_sio_cpup_wh(&cpg, file); -+ else -+ /* already copied-up after unlink */ -+ err = au_reopen_wh(file, bcpup, hi_wh); -+ -+ if (!err -+ && (inode->i_nlink > 1 -+ || (inode->i_state & I_LINKABLE)) -+ && au_opt_test(au_mntflags(cpg.dentry->d_sb), PLINK)) -+ au_plink_append(inode, bcpup, au_h_dptr(cpg.dentry, bcpup)); -+ -+ return err; -+} -+ -+/* -+ * prepare the @file for writing. -+ */ -+int au_ready_to_write(struct file *file, loff_t len, struct au_pin *pin) -+{ -+ int err; -+ aufs_bindex_t dbtop; -+ struct dentry *parent; -+ struct inode *inode; -+ struct super_block *sb; -+ struct file *h_file; -+ struct au_cp_generic cpg = { -+ .dentry = file->f_path.dentry, -+ .bdst = -1, -+ .bsrc = -1, -+ .len = len, -+ .pin = pin, -+ .flags = AuCpup_DTIME -+ }; -+ -+ sb = cpg.dentry->d_sb; -+ inode = d_inode(cpg.dentry); -+ cpg.bsrc = au_fbtop(file); -+ err = au_test_ro(sb, cpg.bsrc, inode); -+ if (!err && (au_hf_top(file)->f_mode & FMODE_WRITE)) { -+ err = au_pin(pin, cpg.dentry, cpg.bsrc, AuOpt_UDBA_NONE, -+ /*flags*/0); -+ goto out; -+ } -+ -+ /* need to cpup or reopen */ -+ parent = dget_parent(cpg.dentry); -+ di_write_lock_parent(parent); -+ err = AuWbrCopyup(au_sbi(sb), cpg.dentry); -+ cpg.bdst = err; -+ if (unlikely(err < 0)) -+ goto out_dgrade; -+ err = 0; -+ -+ if (!d_unhashed(cpg.dentry) && !au_h_dptr(parent, cpg.bdst)) { -+ err = au_cpup_dirs(cpg.dentry, cpg.bdst); -+ if (unlikely(err)) -+ goto out_dgrade; -+ } -+ -+ err = au_pin(pin, cpg.dentry, cpg.bdst, AuOpt_UDBA_NONE, -+ AuPin_DI_LOCKED | AuPin_MNT_WRITE); -+ if (unlikely(err)) -+ goto out_dgrade; -+ -+ dbtop = au_dbtop(cpg.dentry); -+ if (dbtop <= cpg.bdst) -+ cpg.bsrc = cpg.bdst; -+ -+ if (dbtop <= cpg.bdst /* just reopen */ -+ || !d_unhashed(cpg.dentry) /* copyup and reopen */ -+ ) { -+ h_file = au_h_open_pre(cpg.dentry, cpg.bsrc, /*force_wr*/0); -+ if (IS_ERR(h_file)) -+ err = PTR_ERR(h_file); -+ else { -+ di_downgrade_lock(parent, AuLock_IR); -+ if (dbtop > cpg.bdst) -+ err = au_sio_cpup_simple(&cpg); -+ if (!err) -+ err = au_reopen_nondir(file); -+ au_h_open_post(cpg.dentry, cpg.bsrc, h_file); -+ } -+ } else { /* copyup as wh and reopen */ -+ /* -+ * since writable hfsplus branch is not supported, -+ * h_open_pre/post() are unnecessary. -+ */ -+ err = au_ready_to_write_wh(file, len, cpg.bdst, pin); -+ di_downgrade_lock(parent, AuLock_IR); -+ } -+ -+ if (!err) { -+ au_pin_set_parent_lflag(pin, /*lflag*/0); -+ goto out_dput; /* success */ -+ } -+ au_unpin(pin); -+ goto out_unlock; -+ -+out_dgrade: -+ di_downgrade_lock(parent, AuLock_IR); -+out_unlock: -+ di_read_unlock(parent, AuLock_IR); -+out_dput: -+ dput(parent); -+out: -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+int au_do_flush(struct file *file, fl_owner_t id, -+ int (*flush)(struct file *file, fl_owner_t id)) -+{ -+ int err; -+ struct super_block *sb; -+ struct inode *inode; -+ -+ inode = file_inode(file); -+ sb = inode->i_sb; -+ si_noflush_read_lock(sb); -+ fi_read_lock(file); -+ ii_read_lock_child(inode); -+ -+ err = flush(file, id); -+ au_cpup_attr_timesizes(inode); -+ -+ ii_read_unlock(inode); -+ fi_read_unlock(file); -+ si_read_unlock(sb); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int au_file_refresh_by_inode(struct file *file, int *need_reopen) -+{ -+ int err; -+ struct au_pin pin; -+ struct au_finfo *finfo; -+ struct dentry *parent, *hi_wh; -+ struct inode *inode; -+ struct super_block *sb; -+ struct au_cp_generic cpg = { -+ .dentry = file->f_path.dentry, -+ .bdst = -1, -+ .bsrc = -1, -+ .len = -1, -+ .pin = &pin, -+ .flags = AuCpup_DTIME -+ }; -+ -+ FiMustWriteLock(file); -+ -+ err = 0; -+ finfo = au_fi(file); -+ sb = cpg.dentry->d_sb; -+ inode = d_inode(cpg.dentry); -+ cpg.bdst = au_ibtop(inode); -+ if (cpg.bdst == finfo->fi_btop || IS_ROOT(cpg.dentry)) -+ goto out; -+ -+ parent = dget_parent(cpg.dentry); -+ if (au_test_ro(sb, cpg.bdst, inode)) { -+ di_read_lock_parent(parent, !AuLock_IR); -+ err = AuWbrCopyup(au_sbi(sb), cpg.dentry); -+ cpg.bdst = err; -+ di_read_unlock(parent, !AuLock_IR); -+ if (unlikely(err < 0)) -+ goto out_parent; -+ err = 0; -+ } -+ -+ di_read_lock_parent(parent, AuLock_IR); -+ hi_wh = au_hi_wh(inode, cpg.bdst); -+ if (!S_ISDIR(inode->i_mode) -+ && au_opt_test(au_mntflags(sb), PLINK) -+ && au_plink_test(inode) -+ && !d_unhashed(cpg.dentry) -+ && cpg.bdst < au_dbtop(cpg.dentry)) { -+ err = au_test_and_cpup_dirs(cpg.dentry, cpg.bdst); -+ if (unlikely(err)) -+ goto out_unlock; -+ -+ /* always superio. */ -+ err = au_pin(&pin, cpg.dentry, cpg.bdst, AuOpt_UDBA_NONE, -+ AuPin_DI_LOCKED | AuPin_MNT_WRITE); -+ if (!err) { -+ err = au_sio_cpup_simple(&cpg); -+ au_unpin(&pin); -+ } -+ } else if (hi_wh) { -+ /* already copied-up after unlink */ -+ err = au_reopen_wh(file, cpg.bdst, hi_wh); -+ *need_reopen = 0; -+ } -+ -+out_unlock: -+ di_read_unlock(parent, AuLock_IR); -+out_parent: -+ dput(parent); -+out: -+ return err; -+} -+ -+static void au_do_refresh_dir(struct file *file) -+{ -+ int execed; -+ aufs_bindex_t bindex, bbot, new_bindex, brid; -+ struct au_hfile *p, tmp, *q; -+ struct au_finfo *finfo; -+ struct super_block *sb; -+ struct au_fidir *fidir; -+ -+ FiMustWriteLock(file); -+ -+ sb = file->f_path.dentry->d_sb; -+ finfo = au_fi(file); -+ fidir = finfo->fi_hdir; -+ AuDebugOn(!fidir); -+ p = fidir->fd_hfile + finfo->fi_btop; -+ brid = p->hf_br->br_id; -+ bbot = fidir->fd_bbot; -+ for (bindex = finfo->fi_btop; bindex <= bbot; bindex++, p++) { -+ if (!p->hf_file) -+ continue; -+ -+ new_bindex = au_br_index(sb, p->hf_br->br_id); -+ if (new_bindex == bindex) -+ continue; -+ if (new_bindex < 0) { -+ au_set_h_fptr(file, bindex, NULL); -+ continue; -+ } -+ -+ /* swap two lower inode, and loop again */ -+ q = fidir->fd_hfile + new_bindex; -+ tmp = *q; -+ *q = *p; -+ *p = tmp; -+ if (tmp.hf_file) { -+ bindex--; -+ p--; -+ } -+ } -+ -+ execed = vfsub_file_execed(file); -+ p = fidir->fd_hfile; -+ if (!au_test_mmapped(file) && !d_unlinked(file->f_path.dentry)) { -+ bbot = au_sbbot(sb); -+ for (finfo->fi_btop = 0; finfo->fi_btop <= bbot; -+ finfo->fi_btop++, p++) -+ if (p->hf_file) { -+ if (file_inode(p->hf_file)) -+ break; -+ au_hfput(p, execed); -+ } -+ } else { -+ bbot = au_br_index(sb, brid); -+ for (finfo->fi_btop = 0; finfo->fi_btop < bbot; -+ finfo->fi_btop++, p++) -+ if (p->hf_file) -+ au_hfput(p, execed); -+ bbot = au_sbbot(sb); -+ } -+ -+ p = fidir->fd_hfile + bbot; -+ for (fidir->fd_bbot = bbot; fidir->fd_bbot >= finfo->fi_btop; -+ fidir->fd_bbot--, p--) -+ if (p->hf_file) { -+ if (file_inode(p->hf_file)) -+ break; -+ au_hfput(p, execed); -+ } -+ AuDebugOn(fidir->fd_bbot < finfo->fi_btop); -+} -+ -+/* -+ * after branch manipulating, refresh the file. -+ */ -+static int refresh_file(struct file *file, int (*reopen)(struct file *file)) -+{ -+ int err, need_reopen, nbr; -+ aufs_bindex_t bbot, bindex; -+ struct dentry *dentry; -+ struct super_block *sb; -+ struct au_finfo *finfo; -+ struct au_hfile *hfile; -+ -+ dentry = file->f_path.dentry; -+ sb = dentry->d_sb; -+ nbr = au_sbbot(sb) + 1; -+ finfo = au_fi(file); -+ if (!finfo->fi_hdir) { -+ hfile = &finfo->fi_htop; -+ AuDebugOn(!hfile->hf_file); -+ bindex = au_br_index(sb, hfile->hf_br->br_id); -+ AuDebugOn(bindex < 0); -+ if (bindex != finfo->fi_btop) -+ au_set_fbtop(file, bindex); -+ } else { -+ err = au_fidir_realloc(finfo, nbr, /*may_shrink*/0); -+ if (unlikely(err)) -+ goto out; -+ au_do_refresh_dir(file); -+ } -+ -+ err = 0; -+ need_reopen = 1; -+ if (!au_test_mmapped(file)) -+ err = au_file_refresh_by_inode(file, &need_reopen); -+ if (finfo->fi_hdir) -+ /* harmless if err */ -+ au_fidir_realloc(finfo, nbr, /*may_shrink*/1); -+ if (!err && need_reopen && !d_unlinked(dentry)) -+ err = reopen(file); -+ if (!err) { -+ au_update_figen(file); -+ goto out; /* success */ -+ } -+ -+ /* error, close all lower files */ -+ if (finfo->fi_hdir) { -+ bbot = au_fbbot_dir(file); -+ for (bindex = au_fbtop(file); bindex <= bbot; bindex++) -+ au_set_h_fptr(file, bindex, NULL); -+ } -+ -+out: -+ return err; -+} -+ -+/* common function to regular file and dir */ -+int au_reval_and_lock_fdi(struct file *file, int (*reopen)(struct file *file), -+ int wlock) -+{ -+ int err; -+ unsigned int sigen, figen; -+ aufs_bindex_t btop; -+ unsigned char pseudo_link; -+ struct dentry *dentry; -+ struct inode *inode; -+ -+ err = 0; -+ dentry = file->f_path.dentry; -+ inode = d_inode(dentry); -+ sigen = au_sigen(dentry->d_sb); -+ fi_write_lock(file); -+ figen = au_figen(file); -+ di_write_lock_child(dentry); -+ btop = au_dbtop(dentry); -+ pseudo_link = (btop != au_ibtop(inode)); -+ if (sigen == figen && !pseudo_link && au_fbtop(file) == btop) { -+ if (!wlock) { -+ di_downgrade_lock(dentry, AuLock_IR); -+ fi_downgrade_lock(file); -+ } -+ goto out; /* success */ -+ } -+ -+ AuDbg("sigen %d, figen %d\n", sigen, figen); -+ if (au_digen_test(dentry, sigen)) { -+ err = au_reval_dpath(dentry, sigen); -+ AuDebugOn(!err && au_digen_test(dentry, sigen)); -+ } -+ -+ if (!err) -+ err = refresh_file(file, reopen); -+ if (!err) { -+ if (!wlock) { -+ di_downgrade_lock(dentry, AuLock_IR); -+ fi_downgrade_lock(file); -+ } -+ } else { -+ di_write_unlock(dentry); -+ fi_write_unlock(file); -+ } -+ -+out: -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* cf. aufs_nopage() */ -+/* for madvise(2) */ -+static int aufs_readpage(struct file *file __maybe_unused, struct page *page) -+{ -+ unlock_page(page); -+ return 0; -+} -+ -+/* it will never be called, but necessary to support O_DIRECT */ -+static ssize_t aufs_direct_IO(struct kiocb *iocb, struct iov_iter *iter) -+{ BUG(); return 0; } -+ -+/* they will never be called. */ -+#ifdef CONFIG_AUFS_DEBUG -+static int aufs_write_begin(struct file *file, struct address_space *mapping, -+ loff_t pos, unsigned len, unsigned flags, -+ struct page **pagep, void **fsdata) -+{ AuUnsupport(); return 0; } -+static int aufs_write_end(struct file *file, struct address_space *mapping, -+ loff_t pos, unsigned len, unsigned copied, -+ struct page *page, void *fsdata) -+{ AuUnsupport(); return 0; } -+static int aufs_writepage(struct page *page, struct writeback_control *wbc) -+{ AuUnsupport(); return 0; } -+ -+static int aufs_set_page_dirty(struct page *page) -+{ AuUnsupport(); return 0; } -+static void aufs_invalidatepage(struct page *page, unsigned int offset, -+ unsigned int length) -+{ AuUnsupport(); } -+static int aufs_releasepage(struct page *page, gfp_t gfp) -+{ AuUnsupport(); return 0; } -+#if 0 /* called by memory compaction regardless file */ -+static int aufs_migratepage(struct address_space *mapping, struct page *newpage, -+ struct page *page, enum migrate_mode mode) -+{ AuUnsupport(); return 0; } -+#endif -+static bool aufs_isolate_page(struct page *page, isolate_mode_t mode) -+{ AuUnsupport(); return true; } -+static void aufs_putback_page(struct page *page) -+{ AuUnsupport(); } -+static int aufs_launder_page(struct page *page) -+{ AuUnsupport(); return 0; } -+static int aufs_is_partially_uptodate(struct page *page, -+ unsigned long from, -+ unsigned long count) -+{ AuUnsupport(); return 0; } -+static void aufs_is_dirty_writeback(struct page *page, bool *dirty, -+ bool *writeback) -+{ AuUnsupport(); } -+static int aufs_error_remove_page(struct address_space *mapping, -+ struct page *page) -+{ AuUnsupport(); return 0; } -+static int aufs_swap_activate(struct swap_info_struct *sis, struct file *file, -+ sector_t *span) -+{ AuUnsupport(); return 0; } -+static void aufs_swap_deactivate(struct file *file) -+{ AuUnsupport(); } -+#endif /* CONFIG_AUFS_DEBUG */ -+ -+const struct address_space_operations aufs_aop = { -+ .readpage = aufs_readpage, -+ .direct_IO = aufs_direct_IO, -+#ifdef CONFIG_AUFS_DEBUG -+ .writepage = aufs_writepage, -+ /* no writepages, because of writepage */ -+ .set_page_dirty = aufs_set_page_dirty, -+ /* no readpages, because of readpage */ -+ .write_begin = aufs_write_begin, -+ .write_end = aufs_write_end, -+ /* no bmap, no block device */ -+ .invalidatepage = aufs_invalidatepage, -+ .releasepage = aufs_releasepage, -+ /* is fallback_migrate_page ok? */ -+ /* .migratepage = aufs_migratepage, */ -+ .isolate_page = aufs_isolate_page, -+ .putback_page = aufs_putback_page, -+ .launder_page = aufs_launder_page, -+ .is_partially_uptodate = aufs_is_partially_uptodate, -+ .is_dirty_writeback = aufs_is_dirty_writeback, -+ .error_remove_page = aufs_error_remove_page, -+ .swap_activate = aufs_swap_activate, -+ .swap_deactivate = aufs_swap_deactivate -+#endif /* CONFIG_AUFS_DEBUG */ -+}; -diff --git a/fs/aufs/file.h b/fs/aufs/file.h -new file mode 100644 -index 0000000..f53b381 ---- /dev/null -+++ b/fs/aufs/file.h -@@ -0,0 +1,281 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * file operations -+ */ -+ -+#ifndef __AUFS_FILE_H__ -+#define __AUFS_FILE_H__ -+ -+#ifdef __KERNEL__ -+ -+#include -+#include -+#include -+#include "rwsem.h" -+ -+struct au_branch; -+struct au_hfile { -+ struct file *hf_file; -+ struct au_branch *hf_br; -+}; -+ -+struct au_vdir; -+struct au_fidir { -+ aufs_bindex_t fd_bbot; -+ aufs_bindex_t fd_nent; -+ struct au_vdir *fd_vdir_cache; -+ struct au_hfile fd_hfile[]; -+}; -+ -+static inline int au_fidir_sz(int nent) -+{ -+ AuDebugOn(nent < 0); -+ return sizeof(struct au_fidir) + sizeof(struct au_hfile) * nent; -+} -+ -+struct au_finfo { -+ atomic_t fi_generation; -+ -+ struct au_rwsem fi_rwsem; -+ aufs_bindex_t fi_btop; -+ -+ /* do not union them */ -+ struct { /* for non-dir */ -+ struct au_hfile fi_htop; -+ atomic_t fi_mmapped; -+ }; -+ struct au_fidir *fi_hdir; /* for dir only */ -+ -+ struct hlist_node fi_hlist; -+ union { -+ struct file *fi_file; /* very ugly */ -+ struct llist_node fi_lnode; /* delayed free */ -+ }; -+} ____cacheline_aligned_in_smp; -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* file.c */ -+extern const struct address_space_operations aufs_aop; -+unsigned int au_file_roflags(unsigned int flags); -+struct file *au_h_open(struct dentry *dentry, aufs_bindex_t bindex, int flags, -+ struct file *file, int force_wr); -+struct au_do_open_args { -+ int no_lock; -+ int (*open)(struct file *file, int flags, -+ struct file *h_file); -+ struct au_fidir *fidir; -+ struct file *h_file; -+}; -+int au_do_open(struct file *file, struct au_do_open_args *args); -+int au_reopen_nondir(struct file *file); -+struct au_pin; -+int au_ready_to_write(struct file *file, loff_t len, struct au_pin *pin); -+int au_reval_and_lock_fdi(struct file *file, int (*reopen)(struct file *file), -+ int wlock); -+int au_do_flush(struct file *file, fl_owner_t id, -+ int (*flush)(struct file *file, fl_owner_t id)); -+ -+/* poll.c */ -+#ifdef CONFIG_AUFS_POLL -+unsigned int aufs_poll(struct file *file, poll_table *wait); -+#endif -+ -+#ifdef CONFIG_AUFS_BR_HFSPLUS -+/* hfsplus.c */ -+struct file *au_h_open_pre(struct dentry *dentry, aufs_bindex_t bindex, -+ int force_wr); -+void au_h_open_post(struct dentry *dentry, aufs_bindex_t bindex, -+ struct file *h_file); -+#else -+AuStub(struct file *, au_h_open_pre, return NULL, struct dentry *dentry, -+ aufs_bindex_t bindex, int force_wr) -+AuStubVoid(au_h_open_post, struct dentry *dentry, aufs_bindex_t bindex, -+ struct file *h_file); -+#endif -+ -+/* f_op.c */ -+extern const struct file_operations aufs_file_fop; -+int au_do_open_nondir(struct file *file, int flags, struct file *h_file); -+int aufs_release_nondir(struct inode *inode __maybe_unused, struct file *file); -+struct file *au_read_pre(struct file *file, int keep_fi); -+ -+/* finfo.c */ -+void au_hfput(struct au_hfile *hf, int execed); -+void au_set_h_fptr(struct file *file, aufs_bindex_t bindex, -+ struct file *h_file); -+ -+void au_update_figen(struct file *file); -+struct au_fidir *au_fidir_alloc(struct super_block *sb); -+int au_fidir_realloc(struct au_finfo *finfo, int nbr, int may_shrink); -+ -+void au_fi_init_once(void *_fi); -+void au_finfo_fin(struct file *file, int atonce); -+int au_finfo_init(struct file *file, struct au_fidir *fidir); -+ -+/* ioctl.c */ -+long aufs_ioctl_nondir(struct file *file, unsigned int cmd, unsigned long arg); -+#ifdef CONFIG_COMPAT -+long aufs_compat_ioctl_dir(struct file *file, unsigned int cmd, -+ unsigned long arg); -+long aufs_compat_ioctl_nondir(struct file *file, unsigned int cmd, -+ unsigned long arg); -+#endif -+ -+/* ---------------------------------------------------------------------- */ -+ -+static inline struct au_finfo *au_fi(struct file *file) -+{ -+ return file->private_data; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * fi_read_lock, fi_write_lock, -+ * fi_read_unlock, fi_write_unlock, fi_downgrade_lock -+ */ -+AuSimpleRwsemFuncs(fi, struct file *f, &au_fi(f)->fi_rwsem); -+ -+#define FiMustNoWaiters(f) AuRwMustNoWaiters(&au_fi(f)->fi_rwsem) -+#define FiMustAnyLock(f) AuRwMustAnyLock(&au_fi(f)->fi_rwsem) -+#define FiMustWriteLock(f) AuRwMustWriteLock(&au_fi(f)->fi_rwsem) -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* todo: hard/soft set? */ -+static inline aufs_bindex_t au_fbtop(struct file *file) -+{ -+ FiMustAnyLock(file); -+ return au_fi(file)->fi_btop; -+} -+ -+static inline aufs_bindex_t au_fbbot_dir(struct file *file) -+{ -+ FiMustAnyLock(file); -+ AuDebugOn(!au_fi(file)->fi_hdir); -+ return au_fi(file)->fi_hdir->fd_bbot; -+} -+ -+static inline struct au_vdir *au_fvdir_cache(struct file *file) -+{ -+ FiMustAnyLock(file); -+ AuDebugOn(!au_fi(file)->fi_hdir); -+ return au_fi(file)->fi_hdir->fd_vdir_cache; -+} -+ -+static inline void au_set_fbtop(struct file *file, aufs_bindex_t bindex) -+{ -+ FiMustWriteLock(file); -+ au_fi(file)->fi_btop = bindex; -+} -+ -+static inline void au_set_fbbot_dir(struct file *file, aufs_bindex_t bindex) -+{ -+ FiMustWriteLock(file); -+ AuDebugOn(!au_fi(file)->fi_hdir); -+ au_fi(file)->fi_hdir->fd_bbot = bindex; -+} -+ -+static inline void au_set_fvdir_cache(struct file *file, -+ struct au_vdir *vdir_cache) -+{ -+ FiMustWriteLock(file); -+ AuDebugOn(!au_fi(file)->fi_hdir); -+ au_fi(file)->fi_hdir->fd_vdir_cache = vdir_cache; -+} -+ -+static inline struct file *au_hf_top(struct file *file) -+{ -+ FiMustAnyLock(file); -+ AuDebugOn(au_fi(file)->fi_hdir); -+ return au_fi(file)->fi_htop.hf_file; -+} -+ -+static inline struct file *au_hf_dir(struct file *file, aufs_bindex_t bindex) -+{ -+ FiMustAnyLock(file); -+ AuDebugOn(!au_fi(file)->fi_hdir); -+ return au_fi(file)->fi_hdir->fd_hfile[0 + bindex].hf_file; -+} -+ -+/* todo: memory barrier? */ -+static inline unsigned int au_figen(struct file *f) -+{ -+ return atomic_read(&au_fi(f)->fi_generation); -+} -+ -+static inline void au_set_mmapped(struct file *f) -+{ -+ if (atomic_inc_return(&au_fi(f)->fi_mmapped)) -+ return; -+ pr_warn("fi_mmapped wrapped around\n"); -+ while (!atomic_inc_return(&au_fi(f)->fi_mmapped)) -+ ; -+} -+ -+static inline void au_unset_mmapped(struct file *f) -+{ -+ atomic_dec(&au_fi(f)->fi_mmapped); -+} -+ -+static inline int au_test_mmapped(struct file *f) -+{ -+ return atomic_read(&au_fi(f)->fi_mmapped); -+} -+ -+/* customize vma->vm_file */ -+ -+static inline void au_do_vm_file_reset(struct vm_area_struct *vma, -+ struct file *file) -+{ -+ struct file *f; -+ -+ f = vma->vm_file; -+ get_file(file); -+ vma->vm_file = file; -+ fput(f); -+} -+ -+#ifdef CONFIG_MMU -+#define AuDbgVmRegion(file, vma) do {} while (0) -+ -+static inline void au_vm_file_reset(struct vm_area_struct *vma, -+ struct file *file) -+{ -+ au_do_vm_file_reset(vma, file); -+} -+#else -+#define AuDbgVmRegion(file, vma) \ -+ AuDebugOn((vma)->vm_region && (vma)->vm_region->vm_file != (file)) -+ -+static inline void au_vm_file_reset(struct vm_area_struct *vma, -+ struct file *file) -+{ -+ struct file *f; -+ -+ au_do_vm_file_reset(vma, file); -+ f = vma->vm_region->vm_file; -+ get_file(file); -+ vma->vm_region->vm_file = file; -+ fput(f); -+} -+#endif /* CONFIG_MMU */ -+ -+/* handle vma->vm_prfile */ -+static inline void au_vm_prfile_set(struct vm_area_struct *vma, -+ struct file *file) -+{ -+ get_file(file); -+ vma->vm_prfile = file; -+#ifndef CONFIG_MMU -+ get_file(file); -+ vma->vm_region->vm_prfile = file; -+#endif -+} -+ -+#endif /* __KERNEL__ */ -+#endif /* __AUFS_FILE_H__ */ -diff --git a/fs/aufs/finfo.c b/fs/aufs/finfo.c -new file mode 100644 -index 0000000..0f016ed ---- /dev/null -+++ b/fs/aufs/finfo.c -@@ -0,0 +1,138 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * file private data -+ */ -+ -+#include "aufs.h" -+ -+void au_hfput(struct au_hfile *hf, int execed) -+{ -+ if (execed) -+ allow_write_access(hf->hf_file); -+ fput(hf->hf_file); -+ hf->hf_file = NULL; -+ au_br_put(hf->hf_br); -+ hf->hf_br = NULL; -+} -+ -+void au_set_h_fptr(struct file *file, aufs_bindex_t bindex, struct file *val) -+{ -+ struct au_finfo *finfo = au_fi(file); -+ struct au_hfile *hf; -+ struct au_fidir *fidir; -+ -+ fidir = finfo->fi_hdir; -+ if (!fidir) { -+ AuDebugOn(finfo->fi_btop != bindex); -+ hf = &finfo->fi_htop; -+ } else -+ hf = fidir->fd_hfile + bindex; -+ -+ if (hf && hf->hf_file) -+ au_hfput(hf, vfsub_file_execed(file)); -+ if (val) { -+ FiMustWriteLock(file); -+ AuDebugOn(IS_ERR_OR_NULL(file->f_path.dentry)); -+ hf->hf_file = val; -+ hf->hf_br = au_sbr(file->f_path.dentry->d_sb, bindex); -+ } -+} -+ -+void au_update_figen(struct file *file) -+{ -+ atomic_set(&au_fi(file)->fi_generation, au_digen(file->f_path.dentry)); -+ /* smp_mb(); */ /* atomic_set */ -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+struct au_fidir *au_fidir_alloc(struct super_block *sb) -+{ -+ struct au_fidir *fidir; -+ int nbr; -+ -+ nbr = au_sbbot(sb) + 1; -+ if (nbr < 2) -+ nbr = 2; /* initial allocate for 2 branches */ -+ fidir = kzalloc(au_fidir_sz(nbr), GFP_NOFS); -+ if (fidir) { -+ fidir->fd_bbot = -1; -+ fidir->fd_nent = nbr; -+ } -+ -+ return fidir; -+} -+ -+int au_fidir_realloc(struct au_finfo *finfo, int nbr, int may_shrink) -+{ -+ int err; -+ struct au_fidir *fidir, *p; -+ -+ AuRwMustWriteLock(&finfo->fi_rwsem); -+ fidir = finfo->fi_hdir; -+ AuDebugOn(!fidir); -+ -+ err = -ENOMEM; -+ p = au_kzrealloc(fidir, au_fidir_sz(fidir->fd_nent), au_fidir_sz(nbr), -+ GFP_NOFS, may_shrink); -+ if (p) { -+ p->fd_nent = nbr; -+ finfo->fi_hdir = p; -+ err = 0; -+ } -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+void au_finfo_fin(struct file *file, int atonce) -+{ -+ struct au_finfo *finfo; -+ -+ au_nfiles_dec(file->f_path.dentry->d_sb); -+ -+ finfo = au_fi(file); -+ AuDebugOn(finfo->fi_hdir); -+ AuRwDestroy(&finfo->fi_rwsem); -+ if (!atonce) -+ au_cache_dfree_finfo(finfo); -+ else -+ au_cache_free_finfo(finfo); -+} -+ -+void au_fi_init_once(void *_finfo) -+{ -+ struct au_finfo *finfo = _finfo; -+ -+ au_rw_init(&finfo->fi_rwsem); -+} -+ -+int au_finfo_init(struct file *file, struct au_fidir *fidir) -+{ -+ int err; -+ struct au_finfo *finfo; -+ struct dentry *dentry; -+ -+ err = -ENOMEM; -+ dentry = file->f_path.dentry; -+ finfo = au_cache_alloc_finfo(); -+ if (unlikely(!finfo)) -+ goto out; -+ -+ err = 0; -+ au_nfiles_inc(dentry->d_sb); -+ au_rw_write_lock(&finfo->fi_rwsem); -+ finfo->fi_btop = -1; -+ finfo->fi_hdir = fidir; -+ atomic_set(&finfo->fi_generation, au_digen(dentry)); -+ /* smp_mb(); */ /* atomic_set */ -+ -+ file->private_data = finfo; -+ -+out: -+ return err; -+} -diff --git a/fs/aufs/fstype.h b/fs/aufs/fstype.h -new file mode 100644 -index 0000000..95b78b9 ---- /dev/null -+++ b/fs/aufs/fstype.h -@@ -0,0 +1,387 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * judging filesystem type -+ */ -+ -+#ifndef __AUFS_FSTYPE_H__ -+#define __AUFS_FSTYPE_H__ -+ -+#ifdef __KERNEL__ -+ -+#include -+#include -+#include -+#include -+ -+static inline int au_test_aufs(struct super_block *sb) -+{ -+ return sb->s_magic == AUFS_SUPER_MAGIC; -+} -+ -+static inline const char *au_sbtype(struct super_block *sb) -+{ -+ return sb->s_type->name; -+} -+ -+static inline int au_test_iso9660(struct super_block *sb __maybe_unused) -+{ -+#if IS_ENABLED(CONFIG_ISO9660_FS) -+ return sb->s_magic == ISOFS_SUPER_MAGIC; -+#else -+ return 0; -+#endif -+} -+ -+static inline int au_test_romfs(struct super_block *sb __maybe_unused) -+{ -+#if IS_ENABLED(CONFIG_ROMFS_FS) -+ return sb->s_magic == ROMFS_MAGIC; -+#else -+ return 0; -+#endif -+} -+ -+static inline int au_test_cramfs(struct super_block *sb __maybe_unused) -+{ -+#if IS_ENABLED(CONFIG_CRAMFS) -+ return sb->s_magic == CRAMFS_MAGIC; -+#endif -+ return 0; -+} -+ -+static inline int au_test_nfs(struct super_block *sb __maybe_unused) -+{ -+#if IS_ENABLED(CONFIG_NFS_FS) -+ return sb->s_magic == NFS_SUPER_MAGIC; -+#else -+ return 0; -+#endif -+} -+ -+static inline int au_test_fuse(struct super_block *sb __maybe_unused) -+{ -+#if IS_ENABLED(CONFIG_FUSE_FS) -+ return sb->s_magic == FUSE_SUPER_MAGIC; -+#else -+ return 0; -+#endif -+} -+ -+static inline int au_test_xfs(struct super_block *sb __maybe_unused) -+{ -+#if IS_ENABLED(CONFIG_XFS_FS) -+ return sb->s_magic == XFS_SB_MAGIC; -+#else -+ return 0; -+#endif -+} -+ -+static inline int au_test_tmpfs(struct super_block *sb __maybe_unused) -+{ -+#ifdef CONFIG_TMPFS -+ return sb->s_magic == TMPFS_MAGIC; -+#else -+ return 0; -+#endif -+} -+ -+static inline int au_test_ecryptfs(struct super_block *sb __maybe_unused) -+{ -+#if IS_ENABLED(CONFIG_ECRYPT_FS) -+ return !strcmp(au_sbtype(sb), "ecryptfs"); -+#else -+ return 0; -+#endif -+} -+ -+static inline int au_test_ramfs(struct super_block *sb) -+{ -+ return sb->s_magic == RAMFS_MAGIC; -+} -+ -+static inline int au_test_ubifs(struct super_block *sb __maybe_unused) -+{ -+#if IS_ENABLED(CONFIG_UBIFS_FS) -+ return sb->s_magic == UBIFS_SUPER_MAGIC; -+#else -+ return 0; -+#endif -+} -+ -+static inline int au_test_procfs(struct super_block *sb __maybe_unused) -+{ -+#ifdef CONFIG_PROC_FS -+ return sb->s_magic == PROC_SUPER_MAGIC; -+#else -+ return 0; -+#endif -+} -+ -+static inline int au_test_sysfs(struct super_block *sb __maybe_unused) -+{ -+#ifdef CONFIG_SYSFS -+ return sb->s_magic == SYSFS_MAGIC; -+#else -+ return 0; -+#endif -+} -+ -+static inline int au_test_configfs(struct super_block *sb __maybe_unused) -+{ -+#if IS_ENABLED(CONFIG_CONFIGFS_FS) -+ return sb->s_magic == CONFIGFS_MAGIC; -+#else -+ return 0; -+#endif -+} -+ -+static inline int au_test_minix(struct super_block *sb __maybe_unused) -+{ -+#if IS_ENABLED(CONFIG_MINIX_FS) -+ return sb->s_magic == MINIX3_SUPER_MAGIC -+ || sb->s_magic == MINIX2_SUPER_MAGIC -+ || sb->s_magic == MINIX2_SUPER_MAGIC2 -+ || sb->s_magic == MINIX_SUPER_MAGIC -+ || sb->s_magic == MINIX_SUPER_MAGIC2; -+#else -+ return 0; -+#endif -+} -+ -+static inline int au_test_fat(struct super_block *sb __maybe_unused) -+{ -+#if IS_ENABLED(CONFIG_FAT_FS) -+ return sb->s_magic == MSDOS_SUPER_MAGIC; -+#else -+ return 0; -+#endif -+} -+ -+static inline int au_test_msdos(struct super_block *sb) -+{ -+ return au_test_fat(sb); -+} -+ -+static inline int au_test_vfat(struct super_block *sb) -+{ -+ return au_test_fat(sb); -+} -+ -+static inline int au_test_securityfs(struct super_block *sb __maybe_unused) -+{ -+#ifdef CONFIG_SECURITYFS -+ return sb->s_magic == SECURITYFS_MAGIC; -+#else -+ return 0; -+#endif -+} -+ -+static inline int au_test_squashfs(struct super_block *sb __maybe_unused) -+{ -+#if IS_ENABLED(CONFIG_SQUASHFS) -+ return sb->s_magic == SQUASHFS_MAGIC; -+#else -+ return 0; -+#endif -+} -+ -+static inline int au_test_btrfs(struct super_block *sb __maybe_unused) -+{ -+#if IS_ENABLED(CONFIG_BTRFS_FS) -+ return sb->s_magic == BTRFS_SUPER_MAGIC; -+#else -+ return 0; -+#endif -+} -+ -+static inline int au_test_xenfs(struct super_block *sb __maybe_unused) -+{ -+#if IS_ENABLED(CONFIG_XENFS) -+ return sb->s_magic == XENFS_SUPER_MAGIC; -+#else -+ return 0; -+#endif -+} -+ -+static inline int au_test_debugfs(struct super_block *sb __maybe_unused) -+{ -+#ifdef CONFIG_DEBUG_FS -+ return sb->s_magic == DEBUGFS_MAGIC; -+#else -+ return 0; -+#endif -+} -+ -+static inline int au_test_nilfs(struct super_block *sb __maybe_unused) -+{ -+#if IS_ENABLED(CONFIG_NILFS) -+ return sb->s_magic == NILFS_SUPER_MAGIC; -+#else -+ return 0; -+#endif -+} -+ -+static inline int au_test_hfsplus(struct super_block *sb __maybe_unused) -+{ -+#if IS_ENABLED(CONFIG_HFSPLUS_FS) -+ return sb->s_magic == HFSPLUS_SUPER_MAGIC; -+#else -+ return 0; -+#endif -+} -+ -+/* ---------------------------------------------------------------------- */ -+/* -+ * they can't be an aufs branch. -+ */ -+static inline int au_test_fs_unsuppoted(struct super_block *sb) -+{ -+ return -+#ifndef CONFIG_AUFS_BR_RAMFS -+ au_test_ramfs(sb) || -+#endif -+ au_test_procfs(sb) -+ || au_test_sysfs(sb) -+ || au_test_configfs(sb) -+ || au_test_debugfs(sb) -+ || au_test_securityfs(sb) -+ || au_test_xenfs(sb) -+ || au_test_ecryptfs(sb) -+ /* || !strcmp(au_sbtype(sb), "unionfs") */ -+ || au_test_aufs(sb); /* will be supported in next version */ -+} -+ -+static inline int au_test_fs_remote(struct super_block *sb) -+{ -+ return !au_test_tmpfs(sb) -+#ifdef CONFIG_AUFS_BR_RAMFS -+ && !au_test_ramfs(sb) -+#endif -+ && !(sb->s_type->fs_flags & FS_REQUIRES_DEV); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * Note: these functions (below) are created after reading ->getattr() in all -+ * filesystems under linux/fs. it means we have to do so in every update... -+ */ -+ -+/* -+ * some filesystems require getattr to refresh the inode attributes before -+ * referencing. -+ * in most cases, we can rely on the inode attribute in NFS (or every remote fs) -+ * and leave the work for d_revalidate() -+ */ -+static inline int au_test_fs_refresh_iattr(struct super_block *sb) -+{ -+ return au_test_nfs(sb) -+ || au_test_fuse(sb) -+ /* || au_test_btrfs(sb) */ /* untested */ -+ ; -+} -+ -+/* -+ * filesystems which don't maintain i_size or i_blocks. -+ */ -+static inline int au_test_fs_bad_iattr_size(struct super_block *sb) -+{ -+ return au_test_xfs(sb) -+ || au_test_btrfs(sb) -+ || au_test_ubifs(sb) -+ || au_test_hfsplus(sb) /* maintained, but incorrect */ -+ /* || au_test_minix(sb) */ /* untested */ -+ ; -+} -+ -+/* -+ * filesystems which don't store the correct value in some of their inode -+ * attributes. -+ */ -+static inline int au_test_fs_bad_iattr(struct super_block *sb) -+{ -+ return au_test_fs_bad_iattr_size(sb) -+ || au_test_fat(sb) -+ || au_test_msdos(sb) -+ || au_test_vfat(sb); -+} -+ -+/* they don't check i_nlink in link(2) */ -+static inline int au_test_fs_no_limit_nlink(struct super_block *sb) -+{ -+ return au_test_tmpfs(sb) -+#ifdef CONFIG_AUFS_BR_RAMFS -+ || au_test_ramfs(sb) -+#endif -+ || au_test_ubifs(sb) -+ || au_test_hfsplus(sb); -+} -+ -+/* -+ * filesystems which sets S_NOATIME and S_NOCMTIME. -+ */ -+static inline int au_test_fs_notime(struct super_block *sb) -+{ -+ return au_test_nfs(sb) -+ || au_test_fuse(sb) -+ || au_test_ubifs(sb) -+ ; -+} -+ -+/* temporary support for i#1 in cramfs */ -+static inline int au_test_fs_unique_ino(struct inode *inode) -+{ -+ if (au_test_cramfs(inode->i_sb)) -+ return inode->i_ino != 1; -+ return 1; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * the filesystem where the xino files placed must support i/o after unlink and -+ * maintain i_size and i_blocks. -+ */ -+static inline int au_test_fs_bad_xino(struct super_block *sb) -+{ -+ return au_test_fs_remote(sb) -+ || au_test_fs_bad_iattr_size(sb) -+ /* don't want unnecessary work for xino */ -+ || au_test_aufs(sb) -+ || au_test_ecryptfs(sb) -+ || au_test_nilfs(sb); -+} -+ -+static inline int au_test_fs_trunc_xino(struct super_block *sb) -+{ -+ return au_test_tmpfs(sb) -+ || au_test_ramfs(sb); -+} -+ -+/* -+ * test if the @sb is real-readonly. -+ */ -+static inline int au_test_fs_rr(struct super_block *sb) -+{ -+ return au_test_squashfs(sb) -+ || au_test_iso9660(sb) -+ || au_test_cramfs(sb) -+ || au_test_romfs(sb); -+} -+ -+/* -+ * test if the @inode is nfs with 'noacl' option -+ * NFS always sets MS_POSIXACL regardless its mount option 'noacl.' -+ */ -+static inline int au_test_nfs_noacl(struct inode *inode) -+{ -+ return au_test_nfs(inode->i_sb) -+ /* && IS_POSIXACL(inode) */ -+ && !nfs_server_capable(inode, NFS_CAP_ACLS); -+} -+ -+#endif /* __KERNEL__ */ -+#endif /* __AUFS_FSTYPE_H__ */ -diff --git a/fs/aufs/hfsnotify.c b/fs/aufs/hfsnotify.c -new file mode 100644 -index 0000000..110f8f5 ---- /dev/null -+++ b/fs/aufs/hfsnotify.c -@@ -0,0 +1,274 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * fsnotify for the lower directories -+ */ -+ -+#include "aufs.h" -+ -+/* FS_IN_IGNORED is unnecessary */ -+static const __u32 AuHfsnMask = (FS_MOVED_TO | FS_MOVED_FROM | FS_DELETE -+ | FS_CREATE | FS_EVENT_ON_CHILD); -+static DECLARE_WAIT_QUEUE_HEAD(au_hfsn_wq); -+static __cacheline_aligned_in_smp atomic64_t au_hfsn_ifree = ATOMIC64_INIT(0); -+ -+static void au_hfsn_free_mark(struct fsnotify_mark *mark) -+{ -+ struct au_hnotify *hn = container_of(mark, struct au_hnotify, -+ hn_mark); -+ /* AuDbg("here\n"); */ -+ au_cache_dfree_hnotify(hn); -+ smp_mb__before_atomic(); -+ if (atomic64_dec_and_test(&au_hfsn_ifree)) -+ wake_up(&au_hfsn_wq); -+} -+ -+static int au_hfsn_alloc(struct au_hinode *hinode) -+{ -+ int err; -+ struct au_hnotify *hn; -+ struct super_block *sb; -+ struct au_branch *br; -+ struct fsnotify_mark *mark; -+ aufs_bindex_t bindex; -+ -+ hn = hinode->hi_notify; -+ sb = hn->hn_aufs_inode->i_sb; -+ bindex = au_br_index(sb, hinode->hi_id); -+ br = au_sbr(sb, bindex); -+ AuDebugOn(!br->br_hfsn); -+ -+ mark = &hn->hn_mark; -+ fsnotify_init_mark(mark, au_hfsn_free_mark); -+ mark->mask = AuHfsnMask; -+ /* -+ * by udba rename or rmdir, aufs assign a new inode to the known -+ * h_inode, so specify 1 to allow dups. -+ */ -+ lockdep_off(); -+ err = fsnotify_add_mark(mark, br->br_hfsn->hfsn_group, hinode->hi_inode, -+ /*mnt*/NULL, /*allow_dups*/1); -+ lockdep_on(); -+ -+ return err; -+} -+ -+static int au_hfsn_free(struct au_hinode *hinode, struct au_hnotify *hn) -+{ -+ struct fsnotify_mark *mark; -+ unsigned long long ull; -+ struct fsnotify_group *group; -+ -+ ull = atomic64_inc_return(&au_hfsn_ifree); -+ BUG_ON(!ull); -+ -+ mark = &hn->hn_mark; -+ spin_lock(&mark->lock); -+ group = mark->group; -+ fsnotify_get_group(group); -+ spin_unlock(&mark->lock); -+ lockdep_off(); -+ fsnotify_destroy_mark(mark, group); -+ fsnotify_put_mark(mark); -+ fsnotify_put_group(group); -+ lockdep_on(); -+ -+ /* free hn by myself */ -+ return 0; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static void au_hfsn_ctl(struct au_hinode *hinode, int do_set) -+{ -+ struct fsnotify_mark *mark; -+ -+ mark = &hinode->hi_notify->hn_mark; -+ spin_lock(&mark->lock); -+ if (do_set) { -+ AuDebugOn(mark->mask & AuHfsnMask); -+ mark->mask |= AuHfsnMask; -+ } else { -+ AuDebugOn(!(mark->mask & AuHfsnMask)); -+ mark->mask &= ~AuHfsnMask; -+ } -+ spin_unlock(&mark->lock); -+ /* fsnotify_recalc_inode_mask(hinode->hi_inode); */ -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* #define AuDbgHnotify */ -+#ifdef AuDbgHnotify -+static char *au_hfsn_name(u32 mask) -+{ -+#ifdef CONFIG_AUFS_DEBUG -+#define test_ret(flag) \ -+ do { \ -+ if (mask & flag) \ -+ return #flag; \ -+ } while (0) -+ test_ret(FS_ACCESS); -+ test_ret(FS_MODIFY); -+ test_ret(FS_ATTRIB); -+ test_ret(FS_CLOSE_WRITE); -+ test_ret(FS_CLOSE_NOWRITE); -+ test_ret(FS_OPEN); -+ test_ret(FS_MOVED_FROM); -+ test_ret(FS_MOVED_TO); -+ test_ret(FS_CREATE); -+ test_ret(FS_DELETE); -+ test_ret(FS_DELETE_SELF); -+ test_ret(FS_MOVE_SELF); -+ test_ret(FS_UNMOUNT); -+ test_ret(FS_Q_OVERFLOW); -+ test_ret(FS_IN_IGNORED); -+ test_ret(FS_ISDIR); -+ test_ret(FS_IN_ONESHOT); -+ test_ret(FS_EVENT_ON_CHILD); -+ return ""; -+#undef test_ret -+#else -+ return "??"; -+#endif -+} -+#endif -+ -+/* ---------------------------------------------------------------------- */ -+ -+static void au_hfsn_free_group(struct fsnotify_group *group) -+{ -+ struct au_br_hfsnotify *hfsn = group->private; -+ -+ /* AuDbg("here\n"); */ -+ au_delayed_kfree(hfsn); -+} -+ -+static int au_hfsn_handle_event(struct fsnotify_group *group, -+ struct inode *inode, -+ struct fsnotify_mark *inode_mark, -+ struct fsnotify_mark *vfsmount_mark, -+ u32 mask, void *data, int data_type, -+ const unsigned char *file_name, u32 cookie) -+{ -+ int err; -+ struct au_hnotify *hnotify; -+ struct inode *h_dir, *h_inode; -+ struct qstr h_child_qstr = QSTR_INIT(file_name, strlen(file_name)); -+ -+ AuDebugOn(data_type != FSNOTIFY_EVENT_INODE); -+ -+ err = 0; -+ /* if FS_UNMOUNT happens, there must be another bug */ -+ AuDebugOn(mask & FS_UNMOUNT); -+ if (mask & (FS_IN_IGNORED | FS_UNMOUNT)) -+ goto out; -+ -+ h_dir = inode; -+ h_inode = NULL; -+#ifdef AuDbgHnotify -+ au_debug_on(); -+ if (1 || h_child_qstr.len != sizeof(AUFS_XINO_FNAME) - 1 -+ || strncmp(h_child_qstr.name, AUFS_XINO_FNAME, h_child_qstr.len)) { -+ AuDbg("i%lu, mask 0x%x %s, hcname %.*s, hi%lu\n", -+ h_dir->i_ino, mask, au_hfsn_name(mask), -+ AuLNPair(&h_child_qstr), h_inode ? h_inode->i_ino : 0); -+ /* WARN_ON(1); */ -+ } -+ au_debug_off(); -+#endif -+ -+ AuDebugOn(!inode_mark); -+ hnotify = container_of(inode_mark, struct au_hnotify, hn_mark); -+ err = au_hnotify(h_dir, hnotify, mask, &h_child_qstr, h_inode); -+ -+out: -+ return err; -+} -+ -+static struct fsnotify_ops au_hfsn_ops = { -+ .handle_event = au_hfsn_handle_event, -+ .free_group_priv = au_hfsn_free_group -+}; -+ -+/* ---------------------------------------------------------------------- */ -+ -+static void au_hfsn_fin_br(struct au_branch *br) -+{ -+ struct au_br_hfsnotify *hfsn; -+ -+ hfsn = br->br_hfsn; -+ if (hfsn) { -+ lockdep_off(); -+ fsnotify_put_group(hfsn->hfsn_group); -+ lockdep_on(); -+ } -+} -+ -+static int au_hfsn_init_br(struct au_branch *br, int perm) -+{ -+ int err; -+ struct fsnotify_group *group; -+ struct au_br_hfsnotify *hfsn; -+ -+ err = 0; -+ br->br_hfsn = NULL; -+ if (!au_br_hnotifyable(perm)) -+ goto out; -+ -+ err = -ENOMEM; -+ hfsn = kmalloc(sizeof(*hfsn), GFP_NOFS); -+ if (unlikely(!hfsn)) -+ goto out; -+ -+ err = 0; -+ group = fsnotify_alloc_group(&au_hfsn_ops); -+ if (IS_ERR(group)) { -+ err = PTR_ERR(group); -+ pr_err("fsnotify_alloc_group() failed, %d\n", err); -+ goto out_hfsn; -+ } -+ -+ group->private = hfsn; -+ hfsn->hfsn_group = group; -+ br->br_hfsn = hfsn; -+ goto out; /* success */ -+ -+out_hfsn: -+ au_delayed_kfree(hfsn); -+out: -+ return err; -+} -+ -+static int au_hfsn_reset_br(unsigned int udba, struct au_branch *br, int perm) -+{ -+ int err; -+ -+ err = 0; -+ if (!br->br_hfsn) -+ err = au_hfsn_init_br(br, perm); -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static void au_hfsn_fin(void) -+{ -+ AuDbg("au_hfsn_ifree %lld\n", (long long)atomic64_read(&au_hfsn_ifree)); -+ wait_event(au_hfsn_wq, !atomic64_read(&au_hfsn_ifree)); -+} -+ -+const struct au_hnotify_op au_hnotify_op = { -+ .ctl = au_hfsn_ctl, -+ .alloc = au_hfsn_alloc, -+ .free = au_hfsn_free, -+ -+ .fin = au_hfsn_fin, -+ -+ .reset_br = au_hfsn_reset_br, -+ .fin_br = au_hfsn_fin_br, -+ .init_br = au_hfsn_init_br -+}; -diff --git a/fs/aufs/hfsplus.c b/fs/aufs/hfsplus.c -new file mode 100644 -index 0000000..145c6ac ---- /dev/null -+++ b/fs/aufs/hfsplus.c -@@ -0,0 +1,43 @@ -+/* -+ * Copyright (C) 2010-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * special support for filesystems which aqucires an inode mutex -+ * at final closing a file, eg, hfsplus. -+ * -+ * This trick is very simple and stupid, just to open the file before really -+ * neceeary open to tell hfsplus that this is not the final closing. -+ * The caller should call au_h_open_pre() after acquiring the inode mutex, -+ * and au_h_open_post() after releasing it. -+ */ -+ -+#include "aufs.h" -+ -+struct file *au_h_open_pre(struct dentry *dentry, aufs_bindex_t bindex, -+ int force_wr) -+{ -+ struct file *h_file; -+ struct dentry *h_dentry; -+ -+ h_dentry = au_h_dptr(dentry, bindex); -+ AuDebugOn(!h_dentry); -+ AuDebugOn(d_is_negative(h_dentry)); -+ -+ h_file = NULL; -+ if (au_test_hfsplus(h_dentry->d_sb) -+ && d_is_reg(h_dentry)) -+ h_file = au_h_open(dentry, bindex, -+ O_RDONLY | O_NOATIME | O_LARGEFILE, -+ /*file*/NULL, force_wr); -+ return h_file; -+} -+ -+void au_h_open_post(struct dentry *dentry, aufs_bindex_t bindex, -+ struct file *h_file) -+{ -+ if (h_file) { -+ fput(h_file); -+ au_sbr_put(dentry->d_sb, bindex); -+ } -+} -diff --git a/fs/aufs/hnotify.c b/fs/aufs/hnotify.c -new file mode 100644 -index 0000000..a05aed8 ---- /dev/null -+++ b/fs/aufs/hnotify.c -@@ -0,0 +1,710 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * abstraction to notify the direct changes on lower directories -+ */ -+ -+#include "aufs.h" -+ -+int au_hn_alloc(struct au_hinode *hinode, struct inode *inode) -+{ -+ int err; -+ struct au_hnotify *hn; -+ -+ err = -ENOMEM; -+ hn = au_cache_alloc_hnotify(); -+ if (hn) { -+ hn->hn_aufs_inode = inode; -+ hinode->hi_notify = hn; -+ err = au_hnotify_op.alloc(hinode); -+ AuTraceErr(err); -+ if (unlikely(err)) { -+ hinode->hi_notify = NULL; -+ au_cache_dfree_hnotify(hn); -+ /* -+ * The upper dir was removed by udba, but the same named -+ * dir left. In this case, aufs assignes a new inode -+ * number and set the monitor again. -+ * For the lower dir, the old monitnor is still left. -+ */ -+ if (err == -EEXIST) -+ err = 0; -+ } -+ } -+ -+ AuTraceErr(err); -+ return err; -+} -+ -+void au_hn_free(struct au_hinode *hinode) -+{ -+ struct au_hnotify *hn; -+ -+ hn = hinode->hi_notify; -+ if (hn) { -+ hinode->hi_notify = NULL; -+ if (au_hnotify_op.free(hinode, hn)) -+ au_cache_dfree_hnotify(hn); -+ } -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+void au_hn_ctl(struct au_hinode *hinode, int do_set) -+{ -+ if (hinode->hi_notify) -+ au_hnotify_op.ctl(hinode, do_set); -+} -+ -+void au_hn_reset(struct inode *inode, unsigned int flags) -+{ -+ aufs_bindex_t bindex, bbot; -+ struct inode *hi; -+ struct dentry *iwhdentry; -+ -+ bbot = au_ibbot(inode); -+ for (bindex = au_ibtop(inode); bindex <= bbot; bindex++) { -+ hi = au_h_iptr(inode, bindex); -+ if (!hi) -+ continue; -+ -+ /* inode_lock_nested(hi, AuLsc_I_CHILD); */ -+ iwhdentry = au_hi_wh(inode, bindex); -+ if (iwhdentry) -+ dget(iwhdentry); -+ au_igrab(hi); -+ au_set_h_iptr(inode, bindex, NULL, 0); -+ au_set_h_iptr(inode, bindex, au_igrab(hi), -+ flags & ~AuHi_XINO); -+ iput(hi); -+ dput(iwhdentry); -+ /* inode_unlock(hi); */ -+ } -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int hn_xino(struct inode *inode, struct inode *h_inode) -+{ -+ int err; -+ aufs_bindex_t bindex, bbot, bfound, btop; -+ struct inode *h_i; -+ -+ err = 0; -+ if (unlikely(inode->i_ino == AUFS_ROOT_INO)) { -+ pr_warn("branch root dir was changed\n"); -+ goto out; -+ } -+ -+ bfound = -1; -+ bbot = au_ibbot(inode); -+ btop = au_ibtop(inode); -+#if 0 /* reserved for future use */ -+ if (bindex == bbot) { -+ /* keep this ino in rename case */ -+ goto out; -+ } -+#endif -+ for (bindex = btop; bindex <= bbot; bindex++) -+ if (au_h_iptr(inode, bindex) == h_inode) { -+ bfound = bindex; -+ break; -+ } -+ if (bfound < 0) -+ goto out; -+ -+ for (bindex = btop; bindex <= bbot; bindex++) { -+ h_i = au_h_iptr(inode, bindex); -+ if (!h_i) -+ continue; -+ -+ err = au_xino_write(inode->i_sb, bindex, h_i->i_ino, /*ino*/0); -+ /* ignore this error */ -+ /* bad action? */ -+ } -+ -+ /* children inode number will be broken */ -+ -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+static int hn_gen_tree(struct dentry *dentry) -+{ -+ int err, i, j, ndentry; -+ struct au_dcsub_pages dpages; -+ struct au_dpage *dpage; -+ struct dentry **dentries; -+ -+ err = au_dpages_init(&dpages, GFP_NOFS); -+ if (unlikely(err)) -+ goto out; -+ err = au_dcsub_pages(&dpages, dentry, NULL, NULL); -+ if (unlikely(err)) -+ goto out_dpages; -+ -+ for (i = 0; i < dpages.ndpage; i++) { -+ dpage = dpages.dpages + i; -+ dentries = dpage->dentries; -+ ndentry = dpage->ndentry; -+ for (j = 0; j < ndentry; j++) { -+ struct dentry *d; -+ -+ d = dentries[j]; -+ if (IS_ROOT(d)) -+ continue; -+ -+ au_digen_dec(d); -+ if (d_really_is_positive(d)) -+ /* todo: reset children xino? -+ cached children only? */ -+ au_iigen_dec(d_inode(d)); -+ } -+ } -+ -+out_dpages: -+ au_dpages_free(&dpages); -+ -+#if 0 -+ /* discard children */ -+ dentry_unhash(dentry); -+ dput(dentry); -+#endif -+out: -+ return err; -+} -+ -+/* -+ * return 0 if processed. -+ */ -+static int hn_gen_by_inode(char *name, unsigned int nlen, struct inode *inode, -+ const unsigned int isdir) -+{ -+ int err; -+ struct dentry *d; -+ struct qstr *dname; -+ -+ err = 1; -+ if (unlikely(inode->i_ino == AUFS_ROOT_INO)) { -+ pr_warn("branch root dir was changed\n"); -+ err = 0; -+ goto out; -+ } -+ -+ if (!isdir) { -+ AuDebugOn(!name); -+ au_iigen_dec(inode); -+ spin_lock(&inode->i_lock); -+ hlist_for_each_entry(d, &inode->i_dentry, d_u.d_alias) { -+ spin_lock(&d->d_lock); -+ dname = &d->d_name; -+ if (dname->len != nlen -+ && memcmp(dname->name, name, nlen)) { -+ spin_unlock(&d->d_lock); -+ continue; -+ } -+ err = 0; -+ au_digen_dec(d); -+ spin_unlock(&d->d_lock); -+ break; -+ } -+ spin_unlock(&inode->i_lock); -+ } else { -+ au_fset_si(au_sbi(inode->i_sb), FAILED_REFRESH_DIR); -+ d = d_find_any_alias(inode); -+ if (!d) { -+ au_iigen_dec(inode); -+ goto out; -+ } -+ -+ spin_lock(&d->d_lock); -+ dname = &d->d_name; -+ if (dname->len == nlen && !memcmp(dname->name, name, nlen)) { -+ spin_unlock(&d->d_lock); -+ err = hn_gen_tree(d); -+ spin_lock(&d->d_lock); -+ } -+ spin_unlock(&d->d_lock); -+ dput(d); -+ } -+ -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+static int hn_gen_by_name(struct dentry *dentry, const unsigned int isdir) -+{ -+ int err; -+ -+ if (IS_ROOT(dentry)) { -+ pr_warn("branch root dir was changed\n"); -+ return 0; -+ } -+ -+ err = 0; -+ if (!isdir) { -+ au_digen_dec(dentry); -+ if (d_really_is_positive(dentry)) -+ au_iigen_dec(d_inode(dentry)); -+ } else { -+ au_fset_si(au_sbi(dentry->d_sb), FAILED_REFRESH_DIR); -+ if (d_really_is_positive(dentry)) -+ err = hn_gen_tree(dentry); -+ } -+ -+ AuTraceErr(err); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* hnotify job flags */ -+#define AuHnJob_XINO0 1 -+#define AuHnJob_GEN (1 << 1) -+#define AuHnJob_DIRENT (1 << 2) -+#define AuHnJob_ISDIR (1 << 3) -+#define AuHnJob_TRYXINO0 (1 << 4) -+#define AuHnJob_MNTPNT (1 << 5) -+#define au_ftest_hnjob(flags, name) ((flags) & AuHnJob_##name) -+#define au_fset_hnjob(flags, name) \ -+ do { (flags) |= AuHnJob_##name; } while (0) -+#define au_fclr_hnjob(flags, name) \ -+ do { (flags) &= ~AuHnJob_##name; } while (0) -+ -+enum { -+ AuHn_CHILD, -+ AuHn_PARENT, -+ AuHnLast -+}; -+ -+struct au_hnotify_args { -+ struct inode *h_dir, *dir, *h_child_inode; -+ u32 mask; -+ unsigned int flags[AuHnLast]; -+ unsigned int h_child_nlen; -+ char h_child_name[]; -+}; -+ -+struct hn_job_args { -+ unsigned int flags; -+ struct inode *inode, *h_inode, *dir, *h_dir; -+ struct dentry *dentry; -+ char *h_name; -+ int h_nlen; -+}; -+ -+static int hn_job(struct hn_job_args *a) -+{ -+ const unsigned int isdir = au_ftest_hnjob(a->flags, ISDIR); -+ int e; -+ -+ /* reset xino */ -+ if (au_ftest_hnjob(a->flags, XINO0) && a->inode) -+ hn_xino(a->inode, a->h_inode); /* ignore this error */ -+ -+ if (au_ftest_hnjob(a->flags, TRYXINO0) -+ && a->inode -+ && a->h_inode) { -+ inode_lock_nested(a->h_inode, AuLsc_I_CHILD); -+ if (!a->h_inode->i_nlink -+ && !(a->h_inode->i_state & I_LINKABLE)) -+ hn_xino(a->inode, a->h_inode); /* ignore this error */ -+ inode_unlock(a->h_inode); -+ } -+ -+ /* make the generation obsolete */ -+ if (au_ftest_hnjob(a->flags, GEN)) { -+ e = -1; -+ if (a->inode) -+ e = hn_gen_by_inode(a->h_name, a->h_nlen, a->inode, -+ isdir); -+ if (e && a->dentry) -+ hn_gen_by_name(a->dentry, isdir); -+ /* ignore this error */ -+ } -+ -+ /* make dir entries obsolete */ -+ if (au_ftest_hnjob(a->flags, DIRENT) && a->inode) { -+ struct au_vdir *vdir; -+ -+ vdir = au_ivdir(a->inode); -+ if (vdir) -+ vdir->vd_jiffy = 0; -+ /* IMustLock(a->inode); */ -+ /* a->inode->i_version++; */ -+ } -+ -+ /* can do nothing but warn */ -+ if (au_ftest_hnjob(a->flags, MNTPNT) -+ && a->dentry -+ && d_mountpoint(a->dentry)) -+ pr_warn("mount-point %pd is removed or renamed\n", a->dentry); -+ -+ return 0; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static struct dentry *lookup_wlock_by_name(char *name, unsigned int nlen, -+ struct inode *dir) -+{ -+ struct dentry *dentry, *d, *parent; -+ struct qstr *dname; -+ -+ parent = d_find_any_alias(dir); -+ if (!parent) -+ return NULL; -+ -+ dentry = NULL; -+ spin_lock(&parent->d_lock); -+ list_for_each_entry(d, &parent->d_subdirs, d_child) { -+ /* AuDbg("%pd\n", d); */ -+ spin_lock_nested(&d->d_lock, DENTRY_D_LOCK_NESTED); -+ dname = &d->d_name; -+ if (dname->len != nlen || memcmp(dname->name, name, nlen)) -+ goto cont_unlock; -+ if (au_di(d)) -+ au_digen_dec(d); -+ else -+ goto cont_unlock; -+ if (au_dcount(d) > 0) { -+ dentry = dget_dlock(d); -+ spin_unlock(&d->d_lock); -+ break; -+ } -+ -+cont_unlock: -+ spin_unlock(&d->d_lock); -+ } -+ spin_unlock(&parent->d_lock); -+ dput(parent); -+ -+ if (dentry) -+ di_write_lock_child(dentry); -+ -+ return dentry; -+} -+ -+static struct inode *lookup_wlock_by_ino(struct super_block *sb, -+ aufs_bindex_t bindex, ino_t h_ino) -+{ -+ struct inode *inode; -+ ino_t ino; -+ int err; -+ -+ inode = NULL; -+ err = au_xino_read(sb, bindex, h_ino, &ino); -+ if (!err && ino) -+ inode = ilookup(sb, ino); -+ if (!inode) -+ goto out; -+ -+ if (unlikely(inode->i_ino == AUFS_ROOT_INO)) { -+ pr_warn("wrong root branch\n"); -+ iput(inode); -+ inode = NULL; -+ goto out; -+ } -+ -+ ii_write_lock_child(inode); -+ -+out: -+ return inode; -+} -+ -+static void au_hn_bh(void *_args) -+{ -+ struct au_hnotify_args *a = _args; -+ struct super_block *sb; -+ aufs_bindex_t bindex, bbot, bfound; -+ unsigned char xino, try_iput; -+ int err; -+ struct inode *inode; -+ ino_t h_ino; -+ struct hn_job_args args; -+ struct dentry *dentry; -+ struct au_sbinfo *sbinfo; -+ -+ AuDebugOn(!_args); -+ AuDebugOn(!a->h_dir); -+ AuDebugOn(!a->dir); -+ AuDebugOn(!a->mask); -+ AuDbg("mask 0x%x, i%lu, hi%lu, hci%lu\n", -+ a->mask, a->dir->i_ino, a->h_dir->i_ino, -+ a->h_child_inode ? a->h_child_inode->i_ino : 0); -+ -+ inode = NULL; -+ dentry = NULL; -+ /* -+ * do not lock a->dir->i_mutex here -+ * because of d_revalidate() may cause a deadlock. -+ */ -+ sb = a->dir->i_sb; -+ AuDebugOn(!sb); -+ sbinfo = au_sbi(sb); -+ AuDebugOn(!sbinfo); -+ si_write_lock(sb, AuLock_NOPLMW); -+ -+ ii_read_lock_parent(a->dir); -+ bfound = -1; -+ bbot = au_ibbot(a->dir); -+ for (bindex = au_ibtop(a->dir); bindex <= bbot; bindex++) -+ if (au_h_iptr(a->dir, bindex) == a->h_dir) { -+ bfound = bindex; -+ break; -+ } -+ ii_read_unlock(a->dir); -+ if (unlikely(bfound < 0)) -+ goto out; -+ -+ xino = !!au_opt_test(au_mntflags(sb), XINO); -+ h_ino = 0; -+ if (a->h_child_inode) -+ h_ino = a->h_child_inode->i_ino; -+ -+ if (a->h_child_nlen -+ && (au_ftest_hnjob(a->flags[AuHn_CHILD], GEN) -+ || au_ftest_hnjob(a->flags[AuHn_CHILD], MNTPNT))) -+ dentry = lookup_wlock_by_name(a->h_child_name, a->h_child_nlen, -+ a->dir); -+ try_iput = 0; -+ if (dentry && d_really_is_positive(dentry)) -+ inode = d_inode(dentry); -+ if (xino && !inode && h_ino -+ && (au_ftest_hnjob(a->flags[AuHn_CHILD], XINO0) -+ || au_ftest_hnjob(a->flags[AuHn_CHILD], TRYXINO0) -+ || au_ftest_hnjob(a->flags[AuHn_CHILD], GEN))) { -+ inode = lookup_wlock_by_ino(sb, bfound, h_ino); -+ try_iput = 1; -+ } -+ -+ args.flags = a->flags[AuHn_CHILD]; -+ args.dentry = dentry; -+ args.inode = inode; -+ args.h_inode = a->h_child_inode; -+ args.dir = a->dir; -+ args.h_dir = a->h_dir; -+ args.h_name = a->h_child_name; -+ args.h_nlen = a->h_child_nlen; -+ err = hn_job(&args); -+ if (dentry) { -+ if (au_di(dentry)) -+ di_write_unlock(dentry); -+ dput(dentry); -+ } -+ if (inode && try_iput) { -+ ii_write_unlock(inode); -+ iput(inode); -+ } -+ -+ ii_write_lock_parent(a->dir); -+ args.flags = a->flags[AuHn_PARENT]; -+ args.dentry = NULL; -+ args.inode = a->dir; -+ args.h_inode = a->h_dir; -+ args.dir = NULL; -+ args.h_dir = NULL; -+ args.h_name = NULL; -+ args.h_nlen = 0; -+ err = hn_job(&args); -+ ii_write_unlock(a->dir); -+ -+out: -+ iput(a->h_child_inode); -+ iput(a->h_dir); -+ iput(a->dir); -+ si_write_unlock(sb); -+ au_nwt_done(&sbinfo->si_nowait); -+ au_delayed_kfree(a); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+int au_hnotify(struct inode *h_dir, struct au_hnotify *hnotify, u32 mask, -+ struct qstr *h_child_qstr, struct inode *h_child_inode) -+{ -+ int err, len; -+ unsigned int flags[AuHnLast], f; -+ unsigned char isdir, isroot, wh; -+ struct inode *dir; -+ struct au_hnotify_args *args; -+ char *p, *h_child_name; -+ -+ err = 0; -+ AuDebugOn(!hnotify || !hnotify->hn_aufs_inode); -+ dir = igrab(hnotify->hn_aufs_inode); -+ if (!dir) -+ goto out; -+ -+ isroot = (dir->i_ino == AUFS_ROOT_INO); -+ wh = 0; -+ h_child_name = (void *)h_child_qstr->name; -+ len = h_child_qstr->len; -+ if (h_child_name) { -+ if (len > AUFS_WH_PFX_LEN -+ && !memcmp(h_child_name, AUFS_WH_PFX, AUFS_WH_PFX_LEN)) { -+ h_child_name += AUFS_WH_PFX_LEN; -+ len -= AUFS_WH_PFX_LEN; -+ wh = 1; -+ } -+ } -+ -+ isdir = 0; -+ if (h_child_inode) -+ isdir = !!S_ISDIR(h_child_inode->i_mode); -+ flags[AuHn_PARENT] = AuHnJob_ISDIR; -+ flags[AuHn_CHILD] = 0; -+ if (isdir) -+ flags[AuHn_CHILD] = AuHnJob_ISDIR; -+ au_fset_hnjob(flags[AuHn_PARENT], DIRENT); -+ au_fset_hnjob(flags[AuHn_CHILD], GEN); -+ switch (mask & FS_EVENTS_POSS_ON_CHILD) { -+ case FS_MOVED_FROM: -+ case FS_MOVED_TO: -+ au_fset_hnjob(flags[AuHn_CHILD], XINO0); -+ au_fset_hnjob(flags[AuHn_CHILD], MNTPNT); -+ /*FALLTHROUGH*/ -+ case FS_CREATE: -+ AuDebugOn(!h_child_name); -+ break; -+ -+ case FS_DELETE: -+ /* -+ * aufs never be able to get this child inode. -+ * revalidation should be in d_revalidate() -+ * by checking i_nlink, i_generation or d_unhashed(). -+ */ -+ AuDebugOn(!h_child_name); -+ au_fset_hnjob(flags[AuHn_CHILD], TRYXINO0); -+ au_fset_hnjob(flags[AuHn_CHILD], MNTPNT); -+ break; -+ -+ default: -+ AuDebugOn(1); -+ } -+ -+ if (wh) -+ h_child_inode = NULL; -+ -+ err = -ENOMEM; -+ /* iput() and kfree() will be called in au_hnotify() */ -+ args = kmalloc(sizeof(*args) + len + 1, GFP_NOFS); -+ if (unlikely(!args)) { -+ AuErr1("no memory\n"); -+ iput(dir); -+ goto out; -+ } -+ args->flags[AuHn_PARENT] = flags[AuHn_PARENT]; -+ args->flags[AuHn_CHILD] = flags[AuHn_CHILD]; -+ args->mask = mask; -+ args->dir = dir; -+ args->h_dir = igrab(h_dir); -+ if (h_child_inode) -+ h_child_inode = igrab(h_child_inode); /* can be NULL */ -+ args->h_child_inode = h_child_inode; -+ args->h_child_nlen = len; -+ if (len) { -+ p = (void *)args; -+ p += sizeof(*args); -+ memcpy(p, h_child_name, len); -+ p[len] = 0; -+ } -+ -+ /* NFS fires the event for silly-renamed one from kworker */ -+ f = 0; -+ if (!dir->i_nlink -+ || (au_test_nfs(h_dir->i_sb) && (mask & FS_DELETE))) -+ f = AuWkq_NEST; -+ err = au_wkq_nowait(au_hn_bh, args, dir->i_sb, f); -+ if (unlikely(err)) { -+ pr_err("wkq %d\n", err); -+ iput(args->h_child_inode); -+ iput(args->h_dir); -+ iput(args->dir); -+ au_delayed_kfree(args); -+ } -+ -+out: -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+int au_hnotify_reset_br(unsigned int udba, struct au_branch *br, int perm) -+{ -+ int err; -+ -+ AuDebugOn(!(udba & AuOptMask_UDBA)); -+ -+ err = 0; -+ if (au_hnotify_op.reset_br) -+ err = au_hnotify_op.reset_br(udba, br, perm); -+ -+ return err; -+} -+ -+int au_hnotify_init_br(struct au_branch *br, int perm) -+{ -+ int err; -+ -+ err = 0; -+ if (au_hnotify_op.init_br) -+ err = au_hnotify_op.init_br(br, perm); -+ -+ return err; -+} -+ -+void au_hnotify_fin_br(struct au_branch *br) -+{ -+ if (au_hnotify_op.fin_br) -+ au_hnotify_op.fin_br(br); -+} -+ -+static void au_hn_destroy_cache(void) -+{ -+ struct au_cache *cp; -+ -+ flush_delayed_work(&au_dfree.dwork); -+ cp = au_dfree.cache + AuCache_HNOTIFY; -+ AuDebugOn(!llist_empty(&cp->llist)); -+ kmem_cache_destroy(cp->cache); -+ cp->cache = NULL; -+} -+ -+AU_CACHE_DFREE_FUNC(hnotify, HNOTIFY, hn_lnode); -+ -+int __init au_hnotify_init(void) -+{ -+ int err; -+ struct au_cache *cp; -+ -+ err = -ENOMEM; -+ cp = au_dfree.cache + AuCache_HNOTIFY; -+ cp->cache = AuCache(au_hnotify); -+ if (cp->cache) { -+ err = 0; -+ if (au_hnotify_op.init) -+ err = au_hnotify_op.init(); -+ if (unlikely(err)) -+ au_hn_destroy_cache(); -+ } -+ AuTraceErr(err); -+ return err; -+} -+ -+void au_hnotify_fin(void) -+{ -+ struct au_cache *cp; -+ -+ if (au_hnotify_op.fin) -+ au_hnotify_op.fin(); -+ -+ /* cf. au_cache_fin() */ -+ cp = au_dfree.cache + AuCache_HNOTIFY; -+ if (cp->cache) -+ au_hn_destroy_cache(); -+} -diff --git a/fs/aufs/i_op.c b/fs/aufs/i_op.c -new file mode 100644 -index 0000000..c730ec7 ---- /dev/null -+++ b/fs/aufs/i_op.c -@@ -0,0 +1,1438 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * inode operations (except add/del/rename) -+ */ -+ -+#include -+#include -+#include -+#include -+#include "aufs.h" -+ -+static int h_permission(struct inode *h_inode, int mask, -+ struct path *h_path, int brperm) -+{ -+ int err; -+ const unsigned char write_mask = !!(mask & (MAY_WRITE | MAY_APPEND)); -+ -+ err = -EPERM; -+ if (write_mask && IS_IMMUTABLE(h_inode)) -+ goto out; -+ -+ err = -EACCES; -+ if (((mask & MAY_EXEC) -+ && S_ISREG(h_inode->i_mode) -+ && (path_noexec(h_path) -+ || !(h_inode->i_mode & S_IXUGO)))) -+ goto out; -+ -+ /* -+ * - skip the lower fs test in the case of write to ro branch. -+ * - nfs dir permission write check is optimized, but a policy for -+ * link/rename requires a real check. -+ * - nfs always sets MS_POSIXACL regardless its mount option 'noacl.' -+ * in this case, generic_permission() returns -EOPNOTSUPP. -+ */ -+ if ((write_mask && !au_br_writable(brperm)) -+ || (au_test_nfs(h_inode->i_sb) && S_ISDIR(h_inode->i_mode) -+ && write_mask && !(mask & MAY_READ)) -+ || !h_inode->i_op->permission) { -+ /* AuLabel(generic_permission); */ -+ /* AuDbg("get_acl %pf\n", h_inode->i_op->get_acl); */ -+ err = generic_permission(h_inode, mask); -+ if (err == -EOPNOTSUPP && au_test_nfs_noacl(h_inode)) -+ err = h_inode->i_op->permission(h_inode, mask); -+ AuTraceErr(err); -+ } else { -+ /* AuLabel(h_inode->permission); */ -+ err = h_inode->i_op->permission(h_inode, mask); -+ AuTraceErr(err); -+ } -+ -+ if (!err) -+ err = devcgroup_inode_permission(h_inode, mask); -+ if (!err) -+ err = security_inode_permission(h_inode, mask); -+ -+#if 0 -+ if (!err) { -+ /* todo: do we need to call ima_path_check()? */ -+ struct path h_path = { -+ .dentry = -+ .mnt = h_mnt -+ }; -+ err = ima_path_check(&h_path, -+ mask & (MAY_READ | MAY_WRITE | MAY_EXEC), -+ IMA_COUNT_LEAVE); -+ } -+#endif -+ -+out: -+ return err; -+} -+ -+static int aufs_permission(struct inode *inode, int mask) -+{ -+ int err; -+ aufs_bindex_t bindex, bbot; -+ const unsigned char isdir = !!S_ISDIR(inode->i_mode), -+ write_mask = !!(mask & (MAY_WRITE | MAY_APPEND)); -+ struct inode *h_inode; -+ struct super_block *sb; -+ struct au_branch *br; -+ -+ /* todo: support rcu-walk? */ -+ if (mask & MAY_NOT_BLOCK) -+ return -ECHILD; -+ -+ sb = inode->i_sb; -+ si_read_lock(sb, AuLock_FLUSH); -+ ii_read_lock_child(inode); -+#if 0 -+ err = au_iigen_test(inode, au_sigen(sb)); -+ if (unlikely(err)) -+ goto out; -+#endif -+ -+ if (!isdir -+ || write_mask -+ || au_opt_test(au_mntflags(sb), DIRPERM1)) { -+ err = au_busy_or_stale(); -+ h_inode = au_h_iptr(inode, au_ibtop(inode)); -+ if (unlikely(!h_inode -+ || (h_inode->i_mode & S_IFMT) -+ != (inode->i_mode & S_IFMT))) -+ goto out; -+ -+ err = 0; -+ bindex = au_ibtop(inode); -+ br = au_sbr(sb, bindex); -+ err = h_permission(h_inode, mask, &br->br_path, br->br_perm); -+ if (write_mask -+ && !err -+ && !special_file(h_inode->i_mode)) { -+ /* test whether the upper writable branch exists */ -+ err = -EROFS; -+ for (; bindex >= 0; bindex--) -+ if (!au_br_rdonly(au_sbr(sb, bindex))) { -+ err = 0; -+ break; -+ } -+ } -+ goto out; -+ } -+ -+ /* non-write to dir */ -+ err = 0; -+ bbot = au_ibbot(inode); -+ for (bindex = au_ibtop(inode); !err && bindex <= bbot; bindex++) { -+ h_inode = au_h_iptr(inode, bindex); -+ if (h_inode) { -+ err = au_busy_or_stale(); -+ if (unlikely(!S_ISDIR(h_inode->i_mode))) -+ break; -+ -+ br = au_sbr(sb, bindex); -+ err = h_permission(h_inode, mask, &br->br_path, -+ br->br_perm); -+ } -+ } -+ -+out: -+ ii_read_unlock(inode); -+ si_read_unlock(sb); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static struct dentry *aufs_lookup(struct inode *dir, struct dentry *dentry, -+ unsigned int flags) -+{ -+ struct dentry *ret, *parent; -+ struct inode *inode; -+ struct super_block *sb; -+ int err, npositive; -+ -+ IMustLock(dir); -+ -+ /* todo: support rcu-walk? */ -+ ret = ERR_PTR(-ECHILD); -+ if (flags & LOOKUP_RCU) -+ goto out; -+ -+ ret = ERR_PTR(-ENAMETOOLONG); -+ if (unlikely(dentry->d_name.len > AUFS_MAX_NAMELEN)) -+ goto out; -+ -+ sb = dir->i_sb; -+ err = si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLM); -+ ret = ERR_PTR(err); -+ if (unlikely(err)) -+ goto out; -+ -+ err = au_di_init(dentry); -+ ret = ERR_PTR(err); -+ if (unlikely(err)) -+ goto out_si; -+ -+ inode = NULL; -+ npositive = 0; /* suppress a warning */ -+ parent = dentry->d_parent; /* dir inode is locked */ -+ di_read_lock_parent(parent, AuLock_IR); -+ err = au_alive_dir(parent); -+ if (!err) -+ err = au_digen_test(parent, au_sigen(sb)); -+ if (!err) { -+ /* regardless LOOKUP_CREATE, always ALLOW_NEG */ -+ npositive = au_lkup_dentry(dentry, au_dbtop(parent), -+ AuLkup_ALLOW_NEG); -+ err = npositive; -+ } -+ di_read_unlock(parent, AuLock_IR); -+ ret = ERR_PTR(err); -+ if (unlikely(err < 0)) -+ goto out_unlock; -+ -+ if (npositive) { -+ inode = au_new_inode(dentry, /*must_new*/0); -+ if (IS_ERR(inode)) { -+ ret = (void *)inode; -+ inode = NULL; -+ goto out_unlock; -+ } -+ } -+ -+ if (inode) -+ atomic_inc(&inode->i_count); -+ ret = d_splice_alias(inode, dentry); -+#if 0 -+ if (unlikely(d_need_lookup(dentry))) { -+ spin_lock(&dentry->d_lock); -+ dentry->d_flags &= ~DCACHE_NEED_LOOKUP; -+ spin_unlock(&dentry->d_lock); -+ } else -+#endif -+ if (inode) { -+ if (!IS_ERR(ret)) { -+ iput(inode); -+ if (ret && ret != dentry) -+ ii_write_unlock(inode); -+ } else { -+ ii_write_unlock(inode); -+ iput(inode); -+ inode = NULL; -+ } -+ } -+ -+out_unlock: -+ di_write_unlock(dentry); -+out_si: -+ si_read_unlock(sb); -+out: -+ return ret; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+struct aopen_node { -+ struct hlist_node hlist; -+ struct file *file, *h_file; -+}; -+ -+static int au_do_aopen(struct inode *inode, struct file *file) -+{ -+ struct au_sphlhead *aopen; -+ struct aopen_node *node; -+ struct au_do_open_args args = { -+ .no_lock = 1, -+ .open = au_do_open_nondir -+ }; -+ -+ aopen = &au_sbi(inode->i_sb)->si_aopen; -+ spin_lock(&aopen->spin); -+ hlist_for_each_entry(node, &aopen->head, hlist) -+ if (node->file == file) { -+ args.h_file = node->h_file; -+ break; -+ } -+ spin_unlock(&aopen->spin); -+ /* AuDebugOn(!args.h_file); */ -+ -+ return au_do_open(file, &args); -+} -+ -+static int aufs_atomic_open(struct inode *dir, struct dentry *dentry, -+ struct file *file, unsigned int open_flag, -+ umode_t create_mode, int *opened) -+{ -+ int err, h_opened = *opened; -+ unsigned int lkup_flags; -+ struct dentry *parent, *d; -+ struct au_sphlhead *aopen; -+ struct vfsub_aopen_args args = { -+ .open_flag = open_flag, -+ .create_mode = create_mode, -+ .opened = &h_opened -+ }; -+ struct aopen_node aopen_node = { -+ .file = file -+ }; -+ -+ IMustLock(dir); -+ AuDbg("open_flag 0%o\n", open_flag); -+ AuDbgDentry(dentry); -+ -+ err = 0; -+ if (!au_di(dentry)) { -+ lkup_flags = LOOKUP_OPEN; -+ if (open_flag & O_CREAT) -+ lkup_flags |= LOOKUP_CREATE; -+ d = aufs_lookup(dir, dentry, lkup_flags); -+ if (IS_ERR(d)) { -+ err = PTR_ERR(d); -+ AuTraceErr(err); -+ goto out; -+ } else if (d) { -+ /* -+ * obsoleted dentry found. -+ * another error will be returned later. -+ */ -+ d_drop(d); -+ AuDbgDentry(d); -+ dput(d); -+ } -+ AuDbgDentry(dentry); -+ } -+ -+ if (d_is_positive(dentry) -+ || d_unhashed(dentry) -+ || d_unlinked(dentry) -+ || !(open_flag & O_CREAT)) -+ goto out_no_open; -+ -+ err = aufs_read_lock(dentry, AuLock_DW | AuLock_FLUSH | AuLock_GEN); -+ if (unlikely(err)) -+ goto out; -+ -+ parent = dentry->d_parent; /* dir is locked */ -+ di_write_lock_parent(parent); -+ err = au_lkup_dentry(dentry, /*btop*/0, AuLkup_ALLOW_NEG); -+ if (unlikely(err)) -+ goto out_unlock; -+ -+ AuDbgDentry(dentry); -+ if (d_is_positive(dentry)) -+ goto out_unlock; -+ -+ args.file = get_empty_filp(); -+ err = PTR_ERR(args.file); -+ if (IS_ERR(args.file)) -+ goto out_unlock; -+ -+ args.file->f_flags = file->f_flags; -+ err = au_aopen_or_create(dir, dentry, &args); -+ AuTraceErr(err); -+ AuDbgFile(args.file); -+ if (unlikely(err < 0)) { -+ if (h_opened & FILE_OPENED) -+ fput(args.file); -+ else -+ put_filp(args.file); -+ goto out_unlock; -+ } -+ -+ /* some filesystems don't set FILE_CREATED while succeeded? */ -+ *opened |= FILE_CREATED; -+ if (h_opened & FILE_OPENED) -+ aopen_node.h_file = args.file; -+ else { -+ put_filp(args.file); -+ args.file = NULL; -+ } -+ aopen = &au_sbi(dir->i_sb)->si_aopen; -+ au_sphl_add(&aopen_node.hlist, aopen); -+ err = finish_open(file, dentry, au_do_aopen, opened); -+ au_sphl_del(&aopen_node.hlist, aopen); -+ AuTraceErr(err); -+ AuDbgFile(file); -+ if (aopen_node.h_file) -+ fput(aopen_node.h_file); -+ -+out_unlock: -+ di_write_unlock(parent); -+ aufs_read_unlock(dentry, AuLock_DW); -+ AuDbgDentry(dentry); -+ if (unlikely(err < 0)) -+ goto out; -+out_no_open: -+ if (err >= 0 && !(*opened & FILE_CREATED)) { -+ AuLabel(out_no_open); -+ dget(dentry); -+ err = finish_no_open(file, dentry); -+ } -+out: -+ AuDbg("%pd%s%s\n", dentry, -+ (*opened & FILE_CREATED) ? " created" : "", -+ (*opened & FILE_OPENED) ? " opened" : ""); -+ AuTraceErr(err); -+ return err; -+} -+ -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int au_wr_dir_cpup(struct dentry *dentry, struct dentry *parent, -+ const unsigned char add_entry, aufs_bindex_t bcpup, -+ aufs_bindex_t btop) -+{ -+ int err; -+ struct dentry *h_parent; -+ struct inode *h_dir; -+ -+ if (add_entry) -+ IMustLock(d_inode(parent)); -+ else -+ di_write_lock_parent(parent); -+ -+ err = 0; -+ if (!au_h_dptr(parent, bcpup)) { -+ if (btop > bcpup) -+ err = au_cpup_dirs(dentry, bcpup); -+ else if (btop < bcpup) -+ err = au_cpdown_dirs(dentry, bcpup); -+ else -+ BUG(); -+ } -+ if (!err && add_entry && !au_ftest_wrdir(add_entry, TMPFILE)) { -+ h_parent = au_h_dptr(parent, bcpup); -+ h_dir = d_inode(h_parent); -+ inode_lock_nested(h_dir, AuLsc_I_PARENT); -+ err = au_lkup_neg(dentry, bcpup, /*wh*/0); -+ /* todo: no unlock here */ -+ inode_unlock(h_dir); -+ -+ AuDbg("bcpup %d\n", bcpup); -+ if (!err) { -+ if (d_really_is_negative(dentry)) -+ au_set_h_dptr(dentry, btop, NULL); -+ au_update_dbrange(dentry, /*do_put_zero*/0); -+ } -+ } -+ -+ if (!add_entry) -+ di_write_unlock(parent); -+ if (!err) -+ err = bcpup; /* success */ -+ -+ AuTraceErr(err); -+ return err; -+} -+ -+/* -+ * decide the branch and the parent dir where we will create a new entry. -+ * returns new bindex or an error. -+ * copyup the parent dir if needed. -+ */ -+int au_wr_dir(struct dentry *dentry, struct dentry *src_dentry, -+ struct au_wr_dir_args *args) -+{ -+ int err; -+ unsigned int flags; -+ aufs_bindex_t bcpup, btop, src_btop; -+ const unsigned char add_entry -+ = au_ftest_wrdir(args->flags, ADD_ENTRY) -+ | au_ftest_wrdir(args->flags, TMPFILE); -+ struct super_block *sb; -+ struct dentry *parent; -+ struct au_sbinfo *sbinfo; -+ -+ sb = dentry->d_sb; -+ sbinfo = au_sbi(sb); -+ parent = dget_parent(dentry); -+ btop = au_dbtop(dentry); -+ bcpup = btop; -+ if (args->force_btgt < 0) { -+ if (src_dentry) { -+ src_btop = au_dbtop(src_dentry); -+ if (src_btop < btop) -+ bcpup = src_btop; -+ } else if (add_entry) { -+ flags = 0; -+ if (au_ftest_wrdir(args->flags, ISDIR)) -+ au_fset_wbr(flags, DIR); -+ err = AuWbrCreate(sbinfo, dentry, flags); -+ bcpup = err; -+ } -+ -+ if (bcpup < 0 || au_test_ro(sb, bcpup, d_inode(dentry))) { -+ if (add_entry) -+ err = AuWbrCopyup(sbinfo, dentry); -+ else { -+ if (!IS_ROOT(dentry)) { -+ di_read_lock_parent(parent, !AuLock_IR); -+ err = AuWbrCopyup(sbinfo, dentry); -+ di_read_unlock(parent, !AuLock_IR); -+ } else -+ err = AuWbrCopyup(sbinfo, dentry); -+ } -+ bcpup = err; -+ if (unlikely(err < 0)) -+ goto out; -+ } -+ } else { -+ bcpup = args->force_btgt; -+ AuDebugOn(au_test_ro(sb, bcpup, d_inode(dentry))); -+ } -+ -+ AuDbg("btop %d, bcpup %d\n", btop, bcpup); -+ err = bcpup; -+ if (bcpup == btop) -+ goto out; /* success */ -+ -+ /* copyup the new parent into the branch we process */ -+ err = au_wr_dir_cpup(dentry, parent, add_entry, bcpup, btop); -+ if (err >= 0) { -+ if (d_really_is_negative(dentry)) { -+ au_set_h_dptr(dentry, btop, NULL); -+ au_set_dbtop(dentry, bcpup); -+ au_set_dbbot(dentry, bcpup); -+ } -+ AuDebugOn(add_entry -+ && !au_ftest_wrdir(args->flags, TMPFILE) -+ && !au_h_dptr(dentry, bcpup)); -+ } -+ -+out: -+ dput(parent); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+void au_pin_hdir_unlock(struct au_pin *p) -+{ -+ if (p->hdir) -+ au_hn_inode_unlock(p->hdir); -+} -+ -+int au_pin_hdir_lock(struct au_pin *p) -+{ -+ int err; -+ -+ err = 0; -+ if (!p->hdir) -+ goto out; -+ -+ /* even if an error happens later, keep this lock */ -+ au_hn_inode_lock_nested(p->hdir, p->lsc_hi); -+ -+ err = -EBUSY; -+ if (unlikely(p->hdir->hi_inode != d_inode(p->h_parent))) -+ goto out; -+ -+ err = 0; -+ if (p->h_dentry) -+ err = au_h_verify(p->h_dentry, p->udba, p->hdir->hi_inode, -+ p->h_parent, p->br); -+ -+out: -+ return err; -+} -+ -+int au_pin_hdir_relock(struct au_pin *p) -+{ -+ int err, i; -+ struct inode *h_i; -+ struct dentry *h_d[] = { -+ p->h_dentry, -+ p->h_parent -+ }; -+ -+ err = au_pin_hdir_lock(p); -+ if (unlikely(err)) -+ goto out; -+ -+ for (i = 0; !err && i < sizeof(h_d)/sizeof(*h_d); i++) { -+ if (!h_d[i]) -+ continue; -+ if (d_is_positive(h_d[i])) { -+ h_i = d_inode(h_d[i]); -+ err = !h_i->i_nlink; -+ } -+ } -+ -+out: -+ return err; -+} -+ -+static void au_pin_hdir_set_owner(struct au_pin *p, struct task_struct *task) -+{ -+#if !defined(CONFIG_RWSEM_GENERIC_SPINLOCK) && defined(CONFIG_RWSEM_SPIN_ON_OWNER) -+ p->hdir->hi_inode->i_rwsem.owner = task; -+#endif -+} -+ -+void au_pin_hdir_acquire_nest(struct au_pin *p) -+{ -+ if (p->hdir) { -+ rwsem_acquire_nest(&p->hdir->hi_inode->i_rwsem.dep_map, -+ p->lsc_hi, 0, NULL, _RET_IP_); -+ au_pin_hdir_set_owner(p, current); -+ } -+} -+ -+void au_pin_hdir_release(struct au_pin *p) -+{ -+ if (p->hdir) { -+ au_pin_hdir_set_owner(p, p->task); -+ rwsem_release(&p->hdir->hi_inode->i_rwsem.dep_map, 1, _RET_IP_); -+ } -+} -+ -+struct dentry *au_pinned_h_parent(struct au_pin *pin) -+{ -+ if (pin && pin->parent) -+ return au_h_dptr(pin->parent, pin->bindex); -+ return NULL; -+} -+ -+void au_unpin(struct au_pin *p) -+{ -+ if (p->hdir) -+ au_pin_hdir_unlock(p); -+ if (p->h_mnt && au_ftest_pin(p->flags, MNT_WRITE)) -+ vfsub_mnt_drop_write(p->h_mnt); -+ if (!p->hdir) -+ return; -+ -+ if (!au_ftest_pin(p->flags, DI_LOCKED)) -+ di_read_unlock(p->parent, AuLock_IR); -+ iput(p->hdir->hi_inode); -+ dput(p->parent); -+ p->parent = NULL; -+ p->hdir = NULL; -+ p->h_mnt = NULL; -+ /* do not clear p->task */ -+} -+ -+int au_do_pin(struct au_pin *p) -+{ -+ int err; -+ struct super_block *sb; -+ struct inode *h_dir; -+ -+ err = 0; -+ sb = p->dentry->d_sb; -+ p->br = au_sbr(sb, p->bindex); -+ if (IS_ROOT(p->dentry)) { -+ if (au_ftest_pin(p->flags, MNT_WRITE)) { -+ p->h_mnt = au_br_mnt(p->br); -+ err = vfsub_mnt_want_write(p->h_mnt); -+ if (unlikely(err)) { -+ au_fclr_pin(p->flags, MNT_WRITE); -+ goto out_err; -+ } -+ } -+ goto out; -+ } -+ -+ p->h_dentry = NULL; -+ if (p->bindex <= au_dbbot(p->dentry)) -+ p->h_dentry = au_h_dptr(p->dentry, p->bindex); -+ -+ p->parent = dget_parent(p->dentry); -+ if (!au_ftest_pin(p->flags, DI_LOCKED)) -+ di_read_lock(p->parent, AuLock_IR, p->lsc_di); -+ -+ h_dir = NULL; -+ p->h_parent = au_h_dptr(p->parent, p->bindex); -+ p->hdir = au_hi(d_inode(p->parent), p->bindex); -+ if (p->hdir) -+ h_dir = p->hdir->hi_inode; -+ -+ /* -+ * udba case, or -+ * if DI_LOCKED is not set, then p->parent may be different -+ * and h_parent can be NULL. -+ */ -+ if (unlikely(!p->hdir || !h_dir || !p->h_parent)) { -+ err = -EBUSY; -+ if (!au_ftest_pin(p->flags, DI_LOCKED)) -+ di_read_unlock(p->parent, AuLock_IR); -+ dput(p->parent); -+ p->parent = NULL; -+ goto out_err; -+ } -+ -+ if (au_ftest_pin(p->flags, MNT_WRITE)) { -+ p->h_mnt = au_br_mnt(p->br); -+ err = vfsub_mnt_want_write(p->h_mnt); -+ if (unlikely(err)) { -+ au_fclr_pin(p->flags, MNT_WRITE); -+ if (!au_ftest_pin(p->flags, DI_LOCKED)) -+ di_read_unlock(p->parent, AuLock_IR); -+ dput(p->parent); -+ p->parent = NULL; -+ goto out_err; -+ } -+ } -+ -+ au_igrab(h_dir); -+ err = au_pin_hdir_lock(p); -+ if (!err) -+ goto out; /* success */ -+ -+ au_unpin(p); -+ -+out_err: -+ pr_err("err %d\n", err); -+ err = au_busy_or_stale(); -+out: -+ return err; -+} -+ -+void au_pin_init(struct au_pin *p, struct dentry *dentry, -+ aufs_bindex_t bindex, int lsc_di, int lsc_hi, -+ unsigned int udba, unsigned char flags) -+{ -+ p->dentry = dentry; -+ p->udba = udba; -+ p->lsc_di = lsc_di; -+ p->lsc_hi = lsc_hi; -+ p->flags = flags; -+ p->bindex = bindex; -+ -+ p->parent = NULL; -+ p->hdir = NULL; -+ p->h_mnt = NULL; -+ -+ p->h_dentry = NULL; -+ p->h_parent = NULL; -+ p->br = NULL; -+ p->task = current; -+} -+ -+int au_pin(struct au_pin *pin, struct dentry *dentry, aufs_bindex_t bindex, -+ unsigned int udba, unsigned char flags) -+{ -+ au_pin_init(pin, dentry, bindex, AuLsc_DI_PARENT, AuLsc_I_PARENT2, -+ udba, flags); -+ return au_do_pin(pin); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * ->setattr() and ->getattr() are called in various cases. -+ * chmod, stat: dentry is revalidated. -+ * fchmod, fstat: file and dentry are not revalidated, additionally they may be -+ * unhashed. -+ * for ->setattr(), ia->ia_file is passed from ftruncate only. -+ */ -+/* todo: consolidate with do_refresh() and simple_reval_dpath() */ -+int au_reval_for_attr(struct dentry *dentry, unsigned int sigen) -+{ -+ int err; -+ struct dentry *parent; -+ -+ err = 0; -+ if (au_digen_test(dentry, sigen)) { -+ parent = dget_parent(dentry); -+ di_read_lock_parent(parent, AuLock_IR); -+ err = au_refresh_dentry(dentry, parent); -+ di_read_unlock(parent, AuLock_IR); -+ dput(parent); -+ } -+ -+ AuTraceErr(err); -+ return err; -+} -+ -+int au_pin_and_icpup(struct dentry *dentry, struct iattr *ia, -+ struct au_icpup_args *a) -+{ -+ int err; -+ loff_t sz; -+ aufs_bindex_t btop, ibtop; -+ struct dentry *hi_wh, *parent; -+ struct inode *inode; -+ struct au_wr_dir_args wr_dir_args = { -+ .force_btgt = -1, -+ .flags = 0 -+ }; -+ -+ if (d_is_dir(dentry)) -+ au_fset_wrdir(wr_dir_args.flags, ISDIR); -+ /* plink or hi_wh() case */ -+ btop = au_dbtop(dentry); -+ inode = d_inode(dentry); -+ ibtop = au_ibtop(inode); -+ if (btop != ibtop && !au_test_ro(inode->i_sb, ibtop, inode)) -+ wr_dir_args.force_btgt = ibtop; -+ err = au_wr_dir(dentry, /*src_dentry*/NULL, &wr_dir_args); -+ if (unlikely(err < 0)) -+ goto out; -+ a->btgt = err; -+ if (err != btop) -+ au_fset_icpup(a->flags, DID_CPUP); -+ -+ err = 0; -+ a->pin_flags = AuPin_MNT_WRITE; -+ parent = NULL; -+ if (!IS_ROOT(dentry)) { -+ au_fset_pin(a->pin_flags, DI_LOCKED); -+ parent = dget_parent(dentry); -+ di_write_lock_parent(parent); -+ } -+ -+ err = au_pin(&a->pin, dentry, a->btgt, a->udba, a->pin_flags); -+ if (unlikely(err)) -+ goto out_parent; -+ -+ sz = -1; -+ a->h_path.dentry = au_h_dptr(dentry, btop); -+ a->h_inode = d_inode(a->h_path.dentry); -+ if (ia && (ia->ia_valid & ATTR_SIZE)) { -+ inode_lock_nested(a->h_inode, AuLsc_I_CHILD); -+ if (ia->ia_size < i_size_read(a->h_inode)) -+ sz = ia->ia_size; -+ inode_unlock(a->h_inode); -+ } -+ -+ hi_wh = NULL; -+ if (au_ftest_icpup(a->flags, DID_CPUP) && d_unlinked(dentry)) { -+ hi_wh = au_hi_wh(inode, a->btgt); -+ if (!hi_wh) { -+ struct au_cp_generic cpg = { -+ .dentry = dentry, -+ .bdst = a->btgt, -+ .bsrc = -1, -+ .len = sz, -+ .pin = &a->pin -+ }; -+ err = au_sio_cpup_wh(&cpg, /*file*/NULL); -+ if (unlikely(err)) -+ goto out_unlock; -+ hi_wh = au_hi_wh(inode, a->btgt); -+ /* todo: revalidate hi_wh? */ -+ } -+ } -+ -+ if (parent) { -+ au_pin_set_parent_lflag(&a->pin, /*lflag*/0); -+ di_downgrade_lock(parent, AuLock_IR); -+ dput(parent); -+ parent = NULL; -+ } -+ if (!au_ftest_icpup(a->flags, DID_CPUP)) -+ goto out; /* success */ -+ -+ if (!d_unhashed(dentry)) { -+ struct au_cp_generic cpg = { -+ .dentry = dentry, -+ .bdst = a->btgt, -+ .bsrc = btop, -+ .len = sz, -+ .pin = &a->pin, -+ .flags = AuCpup_DTIME | AuCpup_HOPEN -+ }; -+ err = au_sio_cpup_simple(&cpg); -+ if (!err) -+ a->h_path.dentry = au_h_dptr(dentry, a->btgt); -+ } else if (!hi_wh) -+ a->h_path.dentry = au_h_dptr(dentry, a->btgt); -+ else -+ a->h_path.dentry = hi_wh; /* do not dget here */ -+ -+out_unlock: -+ a->h_inode = d_inode(a->h_path.dentry); -+ if (!err) -+ goto out; /* success */ -+ au_unpin(&a->pin); -+out_parent: -+ if (parent) { -+ di_write_unlock(parent); -+ dput(parent); -+ } -+out: -+ if (!err) -+ inode_lock_nested(a->h_inode, AuLsc_I_CHILD); -+ return err; -+} -+ -+static int aufs_setattr(struct dentry *dentry, struct iattr *ia) -+{ -+ int err; -+ struct inode *inode, *delegated; -+ struct super_block *sb; -+ struct file *file; -+ struct au_icpup_args *a; -+ -+ inode = d_inode(dentry); -+ IMustLock(inode); -+ -+ err = -ENOMEM; -+ a = kzalloc(sizeof(*a), GFP_NOFS); -+ if (unlikely(!a)) -+ goto out; -+ -+ if (ia->ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID)) -+ ia->ia_valid &= ~ATTR_MODE; -+ -+ file = NULL; -+ sb = dentry->d_sb; -+ err = si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLM); -+ if (unlikely(err)) -+ goto out_kfree; -+ -+ if (ia->ia_valid & ATTR_FILE) { -+ /* currently ftruncate(2) only */ -+ AuDebugOn(!d_is_reg(dentry)); -+ file = ia->ia_file; -+ err = au_reval_and_lock_fdi(file, au_reopen_nondir, /*wlock*/1); -+ if (unlikely(err)) -+ goto out_si; -+ ia->ia_file = au_hf_top(file); -+ a->udba = AuOpt_UDBA_NONE; -+ } else { -+ /* fchmod() doesn't pass ia_file */ -+ a->udba = au_opt_udba(sb); -+ di_write_lock_child(dentry); -+ /* no d_unlinked(), to set UDBA_NONE for root */ -+ if (d_unhashed(dentry)) -+ a->udba = AuOpt_UDBA_NONE; -+ if (a->udba != AuOpt_UDBA_NONE) { -+ AuDebugOn(IS_ROOT(dentry)); -+ err = au_reval_for_attr(dentry, au_sigen(sb)); -+ if (unlikely(err)) -+ goto out_dentry; -+ } -+ } -+ -+ err = au_pin_and_icpup(dentry, ia, a); -+ if (unlikely(err < 0)) -+ goto out_dentry; -+ if (au_ftest_icpup(a->flags, DID_CPUP)) { -+ ia->ia_file = NULL; -+ ia->ia_valid &= ~ATTR_FILE; -+ } -+ -+ a->h_path.mnt = au_sbr_mnt(sb, a->btgt); -+ if ((ia->ia_valid & (ATTR_MODE | ATTR_CTIME)) -+ == (ATTR_MODE | ATTR_CTIME)) { -+ err = security_path_chmod(&a->h_path, ia->ia_mode); -+ if (unlikely(err)) -+ goto out_unlock; -+ } else if ((ia->ia_valid & (ATTR_UID | ATTR_GID)) -+ && (ia->ia_valid & ATTR_CTIME)) { -+ err = security_path_chown(&a->h_path, ia->ia_uid, ia->ia_gid); -+ if (unlikely(err)) -+ goto out_unlock; -+ } -+ -+ if (ia->ia_valid & ATTR_SIZE) { -+ struct file *f; -+ -+ if (ia->ia_size < i_size_read(inode)) -+ /* unmap only */ -+ truncate_setsize(inode, ia->ia_size); -+ -+ f = NULL; -+ if (ia->ia_valid & ATTR_FILE) -+ f = ia->ia_file; -+ inode_unlock(a->h_inode); -+ err = vfsub_trunc(&a->h_path, ia->ia_size, ia->ia_valid, f); -+ inode_lock_nested(a->h_inode, AuLsc_I_CHILD); -+ } else { -+ delegated = NULL; -+ while (1) { -+ err = vfsub_notify_change(&a->h_path, ia, &delegated); -+ if (delegated) { -+ err = break_deleg_wait(&delegated); -+ if (!err) -+ continue; -+ } -+ break; -+ } -+ } -+ /* -+ * regardless aufs 'acl' option setting. -+ * why don't all acl-aware fs call this func from their ->setattr()? -+ */ -+ if (!err && (ia->ia_valid & ATTR_MODE)) -+ err = vfsub_acl_chmod(a->h_inode, ia->ia_mode); -+ if (!err) -+ au_cpup_attr_changeable(inode); -+ -+out_unlock: -+ inode_unlock(a->h_inode); -+ au_unpin(&a->pin); -+ if (unlikely(err)) -+ au_update_dbtop(dentry); -+out_dentry: -+ di_write_unlock(dentry); -+ if (file) { -+ fi_write_unlock(file); -+ ia->ia_file = file; -+ ia->ia_valid |= ATTR_FILE; -+ } -+out_si: -+ si_read_unlock(sb); -+out_kfree: -+ au_delayed_kfree(a); -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+#if IS_ENABLED(CONFIG_AUFS_XATTR) || IS_ENABLED(CONFIG_FS_POSIX_ACL) -+static int au_h_path_to_set_attr(struct dentry *dentry, -+ struct au_icpup_args *a, struct path *h_path) -+{ -+ int err; -+ struct super_block *sb; -+ -+ sb = dentry->d_sb; -+ a->udba = au_opt_udba(sb); -+ /* no d_unlinked(), to set UDBA_NONE for root */ -+ if (d_unhashed(dentry)) -+ a->udba = AuOpt_UDBA_NONE; -+ if (a->udba != AuOpt_UDBA_NONE) { -+ AuDebugOn(IS_ROOT(dentry)); -+ err = au_reval_for_attr(dentry, au_sigen(sb)); -+ if (unlikely(err)) -+ goto out; -+ } -+ err = au_pin_and_icpup(dentry, /*ia*/NULL, a); -+ if (unlikely(err < 0)) -+ goto out; -+ -+ h_path->dentry = a->h_path.dentry; -+ h_path->mnt = au_sbr_mnt(sb, a->btgt); -+ -+out: -+ return err; -+} -+ -+ssize_t au_srxattr(struct dentry *dentry, struct inode *inode, -+ struct au_srxattr *arg) -+{ -+ int err; -+ struct path h_path; -+ struct super_block *sb; -+ struct au_icpup_args *a; -+ struct inode *h_inode; -+ -+ IMustLock(inode); -+ -+ err = -ENOMEM; -+ a = kzalloc(sizeof(*a), GFP_NOFS); -+ if (unlikely(!a)) -+ goto out; -+ -+ sb = dentry->d_sb; -+ err = si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLM); -+ if (unlikely(err)) -+ goto out_kfree; -+ -+ h_path.dentry = NULL; /* silence gcc */ -+ di_write_lock_child(dentry); -+ err = au_h_path_to_set_attr(dentry, a, &h_path); -+ if (unlikely(err)) -+ goto out_di; -+ -+ inode_unlock(a->h_inode); -+ switch (arg->type) { -+ case AU_XATTR_SET: -+ AuDebugOn(d_is_negative(h_path.dentry)); -+ err = vfsub_setxattr(h_path.dentry, -+ arg->u.set.name, arg->u.set.value, -+ arg->u.set.size, arg->u.set.flags); -+ break; -+ case AU_XATTR_REMOVE: -+ err = vfsub_removexattr(h_path.dentry, arg->u.remove.name); -+ break; -+ case AU_ACL_SET: -+ err = -EOPNOTSUPP; -+ h_inode = d_inode(h_path.dentry); -+ if (h_inode->i_op->set_acl) -+ err = h_inode->i_op->set_acl(h_inode, -+ arg->u.acl_set.acl, -+ arg->u.acl_set.type); -+ break; -+ } -+ if (!err) -+ au_cpup_attr_timesizes(inode); -+ -+ au_unpin(&a->pin); -+ if (unlikely(err)) -+ au_update_dbtop(dentry); -+ -+out_di: -+ di_write_unlock(dentry); -+ si_read_unlock(sb); -+out_kfree: -+ au_delayed_kfree(a); -+out: -+ AuTraceErr(err); -+ return err; -+} -+#endif -+ -+static void au_refresh_iattr(struct inode *inode, struct kstat *st, -+ unsigned int nlink) -+{ -+ unsigned int n; -+ -+ inode->i_mode = st->mode; -+ /* don't i_[ug]id_write() here */ -+ inode->i_uid = st->uid; -+ inode->i_gid = st->gid; -+ inode->i_atime = st->atime; -+ inode->i_mtime = st->mtime; -+ inode->i_ctime = st->ctime; -+ -+ au_cpup_attr_nlink(inode, /*force*/0); -+ if (S_ISDIR(inode->i_mode)) { -+ n = inode->i_nlink; -+ n -= nlink; -+ n += st->nlink; -+ smp_mb(); /* for i_nlink */ -+ /* 0 can happen */ -+ set_nlink(inode, n); -+ } -+ -+ spin_lock(&inode->i_lock); -+ inode->i_blocks = st->blocks; -+ i_size_write(inode, st->size); -+ spin_unlock(&inode->i_lock); -+} -+ -+/* -+ * common routine for aufs_getattr() and aufs_getxattr(). -+ * returns zero or negative (an error). -+ * @dentry will be read-locked in success. -+ */ -+int au_h_path_getattr(struct dentry *dentry, int force, struct path *h_path) -+{ -+ int err; -+ unsigned int mnt_flags, sigen; -+ unsigned char udba_none; -+ aufs_bindex_t bindex; -+ struct super_block *sb, *h_sb; -+ struct inode *inode; -+ -+ h_path->mnt = NULL; -+ h_path->dentry = NULL; -+ -+ err = 0; -+ sb = dentry->d_sb; -+ mnt_flags = au_mntflags(sb); -+ udba_none = !!au_opt_test(mnt_flags, UDBA_NONE); -+ -+ /* support fstat(2) */ -+ if (!d_unlinked(dentry) && !udba_none) { -+ sigen = au_sigen(sb); -+ err = au_digen_test(dentry, sigen); -+ if (!err) { -+ di_read_lock_child(dentry, AuLock_IR); -+ err = au_dbrange_test(dentry); -+ if (unlikely(err)) { -+ di_read_unlock(dentry, AuLock_IR); -+ goto out; -+ } -+ } else { -+ AuDebugOn(IS_ROOT(dentry)); -+ di_write_lock_child(dentry); -+ err = au_dbrange_test(dentry); -+ if (!err) -+ err = au_reval_for_attr(dentry, sigen); -+ if (!err) -+ di_downgrade_lock(dentry, AuLock_IR); -+ else { -+ di_write_unlock(dentry); -+ goto out; -+ } -+ } -+ } else -+ di_read_lock_child(dentry, AuLock_IR); -+ -+ inode = d_inode(dentry); -+ bindex = au_ibtop(inode); -+ h_path->mnt = au_sbr_mnt(sb, bindex); -+ h_sb = h_path->mnt->mnt_sb; -+ if (!force -+ && !au_test_fs_bad_iattr(h_sb) -+ && udba_none) -+ goto out; /* success */ -+ -+ if (au_dbtop(dentry) == bindex) -+ h_path->dentry = au_h_dptr(dentry, bindex); -+ else if (au_opt_test(mnt_flags, PLINK) && au_plink_test(inode)) { -+ h_path->dentry = au_plink_lkup(inode, bindex); -+ if (IS_ERR(h_path->dentry)) -+ /* pretending success */ -+ h_path->dentry = NULL; -+ else -+ dput(h_path->dentry); -+ } -+ -+out: -+ return err; -+} -+ -+static int aufs_getattr(struct vfsmount *mnt __maybe_unused, -+ struct dentry *dentry, struct kstat *st) -+{ -+ int err; -+ unsigned char positive; -+ struct path h_path; -+ struct inode *inode; -+ struct super_block *sb; -+ -+ inode = d_inode(dentry); -+ sb = dentry->d_sb; -+ err = si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLM); -+ if (unlikely(err)) -+ goto out; -+ err = au_h_path_getattr(dentry, /*force*/0, &h_path); -+ if (unlikely(err)) -+ goto out_si; -+ if (unlikely(!h_path.dentry)) -+ /* illegally overlapped or something */ -+ goto out_fill; /* pretending success */ -+ -+ positive = d_is_positive(h_path.dentry); -+ if (positive) -+ err = vfs_getattr(&h_path, st); -+ if (!err) { -+ if (positive) -+ au_refresh_iattr(inode, st, -+ d_inode(h_path.dentry)->i_nlink); -+ goto out_fill; /* success */ -+ } -+ AuTraceErr(err); -+ goto out_di; -+ -+out_fill: -+ generic_fillattr(inode, st); -+out_di: -+ di_read_unlock(dentry, AuLock_IR); -+out_si: -+ si_read_unlock(sb); -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static const char *aufs_get_link(struct dentry *dentry, struct inode *inode, -+ struct delayed_call *done) -+{ -+ const char *ret; -+ struct dentry *h_dentry; -+ struct inode *h_inode; -+ int err; -+ aufs_bindex_t bindex; -+ -+ ret = NULL; /* suppress a warning */ -+ err = -ECHILD; -+ if (!dentry) -+ goto out; -+ -+ err = aufs_read_lock(dentry, AuLock_IR | AuLock_GEN); -+ if (unlikely(err)) -+ goto out; -+ -+ err = au_d_hashed_positive(dentry); -+ if (unlikely(err)) -+ goto out_unlock; -+ -+ err = -EINVAL; -+ inode = d_inode(dentry); -+ bindex = au_ibtop(inode); -+ h_inode = au_h_iptr(inode, bindex); -+ if (unlikely(!h_inode->i_op->get_link)) -+ goto out_unlock; -+ -+ err = -EBUSY; -+ h_dentry = NULL; -+ if (au_dbtop(dentry) <= bindex) { -+ h_dentry = au_h_dptr(dentry, bindex); -+ if (h_dentry) -+ dget(h_dentry); -+ } -+ if (!h_dentry) { -+ h_dentry = d_find_any_alias(h_inode); -+ if (IS_ERR(h_dentry)) { -+ err = PTR_ERR(h_dentry); -+ goto out_unlock; -+ } -+ } -+ if (unlikely(!h_dentry)) -+ goto out_unlock; -+ -+ err = 0; -+ AuDbg("%pf\n", h_inode->i_op->get_link); -+ AuDbgDentry(h_dentry); -+ ret = h_inode->i_op->get_link(h_dentry, h_inode, done); -+ dput(h_dentry); -+ if (IS_ERR(ret)) -+ err = PTR_ERR(ret); -+ -+out_unlock: -+ aufs_read_unlock(dentry, AuLock_IR); -+out: -+ if (unlikely(err)) -+ ret = ERR_PTR(err); -+ AuTraceErrPtr(ret); -+ return ret; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int au_is_special(struct inode *inode) -+{ -+ return (inode->i_mode & (S_IFBLK | S_IFCHR | S_IFIFO | S_IFSOCK)); -+} -+ -+static int aufs_update_time(struct inode *inode, struct timespec *ts, int flags) -+{ -+ int err; -+ aufs_bindex_t bindex; -+ struct super_block *sb; -+ struct inode *h_inode; -+ struct vfsmount *h_mnt; -+ -+ sb = inode->i_sb; -+ WARN_ONCE((flags & S_ATIME) && !IS_NOATIME(inode), -+ "unexpected s_flags 0x%lx", sb->s_flags); -+ -+ /* mmap_sem might be acquired already, cf. aufs_mmap() */ -+ lockdep_off(); -+ si_read_lock(sb, AuLock_FLUSH); -+ ii_write_lock_child(inode); -+ lockdep_on(); -+ -+ err = 0; -+ bindex = au_ibtop(inode); -+ h_inode = au_h_iptr(inode, bindex); -+ if (!au_test_ro(sb, bindex, inode)) { -+ h_mnt = au_sbr_mnt(sb, bindex); -+ err = vfsub_mnt_want_write(h_mnt); -+ if (!err) { -+ err = vfsub_update_time(h_inode, ts, flags); -+ vfsub_mnt_drop_write(h_mnt); -+ } -+ } else if (au_is_special(h_inode)) { -+ /* -+ * Never copy-up here. -+ * These special files may already be opened and used for -+ * communicating. If we copied it up, then the communication -+ * would be corrupted. -+ */ -+ AuWarn1("timestamps for i%lu are ignored " -+ "since it is on readonly branch (hi%lu).\n", -+ inode->i_ino, h_inode->i_ino); -+ } else if (flags & ~S_ATIME) { -+ err = -EIO; -+ AuIOErr1("unexpected flags 0x%x\n", flags); -+ AuDebugOn(1); -+ } -+ -+ lockdep_off(); -+ if (!err) -+ au_cpup_attr_timesizes(inode); -+ ii_write_unlock(inode); -+ si_read_unlock(sb); -+ lockdep_on(); -+ -+ if (!err && (flags & S_VERSION)) -+ inode_inc_iversion(inode); -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* no getattr version will be set by module.c:aufs_init() */ -+struct inode_operations aufs_iop_nogetattr[AuIop_Last], -+ aufs_iop[] = { -+ [AuIop_SYMLINK] = { -+ .permission = aufs_permission, -+#ifdef CONFIG_FS_POSIX_ACL -+ .get_acl = aufs_get_acl, -+ .set_acl = aufs_set_acl, /* unsupport for symlink? */ -+#endif -+ -+ .setattr = aufs_setattr, -+ .getattr = aufs_getattr, -+ -+#ifdef CONFIG_AUFS_XATTR -+ .setxattr = aufs_setxattr, -+ .getxattr = aufs_getxattr, -+ .listxattr = aufs_listxattr, -+ .removexattr = aufs_removexattr, -+#endif -+ -+ .readlink = generic_readlink, -+ .get_link = aufs_get_link, -+ -+ /* .update_time = aufs_update_time */ -+ }, -+ [AuIop_DIR] = { -+ .create = aufs_create, -+ .lookup = aufs_lookup, -+ .link = aufs_link, -+ .unlink = aufs_unlink, -+ .symlink = aufs_symlink, -+ .mkdir = aufs_mkdir, -+ .rmdir = aufs_rmdir, -+ .mknod = aufs_mknod, -+ .rename = aufs_rename, -+ -+ .permission = aufs_permission, -+#ifdef CONFIG_FS_POSIX_ACL -+ .get_acl = aufs_get_acl, -+ .set_acl = aufs_set_acl, -+#endif -+ -+ .setattr = aufs_setattr, -+ .getattr = aufs_getattr, -+ -+#ifdef CONFIG_AUFS_XATTR -+ .setxattr = aufs_setxattr, -+ .getxattr = aufs_getxattr, -+ .listxattr = aufs_listxattr, -+ .removexattr = aufs_removexattr, -+#endif -+ -+ .update_time = aufs_update_time, -+ .atomic_open = aufs_atomic_open, -+ .tmpfile = aufs_tmpfile -+ }, -+ [AuIop_OTHER] = { -+ .permission = aufs_permission, -+#ifdef CONFIG_FS_POSIX_ACL -+ .get_acl = aufs_get_acl, -+ .set_acl = aufs_set_acl, -+#endif -+ -+ .setattr = aufs_setattr, -+ .getattr = aufs_getattr, -+ -+#ifdef CONFIG_AUFS_XATTR -+ .setxattr = aufs_setxattr, -+ .getxattr = aufs_getxattr, -+ .listxattr = aufs_listxattr, -+ .removexattr = aufs_removexattr, -+#endif -+ -+ .update_time = aufs_update_time -+ } -+}; -diff --git a/fs/aufs/i_op_add.c b/fs/aufs/i_op_add.c -new file mode 100644 -index 0000000..2a9aa09 ---- /dev/null -+++ b/fs/aufs/i_op_add.c -@@ -0,0 +1,911 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * inode operations (add entry) -+ */ -+ -+#include "aufs.h" -+ -+/* -+ * final procedure of adding a new entry, except link(2). -+ * remove whiteout, instantiate, copyup the parent dir's times and size -+ * and update version. -+ * if it failed, re-create the removed whiteout. -+ */ -+static int epilog(struct inode *dir, aufs_bindex_t bindex, -+ struct dentry *wh_dentry, struct dentry *dentry) -+{ -+ int err, rerr; -+ aufs_bindex_t bwh; -+ struct path h_path; -+ struct super_block *sb; -+ struct inode *inode, *h_dir; -+ struct dentry *wh; -+ -+ bwh = -1; -+ sb = dir->i_sb; -+ if (wh_dentry) { -+ h_dir = d_inode(wh_dentry->d_parent); /* dir inode is locked */ -+ IMustLock(h_dir); -+ AuDebugOn(au_h_iptr(dir, bindex) != h_dir); -+ bwh = au_dbwh(dentry); -+ h_path.dentry = wh_dentry; -+ h_path.mnt = au_sbr_mnt(sb, bindex); -+ err = au_wh_unlink_dentry(au_h_iptr(dir, bindex), &h_path, -+ dentry); -+ if (unlikely(err)) -+ goto out; -+ } -+ -+ inode = au_new_inode(dentry, /*must_new*/1); -+ if (!IS_ERR(inode)) { -+ d_instantiate(dentry, inode); -+ dir = d_inode(dentry->d_parent); /* dir inode is locked */ -+ IMustLock(dir); -+ au_dir_ts(dir, bindex); -+ dir->i_version++; -+ au_fhsm_wrote(sb, bindex, /*force*/0); -+ return 0; /* success */ -+ } -+ -+ err = PTR_ERR(inode); -+ if (!wh_dentry) -+ goto out; -+ -+ /* revert */ -+ /* dir inode is locked */ -+ wh = au_wh_create(dentry, bwh, wh_dentry->d_parent); -+ rerr = PTR_ERR(wh); -+ if (IS_ERR(wh)) { -+ AuIOErr("%pd reverting whiteout failed(%d, %d)\n", -+ dentry, err, rerr); -+ err = -EIO; -+ } else -+ dput(wh); -+ -+out: -+ return err; -+} -+ -+static int au_d_may_add(struct dentry *dentry) -+{ -+ int err; -+ -+ err = 0; -+ if (unlikely(d_unhashed(dentry))) -+ err = -ENOENT; -+ if (unlikely(d_really_is_positive(dentry))) -+ err = -EEXIST; -+ return err; -+} -+ -+/* -+ * simple tests for the adding inode operations. -+ * following the checks in vfs, plus the parent-child relationship. -+ */ -+int au_may_add(struct dentry *dentry, aufs_bindex_t bindex, -+ struct dentry *h_parent, int isdir) -+{ -+ int err; -+ umode_t h_mode; -+ struct dentry *h_dentry; -+ struct inode *h_inode; -+ -+ err = -ENAMETOOLONG; -+ if (unlikely(dentry->d_name.len > AUFS_MAX_NAMELEN)) -+ goto out; -+ -+ h_dentry = au_h_dptr(dentry, bindex); -+ if (d_really_is_negative(dentry)) { -+ err = -EEXIST; -+ if (unlikely(d_is_positive(h_dentry))) -+ goto out; -+ } else { -+ /* rename(2) case */ -+ err = -EIO; -+ if (unlikely(d_is_negative(h_dentry))) -+ goto out; -+ h_inode = d_inode(h_dentry); -+ if (unlikely(!h_inode->i_nlink)) -+ goto out; -+ -+ h_mode = h_inode->i_mode; -+ if (!isdir) { -+ err = -EISDIR; -+ if (unlikely(S_ISDIR(h_mode))) -+ goto out; -+ } else if (unlikely(!S_ISDIR(h_mode))) { -+ err = -ENOTDIR; -+ goto out; -+ } -+ } -+ -+ err = 0; -+ /* expected parent dir is locked */ -+ if (unlikely(h_parent != h_dentry->d_parent)) -+ err = -EIO; -+ -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+/* -+ * initial procedure of adding a new entry. -+ * prepare writable branch and the parent dir, lock it, -+ * and lookup whiteout for the new entry. -+ */ -+static struct dentry* -+lock_hdir_lkup_wh(struct dentry *dentry, struct au_dtime *dt, -+ struct dentry *src_dentry, struct au_pin *pin, -+ struct au_wr_dir_args *wr_dir_args) -+{ -+ struct dentry *wh_dentry, *h_parent; -+ struct super_block *sb; -+ struct au_branch *br; -+ int err; -+ unsigned int udba; -+ aufs_bindex_t bcpup; -+ -+ AuDbg("%pd\n", dentry); -+ -+ err = au_wr_dir(dentry, src_dentry, wr_dir_args); -+ bcpup = err; -+ wh_dentry = ERR_PTR(err); -+ if (unlikely(err < 0)) -+ goto out; -+ -+ sb = dentry->d_sb; -+ udba = au_opt_udba(sb); -+ err = au_pin(pin, dentry, bcpup, udba, -+ AuPin_DI_LOCKED | AuPin_MNT_WRITE); -+ wh_dentry = ERR_PTR(err); -+ if (unlikely(err)) -+ goto out; -+ -+ h_parent = au_pinned_h_parent(pin); -+ if (udba != AuOpt_UDBA_NONE -+ && au_dbtop(dentry) == bcpup) -+ err = au_may_add(dentry, bcpup, h_parent, -+ au_ftest_wrdir(wr_dir_args->flags, ISDIR)); -+ else if (unlikely(dentry->d_name.len > AUFS_MAX_NAMELEN)) -+ err = -ENAMETOOLONG; -+ wh_dentry = ERR_PTR(err); -+ if (unlikely(err)) -+ goto out_unpin; -+ -+ br = au_sbr(sb, bcpup); -+ if (dt) { -+ struct path tmp = { -+ .dentry = h_parent, -+ .mnt = au_br_mnt(br) -+ }; -+ au_dtime_store(dt, au_pinned_parent(pin), &tmp); -+ } -+ -+ wh_dentry = NULL; -+ if (bcpup != au_dbwh(dentry)) -+ goto out; /* success */ -+ -+ /* -+ * ENAMETOOLONG here means that if we allowed create such name, then it -+ * would not be able to removed in the future. So we don't allow such -+ * name here and we don't handle ENAMETOOLONG differently here. -+ */ -+ wh_dentry = au_wh_lkup(h_parent, &dentry->d_name, br); -+ -+out_unpin: -+ if (IS_ERR(wh_dentry)) -+ au_unpin(pin); -+out: -+ return wh_dentry; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+enum { Mknod, Symlink, Creat }; -+struct simple_arg { -+ int type; -+ union { -+ struct { -+ umode_t mode; -+ bool want_excl; -+ bool try_aopen; -+ struct vfsub_aopen_args *aopen; -+ } c; -+ struct { -+ const char *symname; -+ } s; -+ struct { -+ umode_t mode; -+ dev_t dev; -+ } m; -+ } u; -+}; -+ -+static int add_simple(struct inode *dir, struct dentry *dentry, -+ struct simple_arg *arg) -+{ -+ int err, rerr; -+ aufs_bindex_t btop; -+ unsigned char created; -+ const unsigned char try_aopen -+ = (arg->type == Creat && arg->u.c.try_aopen); -+ struct dentry *wh_dentry, *parent; -+ struct inode *h_dir; -+ struct super_block *sb; -+ struct au_branch *br; -+ /* to reuduce stack size */ -+ struct { -+ struct au_dtime dt; -+ struct au_pin pin; -+ struct path h_path; -+ struct au_wr_dir_args wr_dir_args; -+ } *a; -+ -+ AuDbg("%pd\n", dentry); -+ IMustLock(dir); -+ -+ err = -ENOMEM; -+ a = kmalloc(sizeof(*a), GFP_NOFS); -+ if (unlikely(!a)) -+ goto out; -+ a->wr_dir_args.force_btgt = -1; -+ a->wr_dir_args.flags = AuWrDir_ADD_ENTRY; -+ -+ parent = dentry->d_parent; /* dir inode is locked */ -+ if (!try_aopen) { -+ err = aufs_read_lock(dentry, AuLock_DW | AuLock_GEN); -+ if (unlikely(err)) -+ goto out_free; -+ } -+ err = au_d_may_add(dentry); -+ if (unlikely(err)) -+ goto out_unlock; -+ if (!try_aopen) -+ di_write_lock_parent(parent); -+ wh_dentry = lock_hdir_lkup_wh(dentry, &a->dt, /*src_dentry*/NULL, -+ &a->pin, &a->wr_dir_args); -+ err = PTR_ERR(wh_dentry); -+ if (IS_ERR(wh_dentry)) -+ goto out_parent; -+ -+ btop = au_dbtop(dentry); -+ sb = dentry->d_sb; -+ br = au_sbr(sb, btop); -+ a->h_path.dentry = au_h_dptr(dentry, btop); -+ a->h_path.mnt = au_br_mnt(br); -+ h_dir = au_pinned_h_dir(&a->pin); -+ switch (arg->type) { -+ case Creat: -+ err = 0; -+ if (!try_aopen || !h_dir->i_op->atomic_open) -+ err = vfsub_create(h_dir, &a->h_path, arg->u.c.mode, -+ arg->u.c.want_excl); -+ else -+ err = vfsub_atomic_open(h_dir, a->h_path.dentry, -+ arg->u.c.aopen, br); -+ break; -+ case Symlink: -+ err = vfsub_symlink(h_dir, &a->h_path, arg->u.s.symname); -+ break; -+ case Mknod: -+ err = vfsub_mknod(h_dir, &a->h_path, arg->u.m.mode, -+ arg->u.m.dev); -+ break; -+ default: -+ BUG(); -+ } -+ created = !err; -+ if (!err) -+ err = epilog(dir, btop, wh_dentry, dentry); -+ -+ /* revert */ -+ if (unlikely(created && err && d_is_positive(a->h_path.dentry))) { -+ /* no delegation since it is just created */ -+ rerr = vfsub_unlink(h_dir, &a->h_path, /*delegated*/NULL, -+ /*force*/0); -+ if (rerr) { -+ AuIOErr("%pd revert failure(%d, %d)\n", -+ dentry, err, rerr); -+ err = -EIO; -+ } -+ au_dtime_revert(&a->dt); -+ } -+ -+ if (!err && try_aopen && !h_dir->i_op->atomic_open) -+ *arg->u.c.aopen->opened |= FILE_CREATED; -+ -+ au_unpin(&a->pin); -+ dput(wh_dentry); -+ -+out_parent: -+ if (!try_aopen) -+ di_write_unlock(parent); -+out_unlock: -+ if (unlikely(err)) { -+ au_update_dbtop(dentry); -+ d_drop(dentry); -+ } -+ if (!try_aopen) -+ aufs_read_unlock(dentry, AuLock_DW); -+out_free: -+ au_delayed_kfree(a); -+out: -+ return err; -+} -+ -+int aufs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, -+ dev_t dev) -+{ -+ struct simple_arg arg = { -+ .type = Mknod, -+ .u.m = { -+ .mode = mode, -+ .dev = dev -+ } -+ }; -+ return add_simple(dir, dentry, &arg); -+} -+ -+int aufs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) -+{ -+ struct simple_arg arg = { -+ .type = Symlink, -+ .u.s.symname = symname -+ }; -+ return add_simple(dir, dentry, &arg); -+} -+ -+int aufs_create(struct inode *dir, struct dentry *dentry, umode_t mode, -+ bool want_excl) -+{ -+ struct simple_arg arg = { -+ .type = Creat, -+ .u.c = { -+ .mode = mode, -+ .want_excl = want_excl -+ } -+ }; -+ return add_simple(dir, dentry, &arg); -+} -+ -+int au_aopen_or_create(struct inode *dir, struct dentry *dentry, -+ struct vfsub_aopen_args *aopen_args) -+{ -+ struct simple_arg arg = { -+ .type = Creat, -+ .u.c = { -+ .mode = aopen_args->create_mode, -+ .want_excl = aopen_args->open_flag & O_EXCL, -+ .try_aopen = true, -+ .aopen = aopen_args -+ } -+ }; -+ return add_simple(dir, dentry, &arg); -+} -+ -+int aufs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) -+{ -+ int err; -+ aufs_bindex_t bindex; -+ struct super_block *sb; -+ struct dentry *parent, *h_parent, *h_dentry; -+ struct inode *h_dir, *inode; -+ struct vfsmount *h_mnt; -+ struct au_wr_dir_args wr_dir_args = { -+ .force_btgt = -1, -+ .flags = AuWrDir_TMPFILE -+ }; -+ -+ /* copy-up may happen */ -+ inode_lock(dir); -+ -+ sb = dir->i_sb; -+ err = si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLM); -+ if (unlikely(err)) -+ goto out; -+ -+ err = au_di_init(dentry); -+ if (unlikely(err)) -+ goto out_si; -+ -+ err = -EBUSY; -+ parent = d_find_any_alias(dir); -+ AuDebugOn(!parent); -+ di_write_lock_parent(parent); -+ if (unlikely(d_inode(parent) != dir)) -+ goto out_parent; -+ -+ err = au_digen_test(parent, au_sigen(sb)); -+ if (unlikely(err)) -+ goto out_parent; -+ -+ bindex = au_dbtop(parent); -+ au_set_dbtop(dentry, bindex); -+ au_set_dbbot(dentry, bindex); -+ err = au_wr_dir(dentry, /*src_dentry*/NULL, &wr_dir_args); -+ bindex = err; -+ if (unlikely(err < 0)) -+ goto out_parent; -+ -+ err = -EOPNOTSUPP; -+ h_dir = au_h_iptr(dir, bindex); -+ if (unlikely(!h_dir->i_op->tmpfile)) -+ goto out_parent; -+ -+ h_mnt = au_sbr_mnt(sb, bindex); -+ err = vfsub_mnt_want_write(h_mnt); -+ if (unlikely(err)) -+ goto out_parent; -+ -+ h_parent = au_h_dptr(parent, bindex); -+ err = inode_permission(d_inode(h_parent), MAY_WRITE | MAY_EXEC); -+ if (unlikely(err)) -+ goto out_mnt; -+ -+ err = -ENOMEM; -+ h_dentry = d_alloc(h_parent, &dentry->d_name); -+ if (unlikely(!h_dentry)) -+ goto out_mnt; -+ -+ err = h_dir->i_op->tmpfile(h_dir, h_dentry, mode); -+ if (unlikely(err)) -+ goto out_dentry; -+ -+ au_set_dbtop(dentry, bindex); -+ au_set_dbbot(dentry, bindex); -+ au_set_h_dptr(dentry, bindex, dget(h_dentry)); -+ inode = au_new_inode(dentry, /*must_new*/1); -+ if (IS_ERR(inode)) { -+ err = PTR_ERR(inode); -+ au_set_h_dptr(dentry, bindex, NULL); -+ au_set_dbtop(dentry, -1); -+ au_set_dbbot(dentry, -1); -+ } else { -+ if (!inode->i_nlink) -+ set_nlink(inode, 1); -+ d_tmpfile(dentry, inode); -+ au_di(dentry)->di_tmpfile = 1; -+ -+ /* update without i_mutex */ -+ if (au_ibtop(dir) == au_dbtop(dentry)) -+ au_cpup_attr_timesizes(dir); -+ } -+ -+out_dentry: -+ dput(h_dentry); -+out_mnt: -+ vfsub_mnt_drop_write(h_mnt); -+out_parent: -+ di_write_unlock(parent); -+ dput(parent); -+ di_write_unlock(dentry); -+ if (unlikely(err)) { -+ au_di_fin(dentry); -+ dentry->d_fsdata = NULL; -+ } -+out_si: -+ si_read_unlock(sb); -+out: -+ inode_unlock(dir); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+struct au_link_args { -+ aufs_bindex_t bdst, bsrc; -+ struct au_pin pin; -+ struct path h_path; -+ struct dentry *src_parent, *parent; -+}; -+ -+static int au_cpup_before_link(struct dentry *src_dentry, -+ struct au_link_args *a) -+{ -+ int err; -+ struct dentry *h_src_dentry; -+ struct au_cp_generic cpg = { -+ .dentry = src_dentry, -+ .bdst = a->bdst, -+ .bsrc = a->bsrc, -+ .len = -1, -+ .pin = &a->pin, -+ .flags = AuCpup_DTIME | AuCpup_HOPEN /* | AuCpup_KEEPLINO */ -+ }; -+ -+ di_read_lock_parent(a->src_parent, AuLock_IR); -+ err = au_test_and_cpup_dirs(src_dentry, a->bdst); -+ if (unlikely(err)) -+ goto out; -+ -+ h_src_dentry = au_h_dptr(src_dentry, a->bsrc); -+ err = au_pin(&a->pin, src_dentry, a->bdst, -+ au_opt_udba(src_dentry->d_sb), -+ AuPin_DI_LOCKED | AuPin_MNT_WRITE); -+ if (unlikely(err)) -+ goto out; -+ -+ err = au_sio_cpup_simple(&cpg); -+ au_unpin(&a->pin); -+ -+out: -+ di_read_unlock(a->src_parent, AuLock_IR); -+ return err; -+} -+ -+static int au_cpup_or_link(struct dentry *src_dentry, struct dentry *dentry, -+ struct au_link_args *a) -+{ -+ int err; -+ unsigned char plink; -+ aufs_bindex_t bbot; -+ struct dentry *h_src_dentry; -+ struct inode *h_inode, *inode, *delegated; -+ struct super_block *sb; -+ struct file *h_file; -+ -+ plink = 0; -+ h_inode = NULL; -+ sb = src_dentry->d_sb; -+ inode = d_inode(src_dentry); -+ if (au_ibtop(inode) <= a->bdst) -+ h_inode = au_h_iptr(inode, a->bdst); -+ if (!h_inode || !h_inode->i_nlink) { -+ /* copyup src_dentry as the name of dentry. */ -+ bbot = au_dbbot(dentry); -+ if (bbot < a->bsrc) -+ au_set_dbbot(dentry, a->bsrc); -+ au_set_h_dptr(dentry, a->bsrc, -+ dget(au_h_dptr(src_dentry, a->bsrc))); -+ dget(a->h_path.dentry); -+ au_set_h_dptr(dentry, a->bdst, NULL); -+ AuDbg("temporary d_inode...\n"); -+ spin_lock(&dentry->d_lock); -+ dentry->d_inode = d_inode(src_dentry); /* tmp */ -+ spin_unlock(&dentry->d_lock); -+ h_file = au_h_open_pre(dentry, a->bsrc, /*force_wr*/0); -+ if (IS_ERR(h_file)) -+ err = PTR_ERR(h_file); -+ else { -+ struct au_cp_generic cpg = { -+ .dentry = dentry, -+ .bdst = a->bdst, -+ .bsrc = -1, -+ .len = -1, -+ .pin = &a->pin, -+ .flags = AuCpup_KEEPLINO -+ }; -+ err = au_sio_cpup_simple(&cpg); -+ au_h_open_post(dentry, a->bsrc, h_file); -+ if (!err) { -+ dput(a->h_path.dentry); -+ a->h_path.dentry = au_h_dptr(dentry, a->bdst); -+ } else -+ au_set_h_dptr(dentry, a->bdst, -+ a->h_path.dentry); -+ } -+ spin_lock(&dentry->d_lock); -+ dentry->d_inode = NULL; /* restore */ -+ spin_unlock(&dentry->d_lock); -+ AuDbg("temporary d_inode...done\n"); -+ au_set_h_dptr(dentry, a->bsrc, NULL); -+ au_set_dbbot(dentry, bbot); -+ } else { -+ /* the inode of src_dentry already exists on a.bdst branch */ -+ h_src_dentry = d_find_alias(h_inode); -+ if (!h_src_dentry && au_plink_test(inode)) { -+ plink = 1; -+ h_src_dentry = au_plink_lkup(inode, a->bdst); -+ err = PTR_ERR(h_src_dentry); -+ if (IS_ERR(h_src_dentry)) -+ goto out; -+ -+ if (unlikely(d_is_negative(h_src_dentry))) { -+ dput(h_src_dentry); -+ h_src_dentry = NULL; -+ } -+ -+ } -+ if (h_src_dentry) { -+ delegated = NULL; -+ err = vfsub_link(h_src_dentry, au_pinned_h_dir(&a->pin), -+ &a->h_path, &delegated); -+ if (unlikely(err == -EWOULDBLOCK)) { -+ pr_warn("cannot retry for NFSv4 delegation" -+ " for an internal link\n"); -+ iput(delegated); -+ } -+ dput(h_src_dentry); -+ } else { -+ AuIOErr("no dentry found for hi%lu on b%d\n", -+ h_inode->i_ino, a->bdst); -+ err = -EIO; -+ } -+ } -+ -+ if (!err && !plink) -+ au_plink_append(inode, a->bdst, a->h_path.dentry); -+ -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+int aufs_link(struct dentry *src_dentry, struct inode *dir, -+ struct dentry *dentry) -+{ -+ int err, rerr; -+ struct au_dtime dt; -+ struct au_link_args *a; -+ struct dentry *wh_dentry, *h_src_dentry; -+ struct inode *inode, *delegated; -+ struct super_block *sb; -+ struct au_wr_dir_args wr_dir_args = { -+ /* .force_btgt = -1, */ -+ .flags = AuWrDir_ADD_ENTRY -+ }; -+ -+ IMustLock(dir); -+ inode = d_inode(src_dentry); -+ IMustLock(inode); -+ -+ err = -ENOMEM; -+ a = kzalloc(sizeof(*a), GFP_NOFS); -+ if (unlikely(!a)) -+ goto out; -+ -+ a->parent = dentry->d_parent; /* dir inode is locked */ -+ err = aufs_read_and_write_lock2(dentry, src_dentry, -+ AuLock_NOPLM | AuLock_GEN); -+ if (unlikely(err)) -+ goto out_kfree; -+ err = au_d_linkable(src_dentry); -+ if (unlikely(err)) -+ goto out_unlock; -+ err = au_d_may_add(dentry); -+ if (unlikely(err)) -+ goto out_unlock; -+ -+ a->src_parent = dget_parent(src_dentry); -+ wr_dir_args.force_btgt = au_ibtop(inode); -+ -+ di_write_lock_parent(a->parent); -+ wr_dir_args.force_btgt = au_wbr(dentry, wr_dir_args.force_btgt); -+ wh_dentry = lock_hdir_lkup_wh(dentry, &dt, src_dentry, &a->pin, -+ &wr_dir_args); -+ err = PTR_ERR(wh_dentry); -+ if (IS_ERR(wh_dentry)) -+ goto out_parent; -+ -+ err = 0; -+ sb = dentry->d_sb; -+ a->bdst = au_dbtop(dentry); -+ a->h_path.dentry = au_h_dptr(dentry, a->bdst); -+ a->h_path.mnt = au_sbr_mnt(sb, a->bdst); -+ a->bsrc = au_ibtop(inode); -+ h_src_dentry = au_h_d_alias(src_dentry, a->bsrc); -+ if (!h_src_dentry && au_di(src_dentry)->di_tmpfile) -+ h_src_dentry = dget(au_hi_wh(inode, a->bsrc)); -+ if (!h_src_dentry) { -+ a->bsrc = au_dbtop(src_dentry); -+ h_src_dentry = au_h_d_alias(src_dentry, a->bsrc); -+ AuDebugOn(!h_src_dentry); -+ } else if (IS_ERR(h_src_dentry)) { -+ err = PTR_ERR(h_src_dentry); -+ goto out_parent; -+ } -+ -+ if (au_opt_test(au_mntflags(sb), PLINK)) { -+ if (a->bdst < a->bsrc -+ /* && h_src_dentry->d_sb != a->h_path.dentry->d_sb */) -+ err = au_cpup_or_link(src_dentry, dentry, a); -+ else { -+ delegated = NULL; -+ err = vfsub_link(h_src_dentry, au_pinned_h_dir(&a->pin), -+ &a->h_path, &delegated); -+ if (unlikely(err == -EWOULDBLOCK)) { -+ pr_warn("cannot retry for NFSv4 delegation" -+ " for an internal link\n"); -+ iput(delegated); -+ } -+ } -+ dput(h_src_dentry); -+ } else { -+ /* -+ * copyup src_dentry to the branch we process, -+ * and then link(2) to it. -+ */ -+ dput(h_src_dentry); -+ if (a->bdst < a->bsrc -+ /* && h_src_dentry->d_sb != a->h_path.dentry->d_sb */) { -+ au_unpin(&a->pin); -+ di_write_unlock(a->parent); -+ err = au_cpup_before_link(src_dentry, a); -+ di_write_lock_parent(a->parent); -+ if (!err) -+ err = au_pin(&a->pin, dentry, a->bdst, -+ au_opt_udba(sb), -+ AuPin_DI_LOCKED | AuPin_MNT_WRITE); -+ if (unlikely(err)) -+ goto out_wh; -+ } -+ if (!err) { -+ h_src_dentry = au_h_dptr(src_dentry, a->bdst); -+ err = -ENOENT; -+ if (h_src_dentry && d_is_positive(h_src_dentry)) { -+ delegated = NULL; -+ err = vfsub_link(h_src_dentry, -+ au_pinned_h_dir(&a->pin), -+ &a->h_path, &delegated); -+ if (unlikely(err == -EWOULDBLOCK)) { -+ pr_warn("cannot retry" -+ " for NFSv4 delegation" -+ " for an internal link\n"); -+ iput(delegated); -+ } -+ } -+ } -+ } -+ if (unlikely(err)) -+ goto out_unpin; -+ -+ if (wh_dentry) { -+ a->h_path.dentry = wh_dentry; -+ err = au_wh_unlink_dentry(au_pinned_h_dir(&a->pin), &a->h_path, -+ dentry); -+ if (unlikely(err)) -+ goto out_revert; -+ } -+ -+ au_dir_ts(dir, a->bdst); -+ dir->i_version++; -+ inc_nlink(inode); -+ inode->i_ctime = dir->i_ctime; -+ d_instantiate(dentry, au_igrab(inode)); -+ if (d_unhashed(a->h_path.dentry)) -+ /* some filesystem calls d_drop() */ -+ d_drop(dentry); -+ /* some filesystems consume an inode even hardlink */ -+ au_fhsm_wrote(sb, a->bdst, /*force*/0); -+ goto out_unpin; /* success */ -+ -+out_revert: -+ /* no delegation since it is just created */ -+ rerr = vfsub_unlink(au_pinned_h_dir(&a->pin), &a->h_path, -+ /*delegated*/NULL, /*force*/0); -+ if (unlikely(rerr)) { -+ AuIOErr("%pd reverting failed(%d, %d)\n", dentry, err, rerr); -+ err = -EIO; -+ } -+ au_dtime_revert(&dt); -+out_unpin: -+ au_unpin(&a->pin); -+out_wh: -+ dput(wh_dentry); -+out_parent: -+ di_write_unlock(a->parent); -+ dput(a->src_parent); -+out_unlock: -+ if (unlikely(err)) { -+ au_update_dbtop(dentry); -+ d_drop(dentry); -+ } -+ aufs_read_and_write_unlock2(dentry, src_dentry); -+out_kfree: -+ au_delayed_kfree(a); -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+int aufs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) -+{ -+ int err, rerr; -+ aufs_bindex_t bindex; -+ unsigned char diropq; -+ struct path h_path; -+ struct dentry *wh_dentry, *parent, *opq_dentry; -+ struct inode *h_inode; -+ struct super_block *sb; -+ struct { -+ struct au_pin pin; -+ struct au_dtime dt; -+ } *a; /* reduce the stack usage */ -+ struct au_wr_dir_args wr_dir_args = { -+ .force_btgt = -1, -+ .flags = AuWrDir_ADD_ENTRY | AuWrDir_ISDIR -+ }; -+ -+ IMustLock(dir); -+ -+ err = -ENOMEM; -+ a = kmalloc(sizeof(*a), GFP_NOFS); -+ if (unlikely(!a)) -+ goto out; -+ -+ err = aufs_read_lock(dentry, AuLock_DW | AuLock_GEN); -+ if (unlikely(err)) -+ goto out_free; -+ err = au_d_may_add(dentry); -+ if (unlikely(err)) -+ goto out_unlock; -+ -+ parent = dentry->d_parent; /* dir inode is locked */ -+ di_write_lock_parent(parent); -+ wh_dentry = lock_hdir_lkup_wh(dentry, &a->dt, /*src_dentry*/NULL, -+ &a->pin, &wr_dir_args); -+ err = PTR_ERR(wh_dentry); -+ if (IS_ERR(wh_dentry)) -+ goto out_parent; -+ -+ sb = dentry->d_sb; -+ bindex = au_dbtop(dentry); -+ h_path.dentry = au_h_dptr(dentry, bindex); -+ h_path.mnt = au_sbr_mnt(sb, bindex); -+ err = vfsub_mkdir(au_pinned_h_dir(&a->pin), &h_path, mode); -+ if (unlikely(err)) -+ goto out_unpin; -+ -+ /* make the dir opaque */ -+ diropq = 0; -+ h_inode = d_inode(h_path.dentry); -+ if (wh_dentry -+ || au_opt_test(au_mntflags(sb), ALWAYS_DIROPQ)) { -+ inode_lock_nested(h_inode, AuLsc_I_CHILD); -+ opq_dentry = au_diropq_create(dentry, bindex); -+ inode_unlock(h_inode); -+ err = PTR_ERR(opq_dentry); -+ if (IS_ERR(opq_dentry)) -+ goto out_dir; -+ dput(opq_dentry); -+ diropq = 1; -+ } -+ -+ err = epilog(dir, bindex, wh_dentry, dentry); -+ if (!err) { -+ inc_nlink(dir); -+ goto out_unpin; /* success */ -+ } -+ -+ /* revert */ -+ if (diropq) { -+ AuLabel(revert opq); -+ inode_lock_nested(h_inode, AuLsc_I_CHILD); -+ rerr = au_diropq_remove(dentry, bindex); -+ inode_unlock(h_inode); -+ if (rerr) { -+ AuIOErr("%pd reverting diropq failed(%d, %d)\n", -+ dentry, err, rerr); -+ err = -EIO; -+ } -+ } -+ -+out_dir: -+ AuLabel(revert dir); -+ rerr = vfsub_rmdir(au_pinned_h_dir(&a->pin), &h_path); -+ if (rerr) { -+ AuIOErr("%pd reverting dir failed(%d, %d)\n", -+ dentry, err, rerr); -+ err = -EIO; -+ } -+ au_dtime_revert(&a->dt); -+out_unpin: -+ au_unpin(&a->pin); -+ dput(wh_dentry); -+out_parent: -+ di_write_unlock(parent); -+out_unlock: -+ if (unlikely(err)) { -+ au_update_dbtop(dentry); -+ d_drop(dentry); -+ } -+ aufs_read_unlock(dentry, AuLock_DW); -+out_free: -+ au_delayed_kfree(a); -+out: -+ return err; -+} -diff --git a/fs/aufs/i_op_del.c b/fs/aufs/i_op_del.c -new file mode 100644 -index 0000000..2fe8f07 ---- /dev/null -+++ b/fs/aufs/i_op_del.c -@@ -0,0 +1,498 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * inode operations (del entry) -+ */ -+ -+#include "aufs.h" -+ -+/* -+ * decide if a new whiteout for @dentry is necessary or not. -+ * when it is necessary, prepare the parent dir for the upper branch whose -+ * branch index is @bcpup for creation. the actual creation of the whiteout will -+ * be done by caller. -+ * return value: -+ * 0: wh is unnecessary -+ * plus: wh is necessary -+ * minus: error -+ */ -+int au_wr_dir_need_wh(struct dentry *dentry, int isdir, aufs_bindex_t *bcpup) -+{ -+ int need_wh, err; -+ aufs_bindex_t btop; -+ struct super_block *sb; -+ -+ sb = dentry->d_sb; -+ btop = au_dbtop(dentry); -+ if (*bcpup < 0) { -+ *bcpup = btop; -+ if (au_test_ro(sb, btop, d_inode(dentry))) { -+ err = AuWbrCopyup(au_sbi(sb), dentry); -+ *bcpup = err; -+ if (unlikely(err < 0)) -+ goto out; -+ } -+ } else -+ AuDebugOn(btop < *bcpup -+ || au_test_ro(sb, *bcpup, d_inode(dentry))); -+ AuDbg("bcpup %d, btop %d\n", *bcpup, btop); -+ -+ if (*bcpup != btop) { -+ err = au_cpup_dirs(dentry, *bcpup); -+ if (unlikely(err)) -+ goto out; -+ need_wh = 1; -+ } else { -+ struct au_dinfo *dinfo, *tmp; -+ -+ need_wh = -ENOMEM; -+ dinfo = au_di(dentry); -+ tmp = au_di_alloc(sb, AuLsc_DI_TMP); -+ if (tmp) { -+ au_di_cp(tmp, dinfo); -+ au_di_swap(tmp, dinfo); -+ /* returns the number of positive dentries */ -+ need_wh = au_lkup_dentry(dentry, btop + 1, -+ /* AuLkup_IGNORE_PERM */ 0); -+ au_di_swap(tmp, dinfo); -+ au_rw_write_unlock(&tmp->di_rwsem); -+ au_di_free(tmp); -+ } -+ } -+ AuDbg("need_wh %d\n", need_wh); -+ err = need_wh; -+ -+out: -+ return err; -+} -+ -+/* -+ * simple tests for the del-entry operations. -+ * following the checks in vfs, plus the parent-child relationship. -+ */ -+int au_may_del(struct dentry *dentry, aufs_bindex_t bindex, -+ struct dentry *h_parent, int isdir) -+{ -+ int err; -+ umode_t h_mode; -+ struct dentry *h_dentry, *h_latest; -+ struct inode *h_inode; -+ -+ h_dentry = au_h_dptr(dentry, bindex); -+ if (d_really_is_positive(dentry)) { -+ err = -ENOENT; -+ if (unlikely(d_is_negative(h_dentry))) -+ goto out; -+ h_inode = d_inode(h_dentry); -+ if (unlikely(!h_inode->i_nlink)) -+ goto out; -+ -+ h_mode = h_inode->i_mode; -+ if (!isdir) { -+ err = -EISDIR; -+ if (unlikely(S_ISDIR(h_mode))) -+ goto out; -+ } else if (unlikely(!S_ISDIR(h_mode))) { -+ err = -ENOTDIR; -+ goto out; -+ } -+ } else { -+ /* rename(2) case */ -+ err = -EIO; -+ if (unlikely(d_is_positive(h_dentry))) -+ goto out; -+ } -+ -+ err = -ENOENT; -+ /* expected parent dir is locked */ -+ if (unlikely(h_parent != h_dentry->d_parent)) -+ goto out; -+ err = 0; -+ -+ /* -+ * rmdir a dir may break the consistency on some filesystem. -+ * let's try heavy test. -+ */ -+ err = -EACCES; -+ if (unlikely(!au_opt_test(au_mntflags(dentry->d_sb), DIRPERM1) -+ && au_test_h_perm(d_inode(h_parent), -+ MAY_EXEC | MAY_WRITE))) -+ goto out; -+ -+ h_latest = au_sio_lkup_one(&dentry->d_name, h_parent); -+ err = -EIO; -+ if (IS_ERR(h_latest)) -+ goto out; -+ if (h_latest == h_dentry) -+ err = 0; -+ dput(h_latest); -+ -+out: -+ return err; -+} -+ -+/* -+ * decide the branch where we operate for @dentry. the branch index will be set -+ * @rbcpup. after diciding it, 'pin' it and store the timestamps of the parent -+ * dir for reverting. -+ * when a new whiteout is necessary, create it. -+ */ -+static struct dentry* -+lock_hdir_create_wh(struct dentry *dentry, int isdir, aufs_bindex_t *rbcpup, -+ struct au_dtime *dt, struct au_pin *pin) -+{ -+ struct dentry *wh_dentry; -+ struct super_block *sb; -+ struct path h_path; -+ int err, need_wh; -+ unsigned int udba; -+ aufs_bindex_t bcpup; -+ -+ need_wh = au_wr_dir_need_wh(dentry, isdir, rbcpup); -+ wh_dentry = ERR_PTR(need_wh); -+ if (unlikely(need_wh < 0)) -+ goto out; -+ -+ sb = dentry->d_sb; -+ udba = au_opt_udba(sb); -+ bcpup = *rbcpup; -+ err = au_pin(pin, dentry, bcpup, udba, -+ AuPin_DI_LOCKED | AuPin_MNT_WRITE); -+ wh_dentry = ERR_PTR(err); -+ if (unlikely(err)) -+ goto out; -+ -+ h_path.dentry = au_pinned_h_parent(pin); -+ if (udba != AuOpt_UDBA_NONE -+ && au_dbtop(dentry) == bcpup) { -+ err = au_may_del(dentry, bcpup, h_path.dentry, isdir); -+ wh_dentry = ERR_PTR(err); -+ if (unlikely(err)) -+ goto out_unpin; -+ } -+ -+ h_path.mnt = au_sbr_mnt(sb, bcpup); -+ au_dtime_store(dt, au_pinned_parent(pin), &h_path); -+ wh_dentry = NULL; -+ if (!need_wh) -+ goto out; /* success, no need to create whiteout */ -+ -+ wh_dentry = au_wh_create(dentry, bcpup, h_path.dentry); -+ if (IS_ERR(wh_dentry)) -+ goto out_unpin; -+ -+ /* returns with the parent is locked and wh_dentry is dget-ed */ -+ goto out; /* success */ -+ -+out_unpin: -+ au_unpin(pin); -+out: -+ return wh_dentry; -+} -+ -+/* -+ * when removing a dir, rename it to a unique temporary whiteout-ed name first -+ * in order to be revertible and save time for removing many child whiteouts -+ * under the dir. -+ * returns 1 when there are too many child whiteout and caller should remove -+ * them asynchronously. returns 0 when the number of children is enough small to -+ * remove now or the branch fs is a remote fs. -+ * otherwise return an error. -+ */ -+static int renwh_and_rmdir(struct dentry *dentry, aufs_bindex_t bindex, -+ struct au_nhash *whlist, struct inode *dir) -+{ -+ int rmdir_later, err, dirwh; -+ struct dentry *h_dentry; -+ struct super_block *sb; -+ struct inode *inode; -+ -+ sb = dentry->d_sb; -+ SiMustAnyLock(sb); -+ h_dentry = au_h_dptr(dentry, bindex); -+ err = au_whtmp_ren(h_dentry, au_sbr(sb, bindex)); -+ if (unlikely(err)) -+ goto out; -+ -+ /* stop monitoring */ -+ inode = d_inode(dentry); -+ au_hn_free(au_hi(inode, bindex)); -+ -+ if (!au_test_fs_remote(h_dentry->d_sb)) { -+ dirwh = au_sbi(sb)->si_dirwh; -+ rmdir_later = (dirwh <= 1); -+ if (!rmdir_later) -+ rmdir_later = au_nhash_test_longer_wh(whlist, bindex, -+ dirwh); -+ if (rmdir_later) -+ return rmdir_later; -+ } -+ -+ err = au_whtmp_rmdir(dir, bindex, h_dentry, whlist); -+ if (unlikely(err)) { -+ AuIOErr("rmdir %pd, b%d failed, %d. ignored\n", -+ h_dentry, bindex, err); -+ err = 0; -+ } -+ -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+/* -+ * final procedure for deleting a entry. -+ * maintain dentry and iattr. -+ */ -+static void epilog(struct inode *dir, struct dentry *dentry, -+ aufs_bindex_t bindex) -+{ -+ struct inode *inode; -+ -+ inode = d_inode(dentry); -+ d_drop(dentry); -+ inode->i_ctime = dir->i_ctime; -+ -+ au_dir_ts(dir, bindex); -+ dir->i_version++; -+} -+ -+/* -+ * when an error happened, remove the created whiteout and revert everything. -+ */ -+static int do_revert(int err, struct inode *dir, aufs_bindex_t bindex, -+ aufs_bindex_t bwh, struct dentry *wh_dentry, -+ struct dentry *dentry, struct au_dtime *dt) -+{ -+ int rerr; -+ struct path h_path = { -+ .dentry = wh_dentry, -+ .mnt = au_sbr_mnt(dir->i_sb, bindex) -+ }; -+ -+ rerr = au_wh_unlink_dentry(au_h_iptr(dir, bindex), &h_path, dentry); -+ if (!rerr) { -+ au_set_dbwh(dentry, bwh); -+ au_dtime_revert(dt); -+ return 0; -+ } -+ -+ AuIOErr("%pd reverting whiteout failed(%d, %d)\n", dentry, err, rerr); -+ return -EIO; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+int aufs_unlink(struct inode *dir, struct dentry *dentry) -+{ -+ int err; -+ aufs_bindex_t bwh, bindex, btop; -+ struct inode *inode, *h_dir, *delegated; -+ struct dentry *parent, *wh_dentry; -+ /* to reuduce stack size */ -+ struct { -+ struct au_dtime dt; -+ struct au_pin pin; -+ struct path h_path; -+ } *a; -+ -+ IMustLock(dir); -+ -+ err = -ENOMEM; -+ a = kmalloc(sizeof(*a), GFP_NOFS); -+ if (unlikely(!a)) -+ goto out; -+ -+ err = aufs_read_lock(dentry, AuLock_DW | AuLock_GEN); -+ if (unlikely(err)) -+ goto out_free; -+ err = au_d_hashed_positive(dentry); -+ if (unlikely(err)) -+ goto out_unlock; -+ inode = d_inode(dentry); -+ IMustLock(inode); -+ err = -EISDIR; -+ if (unlikely(d_is_dir(dentry))) -+ goto out_unlock; /* possible? */ -+ -+ btop = au_dbtop(dentry); -+ bwh = au_dbwh(dentry); -+ bindex = -1; -+ parent = dentry->d_parent; /* dir inode is locked */ -+ di_write_lock_parent(parent); -+ wh_dentry = lock_hdir_create_wh(dentry, /*isdir*/0, &bindex, &a->dt, -+ &a->pin); -+ err = PTR_ERR(wh_dentry); -+ if (IS_ERR(wh_dentry)) -+ goto out_parent; -+ -+ a->h_path.mnt = au_sbr_mnt(dentry->d_sb, btop); -+ a->h_path.dentry = au_h_dptr(dentry, btop); -+ dget(a->h_path.dentry); -+ if (bindex == btop) { -+ h_dir = au_pinned_h_dir(&a->pin); -+ delegated = NULL; -+ err = vfsub_unlink(h_dir, &a->h_path, &delegated, /*force*/0); -+ if (unlikely(err == -EWOULDBLOCK)) { -+ pr_warn("cannot retry for NFSv4 delegation" -+ " for an internal unlink\n"); -+ iput(delegated); -+ } -+ } else { -+ /* dir inode is locked */ -+ h_dir = d_inode(wh_dentry->d_parent); -+ IMustLock(h_dir); -+ err = 0; -+ } -+ -+ if (!err) { -+ vfsub_drop_nlink(inode); -+ epilog(dir, dentry, bindex); -+ -+ /* update target timestamps */ -+ if (bindex == btop) { -+ vfsub_update_h_iattr(&a->h_path, /*did*/NULL); -+ /*ignore*/ -+ inode->i_ctime = d_inode(a->h_path.dentry)->i_ctime; -+ } else -+ /* todo: this timestamp may be reverted later */ -+ inode->i_ctime = h_dir->i_ctime; -+ goto out_unpin; /* success */ -+ } -+ -+ /* revert */ -+ if (wh_dentry) { -+ int rerr; -+ -+ rerr = do_revert(err, dir, bindex, bwh, wh_dentry, dentry, -+ &a->dt); -+ if (rerr) -+ err = rerr; -+ } -+ -+out_unpin: -+ au_unpin(&a->pin); -+ dput(wh_dentry); -+ dput(a->h_path.dentry); -+out_parent: -+ di_write_unlock(parent); -+out_unlock: -+ aufs_read_unlock(dentry, AuLock_DW); -+out_free: -+ au_delayed_kfree(a); -+out: -+ return err; -+} -+ -+int aufs_rmdir(struct inode *dir, struct dentry *dentry) -+{ -+ int err, rmdir_later; -+ aufs_bindex_t bwh, bindex, btop; -+ struct inode *inode; -+ struct dentry *parent, *wh_dentry, *h_dentry; -+ struct au_whtmp_rmdir *args; -+ /* to reuduce stack size */ -+ struct { -+ struct au_dtime dt; -+ struct au_pin pin; -+ } *a; -+ -+ IMustLock(dir); -+ -+ err = -ENOMEM; -+ a = kmalloc(sizeof(*a), GFP_NOFS); -+ if (unlikely(!a)) -+ goto out; -+ -+ err = aufs_read_lock(dentry, AuLock_DW | AuLock_FLUSH | AuLock_GEN); -+ if (unlikely(err)) -+ goto out_free; -+ err = au_alive_dir(dentry); -+ if (unlikely(err)) -+ goto out_unlock; -+ inode = d_inode(dentry); -+ IMustLock(inode); -+ err = -ENOTDIR; -+ if (unlikely(!d_is_dir(dentry))) -+ goto out_unlock; /* possible? */ -+ -+ err = -ENOMEM; -+ args = au_whtmp_rmdir_alloc(dir->i_sb, GFP_NOFS); -+ if (unlikely(!args)) -+ goto out_unlock; -+ -+ parent = dentry->d_parent; /* dir inode is locked */ -+ di_write_lock_parent(parent); -+ err = au_test_empty(dentry, &args->whlist); -+ if (unlikely(err)) -+ goto out_parent; -+ -+ btop = au_dbtop(dentry); -+ bwh = au_dbwh(dentry); -+ bindex = -1; -+ wh_dentry = lock_hdir_create_wh(dentry, /*isdir*/1, &bindex, &a->dt, -+ &a->pin); -+ err = PTR_ERR(wh_dentry); -+ if (IS_ERR(wh_dentry)) -+ goto out_parent; -+ -+ h_dentry = au_h_dptr(dentry, btop); -+ dget(h_dentry); -+ rmdir_later = 0; -+ if (bindex == btop) { -+ err = renwh_and_rmdir(dentry, btop, &args->whlist, dir); -+ if (err > 0) { -+ rmdir_later = err; -+ err = 0; -+ } -+ } else { -+ /* stop monitoring */ -+ au_hn_free(au_hi(inode, btop)); -+ -+ /* dir inode is locked */ -+ IMustLock(d_inode(wh_dentry->d_parent)); -+ err = 0; -+ } -+ -+ if (!err) { -+ vfsub_dead_dir(inode); -+ au_set_dbdiropq(dentry, -1); -+ epilog(dir, dentry, bindex); -+ -+ if (rmdir_later) { -+ au_whtmp_kick_rmdir(dir, btop, h_dentry, args); -+ args = NULL; -+ } -+ -+ goto out_unpin; /* success */ -+ } -+ -+ /* revert */ -+ AuLabel(revert); -+ if (wh_dentry) { -+ int rerr; -+ -+ rerr = do_revert(err, dir, bindex, bwh, wh_dentry, dentry, -+ &a->dt); -+ if (rerr) -+ err = rerr; -+ } -+ -+out_unpin: -+ au_unpin(&a->pin); -+ dput(wh_dentry); -+ dput(h_dentry); -+out_parent: -+ di_write_unlock(parent); -+ if (args) -+ au_whtmp_rmdir_free(args); -+out_unlock: -+ aufs_read_unlock(dentry, AuLock_DW); -+out_free: -+ au_delayed_kfree(a); -+out: -+ AuTraceErr(err); -+ return err; -+} -diff --git a/fs/aufs/i_op_ren.c b/fs/aufs/i_op_ren.c -new file mode 100644 -index 0000000..43a0909 ---- /dev/null -+++ b/fs/aufs/i_op_ren.c -@@ -0,0 +1,1002 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * inode operation (rename entry) -+ * todo: this is crazy monster -+ */ -+ -+#include "aufs.h" -+ -+enum { AuSRC, AuDST, AuSrcDst }; -+enum { AuPARENT, AuCHILD, AuParentChild }; -+ -+#define AuRen_ISDIR 1 -+#define AuRen_ISSAMEDIR (1 << 1) -+#define AuRen_WHSRC (1 << 2) -+#define AuRen_WHDST (1 << 3) -+#define AuRen_MNT_WRITE (1 << 4) -+#define AuRen_DT_DSTDIR (1 << 5) -+#define AuRen_DIROPQ (1 << 6) -+#define au_ftest_ren(flags, name) ((flags) & AuRen_##name) -+#define au_fset_ren(flags, name) \ -+ do { (flags) |= AuRen_##name; } while (0) -+#define au_fclr_ren(flags, name) \ -+ do { (flags) &= ~AuRen_##name; } while (0) -+ -+struct au_ren_args { -+ struct { -+ struct dentry *dentry, *h_dentry, *parent, *h_parent, -+ *wh_dentry; -+ struct inode *dir, *inode; -+ struct au_hinode *hdir; -+ struct au_dtime dt[AuParentChild]; -+ aufs_bindex_t btop; -+ } sd[AuSrcDst]; -+ -+#define src_dentry sd[AuSRC].dentry -+#define src_dir sd[AuSRC].dir -+#define src_inode sd[AuSRC].inode -+#define src_h_dentry sd[AuSRC].h_dentry -+#define src_parent sd[AuSRC].parent -+#define src_h_parent sd[AuSRC].h_parent -+#define src_wh_dentry sd[AuSRC].wh_dentry -+#define src_hdir sd[AuSRC].hdir -+#define src_h_dir sd[AuSRC].hdir->hi_inode -+#define src_dt sd[AuSRC].dt -+#define src_btop sd[AuSRC].btop -+ -+#define dst_dentry sd[AuDST].dentry -+#define dst_dir sd[AuDST].dir -+#define dst_inode sd[AuDST].inode -+#define dst_h_dentry sd[AuDST].h_dentry -+#define dst_parent sd[AuDST].parent -+#define dst_h_parent sd[AuDST].h_parent -+#define dst_wh_dentry sd[AuDST].wh_dentry -+#define dst_hdir sd[AuDST].hdir -+#define dst_h_dir sd[AuDST].hdir->hi_inode -+#define dst_dt sd[AuDST].dt -+#define dst_btop sd[AuDST].btop -+ -+ struct dentry *h_trap; -+ struct au_branch *br; -+ struct au_hinode *src_hinode; -+ struct path h_path; -+ struct au_nhash whlist; -+ aufs_bindex_t btgt, src_bwh, src_bdiropq; -+ -+ unsigned int flags; -+ -+ struct au_whtmp_rmdir *thargs; -+ struct dentry *h_dst; -+}; -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * functions for reverting. -+ * when an error happened in a single rename systemcall, we should revert -+ * everything as if nothing happened. -+ * we don't need to revert the copied-up/down the parent dir since they are -+ * harmless. -+ */ -+ -+#define RevertFailure(fmt, ...) do { \ -+ AuIOErr("revert failure: " fmt " (%d, %d)\n", \ -+ ##__VA_ARGS__, err, rerr); \ -+ err = -EIO; \ -+} while (0) -+ -+static void au_ren_rev_diropq(int err, struct au_ren_args *a) -+{ -+ int rerr; -+ -+ au_hn_inode_lock_nested(a->src_hinode, AuLsc_I_CHILD); -+ rerr = au_diropq_remove(a->src_dentry, a->btgt); -+ au_hn_inode_unlock(a->src_hinode); -+ au_set_dbdiropq(a->src_dentry, a->src_bdiropq); -+ if (rerr) -+ RevertFailure("remove diropq %pd", a->src_dentry); -+} -+ -+static void au_ren_rev_rename(int err, struct au_ren_args *a) -+{ -+ int rerr; -+ struct inode *delegated; -+ -+ a->h_path.dentry = vfsub_lkup_one(&a->src_dentry->d_name, -+ a->src_h_parent); -+ rerr = PTR_ERR(a->h_path.dentry); -+ if (IS_ERR(a->h_path.dentry)) { -+ RevertFailure("lkup one %pd", a->src_dentry); -+ return; -+ } -+ -+ delegated = NULL; -+ rerr = vfsub_rename(a->dst_h_dir, -+ au_h_dptr(a->src_dentry, a->btgt), -+ a->src_h_dir, &a->h_path, &delegated); -+ if (unlikely(rerr == -EWOULDBLOCK)) { -+ pr_warn("cannot retry for NFSv4 delegation" -+ " for an internal rename\n"); -+ iput(delegated); -+ } -+ d_drop(a->h_path.dentry); -+ dput(a->h_path.dentry); -+ /* au_set_h_dptr(a->src_dentry, a->btgt, NULL); */ -+ if (rerr) -+ RevertFailure("rename %pd", a->src_dentry); -+} -+ -+static void au_ren_rev_whtmp(int err, struct au_ren_args *a) -+{ -+ int rerr; -+ struct inode *delegated; -+ -+ a->h_path.dentry = vfsub_lkup_one(&a->dst_dentry->d_name, -+ a->dst_h_parent); -+ rerr = PTR_ERR(a->h_path.dentry); -+ if (IS_ERR(a->h_path.dentry)) { -+ RevertFailure("lkup one %pd", a->dst_dentry); -+ return; -+ } -+ if (d_is_positive(a->h_path.dentry)) { -+ d_drop(a->h_path.dentry); -+ dput(a->h_path.dentry); -+ return; -+ } -+ -+ delegated = NULL; -+ rerr = vfsub_rename(a->dst_h_dir, a->h_dst, a->dst_h_dir, &a->h_path, -+ &delegated); -+ if (unlikely(rerr == -EWOULDBLOCK)) { -+ pr_warn("cannot retry for NFSv4 delegation" -+ " for an internal rename\n"); -+ iput(delegated); -+ } -+ d_drop(a->h_path.dentry); -+ dput(a->h_path.dentry); -+ if (!rerr) -+ au_set_h_dptr(a->dst_dentry, a->btgt, dget(a->h_dst)); -+ else -+ RevertFailure("rename %pd", a->h_dst); -+} -+ -+static void au_ren_rev_whsrc(int err, struct au_ren_args *a) -+{ -+ int rerr; -+ -+ a->h_path.dentry = a->src_wh_dentry; -+ rerr = au_wh_unlink_dentry(a->src_h_dir, &a->h_path, a->src_dentry); -+ au_set_dbwh(a->src_dentry, a->src_bwh); -+ if (rerr) -+ RevertFailure("unlink %pd", a->src_wh_dentry); -+} -+#undef RevertFailure -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * when we have to copyup the renaming entry, do it with the rename-target name -+ * in order to minimize the cost (the later actual rename is unnecessary). -+ * otherwise rename it on the target branch. -+ */ -+static int au_ren_or_cpup(struct au_ren_args *a) -+{ -+ int err; -+ struct dentry *d; -+ struct inode *delegated; -+ -+ d = a->src_dentry; -+ if (au_dbtop(d) == a->btgt) { -+ a->h_path.dentry = a->dst_h_dentry; -+ if (au_ftest_ren(a->flags, DIROPQ) -+ && au_dbdiropq(d) == a->btgt) -+ au_fclr_ren(a->flags, DIROPQ); -+ AuDebugOn(au_dbtop(d) != a->btgt); -+ delegated = NULL; -+ err = vfsub_rename(a->src_h_dir, au_h_dptr(d, a->btgt), -+ a->dst_h_dir, &a->h_path, &delegated); -+ if (unlikely(err == -EWOULDBLOCK)) { -+ pr_warn("cannot retry for NFSv4 delegation" -+ " for an internal rename\n"); -+ iput(delegated); -+ } -+ } else -+ BUG(); -+ -+ if (!err && a->h_dst) -+ /* it will be set to dinfo later */ -+ dget(a->h_dst); -+ -+ return err; -+} -+ -+/* cf. aufs_rmdir() */ -+static int au_ren_del_whtmp(struct au_ren_args *a) -+{ -+ int err; -+ struct inode *dir; -+ -+ dir = a->dst_dir; -+ SiMustAnyLock(dir->i_sb); -+ if (!au_nhash_test_longer_wh(&a->whlist, a->btgt, -+ au_sbi(dir->i_sb)->si_dirwh) -+ || au_test_fs_remote(a->h_dst->d_sb)) { -+ err = au_whtmp_rmdir(dir, a->btgt, a->h_dst, &a->whlist); -+ if (unlikely(err)) -+ pr_warn("failed removing whtmp dir %pd (%d), " -+ "ignored.\n", a->h_dst, err); -+ } else { -+ au_nhash_wh_free(&a->thargs->whlist); -+ a->thargs->whlist = a->whlist; -+ a->whlist.nh_num = 0; -+ au_whtmp_kick_rmdir(dir, a->btgt, a->h_dst, a->thargs); -+ dput(a->h_dst); -+ a->thargs = NULL; -+ } -+ -+ return 0; -+} -+ -+/* make it 'opaque' dir. */ -+static int au_ren_diropq(struct au_ren_args *a) -+{ -+ int err; -+ struct dentry *diropq; -+ -+ err = 0; -+ a->src_bdiropq = au_dbdiropq(a->src_dentry); -+ a->src_hinode = au_hi(a->src_inode, a->btgt); -+ au_hn_inode_lock_nested(a->src_hinode, AuLsc_I_CHILD); -+ diropq = au_diropq_create(a->src_dentry, a->btgt); -+ au_hn_inode_unlock(a->src_hinode); -+ if (IS_ERR(diropq)) -+ err = PTR_ERR(diropq); -+ else -+ dput(diropq); -+ -+ return err; -+} -+ -+static int do_rename(struct au_ren_args *a) -+{ -+ int err; -+ struct dentry *d, *h_d; -+ -+ /* prepare workqueue args for asynchronous rmdir */ -+ h_d = a->dst_h_dentry; -+ if (au_ftest_ren(a->flags, ISDIR) && d_is_positive(h_d)) { -+ err = -ENOMEM; -+ a->thargs = au_whtmp_rmdir_alloc(a->src_dentry->d_sb, GFP_NOFS); -+ if (unlikely(!a->thargs)) -+ goto out; -+ a->h_dst = dget(h_d); -+ } -+ -+ /* create whiteout for src_dentry */ -+ if (au_ftest_ren(a->flags, WHSRC)) { -+ a->src_bwh = au_dbwh(a->src_dentry); -+ AuDebugOn(a->src_bwh >= 0); -+ a->src_wh_dentry -+ = au_wh_create(a->src_dentry, a->btgt, a->src_h_parent); -+ err = PTR_ERR(a->src_wh_dentry); -+ if (IS_ERR(a->src_wh_dentry)) -+ goto out_thargs; -+ } -+ -+ /* lookup whiteout for dentry */ -+ if (au_ftest_ren(a->flags, WHDST)) { -+ h_d = au_wh_lkup(a->dst_h_parent, &a->dst_dentry->d_name, -+ a->br); -+ err = PTR_ERR(h_d); -+ if (IS_ERR(h_d)) -+ goto out_whsrc; -+ if (d_is_negative(h_d)) -+ dput(h_d); -+ else -+ a->dst_wh_dentry = h_d; -+ } -+ -+ /* rename dentry to tmpwh */ -+ if (a->thargs) { -+ err = au_whtmp_ren(a->dst_h_dentry, a->br); -+ if (unlikely(err)) -+ goto out_whdst; -+ -+ d = a->dst_dentry; -+ au_set_h_dptr(d, a->btgt, NULL); -+ err = au_lkup_neg(d, a->btgt, /*wh*/0); -+ if (unlikely(err)) -+ goto out_whtmp; -+ a->dst_h_dentry = au_h_dptr(d, a->btgt); -+ } -+ -+ BUG_ON(d_is_positive(a->dst_h_dentry) && a->src_btop != a->btgt); -+ -+ /* rename by vfs_rename or cpup */ -+ d = a->dst_dentry; -+ if (au_ftest_ren(a->flags, ISDIR) -+ && (a->dst_wh_dentry -+ || au_dbdiropq(d) == a->btgt -+ /* hide the lower to keep xino */ -+ || a->btgt < au_dbbot(d) -+ || au_opt_test(au_mntflags(d->d_sb), ALWAYS_DIROPQ))) -+ au_fset_ren(a->flags, DIROPQ); -+ err = au_ren_or_cpup(a); -+ if (unlikely(err)) -+ /* leave the copied-up one */ -+ goto out_whtmp; -+ -+ /* make dir opaque */ -+ if (au_ftest_ren(a->flags, DIROPQ)) { -+ err = au_ren_diropq(a); -+ if (unlikely(err)) -+ goto out_rename; -+ } -+ -+ /* update target timestamps */ -+ AuDebugOn(au_dbtop(a->src_dentry) != a->btgt); -+ a->h_path.dentry = au_h_dptr(a->src_dentry, a->btgt); -+ vfsub_update_h_iattr(&a->h_path, /*did*/NULL); /*ignore*/ -+ a->src_inode->i_ctime = d_inode(a->h_path.dentry)->i_ctime; -+ -+ /* remove whiteout for dentry */ -+ if (a->dst_wh_dentry) { -+ a->h_path.dentry = a->dst_wh_dentry; -+ err = au_wh_unlink_dentry(a->dst_h_dir, &a->h_path, -+ a->dst_dentry); -+ if (unlikely(err)) -+ goto out_diropq; -+ } -+ -+ /* remove whtmp */ -+ if (a->thargs) -+ au_ren_del_whtmp(a); /* ignore this error */ -+ -+ au_fhsm_wrote(a->src_dentry->d_sb, a->btgt, /*force*/0); -+ err = 0; -+ goto out_success; -+ -+out_diropq: -+ if (au_ftest_ren(a->flags, DIROPQ)) -+ au_ren_rev_diropq(err, a); -+out_rename: -+ au_ren_rev_rename(err, a); -+ dput(a->h_dst); -+out_whtmp: -+ if (a->thargs) -+ au_ren_rev_whtmp(err, a); -+out_whdst: -+ dput(a->dst_wh_dentry); -+ a->dst_wh_dentry = NULL; -+out_whsrc: -+ if (a->src_wh_dentry) -+ au_ren_rev_whsrc(err, a); -+out_success: -+ dput(a->src_wh_dentry); -+ dput(a->dst_wh_dentry); -+out_thargs: -+ if (a->thargs) { -+ dput(a->h_dst); -+ au_whtmp_rmdir_free(a->thargs); -+ a->thargs = NULL; -+ } -+out: -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * test if @dentry dir can be rename destination or not. -+ * success means, it is a logically empty dir. -+ */ -+static int may_rename_dstdir(struct dentry *dentry, struct au_nhash *whlist) -+{ -+ return au_test_empty(dentry, whlist); -+} -+ -+/* -+ * test if @dentry dir can be rename source or not. -+ * if it can, return 0 and @children is filled. -+ * success means, -+ * - it is a logically empty dir. -+ * - or, it exists on writable branch and has no children including whiteouts -+ * on the lower branch. -+ */ -+static int may_rename_srcdir(struct dentry *dentry, aufs_bindex_t btgt) -+{ -+ int err; -+ unsigned int rdhash; -+ aufs_bindex_t btop; -+ -+ btop = au_dbtop(dentry); -+ if (btop != btgt) { -+ struct au_nhash whlist; -+ -+ SiMustAnyLock(dentry->d_sb); -+ rdhash = au_sbi(dentry->d_sb)->si_rdhash; -+ if (!rdhash) -+ rdhash = au_rdhash_est(au_dir_size(/*file*/NULL, -+ dentry)); -+ err = au_nhash_alloc(&whlist, rdhash, GFP_NOFS); -+ if (unlikely(err)) -+ goto out; -+ err = au_test_empty(dentry, &whlist); -+ au_nhash_wh_free(&whlist); -+ goto out; -+ } -+ -+ if (btop == au_dbtaildir(dentry)) -+ return 0; /* success */ -+ -+ err = au_test_empty_lower(dentry); -+ -+out: -+ if (err == -ENOTEMPTY) { -+ AuWarn1("renaming dir who has child(ren) on multiple branches," -+ " is not supported\n"); -+ err = -EXDEV; -+ } -+ return err; -+} -+ -+/* side effect: sets whlist and h_dentry */ -+static int au_ren_may_dir(struct au_ren_args *a) -+{ -+ int err; -+ unsigned int rdhash; -+ struct dentry *d; -+ -+ d = a->dst_dentry; -+ SiMustAnyLock(d->d_sb); -+ -+ err = 0; -+ if (au_ftest_ren(a->flags, ISDIR) && a->dst_inode) { -+ rdhash = au_sbi(d->d_sb)->si_rdhash; -+ if (!rdhash) -+ rdhash = au_rdhash_est(au_dir_size(/*file*/NULL, d)); -+ err = au_nhash_alloc(&a->whlist, rdhash, GFP_NOFS); -+ if (unlikely(err)) -+ goto out; -+ -+ au_set_dbtop(d, a->dst_btop); -+ err = may_rename_dstdir(d, &a->whlist); -+ au_set_dbtop(d, a->btgt); -+ } -+ a->dst_h_dentry = au_h_dptr(d, au_dbtop(d)); -+ if (unlikely(err)) -+ goto out; -+ -+ d = a->src_dentry; -+ a->src_h_dentry = au_h_dptr(d, au_dbtop(d)); -+ if (au_ftest_ren(a->flags, ISDIR)) { -+ err = may_rename_srcdir(d, a->btgt); -+ if (unlikely(err)) { -+ au_nhash_wh_free(&a->whlist); -+ a->whlist.nh_num = 0; -+ } -+ } -+out: -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * simple tests for rename. -+ * following the checks in vfs, plus the parent-child relationship. -+ */ -+static int au_may_ren(struct au_ren_args *a) -+{ -+ int err, isdir; -+ struct inode *h_inode; -+ -+ if (a->src_btop == a->btgt) { -+ err = au_may_del(a->src_dentry, a->btgt, a->src_h_parent, -+ au_ftest_ren(a->flags, ISDIR)); -+ if (unlikely(err)) -+ goto out; -+ err = -EINVAL; -+ if (unlikely(a->src_h_dentry == a->h_trap)) -+ goto out; -+ } -+ -+ err = 0; -+ if (a->dst_btop != a->btgt) -+ goto out; -+ -+ err = -ENOTEMPTY; -+ if (unlikely(a->dst_h_dentry == a->h_trap)) -+ goto out; -+ -+ err = -EIO; -+ isdir = !!au_ftest_ren(a->flags, ISDIR); -+ if (d_really_is_negative(a->dst_dentry)) { -+ if (d_is_negative(a->dst_h_dentry)) -+ err = au_may_add(a->dst_dentry, a->btgt, -+ a->dst_h_parent, isdir); -+ } else { -+ if (unlikely(d_is_negative(a->dst_h_dentry))) -+ goto out; -+ h_inode = d_inode(a->dst_h_dentry); -+ if (h_inode->i_nlink) -+ err = au_may_del(a->dst_dentry, a->btgt, -+ a->dst_h_parent, isdir); -+ } -+ -+out: -+ if (unlikely(err == -ENOENT || err == -EEXIST)) -+ err = -EIO; -+ AuTraceErr(err); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * locking order -+ * (VFS) -+ * - src_dir and dir by lock_rename() -+ * - inode if exitsts -+ * (aufs) -+ * - lock all -+ * + src_dentry and dentry by aufs_read_and_write_lock2() which calls, -+ * + si_read_lock -+ * + di_write_lock2_child() -+ * + di_write_lock_child() -+ * + ii_write_lock_child() -+ * + di_write_lock_child2() -+ * + ii_write_lock_child2() -+ * + src_parent and parent -+ * + di_write_lock_parent() -+ * + ii_write_lock_parent() -+ * + di_write_lock_parent2() -+ * + ii_write_lock_parent2() -+ * + lower src_dir and dir by vfsub_lock_rename() -+ * + verify the every relationships between child and parent. if any -+ * of them failed, unlock all and return -EBUSY. -+ */ -+static void au_ren_unlock(struct au_ren_args *a) -+{ -+ vfsub_unlock_rename(a->src_h_parent, a->src_hdir, -+ a->dst_h_parent, a->dst_hdir); -+ if (au_ftest_ren(a->flags, MNT_WRITE)) -+ vfsub_mnt_drop_write(au_br_mnt(a->br)); -+} -+ -+static int au_ren_lock(struct au_ren_args *a) -+{ -+ int err; -+ unsigned int udba; -+ -+ err = 0; -+ a->src_h_parent = au_h_dptr(a->src_parent, a->btgt); -+ a->src_hdir = au_hi(a->src_dir, a->btgt); -+ a->dst_h_parent = au_h_dptr(a->dst_parent, a->btgt); -+ a->dst_hdir = au_hi(a->dst_dir, a->btgt); -+ -+ err = vfsub_mnt_want_write(au_br_mnt(a->br)); -+ if (unlikely(err)) -+ goto out; -+ au_fset_ren(a->flags, MNT_WRITE); -+ a->h_trap = vfsub_lock_rename(a->src_h_parent, a->src_hdir, -+ a->dst_h_parent, a->dst_hdir); -+ udba = au_opt_udba(a->src_dentry->d_sb); -+ if (unlikely(a->src_hdir->hi_inode != d_inode(a->src_h_parent) -+ || a->dst_hdir->hi_inode != d_inode(a->dst_h_parent))) -+ err = au_busy_or_stale(); -+ if (!err && au_dbtop(a->src_dentry) == a->btgt) -+ err = au_h_verify(a->src_h_dentry, udba, -+ d_inode(a->src_h_parent), a->src_h_parent, -+ a->br); -+ if (!err && au_dbtop(a->dst_dentry) == a->btgt) -+ err = au_h_verify(a->dst_h_dentry, udba, -+ d_inode(a->dst_h_parent), a->dst_h_parent, -+ a->br); -+ if (!err) -+ goto out; /* success */ -+ -+ err = au_busy_or_stale(); -+ au_ren_unlock(a); -+ -+out: -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static void au_ren_refresh_dir(struct au_ren_args *a) -+{ -+ struct inode *dir; -+ -+ dir = a->dst_dir; -+ dir->i_version++; -+ if (au_ftest_ren(a->flags, ISDIR)) { -+ /* is this updating defined in POSIX? */ -+ au_cpup_attr_timesizes(a->src_inode); -+ au_cpup_attr_nlink(dir, /*force*/1); -+ } -+ -+ au_dir_ts(dir, a->btgt); -+ -+ if (au_ftest_ren(a->flags, ISSAMEDIR)) -+ return; -+ -+ dir = a->src_dir; -+ dir->i_version++; -+ if (au_ftest_ren(a->flags, ISDIR)) -+ au_cpup_attr_nlink(dir, /*force*/1); -+ au_dir_ts(dir, a->btgt); -+} -+ -+static void au_ren_refresh(struct au_ren_args *a) -+{ -+ aufs_bindex_t bbot, bindex; -+ struct dentry *d, *h_d; -+ struct inode *i, *h_i; -+ struct super_block *sb; -+ -+ d = a->dst_dentry; -+ d_drop(d); -+ if (a->h_dst) -+ /* already dget-ed by au_ren_or_cpup() */ -+ au_set_h_dptr(d, a->btgt, a->h_dst); -+ -+ i = a->dst_inode; -+ if (i) { -+ if (!au_ftest_ren(a->flags, ISDIR)) -+ vfsub_drop_nlink(i); -+ else { -+ vfsub_dead_dir(i); -+ au_cpup_attr_timesizes(i); -+ } -+ au_update_dbrange(d, /*do_put_zero*/1); -+ } else { -+ bbot = a->btgt; -+ for (bindex = au_dbtop(d); bindex < bbot; bindex++) -+ au_set_h_dptr(d, bindex, NULL); -+ bbot = au_dbbot(d); -+ for (bindex = a->btgt + 1; bindex <= bbot; bindex++) -+ au_set_h_dptr(d, bindex, NULL); -+ au_update_dbrange(d, /*do_put_zero*/0); -+ } -+ -+ d = a->src_dentry; -+ au_set_dbwh(d, -1); -+ bbot = au_dbbot(d); -+ for (bindex = a->btgt + 1; bindex <= bbot; bindex++) { -+ h_d = au_h_dptr(d, bindex); -+ if (h_d) -+ au_set_h_dptr(d, bindex, NULL); -+ } -+ au_set_dbbot(d, a->btgt); -+ -+ sb = d->d_sb; -+ i = a->src_inode; -+ if (au_opt_test(au_mntflags(sb), PLINK) && au_plink_test(i)) -+ return; /* success */ -+ -+ bbot = au_ibbot(i); -+ for (bindex = a->btgt + 1; bindex <= bbot; bindex++) { -+ h_i = au_h_iptr(i, bindex); -+ if (h_i) { -+ au_xino_write(sb, bindex, h_i->i_ino, /*ino*/0); -+ /* ignore this error */ -+ au_set_h_iptr(i, bindex, NULL, 0); -+ } -+ } -+ au_set_ibbot(i, a->btgt); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* mainly for link(2) and rename(2) */ -+int au_wbr(struct dentry *dentry, aufs_bindex_t btgt) -+{ -+ aufs_bindex_t bdiropq, bwh; -+ struct dentry *parent; -+ struct au_branch *br; -+ -+ parent = dentry->d_parent; -+ IMustLock(d_inode(parent)); /* dir is locked */ -+ -+ bdiropq = au_dbdiropq(parent); -+ bwh = au_dbwh(dentry); -+ br = au_sbr(dentry->d_sb, btgt); -+ if (au_br_rdonly(br) -+ || (0 <= bdiropq && bdiropq < btgt) -+ || (0 <= bwh && bwh < btgt)) -+ btgt = -1; -+ -+ AuDbg("btgt %d\n", btgt); -+ return btgt; -+} -+ -+/* sets src_btop, dst_btop and btgt */ -+static int au_ren_wbr(struct au_ren_args *a) -+{ -+ int err; -+ struct au_wr_dir_args wr_dir_args = { -+ /* .force_btgt = -1, */ -+ .flags = AuWrDir_ADD_ENTRY -+ }; -+ -+ a->src_btop = au_dbtop(a->src_dentry); -+ a->dst_btop = au_dbtop(a->dst_dentry); -+ if (au_ftest_ren(a->flags, ISDIR)) -+ au_fset_wrdir(wr_dir_args.flags, ISDIR); -+ wr_dir_args.force_btgt = a->src_btop; -+ if (a->dst_inode && a->dst_btop < a->src_btop) -+ wr_dir_args.force_btgt = a->dst_btop; -+ wr_dir_args.force_btgt = au_wbr(a->dst_dentry, wr_dir_args.force_btgt); -+ err = au_wr_dir(a->dst_dentry, a->src_dentry, &wr_dir_args); -+ a->btgt = err; -+ -+ return err; -+} -+ -+static void au_ren_dt(struct au_ren_args *a) -+{ -+ a->h_path.dentry = a->src_h_parent; -+ au_dtime_store(a->src_dt + AuPARENT, a->src_parent, &a->h_path); -+ if (!au_ftest_ren(a->flags, ISSAMEDIR)) { -+ a->h_path.dentry = a->dst_h_parent; -+ au_dtime_store(a->dst_dt + AuPARENT, a->dst_parent, &a->h_path); -+ } -+ -+ au_fclr_ren(a->flags, DT_DSTDIR); -+ if (!au_ftest_ren(a->flags, ISDIR)) -+ return; -+ -+ a->h_path.dentry = a->src_h_dentry; -+ au_dtime_store(a->src_dt + AuCHILD, a->src_dentry, &a->h_path); -+ if (d_is_positive(a->dst_h_dentry)) { -+ au_fset_ren(a->flags, DT_DSTDIR); -+ a->h_path.dentry = a->dst_h_dentry; -+ au_dtime_store(a->dst_dt + AuCHILD, a->dst_dentry, &a->h_path); -+ } -+} -+ -+static void au_ren_rev_dt(int err, struct au_ren_args *a) -+{ -+ struct dentry *h_d; -+ struct inode *h_inode; -+ -+ au_dtime_revert(a->src_dt + AuPARENT); -+ if (!au_ftest_ren(a->flags, ISSAMEDIR)) -+ au_dtime_revert(a->dst_dt + AuPARENT); -+ -+ if (au_ftest_ren(a->flags, ISDIR) && err != -EIO) { -+ h_d = a->src_dt[AuCHILD].dt_h_path.dentry; -+ h_inode = d_inode(h_d); -+ inode_lock_nested(h_inode, AuLsc_I_CHILD); -+ au_dtime_revert(a->src_dt + AuCHILD); -+ inode_unlock(h_inode); -+ -+ if (au_ftest_ren(a->flags, DT_DSTDIR)) { -+ h_d = a->dst_dt[AuCHILD].dt_h_path.dentry; -+ h_inode = d_inode(h_d); -+ inode_lock_nested(h_inode, AuLsc_I_CHILD); -+ au_dtime_revert(a->dst_dt + AuCHILD); -+ inode_unlock(h_inode); -+ } -+ } -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+int aufs_rename(struct inode *_src_dir, struct dentry *_src_dentry, -+ struct inode *_dst_dir, struct dentry *_dst_dentry) -+{ -+ int err, flags; -+ /* reduce stack space */ -+ struct au_ren_args *a; -+ -+ AuDbg("%pd, %pd\n", _src_dentry, _dst_dentry); -+ IMustLock(_src_dir); -+ IMustLock(_dst_dir); -+ -+ err = -ENOMEM; -+ BUILD_BUG_ON(sizeof(*a) > PAGE_SIZE); -+ a = kzalloc(sizeof(*a), GFP_NOFS); -+ if (unlikely(!a)) -+ goto out; -+ -+ a->src_dir = _src_dir; -+ a->src_dentry = _src_dentry; -+ a->src_inode = NULL; -+ if (d_really_is_positive(a->src_dentry)) -+ a->src_inode = d_inode(a->src_dentry); -+ a->src_parent = a->src_dentry->d_parent; /* dir inode is locked */ -+ a->dst_dir = _dst_dir; -+ a->dst_dentry = _dst_dentry; -+ a->dst_inode = NULL; -+ if (d_really_is_positive(a->dst_dentry)) -+ a->dst_inode = d_inode(a->dst_dentry); -+ a->dst_parent = a->dst_dentry->d_parent; /* dir inode is locked */ -+ if (a->dst_inode) { -+ IMustLock(a->dst_inode); -+ au_igrab(a->dst_inode); -+ } -+ -+ err = -ENOTDIR; -+ flags = AuLock_FLUSH | AuLock_NOPLM | AuLock_GEN; -+ if (d_is_dir(a->src_dentry)) { -+ au_fset_ren(a->flags, ISDIR); -+ if (unlikely(d_really_is_positive(a->dst_dentry) -+ && !d_is_dir(a->dst_dentry))) -+ goto out_free; -+ flags |= AuLock_DIRS; -+ } -+ err = aufs_read_and_write_lock2(a->dst_dentry, a->src_dentry, flags); -+ if (unlikely(err)) -+ goto out_free; -+ -+ err = au_d_hashed_positive(a->src_dentry); -+ if (unlikely(err)) -+ goto out_unlock; -+ err = -ENOENT; -+ if (a->dst_inode) { -+ /* -+ * If it is a dir, VFS unhash dst_dentry before this -+ * function. It means we cannot rely upon d_unhashed(). -+ */ -+ if (unlikely(!a->dst_inode->i_nlink)) -+ goto out_unlock; -+ if (!S_ISDIR(a->dst_inode->i_mode)) { -+ err = au_d_hashed_positive(a->dst_dentry); -+ if (unlikely(err)) -+ goto out_unlock; -+ } else if (unlikely(IS_DEADDIR(a->dst_inode))) -+ goto out_unlock; -+ } else if (unlikely(d_unhashed(a->dst_dentry))) -+ goto out_unlock; -+ -+ /* -+ * is it possible? -+ * yes, it happened (in linux-3.3-rcN) but I don't know why. -+ * there may exist a problem somewhere else. -+ */ -+ err = -EINVAL; -+ if (unlikely(d_inode(a->dst_parent) == d_inode(a->src_dentry))) -+ goto out_unlock; -+ -+ au_fset_ren(a->flags, ISSAMEDIR); /* temporary */ -+ di_write_lock_parent(a->dst_parent); -+ -+ /* which branch we process */ -+ err = au_ren_wbr(a); -+ if (unlikely(err < 0)) -+ goto out_parent; -+ a->br = au_sbr(a->dst_dentry->d_sb, a->btgt); -+ a->h_path.mnt = au_br_mnt(a->br); -+ -+ /* are they available to be renamed */ -+ err = au_ren_may_dir(a); -+ if (unlikely(err)) -+ goto out_children; -+ -+ /* prepare the writable parent dir on the same branch */ -+ if (a->dst_btop == a->btgt) { -+ au_fset_ren(a->flags, WHDST); -+ } else { -+ err = au_cpup_dirs(a->dst_dentry, a->btgt); -+ if (unlikely(err)) -+ goto out_children; -+ } -+ -+ if (a->src_dir != a->dst_dir) { -+ /* -+ * this temporary unlock is safe, -+ * because both dir->i_mutex are locked. -+ */ -+ di_write_unlock(a->dst_parent); -+ di_write_lock_parent(a->src_parent); -+ err = au_wr_dir_need_wh(a->src_dentry, -+ au_ftest_ren(a->flags, ISDIR), -+ &a->btgt); -+ di_write_unlock(a->src_parent); -+ di_write_lock2_parent(a->src_parent, a->dst_parent, /*isdir*/1); -+ au_fclr_ren(a->flags, ISSAMEDIR); -+ } else -+ err = au_wr_dir_need_wh(a->src_dentry, -+ au_ftest_ren(a->flags, ISDIR), -+ &a->btgt); -+ if (unlikely(err < 0)) -+ goto out_children; -+ if (err) -+ au_fset_ren(a->flags, WHSRC); -+ -+ /* cpup src */ -+ if (a->src_btop != a->btgt) { -+ struct au_pin pin; -+ -+ err = au_pin(&pin, a->src_dentry, a->btgt, -+ au_opt_udba(a->src_dentry->d_sb), -+ AuPin_DI_LOCKED | AuPin_MNT_WRITE); -+ if (!err) { -+ struct au_cp_generic cpg = { -+ .dentry = a->src_dentry, -+ .bdst = a->btgt, -+ .bsrc = a->src_btop, -+ .len = -1, -+ .pin = &pin, -+ .flags = AuCpup_DTIME | AuCpup_HOPEN -+ }; -+ AuDebugOn(au_dbtop(a->src_dentry) != a->src_btop); -+ err = au_sio_cpup_simple(&cpg); -+ au_unpin(&pin); -+ } -+ if (unlikely(err)) -+ goto out_children; -+ a->src_btop = a->btgt; -+ a->src_h_dentry = au_h_dptr(a->src_dentry, a->btgt); -+ au_fset_ren(a->flags, WHSRC); -+ } -+ -+ /* lock them all */ -+ err = au_ren_lock(a); -+ if (unlikely(err)) -+ /* leave the copied-up one */ -+ goto out_children; -+ -+ if (!au_opt_test(au_mntflags(a->dst_dir->i_sb), UDBA_NONE)) -+ err = au_may_ren(a); -+ else if (unlikely(a->dst_dentry->d_name.len > AUFS_MAX_NAMELEN)) -+ err = -ENAMETOOLONG; -+ if (unlikely(err)) -+ goto out_hdir; -+ -+ /* store timestamps to be revertible */ -+ au_ren_dt(a); -+ -+ /* here we go */ -+ err = do_rename(a); -+ if (unlikely(err)) -+ goto out_dt; -+ -+ /* update dir attributes */ -+ au_ren_refresh_dir(a); -+ -+ /* dput/iput all lower dentries */ -+ au_ren_refresh(a); -+ -+ goto out_hdir; /* success */ -+ -+out_dt: -+ au_ren_rev_dt(err, a); -+out_hdir: -+ au_ren_unlock(a); -+out_children: -+ au_nhash_wh_free(&a->whlist); -+ if (err && a->dst_inode && a->dst_btop != a->btgt) { -+ AuDbg("btop %d, btgt %d\n", a->dst_btop, a->btgt); -+ au_set_h_dptr(a->dst_dentry, a->btgt, NULL); -+ au_set_dbtop(a->dst_dentry, a->dst_btop); -+ } -+out_parent: -+ if (!err) -+ d_move(a->src_dentry, a->dst_dentry); -+ else { -+ au_update_dbtop(a->dst_dentry); -+ if (!a->dst_inode) -+ d_drop(a->dst_dentry); -+ } -+ if (au_ftest_ren(a->flags, ISSAMEDIR)) -+ di_write_unlock(a->dst_parent); -+ else -+ di_write_unlock2(a->src_parent, a->dst_parent); -+out_unlock: -+ aufs_read_and_write_unlock2(a->dst_dentry, a->src_dentry); -+out_free: -+ iput(a->dst_inode); -+ if (a->thargs) -+ au_whtmp_rmdir_free(a->thargs); -+ au_delayed_kfree(a); -+out: -+ AuTraceErr(err); -+ return err; -+} -diff --git a/fs/aufs/iinfo.c b/fs/aufs/iinfo.c -new file mode 100644 -index 0000000..975cff3 ---- /dev/null -+++ b/fs/aufs/iinfo.c -@@ -0,0 +1,272 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * inode private data -+ */ -+ -+#include "aufs.h" -+ -+struct inode *au_h_iptr(struct inode *inode, aufs_bindex_t bindex) -+{ -+ struct inode *h_inode; -+ struct au_hinode *hinode; -+ -+ IiMustAnyLock(inode); -+ -+ hinode = au_hinode(au_ii(inode), bindex); -+ h_inode = hinode->hi_inode; -+ AuDebugOn(h_inode && atomic_read(&h_inode->i_count) <= 0); -+ return h_inode; -+} -+ -+/* todo: hard/soft set? */ -+void au_hiput(struct au_hinode *hinode) -+{ -+ au_hn_free(hinode); -+ dput(hinode->hi_whdentry); -+ iput(hinode->hi_inode); -+} -+ -+unsigned int au_hi_flags(struct inode *inode, int isdir) -+{ -+ unsigned int flags; -+ const unsigned int mnt_flags = au_mntflags(inode->i_sb); -+ -+ flags = 0; -+ if (au_opt_test(mnt_flags, XINO)) -+ au_fset_hi(flags, XINO); -+ if (isdir && au_opt_test(mnt_flags, UDBA_HNOTIFY)) -+ au_fset_hi(flags, HNOTIFY); -+ return flags; -+} -+ -+void au_set_h_iptr(struct inode *inode, aufs_bindex_t bindex, -+ struct inode *h_inode, unsigned int flags) -+{ -+ struct au_hinode *hinode; -+ struct inode *hi; -+ struct au_iinfo *iinfo = au_ii(inode); -+ -+ IiMustWriteLock(inode); -+ -+ hinode = au_hinode(iinfo, bindex); -+ hi = hinode->hi_inode; -+ AuDebugOn(h_inode && atomic_read(&h_inode->i_count) <= 0); -+ -+ if (hi) -+ au_hiput(hinode); -+ hinode->hi_inode = h_inode; -+ if (h_inode) { -+ int err; -+ struct super_block *sb = inode->i_sb; -+ struct au_branch *br; -+ -+ AuDebugOn(inode->i_mode -+ && (h_inode->i_mode & S_IFMT) -+ != (inode->i_mode & S_IFMT)); -+ if (bindex == iinfo->ii_btop) -+ au_cpup_igen(inode, h_inode); -+ br = au_sbr(sb, bindex); -+ hinode->hi_id = br->br_id; -+ if (au_ftest_hi(flags, XINO)) { -+ err = au_xino_write(sb, bindex, h_inode->i_ino, -+ inode->i_ino); -+ if (unlikely(err)) -+ AuIOErr1("failed au_xino_write() %d\n", err); -+ } -+ -+ if (au_ftest_hi(flags, HNOTIFY) -+ && au_br_hnotifyable(br->br_perm)) { -+ err = au_hn_alloc(hinode, inode); -+ if (unlikely(err)) -+ AuIOErr1("au_hn_alloc() %d\n", err); -+ } -+ } -+} -+ -+void au_set_hi_wh(struct inode *inode, aufs_bindex_t bindex, -+ struct dentry *h_wh) -+{ -+ struct au_hinode *hinode; -+ -+ IiMustWriteLock(inode); -+ -+ hinode = au_hinode(au_ii(inode), bindex); -+ AuDebugOn(hinode->hi_whdentry); -+ hinode->hi_whdentry = h_wh; -+} -+ -+void au_update_iigen(struct inode *inode, int half) -+{ -+ struct au_iinfo *iinfo; -+ struct au_iigen *iigen; -+ unsigned int sigen; -+ -+ sigen = au_sigen(inode->i_sb); -+ iinfo = au_ii(inode); -+ iigen = &iinfo->ii_generation; -+ spin_lock(&iigen->ig_spin); -+ iigen->ig_generation = sigen; -+ if (half) -+ au_ig_fset(iigen->ig_flags, HALF_REFRESHED); -+ else -+ au_ig_fclr(iigen->ig_flags, HALF_REFRESHED); -+ spin_unlock(&iigen->ig_spin); -+} -+ -+/* it may be called at remount time, too */ -+void au_update_ibrange(struct inode *inode, int do_put_zero) -+{ -+ struct au_iinfo *iinfo; -+ aufs_bindex_t bindex, bbot; -+ -+ AuDebugOn(au_is_bad_inode(inode)); -+ IiMustWriteLock(inode); -+ -+ iinfo = au_ii(inode); -+ if (do_put_zero && iinfo->ii_btop >= 0) { -+ for (bindex = iinfo->ii_btop; bindex <= iinfo->ii_bbot; -+ bindex++) { -+ struct inode *h_i; -+ -+ h_i = au_hinode(iinfo, bindex)->hi_inode; -+ if (h_i -+ && !h_i->i_nlink -+ && !(h_i->i_state & I_LINKABLE)) -+ au_set_h_iptr(inode, bindex, NULL, 0); -+ } -+ } -+ -+ iinfo->ii_btop = -1; -+ iinfo->ii_bbot = -1; -+ bbot = au_sbbot(inode->i_sb); -+ for (bindex = 0; bindex <= bbot; bindex++) -+ if (au_hinode(iinfo, bindex)->hi_inode) { -+ iinfo->ii_btop = bindex; -+ break; -+ } -+ if (iinfo->ii_btop >= 0) -+ for (bindex = bbot; bindex >= iinfo->ii_btop; bindex--) -+ if (au_hinode(iinfo, bindex)->hi_inode) { -+ iinfo->ii_bbot = bindex; -+ break; -+ } -+ AuDebugOn(iinfo->ii_btop > iinfo->ii_bbot); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+void au_icntnr_init_once(void *_c) -+{ -+ struct au_icntnr *c = _c; -+ struct au_iinfo *iinfo = &c->iinfo; -+ -+ spin_lock_init(&iinfo->ii_generation.ig_spin); -+ au_rw_init(&iinfo->ii_rwsem); -+ inode_init_once(&c->vfs_inode); -+} -+ -+void au_hinode_init(struct au_hinode *hinode) -+{ -+ hinode->hi_inode = NULL; -+ hinode->hi_id = -1; -+ au_hn_init(hinode); -+ hinode->hi_whdentry = NULL; -+} -+ -+int au_iinfo_init(struct inode *inode) -+{ -+ struct au_iinfo *iinfo; -+ struct super_block *sb; -+ struct au_hinode *hi; -+ int nbr, i; -+ -+ sb = inode->i_sb; -+ iinfo = &(container_of(inode, struct au_icntnr, vfs_inode)->iinfo); -+ nbr = au_sbbot(sb) + 1; -+ if (unlikely(nbr <= 0)) -+ nbr = 1; -+ hi = kmalloc_array(nbr, sizeof(*iinfo->ii_hinode), GFP_NOFS); -+ if (hi) { -+ au_ninodes_inc(sb); -+ -+ iinfo->ii_hinode = hi; -+ for (i = 0; i < nbr; i++, hi++) -+ au_hinode_init(hi); -+ -+ iinfo->ii_generation.ig_generation = au_sigen(sb); -+ iinfo->ii_btop = -1; -+ iinfo->ii_bbot = -1; -+ iinfo->ii_vdir = NULL; -+ return 0; -+ } -+ return -ENOMEM; -+} -+ -+int au_hinode_realloc(struct au_iinfo *iinfo, int nbr, int may_shrink) -+{ -+ int err, i; -+ struct au_hinode *hip; -+ -+ AuRwMustWriteLock(&iinfo->ii_rwsem); -+ -+ err = -ENOMEM; -+ hip = au_krealloc(iinfo->ii_hinode, sizeof(*hip) * nbr, GFP_NOFS, -+ may_shrink); -+ if (hip) { -+ iinfo->ii_hinode = hip; -+ i = iinfo->ii_bbot + 1; -+ hip += i; -+ for (; i < nbr; i++, hip++) -+ au_hinode_init(hip); -+ err = 0; -+ } -+ -+ return err; -+} -+ -+void au_iinfo_fin(struct inode *inode) -+{ -+ struct au_iinfo *iinfo; -+ struct au_hinode *hi; -+ struct super_block *sb; -+ aufs_bindex_t bindex, bbot; -+ const unsigned char unlinked = !inode->i_nlink; -+ -+ AuDebugOn(au_is_bad_inode(inode)); -+ -+ sb = inode->i_sb; -+ au_ninodes_dec(sb); -+ if (si_pid_test(sb)) -+ au_xino_delete_inode(inode, unlinked); -+ else { -+ /* -+ * it is safe to hide the dependency between sbinfo and -+ * sb->s_umount. -+ */ -+ lockdep_off(); -+ si_noflush_read_lock(sb); -+ au_xino_delete_inode(inode, unlinked); -+ si_read_unlock(sb); -+ lockdep_on(); -+ } -+ -+ iinfo = au_ii(inode); -+ if (iinfo->ii_vdir) -+ au_vdir_free(iinfo->ii_vdir, /*atonce*/0); -+ -+ bindex = iinfo->ii_btop; -+ if (bindex >= 0) { -+ hi = au_hinode(iinfo, bindex); -+ bbot = iinfo->ii_bbot; -+ while (bindex++ <= bbot) { -+ if (hi->hi_inode) -+ au_hiput(hi); -+ hi++; -+ } -+ } -+ au_delayed_kfree(iinfo->ii_hinode); -+ AuRwDestroy(&iinfo->ii_rwsem); -+} -diff --git a/fs/aufs/inode.c b/fs/aufs/inode.c -new file mode 100644 -index 0000000..8f7446d ---- /dev/null -+++ b/fs/aufs/inode.c -@@ -0,0 +1,506 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * inode functions -+ */ -+ -+#include "aufs.h" -+ -+struct inode *au_igrab(struct inode *inode) -+{ -+ if (inode) { -+ AuDebugOn(!atomic_read(&inode->i_count)); -+ ihold(inode); -+ } -+ return inode; -+} -+ -+static void au_refresh_hinode_attr(struct inode *inode, int do_version) -+{ -+ au_cpup_attr_all(inode, /*force*/0); -+ au_update_iigen(inode, /*half*/1); -+ if (do_version) -+ inode->i_version++; -+} -+ -+static int au_ii_refresh(struct inode *inode, int *update) -+{ -+ int err, e, nbr; -+ umode_t type; -+ aufs_bindex_t bindex, new_bindex; -+ struct super_block *sb; -+ struct au_iinfo *iinfo; -+ struct au_hinode *p, *q, tmp; -+ -+ AuDebugOn(au_is_bad_inode(inode)); -+ IiMustWriteLock(inode); -+ -+ *update = 0; -+ sb = inode->i_sb; -+ nbr = au_sbbot(sb) + 1; -+ type = inode->i_mode & S_IFMT; -+ iinfo = au_ii(inode); -+ err = au_hinode_realloc(iinfo, nbr, /*may_shrink*/0); -+ if (unlikely(err)) -+ goto out; -+ -+ AuDebugOn(iinfo->ii_btop < 0); -+ p = au_hinode(iinfo, iinfo->ii_btop); -+ for (bindex = iinfo->ii_btop; bindex <= iinfo->ii_bbot; -+ bindex++, p++) { -+ if (!p->hi_inode) -+ continue; -+ -+ AuDebugOn(type != (p->hi_inode->i_mode & S_IFMT)); -+ new_bindex = au_br_index(sb, p->hi_id); -+ if (new_bindex == bindex) -+ continue; -+ -+ if (new_bindex < 0) { -+ *update = 1; -+ au_hiput(p); -+ p->hi_inode = NULL; -+ continue; -+ } -+ -+ if (new_bindex < iinfo->ii_btop) -+ iinfo->ii_btop = new_bindex; -+ if (iinfo->ii_bbot < new_bindex) -+ iinfo->ii_bbot = new_bindex; -+ /* swap two lower inode, and loop again */ -+ q = au_hinode(iinfo, new_bindex); -+ tmp = *q; -+ *q = *p; -+ *p = tmp; -+ if (tmp.hi_inode) { -+ bindex--; -+ p--; -+ } -+ } -+ au_update_ibrange(inode, /*do_put_zero*/0); -+ au_hinode_realloc(iinfo, nbr, /*may_shrink*/1); /* harmless if err */ -+ e = au_dy_irefresh(inode); -+ if (unlikely(e && !err)) -+ err = e; -+ -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+void au_refresh_iop(struct inode *inode, int force_getattr) -+{ -+ int type; -+ struct au_sbinfo *sbi = au_sbi(inode->i_sb); -+ const struct inode_operations *iop -+ = force_getattr ? aufs_iop : sbi->si_iop_array; -+ -+ if (inode->i_op == iop) -+ return; -+ -+ switch (inode->i_mode & S_IFMT) { -+ case S_IFDIR: -+ type = AuIop_DIR; -+ break; -+ case S_IFLNK: -+ type = AuIop_SYMLINK; -+ break; -+ default: -+ type = AuIop_OTHER; -+ break; -+ } -+ -+ inode->i_op = iop + type; -+ /* unnecessary smp_wmb() */ -+} -+ -+int au_refresh_hinode_self(struct inode *inode) -+{ -+ int err, update; -+ -+ err = au_ii_refresh(inode, &update); -+ if (!err) -+ au_refresh_hinode_attr(inode, update && S_ISDIR(inode->i_mode)); -+ -+ AuTraceErr(err); -+ return err; -+} -+ -+int au_refresh_hinode(struct inode *inode, struct dentry *dentry) -+{ -+ int err, e, update; -+ unsigned int flags; -+ umode_t mode; -+ aufs_bindex_t bindex, bbot; -+ unsigned char isdir; -+ struct au_hinode *p; -+ struct au_iinfo *iinfo; -+ -+ err = au_ii_refresh(inode, &update); -+ if (unlikely(err)) -+ goto out; -+ -+ update = 0; -+ iinfo = au_ii(inode); -+ p = au_hinode(iinfo, iinfo->ii_btop); -+ mode = (inode->i_mode & S_IFMT); -+ isdir = S_ISDIR(mode); -+ flags = au_hi_flags(inode, isdir); -+ bbot = au_dbbot(dentry); -+ for (bindex = au_dbtop(dentry); bindex <= bbot; bindex++) { -+ struct inode *h_i, *h_inode; -+ struct dentry *h_d; -+ -+ h_d = au_h_dptr(dentry, bindex); -+ if (!h_d || d_is_negative(h_d)) -+ continue; -+ -+ h_inode = d_inode(h_d); -+ AuDebugOn(mode != (h_inode->i_mode & S_IFMT)); -+ if (iinfo->ii_btop <= bindex && bindex <= iinfo->ii_bbot) { -+ h_i = au_h_iptr(inode, bindex); -+ if (h_i) { -+ if (h_i == h_inode) -+ continue; -+ err = -EIO; -+ break; -+ } -+ } -+ if (bindex < iinfo->ii_btop) -+ iinfo->ii_btop = bindex; -+ if (iinfo->ii_bbot < bindex) -+ iinfo->ii_bbot = bindex; -+ au_set_h_iptr(inode, bindex, au_igrab(h_inode), flags); -+ update = 1; -+ } -+ au_update_ibrange(inode, /*do_put_zero*/0); -+ e = au_dy_irefresh(inode); -+ if (unlikely(e && !err)) -+ err = e; -+ if (!err) -+ au_refresh_hinode_attr(inode, update && isdir); -+ -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+static int set_inode(struct inode *inode, struct dentry *dentry) -+{ -+ int err; -+ unsigned int flags; -+ umode_t mode; -+ aufs_bindex_t bindex, btop, btail; -+ unsigned char isdir; -+ struct dentry *h_dentry; -+ struct inode *h_inode; -+ struct au_iinfo *iinfo; -+ struct inode_operations *iop; -+ -+ IiMustWriteLock(inode); -+ -+ err = 0; -+ isdir = 0; -+ iop = au_sbi(inode->i_sb)->si_iop_array; -+ btop = au_dbtop(dentry); -+ h_dentry = au_h_dptr(dentry, btop); -+ h_inode = d_inode(h_dentry); -+ mode = h_inode->i_mode; -+ switch (mode & S_IFMT) { -+ case S_IFREG: -+ btail = au_dbtail(dentry); -+ inode->i_op = iop + AuIop_OTHER; -+ inode->i_fop = &aufs_file_fop; -+ err = au_dy_iaop(inode, btop, h_inode); -+ if (unlikely(err)) -+ goto out; -+ break; -+ case S_IFDIR: -+ isdir = 1; -+ btail = au_dbtaildir(dentry); -+ inode->i_op = iop + AuIop_DIR; -+ inode->i_fop = &aufs_dir_fop; -+ break; -+ case S_IFLNK: -+ btail = au_dbtail(dentry); -+ inode->i_op = iop + AuIop_SYMLINK; -+ break; -+ case S_IFBLK: -+ case S_IFCHR: -+ case S_IFIFO: -+ case S_IFSOCK: -+ btail = au_dbtail(dentry); -+ inode->i_op = iop + AuIop_OTHER; -+ init_special_inode(inode, mode, h_inode->i_rdev); -+ break; -+ default: -+ AuIOErr("Unknown file type 0%o\n", mode); -+ err = -EIO; -+ goto out; -+ } -+ -+ /* do not set hnotify for whiteouted dirs (SHWH mode) */ -+ flags = au_hi_flags(inode, isdir); -+ if (au_opt_test(au_mntflags(dentry->d_sb), SHWH) -+ && au_ftest_hi(flags, HNOTIFY) -+ && dentry->d_name.len > AUFS_WH_PFX_LEN -+ && !memcmp(dentry->d_name.name, AUFS_WH_PFX, AUFS_WH_PFX_LEN)) -+ au_fclr_hi(flags, HNOTIFY); -+ iinfo = au_ii(inode); -+ iinfo->ii_btop = btop; -+ iinfo->ii_bbot = btail; -+ for (bindex = btop; bindex <= btail; bindex++) { -+ h_dentry = au_h_dptr(dentry, bindex); -+ if (h_dentry) -+ au_set_h_iptr(inode, bindex, -+ au_igrab(d_inode(h_dentry)), flags); -+ } -+ au_cpup_attr_all(inode, /*force*/1); -+ /* -+ * to force calling aufs_get_acl() every time, -+ * do not call cache_no_acl() for aufs inode. -+ */ -+ -+out: -+ return err; -+} -+ -+/* -+ * successful returns with iinfo write_locked -+ * minus: errno -+ * zero: success, matched -+ * plus: no error, but unmatched -+ */ -+static int reval_inode(struct inode *inode, struct dentry *dentry) -+{ -+ int err; -+ unsigned int gen, igflags; -+ aufs_bindex_t bindex, bbot; -+ struct inode *h_inode, *h_dinode; -+ struct dentry *h_dentry; -+ -+ /* -+ * before this function, if aufs got any iinfo lock, it must be only -+ * one, the parent dir. -+ * it can happen by UDBA and the obsoleted inode number. -+ */ -+ err = -EIO; -+ if (unlikely(inode->i_ino == parent_ino(dentry))) -+ goto out; -+ -+ err = 1; -+ ii_write_lock_new_child(inode); -+ h_dentry = au_h_dptr(dentry, au_dbtop(dentry)); -+ h_dinode = d_inode(h_dentry); -+ bbot = au_ibbot(inode); -+ for (bindex = au_ibtop(inode); bindex <= bbot; bindex++) { -+ h_inode = au_h_iptr(inode, bindex); -+ if (!h_inode || h_inode != h_dinode) -+ continue; -+ -+ err = 0; -+ gen = au_iigen(inode, &igflags); -+ if (gen == au_digen(dentry) -+ && !au_ig_ftest(igflags, HALF_REFRESHED)) -+ break; -+ -+ /* fully refresh inode using dentry */ -+ err = au_refresh_hinode(inode, dentry); -+ if (!err) -+ au_update_iigen(inode, /*half*/0); -+ break; -+ } -+ -+ if (unlikely(err)) -+ ii_write_unlock(inode); -+out: -+ return err; -+} -+ -+int au_ino(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino, -+ unsigned int d_type, ino_t *ino) -+{ -+ int err; -+ struct mutex *mtx; -+ -+ /* prevent hardlinked inode number from race condition */ -+ mtx = NULL; -+ if (d_type != DT_DIR) { -+ mtx = &au_sbr(sb, bindex)->br_xino.xi_nondir_mtx; -+ mutex_lock(mtx); -+ } -+ err = au_xino_read(sb, bindex, h_ino, ino); -+ if (unlikely(err)) -+ goto out; -+ -+ if (!*ino) { -+ err = -EIO; -+ *ino = au_xino_new_ino(sb); -+ if (unlikely(!*ino)) -+ goto out; -+ err = au_xino_write(sb, bindex, h_ino, *ino); -+ if (unlikely(err)) -+ goto out; -+ } -+ -+out: -+ if (mtx) -+ mutex_unlock(mtx); -+ return err; -+} -+ -+/* successful returns with iinfo write_locked */ -+/* todo: return with unlocked? */ -+struct inode *au_new_inode(struct dentry *dentry, int must_new) -+{ -+ struct inode *inode, *h_inode; -+ struct dentry *h_dentry; -+ struct super_block *sb; -+ struct mutex *mtx; -+ ino_t h_ino, ino; -+ int err; -+ aufs_bindex_t btop; -+ -+ sb = dentry->d_sb; -+ btop = au_dbtop(dentry); -+ h_dentry = au_h_dptr(dentry, btop); -+ h_inode = d_inode(h_dentry); -+ h_ino = h_inode->i_ino; -+ -+ /* -+ * stop 'race'-ing between hardlinks under different -+ * parents. -+ */ -+ mtx = NULL; -+ if (!d_is_dir(h_dentry)) -+ mtx = &au_sbr(sb, btop)->br_xino.xi_nondir_mtx; -+ -+new_ino: -+ if (mtx) -+ mutex_lock(mtx); -+ err = au_xino_read(sb, btop, h_ino, &ino); -+ inode = ERR_PTR(err); -+ if (unlikely(err)) -+ goto out; -+ -+ if (!ino) { -+ ino = au_xino_new_ino(sb); -+ if (unlikely(!ino)) { -+ inode = ERR_PTR(-EIO); -+ goto out; -+ } -+ } -+ -+ AuDbg("i%lu\n", (unsigned long)ino); -+ inode = au_iget_locked(sb, ino); -+ err = PTR_ERR(inode); -+ if (IS_ERR(inode)) -+ goto out; -+ -+ AuDbg("%lx, new %d\n", inode->i_state, !!(inode->i_state & I_NEW)); -+ if (inode->i_state & I_NEW) { -+ ii_write_lock_new_child(inode); -+ err = set_inode(inode, dentry); -+ if (!err) { -+ unlock_new_inode(inode); -+ goto out; /* success */ -+ } -+ -+ /* -+ * iget_failed() calls iput(), but we need to call -+ * ii_write_unlock() after iget_failed(). so dirty hack for -+ * i_count. -+ */ -+ atomic_inc(&inode->i_count); -+ iget_failed(inode); -+ ii_write_unlock(inode); -+ au_xino_write(sb, btop, h_ino, /*ino*/0); -+ /* ignore this error */ -+ goto out_iput; -+ } else if (!must_new && !IS_DEADDIR(inode) && inode->i_nlink) { -+ /* -+ * horrible race condition between lookup, readdir and copyup -+ * (or something). -+ */ -+ if (mtx) -+ mutex_unlock(mtx); -+ err = reval_inode(inode, dentry); -+ if (unlikely(err < 0)) { -+ mtx = NULL; -+ goto out_iput; -+ } -+ -+ if (!err) { -+ mtx = NULL; -+ goto out; /* success */ -+ } else if (mtx) -+ mutex_lock(mtx); -+ } -+ -+ if (unlikely(au_test_fs_unique_ino(h_inode))) -+ AuWarn1("Warning: Un-notified UDBA or repeatedly renamed dir," -+ " b%d, %s, %pd, hi%lu, i%lu.\n", -+ btop, au_sbtype(h_dentry->d_sb), dentry, -+ (unsigned long)h_ino, (unsigned long)ino); -+ ino = 0; -+ err = au_xino_write(sb, btop, h_ino, /*ino*/0); -+ if (!err) { -+ iput(inode); -+ if (mtx) -+ mutex_unlock(mtx); -+ goto new_ino; -+ } -+ -+out_iput: -+ iput(inode); -+ inode = ERR_PTR(err); -+out: -+ if (mtx) -+ mutex_unlock(mtx); -+ return inode; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+int au_test_ro(struct super_block *sb, aufs_bindex_t bindex, -+ struct inode *inode) -+{ -+ int err; -+ struct inode *hi; -+ -+ err = au_br_rdonly(au_sbr(sb, bindex)); -+ -+ /* pseudo-link after flushed may happen out of bounds */ -+ if (!err -+ && inode -+ && au_ibtop(inode) <= bindex -+ && bindex <= au_ibbot(inode)) { -+ /* -+ * permission check is unnecessary since vfsub routine -+ * will be called later -+ */ -+ hi = au_h_iptr(inode, bindex); -+ if (hi) -+ err = IS_IMMUTABLE(hi) ? -EROFS : 0; -+ } -+ -+ return err; -+} -+ -+int au_test_h_perm(struct inode *h_inode, int mask) -+{ -+ if (uid_eq(current_fsuid(), GLOBAL_ROOT_UID)) -+ return 0; -+ return inode_permission(h_inode, mask); -+} -+ -+int au_test_h_perm_sio(struct inode *h_inode, int mask) -+{ -+ if (au_test_nfs(h_inode->i_sb) -+ && (mask & MAY_WRITE) -+ && S_ISDIR(h_inode->i_mode)) -+ mask |= MAY_READ; /* force permission check */ -+ return au_test_h_perm(h_inode, mask); -+} -diff --git a/fs/aufs/inode.h b/fs/aufs/inode.h -new file mode 100644 -index 0000000..33d9f5e ---- /dev/null -+++ b/fs/aufs/inode.h -@@ -0,0 +1,687 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * inode operations -+ */ -+ -+#ifndef __AUFS_INODE_H__ -+#define __AUFS_INODE_H__ -+ -+#ifdef __KERNEL__ -+ -+#include -+#include "rwsem.h" -+ -+struct vfsmount; -+ -+struct au_hnotify { -+#ifdef CONFIG_AUFS_HNOTIFY -+#ifdef CONFIG_AUFS_HFSNOTIFY -+ /* never use fsnotify_add_vfsmount_mark() */ -+ struct fsnotify_mark hn_mark; -+#endif -+ union { -+ struct inode *hn_aufs_inode; /* no get/put */ -+ struct llist_node hn_lnode; /* delayed free */ -+ }; -+#endif -+} ____cacheline_aligned_in_smp; -+ -+struct au_hinode { -+ struct inode *hi_inode; -+ aufs_bindex_t hi_id; -+#ifdef CONFIG_AUFS_HNOTIFY -+ struct au_hnotify *hi_notify; -+#endif -+ -+ /* reference to the copied-up whiteout with get/put */ -+ struct dentry *hi_whdentry; -+}; -+ -+/* ig_flags */ -+#define AuIG_HALF_REFRESHED 1 -+#define au_ig_ftest(flags, name) ((flags) & AuIG_##name) -+#define au_ig_fset(flags, name) \ -+ do { (flags) |= AuIG_##name; } while (0) -+#define au_ig_fclr(flags, name) \ -+ do { (flags) &= ~AuIG_##name; } while (0) -+ -+struct au_iigen { -+ spinlock_t ig_spin; -+ __u32 ig_generation, ig_flags; -+}; -+ -+struct au_vdir; -+struct au_iinfo { -+ struct au_iigen ii_generation; -+ struct super_block *ii_hsb1; /* no get/put */ -+ -+ struct au_rwsem ii_rwsem; -+ aufs_bindex_t ii_btop, ii_bbot; -+ __u32 ii_higen; -+ struct au_hinode *ii_hinode; -+ struct au_vdir *ii_vdir; -+}; -+ -+struct au_icntnr { -+ struct au_iinfo iinfo; -+ struct inode vfs_inode; -+ union { -+ struct hlist_node plink; -+ struct llist_node lnode; /* delayed free */ -+ }; -+} ____cacheline_aligned_in_smp; -+ -+/* au_pin flags */ -+#define AuPin_DI_LOCKED 1 -+#define AuPin_MNT_WRITE (1 << 1) -+#define au_ftest_pin(flags, name) ((flags) & AuPin_##name) -+#define au_fset_pin(flags, name) \ -+ do { (flags) |= AuPin_##name; } while (0) -+#define au_fclr_pin(flags, name) \ -+ do { (flags) &= ~AuPin_##name; } while (0) -+ -+struct au_pin { -+ /* input */ -+ struct dentry *dentry; -+ unsigned int udba; -+ unsigned char lsc_di, lsc_hi, flags; -+ aufs_bindex_t bindex; -+ -+ /* output */ -+ struct dentry *parent; -+ struct au_hinode *hdir; -+ struct vfsmount *h_mnt; -+ -+ /* temporary unlock/relock for copyup */ -+ struct dentry *h_dentry, *h_parent; -+ struct au_branch *br; -+ struct task_struct *task; -+}; -+ -+void au_pin_hdir_unlock(struct au_pin *p); -+int au_pin_hdir_lock(struct au_pin *p); -+int au_pin_hdir_relock(struct au_pin *p); -+void au_pin_hdir_acquire_nest(struct au_pin *p); -+void au_pin_hdir_release(struct au_pin *p); -+ -+/* ---------------------------------------------------------------------- */ -+ -+static inline struct au_iinfo *au_ii(struct inode *inode) -+{ -+ BUG_ON(is_bad_inode(inode)); -+ return &(container_of(inode, struct au_icntnr, vfs_inode)->iinfo); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* inode.c */ -+struct inode *au_igrab(struct inode *inode); -+void au_refresh_iop(struct inode *inode, int force_getattr); -+int au_refresh_hinode_self(struct inode *inode); -+int au_refresh_hinode(struct inode *inode, struct dentry *dentry); -+int au_ino(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino, -+ unsigned int d_type, ino_t *ino); -+struct inode *au_new_inode(struct dentry *dentry, int must_new); -+int au_test_ro(struct super_block *sb, aufs_bindex_t bindex, -+ struct inode *inode); -+int au_test_h_perm(struct inode *h_inode, int mask); -+int au_test_h_perm_sio(struct inode *h_inode, int mask); -+ -+static inline int au_wh_ino(struct super_block *sb, aufs_bindex_t bindex, -+ ino_t h_ino, unsigned int d_type, ino_t *ino) -+{ -+#ifdef CONFIG_AUFS_SHWH -+ return au_ino(sb, bindex, h_ino, d_type, ino); -+#else -+ return 0; -+#endif -+} -+ -+/* i_op.c */ -+enum { -+ AuIop_SYMLINK, -+ AuIop_DIR, -+ AuIop_OTHER, -+ AuIop_Last -+}; -+extern struct inode_operations aufs_iop[AuIop_Last], -+ aufs_iop_nogetattr[AuIop_Last]; -+ -+/* au_wr_dir flags */ -+#define AuWrDir_ADD_ENTRY 1 -+#define AuWrDir_ISDIR (1 << 1) -+#define AuWrDir_TMPFILE (1 << 2) -+#define au_ftest_wrdir(flags, name) ((flags) & AuWrDir_##name) -+#define au_fset_wrdir(flags, name) \ -+ do { (flags) |= AuWrDir_##name; } while (0) -+#define au_fclr_wrdir(flags, name) \ -+ do { (flags) &= ~AuWrDir_##name; } while (0) -+ -+struct au_wr_dir_args { -+ aufs_bindex_t force_btgt; -+ unsigned char flags; -+}; -+int au_wr_dir(struct dentry *dentry, struct dentry *src_dentry, -+ struct au_wr_dir_args *args); -+ -+struct dentry *au_pinned_h_parent(struct au_pin *pin); -+void au_pin_init(struct au_pin *pin, struct dentry *dentry, -+ aufs_bindex_t bindex, int lsc_di, int lsc_hi, -+ unsigned int udba, unsigned char flags); -+int au_pin(struct au_pin *pin, struct dentry *dentry, aufs_bindex_t bindex, -+ unsigned int udba, unsigned char flags) __must_check; -+int au_do_pin(struct au_pin *pin) __must_check; -+void au_unpin(struct au_pin *pin); -+int au_reval_for_attr(struct dentry *dentry, unsigned int sigen); -+ -+#define AuIcpup_DID_CPUP 1 -+#define au_ftest_icpup(flags, name) ((flags) & AuIcpup_##name) -+#define au_fset_icpup(flags, name) \ -+ do { (flags) |= AuIcpup_##name; } while (0) -+#define au_fclr_icpup(flags, name) \ -+ do { (flags) &= ~AuIcpup_##name; } while (0) -+ -+struct au_icpup_args { -+ unsigned char flags; -+ unsigned char pin_flags; -+ aufs_bindex_t btgt; -+ unsigned int udba; -+ struct au_pin pin; -+ struct path h_path; -+ struct inode *h_inode; -+}; -+ -+int au_pin_and_icpup(struct dentry *dentry, struct iattr *ia, -+ struct au_icpup_args *a); -+ -+int au_h_path_getattr(struct dentry *dentry, int force, struct path *h_path); -+ -+/* i_op_add.c */ -+int au_may_add(struct dentry *dentry, aufs_bindex_t bindex, -+ struct dentry *h_parent, int isdir); -+int aufs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, -+ dev_t dev); -+int aufs_symlink(struct inode *dir, struct dentry *dentry, const char *symname); -+int aufs_create(struct inode *dir, struct dentry *dentry, umode_t mode, -+ bool want_excl); -+struct vfsub_aopen_args; -+int au_aopen_or_create(struct inode *dir, struct dentry *dentry, -+ struct vfsub_aopen_args *args); -+int aufs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode); -+int aufs_link(struct dentry *src_dentry, struct inode *dir, -+ struct dentry *dentry); -+int aufs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode); -+ -+/* i_op_del.c */ -+int au_wr_dir_need_wh(struct dentry *dentry, int isdir, aufs_bindex_t *bcpup); -+int au_may_del(struct dentry *dentry, aufs_bindex_t bindex, -+ struct dentry *h_parent, int isdir); -+int aufs_unlink(struct inode *dir, struct dentry *dentry); -+int aufs_rmdir(struct inode *dir, struct dentry *dentry); -+ -+/* i_op_ren.c */ -+int au_wbr(struct dentry *dentry, aufs_bindex_t btgt); -+int aufs_rename(struct inode *src_dir, struct dentry *src_dentry, -+ struct inode *dir, struct dentry *dentry); -+ -+/* iinfo.c */ -+struct inode *au_h_iptr(struct inode *inode, aufs_bindex_t bindex); -+void au_hiput(struct au_hinode *hinode); -+void au_set_hi_wh(struct inode *inode, aufs_bindex_t bindex, -+ struct dentry *h_wh); -+unsigned int au_hi_flags(struct inode *inode, int isdir); -+ -+/* hinode flags */ -+#define AuHi_XINO 1 -+#define AuHi_HNOTIFY (1 << 1) -+#define au_ftest_hi(flags, name) ((flags) & AuHi_##name) -+#define au_fset_hi(flags, name) \ -+ do { (flags) |= AuHi_##name; } while (0) -+#define au_fclr_hi(flags, name) \ -+ do { (flags) &= ~AuHi_##name; } while (0) -+ -+#ifndef CONFIG_AUFS_HNOTIFY -+#undef AuHi_HNOTIFY -+#define AuHi_HNOTIFY 0 -+#endif -+ -+void au_set_h_iptr(struct inode *inode, aufs_bindex_t bindex, -+ struct inode *h_inode, unsigned int flags); -+ -+void au_update_iigen(struct inode *inode, int half); -+void au_update_ibrange(struct inode *inode, int do_put_zero); -+ -+void au_icntnr_init_once(void *_c); -+void au_hinode_init(struct au_hinode *hinode); -+int au_iinfo_init(struct inode *inode); -+void au_iinfo_fin(struct inode *inode); -+int au_hinode_realloc(struct au_iinfo *iinfo, int nbr, int may_shrink); -+ -+#ifdef CONFIG_PROC_FS -+/* plink.c */ -+int au_plink_maint(struct super_block *sb, int flags); -+struct au_sbinfo; -+void au_plink_maint_leave(struct au_sbinfo *sbinfo); -+int au_plink_maint_enter(struct super_block *sb); -+#ifdef CONFIG_AUFS_DEBUG -+void au_plink_list(struct super_block *sb); -+#else -+AuStubVoid(au_plink_list, struct super_block *sb) -+#endif -+int au_plink_test(struct inode *inode); -+struct dentry *au_plink_lkup(struct inode *inode, aufs_bindex_t bindex); -+void au_plink_append(struct inode *inode, aufs_bindex_t bindex, -+ struct dentry *h_dentry); -+void au_plink_put(struct super_block *sb, int verbose); -+void au_plink_clean(struct super_block *sb, int verbose); -+void au_plink_half_refresh(struct super_block *sb, aufs_bindex_t br_id); -+#else -+AuStubInt0(au_plink_maint, struct super_block *sb, int flags); -+AuStubVoid(au_plink_maint_leave, struct au_sbinfo *sbinfo); -+AuStubInt0(au_plink_maint_enter, struct super_block *sb); -+AuStubVoid(au_plink_list, struct super_block *sb); -+AuStubInt0(au_plink_test, struct inode *inode); -+AuStub(struct dentry *, au_plink_lkup, return NULL, -+ struct inode *inode, aufs_bindex_t bindex); -+AuStubVoid(au_plink_append, struct inode *inode, aufs_bindex_t bindex, -+ struct dentry *h_dentry); -+AuStubVoid(au_plink_put, struct super_block *sb, int verbose); -+AuStubVoid(au_plink_clean, struct super_block *sb, int verbose); -+AuStubVoid(au_plink_half_refresh, struct super_block *sb, aufs_bindex_t br_id); -+#endif /* CONFIG_PROC_FS */ -+ -+#ifdef CONFIG_AUFS_XATTR -+/* xattr.c */ -+int au_cpup_xattr(struct dentry *h_dst, struct dentry *h_src, int ignore_flags, -+ unsigned int verbose); -+ssize_t aufs_listxattr(struct dentry *dentry, char *list, size_t size); -+ssize_t aufs_getxattr(struct dentry *dentry, struct inode *inode, -+ const char *name, void *value, size_t size); -+int aufs_setxattr(struct dentry *dentry, struct inode *inode, const char *name, -+ const void *value, size_t size, int flags); -+int aufs_removexattr(struct dentry *dentry, const char *name); -+ -+/* void au_xattr_init(struct super_block *sb); */ -+#else -+AuStubInt0(au_cpup_xattr, struct dentry *h_dst, struct dentry *h_src, -+ int ignore_flags, unsigned int verbose); -+/* AuStubVoid(au_xattr_init, struct super_block *sb); */ -+#endif -+ -+#ifdef CONFIG_FS_POSIX_ACL -+struct posix_acl *aufs_get_acl(struct inode *inode, int type); -+int aufs_set_acl(struct inode *inode, struct posix_acl *acl, int type); -+#endif -+ -+#if IS_ENABLED(CONFIG_AUFS_XATTR) || IS_ENABLED(CONFIG_FS_POSIX_ACL) -+enum { -+ AU_XATTR_SET, -+ AU_XATTR_REMOVE, -+ AU_ACL_SET -+}; -+ -+struct au_srxattr { -+ int type; -+ union { -+ struct { -+ const char *name; -+ const void *value; -+ size_t size; -+ int flags; -+ } set; -+ struct { -+ const char *name; -+ } remove; -+ struct { -+ struct posix_acl *acl; -+ int type; -+ } acl_set; -+ } u; -+}; -+ssize_t au_srxattr(struct dentry *dentry, struct inode *inode, -+ struct au_srxattr *arg); -+#endif -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* lock subclass for iinfo */ -+enum { -+ AuLsc_II_CHILD, /* child first */ -+ AuLsc_II_CHILD2, /* rename(2), link(2), and cpup at hnotify */ -+ AuLsc_II_CHILD3, /* copyup dirs */ -+ AuLsc_II_PARENT, /* see AuLsc_I_PARENT in vfsub.h */ -+ AuLsc_II_PARENT2, -+ AuLsc_II_PARENT3, /* copyup dirs */ -+ AuLsc_II_NEW_CHILD -+}; -+ -+/* -+ * ii_read_lock_child, ii_write_lock_child, -+ * ii_read_lock_child2, ii_write_lock_child2, -+ * ii_read_lock_child3, ii_write_lock_child3, -+ * ii_read_lock_parent, ii_write_lock_parent, -+ * ii_read_lock_parent2, ii_write_lock_parent2, -+ * ii_read_lock_parent3, ii_write_lock_parent3, -+ * ii_read_lock_new_child, ii_write_lock_new_child, -+ */ -+#define AuReadLockFunc(name, lsc) \ -+static inline void ii_read_lock_##name(struct inode *i) \ -+{ \ -+ au_rw_read_lock_nested(&au_ii(i)->ii_rwsem, AuLsc_II_##lsc); \ -+} -+ -+#define AuWriteLockFunc(name, lsc) \ -+static inline void ii_write_lock_##name(struct inode *i) \ -+{ \ -+ au_rw_write_lock_nested(&au_ii(i)->ii_rwsem, AuLsc_II_##lsc); \ -+} -+ -+#define AuRWLockFuncs(name, lsc) \ -+ AuReadLockFunc(name, lsc) \ -+ AuWriteLockFunc(name, lsc) -+ -+AuRWLockFuncs(child, CHILD); -+AuRWLockFuncs(child2, CHILD2); -+AuRWLockFuncs(child3, CHILD3); -+AuRWLockFuncs(parent, PARENT); -+AuRWLockFuncs(parent2, PARENT2); -+AuRWLockFuncs(parent3, PARENT3); -+AuRWLockFuncs(new_child, NEW_CHILD); -+ -+#undef AuReadLockFunc -+#undef AuWriteLockFunc -+#undef AuRWLockFuncs -+ -+/* -+ * ii_read_unlock, ii_write_unlock, ii_downgrade_lock -+ */ -+AuSimpleUnlockRwsemFuncs(ii, struct inode *i, &au_ii(i)->ii_rwsem); -+ -+#define IiMustNoWaiters(i) AuRwMustNoWaiters(&au_ii(i)->ii_rwsem) -+#define IiMustAnyLock(i) AuRwMustAnyLock(&au_ii(i)->ii_rwsem) -+#define IiMustWriteLock(i) AuRwMustWriteLock(&au_ii(i)->ii_rwsem) -+ -+/* ---------------------------------------------------------------------- */ -+ -+static inline void au_icntnr_init(struct au_icntnr *c) -+{ -+#ifdef CONFIG_AUFS_DEBUG -+ c->vfs_inode.i_mode = 0; -+#endif -+} -+ -+static inline unsigned int au_iigen(struct inode *inode, unsigned int *igflags) -+{ -+ unsigned int gen; -+ struct au_iinfo *iinfo; -+ struct au_iigen *iigen; -+ -+ iinfo = au_ii(inode); -+ iigen = &iinfo->ii_generation; -+ spin_lock(&iigen->ig_spin); -+ if (igflags) -+ *igflags = iigen->ig_flags; -+ gen = iigen->ig_generation; -+ spin_unlock(&iigen->ig_spin); -+ -+ return gen; -+} -+ -+/* tiny test for inode number */ -+/* tmpfs generation is too rough */ -+static inline int au_test_higen(struct inode *inode, struct inode *h_inode) -+{ -+ struct au_iinfo *iinfo; -+ -+ iinfo = au_ii(inode); -+ AuRwMustAnyLock(&iinfo->ii_rwsem); -+ return !(iinfo->ii_hsb1 == h_inode->i_sb -+ && iinfo->ii_higen == h_inode->i_generation); -+} -+ -+static inline void au_iigen_dec(struct inode *inode) -+{ -+ struct au_iinfo *iinfo; -+ struct au_iigen *iigen; -+ -+ iinfo = au_ii(inode); -+ iigen = &iinfo->ii_generation; -+ spin_lock(&iigen->ig_spin); -+ iigen->ig_generation--; -+ spin_unlock(&iigen->ig_spin); -+} -+ -+static inline int au_iigen_test(struct inode *inode, unsigned int sigen) -+{ -+ int err; -+ -+ err = 0; -+ if (unlikely(inode && au_iigen(inode, NULL) != sigen)) -+ err = -EIO; -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static inline struct au_hinode *au_hinode(struct au_iinfo *iinfo, -+ aufs_bindex_t bindex) -+{ -+ return iinfo->ii_hinode + bindex; -+} -+ -+static inline int au_is_bad_inode(struct inode *inode) -+{ -+ return !!(is_bad_inode(inode) || !au_hinode(au_ii(inode), 0)); -+} -+ -+static inline aufs_bindex_t au_ii_br_id(struct inode *inode, -+ aufs_bindex_t bindex) -+{ -+ IiMustAnyLock(inode); -+ return au_hinode(au_ii(inode), bindex)->hi_id; -+} -+ -+static inline aufs_bindex_t au_ibtop(struct inode *inode) -+{ -+ IiMustAnyLock(inode); -+ return au_ii(inode)->ii_btop; -+} -+ -+static inline aufs_bindex_t au_ibbot(struct inode *inode) -+{ -+ IiMustAnyLock(inode); -+ return au_ii(inode)->ii_bbot; -+} -+ -+static inline struct au_vdir *au_ivdir(struct inode *inode) -+{ -+ IiMustAnyLock(inode); -+ return au_ii(inode)->ii_vdir; -+} -+ -+static inline struct dentry *au_hi_wh(struct inode *inode, aufs_bindex_t bindex) -+{ -+ IiMustAnyLock(inode); -+ return au_hinode(au_ii(inode), bindex)->hi_whdentry; -+} -+ -+static inline void au_set_ibtop(struct inode *inode, aufs_bindex_t bindex) -+{ -+ IiMustWriteLock(inode); -+ au_ii(inode)->ii_btop = bindex; -+} -+ -+static inline void au_set_ibbot(struct inode *inode, aufs_bindex_t bindex) -+{ -+ IiMustWriteLock(inode); -+ au_ii(inode)->ii_bbot = bindex; -+} -+ -+static inline void au_set_ivdir(struct inode *inode, struct au_vdir *vdir) -+{ -+ IiMustWriteLock(inode); -+ au_ii(inode)->ii_vdir = vdir; -+} -+ -+static inline struct au_hinode *au_hi(struct inode *inode, aufs_bindex_t bindex) -+{ -+ IiMustAnyLock(inode); -+ return au_hinode(au_ii(inode), bindex); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static inline struct dentry *au_pinned_parent(struct au_pin *pin) -+{ -+ if (pin) -+ return pin->parent; -+ return NULL; -+} -+ -+static inline struct inode *au_pinned_h_dir(struct au_pin *pin) -+{ -+ if (pin && pin->hdir) -+ return pin->hdir->hi_inode; -+ return NULL; -+} -+ -+static inline struct au_hinode *au_pinned_hdir(struct au_pin *pin) -+{ -+ if (pin) -+ return pin->hdir; -+ return NULL; -+} -+ -+static inline void au_pin_set_dentry(struct au_pin *pin, struct dentry *dentry) -+{ -+ if (pin) -+ pin->dentry = dentry; -+} -+ -+static inline void au_pin_set_parent_lflag(struct au_pin *pin, -+ unsigned char lflag) -+{ -+ if (pin) { -+ if (lflag) -+ au_fset_pin(pin->flags, DI_LOCKED); -+ else -+ au_fclr_pin(pin->flags, DI_LOCKED); -+ } -+} -+ -+#if 0 /* reserved */ -+static inline void au_pin_set_parent(struct au_pin *pin, struct dentry *parent) -+{ -+ if (pin) { -+ dput(pin->parent); -+ pin->parent = dget(parent); -+ } -+} -+#endif -+ -+/* ---------------------------------------------------------------------- */ -+ -+struct au_branch; -+#ifdef CONFIG_AUFS_HNOTIFY -+struct au_hnotify_op { -+ void (*ctl)(struct au_hinode *hinode, int do_set); -+ int (*alloc)(struct au_hinode *hinode); -+ -+ /* -+ * if it returns true, the the caller should free hinode->hi_notify, -+ * otherwise ->free() frees it. -+ */ -+ int (*free)(struct au_hinode *hinode, -+ struct au_hnotify *hn) __must_check; -+ -+ void (*fin)(void); -+ int (*init)(void); -+ -+ int (*reset_br)(unsigned int udba, struct au_branch *br, int perm); -+ void (*fin_br)(struct au_branch *br); -+ int (*init_br)(struct au_branch *br, int perm); -+}; -+ -+/* hnotify.c */ -+int au_hn_alloc(struct au_hinode *hinode, struct inode *inode); -+void au_hn_free(struct au_hinode *hinode); -+void au_hn_ctl(struct au_hinode *hinode, int do_set); -+void au_hn_reset(struct inode *inode, unsigned int flags); -+int au_hnotify(struct inode *h_dir, struct au_hnotify *hnotify, u32 mask, -+ struct qstr *h_child_qstr, struct inode *h_child_inode); -+int au_hnotify_reset_br(unsigned int udba, struct au_branch *br, int perm); -+int au_hnotify_init_br(struct au_branch *br, int perm); -+void au_hnotify_fin_br(struct au_branch *br); -+int __init au_hnotify_init(void); -+void au_hnotify_fin(void); -+ -+/* hfsnotify.c */ -+extern const struct au_hnotify_op au_hnotify_op; -+ -+static inline -+void au_hn_init(struct au_hinode *hinode) -+{ -+ hinode->hi_notify = NULL; -+} -+ -+static inline struct au_hnotify *au_hn(struct au_hinode *hinode) -+{ -+ return hinode->hi_notify; -+} -+ -+#else -+AuStub(int, au_hn_alloc, return -EOPNOTSUPP, -+ struct au_hinode *hinode __maybe_unused, -+ struct inode *inode __maybe_unused) -+AuStub(struct au_hnotify *, au_hn, return NULL, struct au_hinode *hinode) -+AuStubVoid(au_hn_free, struct au_hinode *hinode __maybe_unused) -+AuStubVoid(au_hn_ctl, struct au_hinode *hinode __maybe_unused, -+ int do_set __maybe_unused) -+AuStubVoid(au_hn_reset, struct inode *inode __maybe_unused, -+ unsigned int flags __maybe_unused) -+AuStubInt0(au_hnotify_reset_br, unsigned int udba __maybe_unused, -+ struct au_branch *br __maybe_unused, -+ int perm __maybe_unused) -+AuStubInt0(au_hnotify_init_br, struct au_branch *br __maybe_unused, -+ int perm __maybe_unused) -+AuStubVoid(au_hnotify_fin_br, struct au_branch *br __maybe_unused) -+AuStubInt0(__init au_hnotify_init, void) -+AuStubVoid(au_hnotify_fin, void) -+AuStubVoid(au_hn_init, struct au_hinode *hinode __maybe_unused) -+#endif /* CONFIG_AUFS_HNOTIFY */ -+ -+static inline void au_hn_suspend(struct au_hinode *hdir) -+{ -+ au_hn_ctl(hdir, /*do_set*/0); -+} -+ -+static inline void au_hn_resume(struct au_hinode *hdir) -+{ -+ au_hn_ctl(hdir, /*do_set*/1); -+} -+ -+static inline void au_hn_inode_lock(struct au_hinode *hdir) -+{ -+ inode_lock(hdir->hi_inode); -+ au_hn_suspend(hdir); -+} -+ -+static inline void au_hn_inode_lock_nested(struct au_hinode *hdir, -+ unsigned int sc __maybe_unused) -+{ -+ inode_lock_nested(hdir->hi_inode, sc); -+ au_hn_suspend(hdir); -+} -+ -+static inline void au_hn_inode_unlock(struct au_hinode *hdir) -+{ -+ au_hn_resume(hdir); -+ inode_unlock(hdir->hi_inode); -+} -+ -+#endif /* __KERNEL__ */ -+#endif /* __AUFS_INODE_H__ */ -diff --git a/fs/aufs/ioctl.c b/fs/aufs/ioctl.c -new file mode 100644 -index 0000000..2ebfdc4 ---- /dev/null -+++ b/fs/aufs/ioctl.c -@@ -0,0 +1,206 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * ioctl -+ * plink-management and readdir in userspace. -+ * assist the pathconf(3) wrapper library. -+ * move-down -+ * File-based Hierarchical Storage Management. -+ */ -+ -+#include -+#include -+#include "aufs.h" -+ -+static int au_wbr_fd(struct path *path, struct aufs_wbr_fd __user *arg) -+{ -+ int err, fd; -+ aufs_bindex_t wbi, bindex, bbot; -+ struct file *h_file; -+ struct super_block *sb; -+ struct dentry *root; -+ struct au_branch *br; -+ struct aufs_wbr_fd wbrfd = { -+ .oflags = au_dir_roflags, -+ .brid = -1 -+ }; -+ const int valid = O_RDONLY | O_NONBLOCK | O_LARGEFILE | O_DIRECTORY -+ | O_NOATIME | O_CLOEXEC; -+ -+ AuDebugOn(wbrfd.oflags & ~valid); -+ -+ if (arg) { -+ err = copy_from_user(&wbrfd, arg, sizeof(wbrfd)); -+ if (unlikely(err)) { -+ err = -EFAULT; -+ goto out; -+ } -+ -+ err = -EINVAL; -+ AuDbg("wbrfd{0%o, %d}\n", wbrfd.oflags, wbrfd.brid); -+ wbrfd.oflags |= au_dir_roflags; -+ AuDbg("0%o\n", wbrfd.oflags); -+ if (unlikely(wbrfd.oflags & ~valid)) -+ goto out; -+ } -+ -+ fd = get_unused_fd_flags(0); -+ err = fd; -+ if (unlikely(fd < 0)) -+ goto out; -+ -+ h_file = ERR_PTR(-EINVAL); -+ wbi = 0; -+ br = NULL; -+ sb = path->dentry->d_sb; -+ root = sb->s_root; -+ aufs_read_lock(root, AuLock_IR); -+ bbot = au_sbbot(sb); -+ if (wbrfd.brid >= 0) { -+ wbi = au_br_index(sb, wbrfd.brid); -+ if (unlikely(wbi < 0 || wbi > bbot)) -+ goto out_unlock; -+ } -+ -+ h_file = ERR_PTR(-ENOENT); -+ br = au_sbr(sb, wbi); -+ if (!au_br_writable(br->br_perm)) { -+ if (arg) -+ goto out_unlock; -+ -+ bindex = wbi + 1; -+ wbi = -1; -+ for (; bindex <= bbot; bindex++) { -+ br = au_sbr(sb, bindex); -+ if (au_br_writable(br->br_perm)) { -+ wbi = bindex; -+ br = au_sbr(sb, wbi); -+ break; -+ } -+ } -+ } -+ AuDbg("wbi %d\n", wbi); -+ if (wbi >= 0) -+ h_file = au_h_open(root, wbi, wbrfd.oflags, NULL, -+ /*force_wr*/0); -+ -+out_unlock: -+ aufs_read_unlock(root, AuLock_IR); -+ err = PTR_ERR(h_file); -+ if (IS_ERR(h_file)) -+ goto out_fd; -+ -+ au_br_put(br); /* cf. au_h_open() */ -+ fd_install(fd, h_file); -+ err = fd; -+ goto out; /* success */ -+ -+out_fd: -+ put_unused_fd(fd); -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+long aufs_ioctl_dir(struct file *file, unsigned int cmd, unsigned long arg) -+{ -+ long err; -+ struct dentry *dentry; -+ -+ switch (cmd) { -+ case AUFS_CTL_RDU: -+ case AUFS_CTL_RDU_INO: -+ err = au_rdu_ioctl(file, cmd, arg); -+ break; -+ -+ case AUFS_CTL_WBR_FD: -+ err = au_wbr_fd(&file->f_path, (void __user *)arg); -+ break; -+ -+ case AUFS_CTL_IBUSY: -+ err = au_ibusy_ioctl(file, arg); -+ break; -+ -+ case AUFS_CTL_BRINFO: -+ err = au_brinfo_ioctl(file, arg); -+ break; -+ -+ case AUFS_CTL_FHSM_FD: -+ dentry = file->f_path.dentry; -+ if (IS_ROOT(dentry)) -+ err = au_fhsm_fd(dentry->d_sb, arg); -+ else -+ err = -ENOTTY; -+ break; -+ -+ default: -+ /* do not call the lower */ -+ AuDbg("0x%x\n", cmd); -+ err = -ENOTTY; -+ } -+ -+ AuTraceErr(err); -+ return err; -+} -+ -+long aufs_ioctl_nondir(struct file *file, unsigned int cmd, unsigned long arg) -+{ -+ long err; -+ -+ switch (cmd) { -+ case AUFS_CTL_MVDOWN: -+ err = au_mvdown(file->f_path.dentry, (void __user *)arg); -+ break; -+ -+ case AUFS_CTL_WBR_FD: -+ err = au_wbr_fd(&file->f_path, (void __user *)arg); -+ break; -+ -+ default: -+ /* do not call the lower */ -+ AuDbg("0x%x\n", cmd); -+ err = -ENOTTY; -+ } -+ -+ AuTraceErr(err); -+ return err; -+} -+ -+#ifdef CONFIG_COMPAT -+long aufs_compat_ioctl_dir(struct file *file, unsigned int cmd, -+ unsigned long arg) -+{ -+ long err; -+ -+ switch (cmd) { -+ case AUFS_CTL_RDU: -+ case AUFS_CTL_RDU_INO: -+ err = au_rdu_compat_ioctl(file, cmd, arg); -+ break; -+ -+ case AUFS_CTL_IBUSY: -+ err = au_ibusy_compat_ioctl(file, arg); -+ break; -+ -+ case AUFS_CTL_BRINFO: -+ err = au_brinfo_compat_ioctl(file, arg); -+ break; -+ -+ default: -+ err = aufs_ioctl_dir(file, cmd, arg); -+ } -+ -+ AuTraceErr(err); -+ return err; -+} -+ -+long aufs_compat_ioctl_nondir(struct file *file, unsigned int cmd, -+ unsigned long arg) -+{ -+ return aufs_ioctl_nondir(file, cmd, (unsigned long)compat_ptr(arg)); -+} -+#endif -diff --git a/fs/aufs/loop.c b/fs/aufs/loop.c -new file mode 100644 -index 0000000..c3ca50f ---- /dev/null -+++ b/fs/aufs/loop.c -@@ -0,0 +1,134 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * support for loopback block device as a branch -+ */ -+ -+#include "aufs.h" -+ -+/* added into drivers/block/loop.c */ -+static struct file *(*backing_file_func)(struct super_block *sb); -+ -+/* -+ * test if two lower dentries have overlapping branches. -+ */ -+int au_test_loopback_overlap(struct super_block *sb, struct dentry *h_adding) -+{ -+ struct super_block *h_sb; -+ struct file *backing_file; -+ -+ if (unlikely(!backing_file_func)) { -+ /* don't load "loop" module here */ -+ backing_file_func = symbol_get(loop_backing_file); -+ if (unlikely(!backing_file_func)) -+ /* "loop" module is not loaded */ -+ return 0; -+ } -+ -+ h_sb = h_adding->d_sb; -+ backing_file = backing_file_func(h_sb); -+ if (!backing_file) -+ return 0; -+ -+ h_adding = backing_file->f_path.dentry; -+ /* -+ * h_adding can be local NFS. -+ * in this case aufs cannot detect the loop. -+ */ -+ if (unlikely(h_adding->d_sb == sb)) -+ return 1; -+ return !!au_test_subdir(h_adding, sb->s_root); -+} -+ -+/* true if a kernel thread named 'loop[0-9].*' accesses a file */ -+int au_test_loopback_kthread(void) -+{ -+ int ret; -+ struct task_struct *tsk = current; -+ char c, comm[sizeof(tsk->comm)]; -+ -+ ret = 0; -+ if (tsk->flags & PF_KTHREAD) { -+ get_task_comm(comm, tsk); -+ c = comm[4]; -+ ret = ('0' <= c && c <= '9' -+ && !strncmp(comm, "loop", 4)); -+ } -+ -+ return ret; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+#define au_warn_loopback_step 16 -+static int au_warn_loopback_nelem = au_warn_loopback_step; -+static unsigned long *au_warn_loopback_array; -+ -+void au_warn_loopback(struct super_block *h_sb) -+{ -+ int i, new_nelem; -+ unsigned long *a, magic; -+ static DEFINE_SPINLOCK(spin); -+ -+ magic = h_sb->s_magic; -+ spin_lock(&spin); -+ a = au_warn_loopback_array; -+ for (i = 0; i < au_warn_loopback_nelem && *a; i++) -+ if (a[i] == magic) { -+ spin_unlock(&spin); -+ return; -+ } -+ -+ /* h_sb is new to us, print it */ -+ if (i < au_warn_loopback_nelem) { -+ a[i] = magic; -+ goto pr; -+ } -+ -+ /* expand the array */ -+ new_nelem = au_warn_loopback_nelem + au_warn_loopback_step; -+ a = au_kzrealloc(au_warn_loopback_array, -+ au_warn_loopback_nelem * sizeof(unsigned long), -+ new_nelem * sizeof(unsigned long), GFP_ATOMIC, -+ /*may_shrink*/0); -+ if (a) { -+ au_warn_loopback_nelem = new_nelem; -+ au_warn_loopback_array = a; -+ a[i] = magic; -+ goto pr; -+ } -+ -+ spin_unlock(&spin); -+ AuWarn1("realloc failed, ignored\n"); -+ return; -+ -+pr: -+ spin_unlock(&spin); -+ pr_warn("you may want to try another patch for loopback file " -+ "on %s(0x%lx) branch\n", au_sbtype(h_sb), magic); -+} -+ -+int au_loopback_init(void) -+{ -+ int err; -+ struct super_block *sb __maybe_unused; -+ -+ BUILD_BUG_ON(sizeof(sb->s_magic) != sizeof(unsigned long)); -+ -+ err = 0; -+ au_warn_loopback_array = kcalloc(au_warn_loopback_step, -+ sizeof(unsigned long), GFP_NOFS); -+ if (unlikely(!au_warn_loopback_array)) -+ err = -ENOMEM; -+ -+ return err; -+} -+ -+void au_loopback_fin(void) -+{ -+ if (backing_file_func) -+ symbol_put(loop_backing_file); -+ au_delayed_kfree(au_warn_loopback_array); -+} -diff --git a/fs/aufs/loop.h b/fs/aufs/loop.h -new file mode 100644 -index 0000000..48bf070 ---- /dev/null -+++ b/fs/aufs/loop.h -@@ -0,0 +1,39 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * support for loopback mount as a branch -+ */ -+ -+#ifndef __AUFS_LOOP_H__ -+#define __AUFS_LOOP_H__ -+ -+#ifdef __KERNEL__ -+ -+struct dentry; -+struct super_block; -+ -+#ifdef CONFIG_AUFS_BDEV_LOOP -+/* drivers/block/loop.c */ -+struct file *loop_backing_file(struct super_block *sb); -+ -+/* loop.c */ -+int au_test_loopback_overlap(struct super_block *sb, struct dentry *h_adding); -+int au_test_loopback_kthread(void); -+void au_warn_loopback(struct super_block *h_sb); -+ -+int au_loopback_init(void); -+void au_loopback_fin(void); -+#else -+AuStubInt0(au_test_loopback_overlap, struct super_block *sb, -+ struct dentry *h_adding) -+AuStubInt0(au_test_loopback_kthread, void) -+AuStubVoid(au_warn_loopback, struct super_block *h_sb) -+ -+AuStubInt0(au_loopback_init, void) -+AuStubVoid(au_loopback_fin, void) -+#endif /* BLK_DEV_LOOP */ -+ -+#endif /* __KERNEL__ */ -+#endif /* __AUFS_LOOP_H__ */ -diff --git a/fs/aufs/magic.mk b/fs/aufs/magic.mk -new file mode 100644 -index 0000000..4f83bdf ---- /dev/null -+++ b/fs/aufs/magic.mk -@@ -0,0 +1,30 @@ -+ -+# defined in ${srctree}/fs/fuse/inode.c -+# tristate -+ifdef CONFIG_FUSE_FS -+ccflags-y += -DFUSE_SUPER_MAGIC=0x65735546 -+endif -+ -+# defined in ${srctree}/fs/xfs/xfs_sb.h -+# tristate -+ifdef CONFIG_XFS_FS -+ccflags-y += -DXFS_SB_MAGIC=0x58465342 -+endif -+ -+# defined in ${srctree}/fs/configfs/mount.c -+# tristate -+ifdef CONFIG_CONFIGFS_FS -+ccflags-y += -DCONFIGFS_MAGIC=0x62656570 -+endif -+ -+# defined in ${srctree}/fs/ubifs/ubifs.h -+# tristate -+ifdef CONFIG_UBIFS_FS -+ccflags-y += -DUBIFS_SUPER_MAGIC=0x24051905 -+endif -+ -+# defined in ${srctree}/fs/hfsplus/hfsplus_raw.h -+# tristate -+ifdef CONFIG_HFSPLUS_FS -+ccflags-y += -DHFSPLUS_SUPER_MAGIC=0x482b -+endif -diff --git a/fs/aufs/module.c b/fs/aufs/module.c -new file mode 100644 -index 0000000..5092b4b ---- /dev/null -+++ b/fs/aufs/module.c -@@ -0,0 +1,319 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * module global variables and operations -+ */ -+ -+#include -+#include -+#include "aufs.h" -+ -+/* shrinkable realloc */ -+void *au_krealloc(void *p, unsigned int new_sz, gfp_t gfp, int may_shrink) -+{ -+ size_t sz; -+ int diff; -+ -+ sz = 0; -+ diff = -1; -+ if (p) { -+#if 0 /* unused */ -+ if (!new_sz) { -+ au_delayed_kfree(p); -+ p = NULL; -+ goto out; -+ } -+#else -+ AuDebugOn(!new_sz); -+#endif -+ sz = ksize(p); -+ diff = au_kmidx_sub(sz, new_sz); -+ } -+ if (sz && !diff) -+ goto out; -+ -+ if (sz < new_sz) -+ /* expand or SLOB */ -+ p = krealloc(p, new_sz, gfp); -+ else if (new_sz < sz && may_shrink) { -+ /* shrink */ -+ void *q; -+ -+ q = kmalloc(new_sz, gfp); -+ if (q) { -+ if (p) { -+ memcpy(q, p, new_sz); -+ au_delayed_kfree(p); -+ } -+ p = q; -+ } else -+ p = NULL; -+ } -+ -+out: -+ return p; -+} -+ -+void *au_kzrealloc(void *p, unsigned int nused, unsigned int new_sz, gfp_t gfp, -+ int may_shrink) -+{ -+ p = au_krealloc(p, new_sz, gfp, may_shrink); -+ if (p && new_sz > nused) -+ memset(p + nused, 0, new_sz - nused); -+ return p; -+} -+ -+/* ---------------------------------------------------------------------- */ -+/* -+ * aufs caches -+ */ -+ -+struct au_dfree au_dfree; -+ -+/* delayed free */ -+static void au_do_dfree(struct work_struct *work __maybe_unused) -+{ -+ struct llist_head *head; -+ struct llist_node *node, *next; -+ -+#define AU_CACHE_DFREE_DO_BODY(name, idx, lnode) do { \ -+ head = &au_dfree.cache[AuCache_##idx].llist; \ -+ node = llist_del_all(head); \ -+ for (; node; node = next) { \ -+ struct au_##name *p \ -+ = llist_entry(node, struct au_##name, \ -+ lnode); \ -+ next = llist_next(node); \ -+ au_cache_free_##name(p); \ -+ } \ -+ } while (0) -+ -+ AU_CACHE_DFREE_DO_BODY(dinfo, DINFO, di_lnode); -+ AU_CACHE_DFREE_DO_BODY(icntnr, ICNTNR, lnode); -+ AU_CACHE_DFREE_DO_BODY(finfo, FINFO, fi_lnode); -+ AU_CACHE_DFREE_DO_BODY(vdir, VDIR, vd_lnode); -+ AU_CACHE_DFREE_DO_BODY(vdir_dehstr, DEHSTR, lnode); -+#ifdef CONFIG_AUFS_HNOTIFY -+ AU_CACHE_DFREE_DO_BODY(hnotify, HNOTIFY, hn_lnode); -+#endif -+ -+#define AU_DFREE_DO_BODY(llist, func) do { \ -+ node = llist_del_all(llist); \ -+ for (; node; node = next) { \ -+ next = llist_next(node); \ -+ func(node); \ -+ } \ -+ } while (0) -+ -+ AU_DFREE_DO_BODY(au_dfree.llist + AU_DFREE_KFREE, kfree); -+ AU_DFREE_DO_BODY(au_dfree.llist + AU_DFREE_FREE_PAGE, au_free_page); -+ -+#undef AU_CACHE_DFREE_DO_BODY -+#undef AU_DFREE_DO_BODY -+} -+ -+AU_CACHE_DFREE_FUNC(dinfo, DINFO, di_lnode); -+AU_CACHE_DFREE_FUNC(icntnr, ICNTNR, lnode); -+AU_CACHE_DFREE_FUNC(finfo, FINFO, fi_lnode); -+AU_CACHE_DFREE_FUNC(vdir, VDIR, vd_lnode); -+AU_CACHE_DFREE_FUNC(vdir_dehstr, DEHSTR, lnode); -+ -+static void au_cache_fin(void) -+{ -+ int i; -+ struct au_cache *cp; -+ -+ /* -+ * Make sure all delayed rcu free inodes are flushed before we -+ * destroy cache. -+ */ -+ rcu_barrier(); -+ -+ /* excluding AuCache_HNOTIFY */ -+ BUILD_BUG_ON(AuCache_HNOTIFY + 1 != AuCache_Last); -+ flush_delayed_work(&au_dfree.dwork); -+ for (i = 0; i < AuCache_HNOTIFY; i++) { -+ cp = au_dfree.cache + i; -+ AuDebugOn(!llist_empty(&cp->llist)); -+ kmem_cache_destroy(cp->cache); -+ cp->cache = NULL; -+ } -+} -+ -+static int __init au_cache_init(void) -+{ -+ struct au_cache *cp; -+ -+ cp = au_dfree.cache; -+ cp[AuCache_DINFO].cache = AuCacheCtor(au_dinfo, au_di_init_once); -+ if (cp[AuCache_DINFO].cache) -+ /* SLAB_DESTROY_BY_RCU */ -+ cp[AuCache_ICNTNR].cache = AuCacheCtor(au_icntnr, -+ au_icntnr_init_once); -+ if (cp[AuCache_ICNTNR].cache) -+ cp[AuCache_FINFO].cache = AuCacheCtor(au_finfo, -+ au_fi_init_once); -+ if (cp[AuCache_FINFO].cache) -+ cp[AuCache_VDIR].cache = AuCache(au_vdir); -+ if (cp[AuCache_VDIR].cache) -+ cp[AuCache_DEHSTR].cache = AuCache(au_vdir_dehstr); -+ if (cp[AuCache_DEHSTR].cache) -+ return 0; -+ -+ au_cache_fin(); -+ return -ENOMEM; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+int au_dir_roflags; -+ -+#ifdef CONFIG_AUFS_SBILIST -+/* -+ * iterate_supers_type() doesn't protect us from -+ * remounting (branch management) -+ */ -+struct au_sphlhead au_sbilist; -+#endif -+ -+/* -+ * functions for module interface. -+ */ -+MODULE_LICENSE("GPL"); -+/* MODULE_LICENSE("GPL v2"); */ -+MODULE_AUTHOR("Junjiro R. Okajima "); -+MODULE_DESCRIPTION(AUFS_NAME -+ " -- Advanced multi layered unification filesystem"); -+MODULE_VERSION(AUFS_VERSION); -+ -+/* this module parameter has no meaning when SYSFS is disabled */ -+int sysaufs_brs = 1; -+MODULE_PARM_DESC(brs, "use /fs/aufs/si_*/brN"); -+module_param_named(brs, sysaufs_brs, int, S_IRUGO); -+ -+/* this module parameter has no meaning when USER_NS is disabled */ -+bool au_userns; -+MODULE_PARM_DESC(allow_userns, "allow unprivileged to mount under userns"); -+module_param_named(allow_userns, au_userns, bool, S_IRUGO); -+ -+/* ---------------------------------------------------------------------- */ -+ -+static char au_esc_chars[0x20 + 3]; /* 0x01-0x20, backslash, del, and NULL */ -+ -+int au_seq_path(struct seq_file *seq, struct path *path) -+{ -+ int err; -+ -+ err = seq_path(seq, path, au_esc_chars); -+ if (err > 0) -+ err = 0; -+ else if (err < 0) -+ err = -ENOMEM; -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int __init aufs_init(void) -+{ -+ int err, i; -+ char *p; -+ struct au_cache *cp; -+ -+ p = au_esc_chars; -+ for (i = 1; i <= ' '; i++) -+ *p++ = i; -+ *p++ = '\\'; -+ *p++ = '\x7f'; -+ *p = 0; -+ -+ au_dir_roflags = au_file_roflags(O_DIRECTORY | O_LARGEFILE); -+ -+ memcpy(aufs_iop_nogetattr, aufs_iop, sizeof(aufs_iop)); -+ for (i = 0; i < AuIop_Last; i++) -+ aufs_iop_nogetattr[i].getattr = NULL; -+ -+ /* First, initialize au_dfree */ -+ for (i = 0; i < AuCache_Last; i++) { /* including hnotify */ -+ cp = au_dfree.cache + i; -+ cp->cache = NULL; -+ init_llist_head(&cp->llist); -+ } -+ for (i = 0; i < AU_DFREE_Last; i++) -+ init_llist_head(au_dfree.llist + i); -+ INIT_DELAYED_WORK(&au_dfree.dwork, au_do_dfree); -+ -+ au_sbilist_init(); -+ sysaufs_brs_init(); -+ au_debug_init(); -+ au_dy_init(); -+ err = sysaufs_init(); -+ if (unlikely(err)) -+ goto out; -+ err = au_procfs_init(); -+ if (unlikely(err)) -+ goto out_sysaufs; -+ err = au_wkq_init(); -+ if (unlikely(err)) -+ goto out_procfs; -+ err = au_loopback_init(); -+ if (unlikely(err)) -+ goto out_wkq; -+ err = au_hnotify_init(); -+ if (unlikely(err)) -+ goto out_loopback; -+ err = au_sysrq_init(); -+ if (unlikely(err)) -+ goto out_hin; -+ err = au_cache_init(); -+ if (unlikely(err)) -+ goto out_sysrq; -+ -+ aufs_fs_type.fs_flags |= au_userns ? FS_USERNS_MOUNT : 0; -+ err = register_filesystem(&aufs_fs_type); -+ if (unlikely(err)) -+ goto out_cache; -+ -+ /* since we define pr_fmt, call printk directly */ -+ printk(KERN_INFO AUFS_NAME " " AUFS_VERSION "\n"); -+ goto out; /* success */ -+ -+out_cache: -+ au_cache_fin(); -+out_sysrq: -+ au_sysrq_fin(); -+out_hin: -+ au_hnotify_fin(); -+out_loopback: -+ au_loopback_fin(); -+out_wkq: -+ au_wkq_fin(); -+out_procfs: -+ au_procfs_fin(); -+out_sysaufs: -+ sysaufs_fin(); -+ au_dy_fin(); -+ flush_delayed_work(&au_dfree.dwork); -+out: -+ return err; -+} -+ -+static void __exit aufs_exit(void) -+{ -+ unregister_filesystem(&aufs_fs_type); -+ au_cache_fin(); -+ au_sysrq_fin(); -+ au_hnotify_fin(); -+ au_loopback_fin(); -+ au_wkq_fin(); -+ au_procfs_fin(); -+ sysaufs_fin(); -+ au_dy_fin(); -+ flush_delayed_work(&au_dfree.dwork); -+} -+ -+module_init(aufs_init); -+module_exit(aufs_exit); -diff --git a/fs/aufs/module.h b/fs/aufs/module.h -new file mode 100644 -index 0000000..6f968ba ---- /dev/null -+++ b/fs/aufs/module.h -@@ -0,0 +1,143 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * module initialization and module-global -+ */ -+ -+#ifndef __AUFS_MODULE_H__ -+#define __AUFS_MODULE_H__ -+ -+#ifdef __KERNEL__ -+ -+#include -+#include "debug.h" -+ -+struct path; -+struct seq_file; -+ -+/* module parameters */ -+extern int sysaufs_brs; -+extern bool au_userns; -+ -+/* ---------------------------------------------------------------------- */ -+ -+extern int au_dir_roflags; -+ -+void *au_krealloc(void *p, unsigned int new_sz, gfp_t gfp, int may_shrink); -+void *au_kzrealloc(void *p, unsigned int nused, unsigned int new_sz, gfp_t gfp, -+ int may_shrink); -+ -+static inline int au_kmidx_sub(size_t sz, size_t new_sz) -+{ -+#ifndef CONFIG_SLOB -+ return kmalloc_index(sz) - kmalloc_index(new_sz); -+#else -+ return -1; /* SLOB is untested */ -+#endif -+} -+ -+int au_seq_path(struct seq_file *seq, struct path *path); -+ -+#ifdef CONFIG_PROC_FS -+/* procfs.c */ -+int __init au_procfs_init(void); -+void au_procfs_fin(void); -+#else -+AuStubInt0(au_procfs_init, void); -+AuStubVoid(au_procfs_fin, void); -+#endif -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* kmem cache and delayed free */ -+enum { -+ AuCache_DINFO, -+ AuCache_ICNTNR, -+ AuCache_FINFO, -+ AuCache_VDIR, -+ AuCache_DEHSTR, -+ AuCache_HNOTIFY, /* must be last */ -+ AuCache_Last -+}; -+ -+enum { -+ AU_DFREE_KFREE, -+ AU_DFREE_FREE_PAGE, -+ AU_DFREE_Last -+}; -+ -+struct au_cache { -+ struct kmem_cache *cache; -+ struct llist_head llist; /* delayed free */ -+}; -+ -+/* -+ * in order to reduce the cost of the internal timer, consolidate all the -+ * delayed free works into a single delayed_work. -+ */ -+struct au_dfree { -+ struct au_cache cache[AuCache_Last]; -+ struct llist_head llist[AU_DFREE_Last]; -+ struct delayed_work dwork; -+}; -+ -+extern struct au_dfree au_dfree; -+ -+#define AuCacheFlags (SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD) -+#define AuCache(type) KMEM_CACHE(type, AuCacheFlags) -+#define AuCacheCtor(type, ctor) \ -+ kmem_cache_create(#type, sizeof(struct type), \ -+ __alignof__(struct type), AuCacheFlags, ctor) -+ -+#define AU_DFREE_DELAY msecs_to_jiffies(10) -+#define AU_DFREE_BODY(lnode, llist) do { \ -+ if (llist_add(lnode, llist)) \ -+ schedule_delayed_work(&au_dfree.dwork, \ -+ AU_DFREE_DELAY); \ -+ } while (0) -+#define AU_CACHE_DFREE_FUNC(name, idx, lnode) \ -+ void au_cache_dfree_##name(struct au_##name *p) \ -+ { \ -+ struct au_cache *cp = au_dfree.cache + AuCache_##idx; \ -+ AU_DFREE_BODY(&p->lnode, &cp->llist); \ -+ } -+ -+#define AuCacheFuncs(name, index) \ -+static inline struct au_##name *au_cache_alloc_##name(void) \ -+{ return kmem_cache_alloc(au_dfree.cache[AuCache_##index].cache, GFP_NOFS); } \ -+static inline void au_cache_free_##name(struct au_##name *p) \ -+{ kmem_cache_free(au_dfree.cache[AuCache_##index].cache, p); } \ -+void au_cache_dfree_##name(struct au_##name *p) -+ -+AuCacheFuncs(dinfo, DINFO); -+AuCacheFuncs(icntnr, ICNTNR); -+AuCacheFuncs(finfo, FINFO); -+AuCacheFuncs(vdir, VDIR); -+AuCacheFuncs(vdir_dehstr, DEHSTR); -+#ifdef CONFIG_AUFS_HNOTIFY -+AuCacheFuncs(hnotify, HNOTIFY); -+#endif -+ -+static inline void au_delayed_kfree(const void *p) -+{ -+ AuDebugOn(!p); -+ AuDebugOn(ksize(p) < sizeof(struct llist_node)); -+ -+ AU_DFREE_BODY((void *)p, au_dfree.llist + AU_DFREE_KFREE); -+} -+ -+/* cast only */ -+static inline void au_free_page(void *p) -+{ -+ free_page((unsigned long)p); -+} -+ -+static inline void au_delayed_free_page(unsigned long addr) -+{ -+ AU_DFREE_BODY((void *)addr, au_dfree.llist + AU_DFREE_FREE_PAGE); -+} -+ -+#endif /* __KERNEL__ */ -+#endif /* __AUFS_MODULE_H__ */ -diff --git a/fs/aufs/mvdown.c b/fs/aufs/mvdown.c -new file mode 100644 -index 0000000..b0e5b84 ---- /dev/null -+++ b/fs/aufs/mvdown.c -@@ -0,0 +1,691 @@ -+/* -+ * Copyright (C) 2011-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * move-down, opposite of copy-up -+ */ -+ -+#include "aufs.h" -+ -+struct au_mvd_args { -+ struct { -+ struct super_block *h_sb; -+ struct dentry *h_parent; -+ struct au_hinode *hdir; -+ struct inode *h_dir, *h_inode; -+ struct au_pin pin; -+ } info[AUFS_MVDOWN_NARRAY]; -+ -+ struct aufs_mvdown mvdown; -+ struct dentry *dentry, *parent; -+ struct inode *inode, *dir; -+ struct super_block *sb; -+ aufs_bindex_t bopq, bwh, bfound; -+ unsigned char rename_lock; -+}; -+ -+#define mvd_errno mvdown.au_errno -+#define mvd_bsrc mvdown.stbr[AUFS_MVDOWN_UPPER].bindex -+#define mvd_src_brid mvdown.stbr[AUFS_MVDOWN_UPPER].brid -+#define mvd_bdst mvdown.stbr[AUFS_MVDOWN_LOWER].bindex -+#define mvd_dst_brid mvdown.stbr[AUFS_MVDOWN_LOWER].brid -+ -+#define mvd_h_src_sb info[AUFS_MVDOWN_UPPER].h_sb -+#define mvd_h_src_parent info[AUFS_MVDOWN_UPPER].h_parent -+#define mvd_hdir_src info[AUFS_MVDOWN_UPPER].hdir -+#define mvd_h_src_dir info[AUFS_MVDOWN_UPPER].h_dir -+#define mvd_h_src_inode info[AUFS_MVDOWN_UPPER].h_inode -+#define mvd_pin_src info[AUFS_MVDOWN_UPPER].pin -+ -+#define mvd_h_dst_sb info[AUFS_MVDOWN_LOWER].h_sb -+#define mvd_h_dst_parent info[AUFS_MVDOWN_LOWER].h_parent -+#define mvd_hdir_dst info[AUFS_MVDOWN_LOWER].hdir -+#define mvd_h_dst_dir info[AUFS_MVDOWN_LOWER].h_dir -+#define mvd_h_dst_inode info[AUFS_MVDOWN_LOWER].h_inode -+#define mvd_pin_dst info[AUFS_MVDOWN_LOWER].pin -+ -+#define AU_MVD_PR(flag, ...) do { \ -+ if (flag) \ -+ pr_err(__VA_ARGS__); \ -+ } while (0) -+ -+static int find_lower_writable(struct au_mvd_args *a) -+{ -+ struct super_block *sb; -+ aufs_bindex_t bindex, bbot; -+ struct au_branch *br; -+ -+ sb = a->sb; -+ bindex = a->mvd_bsrc; -+ bbot = au_sbbot(sb); -+ if (a->mvdown.flags & AUFS_MVDOWN_FHSM_LOWER) -+ for (bindex++; bindex <= bbot; bindex++) { -+ br = au_sbr(sb, bindex); -+ if (au_br_fhsm(br->br_perm) -+ && (!(au_br_sb(br)->s_flags & MS_RDONLY))) -+ return bindex; -+ } -+ else if (!(a->mvdown.flags & AUFS_MVDOWN_ROLOWER)) -+ for (bindex++; bindex <= bbot; bindex++) { -+ br = au_sbr(sb, bindex); -+ if (!au_br_rdonly(br)) -+ return bindex; -+ } -+ else -+ for (bindex++; bindex <= bbot; bindex++) { -+ br = au_sbr(sb, bindex); -+ if (!(au_br_sb(br)->s_flags & MS_RDONLY)) { -+ if (au_br_rdonly(br)) -+ a->mvdown.flags -+ |= AUFS_MVDOWN_ROLOWER_R; -+ return bindex; -+ } -+ } -+ -+ return -1; -+} -+ -+/* make the parent dir on bdst */ -+static int au_do_mkdir(const unsigned char dmsg, struct au_mvd_args *a) -+{ -+ int err; -+ -+ err = 0; -+ a->mvd_hdir_src = au_hi(a->dir, a->mvd_bsrc); -+ a->mvd_hdir_dst = au_hi(a->dir, a->mvd_bdst); -+ a->mvd_h_src_parent = au_h_dptr(a->parent, a->mvd_bsrc); -+ a->mvd_h_dst_parent = NULL; -+ if (au_dbbot(a->parent) >= a->mvd_bdst) -+ a->mvd_h_dst_parent = au_h_dptr(a->parent, a->mvd_bdst); -+ if (!a->mvd_h_dst_parent) { -+ err = au_cpdown_dirs(a->dentry, a->mvd_bdst); -+ if (unlikely(err)) { -+ AU_MVD_PR(dmsg, "cpdown_dirs failed\n"); -+ goto out; -+ } -+ a->mvd_h_dst_parent = au_h_dptr(a->parent, a->mvd_bdst); -+ } -+ -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+/* lock them all */ -+static int au_do_lock(const unsigned char dmsg, struct au_mvd_args *a) -+{ -+ int err; -+ struct dentry *h_trap; -+ -+ a->mvd_h_src_sb = au_sbr_sb(a->sb, a->mvd_bsrc); -+ a->mvd_h_dst_sb = au_sbr_sb(a->sb, a->mvd_bdst); -+ err = au_pin(&a->mvd_pin_dst, a->dentry, a->mvd_bdst, -+ au_opt_udba(a->sb), -+ AuPin_MNT_WRITE | AuPin_DI_LOCKED); -+ AuTraceErr(err); -+ if (unlikely(err)) { -+ AU_MVD_PR(dmsg, "pin_dst failed\n"); -+ goto out; -+ } -+ -+ if (a->mvd_h_src_sb != a->mvd_h_dst_sb) { -+ a->rename_lock = 0; -+ au_pin_init(&a->mvd_pin_src, a->dentry, a->mvd_bsrc, -+ AuLsc_DI_PARENT, AuLsc_I_PARENT3, -+ au_opt_udba(a->sb), -+ AuPin_MNT_WRITE | AuPin_DI_LOCKED); -+ err = au_do_pin(&a->mvd_pin_src); -+ AuTraceErr(err); -+ a->mvd_h_src_dir = d_inode(a->mvd_h_src_parent); -+ if (unlikely(err)) { -+ AU_MVD_PR(dmsg, "pin_src failed\n"); -+ goto out_dst; -+ } -+ goto out; /* success */ -+ } -+ -+ a->rename_lock = 1; -+ au_pin_hdir_unlock(&a->mvd_pin_dst); -+ err = au_pin(&a->mvd_pin_src, a->dentry, a->mvd_bsrc, -+ au_opt_udba(a->sb), -+ AuPin_MNT_WRITE | AuPin_DI_LOCKED); -+ AuTraceErr(err); -+ a->mvd_h_src_dir = d_inode(a->mvd_h_src_parent); -+ if (unlikely(err)) { -+ AU_MVD_PR(dmsg, "pin_src failed\n"); -+ au_pin_hdir_lock(&a->mvd_pin_dst); -+ goto out_dst; -+ } -+ au_pin_hdir_unlock(&a->mvd_pin_src); -+ h_trap = vfsub_lock_rename(a->mvd_h_src_parent, a->mvd_hdir_src, -+ a->mvd_h_dst_parent, a->mvd_hdir_dst); -+ if (h_trap) { -+ err = (h_trap != a->mvd_h_src_parent); -+ if (err) -+ err = (h_trap != a->mvd_h_dst_parent); -+ } -+ BUG_ON(err); /* it should never happen */ -+ if (unlikely(a->mvd_h_src_dir != au_pinned_h_dir(&a->mvd_pin_src))) { -+ err = -EBUSY; -+ AuTraceErr(err); -+ vfsub_unlock_rename(a->mvd_h_src_parent, a->mvd_hdir_src, -+ a->mvd_h_dst_parent, a->mvd_hdir_dst); -+ au_pin_hdir_lock(&a->mvd_pin_src); -+ au_unpin(&a->mvd_pin_src); -+ au_pin_hdir_lock(&a->mvd_pin_dst); -+ goto out_dst; -+ } -+ goto out; /* success */ -+ -+out_dst: -+ au_unpin(&a->mvd_pin_dst); -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+static void au_do_unlock(const unsigned char dmsg, struct au_mvd_args *a) -+{ -+ if (!a->rename_lock) -+ au_unpin(&a->mvd_pin_src); -+ else { -+ vfsub_unlock_rename(a->mvd_h_src_parent, a->mvd_hdir_src, -+ a->mvd_h_dst_parent, a->mvd_hdir_dst); -+ au_pin_hdir_lock(&a->mvd_pin_src); -+ au_unpin(&a->mvd_pin_src); -+ au_pin_hdir_lock(&a->mvd_pin_dst); -+ } -+ au_unpin(&a->mvd_pin_dst); -+} -+ -+/* copy-down the file */ -+static int au_do_cpdown(const unsigned char dmsg, struct au_mvd_args *a) -+{ -+ int err; -+ struct au_cp_generic cpg = { -+ .dentry = a->dentry, -+ .bdst = a->mvd_bdst, -+ .bsrc = a->mvd_bsrc, -+ .len = -1, -+ .pin = &a->mvd_pin_dst, -+ .flags = AuCpup_DTIME | AuCpup_HOPEN -+ }; -+ -+ AuDbg("b%d, b%d\n", cpg.bsrc, cpg.bdst); -+ if (a->mvdown.flags & AUFS_MVDOWN_OWLOWER) -+ au_fset_cpup(cpg.flags, OVERWRITE); -+ if (a->mvdown.flags & AUFS_MVDOWN_ROLOWER) -+ au_fset_cpup(cpg.flags, RWDST); -+ err = au_sio_cpdown_simple(&cpg); -+ if (unlikely(err)) -+ AU_MVD_PR(dmsg, "cpdown failed\n"); -+ -+ AuTraceErr(err); -+ return err; -+} -+ -+/* -+ * unlink the whiteout on bdst if exist which may be created by UDBA while we -+ * were sleeping -+ */ -+static int au_do_unlink_wh(const unsigned char dmsg, struct au_mvd_args *a) -+{ -+ int err; -+ struct path h_path; -+ struct au_branch *br; -+ struct inode *delegated; -+ -+ br = au_sbr(a->sb, a->mvd_bdst); -+ h_path.dentry = au_wh_lkup(a->mvd_h_dst_parent, &a->dentry->d_name, br); -+ err = PTR_ERR(h_path.dentry); -+ if (IS_ERR(h_path.dentry)) { -+ AU_MVD_PR(dmsg, "wh_lkup failed\n"); -+ goto out; -+ } -+ -+ err = 0; -+ if (d_is_positive(h_path.dentry)) { -+ h_path.mnt = au_br_mnt(br); -+ delegated = NULL; -+ err = vfsub_unlink(d_inode(a->mvd_h_dst_parent), &h_path, -+ &delegated, /*force*/0); -+ if (unlikely(err == -EWOULDBLOCK)) { -+ pr_warn("cannot retry for NFSv4 delegation" -+ " for an internal unlink\n"); -+ iput(delegated); -+ } -+ if (unlikely(err)) -+ AU_MVD_PR(dmsg, "wh_unlink failed\n"); -+ } -+ dput(h_path.dentry); -+ -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+/* -+ * unlink the topmost h_dentry -+ */ -+static int au_do_unlink(const unsigned char dmsg, struct au_mvd_args *a) -+{ -+ int err; -+ struct path h_path; -+ struct inode *delegated; -+ -+ h_path.mnt = au_sbr_mnt(a->sb, a->mvd_bsrc); -+ h_path.dentry = au_h_dptr(a->dentry, a->mvd_bsrc); -+ delegated = NULL; -+ err = vfsub_unlink(a->mvd_h_src_dir, &h_path, &delegated, /*force*/0); -+ if (unlikely(err == -EWOULDBLOCK)) { -+ pr_warn("cannot retry for NFSv4 delegation" -+ " for an internal unlink\n"); -+ iput(delegated); -+ } -+ if (unlikely(err)) -+ AU_MVD_PR(dmsg, "unlink failed\n"); -+ -+ AuTraceErr(err); -+ return err; -+} -+ -+/* Since mvdown succeeded, we ignore an error of this function */ -+static void au_do_stfs(const unsigned char dmsg, struct au_mvd_args *a) -+{ -+ int err; -+ struct au_branch *br; -+ -+ a->mvdown.flags |= AUFS_MVDOWN_STFS_FAILED; -+ br = au_sbr(a->sb, a->mvd_bsrc); -+ err = au_br_stfs(br, &a->mvdown.stbr[AUFS_MVDOWN_UPPER].stfs); -+ if (!err) { -+ br = au_sbr(a->sb, a->mvd_bdst); -+ a->mvdown.stbr[AUFS_MVDOWN_LOWER].brid = br->br_id; -+ err = au_br_stfs(br, &a->mvdown.stbr[AUFS_MVDOWN_LOWER].stfs); -+ } -+ if (!err) -+ a->mvdown.flags &= ~AUFS_MVDOWN_STFS_FAILED; -+ else -+ AU_MVD_PR(dmsg, "statfs failed (%d), ignored\n", err); -+} -+ -+/* -+ * copy-down the file and unlink the bsrc file. -+ * - unlink the bdst whout if exist -+ * - copy-down the file (with whtmp name and rename) -+ * - unlink the bsrc file -+ */ -+static int au_do_mvdown(const unsigned char dmsg, struct au_mvd_args *a) -+{ -+ int err; -+ -+ err = au_do_mkdir(dmsg, a); -+ if (!err) -+ err = au_do_lock(dmsg, a); -+ if (unlikely(err)) -+ goto out; -+ -+ /* -+ * do not revert the activities we made on bdst since they should be -+ * harmless in aufs. -+ */ -+ -+ err = au_do_cpdown(dmsg, a); -+ if (!err) -+ err = au_do_unlink_wh(dmsg, a); -+ if (!err && !(a->mvdown.flags & AUFS_MVDOWN_KUPPER)) -+ err = au_do_unlink(dmsg, a); -+ if (unlikely(err)) -+ goto out_unlock; -+ -+ AuDbg("%pd2, 0x%x, %d --> %d\n", -+ a->dentry, a->mvdown.flags, a->mvd_bsrc, a->mvd_bdst); -+ if (find_lower_writable(a) < 0) -+ a->mvdown.flags |= AUFS_MVDOWN_BOTTOM; -+ -+ if (a->mvdown.flags & AUFS_MVDOWN_STFS) -+ au_do_stfs(dmsg, a); -+ -+ /* maintain internal array */ -+ if (!(a->mvdown.flags & AUFS_MVDOWN_KUPPER)) { -+ au_set_h_dptr(a->dentry, a->mvd_bsrc, NULL); -+ au_set_dbtop(a->dentry, a->mvd_bdst); -+ au_set_h_iptr(a->inode, a->mvd_bsrc, NULL, /*flags*/0); -+ au_set_ibtop(a->inode, a->mvd_bdst); -+ } else { -+ /* hide the lower */ -+ au_set_h_dptr(a->dentry, a->mvd_bdst, NULL); -+ au_set_dbbot(a->dentry, a->mvd_bsrc); -+ au_set_h_iptr(a->inode, a->mvd_bdst, NULL, /*flags*/0); -+ au_set_ibbot(a->inode, a->mvd_bsrc); -+ } -+ if (au_dbbot(a->dentry) < a->mvd_bdst) -+ au_set_dbbot(a->dentry, a->mvd_bdst); -+ if (au_ibbot(a->inode) < a->mvd_bdst) -+ au_set_ibbot(a->inode, a->mvd_bdst); -+ -+out_unlock: -+ au_do_unlock(dmsg, a); -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* make sure the file is idle */ -+static int au_mvd_args_busy(const unsigned char dmsg, struct au_mvd_args *a) -+{ -+ int err, plinked; -+ -+ err = 0; -+ plinked = !!au_opt_test(au_mntflags(a->sb), PLINK); -+ if (au_dbtop(a->dentry) == a->mvd_bsrc -+ && au_dcount(a->dentry) == 1 -+ && atomic_read(&a->inode->i_count) == 1 -+ /* && a->mvd_h_src_inode->i_nlink == 1 */ -+ && (!plinked || !au_plink_test(a->inode)) -+ && a->inode->i_nlink == 1) -+ goto out; -+ -+ err = -EBUSY; -+ AU_MVD_PR(dmsg, -+ "b%d, d{b%d, c%d?}, i{c%d?, l%u}, hi{l%u}, p{%d, %d}\n", -+ a->mvd_bsrc, au_dbtop(a->dentry), au_dcount(a->dentry), -+ atomic_read(&a->inode->i_count), a->inode->i_nlink, -+ a->mvd_h_src_inode->i_nlink, -+ plinked, plinked ? au_plink_test(a->inode) : 0); -+ -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+/* make sure the parent dir is fine */ -+static int au_mvd_args_parent(const unsigned char dmsg, -+ struct au_mvd_args *a) -+{ -+ int err; -+ aufs_bindex_t bindex; -+ -+ err = 0; -+ if (unlikely(au_alive_dir(a->parent))) { -+ err = -ENOENT; -+ AU_MVD_PR(dmsg, "parent dir is dead\n"); -+ goto out; -+ } -+ -+ a->bopq = au_dbdiropq(a->parent); -+ bindex = au_wbr_nonopq(a->dentry, a->mvd_bdst); -+ AuDbg("b%d\n", bindex); -+ if (unlikely((bindex >= 0 && bindex < a->mvd_bdst) -+ || (a->bopq != -1 && a->bopq < a->mvd_bdst))) { -+ err = -EINVAL; -+ a->mvd_errno = EAU_MVDOWN_OPAQUE; -+ AU_MVD_PR(dmsg, "ancestor is opaque b%d, b%d\n", -+ a->bopq, a->mvd_bdst); -+ } -+ -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+static int au_mvd_args_intermediate(const unsigned char dmsg, -+ struct au_mvd_args *a) -+{ -+ int err; -+ struct au_dinfo *dinfo, *tmp; -+ -+ /* lookup the next lower positive entry */ -+ err = -ENOMEM; -+ tmp = au_di_alloc(a->sb, AuLsc_DI_TMP); -+ if (unlikely(!tmp)) -+ goto out; -+ -+ a->bfound = -1; -+ a->bwh = -1; -+ dinfo = au_di(a->dentry); -+ au_di_cp(tmp, dinfo); -+ au_di_swap(tmp, dinfo); -+ -+ /* returns the number of positive dentries */ -+ err = au_lkup_dentry(a->dentry, a->mvd_bsrc + 1, -+ /* AuLkup_IGNORE_PERM */ 0); -+ if (!err) -+ a->bwh = au_dbwh(a->dentry); -+ else if (err > 0) -+ a->bfound = au_dbtop(a->dentry); -+ -+ au_di_swap(tmp, dinfo); -+ au_rw_write_unlock(&tmp->di_rwsem); -+ au_di_free(tmp); -+ if (unlikely(err < 0)) -+ AU_MVD_PR(dmsg, "failed look-up lower\n"); -+ -+ /* -+ * here, we have these cases. -+ * bfound == -1 -+ * no positive dentry under bsrc. there are more sub-cases. -+ * bwh < 0 -+ * there no whiteout, we can safely move-down. -+ * bwh <= bsrc -+ * impossible -+ * bsrc < bwh && bwh < bdst -+ * there is a whiteout on RO branch. cannot proceed. -+ * bwh == bdst -+ * there is a whiteout on the RW target branch. it should -+ * be removed. -+ * bdst < bwh -+ * there is a whiteout somewhere unrelated branch. -+ * -1 < bfound && bfound <= bsrc -+ * impossible. -+ * bfound < bdst -+ * found, but it is on RO branch between bsrc and bdst. cannot -+ * proceed. -+ * bfound == bdst -+ * found, replace it if AUFS_MVDOWN_FORCE is set. otherwise return -+ * error. -+ * bdst < bfound -+ * found, after we create the file on bdst, it will be hidden. -+ */ -+ -+ AuDebugOn(a->bfound == -1 -+ && a->bwh != -1 -+ && a->bwh <= a->mvd_bsrc); -+ AuDebugOn(-1 < a->bfound -+ && a->bfound <= a->mvd_bsrc); -+ -+ err = -EINVAL; -+ if (a->bfound == -1 -+ && a->mvd_bsrc < a->bwh -+ && a->bwh != -1 -+ && a->bwh < a->mvd_bdst) { -+ a->mvd_errno = EAU_MVDOWN_WHITEOUT; -+ AU_MVD_PR(dmsg, "bsrc %d, bdst %d, bfound %d, bwh %d\n", -+ a->mvd_bsrc, a->mvd_bdst, a->bfound, a->bwh); -+ goto out; -+ } else if (a->bfound != -1 && a->bfound < a->mvd_bdst) { -+ a->mvd_errno = EAU_MVDOWN_UPPER; -+ AU_MVD_PR(dmsg, "bdst %d, bfound %d\n", -+ a->mvd_bdst, a->bfound); -+ goto out; -+ } -+ -+ err = 0; /* success */ -+ -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+static int au_mvd_args_exist(const unsigned char dmsg, struct au_mvd_args *a) -+{ -+ int err; -+ -+ err = 0; -+ if (!(a->mvdown.flags & AUFS_MVDOWN_OWLOWER) -+ && a->bfound == a->mvd_bdst) -+ err = -EEXIST; -+ AuTraceErr(err); -+ return err; -+} -+ -+static int au_mvd_args(const unsigned char dmsg, struct au_mvd_args *a) -+{ -+ int err; -+ struct au_branch *br; -+ -+ err = -EISDIR; -+ if (unlikely(S_ISDIR(a->inode->i_mode))) -+ goto out; -+ -+ err = -EINVAL; -+ if (!(a->mvdown.flags & AUFS_MVDOWN_BRID_UPPER)) -+ a->mvd_bsrc = au_ibtop(a->inode); -+ else { -+ a->mvd_bsrc = au_br_index(a->sb, a->mvd_src_brid); -+ if (unlikely(a->mvd_bsrc < 0 -+ || (a->mvd_bsrc < au_dbtop(a->dentry) -+ || au_dbbot(a->dentry) < a->mvd_bsrc -+ || !au_h_dptr(a->dentry, a->mvd_bsrc)) -+ || (a->mvd_bsrc < au_ibtop(a->inode) -+ || au_ibbot(a->inode) < a->mvd_bsrc -+ || !au_h_iptr(a->inode, a->mvd_bsrc)))) { -+ a->mvd_errno = EAU_MVDOWN_NOUPPER; -+ AU_MVD_PR(dmsg, "no upper\n"); -+ goto out; -+ } -+ } -+ if (unlikely(a->mvd_bsrc == au_sbbot(a->sb))) { -+ a->mvd_errno = EAU_MVDOWN_BOTTOM; -+ AU_MVD_PR(dmsg, "on the bottom\n"); -+ goto out; -+ } -+ a->mvd_h_src_inode = au_h_iptr(a->inode, a->mvd_bsrc); -+ br = au_sbr(a->sb, a->mvd_bsrc); -+ err = au_br_rdonly(br); -+ if (!(a->mvdown.flags & AUFS_MVDOWN_ROUPPER)) { -+ if (unlikely(err)) -+ goto out; -+ } else if (!(vfsub_native_ro(a->mvd_h_src_inode) -+ || IS_APPEND(a->mvd_h_src_inode))) { -+ if (err) -+ a->mvdown.flags |= AUFS_MVDOWN_ROUPPER_R; -+ /* go on */ -+ } else -+ goto out; -+ -+ err = -EINVAL; -+ if (!(a->mvdown.flags & AUFS_MVDOWN_BRID_LOWER)) { -+ a->mvd_bdst = find_lower_writable(a); -+ if (unlikely(a->mvd_bdst < 0)) { -+ a->mvd_errno = EAU_MVDOWN_BOTTOM; -+ AU_MVD_PR(dmsg, "no writable lower branch\n"); -+ goto out; -+ } -+ } else { -+ a->mvd_bdst = au_br_index(a->sb, a->mvd_dst_brid); -+ if (unlikely(a->mvd_bdst < 0 -+ || au_sbbot(a->sb) < a->mvd_bdst)) { -+ a->mvd_errno = EAU_MVDOWN_NOLOWERBR; -+ AU_MVD_PR(dmsg, "no lower brid\n"); -+ goto out; -+ } -+ } -+ -+ err = au_mvd_args_busy(dmsg, a); -+ if (!err) -+ err = au_mvd_args_parent(dmsg, a); -+ if (!err) -+ err = au_mvd_args_intermediate(dmsg, a); -+ if (!err) -+ err = au_mvd_args_exist(dmsg, a); -+ if (!err) -+ AuDbg("b%d, b%d\n", a->mvd_bsrc, a->mvd_bdst); -+ -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+int au_mvdown(struct dentry *dentry, struct aufs_mvdown __user *uarg) -+{ -+ int err, e; -+ unsigned char dmsg; -+ struct au_mvd_args *args; -+ struct inode *inode; -+ -+ inode = d_inode(dentry); -+ err = -EPERM; -+ if (unlikely(!capable(CAP_SYS_ADMIN))) -+ goto out; -+ -+ err = -ENOMEM; -+ args = kmalloc(sizeof(*args), GFP_NOFS); -+ if (unlikely(!args)) -+ goto out; -+ -+ err = copy_from_user(&args->mvdown, uarg, sizeof(args->mvdown)); -+ if (!err) -+ err = !access_ok(VERIFY_WRITE, uarg, sizeof(*uarg)); -+ if (unlikely(err)) { -+ err = -EFAULT; -+ AuTraceErr(err); -+ goto out_free; -+ } -+ AuDbg("flags 0x%x\n", args->mvdown.flags); -+ args->mvdown.flags &= ~(AUFS_MVDOWN_ROLOWER_R | AUFS_MVDOWN_ROUPPER_R); -+ args->mvdown.au_errno = 0; -+ args->dentry = dentry; -+ args->inode = inode; -+ args->sb = dentry->d_sb; -+ -+ err = -ENOENT; -+ dmsg = !!(args->mvdown.flags & AUFS_MVDOWN_DMSG); -+ args->parent = dget_parent(dentry); -+ args->dir = d_inode(args->parent); -+ inode_lock_nested(args->dir, I_MUTEX_PARENT); -+ dput(args->parent); -+ if (unlikely(args->parent != dentry->d_parent)) { -+ AU_MVD_PR(dmsg, "parent dir is moved\n"); -+ goto out_dir; -+ } -+ -+ inode_lock_nested(inode, I_MUTEX_CHILD); -+ err = aufs_read_lock(dentry, AuLock_DW | AuLock_FLUSH | AuLock_NOPLMW); -+ if (unlikely(err)) -+ goto out_inode; -+ -+ di_write_lock_parent(args->parent); -+ err = au_mvd_args(dmsg, args); -+ if (unlikely(err)) -+ goto out_parent; -+ -+ err = au_do_mvdown(dmsg, args); -+ if (unlikely(err)) -+ goto out_parent; -+ -+ au_cpup_attr_timesizes(args->dir); -+ au_cpup_attr_timesizes(inode); -+ if (!(args->mvdown.flags & AUFS_MVDOWN_KUPPER)) -+ au_cpup_igen(inode, au_h_iptr(inode, args->mvd_bdst)); -+ /* au_digen_dec(dentry); */ -+ -+out_parent: -+ di_write_unlock(args->parent); -+ aufs_read_unlock(dentry, AuLock_DW); -+out_inode: -+ inode_unlock(inode); -+out_dir: -+ inode_unlock(args->dir); -+out_free: -+ e = copy_to_user(uarg, &args->mvdown, sizeof(args->mvdown)); -+ if (unlikely(e)) -+ err = -EFAULT; -+ au_delayed_kfree(args); -+out: -+ AuTraceErr(err); -+ return err; -+} -diff --git a/fs/aufs/opts.c b/fs/aufs/opts.c -new file mode 100644 -index 0000000..1d21f0d ---- /dev/null -+++ b/fs/aufs/opts.c -@@ -0,0 +1,1847 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * mount options/flags -+ */ -+ -+#include -+#include /* a distribution requires */ -+#include -+#include "aufs.h" -+ -+/* ---------------------------------------------------------------------- */ -+ -+enum { -+ Opt_br, -+ Opt_add, Opt_del, Opt_mod, Opt_append, Opt_prepend, -+ Opt_idel, Opt_imod, -+ Opt_dirwh, Opt_rdcache, Opt_rdblk, Opt_rdhash, -+ Opt_rdblk_def, Opt_rdhash_def, -+ Opt_xino, Opt_noxino, -+ Opt_trunc_xino, Opt_trunc_xino_v, Opt_notrunc_xino, -+ Opt_trunc_xino_path, Opt_itrunc_xino, -+ Opt_trunc_xib, Opt_notrunc_xib, -+ Opt_shwh, Opt_noshwh, -+ Opt_plink, Opt_noplink, Opt_list_plink, -+ Opt_udba, -+ Opt_dio, Opt_nodio, -+ Opt_diropq_a, Opt_diropq_w, -+ Opt_warn_perm, Opt_nowarn_perm, -+ Opt_wbr_copyup, Opt_wbr_create, -+ Opt_fhsm_sec, -+ Opt_verbose, Opt_noverbose, -+ Opt_sum, Opt_nosum, Opt_wsum, -+ Opt_dirperm1, Opt_nodirperm1, -+ Opt_acl, Opt_noacl, -+ Opt_tail, Opt_ignore, Opt_ignore_silent, Opt_err -+}; -+ -+static match_table_t options = { -+ {Opt_br, "br=%s"}, -+ {Opt_br, "br:%s"}, -+ -+ {Opt_add, "add=%d:%s"}, -+ {Opt_add, "add:%d:%s"}, -+ {Opt_add, "ins=%d:%s"}, -+ {Opt_add, "ins:%d:%s"}, -+ {Opt_append, "append=%s"}, -+ {Opt_append, "append:%s"}, -+ {Opt_prepend, "prepend=%s"}, -+ {Opt_prepend, "prepend:%s"}, -+ -+ {Opt_del, "del=%s"}, -+ {Opt_del, "del:%s"}, -+ /* {Opt_idel, "idel:%d"}, */ -+ {Opt_mod, "mod=%s"}, -+ {Opt_mod, "mod:%s"}, -+ /* {Opt_imod, "imod:%d:%s"}, */ -+ -+ {Opt_dirwh, "dirwh=%d"}, -+ -+ {Opt_xino, "xino=%s"}, -+ {Opt_noxino, "noxino"}, -+ {Opt_trunc_xino, "trunc_xino"}, -+ {Opt_trunc_xino_v, "trunc_xino_v=%d:%d"}, -+ {Opt_notrunc_xino, "notrunc_xino"}, -+ {Opt_trunc_xino_path, "trunc_xino=%s"}, -+ {Opt_itrunc_xino, "itrunc_xino=%d"}, -+ /* {Opt_zxino, "zxino=%s"}, */ -+ {Opt_trunc_xib, "trunc_xib"}, -+ {Opt_notrunc_xib, "notrunc_xib"}, -+ -+#ifdef CONFIG_PROC_FS -+ {Opt_plink, "plink"}, -+#else -+ {Opt_ignore_silent, "plink"}, -+#endif -+ -+ {Opt_noplink, "noplink"}, -+ -+#ifdef CONFIG_AUFS_DEBUG -+ {Opt_list_plink, "list_plink"}, -+#endif -+ -+ {Opt_udba, "udba=%s"}, -+ -+ {Opt_dio, "dio"}, -+ {Opt_nodio, "nodio"}, -+ -+#ifdef CONFIG_AUFS_FHSM -+ {Opt_fhsm_sec, "fhsm_sec=%d"}, -+#else -+ {Opt_ignore_silent, "fhsm_sec=%d"}, -+#endif -+ -+ {Opt_diropq_a, "diropq=always"}, -+ {Opt_diropq_a, "diropq=a"}, -+ {Opt_diropq_w, "diropq=whiteouted"}, -+ {Opt_diropq_w, "diropq=w"}, -+ -+ {Opt_warn_perm, "warn_perm"}, -+ {Opt_nowarn_perm, "nowarn_perm"}, -+ -+ /* keep them temporary */ -+ {Opt_ignore_silent, "nodlgt"}, -+ {Opt_ignore_silent, "clean_plink"}, -+ -+#ifdef CONFIG_AUFS_SHWH -+ {Opt_shwh, "shwh"}, -+#endif -+ {Opt_noshwh, "noshwh"}, -+ -+ {Opt_dirperm1, "dirperm1"}, -+ {Opt_nodirperm1, "nodirperm1"}, -+ -+ {Opt_verbose, "verbose"}, -+ {Opt_verbose, "v"}, -+ {Opt_noverbose, "noverbose"}, -+ {Opt_noverbose, "quiet"}, -+ {Opt_noverbose, "q"}, -+ {Opt_noverbose, "silent"}, -+ -+ {Opt_sum, "sum"}, -+ {Opt_nosum, "nosum"}, -+ {Opt_wsum, "wsum"}, -+ -+ {Opt_rdcache, "rdcache=%d"}, -+ {Opt_rdblk, "rdblk=%d"}, -+ {Opt_rdblk_def, "rdblk=def"}, -+ {Opt_rdhash, "rdhash=%d"}, -+ {Opt_rdhash_def, "rdhash=def"}, -+ -+ {Opt_wbr_create, "create=%s"}, -+ {Opt_wbr_create, "create_policy=%s"}, -+ {Opt_wbr_copyup, "cpup=%s"}, -+ {Opt_wbr_copyup, "copyup=%s"}, -+ {Opt_wbr_copyup, "copyup_policy=%s"}, -+ -+ /* generic VFS flag */ -+#ifdef CONFIG_FS_POSIX_ACL -+ {Opt_acl, "acl"}, -+ {Opt_noacl, "noacl"}, -+#else -+ {Opt_ignore_silent, "acl"}, -+ {Opt_ignore_silent, "noacl"}, -+#endif -+ -+ /* internal use for the scripts */ -+ {Opt_ignore_silent, "si=%s"}, -+ -+ {Opt_br, "dirs=%s"}, -+ {Opt_ignore, "debug=%d"}, -+ {Opt_ignore, "delete=whiteout"}, -+ {Opt_ignore, "delete=all"}, -+ {Opt_ignore, "imap=%s"}, -+ -+ /* temporary workaround, due to old mount(8)? */ -+ {Opt_ignore_silent, "relatime"}, -+ -+ {Opt_err, NULL} -+}; -+ -+/* ---------------------------------------------------------------------- */ -+ -+static const char *au_parser_pattern(int val, match_table_t tbl) -+{ -+ struct match_token *p; -+ -+ p = tbl; -+ while (p->pattern) { -+ if (p->token == val) -+ return p->pattern; -+ p++; -+ } -+ BUG(); -+ return "??"; -+} -+ -+static const char *au_optstr(int *val, match_table_t tbl) -+{ -+ struct match_token *p; -+ int v; -+ -+ v = *val; -+ if (!v) -+ goto out; -+ p = tbl; -+ while (p->pattern) { -+ if (p->token -+ && (v & p->token) == p->token) { -+ *val &= ~p->token; -+ return p->pattern; -+ } -+ p++; -+ } -+ -+out: -+ return NULL; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static match_table_t brperm = { -+ {AuBrPerm_RO, AUFS_BRPERM_RO}, -+ {AuBrPerm_RR, AUFS_BRPERM_RR}, -+ {AuBrPerm_RW, AUFS_BRPERM_RW}, -+ {0, NULL} -+}; -+ -+static match_table_t brattr = { -+ /* general */ -+ {AuBrAttr_COO_REG, AUFS_BRATTR_COO_REG}, -+ {AuBrAttr_COO_ALL, AUFS_BRATTR_COO_ALL}, -+ /* 'unpin' attrib is meaningless since linux-3.18-rc1 */ -+ {AuBrAttr_UNPIN, AUFS_BRATTR_UNPIN}, -+#ifdef CONFIG_AUFS_FHSM -+ {AuBrAttr_FHSM, AUFS_BRATTR_FHSM}, -+#endif -+#ifdef CONFIG_AUFS_XATTR -+ {AuBrAttr_ICEX, AUFS_BRATTR_ICEX}, -+ {AuBrAttr_ICEX_SEC, AUFS_BRATTR_ICEX_SEC}, -+ {AuBrAttr_ICEX_SYS, AUFS_BRATTR_ICEX_SYS}, -+ {AuBrAttr_ICEX_TR, AUFS_BRATTR_ICEX_TR}, -+ {AuBrAttr_ICEX_USR, AUFS_BRATTR_ICEX_USR}, -+ {AuBrAttr_ICEX_OTH, AUFS_BRATTR_ICEX_OTH}, -+#endif -+ -+ /* ro/rr branch */ -+ {AuBrRAttr_WH, AUFS_BRRATTR_WH}, -+ -+ /* rw branch */ -+ {AuBrWAttr_MOO, AUFS_BRWATTR_MOO}, -+ {AuBrWAttr_NoLinkWH, AUFS_BRWATTR_NLWH}, -+ -+ {0, NULL} -+}; -+ -+static int br_attr_val(char *str, match_table_t table, substring_t args[]) -+{ -+ int attr, v; -+ char *p; -+ -+ attr = 0; -+ do { -+ p = strchr(str, '+'); -+ if (p) -+ *p = 0; -+ v = match_token(str, table, args); -+ if (v) { -+ if (v & AuBrAttr_CMOO_Mask) -+ attr &= ~AuBrAttr_CMOO_Mask; -+ attr |= v; -+ } else { -+ if (p) -+ *p = '+'; -+ pr_warn("ignored branch attribute %s\n", str); -+ break; -+ } -+ if (p) -+ str = p + 1; -+ } while (p); -+ -+ return attr; -+} -+ -+static int au_do_optstr_br_attr(au_br_perm_str_t *str, int perm) -+{ -+ int sz; -+ const char *p; -+ char *q; -+ -+ q = str->a; -+ *q = 0; -+ p = au_optstr(&perm, brattr); -+ if (p) { -+ sz = strlen(p); -+ memcpy(q, p, sz + 1); -+ q += sz; -+ } else -+ goto out; -+ -+ do { -+ p = au_optstr(&perm, brattr); -+ if (p) { -+ *q++ = '+'; -+ sz = strlen(p); -+ memcpy(q, p, sz + 1); -+ q += sz; -+ } -+ } while (p); -+ -+out: -+ return q - str->a; -+} -+ -+static int noinline_for_stack br_perm_val(char *perm) -+{ -+ int val, bad, sz; -+ char *p; -+ substring_t args[MAX_OPT_ARGS]; -+ au_br_perm_str_t attr; -+ -+ p = strchr(perm, '+'); -+ if (p) -+ *p = 0; -+ val = match_token(perm, brperm, args); -+ if (!val) { -+ if (p) -+ *p = '+'; -+ pr_warn("ignored branch permission %s\n", perm); -+ val = AuBrPerm_RO; -+ goto out; -+ } -+ if (!p) -+ goto out; -+ -+ val |= br_attr_val(p + 1, brattr, args); -+ -+ bad = 0; -+ switch (val & AuBrPerm_Mask) { -+ case AuBrPerm_RO: -+ case AuBrPerm_RR: -+ bad = val & AuBrWAttr_Mask; -+ val &= ~AuBrWAttr_Mask; -+ break; -+ case AuBrPerm_RW: -+ bad = val & AuBrRAttr_Mask; -+ val &= ~AuBrRAttr_Mask; -+ break; -+ } -+ -+ /* -+ * 'unpin' attrib becomes meaningless since linux-3.18-rc1, but aufs -+ * does not treat it as an error, just warning. -+ * this is a tiny guard for the user operation. -+ */ -+ if (val & AuBrAttr_UNPIN) { -+ bad |= AuBrAttr_UNPIN; -+ val &= ~AuBrAttr_UNPIN; -+ } -+ -+ if (unlikely(bad)) { -+ sz = au_do_optstr_br_attr(&attr, bad); -+ AuDebugOn(!sz); -+ pr_warn("ignored branch attribute %s\n", attr.a); -+ } -+ -+out: -+ return val; -+} -+ -+void au_optstr_br_perm(au_br_perm_str_t *str, int perm) -+{ -+ au_br_perm_str_t attr; -+ const char *p; -+ char *q; -+ int sz; -+ -+ q = str->a; -+ p = au_optstr(&perm, brperm); -+ AuDebugOn(!p || !*p); -+ sz = strlen(p); -+ memcpy(q, p, sz + 1); -+ q += sz; -+ -+ sz = au_do_optstr_br_attr(&attr, perm); -+ if (sz) { -+ *q++ = '+'; -+ memcpy(q, attr.a, sz + 1); -+ } -+ -+ AuDebugOn(strlen(str->a) >= sizeof(str->a)); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static match_table_t udbalevel = { -+ {AuOpt_UDBA_REVAL, "reval"}, -+ {AuOpt_UDBA_NONE, "none"}, -+#ifdef CONFIG_AUFS_HNOTIFY -+ {AuOpt_UDBA_HNOTIFY, "notify"}, /* abstraction */ -+#ifdef CONFIG_AUFS_HFSNOTIFY -+ {AuOpt_UDBA_HNOTIFY, "fsnotify"}, -+#endif -+#endif -+ {-1, NULL} -+}; -+ -+static int noinline_for_stack udba_val(char *str) -+{ -+ substring_t args[MAX_OPT_ARGS]; -+ -+ return match_token(str, udbalevel, args); -+} -+ -+const char *au_optstr_udba(int udba) -+{ -+ return au_parser_pattern(udba, udbalevel); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static match_table_t au_wbr_create_policy = { -+ {AuWbrCreate_TDP, "tdp"}, -+ {AuWbrCreate_TDP, "top-down-parent"}, -+ {AuWbrCreate_RR, "rr"}, -+ {AuWbrCreate_RR, "round-robin"}, -+ {AuWbrCreate_MFS, "mfs"}, -+ {AuWbrCreate_MFS, "most-free-space"}, -+ {AuWbrCreate_MFSV, "mfs:%d"}, -+ {AuWbrCreate_MFSV, "most-free-space:%d"}, -+ -+ {AuWbrCreate_MFSRR, "mfsrr:%d"}, -+ {AuWbrCreate_MFSRRV, "mfsrr:%d:%d"}, -+ {AuWbrCreate_PMFS, "pmfs"}, -+ {AuWbrCreate_PMFSV, "pmfs:%d"}, -+ {AuWbrCreate_PMFSRR, "pmfsrr:%d"}, -+ {AuWbrCreate_PMFSRRV, "pmfsrr:%d:%d"}, -+ -+ {-1, NULL} -+}; -+ -+/* -+ * cf. linux/lib/parser.c and cmdline.c -+ * gave up calling memparse() since it uses simple_strtoull() instead of -+ * kstrto...(). -+ */ -+static int noinline_for_stack -+au_match_ull(substring_t *s, unsigned long long *result) -+{ -+ int err; -+ unsigned int len; -+ char a[32]; -+ -+ err = -ERANGE; -+ len = s->to - s->from; -+ if (len + 1 <= sizeof(a)) { -+ memcpy(a, s->from, len); -+ a[len] = '\0'; -+ err = kstrtoull(a, 0, result); -+ } -+ return err; -+} -+ -+static int au_wbr_mfs_wmark(substring_t *arg, char *str, -+ struct au_opt_wbr_create *create) -+{ -+ int err; -+ unsigned long long ull; -+ -+ err = 0; -+ if (!au_match_ull(arg, &ull)) -+ create->mfsrr_watermark = ull; -+ else { -+ pr_err("bad integer in %s\n", str); -+ err = -EINVAL; -+ } -+ -+ return err; -+} -+ -+static int au_wbr_mfs_sec(substring_t *arg, char *str, -+ struct au_opt_wbr_create *create) -+{ -+ int n, err; -+ -+ err = 0; -+ if (!match_int(arg, &n) && 0 <= n && n <= AUFS_MFS_MAX_SEC) -+ create->mfs_second = n; -+ else { -+ pr_err("bad integer in %s\n", str); -+ err = -EINVAL; -+ } -+ -+ return err; -+} -+ -+static int noinline_for_stack -+au_wbr_create_val(char *str, struct au_opt_wbr_create *create) -+{ -+ int err, e; -+ substring_t args[MAX_OPT_ARGS]; -+ -+ err = match_token(str, au_wbr_create_policy, args); -+ create->wbr_create = err; -+ switch (err) { -+ case AuWbrCreate_MFSRRV: -+ case AuWbrCreate_PMFSRRV: -+ e = au_wbr_mfs_wmark(&args[0], str, create); -+ if (!e) -+ e = au_wbr_mfs_sec(&args[1], str, create); -+ if (unlikely(e)) -+ err = e; -+ break; -+ case AuWbrCreate_MFSRR: -+ case AuWbrCreate_PMFSRR: -+ e = au_wbr_mfs_wmark(&args[0], str, create); -+ if (unlikely(e)) { -+ err = e; -+ break; -+ } -+ /*FALLTHROUGH*/ -+ case AuWbrCreate_MFS: -+ case AuWbrCreate_PMFS: -+ create->mfs_second = AUFS_MFS_DEF_SEC; -+ break; -+ case AuWbrCreate_MFSV: -+ case AuWbrCreate_PMFSV: -+ e = au_wbr_mfs_sec(&args[0], str, create); -+ if (unlikely(e)) -+ err = e; -+ break; -+ } -+ -+ return err; -+} -+ -+const char *au_optstr_wbr_create(int wbr_create) -+{ -+ return au_parser_pattern(wbr_create, au_wbr_create_policy); -+} -+ -+static match_table_t au_wbr_copyup_policy = { -+ {AuWbrCopyup_TDP, "tdp"}, -+ {AuWbrCopyup_TDP, "top-down-parent"}, -+ {AuWbrCopyup_BUP, "bup"}, -+ {AuWbrCopyup_BUP, "bottom-up-parent"}, -+ {AuWbrCopyup_BU, "bu"}, -+ {AuWbrCopyup_BU, "bottom-up"}, -+ {-1, NULL} -+}; -+ -+static int noinline_for_stack au_wbr_copyup_val(char *str) -+{ -+ substring_t args[MAX_OPT_ARGS]; -+ -+ return match_token(str, au_wbr_copyup_policy, args); -+} -+ -+const char *au_optstr_wbr_copyup(int wbr_copyup) -+{ -+ return au_parser_pattern(wbr_copyup, au_wbr_copyup_policy); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static const int lkup_dirflags = LOOKUP_FOLLOW | LOOKUP_DIRECTORY; -+ -+static void dump_opts(struct au_opts *opts) -+{ -+#ifdef CONFIG_AUFS_DEBUG -+ /* reduce stack space */ -+ union { -+ struct au_opt_add *add; -+ struct au_opt_del *del; -+ struct au_opt_mod *mod; -+ struct au_opt_xino *xino; -+ struct au_opt_xino_itrunc *xino_itrunc; -+ struct au_opt_wbr_create *create; -+ } u; -+ struct au_opt *opt; -+ -+ opt = opts->opt; -+ while (opt->type != Opt_tail) { -+ switch (opt->type) { -+ case Opt_add: -+ u.add = &opt->add; -+ AuDbg("add {b%d, %s, 0x%x, %p}\n", -+ u.add->bindex, u.add->pathname, u.add->perm, -+ u.add->path.dentry); -+ break; -+ case Opt_del: -+ case Opt_idel: -+ u.del = &opt->del; -+ AuDbg("del {%s, %p}\n", -+ u.del->pathname, u.del->h_path.dentry); -+ break; -+ case Opt_mod: -+ case Opt_imod: -+ u.mod = &opt->mod; -+ AuDbg("mod {%s, 0x%x, %p}\n", -+ u.mod->path, u.mod->perm, u.mod->h_root); -+ break; -+ case Opt_append: -+ u.add = &opt->add; -+ AuDbg("append {b%d, %s, 0x%x, %p}\n", -+ u.add->bindex, u.add->pathname, u.add->perm, -+ u.add->path.dentry); -+ break; -+ case Opt_prepend: -+ u.add = &opt->add; -+ AuDbg("prepend {b%d, %s, 0x%x, %p}\n", -+ u.add->bindex, u.add->pathname, u.add->perm, -+ u.add->path.dentry); -+ break; -+ case Opt_dirwh: -+ AuDbg("dirwh %d\n", opt->dirwh); -+ break; -+ case Opt_rdcache: -+ AuDbg("rdcache %d\n", opt->rdcache); -+ break; -+ case Opt_rdblk: -+ AuDbg("rdblk %u\n", opt->rdblk); -+ break; -+ case Opt_rdblk_def: -+ AuDbg("rdblk_def\n"); -+ break; -+ case Opt_rdhash: -+ AuDbg("rdhash %u\n", opt->rdhash); -+ break; -+ case Opt_rdhash_def: -+ AuDbg("rdhash_def\n"); -+ break; -+ case Opt_xino: -+ u.xino = &opt->xino; -+ AuDbg("xino {%s %pD}\n", u.xino->path, u.xino->file); -+ break; -+ case Opt_trunc_xino: -+ AuLabel(trunc_xino); -+ break; -+ case Opt_notrunc_xino: -+ AuLabel(notrunc_xino); -+ break; -+ case Opt_trunc_xino_path: -+ case Opt_itrunc_xino: -+ u.xino_itrunc = &opt->xino_itrunc; -+ AuDbg("trunc_xino %d\n", u.xino_itrunc->bindex); -+ break; -+ case Opt_noxino: -+ AuLabel(noxino); -+ break; -+ case Opt_trunc_xib: -+ AuLabel(trunc_xib); -+ break; -+ case Opt_notrunc_xib: -+ AuLabel(notrunc_xib); -+ break; -+ case Opt_shwh: -+ AuLabel(shwh); -+ break; -+ case Opt_noshwh: -+ AuLabel(noshwh); -+ break; -+ case Opt_dirperm1: -+ AuLabel(dirperm1); -+ break; -+ case Opt_nodirperm1: -+ AuLabel(nodirperm1); -+ break; -+ case Opt_plink: -+ AuLabel(plink); -+ break; -+ case Opt_noplink: -+ AuLabel(noplink); -+ break; -+ case Opt_list_plink: -+ AuLabel(list_plink); -+ break; -+ case Opt_udba: -+ AuDbg("udba %d, %s\n", -+ opt->udba, au_optstr_udba(opt->udba)); -+ break; -+ case Opt_dio: -+ AuLabel(dio); -+ break; -+ case Opt_nodio: -+ AuLabel(nodio); -+ break; -+ case Opt_diropq_a: -+ AuLabel(diropq_a); -+ break; -+ case Opt_diropq_w: -+ AuLabel(diropq_w); -+ break; -+ case Opt_warn_perm: -+ AuLabel(warn_perm); -+ break; -+ case Opt_nowarn_perm: -+ AuLabel(nowarn_perm); -+ break; -+ case Opt_verbose: -+ AuLabel(verbose); -+ break; -+ case Opt_noverbose: -+ AuLabel(noverbose); -+ break; -+ case Opt_sum: -+ AuLabel(sum); -+ break; -+ case Opt_nosum: -+ AuLabel(nosum); -+ break; -+ case Opt_wsum: -+ AuLabel(wsum); -+ break; -+ case Opt_wbr_create: -+ u.create = &opt->wbr_create; -+ AuDbg("create %d, %s\n", u.create->wbr_create, -+ au_optstr_wbr_create(u.create->wbr_create)); -+ switch (u.create->wbr_create) { -+ case AuWbrCreate_MFSV: -+ case AuWbrCreate_PMFSV: -+ AuDbg("%d sec\n", u.create->mfs_second); -+ break; -+ case AuWbrCreate_MFSRR: -+ AuDbg("%llu watermark\n", -+ u.create->mfsrr_watermark); -+ break; -+ case AuWbrCreate_MFSRRV: -+ case AuWbrCreate_PMFSRRV: -+ AuDbg("%llu watermark, %d sec\n", -+ u.create->mfsrr_watermark, -+ u.create->mfs_second); -+ break; -+ } -+ break; -+ case Opt_wbr_copyup: -+ AuDbg("copyup %d, %s\n", opt->wbr_copyup, -+ au_optstr_wbr_copyup(opt->wbr_copyup)); -+ break; -+ case Opt_fhsm_sec: -+ AuDbg("fhsm_sec %u\n", opt->fhsm_second); -+ break; -+ case Opt_acl: -+ AuLabel(acl); -+ break; -+ case Opt_noacl: -+ AuLabel(noacl); -+ break; -+ default: -+ BUG(); -+ } -+ opt++; -+ } -+#endif -+} -+ -+void au_opts_free(struct au_opts *opts) -+{ -+ struct au_opt *opt; -+ -+ opt = opts->opt; -+ while (opt->type != Opt_tail) { -+ switch (opt->type) { -+ case Opt_add: -+ case Opt_append: -+ case Opt_prepend: -+ path_put(&opt->add.path); -+ break; -+ case Opt_del: -+ case Opt_idel: -+ path_put(&opt->del.h_path); -+ break; -+ case Opt_mod: -+ case Opt_imod: -+ dput(opt->mod.h_root); -+ break; -+ case Opt_xino: -+ fput(opt->xino.file); -+ break; -+ } -+ opt++; -+ } -+} -+ -+static int opt_add(struct au_opt *opt, char *opt_str, unsigned long sb_flags, -+ aufs_bindex_t bindex) -+{ -+ int err; -+ struct au_opt_add *add = &opt->add; -+ char *p; -+ -+ add->bindex = bindex; -+ add->perm = AuBrPerm_RO; -+ add->pathname = opt_str; -+ p = strchr(opt_str, '='); -+ if (p) { -+ *p++ = 0; -+ if (*p) -+ add->perm = br_perm_val(p); -+ } -+ -+ err = vfsub_kern_path(add->pathname, lkup_dirflags, &add->path); -+ if (!err) { -+ if (!p) { -+ add->perm = AuBrPerm_RO; -+ if (au_test_fs_rr(add->path.dentry->d_sb)) -+ add->perm = AuBrPerm_RR; -+ else if (!bindex && !(sb_flags & MS_RDONLY)) -+ add->perm = AuBrPerm_RW; -+ } -+ opt->type = Opt_add; -+ goto out; -+ } -+ pr_err("lookup failed %s (%d)\n", add->pathname, err); -+ err = -EINVAL; -+ -+out: -+ return err; -+} -+ -+static int au_opts_parse_del(struct au_opt_del *del, substring_t args[]) -+{ -+ int err; -+ -+ del->pathname = args[0].from; -+ AuDbg("del path %s\n", del->pathname); -+ -+ err = vfsub_kern_path(del->pathname, lkup_dirflags, &del->h_path); -+ if (unlikely(err)) -+ pr_err("lookup failed %s (%d)\n", del->pathname, err); -+ -+ return err; -+} -+ -+#if 0 /* reserved for future use */ -+static int au_opts_parse_idel(struct super_block *sb, aufs_bindex_t bindex, -+ struct au_opt_del *del, substring_t args[]) -+{ -+ int err; -+ struct dentry *root; -+ -+ err = -EINVAL; -+ root = sb->s_root; -+ aufs_read_lock(root, AuLock_FLUSH); -+ if (bindex < 0 || au_sbbot(sb) < bindex) { -+ pr_err("out of bounds, %d\n", bindex); -+ goto out; -+ } -+ -+ err = 0; -+ del->h_path.dentry = dget(au_h_dptr(root, bindex)); -+ del->h_path.mnt = mntget(au_sbr_mnt(sb, bindex)); -+ -+out: -+ aufs_read_unlock(root, !AuLock_IR); -+ return err; -+} -+#endif -+ -+static int noinline_for_stack -+au_opts_parse_mod(struct au_opt_mod *mod, substring_t args[]) -+{ -+ int err; -+ struct path path; -+ char *p; -+ -+ err = -EINVAL; -+ mod->path = args[0].from; -+ p = strchr(mod->path, '='); -+ if (unlikely(!p)) { -+ pr_err("no permssion %s\n", args[0].from); -+ goto out; -+ } -+ -+ *p++ = 0; -+ err = vfsub_kern_path(mod->path, lkup_dirflags, &path); -+ if (unlikely(err)) { -+ pr_err("lookup failed %s (%d)\n", mod->path, err); -+ goto out; -+ } -+ -+ mod->perm = br_perm_val(p); -+ AuDbg("mod path %s, perm 0x%x, %s\n", mod->path, mod->perm, p); -+ mod->h_root = dget(path.dentry); -+ path_put(&path); -+ -+out: -+ return err; -+} -+ -+#if 0 /* reserved for future use */ -+static int au_opts_parse_imod(struct super_block *sb, aufs_bindex_t bindex, -+ struct au_opt_mod *mod, substring_t args[]) -+{ -+ int err; -+ struct dentry *root; -+ -+ err = -EINVAL; -+ root = sb->s_root; -+ aufs_read_lock(root, AuLock_FLUSH); -+ if (bindex < 0 || au_sbbot(sb) < bindex) { -+ pr_err("out of bounds, %d\n", bindex); -+ goto out; -+ } -+ -+ err = 0; -+ mod->perm = br_perm_val(args[1].from); -+ AuDbg("mod path %s, perm 0x%x, %s\n", -+ mod->path, mod->perm, args[1].from); -+ mod->h_root = dget(au_h_dptr(root, bindex)); -+ -+out: -+ aufs_read_unlock(root, !AuLock_IR); -+ return err; -+} -+#endif -+ -+static int au_opts_parse_xino(struct super_block *sb, struct au_opt_xino *xino, -+ substring_t args[]) -+{ -+ int err; -+ struct file *file; -+ -+ file = au_xino_create(sb, args[0].from, /*silent*/0); -+ err = PTR_ERR(file); -+ if (IS_ERR(file)) -+ goto out; -+ -+ err = -EINVAL; -+ if (unlikely(file->f_path.dentry->d_sb == sb)) { -+ fput(file); -+ pr_err("%s must be outside\n", args[0].from); -+ goto out; -+ } -+ -+ err = 0; -+ xino->file = file; -+ xino->path = args[0].from; -+ -+out: -+ return err; -+} -+ -+static int noinline_for_stack -+au_opts_parse_xino_itrunc_path(struct super_block *sb, -+ struct au_opt_xino_itrunc *xino_itrunc, -+ substring_t args[]) -+{ -+ int err; -+ aufs_bindex_t bbot, bindex; -+ struct path path; -+ struct dentry *root; -+ -+ err = vfsub_kern_path(args[0].from, lkup_dirflags, &path); -+ if (unlikely(err)) { -+ pr_err("lookup failed %s (%d)\n", args[0].from, err); -+ goto out; -+ } -+ -+ xino_itrunc->bindex = -1; -+ root = sb->s_root; -+ aufs_read_lock(root, AuLock_FLUSH); -+ bbot = au_sbbot(sb); -+ for (bindex = 0; bindex <= bbot; bindex++) { -+ if (au_h_dptr(root, bindex) == path.dentry) { -+ xino_itrunc->bindex = bindex; -+ break; -+ } -+ } -+ aufs_read_unlock(root, !AuLock_IR); -+ path_put(&path); -+ -+ if (unlikely(xino_itrunc->bindex < 0)) { -+ pr_err("no such branch %s\n", args[0].from); -+ err = -EINVAL; -+ } -+ -+out: -+ return err; -+} -+ -+/* called without aufs lock */ -+int au_opts_parse(struct super_block *sb, char *str, struct au_opts *opts) -+{ -+ int err, n, token; -+ aufs_bindex_t bindex; -+ unsigned char skipped; -+ struct dentry *root; -+ struct au_opt *opt, *opt_tail; -+ char *opt_str; -+ /* reduce the stack space */ -+ union { -+ struct au_opt_xino_itrunc *xino_itrunc; -+ struct au_opt_wbr_create *create; -+ } u; -+ struct { -+ substring_t args[MAX_OPT_ARGS]; -+ } *a; -+ -+ err = -ENOMEM; -+ a = kmalloc(sizeof(*a), GFP_NOFS); -+ if (unlikely(!a)) -+ goto out; -+ -+ root = sb->s_root; -+ err = 0; -+ bindex = 0; -+ opt = opts->opt; -+ opt_tail = opt + opts->max_opt - 1; -+ opt->type = Opt_tail; -+ while (!err && (opt_str = strsep(&str, ",")) && *opt_str) { -+ err = -EINVAL; -+ skipped = 0; -+ token = match_token(opt_str, options, a->args); -+ switch (token) { -+ case Opt_br: -+ err = 0; -+ while (!err && (opt_str = strsep(&a->args[0].from, ":")) -+ && *opt_str) { -+ err = opt_add(opt, opt_str, opts->sb_flags, -+ bindex++); -+ if (unlikely(!err && ++opt > opt_tail)) { -+ err = -E2BIG; -+ break; -+ } -+ opt->type = Opt_tail; -+ skipped = 1; -+ } -+ break; -+ case Opt_add: -+ if (unlikely(match_int(&a->args[0], &n))) { -+ pr_err("bad integer in %s\n", opt_str); -+ break; -+ } -+ bindex = n; -+ err = opt_add(opt, a->args[1].from, opts->sb_flags, -+ bindex); -+ if (!err) -+ opt->type = token; -+ break; -+ case Opt_append: -+ err = opt_add(opt, a->args[0].from, opts->sb_flags, -+ /*dummy bindex*/1); -+ if (!err) -+ opt->type = token; -+ break; -+ case Opt_prepend: -+ err = opt_add(opt, a->args[0].from, opts->sb_flags, -+ /*bindex*/0); -+ if (!err) -+ opt->type = token; -+ break; -+ case Opt_del: -+ err = au_opts_parse_del(&opt->del, a->args); -+ if (!err) -+ opt->type = token; -+ break; -+#if 0 /* reserved for future use */ -+ case Opt_idel: -+ del->pathname = "(indexed)"; -+ if (unlikely(match_int(&args[0], &n))) { -+ pr_err("bad integer in %s\n", opt_str); -+ break; -+ } -+ err = au_opts_parse_idel(sb, n, &opt->del, a->args); -+ if (!err) -+ opt->type = token; -+ break; -+#endif -+ case Opt_mod: -+ err = au_opts_parse_mod(&opt->mod, a->args); -+ if (!err) -+ opt->type = token; -+ break; -+#ifdef IMOD /* reserved for future use */ -+ case Opt_imod: -+ u.mod->path = "(indexed)"; -+ if (unlikely(match_int(&a->args[0], &n))) { -+ pr_err("bad integer in %s\n", opt_str); -+ break; -+ } -+ err = au_opts_parse_imod(sb, n, &opt->mod, a->args); -+ if (!err) -+ opt->type = token; -+ break; -+#endif -+ case Opt_xino: -+ err = au_opts_parse_xino(sb, &opt->xino, a->args); -+ if (!err) -+ opt->type = token; -+ break; -+ -+ case Opt_trunc_xino_path: -+ err = au_opts_parse_xino_itrunc_path -+ (sb, &opt->xino_itrunc, a->args); -+ if (!err) -+ opt->type = token; -+ break; -+ -+ case Opt_itrunc_xino: -+ u.xino_itrunc = &opt->xino_itrunc; -+ if (unlikely(match_int(&a->args[0], &n))) { -+ pr_err("bad integer in %s\n", opt_str); -+ break; -+ } -+ u.xino_itrunc->bindex = n; -+ aufs_read_lock(root, AuLock_FLUSH); -+ if (n < 0 || au_sbbot(sb) < n) { -+ pr_err("out of bounds, %d\n", n); -+ aufs_read_unlock(root, !AuLock_IR); -+ break; -+ } -+ aufs_read_unlock(root, !AuLock_IR); -+ err = 0; -+ opt->type = token; -+ break; -+ -+ case Opt_dirwh: -+ if (unlikely(match_int(&a->args[0], &opt->dirwh))) -+ break; -+ err = 0; -+ opt->type = token; -+ break; -+ -+ case Opt_rdcache: -+ if (unlikely(match_int(&a->args[0], &n))) { -+ pr_err("bad integer in %s\n", opt_str); -+ break; -+ } -+ if (unlikely(n > AUFS_RDCACHE_MAX)) { -+ pr_err("rdcache must be smaller than %d\n", -+ AUFS_RDCACHE_MAX); -+ break; -+ } -+ opt->rdcache = n; -+ err = 0; -+ opt->type = token; -+ break; -+ case Opt_rdblk: -+ if (unlikely(match_int(&a->args[0], &n) -+ || n < 0 -+ || n > KMALLOC_MAX_SIZE)) { -+ pr_err("bad integer in %s\n", opt_str); -+ break; -+ } -+ if (unlikely(n && n < NAME_MAX)) { -+ pr_err("rdblk must be larger than %d\n", -+ NAME_MAX); -+ break; -+ } -+ opt->rdblk = n; -+ err = 0; -+ opt->type = token; -+ break; -+ case Opt_rdhash: -+ if (unlikely(match_int(&a->args[0], &n) -+ || n < 0 -+ || n * sizeof(struct hlist_head) -+ > KMALLOC_MAX_SIZE)) { -+ pr_err("bad integer in %s\n", opt_str); -+ break; -+ } -+ opt->rdhash = n; -+ err = 0; -+ opt->type = token; -+ break; -+ -+ case Opt_trunc_xino: -+ case Opt_notrunc_xino: -+ case Opt_noxino: -+ case Opt_trunc_xib: -+ case Opt_notrunc_xib: -+ case Opt_shwh: -+ case Opt_noshwh: -+ case Opt_dirperm1: -+ case Opt_nodirperm1: -+ case Opt_plink: -+ case Opt_noplink: -+ case Opt_list_plink: -+ case Opt_dio: -+ case Opt_nodio: -+ case Opt_diropq_a: -+ case Opt_diropq_w: -+ case Opt_warn_perm: -+ case Opt_nowarn_perm: -+ case Opt_verbose: -+ case Opt_noverbose: -+ case Opt_sum: -+ case Opt_nosum: -+ case Opt_wsum: -+ case Opt_rdblk_def: -+ case Opt_rdhash_def: -+ case Opt_acl: -+ case Opt_noacl: -+ err = 0; -+ opt->type = token; -+ break; -+ -+ case Opt_udba: -+ opt->udba = udba_val(a->args[0].from); -+ if (opt->udba >= 0) { -+ err = 0; -+ opt->type = token; -+ } else -+ pr_err("wrong value, %s\n", opt_str); -+ break; -+ -+ case Opt_wbr_create: -+ u.create = &opt->wbr_create; -+ u.create->wbr_create -+ = au_wbr_create_val(a->args[0].from, u.create); -+ if (u.create->wbr_create >= 0) { -+ err = 0; -+ opt->type = token; -+ } else -+ pr_err("wrong value, %s\n", opt_str); -+ break; -+ case Opt_wbr_copyup: -+ opt->wbr_copyup = au_wbr_copyup_val(a->args[0].from); -+ if (opt->wbr_copyup >= 0) { -+ err = 0; -+ opt->type = token; -+ } else -+ pr_err("wrong value, %s\n", opt_str); -+ break; -+ -+ case Opt_fhsm_sec: -+ if (unlikely(match_int(&a->args[0], &n) -+ || n < 0)) { -+ pr_err("bad integer in %s\n", opt_str); -+ break; -+ } -+ if (sysaufs_brs) { -+ opt->fhsm_second = n; -+ opt->type = token; -+ } else -+ pr_warn("ignored %s\n", opt_str); -+ err = 0; -+ break; -+ -+ case Opt_ignore: -+ pr_warn("ignored %s\n", opt_str); -+ /*FALLTHROUGH*/ -+ case Opt_ignore_silent: -+ skipped = 1; -+ err = 0; -+ break; -+ case Opt_err: -+ pr_err("unknown option %s\n", opt_str); -+ break; -+ } -+ -+ if (!err && !skipped) { -+ if (unlikely(++opt > opt_tail)) { -+ err = -E2BIG; -+ opt--; -+ opt->type = Opt_tail; -+ break; -+ } -+ opt->type = Opt_tail; -+ } -+ } -+ -+ au_delayed_kfree(a); -+ dump_opts(opts); -+ if (unlikely(err)) -+ au_opts_free(opts); -+ -+out: -+ return err; -+} -+ -+static int au_opt_wbr_create(struct super_block *sb, -+ struct au_opt_wbr_create *create) -+{ -+ int err; -+ struct au_sbinfo *sbinfo; -+ -+ SiMustWriteLock(sb); -+ -+ err = 1; /* handled */ -+ sbinfo = au_sbi(sb); -+ if (sbinfo->si_wbr_create_ops->fin) { -+ err = sbinfo->si_wbr_create_ops->fin(sb); -+ if (!err) -+ err = 1; -+ } -+ -+ sbinfo->si_wbr_create = create->wbr_create; -+ sbinfo->si_wbr_create_ops = au_wbr_create_ops + create->wbr_create; -+ switch (create->wbr_create) { -+ case AuWbrCreate_MFSRRV: -+ case AuWbrCreate_MFSRR: -+ case AuWbrCreate_PMFSRR: -+ case AuWbrCreate_PMFSRRV: -+ sbinfo->si_wbr_mfs.mfsrr_watermark = create->mfsrr_watermark; -+ /*FALLTHROUGH*/ -+ case AuWbrCreate_MFS: -+ case AuWbrCreate_MFSV: -+ case AuWbrCreate_PMFS: -+ case AuWbrCreate_PMFSV: -+ sbinfo->si_wbr_mfs.mfs_expire -+ = msecs_to_jiffies(create->mfs_second * MSEC_PER_SEC); -+ break; -+ } -+ -+ if (sbinfo->si_wbr_create_ops->init) -+ sbinfo->si_wbr_create_ops->init(sb); /* ignore */ -+ -+ return err; -+} -+ -+/* -+ * returns, -+ * plus: processed without an error -+ * zero: unprocessed -+ */ -+static int au_opt_simple(struct super_block *sb, struct au_opt *opt, -+ struct au_opts *opts) -+{ -+ int err; -+ struct au_sbinfo *sbinfo; -+ -+ SiMustWriteLock(sb); -+ -+ err = 1; /* handled */ -+ sbinfo = au_sbi(sb); -+ switch (opt->type) { -+ case Opt_udba: -+ sbinfo->si_mntflags &= ~AuOptMask_UDBA; -+ sbinfo->si_mntflags |= opt->udba; -+ opts->given_udba |= opt->udba; -+ break; -+ -+ case Opt_plink: -+ au_opt_set(sbinfo->si_mntflags, PLINK); -+ break; -+ case Opt_noplink: -+ if (au_opt_test(sbinfo->si_mntflags, PLINK)) -+ au_plink_put(sb, /*verbose*/1); -+ au_opt_clr(sbinfo->si_mntflags, PLINK); -+ break; -+ case Opt_list_plink: -+ if (au_opt_test(sbinfo->si_mntflags, PLINK)) -+ au_plink_list(sb); -+ break; -+ -+ case Opt_dio: -+ au_opt_set(sbinfo->si_mntflags, DIO); -+ au_fset_opts(opts->flags, REFRESH_DYAOP); -+ break; -+ case Opt_nodio: -+ au_opt_clr(sbinfo->si_mntflags, DIO); -+ au_fset_opts(opts->flags, REFRESH_DYAOP); -+ break; -+ -+ case Opt_fhsm_sec: -+ au_fhsm_set(sbinfo, opt->fhsm_second); -+ break; -+ -+ case Opt_diropq_a: -+ au_opt_set(sbinfo->si_mntflags, ALWAYS_DIROPQ); -+ break; -+ case Opt_diropq_w: -+ au_opt_clr(sbinfo->si_mntflags, ALWAYS_DIROPQ); -+ break; -+ -+ case Opt_warn_perm: -+ au_opt_set(sbinfo->si_mntflags, WARN_PERM); -+ break; -+ case Opt_nowarn_perm: -+ au_opt_clr(sbinfo->si_mntflags, WARN_PERM); -+ break; -+ -+ case Opt_verbose: -+ au_opt_set(sbinfo->si_mntflags, VERBOSE); -+ break; -+ case Opt_noverbose: -+ au_opt_clr(sbinfo->si_mntflags, VERBOSE); -+ break; -+ -+ case Opt_sum: -+ au_opt_set(sbinfo->si_mntflags, SUM); -+ break; -+ case Opt_wsum: -+ au_opt_clr(sbinfo->si_mntflags, SUM); -+ au_opt_set(sbinfo->si_mntflags, SUM_W); -+ case Opt_nosum: -+ au_opt_clr(sbinfo->si_mntflags, SUM); -+ au_opt_clr(sbinfo->si_mntflags, SUM_W); -+ break; -+ -+ case Opt_wbr_create: -+ err = au_opt_wbr_create(sb, &opt->wbr_create); -+ break; -+ case Opt_wbr_copyup: -+ sbinfo->si_wbr_copyup = opt->wbr_copyup; -+ sbinfo->si_wbr_copyup_ops = au_wbr_copyup_ops + opt->wbr_copyup; -+ break; -+ -+ case Opt_dirwh: -+ sbinfo->si_dirwh = opt->dirwh; -+ break; -+ -+ case Opt_rdcache: -+ sbinfo->si_rdcache -+ = msecs_to_jiffies(opt->rdcache * MSEC_PER_SEC); -+ break; -+ case Opt_rdblk: -+ sbinfo->si_rdblk = opt->rdblk; -+ break; -+ case Opt_rdblk_def: -+ sbinfo->si_rdblk = AUFS_RDBLK_DEF; -+ break; -+ case Opt_rdhash: -+ sbinfo->si_rdhash = opt->rdhash; -+ break; -+ case Opt_rdhash_def: -+ sbinfo->si_rdhash = AUFS_RDHASH_DEF; -+ break; -+ -+ case Opt_shwh: -+ au_opt_set(sbinfo->si_mntflags, SHWH); -+ break; -+ case Opt_noshwh: -+ au_opt_clr(sbinfo->si_mntflags, SHWH); -+ break; -+ -+ case Opt_dirperm1: -+ au_opt_set(sbinfo->si_mntflags, DIRPERM1); -+ break; -+ case Opt_nodirperm1: -+ au_opt_clr(sbinfo->si_mntflags, DIRPERM1); -+ break; -+ -+ case Opt_trunc_xino: -+ au_opt_set(sbinfo->si_mntflags, TRUNC_XINO); -+ break; -+ case Opt_notrunc_xino: -+ au_opt_clr(sbinfo->si_mntflags, TRUNC_XINO); -+ break; -+ -+ case Opt_trunc_xino_path: -+ case Opt_itrunc_xino: -+ err = au_xino_trunc(sb, opt->xino_itrunc.bindex); -+ if (!err) -+ err = 1; -+ break; -+ -+ case Opt_trunc_xib: -+ au_fset_opts(opts->flags, TRUNC_XIB); -+ break; -+ case Opt_notrunc_xib: -+ au_fclr_opts(opts->flags, TRUNC_XIB); -+ break; -+ -+ case Opt_acl: -+ sb->s_flags |= MS_POSIXACL; -+ break; -+ case Opt_noacl: -+ sb->s_flags &= ~MS_POSIXACL; -+ break; -+ -+ default: -+ err = 0; -+ break; -+ } -+ -+ return err; -+} -+ -+/* -+ * returns tri-state. -+ * plus: processed without an error -+ * zero: unprocessed -+ * minus: error -+ */ -+static int au_opt_br(struct super_block *sb, struct au_opt *opt, -+ struct au_opts *opts) -+{ -+ int err, do_refresh; -+ -+ err = 0; -+ switch (opt->type) { -+ case Opt_append: -+ opt->add.bindex = au_sbbot(sb) + 1; -+ if (opt->add.bindex < 0) -+ opt->add.bindex = 0; -+ goto add; -+ case Opt_prepend: -+ opt->add.bindex = 0; -+ add: /* indented label */ -+ case Opt_add: -+ err = au_br_add(sb, &opt->add, -+ au_ftest_opts(opts->flags, REMOUNT)); -+ if (!err) { -+ err = 1; -+ au_fset_opts(opts->flags, REFRESH); -+ } -+ break; -+ -+ case Opt_del: -+ case Opt_idel: -+ err = au_br_del(sb, &opt->del, -+ au_ftest_opts(opts->flags, REMOUNT)); -+ if (!err) { -+ err = 1; -+ au_fset_opts(opts->flags, TRUNC_XIB); -+ au_fset_opts(opts->flags, REFRESH); -+ } -+ break; -+ -+ case Opt_mod: -+ case Opt_imod: -+ err = au_br_mod(sb, &opt->mod, -+ au_ftest_opts(opts->flags, REMOUNT), -+ &do_refresh); -+ if (!err) { -+ err = 1; -+ if (do_refresh) -+ au_fset_opts(opts->flags, REFRESH); -+ } -+ break; -+ } -+ -+ return err; -+} -+ -+static int au_opt_xino(struct super_block *sb, struct au_opt *opt, -+ struct au_opt_xino **opt_xino, -+ struct au_opts *opts) -+{ -+ int err; -+ aufs_bindex_t bbot, bindex; -+ struct dentry *root, *parent, *h_root; -+ -+ err = 0; -+ switch (opt->type) { -+ case Opt_xino: -+ err = au_xino_set(sb, &opt->xino, -+ !!au_ftest_opts(opts->flags, REMOUNT)); -+ if (unlikely(err)) -+ break; -+ -+ *opt_xino = &opt->xino; -+ au_xino_brid_set(sb, -1); -+ -+ /* safe d_parent access */ -+ parent = opt->xino.file->f_path.dentry->d_parent; -+ root = sb->s_root; -+ bbot = au_sbbot(sb); -+ for (bindex = 0; bindex <= bbot; bindex++) { -+ h_root = au_h_dptr(root, bindex); -+ if (h_root == parent) { -+ au_xino_brid_set(sb, au_sbr_id(sb, bindex)); -+ break; -+ } -+ } -+ break; -+ -+ case Opt_noxino: -+ au_xino_clr(sb); -+ au_xino_brid_set(sb, -1); -+ *opt_xino = (void *)-1; -+ break; -+ } -+ -+ return err; -+} -+ -+int au_opts_verify(struct super_block *sb, unsigned long sb_flags, -+ unsigned int pending) -+{ -+ int err, fhsm; -+ aufs_bindex_t bindex, bbot; -+ unsigned char do_plink, skip, do_free, can_no_dreval; -+ struct au_branch *br; -+ struct au_wbr *wbr; -+ struct dentry *root, *dentry; -+ struct inode *dir, *h_dir; -+ struct au_sbinfo *sbinfo; -+ struct au_hinode *hdir; -+ -+ SiMustAnyLock(sb); -+ -+ sbinfo = au_sbi(sb); -+ AuDebugOn(!(sbinfo->si_mntflags & AuOptMask_UDBA)); -+ -+ if (!(sb_flags & MS_RDONLY)) { -+ if (unlikely(!au_br_writable(au_sbr_perm(sb, 0)))) -+ pr_warn("first branch should be rw\n"); -+ if (unlikely(au_opt_test(sbinfo->si_mntflags, SHWH))) -+ pr_warn_once("shwh should be used with ro\n"); -+ } -+ -+ if (au_opt_test((sbinfo->si_mntflags | pending), UDBA_HNOTIFY) -+ && !au_opt_test(sbinfo->si_mntflags, XINO)) -+ pr_warn_once("udba=*notify requires xino\n"); -+ -+ if (au_opt_test(sbinfo->si_mntflags, DIRPERM1)) -+ pr_warn_once("dirperm1 breaks the protection" -+ " by the permission bits on the lower branch\n"); -+ -+ err = 0; -+ fhsm = 0; -+ root = sb->s_root; -+ dir = d_inode(root); -+ do_plink = !!au_opt_test(sbinfo->si_mntflags, PLINK); -+ can_no_dreval = !!au_opt_test((sbinfo->si_mntflags | pending), -+ UDBA_NONE); -+ bbot = au_sbbot(sb); -+ for (bindex = 0; !err && bindex <= bbot; bindex++) { -+ skip = 0; -+ h_dir = au_h_iptr(dir, bindex); -+ br = au_sbr(sb, bindex); -+ -+ if ((br->br_perm & AuBrAttr_ICEX) -+ && !h_dir->i_op->listxattr) -+ br->br_perm &= ~AuBrAttr_ICEX; -+#if 0 -+ if ((br->br_perm & AuBrAttr_ICEX_SEC) -+ && (au_br_sb(br)->s_flags & MS_NOSEC)) -+ br->br_perm &= ~AuBrAttr_ICEX_SEC; -+#endif -+ -+ do_free = 0; -+ wbr = br->br_wbr; -+ if (wbr) -+ wbr_wh_read_lock(wbr); -+ -+ if (!au_br_writable(br->br_perm)) { -+ do_free = !!wbr; -+ skip = (!wbr -+ || (!wbr->wbr_whbase -+ && !wbr->wbr_plink -+ && !wbr->wbr_orph)); -+ } else if (!au_br_wh_linkable(br->br_perm)) { -+ /* skip = (!br->br_whbase && !br->br_orph); */ -+ skip = (!wbr || !wbr->wbr_whbase); -+ if (skip && wbr) { -+ if (do_plink) -+ skip = !!wbr->wbr_plink; -+ else -+ skip = !wbr->wbr_plink; -+ } -+ } else { -+ /* skip = (br->br_whbase && br->br_ohph); */ -+ skip = (wbr && wbr->wbr_whbase); -+ if (skip) { -+ if (do_plink) -+ skip = !!wbr->wbr_plink; -+ else -+ skip = !wbr->wbr_plink; -+ } -+ } -+ if (wbr) -+ wbr_wh_read_unlock(wbr); -+ -+ if (can_no_dreval) { -+ dentry = br->br_path.dentry; -+ spin_lock(&dentry->d_lock); -+ if (dentry->d_flags & -+ (DCACHE_OP_REVALIDATE | DCACHE_OP_WEAK_REVALIDATE)) -+ can_no_dreval = 0; -+ spin_unlock(&dentry->d_lock); -+ } -+ -+ if (au_br_fhsm(br->br_perm)) { -+ fhsm++; -+ AuDebugOn(!br->br_fhsm); -+ } -+ -+ if (skip) -+ continue; -+ -+ hdir = au_hi(dir, bindex); -+ au_hn_inode_lock_nested(hdir, AuLsc_I_PARENT); -+ if (wbr) -+ wbr_wh_write_lock(wbr); -+ err = au_wh_init(br, sb); -+ if (wbr) -+ wbr_wh_write_unlock(wbr); -+ au_hn_inode_unlock(hdir); -+ -+ if (!err && do_free) { -+ if (wbr) -+ au_delayed_kfree(wbr); -+ br->br_wbr = NULL; -+ } -+ } -+ -+ if (can_no_dreval) -+ au_fset_si(sbinfo, NO_DREVAL); -+ else -+ au_fclr_si(sbinfo, NO_DREVAL); -+ -+ if (fhsm >= 2) { -+ au_fset_si(sbinfo, FHSM); -+ for (bindex = bbot; bindex >= 0; bindex--) { -+ br = au_sbr(sb, bindex); -+ if (au_br_fhsm(br->br_perm)) { -+ au_fhsm_set_bottom(sb, bindex); -+ break; -+ } -+ } -+ } else { -+ au_fclr_si(sbinfo, FHSM); -+ au_fhsm_set_bottom(sb, -1); -+ } -+ -+ return err; -+} -+ -+int au_opts_mount(struct super_block *sb, struct au_opts *opts) -+{ -+ int err; -+ unsigned int tmp; -+ aufs_bindex_t bindex, bbot; -+ struct au_opt *opt; -+ struct au_opt_xino *opt_xino, xino; -+ struct au_sbinfo *sbinfo; -+ struct au_branch *br; -+ struct inode *dir; -+ -+ SiMustWriteLock(sb); -+ -+ err = 0; -+ opt_xino = NULL; -+ opt = opts->opt; -+ while (err >= 0 && opt->type != Opt_tail) -+ err = au_opt_simple(sb, opt++, opts); -+ if (err > 0) -+ err = 0; -+ else if (unlikely(err < 0)) -+ goto out; -+ -+ /* disable xino and udba temporary */ -+ sbinfo = au_sbi(sb); -+ tmp = sbinfo->si_mntflags; -+ au_opt_clr(sbinfo->si_mntflags, XINO); -+ au_opt_set_udba(sbinfo->si_mntflags, UDBA_REVAL); -+ -+ opt = opts->opt; -+ while (err >= 0 && opt->type != Opt_tail) -+ err = au_opt_br(sb, opt++, opts); -+ if (err > 0) -+ err = 0; -+ else if (unlikely(err < 0)) -+ goto out; -+ -+ bbot = au_sbbot(sb); -+ if (unlikely(bbot < 0)) { -+ err = -EINVAL; -+ pr_err("no branches\n"); -+ goto out; -+ } -+ -+ if (au_opt_test(tmp, XINO)) -+ au_opt_set(sbinfo->si_mntflags, XINO); -+ opt = opts->opt; -+ while (!err && opt->type != Opt_tail) -+ err = au_opt_xino(sb, opt++, &opt_xino, opts); -+ if (unlikely(err)) -+ goto out; -+ -+ err = au_opts_verify(sb, sb->s_flags, tmp); -+ if (unlikely(err)) -+ goto out; -+ -+ /* restore xino */ -+ if (au_opt_test(tmp, XINO) && !opt_xino) { -+ xino.file = au_xino_def(sb); -+ err = PTR_ERR(xino.file); -+ if (IS_ERR(xino.file)) -+ goto out; -+ -+ err = au_xino_set(sb, &xino, /*remount*/0); -+ fput(xino.file); -+ if (unlikely(err)) -+ goto out; -+ } -+ -+ /* restore udba */ -+ tmp &= AuOptMask_UDBA; -+ sbinfo->si_mntflags &= ~AuOptMask_UDBA; -+ sbinfo->si_mntflags |= tmp; -+ bbot = au_sbbot(sb); -+ for (bindex = 0; bindex <= bbot; bindex++) { -+ br = au_sbr(sb, bindex); -+ err = au_hnotify_reset_br(tmp, br, br->br_perm); -+ if (unlikely(err)) -+ AuIOErr("hnotify failed on br %d, %d, ignored\n", -+ bindex, err); -+ /* go on even if err */ -+ } -+ if (au_opt_test(tmp, UDBA_HNOTIFY)) { -+ dir = d_inode(sb->s_root); -+ au_hn_reset(dir, au_hi_flags(dir, /*isdir*/1) & ~AuHi_XINO); -+ } -+ -+out: -+ return err; -+} -+ -+int au_opts_remount(struct super_block *sb, struct au_opts *opts) -+{ -+ int err, rerr; -+ unsigned char no_dreval; -+ struct inode *dir; -+ struct au_opt_xino *opt_xino; -+ struct au_opt *opt; -+ struct au_sbinfo *sbinfo; -+ -+ SiMustWriteLock(sb); -+ -+ err = 0; -+ dir = d_inode(sb->s_root); -+ sbinfo = au_sbi(sb); -+ opt_xino = NULL; -+ opt = opts->opt; -+ while (err >= 0 && opt->type != Opt_tail) { -+ err = au_opt_simple(sb, opt, opts); -+ if (!err) -+ err = au_opt_br(sb, opt, opts); -+ if (!err) -+ err = au_opt_xino(sb, opt, &opt_xino, opts); -+ opt++; -+ } -+ if (err > 0) -+ err = 0; -+ AuTraceErr(err); -+ /* go on even err */ -+ -+ no_dreval = !!au_ftest_si(sbinfo, NO_DREVAL); -+ rerr = au_opts_verify(sb, opts->sb_flags, /*pending*/0); -+ if (unlikely(rerr && !err)) -+ err = rerr; -+ -+ if (no_dreval != !!au_ftest_si(sbinfo, NO_DREVAL)) -+ au_fset_opts(opts->flags, REFRESH_IDOP); -+ -+ if (au_ftest_opts(opts->flags, TRUNC_XIB)) { -+ rerr = au_xib_trunc(sb); -+ if (unlikely(rerr && !err)) -+ err = rerr; -+ } -+ -+ /* will be handled by the caller */ -+ if (!au_ftest_opts(opts->flags, REFRESH) -+ && (opts->given_udba -+ || au_opt_test(sbinfo->si_mntflags, XINO) -+ || au_ftest_opts(opts->flags, REFRESH_IDOP) -+ )) -+ au_fset_opts(opts->flags, REFRESH); -+ -+ AuDbg("status 0x%x\n", opts->flags); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+unsigned int au_opt_udba(struct super_block *sb) -+{ -+ return au_mntflags(sb) & AuOptMask_UDBA; -+} -diff --git a/fs/aufs/opts.h b/fs/aufs/opts.h -new file mode 100644 -index 0000000..0d6c2e1 ---- /dev/null -+++ b/fs/aufs/opts.h -@@ -0,0 +1,198 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * mount options/flags -+ */ -+ -+#ifndef __AUFS_OPTS_H__ -+#define __AUFS_OPTS_H__ -+ -+#ifdef __KERNEL__ -+ -+#include -+ -+struct file; -+struct super_block; -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* mount flags */ -+#define AuOpt_XINO 1 /* external inode number bitmap -+ and translation table */ -+#define AuOpt_TRUNC_XINO (1 << 1) /* truncate xino files */ -+#define AuOpt_UDBA_NONE (1 << 2) /* users direct branch access */ -+#define AuOpt_UDBA_REVAL (1 << 3) -+#define AuOpt_UDBA_HNOTIFY (1 << 4) -+#define AuOpt_SHWH (1 << 5) /* show whiteout */ -+#define AuOpt_PLINK (1 << 6) /* pseudo-link */ -+#define AuOpt_DIRPERM1 (1 << 7) /* ignore the lower dir's perm -+ bits */ -+#define AuOpt_ALWAYS_DIROPQ (1 << 9) /* policy to creating diropq */ -+#define AuOpt_SUM (1 << 10) /* summation for statfs(2) */ -+#define AuOpt_SUM_W (1 << 11) /* unimplemented */ -+#define AuOpt_WARN_PERM (1 << 12) /* warn when add-branch */ -+#define AuOpt_VERBOSE (1 << 13) /* busy inode when del-branch */ -+#define AuOpt_DIO (1 << 14) /* direct io */ -+ -+#ifndef CONFIG_AUFS_HNOTIFY -+#undef AuOpt_UDBA_HNOTIFY -+#define AuOpt_UDBA_HNOTIFY 0 -+#endif -+#ifndef CONFIG_AUFS_SHWH -+#undef AuOpt_SHWH -+#define AuOpt_SHWH 0 -+#endif -+ -+#define AuOpt_Def (AuOpt_XINO \ -+ | AuOpt_UDBA_REVAL \ -+ | AuOpt_PLINK \ -+ /* | AuOpt_DIRPERM1 */ \ -+ | AuOpt_WARN_PERM) -+#define AuOptMask_UDBA (AuOpt_UDBA_NONE \ -+ | AuOpt_UDBA_REVAL \ -+ | AuOpt_UDBA_HNOTIFY) -+ -+#define au_opt_test(flags, name) (flags & AuOpt_##name) -+#define au_opt_set(flags, name) do { \ -+ BUILD_BUG_ON(AuOpt_##name & AuOptMask_UDBA); \ -+ ((flags) |= AuOpt_##name); \ -+} while (0) -+#define au_opt_set_udba(flags, name) do { \ -+ (flags) &= ~AuOptMask_UDBA; \ -+ ((flags) |= AuOpt_##name); \ -+} while (0) -+#define au_opt_clr(flags, name) do { \ -+ ((flags) &= ~AuOpt_##name); \ -+} while (0) -+ -+static inline unsigned int au_opts_plink(unsigned int mntflags) -+{ -+#ifdef CONFIG_PROC_FS -+ return mntflags; -+#else -+ return mntflags & ~AuOpt_PLINK; -+#endif -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* policies to select one among multiple writable branches */ -+enum { -+ AuWbrCreate_TDP, /* top down parent */ -+ AuWbrCreate_RR, /* round robin */ -+ AuWbrCreate_MFS, /* most free space */ -+ AuWbrCreate_MFSV, /* mfs with seconds */ -+ AuWbrCreate_MFSRR, /* mfs then rr */ -+ AuWbrCreate_MFSRRV, /* mfs then rr with seconds */ -+ AuWbrCreate_PMFS, /* parent and mfs */ -+ AuWbrCreate_PMFSV, /* parent and mfs with seconds */ -+ AuWbrCreate_PMFSRR, /* parent, mfs and round-robin */ -+ AuWbrCreate_PMFSRRV, /* plus seconds */ -+ -+ AuWbrCreate_Def = AuWbrCreate_TDP -+}; -+ -+enum { -+ AuWbrCopyup_TDP, /* top down parent */ -+ AuWbrCopyup_BUP, /* bottom up parent */ -+ AuWbrCopyup_BU, /* bottom up */ -+ -+ AuWbrCopyup_Def = AuWbrCopyup_TDP -+}; -+ -+/* ---------------------------------------------------------------------- */ -+ -+struct au_opt_add { -+ aufs_bindex_t bindex; -+ char *pathname; -+ int perm; -+ struct path path; -+}; -+ -+struct au_opt_del { -+ char *pathname; -+ struct path h_path; -+}; -+ -+struct au_opt_mod { -+ char *path; -+ int perm; -+ struct dentry *h_root; -+}; -+ -+struct au_opt_xino { -+ char *path; -+ struct file *file; -+}; -+ -+struct au_opt_xino_itrunc { -+ aufs_bindex_t bindex; -+}; -+ -+struct au_opt_wbr_create { -+ int wbr_create; -+ int mfs_second; -+ unsigned long long mfsrr_watermark; -+}; -+ -+struct au_opt { -+ int type; -+ union { -+ struct au_opt_xino xino; -+ struct au_opt_xino_itrunc xino_itrunc; -+ struct au_opt_add add; -+ struct au_opt_del del; -+ struct au_opt_mod mod; -+ int dirwh; -+ int rdcache; -+ unsigned int rdblk; -+ unsigned int rdhash; -+ int udba; -+ struct au_opt_wbr_create wbr_create; -+ int wbr_copyup; -+ unsigned int fhsm_second; -+ }; -+}; -+ -+/* opts flags */ -+#define AuOpts_REMOUNT 1 -+#define AuOpts_REFRESH (1 << 1) -+#define AuOpts_TRUNC_XIB (1 << 2) -+#define AuOpts_REFRESH_DYAOP (1 << 3) -+#define AuOpts_REFRESH_IDOP (1 << 4) -+#define au_ftest_opts(flags, name) ((flags) & AuOpts_##name) -+#define au_fset_opts(flags, name) \ -+ do { (flags) |= AuOpts_##name; } while (0) -+#define au_fclr_opts(flags, name) \ -+ do { (flags) &= ~AuOpts_##name; } while (0) -+ -+struct au_opts { -+ struct au_opt *opt; -+ int max_opt; -+ -+ unsigned int given_udba; -+ unsigned int flags; -+ unsigned long sb_flags; -+}; -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* opts.c */ -+void au_optstr_br_perm(au_br_perm_str_t *str, int perm); -+const char *au_optstr_udba(int udba); -+const char *au_optstr_wbr_copyup(int wbr_copyup); -+const char *au_optstr_wbr_create(int wbr_create); -+ -+void au_opts_free(struct au_opts *opts); -+int au_opts_parse(struct super_block *sb, char *str, struct au_opts *opts); -+int au_opts_verify(struct super_block *sb, unsigned long sb_flags, -+ unsigned int pending); -+int au_opts_mount(struct super_block *sb, struct au_opts *opts); -+int au_opts_remount(struct super_block *sb, struct au_opts *opts); -+ -+unsigned int au_opt_udba(struct super_block *sb); -+ -+#endif /* __KERNEL__ */ -+#endif /* __AUFS_OPTS_H__ */ -diff --git a/fs/aufs/plink.c b/fs/aufs/plink.c -new file mode 100644 -index 0000000..d8d75e8 ---- /dev/null -+++ b/fs/aufs/plink.c -@@ -0,0 +1,501 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * pseudo-link -+ */ -+ -+#include "aufs.h" -+ -+/* -+ * the pseudo-link maintenance mode. -+ * during a user process maintains the pseudo-links, -+ * prohibit adding a new plink and branch manipulation. -+ * -+ * Flags -+ * NOPLM: -+ * For entry functions which will handle plink, and i_mutex is already held -+ * in VFS. -+ * They cannot wait and should return an error at once. -+ * Callers has to check the error. -+ * NOPLMW: -+ * For entry functions which will handle plink, but i_mutex is not held -+ * in VFS. -+ * They can wait the plink maintenance mode to finish. -+ * -+ * They behave like F_SETLK and F_SETLKW. -+ * If the caller never handle plink, then both flags are unnecessary. -+ */ -+ -+int au_plink_maint(struct super_block *sb, int flags) -+{ -+ int err; -+ pid_t pid, ppid; -+ struct task_struct *parent, *prev; -+ struct au_sbinfo *sbi; -+ -+ SiMustAnyLock(sb); -+ -+ err = 0; -+ if (!au_opt_test(au_mntflags(sb), PLINK)) -+ goto out; -+ -+ sbi = au_sbi(sb); -+ pid = sbi->si_plink_maint_pid; -+ if (!pid || pid == current->pid) -+ goto out; -+ -+ /* todo: it highly depends upon /sbin/mount.aufs */ -+ prev = NULL; -+ parent = current; -+ ppid = 0; -+ rcu_read_lock(); -+ while (1) { -+ parent = rcu_dereference(parent->real_parent); -+ if (parent == prev) -+ break; -+ ppid = task_pid_vnr(parent); -+ if (pid == ppid) { -+ rcu_read_unlock(); -+ goto out; -+ } -+ prev = parent; -+ } -+ rcu_read_unlock(); -+ -+ if (au_ftest_lock(flags, NOPLMW)) { -+ /* if there is no i_mutex lock in VFS, we don't need to wait */ -+ /* AuDebugOn(!lockdep_depth(current)); */ -+ while (sbi->si_plink_maint_pid) { -+ si_read_unlock(sb); -+ /* gave up wake_up_bit() */ -+ wait_event(sbi->si_plink_wq, !sbi->si_plink_maint_pid); -+ -+ if (au_ftest_lock(flags, FLUSH)) -+ au_nwt_flush(&sbi->si_nowait); -+ si_noflush_read_lock(sb); -+ } -+ } else if (au_ftest_lock(flags, NOPLM)) { -+ AuDbg("ppid %d, pid %d\n", ppid, pid); -+ err = -EAGAIN; -+ } -+ -+out: -+ return err; -+} -+ -+void au_plink_maint_leave(struct au_sbinfo *sbinfo) -+{ -+ spin_lock(&sbinfo->si_plink_maint_lock); -+ sbinfo->si_plink_maint_pid = 0; -+ spin_unlock(&sbinfo->si_plink_maint_lock); -+ wake_up_all(&sbinfo->si_plink_wq); -+} -+ -+int au_plink_maint_enter(struct super_block *sb) -+{ -+ int err; -+ struct au_sbinfo *sbinfo; -+ -+ err = 0; -+ sbinfo = au_sbi(sb); -+ /* make sure i am the only one in this fs */ -+ si_write_lock(sb, AuLock_FLUSH); -+ if (au_opt_test(au_mntflags(sb), PLINK)) { -+ spin_lock(&sbinfo->si_plink_maint_lock); -+ if (!sbinfo->si_plink_maint_pid) -+ sbinfo->si_plink_maint_pid = current->pid; -+ else -+ err = -EBUSY; -+ spin_unlock(&sbinfo->si_plink_maint_lock); -+ } -+ si_write_unlock(sb); -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+#ifdef CONFIG_AUFS_DEBUG -+void au_plink_list(struct super_block *sb) -+{ -+ int i; -+ struct au_sbinfo *sbinfo; -+ struct hlist_head *plink_hlist; -+ struct au_icntnr *icntnr; -+ -+ SiMustAnyLock(sb); -+ -+ sbinfo = au_sbi(sb); -+ AuDebugOn(!au_opt_test(au_mntflags(sb), PLINK)); -+ AuDebugOn(au_plink_maint(sb, AuLock_NOPLM)); -+ -+ for (i = 0; i < AuPlink_NHASH; i++) { -+ plink_hlist = &sbinfo->si_plink[i].head; -+ rcu_read_lock(); -+ hlist_for_each_entry_rcu(icntnr, plink_hlist, plink) -+ AuDbg("%lu\n", icntnr->vfs_inode.i_ino); -+ rcu_read_unlock(); -+ } -+} -+#endif -+ -+/* is the inode pseudo-linked? */ -+int au_plink_test(struct inode *inode) -+{ -+ int found, i; -+ struct au_sbinfo *sbinfo; -+ struct hlist_head *plink_hlist; -+ struct au_icntnr *icntnr; -+ -+ sbinfo = au_sbi(inode->i_sb); -+ AuRwMustAnyLock(&sbinfo->si_rwsem); -+ AuDebugOn(!au_opt_test(au_mntflags(inode->i_sb), PLINK)); -+ AuDebugOn(au_plink_maint(inode->i_sb, AuLock_NOPLM)); -+ -+ found = 0; -+ i = au_plink_hash(inode->i_ino); -+ plink_hlist = &sbinfo->si_plink[i].head; -+ rcu_read_lock(); -+ hlist_for_each_entry_rcu(icntnr, plink_hlist, plink) -+ if (&icntnr->vfs_inode == inode) { -+ found = 1; -+ break; -+ } -+ rcu_read_unlock(); -+ return found; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * generate a name for plink. -+ * the file will be stored under AUFS_WH_PLINKDIR. -+ */ -+/* 20 is max digits length of ulong 64 */ -+#define PLINK_NAME_LEN ((20 + 1) * 2) -+ -+static int plink_name(char *name, int len, struct inode *inode, -+ aufs_bindex_t bindex) -+{ -+ int rlen; -+ struct inode *h_inode; -+ -+ h_inode = au_h_iptr(inode, bindex); -+ rlen = snprintf(name, len, "%lu.%lu", inode->i_ino, h_inode->i_ino); -+ return rlen; -+} -+ -+struct au_do_plink_lkup_args { -+ struct dentry **errp; -+ struct qstr *tgtname; -+ struct dentry *h_parent; -+ struct au_branch *br; -+}; -+ -+static struct dentry *au_do_plink_lkup(struct qstr *tgtname, -+ struct dentry *h_parent, -+ struct au_branch *br) -+{ -+ struct dentry *h_dentry; -+ struct inode *h_inode; -+ -+ h_inode = d_inode(h_parent); -+ inode_lock_nested(h_inode, AuLsc_I_CHILD2); -+ h_dentry = vfsub_lkup_one(tgtname, h_parent); -+ inode_unlock(h_inode); -+ return h_dentry; -+} -+ -+static void au_call_do_plink_lkup(void *args) -+{ -+ struct au_do_plink_lkup_args *a = args; -+ *a->errp = au_do_plink_lkup(a->tgtname, a->h_parent, a->br); -+} -+ -+/* lookup the plink-ed @inode under the branch at @bindex */ -+struct dentry *au_plink_lkup(struct inode *inode, aufs_bindex_t bindex) -+{ -+ struct dentry *h_dentry, *h_parent; -+ struct au_branch *br; -+ int wkq_err; -+ char a[PLINK_NAME_LEN]; -+ struct qstr tgtname = QSTR_INIT(a, 0); -+ -+ AuDebugOn(au_plink_maint(inode->i_sb, AuLock_NOPLM)); -+ -+ br = au_sbr(inode->i_sb, bindex); -+ h_parent = br->br_wbr->wbr_plink; -+ tgtname.len = plink_name(a, sizeof(a), inode, bindex); -+ -+ if (!uid_eq(current_fsuid(), GLOBAL_ROOT_UID)) { -+ struct au_do_plink_lkup_args args = { -+ .errp = &h_dentry, -+ .tgtname = &tgtname, -+ .h_parent = h_parent, -+ .br = br -+ }; -+ -+ wkq_err = au_wkq_wait(au_call_do_plink_lkup, &args); -+ if (unlikely(wkq_err)) -+ h_dentry = ERR_PTR(wkq_err); -+ } else -+ h_dentry = au_do_plink_lkup(&tgtname, h_parent, br); -+ -+ return h_dentry; -+} -+ -+/* create a pseudo-link */ -+static int do_whplink(struct qstr *tgt, struct dentry *h_parent, -+ struct dentry *h_dentry, struct au_branch *br) -+{ -+ int err; -+ struct path h_path = { -+ .mnt = au_br_mnt(br) -+ }; -+ struct inode *h_dir, *delegated; -+ -+ h_dir = d_inode(h_parent); -+ inode_lock_nested(h_dir, AuLsc_I_CHILD2); -+again: -+ h_path.dentry = vfsub_lkup_one(tgt, h_parent); -+ err = PTR_ERR(h_path.dentry); -+ if (IS_ERR(h_path.dentry)) -+ goto out; -+ -+ err = 0; -+ /* wh.plink dir is not monitored */ -+ /* todo: is it really safe? */ -+ if (d_is_positive(h_path.dentry) -+ && d_inode(h_path.dentry) != d_inode(h_dentry)) { -+ delegated = NULL; -+ err = vfsub_unlink(h_dir, &h_path, &delegated, /*force*/0); -+ if (unlikely(err == -EWOULDBLOCK)) { -+ pr_warn("cannot retry for NFSv4 delegation" -+ " for an internal unlink\n"); -+ iput(delegated); -+ } -+ dput(h_path.dentry); -+ h_path.dentry = NULL; -+ if (!err) -+ goto again; -+ } -+ if (!err && d_is_negative(h_path.dentry)) { -+ delegated = NULL; -+ err = vfsub_link(h_dentry, h_dir, &h_path, &delegated); -+ if (unlikely(err == -EWOULDBLOCK)) { -+ pr_warn("cannot retry for NFSv4 delegation" -+ " for an internal link\n"); -+ iput(delegated); -+ } -+ } -+ dput(h_path.dentry); -+ -+out: -+ inode_unlock(h_dir); -+ return err; -+} -+ -+struct do_whplink_args { -+ int *errp; -+ struct qstr *tgt; -+ struct dentry *h_parent; -+ struct dentry *h_dentry; -+ struct au_branch *br; -+}; -+ -+static void call_do_whplink(void *args) -+{ -+ struct do_whplink_args *a = args; -+ *a->errp = do_whplink(a->tgt, a->h_parent, a->h_dentry, a->br); -+} -+ -+static int whplink(struct dentry *h_dentry, struct inode *inode, -+ aufs_bindex_t bindex, struct au_branch *br) -+{ -+ int err, wkq_err; -+ struct au_wbr *wbr; -+ struct dentry *h_parent; -+ char a[PLINK_NAME_LEN]; -+ struct qstr tgtname = QSTR_INIT(a, 0); -+ -+ wbr = au_sbr(inode->i_sb, bindex)->br_wbr; -+ h_parent = wbr->wbr_plink; -+ tgtname.len = plink_name(a, sizeof(a), inode, bindex); -+ -+ /* always superio. */ -+ if (!uid_eq(current_fsuid(), GLOBAL_ROOT_UID)) { -+ struct do_whplink_args args = { -+ .errp = &err, -+ .tgt = &tgtname, -+ .h_parent = h_parent, -+ .h_dentry = h_dentry, -+ .br = br -+ }; -+ wkq_err = au_wkq_wait(call_do_whplink, &args); -+ if (unlikely(wkq_err)) -+ err = wkq_err; -+ } else -+ err = do_whplink(&tgtname, h_parent, h_dentry, br); -+ -+ return err; -+} -+ -+/* -+ * create a new pseudo-link for @h_dentry on @bindex. -+ * the linked inode is held in aufs @inode. -+ */ -+void au_plink_append(struct inode *inode, aufs_bindex_t bindex, -+ struct dentry *h_dentry) -+{ -+ struct super_block *sb; -+ struct au_sbinfo *sbinfo; -+ struct hlist_head *plink_hlist; -+ struct au_icntnr *icntnr; -+ struct au_sphlhead *sphl; -+ int found, err, cnt, i; -+ -+ sb = inode->i_sb; -+ sbinfo = au_sbi(sb); -+ AuDebugOn(!au_opt_test(au_mntflags(sb), PLINK)); -+ AuDebugOn(au_plink_maint(sb, AuLock_NOPLM)); -+ -+ found = au_plink_test(inode); -+ if (found) -+ return; -+ -+ i = au_plink_hash(inode->i_ino); -+ sphl = sbinfo->si_plink + i; -+ plink_hlist = &sphl->head; -+ au_igrab(inode); -+ -+ spin_lock(&sphl->spin); -+ hlist_for_each_entry(icntnr, plink_hlist, plink) { -+ if (&icntnr->vfs_inode == inode) { -+ found = 1; -+ break; -+ } -+ } -+ if (!found) { -+ icntnr = container_of(inode, struct au_icntnr, vfs_inode); -+ hlist_add_head_rcu(&icntnr->plink, plink_hlist); -+ } -+ spin_unlock(&sphl->spin); -+ if (!found) { -+ cnt = au_sphl_count(sphl); -+#define msg "unexpectedly unblanced or too many pseudo-links" -+ if (cnt > AUFS_PLINK_WARN) -+ AuWarn1(msg ", %d\n", cnt); -+#undef msg -+ err = whplink(h_dentry, inode, bindex, au_sbr(sb, bindex)); -+ if (unlikely(err)) { -+ pr_warn("err %d, damaged pseudo link.\n", err); -+ au_sphl_del_rcu(&icntnr->plink, sphl); -+ iput(&icntnr->vfs_inode); -+ } -+ } else -+ iput(&icntnr->vfs_inode); -+} -+ -+/* free all plinks */ -+void au_plink_put(struct super_block *sb, int verbose) -+{ -+ int i, warned; -+ struct au_sbinfo *sbinfo; -+ struct hlist_head *plink_hlist; -+ struct hlist_node *tmp; -+ struct au_icntnr *icntnr; -+ -+ SiMustWriteLock(sb); -+ -+ sbinfo = au_sbi(sb); -+ AuDebugOn(!au_opt_test(au_mntflags(sb), PLINK)); -+ AuDebugOn(au_plink_maint(sb, AuLock_NOPLM)); -+ -+ /* no spin_lock since sbinfo is write-locked */ -+ warned = 0; -+ for (i = 0; i < AuPlink_NHASH; i++) { -+ plink_hlist = &sbinfo->si_plink[i].head; -+ if (!warned && verbose && !hlist_empty(plink_hlist)) { -+ pr_warn("pseudo-link is not flushed"); -+ warned = 1; -+ } -+ hlist_for_each_entry_safe(icntnr, tmp, plink_hlist, plink) -+ iput(&icntnr->vfs_inode); -+ INIT_HLIST_HEAD(plink_hlist); -+ } -+} -+ -+void au_plink_clean(struct super_block *sb, int verbose) -+{ -+ struct dentry *root; -+ -+ root = sb->s_root; -+ aufs_write_lock(root); -+ if (au_opt_test(au_mntflags(sb), PLINK)) -+ au_plink_put(sb, verbose); -+ aufs_write_unlock(root); -+} -+ -+static int au_plink_do_half_refresh(struct inode *inode, aufs_bindex_t br_id) -+{ -+ int do_put; -+ aufs_bindex_t btop, bbot, bindex; -+ -+ do_put = 0; -+ btop = au_ibtop(inode); -+ bbot = au_ibbot(inode); -+ if (btop >= 0) { -+ for (bindex = btop; bindex <= bbot; bindex++) { -+ if (!au_h_iptr(inode, bindex) -+ || au_ii_br_id(inode, bindex) != br_id) -+ continue; -+ au_set_h_iptr(inode, bindex, NULL, 0); -+ do_put = 1; -+ break; -+ } -+ if (do_put) -+ for (bindex = btop; bindex <= bbot; bindex++) -+ if (au_h_iptr(inode, bindex)) { -+ do_put = 0; -+ break; -+ } -+ } else -+ do_put = 1; -+ -+ return do_put; -+} -+ -+/* free the plinks on a branch specified by @br_id */ -+void au_plink_half_refresh(struct super_block *sb, aufs_bindex_t br_id) -+{ -+ struct au_sbinfo *sbinfo; -+ struct hlist_head *plink_hlist; -+ struct hlist_node *tmp; -+ struct au_icntnr *icntnr; -+ struct inode *inode; -+ int i, do_put; -+ -+ SiMustWriteLock(sb); -+ -+ sbinfo = au_sbi(sb); -+ AuDebugOn(!au_opt_test(au_mntflags(sb), PLINK)); -+ AuDebugOn(au_plink_maint(sb, AuLock_NOPLM)); -+ -+ /* no spin_lock since sbinfo is write-locked */ -+ for (i = 0; i < AuPlink_NHASH; i++) { -+ plink_hlist = &sbinfo->si_plink[i].head; -+ hlist_for_each_entry_safe(icntnr, tmp, plink_hlist, plink) { -+ inode = au_igrab(&icntnr->vfs_inode); -+ ii_write_lock_child(inode); -+ do_put = au_plink_do_half_refresh(inode, br_id); -+ if (do_put) { -+ hlist_del(&icntnr->plink); -+ iput(inode); -+ } -+ ii_write_unlock(inode); -+ iput(inode); -+ } -+ } -+} -diff --git a/fs/aufs/poll.c b/fs/aufs/poll.c -new file mode 100644 -index 0000000..dd2baf5 ---- /dev/null -+++ b/fs/aufs/poll.c -@@ -0,0 +1,39 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * poll operation -+ * There is only one filesystem which implements ->poll operation, currently. -+ */ -+ -+#include "aufs.h" -+ -+unsigned int aufs_poll(struct file *file, poll_table *wait) -+{ -+ unsigned int mask; -+ int err; -+ struct file *h_file; -+ struct super_block *sb; -+ -+ /* We should pretend an error happened. */ -+ mask = POLLERR /* | POLLIN | POLLOUT */; -+ sb = file->f_path.dentry->d_sb; -+ si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLMW); -+ -+ h_file = au_read_pre(file, /*keep_fi*/0); -+ err = PTR_ERR(h_file); -+ if (IS_ERR(h_file)) -+ goto out; -+ -+ /* it is not an error if h_file has no operation */ -+ mask = DEFAULT_POLLMASK; -+ if (h_file->f_op->poll) -+ mask = h_file->f_op->poll(h_file, wait); -+ fput(h_file); /* instead of au_read_post() */ -+ -+out: -+ si_read_unlock(sb); -+ AuTraceErr((int)mask); -+ return mask; -+} -diff --git a/fs/aufs/posix_acl.c b/fs/aufs/posix_acl.c -new file mode 100644 -index 0000000..1ee17ee ---- /dev/null -+++ b/fs/aufs/posix_acl.c -@@ -0,0 +1,85 @@ -+/* -+ * Copyright (C) 2014-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * posix acl operations -+ */ -+ -+#include -+#include "aufs.h" -+ -+struct posix_acl *aufs_get_acl(struct inode *inode, int type) -+{ -+ struct posix_acl *acl; -+ int err; -+ aufs_bindex_t bindex; -+ struct inode *h_inode; -+ struct super_block *sb; -+ -+ acl = NULL; -+ sb = inode->i_sb; -+ si_read_lock(sb, AuLock_FLUSH); -+ ii_read_lock_child(inode); -+ if (!(sb->s_flags & MS_POSIXACL)) -+ goto out; -+ -+ bindex = au_ibtop(inode); -+ h_inode = au_h_iptr(inode, bindex); -+ if (unlikely(!h_inode -+ || ((h_inode->i_mode & S_IFMT) -+ != (inode->i_mode & S_IFMT)))) { -+ err = au_busy_or_stale(); -+ acl = ERR_PTR(err); -+ goto out; -+ } -+ -+ /* always topmost only */ -+ acl = get_acl(h_inode, type); -+ -+out: -+ ii_read_unlock(inode); -+ si_read_unlock(sb); -+ -+ AuTraceErrPtr(acl); -+ return acl; -+} -+ -+int aufs_set_acl(struct inode *inode, struct posix_acl *acl, int type) -+{ -+ int err; -+ ssize_t ssz; -+ struct dentry *dentry; -+ struct au_srxattr arg = { -+ .type = AU_ACL_SET, -+ .u.acl_set = { -+ .acl = acl, -+ .type = type -+ }, -+ }; -+ -+ IMustLock(inode); -+ -+ if (inode->i_ino == AUFS_ROOT_INO) -+ dentry = dget(inode->i_sb->s_root); -+ else { -+ dentry = d_find_alias(inode); -+ if (!dentry) -+ dentry = d_find_any_alias(inode); -+ if (!dentry) { -+ pr_warn("cannot handle this inode, " -+ "please report to aufs-users ML\n"); -+ err = -ENOENT; -+ goto out; -+ } -+ } -+ -+ ssz = au_srxattr(dentry, inode, &arg); -+ dput(dentry); -+ err = ssz; -+ if (ssz >= 0) -+ err = 0; -+ -+out: -+ return err; -+} -diff --git a/fs/aufs/procfs.c b/fs/aufs/procfs.c -new file mode 100644 -index 0000000..e5a4e37 ---- /dev/null -+++ b/fs/aufs/procfs.c -@@ -0,0 +1,156 @@ -+/* -+ * Copyright (C) 2010-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * procfs interfaces -+ */ -+ -+#include -+#include "aufs.h" -+ -+static int au_procfs_plm_release(struct inode *inode, struct file *file) -+{ -+ struct au_sbinfo *sbinfo; -+ -+ sbinfo = file->private_data; -+ if (sbinfo) { -+ au_plink_maint_leave(sbinfo); -+ kobject_put(&sbinfo->si_kobj); -+ } -+ -+ return 0; -+} -+ -+static void au_procfs_plm_write_clean(struct file *file) -+{ -+ struct au_sbinfo *sbinfo; -+ -+ sbinfo = file->private_data; -+ if (sbinfo) -+ au_plink_clean(sbinfo->si_sb, /*verbose*/0); -+} -+ -+static int au_procfs_plm_write_si(struct file *file, unsigned long id) -+{ -+ int err; -+ struct super_block *sb; -+ struct au_sbinfo *sbinfo; -+ -+ err = -EBUSY; -+ if (unlikely(file->private_data)) -+ goto out; -+ -+ sb = NULL; -+ /* don't use au_sbilist_lock() here */ -+ spin_lock(&au_sbilist.spin); -+ hlist_for_each_entry(sbinfo, &au_sbilist.head, si_list) -+ if (id == sysaufs_si_id(sbinfo)) { -+ kobject_get(&sbinfo->si_kobj); -+ sb = sbinfo->si_sb; -+ break; -+ } -+ spin_unlock(&au_sbilist.spin); -+ -+ err = -EINVAL; -+ if (unlikely(!sb)) -+ goto out; -+ -+ err = au_plink_maint_enter(sb); -+ if (!err) -+ /* keep kobject_get() */ -+ file->private_data = sbinfo; -+ else -+ kobject_put(&sbinfo->si_kobj); -+out: -+ return err; -+} -+ -+/* -+ * Accept a valid "si=xxxx" only. -+ * Once it is accepted successfully, accept "clean" too. -+ */ -+static ssize_t au_procfs_plm_write(struct file *file, const char __user *ubuf, -+ size_t count, loff_t *ppos) -+{ -+ ssize_t err; -+ unsigned long id; -+ /* last newline is allowed */ -+ char buf[3 + sizeof(unsigned long) * 2 + 1]; -+ -+ err = -EACCES; -+ if (unlikely(!capable(CAP_SYS_ADMIN))) -+ goto out; -+ -+ err = -EINVAL; -+ if (unlikely(count > sizeof(buf))) -+ goto out; -+ -+ err = copy_from_user(buf, ubuf, count); -+ if (unlikely(err)) { -+ err = -EFAULT; -+ goto out; -+ } -+ buf[count] = 0; -+ -+ err = -EINVAL; -+ if (!strcmp("clean", buf)) { -+ au_procfs_plm_write_clean(file); -+ goto out_success; -+ } else if (unlikely(strncmp("si=", buf, 3))) -+ goto out; -+ -+ err = kstrtoul(buf + 3, 16, &id); -+ if (unlikely(err)) -+ goto out; -+ -+ err = au_procfs_plm_write_si(file, id); -+ if (unlikely(err)) -+ goto out; -+ -+out_success: -+ err = count; /* success */ -+out: -+ return err; -+} -+ -+static const struct file_operations au_procfs_plm_fop = { -+ .write = au_procfs_plm_write, -+ .release = au_procfs_plm_release, -+ .owner = THIS_MODULE -+}; -+ -+/* ---------------------------------------------------------------------- */ -+ -+static struct proc_dir_entry *au_procfs_dir; -+ -+void au_procfs_fin(void) -+{ -+ remove_proc_entry(AUFS_PLINK_MAINT_NAME, au_procfs_dir); -+ remove_proc_entry(AUFS_PLINK_MAINT_DIR, NULL); -+} -+ -+int __init au_procfs_init(void) -+{ -+ int err; -+ struct proc_dir_entry *entry; -+ -+ err = -ENOMEM; -+ au_procfs_dir = proc_mkdir(AUFS_PLINK_MAINT_DIR, NULL); -+ if (unlikely(!au_procfs_dir)) -+ goto out; -+ -+ entry = proc_create(AUFS_PLINK_MAINT_NAME, S_IFREG | S_IWUSR, -+ au_procfs_dir, &au_procfs_plm_fop); -+ if (unlikely(!entry)) -+ goto out_dir; -+ -+ err = 0; -+ goto out; /* success */ -+ -+ -+out_dir: -+ remove_proc_entry(AUFS_PLINK_MAINT_DIR, NULL); -+out: -+ return err; -+} -diff --git a/fs/aufs/rdu.c b/fs/aufs/rdu.c -new file mode 100644 -index 0000000..54abc14 ---- /dev/null -+++ b/fs/aufs/rdu.c -@@ -0,0 +1,368 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * readdir in userspace. -+ */ -+ -+#include -+#include -+#include -+#include "aufs.h" -+ -+/* bits for struct aufs_rdu.flags */ -+#define AuRdu_CALLED 1 -+#define AuRdu_CONT (1 << 1) -+#define AuRdu_FULL (1 << 2) -+#define au_ftest_rdu(flags, name) ((flags) & AuRdu_##name) -+#define au_fset_rdu(flags, name) \ -+ do { (flags) |= AuRdu_##name; } while (0) -+#define au_fclr_rdu(flags, name) \ -+ do { (flags) &= ~AuRdu_##name; } while (0) -+ -+struct au_rdu_arg { -+ struct dir_context ctx; -+ struct aufs_rdu *rdu; -+ union au_rdu_ent_ul ent; -+ unsigned long end; -+ -+ struct super_block *sb; -+ int err; -+}; -+ -+static int au_rdu_fill(struct dir_context *ctx, const char *name, int nlen, -+ loff_t offset, u64 h_ino, unsigned int d_type) -+{ -+ int err, len; -+ struct au_rdu_arg *arg = container_of(ctx, struct au_rdu_arg, ctx); -+ struct aufs_rdu *rdu = arg->rdu; -+ struct au_rdu_ent ent; -+ -+ err = 0; -+ arg->err = 0; -+ au_fset_rdu(rdu->cookie.flags, CALLED); -+ len = au_rdu_len(nlen); -+ if (arg->ent.ul + len < arg->end) { -+ ent.ino = h_ino; -+ ent.bindex = rdu->cookie.bindex; -+ ent.type = d_type; -+ ent.nlen = nlen; -+ if (unlikely(nlen > AUFS_MAX_NAMELEN)) -+ ent.type = DT_UNKNOWN; -+ -+ /* unnecessary to support mmap_sem since this is a dir */ -+ err = -EFAULT; -+ if (copy_to_user(arg->ent.e, &ent, sizeof(ent))) -+ goto out; -+ if (copy_to_user(arg->ent.e->name, name, nlen)) -+ goto out; -+ /* the terminating NULL */ -+ if (__put_user(0, arg->ent.e->name + nlen)) -+ goto out; -+ err = 0; -+ /* AuDbg("%p, %.*s\n", arg->ent.p, nlen, name); */ -+ arg->ent.ul += len; -+ rdu->rent++; -+ } else { -+ err = -EFAULT; -+ au_fset_rdu(rdu->cookie.flags, FULL); -+ rdu->full = 1; -+ rdu->tail = arg->ent; -+ } -+ -+out: -+ /* AuTraceErr(err); */ -+ return err; -+} -+ -+static int au_rdu_do(struct file *h_file, struct au_rdu_arg *arg) -+{ -+ int err; -+ loff_t offset; -+ struct au_rdu_cookie *cookie = &arg->rdu->cookie; -+ -+ /* we don't have to care (FMODE_32BITHASH | FMODE_64BITHASH) for ext4 */ -+ offset = vfsub_llseek(h_file, cookie->h_pos, SEEK_SET); -+ err = offset; -+ if (unlikely(offset != cookie->h_pos)) -+ goto out; -+ -+ err = 0; -+ do { -+ arg->err = 0; -+ au_fclr_rdu(cookie->flags, CALLED); -+ /* smp_mb(); */ -+ err = vfsub_iterate_dir(h_file, &arg->ctx); -+ if (err >= 0) -+ err = arg->err; -+ } while (!err -+ && au_ftest_rdu(cookie->flags, CALLED) -+ && !au_ftest_rdu(cookie->flags, FULL)); -+ cookie->h_pos = h_file->f_pos; -+ -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+static int au_rdu(struct file *file, struct aufs_rdu *rdu) -+{ -+ int err; -+ aufs_bindex_t bbot; -+ struct au_rdu_arg arg = { -+ .ctx = { -+ .actor = au_rdu_fill -+ } -+ }; -+ struct dentry *dentry; -+ struct inode *inode; -+ struct file *h_file; -+ struct au_rdu_cookie *cookie = &rdu->cookie; -+ -+ err = !access_ok(VERIFY_WRITE, rdu->ent.e, rdu->sz); -+ if (unlikely(err)) { -+ err = -EFAULT; -+ AuTraceErr(err); -+ goto out; -+ } -+ rdu->rent = 0; -+ rdu->tail = rdu->ent; -+ rdu->full = 0; -+ arg.rdu = rdu; -+ arg.ent = rdu->ent; -+ arg.end = arg.ent.ul; -+ arg.end += rdu->sz; -+ -+ err = -ENOTDIR; -+ if (unlikely(!file->f_op->iterate && !file->f_op->iterate_shared)) -+ goto out; -+ -+ err = security_file_permission(file, MAY_READ); -+ AuTraceErr(err); -+ if (unlikely(err)) -+ goto out; -+ -+ dentry = file->f_path.dentry; -+ inode = d_inode(dentry); -+ inode_lock_shared(inode); -+ -+ arg.sb = inode->i_sb; -+ err = si_read_lock(arg.sb, AuLock_FLUSH | AuLock_NOPLM); -+ if (unlikely(err)) -+ goto out_mtx; -+ err = au_alive_dir(dentry); -+ if (unlikely(err)) -+ goto out_si; -+ /* todo: reval? */ -+ fi_read_lock(file); -+ -+ err = -EAGAIN; -+ if (unlikely(au_ftest_rdu(cookie->flags, CONT) -+ && cookie->generation != au_figen(file))) -+ goto out_unlock; -+ -+ err = 0; -+ if (!rdu->blk) { -+ rdu->blk = au_sbi(arg.sb)->si_rdblk; -+ if (!rdu->blk) -+ rdu->blk = au_dir_size(file, /*dentry*/NULL); -+ } -+ bbot = au_fbtop(file); -+ if (cookie->bindex < bbot) -+ cookie->bindex = bbot; -+ bbot = au_fbbot_dir(file); -+ /* AuDbg("b%d, b%d\n", cookie->bindex, bbot); */ -+ for (; !err && cookie->bindex <= bbot; -+ cookie->bindex++, cookie->h_pos = 0) { -+ h_file = au_hf_dir(file, cookie->bindex); -+ if (!h_file) -+ continue; -+ -+ au_fclr_rdu(cookie->flags, FULL); -+ err = au_rdu_do(h_file, &arg); -+ AuTraceErr(err); -+ if (unlikely(au_ftest_rdu(cookie->flags, FULL) || err)) -+ break; -+ } -+ AuDbg("rent %llu\n", rdu->rent); -+ -+ if (!err && !au_ftest_rdu(cookie->flags, CONT)) { -+ rdu->shwh = !!au_opt_test(au_sbi(arg.sb)->si_mntflags, SHWH); -+ au_fset_rdu(cookie->flags, CONT); -+ cookie->generation = au_figen(file); -+ } -+ -+ ii_read_lock_child(inode); -+ fsstack_copy_attr_atime(inode, au_h_iptr(inode, au_ibtop(inode))); -+ ii_read_unlock(inode); -+ -+out_unlock: -+ fi_read_unlock(file); -+out_si: -+ si_read_unlock(arg.sb); -+out_mtx: -+ inode_unlock_shared(inode); -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+static int au_rdu_ino(struct file *file, struct aufs_rdu *rdu) -+{ -+ int err; -+ ino_t ino; -+ unsigned long long nent; -+ union au_rdu_ent_ul *u; -+ struct au_rdu_ent ent; -+ struct super_block *sb; -+ -+ err = 0; -+ nent = rdu->nent; -+ u = &rdu->ent; -+ sb = file->f_path.dentry->d_sb; -+ si_read_lock(sb, AuLock_FLUSH); -+ while (nent-- > 0) { -+ /* unnecessary to support mmap_sem since this is a dir */ -+ err = copy_from_user(&ent, u->e, sizeof(ent)); -+ if (!err) -+ err = !access_ok(VERIFY_WRITE, &u->e->ino, sizeof(ino)); -+ if (unlikely(err)) { -+ err = -EFAULT; -+ AuTraceErr(err); -+ break; -+ } -+ -+ /* AuDbg("b%d, i%llu\n", ent.bindex, ent.ino); */ -+ if (!ent.wh) -+ err = au_ino(sb, ent.bindex, ent.ino, ent.type, &ino); -+ else -+ err = au_wh_ino(sb, ent.bindex, ent.ino, ent.type, -+ &ino); -+ if (unlikely(err)) { -+ AuTraceErr(err); -+ break; -+ } -+ -+ err = __put_user(ino, &u->e->ino); -+ if (unlikely(err)) { -+ err = -EFAULT; -+ AuTraceErr(err); -+ break; -+ } -+ u->ul += au_rdu_len(ent.nlen); -+ } -+ si_read_unlock(sb); -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int au_rdu_verify(struct aufs_rdu *rdu) -+{ -+ AuDbg("rdu{%llu, %p, %u | %u | %llu, %u, %u | " -+ "%llu, b%d, 0x%x, g%u}\n", -+ rdu->sz, rdu->ent.e, rdu->verify[AufsCtlRduV_SZ], -+ rdu->blk, -+ rdu->rent, rdu->shwh, rdu->full, -+ rdu->cookie.h_pos, rdu->cookie.bindex, rdu->cookie.flags, -+ rdu->cookie.generation); -+ -+ if (rdu->verify[AufsCtlRduV_SZ] == sizeof(*rdu)) -+ return 0; -+ -+ AuDbg("%u:%u\n", -+ rdu->verify[AufsCtlRduV_SZ], (unsigned int)sizeof(*rdu)); -+ return -EINVAL; -+} -+ -+long au_rdu_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -+{ -+ long err, e; -+ struct aufs_rdu rdu; -+ void __user *p = (void __user *)arg; -+ -+ err = copy_from_user(&rdu, p, sizeof(rdu)); -+ if (unlikely(err)) { -+ err = -EFAULT; -+ AuTraceErr(err); -+ goto out; -+ } -+ err = au_rdu_verify(&rdu); -+ if (unlikely(err)) -+ goto out; -+ -+ switch (cmd) { -+ case AUFS_CTL_RDU: -+ err = au_rdu(file, &rdu); -+ if (unlikely(err)) -+ break; -+ -+ e = copy_to_user(p, &rdu, sizeof(rdu)); -+ if (unlikely(e)) { -+ err = -EFAULT; -+ AuTraceErr(err); -+ } -+ break; -+ case AUFS_CTL_RDU_INO: -+ err = au_rdu_ino(file, &rdu); -+ break; -+ -+ default: -+ /* err = -ENOTTY; */ -+ err = -EINVAL; -+ } -+ -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+#ifdef CONFIG_COMPAT -+long au_rdu_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -+{ -+ long err, e; -+ struct aufs_rdu rdu; -+ void __user *p = compat_ptr(arg); -+ -+ /* todo: get_user()? */ -+ err = copy_from_user(&rdu, p, sizeof(rdu)); -+ if (unlikely(err)) { -+ err = -EFAULT; -+ AuTraceErr(err); -+ goto out; -+ } -+ rdu.ent.e = compat_ptr(rdu.ent.ul); -+ err = au_rdu_verify(&rdu); -+ if (unlikely(err)) -+ goto out; -+ -+ switch (cmd) { -+ case AUFS_CTL_RDU: -+ err = au_rdu(file, &rdu); -+ if (unlikely(err)) -+ break; -+ -+ rdu.ent.ul = ptr_to_compat(rdu.ent.e); -+ rdu.tail.ul = ptr_to_compat(rdu.tail.e); -+ e = copy_to_user(p, &rdu, sizeof(rdu)); -+ if (unlikely(e)) { -+ err = -EFAULT; -+ AuTraceErr(err); -+ } -+ break; -+ case AUFS_CTL_RDU_INO: -+ err = au_rdu_ino(file, &rdu); -+ break; -+ -+ default: -+ /* err = -ENOTTY; */ -+ err = -EINVAL; -+ } -+ -+out: -+ AuTraceErr(err); -+ return err; -+} -+#endif -diff --git a/fs/aufs/rwsem.h b/fs/aufs/rwsem.h -new file mode 100644 -index 0000000..6c0d5a9 ---- /dev/null -+++ b/fs/aufs/rwsem.h -@@ -0,0 +1,185 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * simple read-write semaphore wrappers -+ */ -+ -+#ifndef __AUFS_RWSEM_H__ -+#define __AUFS_RWSEM_H__ -+ -+#ifdef __KERNEL__ -+ -+#include "debug.h" -+ -+struct au_rwsem { -+ struct rw_semaphore rwsem; -+#ifdef CONFIG_AUFS_DEBUG -+ /* just for debugging, not almighty counter */ -+ atomic_t rcnt, wcnt; -+#endif -+}; -+ -+#ifdef CONFIG_LOCKDEP -+#define au_lockdep_set_name(rw) \ -+ lockdep_set_class_and_name(&(rw)->rwsem, \ -+ /*original key*/(rw)->rwsem.dep_map.key, \ -+ /*name*/#rw) -+#else -+#define au_lockdep_set_name(rw) do {} while (0) -+#endif -+ -+#ifdef CONFIG_AUFS_DEBUG -+#define AuDbgCntInit(rw) do { \ -+ atomic_set(&(rw)->rcnt, 0); \ -+ atomic_set(&(rw)->wcnt, 0); \ -+ smp_mb(); /* atomic set */ \ -+} while (0) -+ -+#define AuDbgCnt(rw, cnt) atomic_read(&(rw)->cnt) -+#define AuDbgCntInc(rw, cnt) atomic_inc(&(rw)->cnt) -+#define AuDbgCntDec(rw, cnt) WARN_ON(atomic_dec_return(&(rw)->cnt) < 0) -+#define AuDbgRcntInc(rw) AuDbgCntInc(rw, rcnt) -+#define AuDbgRcntDec(rw) AuDbgCntDec(rw, rcnt) -+#define AuDbgWcntInc(rw) AuDbgCntInc(rw, wcnt) -+#define AuDbgWcntDec(rw) AuDbgCntDec(rw, wcnt) -+#else -+#define AuDbgCnt(rw, cnt) 0 -+#define AuDbgCntInit(rw) do {} while (0) -+#define AuDbgRcntInc(rw) do {} while (0) -+#define AuDbgRcntDec(rw) do {} while (0) -+#define AuDbgWcntInc(rw) do {} while (0) -+#define AuDbgWcntDec(rw) do {} while (0) -+#endif /* CONFIG_AUFS_DEBUG */ -+ -+/* to debug easier, do not make them inlined functions */ -+#define AuRwMustNoWaiters(rw) AuDebugOn(rwsem_is_contended(&(rw)->rwsem)) -+/* rwsem_is_locked() is unusable */ -+#define AuRwMustReadLock(rw) AuDebugOn(AuDbgCnt(rw, rcnt) <= 0) -+#define AuRwMustWriteLock(rw) AuDebugOn(AuDbgCnt(rw, wcnt) <= 0) -+#define AuRwMustAnyLock(rw) AuDebugOn(AuDbgCnt(rw, rcnt) <= 0 \ -+ && AuDbgCnt(rw, wcnt) <= 0) -+#define AuRwDestroy(rw) AuDebugOn(AuDbgCnt(rw, rcnt) \ -+ || AuDbgCnt(rw, wcnt)) -+ -+#define au_rw_init(rw) do { \ -+ AuDbgCntInit(rw); \ -+ init_rwsem(&(rw)->rwsem); \ -+ au_lockdep_set_name(rw); \ -+ } while (0) -+ -+#define au_rw_init_wlock(rw) do { \ -+ au_rw_init(rw); \ -+ down_write(&(rw)->rwsem); \ -+ AuDbgWcntInc(rw); \ -+ } while (0) -+ -+#define au_rw_init_wlock_nested(rw, lsc) do { \ -+ au_rw_init(rw); \ -+ down_write_nested(&(rw)->rwsem, lsc); \ -+ AuDbgWcntInc(rw); \ -+ } while (0) -+ -+static inline void au_rw_read_lock(struct au_rwsem *rw) -+{ -+ down_read(&rw->rwsem); -+ AuDbgRcntInc(rw); -+} -+ -+static inline void au_rw_read_lock_nested(struct au_rwsem *rw, unsigned int lsc) -+{ -+ down_read_nested(&rw->rwsem, lsc); -+ AuDbgRcntInc(rw); -+} -+ -+static inline void au_rw_read_unlock(struct au_rwsem *rw) -+{ -+ AuRwMustReadLock(rw); -+ AuDbgRcntDec(rw); -+ up_read(&rw->rwsem); -+} -+ -+static inline void au_rw_dgrade_lock(struct au_rwsem *rw) -+{ -+ AuRwMustWriteLock(rw); -+ AuDbgRcntInc(rw); -+ AuDbgWcntDec(rw); -+ downgrade_write(&rw->rwsem); -+} -+ -+static inline void au_rw_write_lock(struct au_rwsem *rw) -+{ -+ down_write(&rw->rwsem); -+ AuDbgWcntInc(rw); -+} -+ -+static inline void au_rw_write_lock_nested(struct au_rwsem *rw, -+ unsigned int lsc) -+{ -+ down_write_nested(&rw->rwsem, lsc); -+ AuDbgWcntInc(rw); -+} -+ -+static inline void au_rw_write_unlock(struct au_rwsem *rw) -+{ -+ AuRwMustWriteLock(rw); -+ AuDbgWcntDec(rw); -+ up_write(&rw->rwsem); -+} -+ -+/* why is not _nested version defined */ -+static inline int au_rw_read_trylock(struct au_rwsem *rw) -+{ -+ int ret; -+ -+ ret = down_read_trylock(&rw->rwsem); -+ if (ret) -+ AuDbgRcntInc(rw); -+ return ret; -+} -+ -+static inline int au_rw_write_trylock(struct au_rwsem *rw) -+{ -+ int ret; -+ -+ ret = down_write_trylock(&rw->rwsem); -+ if (ret) -+ AuDbgWcntInc(rw); -+ return ret; -+} -+ -+#undef AuDbgCntDec -+#undef AuDbgRcntInc -+#undef AuDbgRcntDec -+#undef AuDbgWcntDec -+ -+#define AuSimpleLockRwsemFuncs(prefix, param, rwsem) \ -+static inline void prefix##_read_lock(param) \ -+{ au_rw_read_lock(rwsem); } \ -+static inline void prefix##_write_lock(param) \ -+{ au_rw_write_lock(rwsem); } \ -+static inline int prefix##_read_trylock(param) \ -+{ return au_rw_read_trylock(rwsem); } \ -+static inline int prefix##_write_trylock(param) \ -+{ return au_rw_write_trylock(rwsem); } -+/* why is not _nested version defined */ -+/* static inline void prefix##_read_trylock_nested(param, lsc) -+{ au_rw_read_trylock_nested(rwsem, lsc)); } -+static inline void prefix##_write_trylock_nestd(param, lsc) -+{ au_rw_write_trylock_nested(rwsem, lsc); } */ -+ -+#define AuSimpleUnlockRwsemFuncs(prefix, param, rwsem) \ -+static inline void prefix##_read_unlock(param) \ -+{ au_rw_read_unlock(rwsem); } \ -+static inline void prefix##_write_unlock(param) \ -+{ au_rw_write_unlock(rwsem); } \ -+static inline void prefix##_downgrade_lock(param) \ -+{ au_rw_dgrade_lock(rwsem); } -+ -+#define AuSimpleRwsemFuncs(prefix, param, rwsem) \ -+ AuSimpleLockRwsemFuncs(prefix, param, rwsem) \ -+ AuSimpleUnlockRwsemFuncs(prefix, param, rwsem) -+ -+#endif /* __KERNEL__ */ -+#endif /* __AUFS_RWSEM_H__ */ -diff --git a/fs/aufs/sbinfo.c b/fs/aufs/sbinfo.c -new file mode 100644 -index 0000000..e113b51 ---- /dev/null -+++ b/fs/aufs/sbinfo.c -@@ -0,0 +1,342 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * superblock private data -+ */ -+ -+#include "aufs.h" -+ -+/* -+ * they are necessary regardless sysfs is disabled. -+ */ -+void au_si_free(struct kobject *kobj) -+{ -+ int i; -+ struct au_sbinfo *sbinfo; -+ char *locked __maybe_unused; /* debug only */ -+ -+ sbinfo = container_of(kobj, struct au_sbinfo, si_kobj); -+ for (i = 0; i < AuPlink_NHASH; i++) -+ AuDebugOn(!hlist_empty(&sbinfo->si_plink[i].head)); -+ AuDebugOn(atomic_read(&sbinfo->si_nowait.nw_len)); -+ -+ AuDebugOn(percpu_counter_sum(&sbinfo->si_ninodes)); -+ percpu_counter_destroy(&sbinfo->si_ninodes); -+ AuDebugOn(percpu_counter_sum(&sbinfo->si_nfiles)); -+ percpu_counter_destroy(&sbinfo->si_nfiles); -+ -+ au_rw_write_lock(&sbinfo->si_rwsem); -+ au_br_free(sbinfo); -+ au_rw_write_unlock(&sbinfo->si_rwsem); -+ -+ au_delayed_kfree(sbinfo->si_branch); -+ for (i = 0; i < AU_NPIDMAP; i++) -+ if (sbinfo->au_si_pid.pid_bitmap[i]) -+ au_delayed_kfree(sbinfo->au_si_pid.pid_bitmap[i]); -+ mutex_destroy(&sbinfo->au_si_pid.pid_mtx); -+ mutex_destroy(&sbinfo->si_xib_mtx); -+ AuRwDestroy(&sbinfo->si_rwsem); -+ -+ au_delayed_kfree(sbinfo); -+} -+ -+int au_si_alloc(struct super_block *sb) -+{ -+ int err, i; -+ struct au_sbinfo *sbinfo; -+ -+ err = -ENOMEM; -+ sbinfo = kzalloc(sizeof(*sbinfo), GFP_NOFS); -+ if (unlikely(!sbinfo)) -+ goto out; -+ -+ /* will be reallocated separately */ -+ sbinfo->si_branch = kzalloc(sizeof(*sbinfo->si_branch), GFP_NOFS); -+ if (unlikely(!sbinfo->si_branch)) -+ goto out_sbinfo; -+ -+ err = sysaufs_si_init(sbinfo); -+ if (unlikely(err)) -+ goto out_br; -+ -+ au_nwt_init(&sbinfo->si_nowait); -+ au_rw_init_wlock(&sbinfo->si_rwsem); -+ mutex_init(&sbinfo->au_si_pid.pid_mtx); -+ -+ percpu_counter_init(&sbinfo->si_ninodes, 0, GFP_NOFS); -+ percpu_counter_init(&sbinfo->si_nfiles, 0, GFP_NOFS); -+ -+ sbinfo->si_bbot = -1; -+ sbinfo->si_last_br_id = AUFS_BRANCH_MAX / 2; -+ -+ sbinfo->si_wbr_copyup = AuWbrCopyup_Def; -+ sbinfo->si_wbr_create = AuWbrCreate_Def; -+ sbinfo->si_wbr_copyup_ops = au_wbr_copyup_ops + sbinfo->si_wbr_copyup; -+ sbinfo->si_wbr_create_ops = au_wbr_create_ops + sbinfo->si_wbr_create; -+ -+ au_fhsm_init(sbinfo); -+ -+ sbinfo->si_mntflags = au_opts_plink(AuOpt_Def); -+ -+ sbinfo->si_xino_jiffy = jiffies; -+ sbinfo->si_xino_expire -+ = msecs_to_jiffies(AUFS_XINO_DEF_SEC * MSEC_PER_SEC); -+ mutex_init(&sbinfo->si_xib_mtx); -+ sbinfo->si_xino_brid = -1; -+ /* leave si_xib_last_pindex and si_xib_next_bit */ -+ -+ au_sphl_init(&sbinfo->si_aopen); -+ -+ sbinfo->si_rdcache = msecs_to_jiffies(AUFS_RDCACHE_DEF * MSEC_PER_SEC); -+ sbinfo->si_rdblk = AUFS_RDBLK_DEF; -+ sbinfo->si_rdhash = AUFS_RDHASH_DEF; -+ sbinfo->si_dirwh = AUFS_DIRWH_DEF; -+ -+ for (i = 0; i < AuPlink_NHASH; i++) -+ au_sphl_init(sbinfo->si_plink + i); -+ init_waitqueue_head(&sbinfo->si_plink_wq); -+ spin_lock_init(&sbinfo->si_plink_maint_lock); -+ -+ au_sphl_init(&sbinfo->si_files); -+ -+ /* with getattr by default */ -+ sbinfo->si_iop_array = aufs_iop; -+ -+ /* leave other members for sysaufs and si_mnt. */ -+ sbinfo->si_sb = sb; -+ sb->s_fs_info = sbinfo; -+ si_pid_set(sb); -+ return 0; /* success */ -+ -+out_br: -+ au_delayed_kfree(sbinfo->si_branch); -+out_sbinfo: -+ au_delayed_kfree(sbinfo); -+out: -+ return err; -+} -+ -+int au_sbr_realloc(struct au_sbinfo *sbinfo, int nbr, int may_shrink) -+{ -+ int err, sz; -+ struct au_branch **brp; -+ -+ AuRwMustWriteLock(&sbinfo->si_rwsem); -+ -+ err = -ENOMEM; -+ sz = sizeof(*brp) * (sbinfo->si_bbot + 1); -+ if (unlikely(!sz)) -+ sz = sizeof(*brp); -+ brp = au_kzrealloc(sbinfo->si_branch, sz, sizeof(*brp) * nbr, GFP_NOFS, -+ may_shrink); -+ if (brp) { -+ sbinfo->si_branch = brp; -+ err = 0; -+ } -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+unsigned int au_sigen_inc(struct super_block *sb) -+{ -+ unsigned int gen; -+ struct inode *inode; -+ -+ SiMustWriteLock(sb); -+ -+ gen = ++au_sbi(sb)->si_generation; -+ au_update_digen(sb->s_root); -+ inode = d_inode(sb->s_root); -+ au_update_iigen(inode, /*half*/0); -+ inode->i_version++; -+ return gen; -+} -+ -+aufs_bindex_t au_new_br_id(struct super_block *sb) -+{ -+ aufs_bindex_t br_id; -+ int i; -+ struct au_sbinfo *sbinfo; -+ -+ SiMustWriteLock(sb); -+ -+ sbinfo = au_sbi(sb); -+ for (i = 0; i <= AUFS_BRANCH_MAX; i++) { -+ br_id = ++sbinfo->si_last_br_id; -+ AuDebugOn(br_id < 0); -+ if (br_id && au_br_index(sb, br_id) < 0) -+ return br_id; -+ } -+ -+ return -1; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* it is ok that new 'nwt' tasks are appended while we are sleeping */ -+int si_read_lock(struct super_block *sb, int flags) -+{ -+ int err; -+ -+ err = 0; -+ if (au_ftest_lock(flags, FLUSH)) -+ au_nwt_flush(&au_sbi(sb)->si_nowait); -+ -+ si_noflush_read_lock(sb); -+ err = au_plink_maint(sb, flags); -+ if (unlikely(err)) -+ si_read_unlock(sb); -+ -+ return err; -+} -+ -+int si_write_lock(struct super_block *sb, int flags) -+{ -+ int err; -+ -+ if (au_ftest_lock(flags, FLUSH)) -+ au_nwt_flush(&au_sbi(sb)->si_nowait); -+ -+ si_noflush_write_lock(sb); -+ err = au_plink_maint(sb, flags); -+ if (unlikely(err)) -+ si_write_unlock(sb); -+ -+ return err; -+} -+ -+/* dentry and super_block lock. call at entry point */ -+int aufs_read_lock(struct dentry *dentry, int flags) -+{ -+ int err; -+ struct super_block *sb; -+ -+ sb = dentry->d_sb; -+ err = si_read_lock(sb, flags); -+ if (unlikely(err)) -+ goto out; -+ -+ if (au_ftest_lock(flags, DW)) -+ di_write_lock_child(dentry); -+ else -+ di_read_lock_child(dentry, flags); -+ -+ if (au_ftest_lock(flags, GEN)) { -+ err = au_digen_test(dentry, au_sigen(sb)); -+ if (!au_opt_test(au_mntflags(sb), UDBA_NONE)) -+ AuDebugOn(!err && au_dbrange_test(dentry)); -+ else if (!err) -+ err = au_dbrange_test(dentry); -+ if (unlikely(err)) -+ aufs_read_unlock(dentry, flags); -+ } -+ -+out: -+ return err; -+} -+ -+void aufs_read_unlock(struct dentry *dentry, int flags) -+{ -+ if (au_ftest_lock(flags, DW)) -+ di_write_unlock(dentry); -+ else -+ di_read_unlock(dentry, flags); -+ si_read_unlock(dentry->d_sb); -+} -+ -+void aufs_write_lock(struct dentry *dentry) -+{ -+ si_write_lock(dentry->d_sb, AuLock_FLUSH | AuLock_NOPLMW); -+ di_write_lock_child(dentry); -+} -+ -+void aufs_write_unlock(struct dentry *dentry) -+{ -+ di_write_unlock(dentry); -+ si_write_unlock(dentry->d_sb); -+} -+ -+int aufs_read_and_write_lock2(struct dentry *d1, struct dentry *d2, int flags) -+{ -+ int err; -+ unsigned int sigen; -+ struct super_block *sb; -+ -+ sb = d1->d_sb; -+ err = si_read_lock(sb, flags); -+ if (unlikely(err)) -+ goto out; -+ -+ di_write_lock2_child(d1, d2, au_ftest_lock(flags, DIRS)); -+ -+ if (au_ftest_lock(flags, GEN)) { -+ sigen = au_sigen(sb); -+ err = au_digen_test(d1, sigen); -+ AuDebugOn(!err && au_dbrange_test(d1)); -+ if (!err) { -+ err = au_digen_test(d2, sigen); -+ AuDebugOn(!err && au_dbrange_test(d2)); -+ } -+ if (unlikely(err)) -+ aufs_read_and_write_unlock2(d1, d2); -+ } -+ -+out: -+ return err; -+} -+ -+void aufs_read_and_write_unlock2(struct dentry *d1, struct dentry *d2) -+{ -+ di_write_unlock2(d1, d2); -+ si_read_unlock(d1->d_sb); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static void si_pid_alloc(struct au_si_pid *au_si_pid, int idx) -+{ -+ unsigned long *p; -+ -+ BUILD_BUG_ON(sizeof(unsigned long) != -+ sizeof(*au_si_pid->pid_bitmap)); -+ -+ mutex_lock(&au_si_pid->pid_mtx); -+ p = au_si_pid->pid_bitmap[idx]; -+ while (!p) { -+ /* -+ * bad approach. -+ * but keeping 'si_pid_set()' void is more important. -+ */ -+ p = kcalloc(BITS_TO_LONGS(AU_PIDSTEP), -+ sizeof(*au_si_pid->pid_bitmap), -+ GFP_NOFS); -+ if (p) -+ break; -+ cond_resched(); -+ } -+ au_si_pid->pid_bitmap[idx] = p; -+ mutex_unlock(&au_si_pid->pid_mtx); -+} -+ -+void si_pid_set(struct super_block *sb) -+{ -+ pid_t bit; -+ int idx; -+ unsigned long *bitmap; -+ struct au_si_pid *au_si_pid; -+ -+ si_pid_idx_bit(&idx, &bit); -+ au_si_pid = &au_sbi(sb)->au_si_pid; -+ bitmap = au_si_pid->pid_bitmap[idx]; -+ if (!bitmap) { -+ si_pid_alloc(au_si_pid, idx); -+ bitmap = au_si_pid->pid_bitmap[idx]; -+ } -+ AuDebugOn(test_bit(bit, bitmap)); -+ set_bit(bit, bitmap); -+ /* smp_mb(); */ -+} -diff --git a/fs/aufs/spl.h b/fs/aufs/spl.h -new file mode 100644 -index 0000000..8f519db3 ---- /dev/null -+++ b/fs/aufs/spl.h -@@ -0,0 +1,100 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * simple list protected by a spinlock -+ */ -+ -+#ifndef __AUFS_SPL_H__ -+#define __AUFS_SPL_H__ -+ -+#ifdef __KERNEL__ -+ -+#if 0 -+struct au_splhead { -+ spinlock_t spin; -+ struct list_head head; -+}; -+ -+static inline void au_spl_init(struct au_splhead *spl) -+{ -+ spin_lock_init(&spl->spin); -+ INIT_LIST_HEAD(&spl->head); -+} -+ -+static inline void au_spl_add(struct list_head *list, struct au_splhead *spl) -+{ -+ spin_lock(&spl->spin); -+ list_add(list, &spl->head); -+ spin_unlock(&spl->spin); -+} -+ -+static inline void au_spl_del(struct list_head *list, struct au_splhead *spl) -+{ -+ spin_lock(&spl->spin); -+ list_del(list); -+ spin_unlock(&spl->spin); -+} -+ -+static inline void au_spl_del_rcu(struct list_head *list, -+ struct au_splhead *spl) -+{ -+ spin_lock(&spl->spin); -+ list_del_rcu(list); -+ spin_unlock(&spl->spin); -+} -+#endif -+ -+/* ---------------------------------------------------------------------- */ -+ -+struct au_sphlhead { -+ spinlock_t spin; -+ struct hlist_head head; -+}; -+ -+static inline void au_sphl_init(struct au_sphlhead *sphl) -+{ -+ spin_lock_init(&sphl->spin); -+ INIT_HLIST_HEAD(&sphl->head); -+} -+ -+static inline void au_sphl_add(struct hlist_node *hlist, -+ struct au_sphlhead *sphl) -+{ -+ spin_lock(&sphl->spin); -+ hlist_add_head(hlist, &sphl->head); -+ spin_unlock(&sphl->spin); -+} -+ -+static inline void au_sphl_del(struct hlist_node *hlist, -+ struct au_sphlhead *sphl) -+{ -+ spin_lock(&sphl->spin); -+ hlist_del(hlist); -+ spin_unlock(&sphl->spin); -+} -+ -+static inline void au_sphl_del_rcu(struct hlist_node *hlist, -+ struct au_sphlhead *sphl) -+{ -+ spin_lock(&sphl->spin); -+ hlist_del_rcu(hlist); -+ spin_unlock(&sphl->spin); -+} -+ -+static inline unsigned long au_sphl_count(struct au_sphlhead *sphl) -+{ -+ unsigned long cnt; -+ struct hlist_node *pos; -+ -+ cnt = 0; -+ spin_lock(&sphl->spin); -+ hlist_for_each(pos, &sphl->head) -+ cnt++; -+ spin_unlock(&sphl->spin); -+ return cnt; -+} -+ -+#endif /* __KERNEL__ */ -+#endif /* __AUFS_SPL_H__ */ -diff --git a/fs/aufs/super.c b/fs/aufs/super.c -new file mode 100644 -index 0000000..58a773c ---- /dev/null -+++ b/fs/aufs/super.c -@@ -0,0 +1,1025 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * mount and super_block operations -+ */ -+ -+#include -+#include -+#include -+#include -+#include "aufs.h" -+ -+/* -+ * super_operations -+ */ -+static struct inode *aufs_alloc_inode(struct super_block *sb __maybe_unused) -+{ -+ struct au_icntnr *c; -+ -+ c = au_cache_alloc_icntnr(); -+ if (c) { -+ au_icntnr_init(c); -+ c->vfs_inode.i_version = 1; /* sigen(sb); */ -+ c->iinfo.ii_hinode = NULL; -+ return &c->vfs_inode; -+ } -+ return NULL; -+} -+ -+static void aufs_destroy_inode_cb(struct rcu_head *head) -+{ -+ struct inode *inode = container_of(head, struct inode, i_rcu); -+ -+ au_cache_dfree_icntnr(container_of(inode, struct au_icntnr, vfs_inode)); -+} -+ -+static void aufs_destroy_inode(struct inode *inode) -+{ -+ if (!au_is_bad_inode(inode)) -+ au_iinfo_fin(inode); -+ call_rcu(&inode->i_rcu, aufs_destroy_inode_cb); -+} -+ -+struct inode *au_iget_locked(struct super_block *sb, ino_t ino) -+{ -+ struct inode *inode; -+ int err; -+ -+ inode = iget_locked(sb, ino); -+ if (unlikely(!inode)) { -+ inode = ERR_PTR(-ENOMEM); -+ goto out; -+ } -+ if (!(inode->i_state & I_NEW)) -+ goto out; -+ -+ err = au_xigen_new(inode); -+ if (!err) -+ err = au_iinfo_init(inode); -+ if (!err) -+ inode->i_version++; -+ else { -+ iget_failed(inode); -+ inode = ERR_PTR(err); -+ } -+ -+out: -+ /* never return NULL */ -+ AuDebugOn(!inode); -+ AuTraceErrPtr(inode); -+ return inode; -+} -+ -+/* lock free root dinfo */ -+static int au_show_brs(struct seq_file *seq, struct super_block *sb) -+{ -+ int err; -+ aufs_bindex_t bindex, bbot; -+ struct path path; -+ struct au_hdentry *hdp; -+ struct au_branch *br; -+ au_br_perm_str_t perm; -+ -+ err = 0; -+ bbot = au_sbbot(sb); -+ bindex = 0; -+ hdp = au_hdentry(au_di(sb->s_root), bindex); -+ for (; !err && bindex <= bbot; bindex++, hdp++) { -+ br = au_sbr(sb, bindex); -+ path.mnt = au_br_mnt(br); -+ path.dentry = hdp->hd_dentry; -+ err = au_seq_path(seq, &path); -+ if (!err) { -+ au_optstr_br_perm(&perm, br->br_perm); -+ seq_printf(seq, "=%s", perm.a); -+ if (bindex != bbot) -+ seq_putc(seq, ':'); -+ } -+ } -+ if (unlikely(err || seq_has_overflowed(seq))) -+ err = -E2BIG; -+ -+ return err; -+} -+ -+static void au_show_wbr_create(struct seq_file *m, int v, -+ struct au_sbinfo *sbinfo) -+{ -+ const char *pat; -+ -+ AuRwMustAnyLock(&sbinfo->si_rwsem); -+ -+ seq_puts(m, ",create="); -+ pat = au_optstr_wbr_create(v); -+ switch (v) { -+ case AuWbrCreate_TDP: -+ case AuWbrCreate_RR: -+ case AuWbrCreate_MFS: -+ case AuWbrCreate_PMFS: -+ seq_puts(m, pat); -+ break; -+ case AuWbrCreate_MFSV: -+ seq_printf(m, /*pat*/"mfs:%lu", -+ jiffies_to_msecs(sbinfo->si_wbr_mfs.mfs_expire) -+ / MSEC_PER_SEC); -+ break; -+ case AuWbrCreate_PMFSV: -+ seq_printf(m, /*pat*/"pmfs:%lu", -+ jiffies_to_msecs(sbinfo->si_wbr_mfs.mfs_expire) -+ / MSEC_PER_SEC); -+ break; -+ case AuWbrCreate_MFSRR: -+ seq_printf(m, /*pat*/"mfsrr:%llu", -+ sbinfo->si_wbr_mfs.mfsrr_watermark); -+ break; -+ case AuWbrCreate_MFSRRV: -+ seq_printf(m, /*pat*/"mfsrr:%llu:%lu", -+ sbinfo->si_wbr_mfs.mfsrr_watermark, -+ jiffies_to_msecs(sbinfo->si_wbr_mfs.mfs_expire) -+ / MSEC_PER_SEC); -+ break; -+ case AuWbrCreate_PMFSRR: -+ seq_printf(m, /*pat*/"pmfsrr:%llu", -+ sbinfo->si_wbr_mfs.mfsrr_watermark); -+ break; -+ case AuWbrCreate_PMFSRRV: -+ seq_printf(m, /*pat*/"pmfsrr:%llu:%lu", -+ sbinfo->si_wbr_mfs.mfsrr_watermark, -+ jiffies_to_msecs(sbinfo->si_wbr_mfs.mfs_expire) -+ / MSEC_PER_SEC); -+ break; -+ } -+} -+ -+static int au_show_xino(struct seq_file *seq, struct super_block *sb) -+{ -+#ifdef CONFIG_SYSFS -+ return 0; -+#else -+ int err; -+ const int len = sizeof(AUFS_XINO_FNAME) - 1; -+ aufs_bindex_t bindex, brid; -+ struct qstr *name; -+ struct file *f; -+ struct dentry *d, *h_root; -+ -+ AuRwMustAnyLock(&sbinfo->si_rwsem); -+ -+ err = 0; -+ f = au_sbi(sb)->si_xib; -+ if (!f) -+ goto out; -+ -+ /* stop printing the default xino path on the first writable branch */ -+ h_root = NULL; -+ brid = au_xino_brid(sb); -+ if (brid >= 0) { -+ bindex = au_br_index(sb, brid); -+ h_root = au_hdentry(au_di(sb->s_root), bindex)->hd_dentry; -+ } -+ d = f->f_path.dentry; -+ name = &d->d_name; -+ /* safe ->d_parent because the file is unlinked */ -+ if (d->d_parent == h_root -+ && name->len == len -+ && !memcmp(name->name, AUFS_XINO_FNAME, len)) -+ goto out; -+ -+ seq_puts(seq, ",xino="); -+ err = au_xino_path(seq, f); -+ -+out: -+ return err; -+#endif -+} -+ -+/* seq_file will re-call me in case of too long string */ -+static int aufs_show_options(struct seq_file *m, struct dentry *dentry) -+{ -+ int err; -+ unsigned int mnt_flags, v; -+ struct super_block *sb; -+ struct au_sbinfo *sbinfo; -+ -+#define AuBool(name, str) do { \ -+ v = au_opt_test(mnt_flags, name); \ -+ if (v != au_opt_test(AuOpt_Def, name)) \ -+ seq_printf(m, ",%s" #str, v ? "" : "no"); \ -+} while (0) -+ -+#define AuStr(name, str) do { \ -+ v = mnt_flags & AuOptMask_##name; \ -+ if (v != (AuOpt_Def & AuOptMask_##name)) \ -+ seq_printf(m, "," #str "=%s", au_optstr_##str(v)); \ -+} while (0) -+ -+#define AuUInt(name, str, val) do { \ -+ if (val != AUFS_##name##_DEF) \ -+ seq_printf(m, "," #str "=%u", val); \ -+} while (0) -+ -+ sb = dentry->d_sb; -+ if (sb->s_flags & MS_POSIXACL) -+ seq_puts(m, ",acl"); -+ -+ /* lock free root dinfo */ -+ si_noflush_read_lock(sb); -+ sbinfo = au_sbi(sb); -+ seq_printf(m, ",si=%lx", sysaufs_si_id(sbinfo)); -+ -+ mnt_flags = au_mntflags(sb); -+ if (au_opt_test(mnt_flags, XINO)) { -+ err = au_show_xino(m, sb); -+ if (unlikely(err)) -+ goto out; -+ } else -+ seq_puts(m, ",noxino"); -+ -+ AuBool(TRUNC_XINO, trunc_xino); -+ AuStr(UDBA, udba); -+ AuBool(SHWH, shwh); -+ AuBool(PLINK, plink); -+ AuBool(DIO, dio); -+ AuBool(DIRPERM1, dirperm1); -+ -+ v = sbinfo->si_wbr_create; -+ if (v != AuWbrCreate_Def) -+ au_show_wbr_create(m, v, sbinfo); -+ -+ v = sbinfo->si_wbr_copyup; -+ if (v != AuWbrCopyup_Def) -+ seq_printf(m, ",cpup=%s", au_optstr_wbr_copyup(v)); -+ -+ v = au_opt_test(mnt_flags, ALWAYS_DIROPQ); -+ if (v != au_opt_test(AuOpt_Def, ALWAYS_DIROPQ)) -+ seq_printf(m, ",diropq=%c", v ? 'a' : 'w'); -+ -+ AuUInt(DIRWH, dirwh, sbinfo->si_dirwh); -+ -+ v = jiffies_to_msecs(sbinfo->si_rdcache) / MSEC_PER_SEC; -+ AuUInt(RDCACHE, rdcache, v); -+ -+ AuUInt(RDBLK, rdblk, sbinfo->si_rdblk); -+ AuUInt(RDHASH, rdhash, sbinfo->si_rdhash); -+ -+ au_fhsm_show(m, sbinfo); -+ -+ AuBool(SUM, sum); -+ /* AuBool(SUM_W, wsum); */ -+ AuBool(WARN_PERM, warn_perm); -+ AuBool(VERBOSE, verbose); -+ -+out: -+ /* be sure to print "br:" last */ -+ if (!sysaufs_brs) { -+ seq_puts(m, ",br:"); -+ au_show_brs(m, sb); -+ } -+ si_read_unlock(sb); -+ return 0; -+ -+#undef AuBool -+#undef AuStr -+#undef AuUInt -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* sum mode which returns the summation for statfs(2) */ -+ -+static u64 au_add_till_max(u64 a, u64 b) -+{ -+ u64 old; -+ -+ old = a; -+ a += b; -+ if (old <= a) -+ return a; -+ return ULLONG_MAX; -+} -+ -+static u64 au_mul_till_max(u64 a, long mul) -+{ -+ u64 old; -+ -+ old = a; -+ a *= mul; -+ if (old <= a) -+ return a; -+ return ULLONG_MAX; -+} -+ -+static int au_statfs_sum(struct super_block *sb, struct kstatfs *buf) -+{ -+ int err; -+ long bsize, factor; -+ u64 blocks, bfree, bavail, files, ffree; -+ aufs_bindex_t bbot, bindex, i; -+ unsigned char shared; -+ struct path h_path; -+ struct super_block *h_sb; -+ -+ err = 0; -+ bsize = LONG_MAX; -+ files = 0; -+ ffree = 0; -+ blocks = 0; -+ bfree = 0; -+ bavail = 0; -+ bbot = au_sbbot(sb); -+ for (bindex = 0; bindex <= bbot; bindex++) { -+ h_path.mnt = au_sbr_mnt(sb, bindex); -+ h_sb = h_path.mnt->mnt_sb; -+ shared = 0; -+ for (i = 0; !shared && i < bindex; i++) -+ shared = (au_sbr_sb(sb, i) == h_sb); -+ if (shared) -+ continue; -+ -+ /* sb->s_root for NFS is unreliable */ -+ h_path.dentry = h_path.mnt->mnt_root; -+ err = vfs_statfs(&h_path, buf); -+ if (unlikely(err)) -+ goto out; -+ -+ if (bsize > buf->f_bsize) { -+ /* -+ * we will reduce bsize, so we have to expand blocks -+ * etc. to match them again -+ */ -+ factor = (bsize / buf->f_bsize); -+ blocks = au_mul_till_max(blocks, factor); -+ bfree = au_mul_till_max(bfree, factor); -+ bavail = au_mul_till_max(bavail, factor); -+ bsize = buf->f_bsize; -+ } -+ -+ factor = (buf->f_bsize / bsize); -+ blocks = au_add_till_max(blocks, -+ au_mul_till_max(buf->f_blocks, factor)); -+ bfree = au_add_till_max(bfree, -+ au_mul_till_max(buf->f_bfree, factor)); -+ bavail = au_add_till_max(bavail, -+ au_mul_till_max(buf->f_bavail, factor)); -+ files = au_add_till_max(files, buf->f_files); -+ ffree = au_add_till_max(ffree, buf->f_ffree); -+ } -+ -+ buf->f_bsize = bsize; -+ buf->f_blocks = blocks; -+ buf->f_bfree = bfree; -+ buf->f_bavail = bavail; -+ buf->f_files = files; -+ buf->f_ffree = ffree; -+ buf->f_frsize = 0; -+ -+out: -+ return err; -+} -+ -+static int aufs_statfs(struct dentry *dentry, struct kstatfs *buf) -+{ -+ int err; -+ struct path h_path; -+ struct super_block *sb; -+ -+ /* lock free root dinfo */ -+ sb = dentry->d_sb; -+ si_noflush_read_lock(sb); -+ if (!au_opt_test(au_mntflags(sb), SUM)) { -+ /* sb->s_root for NFS is unreliable */ -+ h_path.mnt = au_sbr_mnt(sb, 0); -+ h_path.dentry = h_path.mnt->mnt_root; -+ err = vfs_statfs(&h_path, buf); -+ } else -+ err = au_statfs_sum(sb, buf); -+ si_read_unlock(sb); -+ -+ if (!err) { -+ buf->f_type = AUFS_SUPER_MAGIC; -+ buf->f_namelen = AUFS_MAX_NAMELEN; -+ memset(&buf->f_fsid, 0, sizeof(buf->f_fsid)); -+ } -+ /* buf->f_bsize = buf->f_blocks = buf->f_bfree = buf->f_bavail = -1; */ -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int aufs_sync_fs(struct super_block *sb, int wait) -+{ -+ int err, e; -+ aufs_bindex_t bbot, bindex; -+ struct au_branch *br; -+ struct super_block *h_sb; -+ -+ err = 0; -+ si_noflush_read_lock(sb); -+ bbot = au_sbbot(sb); -+ for (bindex = 0; bindex <= bbot; bindex++) { -+ br = au_sbr(sb, bindex); -+ if (!au_br_writable(br->br_perm)) -+ continue; -+ -+ h_sb = au_sbr_sb(sb, bindex); -+ if (h_sb->s_op->sync_fs) { -+ e = h_sb->s_op->sync_fs(h_sb, wait); -+ if (unlikely(e && !err)) -+ err = e; -+ /* go on even if an error happens */ -+ } -+ } -+ si_read_unlock(sb); -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* final actions when unmounting a file system */ -+static void aufs_put_super(struct super_block *sb) -+{ -+ struct au_sbinfo *sbinfo; -+ -+ sbinfo = au_sbi(sb); -+ if (!sbinfo) -+ return; -+ -+ dbgaufs_si_fin(sbinfo); -+ kobject_put(&sbinfo->si_kobj); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+void *au_array_alloc(unsigned long long *hint, au_arraycb_t cb, -+ struct super_block *sb, void *arg) -+{ -+ void *array; -+ unsigned long long n, sz; -+ -+ array = NULL; -+ n = 0; -+ if (!*hint) -+ goto out; -+ -+ if (*hint > ULLONG_MAX / sizeof(array)) { -+ array = ERR_PTR(-EMFILE); -+ pr_err("hint %llu\n", *hint); -+ goto out; -+ } -+ -+ sz = sizeof(array) * *hint; -+ array = kzalloc(sz, GFP_NOFS); -+ if (unlikely(!array)) -+ array = vzalloc(sz); -+ if (unlikely(!array)) { -+ array = ERR_PTR(-ENOMEM); -+ goto out; -+ } -+ -+ n = cb(sb, array, *hint, arg); -+ AuDebugOn(n > *hint); -+ -+out: -+ *hint = n; -+ return array; -+} -+ -+static unsigned long long au_iarray_cb(struct super_block *sb, void *a, -+ unsigned long long max __maybe_unused, -+ void *arg) -+{ -+ unsigned long long n; -+ struct inode **p, *inode; -+ struct list_head *head; -+ -+ n = 0; -+ p = a; -+ head = arg; -+ spin_lock(&sb->s_inode_list_lock); -+ list_for_each_entry(inode, head, i_sb_list) { -+ if (!au_is_bad_inode(inode) -+ && au_ii(inode)->ii_btop >= 0) { -+ spin_lock(&inode->i_lock); -+ if (atomic_read(&inode->i_count)) { -+ au_igrab(inode); -+ *p++ = inode; -+ n++; -+ AuDebugOn(n > max); -+ } -+ spin_unlock(&inode->i_lock); -+ } -+ } -+ spin_unlock(&sb->s_inode_list_lock); -+ -+ return n; -+} -+ -+struct inode **au_iarray_alloc(struct super_block *sb, unsigned long long *max) -+{ -+ *max = au_ninodes(sb); -+ return au_array_alloc(max, au_iarray_cb, sb, &sb->s_inodes); -+} -+ -+void au_iarray_free(struct inode **a, unsigned long long max) -+{ -+ unsigned long long ull; -+ -+ for (ull = 0; ull < max; ull++) -+ iput(a[ull]); -+ kvfree(a); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * refresh dentry and inode at remount time. -+ */ -+/* todo: consolidate with simple_reval_dpath() and au_reval_for_attr() */ -+static int au_do_refresh(struct dentry *dentry, unsigned int dir_flags, -+ struct dentry *parent) -+{ -+ int err; -+ -+ di_write_lock_child(dentry); -+ di_read_lock_parent(parent, AuLock_IR); -+ err = au_refresh_dentry(dentry, parent); -+ if (!err && dir_flags) -+ au_hn_reset(d_inode(dentry), dir_flags); -+ di_read_unlock(parent, AuLock_IR); -+ di_write_unlock(dentry); -+ -+ return err; -+} -+ -+static int au_do_refresh_d(struct dentry *dentry, unsigned int sigen, -+ struct au_sbinfo *sbinfo, -+ const unsigned int dir_flags, unsigned int do_idop) -+{ -+ int err; -+ struct dentry *parent; -+ -+ err = 0; -+ parent = dget_parent(dentry); -+ if (!au_digen_test(parent, sigen) && au_digen_test(dentry, sigen)) { -+ if (d_really_is_positive(dentry)) { -+ if (!d_is_dir(dentry)) -+ err = au_do_refresh(dentry, /*dir_flags*/0, -+ parent); -+ else { -+ err = au_do_refresh(dentry, dir_flags, parent); -+ if (unlikely(err)) -+ au_fset_si(sbinfo, FAILED_REFRESH_DIR); -+ } -+ } else -+ err = au_do_refresh(dentry, /*dir_flags*/0, parent); -+ AuDbgDentry(dentry); -+ } -+ dput(parent); -+ -+ if (!err) { -+ if (do_idop) -+ au_refresh_dop(dentry, /*force_reval*/0); -+ } else -+ au_refresh_dop(dentry, /*force_reval*/1); -+ -+ AuTraceErr(err); -+ return err; -+} -+ -+static int au_refresh_d(struct super_block *sb, unsigned int do_idop) -+{ -+ int err, i, j, ndentry, e; -+ unsigned int sigen; -+ struct au_dcsub_pages dpages; -+ struct au_dpage *dpage; -+ struct dentry **dentries, *d; -+ struct au_sbinfo *sbinfo; -+ struct dentry *root = sb->s_root; -+ const unsigned int dir_flags = au_hi_flags(d_inode(root), /*isdir*/1); -+ -+ if (do_idop) -+ au_refresh_dop(root, /*force_reval*/0); -+ -+ err = au_dpages_init(&dpages, GFP_NOFS); -+ if (unlikely(err)) -+ goto out; -+ err = au_dcsub_pages(&dpages, root, NULL, NULL); -+ if (unlikely(err)) -+ goto out_dpages; -+ -+ sigen = au_sigen(sb); -+ sbinfo = au_sbi(sb); -+ for (i = 0; i < dpages.ndpage; i++) { -+ dpage = dpages.dpages + i; -+ dentries = dpage->dentries; -+ ndentry = dpage->ndentry; -+ for (j = 0; j < ndentry; j++) { -+ d = dentries[j]; -+ e = au_do_refresh_d(d, sigen, sbinfo, dir_flags, -+ do_idop); -+ if (unlikely(e && !err)) -+ err = e; -+ /* go on even err */ -+ } -+ } -+ -+out_dpages: -+ au_dpages_free(&dpages); -+out: -+ return err; -+} -+ -+static int au_refresh_i(struct super_block *sb, unsigned int do_idop) -+{ -+ int err, e; -+ unsigned int sigen; -+ unsigned long long max, ull; -+ struct inode *inode, **array; -+ -+ array = au_iarray_alloc(sb, &max); -+ err = PTR_ERR(array); -+ if (IS_ERR(array)) -+ goto out; -+ -+ err = 0; -+ sigen = au_sigen(sb); -+ for (ull = 0; ull < max; ull++) { -+ inode = array[ull]; -+ if (unlikely(!inode)) -+ break; -+ -+ e = 0; -+ ii_write_lock_child(inode); -+ if (au_iigen(inode, NULL) != sigen) { -+ e = au_refresh_hinode_self(inode); -+ if (unlikely(e)) { -+ au_refresh_iop(inode, /*force_getattr*/1); -+ pr_err("error %d, i%lu\n", e, inode->i_ino); -+ if (!err) -+ err = e; -+ /* go on even if err */ -+ } -+ } -+ if (!e && do_idop) -+ au_refresh_iop(inode, /*force_getattr*/0); -+ ii_write_unlock(inode); -+ } -+ -+ au_iarray_free(array, max); -+ -+out: -+ return err; -+} -+ -+static void au_remount_refresh(struct super_block *sb, unsigned int do_idop) -+{ -+ int err, e; -+ unsigned int udba; -+ aufs_bindex_t bindex, bbot; -+ struct dentry *root; -+ struct inode *inode; -+ struct au_branch *br; -+ struct au_sbinfo *sbi; -+ -+ au_sigen_inc(sb); -+ sbi = au_sbi(sb); -+ au_fclr_si(sbi, FAILED_REFRESH_DIR); -+ -+ root = sb->s_root; -+ DiMustNoWaiters(root); -+ inode = d_inode(root); -+ IiMustNoWaiters(inode); -+ -+ udba = au_opt_udba(sb); -+ bbot = au_sbbot(sb); -+ for (bindex = 0; bindex <= bbot; bindex++) { -+ br = au_sbr(sb, bindex); -+ err = au_hnotify_reset_br(udba, br, br->br_perm); -+ if (unlikely(err)) -+ AuIOErr("hnotify failed on br %d, %d, ignored\n", -+ bindex, err); -+ /* go on even if err */ -+ } -+ au_hn_reset(inode, au_hi_flags(inode, /*isdir*/1)); -+ -+ if (do_idop) { -+ if (au_ftest_si(sbi, NO_DREVAL)) { -+ AuDebugOn(sb->s_d_op == &aufs_dop_noreval); -+ sb->s_d_op = &aufs_dop_noreval; -+ AuDebugOn(sbi->si_iop_array == aufs_iop_nogetattr); -+ sbi->si_iop_array = aufs_iop_nogetattr; -+ } else { -+ AuDebugOn(sb->s_d_op == &aufs_dop); -+ sb->s_d_op = &aufs_dop; -+ AuDebugOn(sbi->si_iop_array == aufs_iop); -+ sbi->si_iop_array = aufs_iop; -+ } -+ pr_info("reset to %pf and %pf\n", -+ sb->s_d_op, sbi->si_iop_array); -+ } -+ -+ di_write_unlock(root); -+ err = au_refresh_d(sb, do_idop); -+ e = au_refresh_i(sb, do_idop); -+ if (unlikely(e && !err)) -+ err = e; -+ /* aufs_write_lock() calls ..._child() */ -+ di_write_lock_child(root); -+ -+ au_cpup_attr_all(inode, /*force*/1); -+ -+ if (unlikely(err)) -+ AuIOErr("refresh failed, ignored, %d\n", err); -+} -+ -+/* stop extra interpretation of errno in mount(8), and strange error messages */ -+static int cvt_err(int err) -+{ -+ AuTraceErr(err); -+ -+ switch (err) { -+ case -ENOENT: -+ case -ENOTDIR: -+ case -EEXIST: -+ case -EIO: -+ err = -EINVAL; -+ } -+ return err; -+} -+ -+static int aufs_remount_fs(struct super_block *sb, int *flags, char *data) -+{ -+ int err, do_dx; -+ unsigned int mntflags; -+ struct au_opts opts = { -+ .opt = NULL -+ }; -+ struct dentry *root; -+ struct inode *inode; -+ struct au_sbinfo *sbinfo; -+ -+ err = 0; -+ root = sb->s_root; -+ if (!data || !*data) { -+ err = si_write_lock(sb, AuLock_FLUSH | AuLock_NOPLM); -+ if (!err) { -+ di_write_lock_child(root); -+ err = au_opts_verify(sb, *flags, /*pending*/0); -+ aufs_write_unlock(root); -+ } -+ goto out; -+ } -+ -+ err = -ENOMEM; -+ opts.opt = (void *)__get_free_page(GFP_NOFS); -+ if (unlikely(!opts.opt)) -+ goto out; -+ opts.max_opt = PAGE_SIZE / sizeof(*opts.opt); -+ opts.flags = AuOpts_REMOUNT; -+ opts.sb_flags = *flags; -+ -+ /* parse it before aufs lock */ -+ err = au_opts_parse(sb, data, &opts); -+ if (unlikely(err)) -+ goto out_opts; -+ -+ sbinfo = au_sbi(sb); -+ inode = d_inode(root); -+ inode_lock(inode); -+ err = si_write_lock(sb, AuLock_FLUSH | AuLock_NOPLM); -+ if (unlikely(err)) -+ goto out_mtx; -+ di_write_lock_child(root); -+ -+ /* au_opts_remount() may return an error */ -+ err = au_opts_remount(sb, &opts); -+ au_opts_free(&opts); -+ -+ if (au_ftest_opts(opts.flags, REFRESH)) -+ au_remount_refresh(sb, au_ftest_opts(opts.flags, REFRESH_IDOP)); -+ -+ if (au_ftest_opts(opts.flags, REFRESH_DYAOP)) { -+ mntflags = au_mntflags(sb); -+ do_dx = !!au_opt_test(mntflags, DIO); -+ au_dy_arefresh(do_dx); -+ } -+ -+ au_fhsm_wrote_all(sb, /*force*/1); /* ?? */ -+ aufs_write_unlock(root); -+ -+out_mtx: -+ inode_unlock(inode); -+out_opts: -+ au_delayed_free_page((unsigned long)opts.opt); -+out: -+ err = cvt_err(err); -+ AuTraceErr(err); -+ return err; -+} -+ -+static const struct super_operations aufs_sop = { -+ .alloc_inode = aufs_alloc_inode, -+ .destroy_inode = aufs_destroy_inode, -+ /* always deleting, no clearing */ -+ .drop_inode = generic_delete_inode, -+ .show_options = aufs_show_options, -+ .statfs = aufs_statfs, -+ .put_super = aufs_put_super, -+ .sync_fs = aufs_sync_fs, -+ .remount_fs = aufs_remount_fs -+}; -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int alloc_root(struct super_block *sb) -+{ -+ int err; -+ struct inode *inode; -+ struct dentry *root; -+ -+ err = -ENOMEM; -+ inode = au_iget_locked(sb, AUFS_ROOT_INO); -+ err = PTR_ERR(inode); -+ if (IS_ERR(inode)) -+ goto out; -+ -+ inode->i_op = aufs_iop + AuIop_DIR; /* with getattr by default */ -+ inode->i_fop = &aufs_dir_fop; -+ inode->i_mode = S_IFDIR; -+ set_nlink(inode, 2); -+ unlock_new_inode(inode); -+ -+ root = d_make_root(inode); -+ if (unlikely(!root)) -+ goto out; -+ err = PTR_ERR(root); -+ if (IS_ERR(root)) -+ goto out; -+ -+ err = au_di_init(root); -+ if (!err) { -+ sb->s_root = root; -+ return 0; /* success */ -+ } -+ dput(root); -+ -+out: -+ return err; -+} -+ -+static int aufs_fill_super(struct super_block *sb, void *raw_data, -+ int silent __maybe_unused) -+{ -+ int err; -+ struct au_opts opts = { -+ .opt = NULL -+ }; -+ struct au_sbinfo *sbinfo; -+ struct dentry *root; -+ struct inode *inode; -+ char *arg = raw_data; -+ -+ if (unlikely(!arg || !*arg)) { -+ err = -EINVAL; -+ pr_err("no arg\n"); -+ goto out; -+ } -+ -+ err = -ENOMEM; -+ opts.opt = (void *)__get_free_page(GFP_NOFS); -+ if (unlikely(!opts.opt)) -+ goto out; -+ opts.max_opt = PAGE_SIZE / sizeof(*opts.opt); -+ opts.sb_flags = sb->s_flags; -+ -+ err = au_si_alloc(sb); -+ if (unlikely(err)) -+ goto out_opts; -+ sbinfo = au_sbi(sb); -+ -+ /* all timestamps always follow the ones on the branch */ -+ sb->s_flags |= MS_NOATIME | MS_NODIRATIME; -+ sb->s_op = &aufs_sop; -+ sb->s_d_op = &aufs_dop; -+ sb->s_magic = AUFS_SUPER_MAGIC; -+ sb->s_maxbytes = 0; -+ sb->s_stack_depth = 1; -+ au_export_init(sb); -+ /* au_xattr_init(sb); */ -+ -+ err = alloc_root(sb); -+ if (unlikely(err)) { -+ si_write_unlock(sb); -+ goto out_info; -+ } -+ root = sb->s_root; -+ inode = d_inode(root); -+ -+ /* -+ * actually we can parse options regardless aufs lock here. -+ * but at remount time, parsing must be done before aufs lock. -+ * so we follow the same rule. -+ */ -+ ii_write_lock_parent(inode); -+ aufs_write_unlock(root); -+ err = au_opts_parse(sb, arg, &opts); -+ if (unlikely(err)) -+ goto out_root; -+ -+ /* lock vfs_inode first, then aufs. */ -+ inode_lock(inode); -+ aufs_write_lock(root); -+ err = au_opts_mount(sb, &opts); -+ au_opts_free(&opts); -+ if (!err && au_ftest_si(sbinfo, NO_DREVAL)) { -+ sb->s_d_op = &aufs_dop_noreval; -+ pr_info("%pf\n", sb->s_d_op); -+ au_refresh_dop(root, /*force_reval*/0); -+ sbinfo->si_iop_array = aufs_iop_nogetattr; -+ au_refresh_iop(inode, /*force_getattr*/0); -+ } -+ aufs_write_unlock(root); -+ inode_unlock(inode); -+ if (!err) -+ goto out_opts; /* success */ -+ -+out_root: -+ dput(root); -+ sb->s_root = NULL; -+out_info: -+ dbgaufs_si_fin(sbinfo); -+ kobject_put(&sbinfo->si_kobj); -+ sb->s_fs_info = NULL; -+out_opts: -+ au_delayed_free_page((unsigned long)opts.opt); -+out: -+ AuTraceErr(err); -+ err = cvt_err(err); -+ AuTraceErr(err); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static struct dentry *aufs_mount(struct file_system_type *fs_type, int flags, -+ const char *dev_name __maybe_unused, -+ void *raw_data) -+{ -+ struct dentry *root; -+ struct super_block *sb; -+ -+ /* all timestamps always follow the ones on the branch */ -+ /* mnt->mnt_flags |= MNT_NOATIME | MNT_NODIRATIME; */ -+ root = mount_nodev(fs_type, flags, raw_data, aufs_fill_super); -+ if (IS_ERR(root)) -+ goto out; -+ -+ sb = root->d_sb; -+ si_write_lock(sb, !AuLock_FLUSH); -+ sysaufs_brs_add(sb, 0); -+ si_write_unlock(sb); -+ au_sbilist_add(sb); -+ -+out: -+ return root; -+} -+ -+static void aufs_kill_sb(struct super_block *sb) -+{ -+ struct au_sbinfo *sbinfo; -+ -+ sbinfo = au_sbi(sb); -+ if (sbinfo) { -+ au_sbilist_del(sb); -+ aufs_write_lock(sb->s_root); -+ au_fhsm_fin(sb); -+ if (sbinfo->si_wbr_create_ops->fin) -+ sbinfo->si_wbr_create_ops->fin(sb); -+ if (au_opt_test(sbinfo->si_mntflags, UDBA_HNOTIFY)) { -+ au_opt_set_udba(sbinfo->si_mntflags, UDBA_NONE); -+ au_remount_refresh(sb, /*do_idop*/0); -+ } -+ if (au_opt_test(sbinfo->si_mntflags, PLINK)) -+ au_plink_put(sb, /*verbose*/1); -+ au_xino_clr(sb); -+ sbinfo->si_sb = NULL; -+ aufs_write_unlock(sb->s_root); -+ au_nwt_flush(&sbinfo->si_nowait); -+ } -+ kill_anon_super(sb); -+} -+ -+struct file_system_type aufs_fs_type = { -+ .name = AUFS_FSTYPE, -+ /* a race between rename and others */ -+ .fs_flags = FS_RENAME_DOES_D_MOVE, -+ .mount = aufs_mount, -+ .kill_sb = aufs_kill_sb, -+ /* no need to __module_get() and module_put(). */ -+ .owner = THIS_MODULE, -+}; -diff --git a/fs/aufs/super.h b/fs/aufs/super.h -new file mode 100644 -index 0000000..e4ac866 ---- /dev/null -+++ b/fs/aufs/super.h -@@ -0,0 +1,625 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * super_block operations -+ */ -+ -+#ifndef __AUFS_SUPER_H__ -+#define __AUFS_SUPER_H__ -+ -+#ifdef __KERNEL__ -+ -+#include -+#include -+#include "rwsem.h" -+#include "spl.h" -+#include "wkq.h" -+ -+/* policies to select one among multiple writable branches */ -+struct au_wbr_copyup_operations { -+ int (*copyup)(struct dentry *dentry); -+}; -+ -+#define AuWbr_DIR 1 /* target is a dir */ -+#define AuWbr_PARENT (1 << 1) /* always require a parent */ -+ -+#define au_ftest_wbr(flags, name) ((flags) & AuWbr_##name) -+#define au_fset_wbr(flags, name) { (flags) |= AuWbr_##name; } -+#define au_fclr_wbr(flags, name) { (flags) &= ~AuWbr_##name; } -+ -+struct au_wbr_create_operations { -+ int (*create)(struct dentry *dentry, unsigned int flags); -+ int (*init)(struct super_block *sb); -+ int (*fin)(struct super_block *sb); -+}; -+ -+struct au_wbr_mfs { -+ struct mutex mfs_lock; /* protect this structure */ -+ unsigned long mfs_jiffy; -+ unsigned long mfs_expire; -+ aufs_bindex_t mfs_bindex; -+ -+ unsigned long long mfsrr_bytes; -+ unsigned long long mfsrr_watermark; -+}; -+ -+#define AuPlink_NHASH 100 -+static inline int au_plink_hash(ino_t ino) -+{ -+ return ino % AuPlink_NHASH; -+} -+ -+/* File-based Hierarchical Storage Management */ -+struct au_fhsm { -+#ifdef CONFIG_AUFS_FHSM -+ /* allow only one process who can receive the notification */ -+ spinlock_t fhsm_spin; -+ pid_t fhsm_pid; -+ wait_queue_head_t fhsm_wqh; -+ atomic_t fhsm_readable; -+ -+ /* these are protected by si_rwsem */ -+ unsigned long fhsm_expire; -+ aufs_bindex_t fhsm_bottom; -+#endif -+}; -+ -+#define AU_PIDSTEP (int)(BITS_TO_LONGS(PID_MAX_DEFAULT) * BITS_PER_LONG) -+#define AU_NPIDMAP (int)DIV_ROUND_UP(PID_MAX_LIMIT, AU_PIDSTEP) -+struct au_si_pid { -+ unsigned long *pid_bitmap[AU_NPIDMAP]; -+ struct mutex pid_mtx; -+}; -+ -+struct au_branch; -+struct au_sbinfo { -+ /* nowait tasks in the system-wide workqueue */ -+ struct au_nowait_tasks si_nowait; -+ -+ /* -+ * tried sb->s_umount, but failed due to the dependecy between i_mutex. -+ * rwsem for au_sbinfo is necessary. -+ */ -+ struct au_rwsem si_rwsem; -+ -+ /* prevent recursive locking in deleting inode */ -+ struct au_si_pid au_si_pid; -+ -+ /* -+ * dirty approach to protect sb->sb_inodes and ->s_files (gone) from -+ * remount. -+ */ -+ struct percpu_counter si_ninodes, si_nfiles; -+ -+ /* branch management */ -+ unsigned int si_generation; -+ -+ /* see AuSi_ flags */ -+ unsigned char au_si_status; -+ -+ aufs_bindex_t si_bbot; -+ -+ /* dirty trick to keep br_id plus */ -+ unsigned int si_last_br_id : -+ sizeof(aufs_bindex_t) * BITS_PER_BYTE - 1; -+ struct au_branch **si_branch; -+ -+ /* policy to select a writable branch */ -+ unsigned char si_wbr_copyup; -+ unsigned char si_wbr_create; -+ struct au_wbr_copyup_operations *si_wbr_copyup_ops; -+ struct au_wbr_create_operations *si_wbr_create_ops; -+ -+ /* round robin */ -+ atomic_t si_wbr_rr_next; -+ -+ /* most free space */ -+ struct au_wbr_mfs si_wbr_mfs; -+ -+ /* File-based Hierarchical Storage Management */ -+ struct au_fhsm si_fhsm; -+ -+ /* mount flags */ -+ /* include/asm-ia64/siginfo.h defines a macro named si_flags */ -+ unsigned int si_mntflags; -+ -+ /* external inode number (bitmap and translation table) */ -+ vfs_readf_t si_xread; -+ vfs_writef_t si_xwrite; -+ struct file *si_xib; -+ struct mutex si_xib_mtx; /* protect xib members */ -+ unsigned long *si_xib_buf; -+ unsigned long si_xib_last_pindex; -+ int si_xib_next_bit; -+ aufs_bindex_t si_xino_brid; -+ unsigned long si_xino_jiffy; -+ unsigned long si_xino_expire; -+ /* reserved for future use */ -+ /* unsigned long long si_xib_limit; */ /* Max xib file size */ -+ -+#ifdef CONFIG_AUFS_EXPORT -+ /* i_generation */ -+ struct file *si_xigen; -+ atomic_t si_xigen_next; -+#endif -+ -+ /* dirty trick to suppoer atomic_open */ -+ struct au_sphlhead si_aopen; -+ -+ /* vdir parameters */ -+ unsigned long si_rdcache; /* max cache time in jiffies */ -+ unsigned int si_rdblk; /* deblk size */ -+ unsigned int si_rdhash; /* hash size */ -+ -+ /* -+ * If the number of whiteouts are larger than si_dirwh, leave all of -+ * them after au_whtmp_ren to reduce the cost of rmdir(2). -+ * future fsck.aufs or kernel thread will remove them later. -+ * Otherwise, remove all whiteouts and the dir in rmdir(2). -+ */ -+ unsigned int si_dirwh; -+ -+ /* pseudo_link list */ -+ struct au_sphlhead si_plink[AuPlink_NHASH]; -+ wait_queue_head_t si_plink_wq; -+ spinlock_t si_plink_maint_lock; -+ pid_t si_plink_maint_pid; -+ -+ /* file list */ -+ struct au_sphlhead si_files; -+ -+ /* with/without getattr, brother of sb->s_d_op */ -+ struct inode_operations *si_iop_array; -+ -+ /* -+ * sysfs and lifetime management. -+ * this is not a small structure and it may be a waste of memory in case -+ * of sysfs is disabled, particulary when many aufs-es are mounted. -+ * but using sysfs is majority. -+ */ -+ struct kobject si_kobj; -+#ifdef CONFIG_DEBUG_FS -+ struct dentry *si_dbgaufs; -+ struct dentry *si_dbgaufs_plink; -+ struct dentry *si_dbgaufs_xib; -+#ifdef CONFIG_AUFS_EXPORT -+ struct dentry *si_dbgaufs_xigen; -+#endif -+#endif -+ -+#ifdef CONFIG_AUFS_SBILIST -+ struct hlist_node si_list; -+#endif -+ -+ /* dirty, necessary for unmounting, sysfs and sysrq */ -+ struct super_block *si_sb; -+}; -+ -+/* sbinfo status flags */ -+/* -+ * set true when refresh_dirs() failed at remount time. -+ * then try refreshing dirs at access time again. -+ * if it is false, refreshing dirs at access time is unnecesary -+ */ -+#define AuSi_FAILED_REFRESH_DIR 1 -+#define AuSi_FHSM (1 << 1) /* fhsm is active now */ -+#define AuSi_NO_DREVAL (1 << 2) /* disable all d_revalidate */ -+ -+#ifndef CONFIG_AUFS_FHSM -+#undef AuSi_FHSM -+#define AuSi_FHSM 0 -+#endif -+ -+static inline unsigned char au_do_ftest_si(struct au_sbinfo *sbi, -+ unsigned int flag) -+{ -+ AuRwMustAnyLock(&sbi->si_rwsem); -+ return sbi->au_si_status & flag; -+} -+#define au_ftest_si(sbinfo, name) au_do_ftest_si(sbinfo, AuSi_##name) -+#define au_fset_si(sbinfo, name) do { \ -+ AuRwMustWriteLock(&(sbinfo)->si_rwsem); \ -+ (sbinfo)->au_si_status |= AuSi_##name; \ -+} while (0) -+#define au_fclr_si(sbinfo, name) do { \ -+ AuRwMustWriteLock(&(sbinfo)->si_rwsem); \ -+ (sbinfo)->au_si_status &= ~AuSi_##name; \ -+} while (0) -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* policy to select one among writable branches */ -+#define AuWbrCopyup(sbinfo, ...) \ -+ ((sbinfo)->si_wbr_copyup_ops->copyup(__VA_ARGS__)) -+#define AuWbrCreate(sbinfo, ...) \ -+ ((sbinfo)->si_wbr_create_ops->create(__VA_ARGS__)) -+ -+/* flags for si_read_lock()/aufs_read_lock()/di_read_lock() */ -+#define AuLock_DW 1 /* write-lock dentry */ -+#define AuLock_IR (1 << 1) /* read-lock inode */ -+#define AuLock_IW (1 << 2) /* write-lock inode */ -+#define AuLock_FLUSH (1 << 3) /* wait for 'nowait' tasks */ -+#define AuLock_DIRS (1 << 4) /* target is a pair of dirs */ -+#define AuLock_NOPLM (1 << 5) /* return err in plm mode */ -+#define AuLock_NOPLMW (1 << 6) /* wait for plm mode ends */ -+#define AuLock_GEN (1 << 7) /* test digen/iigen */ -+#define au_ftest_lock(flags, name) ((flags) & AuLock_##name) -+#define au_fset_lock(flags, name) \ -+ do { (flags) |= AuLock_##name; } while (0) -+#define au_fclr_lock(flags, name) \ -+ do { (flags) &= ~AuLock_##name; } while (0) -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* super.c */ -+extern struct file_system_type aufs_fs_type; -+struct inode *au_iget_locked(struct super_block *sb, ino_t ino); -+typedef unsigned long long (*au_arraycb_t)(struct super_block *sb, void *array, -+ unsigned long long max, void *arg); -+void *au_array_alloc(unsigned long long *hint, au_arraycb_t cb, -+ struct super_block *sb, void *arg); -+struct inode **au_iarray_alloc(struct super_block *sb, unsigned long long *max); -+void au_iarray_free(struct inode **a, unsigned long long max); -+ -+/* sbinfo.c */ -+void au_si_free(struct kobject *kobj); -+int au_si_alloc(struct super_block *sb); -+int au_sbr_realloc(struct au_sbinfo *sbinfo, int nbr, int may_shrink); -+ -+unsigned int au_sigen_inc(struct super_block *sb); -+aufs_bindex_t au_new_br_id(struct super_block *sb); -+ -+int si_read_lock(struct super_block *sb, int flags); -+int si_write_lock(struct super_block *sb, int flags); -+int aufs_read_lock(struct dentry *dentry, int flags); -+void aufs_read_unlock(struct dentry *dentry, int flags); -+void aufs_write_lock(struct dentry *dentry); -+void aufs_write_unlock(struct dentry *dentry); -+int aufs_read_and_write_lock2(struct dentry *d1, struct dentry *d2, int flags); -+void aufs_read_and_write_unlock2(struct dentry *d1, struct dentry *d2); -+ -+/* wbr_policy.c */ -+extern struct au_wbr_copyup_operations au_wbr_copyup_ops[]; -+extern struct au_wbr_create_operations au_wbr_create_ops[]; -+int au_cpdown_dirs(struct dentry *dentry, aufs_bindex_t bdst); -+int au_wbr_nonopq(struct dentry *dentry, aufs_bindex_t bindex); -+int au_wbr_do_copyup_bu(struct dentry *dentry, aufs_bindex_t btop); -+ -+/* mvdown.c */ -+int au_mvdown(struct dentry *dentry, struct aufs_mvdown __user *arg); -+ -+#ifdef CONFIG_AUFS_FHSM -+/* fhsm.c */ -+ -+static inline pid_t au_fhsm_pid(struct au_fhsm *fhsm) -+{ -+ pid_t pid; -+ -+ spin_lock(&fhsm->fhsm_spin); -+ pid = fhsm->fhsm_pid; -+ spin_unlock(&fhsm->fhsm_spin); -+ -+ return pid; -+} -+ -+void au_fhsm_wrote(struct super_block *sb, aufs_bindex_t bindex, int force); -+void au_fhsm_wrote_all(struct super_block *sb, int force); -+int au_fhsm_fd(struct super_block *sb, int oflags); -+int au_fhsm_br_alloc(struct au_branch *br); -+void au_fhsm_set_bottom(struct super_block *sb, aufs_bindex_t bindex); -+void au_fhsm_fin(struct super_block *sb); -+void au_fhsm_init(struct au_sbinfo *sbinfo); -+void au_fhsm_set(struct au_sbinfo *sbinfo, unsigned int sec); -+void au_fhsm_show(struct seq_file *seq, struct au_sbinfo *sbinfo); -+#else -+AuStubVoid(au_fhsm_wrote, struct super_block *sb, aufs_bindex_t bindex, -+ int force) -+AuStubVoid(au_fhsm_wrote_all, struct super_block *sb, int force) -+AuStub(int, au_fhsm_fd, return -EOPNOTSUPP, struct super_block *sb, int oflags) -+AuStub(pid_t, au_fhsm_pid, return 0, struct au_fhsm *fhsm) -+AuStubInt0(au_fhsm_br_alloc, struct au_branch *br) -+AuStubVoid(au_fhsm_set_bottom, struct super_block *sb, aufs_bindex_t bindex) -+AuStubVoid(au_fhsm_fin, struct super_block *sb) -+AuStubVoid(au_fhsm_init, struct au_sbinfo *sbinfo) -+AuStubVoid(au_fhsm_set, struct au_sbinfo *sbinfo, unsigned int sec) -+AuStubVoid(au_fhsm_show, struct seq_file *seq, struct au_sbinfo *sbinfo) -+#endif -+ -+/* ---------------------------------------------------------------------- */ -+ -+static inline struct au_sbinfo *au_sbi(struct super_block *sb) -+{ -+ return sb->s_fs_info; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+#ifdef CONFIG_AUFS_EXPORT -+int au_test_nfsd(void); -+void au_export_init(struct super_block *sb); -+void au_xigen_inc(struct inode *inode); -+int au_xigen_new(struct inode *inode); -+int au_xigen_set(struct super_block *sb, struct file *base); -+void au_xigen_clr(struct super_block *sb); -+ -+static inline int au_busy_or_stale(void) -+{ -+ if (!au_test_nfsd()) -+ return -EBUSY; -+ return -ESTALE; -+} -+#else -+AuStubInt0(au_test_nfsd, void) -+AuStubVoid(au_export_init, struct super_block *sb) -+AuStubVoid(au_xigen_inc, struct inode *inode) -+AuStubInt0(au_xigen_new, struct inode *inode) -+AuStubInt0(au_xigen_set, struct super_block *sb, struct file *base) -+AuStubVoid(au_xigen_clr, struct super_block *sb) -+AuStub(int, au_busy_or_stale, return -EBUSY, void) -+#endif /* CONFIG_AUFS_EXPORT */ -+ -+/* ---------------------------------------------------------------------- */ -+ -+#ifdef CONFIG_AUFS_SBILIST -+/* module.c */ -+extern struct au_sphlhead au_sbilist; -+ -+static inline void au_sbilist_init(void) -+{ -+ au_sphl_init(&au_sbilist); -+} -+ -+static inline void au_sbilist_add(struct super_block *sb) -+{ -+ au_sphl_add(&au_sbi(sb)->si_list, &au_sbilist); -+} -+ -+static inline void au_sbilist_del(struct super_block *sb) -+{ -+ au_sphl_del(&au_sbi(sb)->si_list, &au_sbilist); -+} -+ -+#ifdef CONFIG_AUFS_MAGIC_SYSRQ -+static inline void au_sbilist_lock(void) -+{ -+ spin_lock(&au_sbilist.spin); -+} -+ -+static inline void au_sbilist_unlock(void) -+{ -+ spin_unlock(&au_sbilist.spin); -+} -+#define AuGFP_SBILIST GFP_ATOMIC -+#else -+AuStubVoid(au_sbilist_lock, void) -+AuStubVoid(au_sbilist_unlock, void) -+#define AuGFP_SBILIST GFP_NOFS -+#endif /* CONFIG_AUFS_MAGIC_SYSRQ */ -+#else -+AuStubVoid(au_sbilist_init, void) -+AuStubVoid(au_sbilist_add, struct super_block *sb) -+AuStubVoid(au_sbilist_del, struct super_block *sb) -+AuStubVoid(au_sbilist_lock, void) -+AuStubVoid(au_sbilist_unlock, void) -+#define AuGFP_SBILIST GFP_NOFS -+#endif -+ -+/* ---------------------------------------------------------------------- */ -+ -+static inline void dbgaufs_si_null(struct au_sbinfo *sbinfo) -+{ -+ /* -+ * This function is a dynamic '__init' function actually, -+ * so the tiny check for si_rwsem is unnecessary. -+ */ -+ /* AuRwMustWriteLock(&sbinfo->si_rwsem); */ -+#ifdef CONFIG_DEBUG_FS -+ sbinfo->si_dbgaufs = NULL; -+ sbinfo->si_dbgaufs_plink = NULL; -+ sbinfo->si_dbgaufs_xib = NULL; -+#ifdef CONFIG_AUFS_EXPORT -+ sbinfo->si_dbgaufs_xigen = NULL; -+#endif -+#endif -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static inline void si_pid_idx_bit(int *idx, pid_t *bit) -+{ -+ /* the origin of pid is 1, but the bitmap's is 0 */ -+ *bit = current->pid - 1; -+ *idx = *bit / AU_PIDSTEP; -+ *bit %= AU_PIDSTEP; -+} -+ -+static inline int si_pid_test(struct super_block *sb) -+{ -+ pid_t bit; -+ int idx; -+ unsigned long *bitmap; -+ -+ si_pid_idx_bit(&idx, &bit); -+ bitmap = au_sbi(sb)->au_si_pid.pid_bitmap[idx]; -+ if (bitmap) -+ return test_bit(bit, bitmap); -+ return 0; -+} -+ -+static inline void si_pid_clr(struct super_block *sb) -+{ -+ pid_t bit; -+ int idx; -+ unsigned long *bitmap; -+ -+ si_pid_idx_bit(&idx, &bit); -+ bitmap = au_sbi(sb)->au_si_pid.pid_bitmap[idx]; -+ BUG_ON(!bitmap); -+ AuDebugOn(!test_bit(bit, bitmap)); -+ clear_bit(bit, bitmap); -+ /* smp_mb(); */ -+} -+ -+void si_pid_set(struct super_block *sb); -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* lock superblock. mainly for entry point functions */ -+/* -+ * __si_read_lock, __si_write_lock, -+ * __si_read_unlock, __si_write_unlock, __si_downgrade_lock -+ */ -+AuSimpleRwsemFuncs(__si, struct super_block *sb, &au_sbi(sb)->si_rwsem); -+ -+#define SiMustNoWaiters(sb) AuRwMustNoWaiters(&au_sbi(sb)->si_rwsem) -+#define SiMustAnyLock(sb) AuRwMustAnyLock(&au_sbi(sb)->si_rwsem) -+#define SiMustWriteLock(sb) AuRwMustWriteLock(&au_sbi(sb)->si_rwsem) -+ -+static inline void si_noflush_read_lock(struct super_block *sb) -+{ -+ __si_read_lock(sb); -+ si_pid_set(sb); -+} -+ -+static inline int si_noflush_read_trylock(struct super_block *sb) -+{ -+ int locked; -+ -+ locked = __si_read_trylock(sb); -+ if (locked) -+ si_pid_set(sb); -+ return locked; -+} -+ -+static inline void si_noflush_write_lock(struct super_block *sb) -+{ -+ __si_write_lock(sb); -+ si_pid_set(sb); -+} -+ -+static inline int si_noflush_write_trylock(struct super_block *sb) -+{ -+ int locked; -+ -+ locked = __si_write_trylock(sb); -+ if (locked) -+ si_pid_set(sb); -+ return locked; -+} -+ -+#if 0 /* reserved */ -+static inline int si_read_trylock(struct super_block *sb, int flags) -+{ -+ if (au_ftest_lock(flags, FLUSH)) -+ au_nwt_flush(&au_sbi(sb)->si_nowait); -+ return si_noflush_read_trylock(sb); -+} -+#endif -+ -+static inline void si_read_unlock(struct super_block *sb) -+{ -+ si_pid_clr(sb); -+ __si_read_unlock(sb); -+} -+ -+#if 0 /* reserved */ -+static inline int si_write_trylock(struct super_block *sb, int flags) -+{ -+ if (au_ftest_lock(flags, FLUSH)) -+ au_nwt_flush(&au_sbi(sb)->si_nowait); -+ return si_noflush_write_trylock(sb); -+} -+#endif -+ -+static inline void si_write_unlock(struct super_block *sb) -+{ -+ si_pid_clr(sb); -+ __si_write_unlock(sb); -+} -+ -+#if 0 /* reserved */ -+static inline void si_downgrade_lock(struct super_block *sb) -+{ -+ __si_downgrade_lock(sb); -+} -+#endif -+ -+/* ---------------------------------------------------------------------- */ -+ -+static inline aufs_bindex_t au_sbbot(struct super_block *sb) -+{ -+ SiMustAnyLock(sb); -+ return au_sbi(sb)->si_bbot; -+} -+ -+static inline unsigned int au_mntflags(struct super_block *sb) -+{ -+ SiMustAnyLock(sb); -+ return au_sbi(sb)->si_mntflags; -+} -+ -+static inline unsigned int au_sigen(struct super_block *sb) -+{ -+ SiMustAnyLock(sb); -+ return au_sbi(sb)->si_generation; -+} -+ -+static inline unsigned long long au_ninodes(struct super_block *sb) -+{ -+ s64 n = percpu_counter_sum(&au_sbi(sb)->si_ninodes); -+ -+ BUG_ON(n < 0); -+ return n; -+} -+ -+static inline void au_ninodes_inc(struct super_block *sb) -+{ -+ percpu_counter_inc(&au_sbi(sb)->si_ninodes); -+} -+ -+static inline void au_ninodes_dec(struct super_block *sb) -+{ -+ percpu_counter_dec(&au_sbi(sb)->si_ninodes); -+} -+ -+static inline unsigned long long au_nfiles(struct super_block *sb) -+{ -+ s64 n = percpu_counter_sum(&au_sbi(sb)->si_nfiles); -+ -+ BUG_ON(n < 0); -+ return n; -+} -+ -+static inline void au_nfiles_inc(struct super_block *sb) -+{ -+ percpu_counter_inc(&au_sbi(sb)->si_nfiles); -+} -+ -+static inline void au_nfiles_dec(struct super_block *sb) -+{ -+ percpu_counter_dec(&au_sbi(sb)->si_nfiles); -+} -+ -+static inline struct au_branch *au_sbr(struct super_block *sb, -+ aufs_bindex_t bindex) -+{ -+ SiMustAnyLock(sb); -+ return au_sbi(sb)->si_branch[0 + bindex]; -+} -+ -+static inline void au_xino_brid_set(struct super_block *sb, aufs_bindex_t brid) -+{ -+ SiMustWriteLock(sb); -+ au_sbi(sb)->si_xino_brid = brid; -+} -+ -+static inline aufs_bindex_t au_xino_brid(struct super_block *sb) -+{ -+ SiMustAnyLock(sb); -+ return au_sbi(sb)->si_xino_brid; -+} -+ -+#endif /* __KERNEL__ */ -+#endif /* __AUFS_SUPER_H__ */ -diff --git a/fs/aufs/sysaufs.c b/fs/aufs/sysaufs.c -new file mode 100644 -index 0000000..8ec10fb3 ---- /dev/null -+++ b/fs/aufs/sysaufs.c -@@ -0,0 +1,91 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * sysfs interface and lifetime management -+ * they are necessary regardless sysfs is disabled. -+ */ -+ -+#include -+#include "aufs.h" -+ -+unsigned long sysaufs_si_mask; -+struct kset *sysaufs_kset; -+ -+#define AuSiAttr(_name) { \ -+ .attr = { .name = __stringify(_name), .mode = 0444 }, \ -+ .show = sysaufs_si_##_name, \ -+} -+ -+static struct sysaufs_si_attr sysaufs_si_attr_xi_path = AuSiAttr(xi_path); -+struct attribute *sysaufs_si_attrs[] = { -+ &sysaufs_si_attr_xi_path.attr, -+ NULL, -+}; -+ -+static const struct sysfs_ops au_sbi_ops = { -+ .show = sysaufs_si_show -+}; -+ -+static struct kobj_type au_sbi_ktype = { -+ .release = au_si_free, -+ .sysfs_ops = &au_sbi_ops, -+ .default_attrs = sysaufs_si_attrs -+}; -+ -+/* ---------------------------------------------------------------------- */ -+ -+int sysaufs_si_init(struct au_sbinfo *sbinfo) -+{ -+ int err; -+ -+ sbinfo->si_kobj.kset = sysaufs_kset; -+ /* cf. sysaufs_name() */ -+ err = kobject_init_and_add -+ (&sbinfo->si_kobj, &au_sbi_ktype, /*&sysaufs_kset->kobj*/NULL, -+ SysaufsSiNamePrefix "%lx", sysaufs_si_id(sbinfo)); -+ -+ dbgaufs_si_null(sbinfo); -+ if (!err) { -+ err = dbgaufs_si_init(sbinfo); -+ if (unlikely(err)) -+ kobject_put(&sbinfo->si_kobj); -+ } -+ return err; -+} -+ -+void sysaufs_fin(void) -+{ -+ dbgaufs_fin(); -+ sysfs_remove_group(&sysaufs_kset->kobj, sysaufs_attr_group); -+ kset_unregister(sysaufs_kset); -+} -+ -+int __init sysaufs_init(void) -+{ -+ int err; -+ -+ do { -+ get_random_bytes(&sysaufs_si_mask, sizeof(sysaufs_si_mask)); -+ } while (!sysaufs_si_mask); -+ -+ err = -EINVAL; -+ sysaufs_kset = kset_create_and_add(AUFS_NAME, NULL, fs_kobj); -+ if (unlikely(!sysaufs_kset)) -+ goto out; -+ err = PTR_ERR(sysaufs_kset); -+ if (IS_ERR(sysaufs_kset)) -+ goto out; -+ err = sysfs_create_group(&sysaufs_kset->kobj, sysaufs_attr_group); -+ if (unlikely(err)) { -+ kset_unregister(sysaufs_kset); -+ goto out; -+ } -+ -+ err = dbgaufs_init(); -+ if (unlikely(err)) -+ sysaufs_fin(); -+out: -+ return err; -+} -diff --git a/fs/aufs/sysaufs.h b/fs/aufs/sysaufs.h -new file mode 100644 -index 0000000..1f79983 ---- /dev/null -+++ b/fs/aufs/sysaufs.h -@@ -0,0 +1,88 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * sysfs interface and mount lifetime management -+ */ -+ -+#ifndef __SYSAUFS_H__ -+#define __SYSAUFS_H__ -+ -+#ifdef __KERNEL__ -+ -+#include -+#include "module.h" -+ -+struct super_block; -+struct au_sbinfo; -+ -+struct sysaufs_si_attr { -+ struct attribute attr; -+ int (*show)(struct seq_file *seq, struct super_block *sb); -+}; -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* sysaufs.c */ -+extern unsigned long sysaufs_si_mask; -+extern struct kset *sysaufs_kset; -+extern struct attribute *sysaufs_si_attrs[]; -+int sysaufs_si_init(struct au_sbinfo *sbinfo); -+int __init sysaufs_init(void); -+void sysaufs_fin(void); -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* some people doesn't like to show a pointer in kernel */ -+static inline unsigned long sysaufs_si_id(struct au_sbinfo *sbinfo) -+{ -+ return sysaufs_si_mask ^ (unsigned long)sbinfo; -+} -+ -+#define SysaufsSiNamePrefix "si_" -+#define SysaufsSiNameLen (sizeof(SysaufsSiNamePrefix) + 16) -+static inline void sysaufs_name(struct au_sbinfo *sbinfo, char *name) -+{ -+ snprintf(name, SysaufsSiNameLen, SysaufsSiNamePrefix "%lx", -+ sysaufs_si_id(sbinfo)); -+} -+ -+struct au_branch; -+#ifdef CONFIG_SYSFS -+/* sysfs.c */ -+extern struct attribute_group *sysaufs_attr_group; -+ -+int sysaufs_si_xi_path(struct seq_file *seq, struct super_block *sb); -+ssize_t sysaufs_si_show(struct kobject *kobj, struct attribute *attr, -+ char *buf); -+long au_brinfo_ioctl(struct file *file, unsigned long arg); -+#ifdef CONFIG_COMPAT -+long au_brinfo_compat_ioctl(struct file *file, unsigned long arg); -+#endif -+ -+void sysaufs_br_init(struct au_branch *br); -+void sysaufs_brs_add(struct super_block *sb, aufs_bindex_t bindex); -+void sysaufs_brs_del(struct super_block *sb, aufs_bindex_t bindex); -+ -+#define sysaufs_brs_init() do {} while (0) -+ -+#else -+#define sysaufs_attr_group NULL -+ -+AuStubInt0(sysaufs_si_xi_path, struct seq_file *seq, struct super_block *sb) -+AuStub(ssize_t, sysaufs_si_show, return 0, struct kobject *kobj, -+ struct attribute *attr, char *buf) -+AuStubVoid(sysaufs_br_init, struct au_branch *br) -+AuStubVoid(sysaufs_brs_add, struct super_block *sb, aufs_bindex_t bindex) -+AuStubVoid(sysaufs_brs_del, struct super_block *sb, aufs_bindex_t bindex) -+ -+static inline void sysaufs_brs_init(void) -+{ -+ sysaufs_brs = 0; -+} -+ -+#endif /* CONFIG_SYSFS */ -+ -+#endif /* __KERNEL__ */ -+#endif /* __SYSAUFS_H__ */ -diff --git a/fs/aufs/sysfs.c b/fs/aufs/sysfs.c -new file mode 100644 -index 0000000..f4c3170 ---- /dev/null -+++ b/fs/aufs/sysfs.c -@@ -0,0 +1,340 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * sysfs interface -+ */ -+ -+#include -+#include -+#include "aufs.h" -+ -+static struct attribute *au_attr[] = { -+ NULL, /* need to NULL terminate the list of attributes */ -+}; -+ -+static struct attribute_group sysaufs_attr_group_body = { -+ .attrs = au_attr -+}; -+ -+struct attribute_group *sysaufs_attr_group = &sysaufs_attr_group_body; -+ -+/* ---------------------------------------------------------------------- */ -+ -+int sysaufs_si_xi_path(struct seq_file *seq, struct super_block *sb) -+{ -+ int err; -+ -+ SiMustAnyLock(sb); -+ -+ err = 0; -+ if (au_opt_test(au_mntflags(sb), XINO)) { -+ err = au_xino_path(seq, au_sbi(sb)->si_xib); -+ seq_putc(seq, '\n'); -+ } -+ return err; -+} -+ -+/* -+ * the lifetime of branch is independent from the entry under sysfs. -+ * sysfs handles the lifetime of the entry, and never call ->show() after it is -+ * unlinked. -+ */ -+static int sysaufs_si_br(struct seq_file *seq, struct super_block *sb, -+ aufs_bindex_t bindex, int idx) -+{ -+ int err; -+ struct path path; -+ struct dentry *root; -+ struct au_branch *br; -+ au_br_perm_str_t perm; -+ -+ AuDbg("b%d\n", bindex); -+ -+ err = 0; -+ root = sb->s_root; -+ di_read_lock_parent(root, !AuLock_IR); -+ br = au_sbr(sb, bindex); -+ -+ switch (idx) { -+ case AuBrSysfs_BR: -+ path.mnt = au_br_mnt(br); -+ path.dentry = au_h_dptr(root, bindex); -+ err = au_seq_path(seq, &path); -+ if (!err) { -+ au_optstr_br_perm(&perm, br->br_perm); -+ seq_printf(seq, "=%s\n", perm.a); -+ } -+ break; -+ case AuBrSysfs_BRID: -+ seq_printf(seq, "%d\n", br->br_id); -+ break; -+ } -+ di_read_unlock(root, !AuLock_IR); -+ if (unlikely(err || seq_has_overflowed(seq))) -+ err = -E2BIG; -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static struct seq_file *au_seq(char *p, ssize_t len) -+{ -+ struct seq_file *seq; -+ -+ seq = kzalloc(sizeof(*seq), GFP_NOFS); -+ if (seq) { -+ /* mutex_init(&seq.lock); */ -+ seq->buf = p; -+ seq->size = len; -+ return seq; /* success */ -+ } -+ -+ seq = ERR_PTR(-ENOMEM); -+ return seq; -+} -+ -+#define SysaufsBr_PREFIX "br" -+#define SysaufsBrid_PREFIX "brid" -+ -+/* todo: file size may exceed PAGE_SIZE */ -+ssize_t sysaufs_si_show(struct kobject *kobj, struct attribute *attr, -+ char *buf) -+{ -+ ssize_t err; -+ int idx; -+ long l; -+ aufs_bindex_t bbot; -+ struct au_sbinfo *sbinfo; -+ struct super_block *sb; -+ struct seq_file *seq; -+ char *name; -+ struct attribute **cattr; -+ -+ sbinfo = container_of(kobj, struct au_sbinfo, si_kobj); -+ sb = sbinfo->si_sb; -+ -+ /* -+ * prevent a race condition between sysfs and aufs. -+ * for instance, sysfs_file_read() calls sysfs_get_active_two() which -+ * prohibits maintaining the sysfs entries. -+ * hew we acquire read lock after sysfs_get_active_two(). -+ * on the other hand, the remount process may maintain the sysfs/aufs -+ * entries after acquiring write lock. -+ * it can cause a deadlock. -+ * simply we gave up processing read here. -+ */ -+ err = -EBUSY; -+ if (unlikely(!si_noflush_read_trylock(sb))) -+ goto out; -+ -+ seq = au_seq(buf, PAGE_SIZE); -+ err = PTR_ERR(seq); -+ if (IS_ERR(seq)) -+ goto out_unlock; -+ -+ name = (void *)attr->name; -+ cattr = sysaufs_si_attrs; -+ while (*cattr) { -+ if (!strcmp(name, (*cattr)->name)) { -+ err = container_of(*cattr, struct sysaufs_si_attr, attr) -+ ->show(seq, sb); -+ goto out_seq; -+ } -+ cattr++; -+ } -+ -+ if (!strncmp(name, SysaufsBrid_PREFIX, -+ sizeof(SysaufsBrid_PREFIX) - 1)) { -+ idx = AuBrSysfs_BRID; -+ name += sizeof(SysaufsBrid_PREFIX) - 1; -+ } else if (!strncmp(name, SysaufsBr_PREFIX, -+ sizeof(SysaufsBr_PREFIX) - 1)) { -+ idx = AuBrSysfs_BR; -+ name += sizeof(SysaufsBr_PREFIX) - 1; -+ } else -+ BUG(); -+ -+ err = kstrtol(name, 10, &l); -+ if (!err) { -+ bbot = au_sbbot(sb); -+ if (l <= bbot) -+ err = sysaufs_si_br(seq, sb, (aufs_bindex_t)l, idx); -+ else -+ err = -ENOENT; -+ } -+ -+out_seq: -+ if (!err) { -+ err = seq->count; -+ /* sysfs limit */ -+ if (unlikely(err == PAGE_SIZE)) -+ err = -EFBIG; -+ } -+ au_delayed_kfree(seq); -+out_unlock: -+ si_read_unlock(sb); -+out: -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int au_brinfo(struct super_block *sb, union aufs_brinfo __user *arg) -+{ -+ int err; -+ int16_t brid; -+ aufs_bindex_t bindex, bbot; -+ size_t sz; -+ char *buf; -+ struct seq_file *seq; -+ struct au_branch *br; -+ -+ si_read_lock(sb, AuLock_FLUSH); -+ bbot = au_sbbot(sb); -+ err = bbot + 1; -+ if (!arg) -+ goto out; -+ -+ err = -ENOMEM; -+ buf = (void *)__get_free_page(GFP_NOFS); -+ if (unlikely(!buf)) -+ goto out; -+ -+ seq = au_seq(buf, PAGE_SIZE); -+ err = PTR_ERR(seq); -+ if (IS_ERR(seq)) -+ goto out_buf; -+ -+ sz = sizeof(*arg) - offsetof(union aufs_brinfo, path); -+ for (bindex = 0; bindex <= bbot; bindex++, arg++) { -+ err = !access_ok(VERIFY_WRITE, arg, sizeof(*arg)); -+ if (unlikely(err)) -+ break; -+ -+ br = au_sbr(sb, bindex); -+ brid = br->br_id; -+ BUILD_BUG_ON(sizeof(brid) != sizeof(arg->id)); -+ err = __put_user(brid, &arg->id); -+ if (unlikely(err)) -+ break; -+ -+ BUILD_BUG_ON(sizeof(br->br_perm) != sizeof(arg->perm)); -+ err = __put_user(br->br_perm, &arg->perm); -+ if (unlikely(err)) -+ break; -+ -+ err = au_seq_path(seq, &br->br_path); -+ if (unlikely(err)) -+ break; -+ seq_putc(seq, '\0'); -+ if (!seq_has_overflowed(seq)) { -+ err = copy_to_user(arg->path, seq->buf, seq->count); -+ seq->count = 0; -+ if (unlikely(err)) -+ break; -+ } else { -+ err = -E2BIG; -+ goto out_seq; -+ } -+ } -+ if (unlikely(err)) -+ err = -EFAULT; -+ -+out_seq: -+ au_delayed_kfree(seq); -+out_buf: -+ au_delayed_free_page((unsigned long)buf); -+out: -+ si_read_unlock(sb); -+ return err; -+} -+ -+long au_brinfo_ioctl(struct file *file, unsigned long arg) -+{ -+ return au_brinfo(file->f_path.dentry->d_sb, (void __user *)arg); -+} -+ -+#ifdef CONFIG_COMPAT -+long au_brinfo_compat_ioctl(struct file *file, unsigned long arg) -+{ -+ return au_brinfo(file->f_path.dentry->d_sb, compat_ptr(arg)); -+} -+#endif -+ -+/* ---------------------------------------------------------------------- */ -+ -+void sysaufs_br_init(struct au_branch *br) -+{ -+ int i; -+ struct au_brsysfs *br_sysfs; -+ struct attribute *attr; -+ -+ br_sysfs = br->br_sysfs; -+ for (i = 0; i < ARRAY_SIZE(br->br_sysfs); i++) { -+ attr = &br_sysfs->attr; -+ sysfs_attr_init(attr); -+ attr->name = br_sysfs->name; -+ attr->mode = S_IRUGO; -+ br_sysfs++; -+ } -+} -+ -+void sysaufs_brs_del(struct super_block *sb, aufs_bindex_t bindex) -+{ -+ struct au_branch *br; -+ struct kobject *kobj; -+ struct au_brsysfs *br_sysfs; -+ int i; -+ aufs_bindex_t bbot; -+ -+ dbgaufs_brs_del(sb, bindex); -+ -+ if (!sysaufs_brs) -+ return; -+ -+ kobj = &au_sbi(sb)->si_kobj; -+ bbot = au_sbbot(sb); -+ for (; bindex <= bbot; bindex++) { -+ br = au_sbr(sb, bindex); -+ br_sysfs = br->br_sysfs; -+ for (i = 0; i < ARRAY_SIZE(br->br_sysfs); i++) { -+ sysfs_remove_file(kobj, &br_sysfs->attr); -+ br_sysfs++; -+ } -+ } -+} -+ -+void sysaufs_brs_add(struct super_block *sb, aufs_bindex_t bindex) -+{ -+ int err, i; -+ aufs_bindex_t bbot; -+ struct kobject *kobj; -+ struct au_branch *br; -+ struct au_brsysfs *br_sysfs; -+ -+ dbgaufs_brs_add(sb, bindex); -+ -+ if (!sysaufs_brs) -+ return; -+ -+ kobj = &au_sbi(sb)->si_kobj; -+ bbot = au_sbbot(sb); -+ for (; bindex <= bbot; bindex++) { -+ br = au_sbr(sb, bindex); -+ br_sysfs = br->br_sysfs; -+ snprintf(br_sysfs[AuBrSysfs_BR].name, sizeof(br_sysfs->name), -+ SysaufsBr_PREFIX "%d", bindex); -+ snprintf(br_sysfs[AuBrSysfs_BRID].name, sizeof(br_sysfs->name), -+ SysaufsBrid_PREFIX "%d", bindex); -+ for (i = 0; i < ARRAY_SIZE(br->br_sysfs); i++) { -+ err = sysfs_create_file(kobj, &br_sysfs->attr); -+ if (unlikely(err)) -+ pr_warn("failed %s under sysfs(%d)\n", -+ br_sysfs->name, err); -+ br_sysfs++; -+ } -+ } -+} -diff --git a/fs/aufs/sysrq.c b/fs/aufs/sysrq.c -new file mode 100644 -index 0000000..7d22979 ---- /dev/null -+++ b/fs/aufs/sysrq.c -@@ -0,0 +1,144 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * magic sysrq hanlder -+ */ -+ -+/* #include */ -+#include -+#include "aufs.h" -+ -+/* ---------------------------------------------------------------------- */ -+ -+static void sysrq_sb(struct super_block *sb) -+{ -+ char *plevel; -+ struct au_sbinfo *sbinfo; -+ struct file *file; -+ struct au_sphlhead *files; -+ struct au_finfo *finfo; -+ -+ plevel = au_plevel; -+ au_plevel = KERN_WARNING; -+ -+ /* since we define pr_fmt, call printk directly */ -+#define pr(str) printk(KERN_WARNING AUFS_NAME ": " str) -+ -+ sbinfo = au_sbi(sb); -+ printk(KERN_WARNING "si=%lx\n", sysaufs_si_id(sbinfo)); -+ pr("superblock\n"); -+ au_dpri_sb(sb); -+ -+#if 0 -+ pr("root dentry\n"); -+ au_dpri_dentry(sb->s_root); -+ pr("root inode\n"); -+ au_dpri_inode(d_inode(sb->s_root)); -+#endif -+ -+#if 0 -+ do { -+ int err, i, j, ndentry; -+ struct au_dcsub_pages dpages; -+ struct au_dpage *dpage; -+ -+ err = au_dpages_init(&dpages, GFP_ATOMIC); -+ if (unlikely(err)) -+ break; -+ err = au_dcsub_pages(&dpages, sb->s_root, NULL, NULL); -+ if (!err) -+ for (i = 0; i < dpages.ndpage; i++) { -+ dpage = dpages.dpages + i; -+ ndentry = dpage->ndentry; -+ for (j = 0; j < ndentry; j++) -+ au_dpri_dentry(dpage->dentries[j]); -+ } -+ au_dpages_free(&dpages); -+ } while (0); -+#endif -+ -+#if 1 -+ { -+ struct inode *i; -+ -+ pr("isolated inode\n"); -+ spin_lock(&sb->s_inode_list_lock); -+ list_for_each_entry(i, &sb->s_inodes, i_sb_list) { -+ spin_lock(&i->i_lock); -+ if (1 || hlist_empty(&i->i_dentry)) -+ au_dpri_inode(i); -+ spin_unlock(&i->i_lock); -+ } -+ spin_unlock(&sb->s_inode_list_lock); -+ } -+#endif -+ pr("files\n"); -+ files = &au_sbi(sb)->si_files; -+ spin_lock(&files->spin); -+ hlist_for_each_entry(finfo, &files->head, fi_hlist) { -+ umode_t mode; -+ -+ file = finfo->fi_file; -+ mode = file_inode(file)->i_mode; -+ if (!special_file(mode)) -+ au_dpri_file(file); -+ } -+ spin_unlock(&files->spin); -+ pr("done\n"); -+ -+#undef pr -+ au_plevel = plevel; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* module parameter */ -+static char *aufs_sysrq_key = "a"; -+module_param_named(sysrq, aufs_sysrq_key, charp, S_IRUGO); -+MODULE_PARM_DESC(sysrq, "MagicSysRq key for " AUFS_NAME); -+ -+static void au_sysrq(int key __maybe_unused) -+{ -+ struct au_sbinfo *sbinfo; -+ -+ lockdep_off(); -+ au_sbilist_lock(); -+ hlist_for_each_entry(sbinfo, &au_sbilist.head, si_list) -+ sysrq_sb(sbinfo->si_sb); -+ au_sbilist_unlock(); -+ lockdep_on(); -+} -+ -+static struct sysrq_key_op au_sysrq_op = { -+ .handler = au_sysrq, -+ .help_msg = "Aufs", -+ .action_msg = "Aufs", -+ .enable_mask = SYSRQ_ENABLE_DUMP -+}; -+ -+/* ---------------------------------------------------------------------- */ -+ -+int __init au_sysrq_init(void) -+{ -+ int err; -+ char key; -+ -+ err = -1; -+ key = *aufs_sysrq_key; -+ if ('a' <= key && key <= 'z') -+ err = register_sysrq_key(key, &au_sysrq_op); -+ if (unlikely(err)) -+ pr_err("err %d, sysrq=%c\n", err, key); -+ return err; -+} -+ -+void au_sysrq_fin(void) -+{ -+ int err; -+ -+ err = unregister_sysrq_key(*aufs_sysrq_key, &au_sysrq_op); -+ if (unlikely(err)) -+ pr_err("err %d (ignored)\n", err); -+} -diff --git a/fs/aufs/vdir.c b/fs/aufs/vdir.c -new file mode 100644 -index 0000000..b2eb4c0 ---- /dev/null -+++ b/fs/aufs/vdir.c -@@ -0,0 +1,887 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * virtual or vertical directory -+ */ -+ -+#include "aufs.h" -+ -+static unsigned int calc_size(int nlen) -+{ -+ return ALIGN(sizeof(struct au_vdir_de) + nlen, sizeof(ino_t)); -+} -+ -+static int set_deblk_end(union au_vdir_deblk_p *p, -+ union au_vdir_deblk_p *deblk_end) -+{ -+ if (calc_size(0) <= deblk_end->deblk - p->deblk) { -+ p->de->de_str.len = 0; -+ /* smp_mb(); */ -+ return 0; -+ } -+ return -1; /* error */ -+} -+ -+/* returns true or false */ -+static int is_deblk_end(union au_vdir_deblk_p *p, -+ union au_vdir_deblk_p *deblk_end) -+{ -+ if (calc_size(0) <= deblk_end->deblk - p->deblk) -+ return !p->de->de_str.len; -+ return 1; -+} -+ -+static unsigned char *last_deblk(struct au_vdir *vdir) -+{ -+ return vdir->vd_deblk[vdir->vd_nblk - 1]; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* estimate the appropriate size for name hash table */ -+unsigned int au_rdhash_est(loff_t sz) -+{ -+ unsigned int n; -+ -+ n = UINT_MAX; -+ sz >>= 10; -+ if (sz < n) -+ n = sz; -+ if (sz < AUFS_RDHASH_DEF) -+ n = AUFS_RDHASH_DEF; -+ /* pr_info("n %u\n", n); */ -+ return n; -+} -+ -+/* -+ * the allocated memory has to be freed by -+ * au_nhash_wh_free() or au_nhash_de_free(). -+ */ -+int au_nhash_alloc(struct au_nhash *nhash, unsigned int num_hash, gfp_t gfp) -+{ -+ struct hlist_head *head; -+ unsigned int u; -+ size_t sz; -+ -+ sz = sizeof(*nhash->nh_head) * num_hash; -+ head = kmalloc(sz, gfp); -+ if (head) { -+ nhash->nh_num = num_hash; -+ nhash->nh_head = head; -+ for (u = 0; u < num_hash; u++) -+ INIT_HLIST_HEAD(head++); -+ return 0; /* success */ -+ } -+ -+ return -ENOMEM; -+} -+ -+static void nhash_count(struct hlist_head *head) -+{ -+#if 0 -+ unsigned long n; -+ struct hlist_node *pos; -+ -+ n = 0; -+ hlist_for_each(pos, head) -+ n++; -+ pr_info("%lu\n", n); -+#endif -+} -+ -+static void au_nhash_wh_do_free(struct hlist_head *head) -+{ -+ struct au_vdir_wh *pos; -+ struct hlist_node *node; -+ -+ hlist_for_each_entry_safe(pos, node, head, wh_hash) -+ au_delayed_kfree(pos); -+} -+ -+static void au_nhash_de_do_free(struct hlist_head *head) -+{ -+ struct au_vdir_dehstr *pos; -+ struct hlist_node *node; -+ -+ hlist_for_each_entry_safe(pos, node, head, hash) -+ au_cache_dfree_vdir_dehstr(pos); -+} -+ -+static void au_nhash_do_free(struct au_nhash *nhash, -+ void (*free)(struct hlist_head *head)) -+{ -+ unsigned int n; -+ struct hlist_head *head; -+ -+ n = nhash->nh_num; -+ if (!n) -+ return; -+ -+ head = nhash->nh_head; -+ while (n-- > 0) { -+ nhash_count(head); -+ free(head++); -+ } -+ au_delayed_kfree(nhash->nh_head); -+} -+ -+void au_nhash_wh_free(struct au_nhash *whlist) -+{ -+ au_nhash_do_free(whlist, au_nhash_wh_do_free); -+} -+ -+static void au_nhash_de_free(struct au_nhash *delist) -+{ -+ au_nhash_do_free(delist, au_nhash_de_do_free); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+int au_nhash_test_longer_wh(struct au_nhash *whlist, aufs_bindex_t btgt, -+ int limit) -+{ -+ int num; -+ unsigned int u, n; -+ struct hlist_head *head; -+ struct au_vdir_wh *pos; -+ -+ num = 0; -+ n = whlist->nh_num; -+ head = whlist->nh_head; -+ for (u = 0; u < n; u++, head++) -+ hlist_for_each_entry(pos, head, wh_hash) -+ if (pos->wh_bindex == btgt && ++num > limit) -+ return 1; -+ return 0; -+} -+ -+static struct hlist_head *au_name_hash(struct au_nhash *nhash, -+ unsigned char *name, -+ unsigned int len) -+{ -+ unsigned int v; -+ /* const unsigned int magic_bit = 12; */ -+ -+ AuDebugOn(!nhash->nh_num || !nhash->nh_head); -+ -+ v = 0; -+ if (len > 8) -+ len = 8; -+ while (len--) -+ v += *name++; -+ /* v = hash_long(v, magic_bit); */ -+ v %= nhash->nh_num; -+ return nhash->nh_head + v; -+} -+ -+static int au_nhash_test_name(struct au_vdir_destr *str, const char *name, -+ int nlen) -+{ -+ return str->len == nlen && !memcmp(str->name, name, nlen); -+} -+ -+/* returns found or not */ -+int au_nhash_test_known_wh(struct au_nhash *whlist, char *name, int nlen) -+{ -+ struct hlist_head *head; -+ struct au_vdir_wh *pos; -+ struct au_vdir_destr *str; -+ -+ head = au_name_hash(whlist, name, nlen); -+ hlist_for_each_entry(pos, head, wh_hash) { -+ str = &pos->wh_str; -+ AuDbg("%.*s\n", str->len, str->name); -+ if (au_nhash_test_name(str, name, nlen)) -+ return 1; -+ } -+ return 0; -+} -+ -+/* returns found(true) or not */ -+static int test_known(struct au_nhash *delist, char *name, int nlen) -+{ -+ struct hlist_head *head; -+ struct au_vdir_dehstr *pos; -+ struct au_vdir_destr *str; -+ -+ head = au_name_hash(delist, name, nlen); -+ hlist_for_each_entry(pos, head, hash) { -+ str = pos->str; -+ AuDbg("%.*s\n", str->len, str->name); -+ if (au_nhash_test_name(str, name, nlen)) -+ return 1; -+ } -+ return 0; -+} -+ -+static void au_shwh_init_wh(struct au_vdir_wh *wh, ino_t ino, -+ unsigned char d_type) -+{ -+#ifdef CONFIG_AUFS_SHWH -+ wh->wh_ino = ino; -+ wh->wh_type = d_type; -+#endif -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+int au_nhash_append_wh(struct au_nhash *whlist, char *name, int nlen, ino_t ino, -+ unsigned int d_type, aufs_bindex_t bindex, -+ unsigned char shwh) -+{ -+ int err; -+ struct au_vdir_destr *str; -+ struct au_vdir_wh *wh; -+ -+ AuDbg("%.*s\n", nlen, name); -+ AuDebugOn(!whlist->nh_num || !whlist->nh_head); -+ -+ err = -ENOMEM; -+ wh = kmalloc(sizeof(*wh) + nlen, GFP_NOFS); -+ if (unlikely(!wh)) -+ goto out; -+ -+ err = 0; -+ wh->wh_bindex = bindex; -+ if (shwh) -+ au_shwh_init_wh(wh, ino, d_type); -+ str = &wh->wh_str; -+ str->len = nlen; -+ memcpy(str->name, name, nlen); -+ hlist_add_head(&wh->wh_hash, au_name_hash(whlist, name, nlen)); -+ /* smp_mb(); */ -+ -+out: -+ return err; -+} -+ -+static int append_deblk(struct au_vdir *vdir) -+{ -+ int err; -+ unsigned long ul; -+ const unsigned int deblk_sz = vdir->vd_deblk_sz; -+ union au_vdir_deblk_p p, deblk_end; -+ unsigned char **o; -+ -+ err = -ENOMEM; -+ o = au_krealloc(vdir->vd_deblk, sizeof(*o) * (vdir->vd_nblk + 1), -+ GFP_NOFS, /*may_shrink*/0); -+ if (unlikely(!o)) -+ goto out; -+ -+ vdir->vd_deblk = o; -+ p.deblk = kmalloc(deblk_sz, GFP_NOFS); -+ if (p.deblk) { -+ ul = vdir->vd_nblk++; -+ vdir->vd_deblk[ul] = p.deblk; -+ vdir->vd_last.ul = ul; -+ vdir->vd_last.p.deblk = p.deblk; -+ deblk_end.deblk = p.deblk + deblk_sz; -+ err = set_deblk_end(&p, &deblk_end); -+ } -+ -+out: -+ return err; -+} -+ -+static int append_de(struct au_vdir *vdir, char *name, int nlen, ino_t ino, -+ unsigned int d_type, struct au_nhash *delist) -+{ -+ int err; -+ unsigned int sz; -+ const unsigned int deblk_sz = vdir->vd_deblk_sz; -+ union au_vdir_deblk_p p, *room, deblk_end; -+ struct au_vdir_dehstr *dehstr; -+ -+ p.deblk = last_deblk(vdir); -+ deblk_end.deblk = p.deblk + deblk_sz; -+ room = &vdir->vd_last.p; -+ AuDebugOn(room->deblk < p.deblk || deblk_end.deblk <= room->deblk -+ || !is_deblk_end(room, &deblk_end)); -+ -+ sz = calc_size(nlen); -+ if (unlikely(sz > deblk_end.deblk - room->deblk)) { -+ err = append_deblk(vdir); -+ if (unlikely(err)) -+ goto out; -+ -+ p.deblk = last_deblk(vdir); -+ deblk_end.deblk = p.deblk + deblk_sz; -+ /* smp_mb(); */ -+ AuDebugOn(room->deblk != p.deblk); -+ } -+ -+ err = -ENOMEM; -+ dehstr = au_cache_alloc_vdir_dehstr(); -+ if (unlikely(!dehstr)) -+ goto out; -+ -+ dehstr->str = &room->de->de_str; -+ hlist_add_head(&dehstr->hash, au_name_hash(delist, name, nlen)); -+ room->de->de_ino = ino; -+ room->de->de_type = d_type; -+ room->de->de_str.len = nlen; -+ memcpy(room->de->de_str.name, name, nlen); -+ -+ err = 0; -+ room->deblk += sz; -+ if (unlikely(set_deblk_end(room, &deblk_end))) -+ err = append_deblk(vdir); -+ /* smp_mb(); */ -+ -+out: -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+void au_vdir_free(struct au_vdir *vdir, int atonce) -+{ -+ unsigned char **deblk; -+ -+ deblk = vdir->vd_deblk; -+ if (!atonce) { -+ while (vdir->vd_nblk--) -+ au_delayed_kfree(*deblk++); -+ au_delayed_kfree(vdir->vd_deblk); -+ au_cache_dfree_vdir(vdir); -+ } else { -+ /* not delayed */ -+ while (vdir->vd_nblk--) -+ kfree(*deblk++); -+ kfree(vdir->vd_deblk); -+ au_cache_free_vdir(vdir); -+ } -+} -+ -+static struct au_vdir *alloc_vdir(struct file *file) -+{ -+ struct au_vdir *vdir; -+ struct super_block *sb; -+ int err; -+ -+ sb = file->f_path.dentry->d_sb; -+ SiMustAnyLock(sb); -+ -+ err = -ENOMEM; -+ vdir = au_cache_alloc_vdir(); -+ if (unlikely(!vdir)) -+ goto out; -+ -+ vdir->vd_deblk = kzalloc(sizeof(*vdir->vd_deblk), GFP_NOFS); -+ if (unlikely(!vdir->vd_deblk)) -+ goto out_free; -+ -+ vdir->vd_deblk_sz = au_sbi(sb)->si_rdblk; -+ if (!vdir->vd_deblk_sz) { -+ /* estimate the appropriate size for deblk */ -+ vdir->vd_deblk_sz = au_dir_size(file, /*dentry*/NULL); -+ /* pr_info("vd_deblk_sz %u\n", vdir->vd_deblk_sz); */ -+ } -+ vdir->vd_nblk = 0; -+ vdir->vd_version = 0; -+ vdir->vd_jiffy = 0; -+ err = append_deblk(vdir); -+ if (!err) -+ return vdir; /* success */ -+ -+ au_delayed_kfree(vdir->vd_deblk); -+ -+out_free: -+ au_cache_dfree_vdir(vdir); -+out: -+ vdir = ERR_PTR(err); -+ return vdir; -+} -+ -+static int reinit_vdir(struct au_vdir *vdir) -+{ -+ int err; -+ union au_vdir_deblk_p p, deblk_end; -+ -+ while (vdir->vd_nblk > 1) { -+ au_delayed_kfree(vdir->vd_deblk[vdir->vd_nblk - 1]); -+ /* vdir->vd_deblk[vdir->vd_nblk - 1] = NULL; */ -+ vdir->vd_nblk--; -+ } -+ p.deblk = vdir->vd_deblk[0]; -+ deblk_end.deblk = p.deblk + vdir->vd_deblk_sz; -+ err = set_deblk_end(&p, &deblk_end); -+ /* keep vd_dblk_sz */ -+ vdir->vd_last.ul = 0; -+ vdir->vd_last.p.deblk = vdir->vd_deblk[0]; -+ vdir->vd_version = 0; -+ vdir->vd_jiffy = 0; -+ /* smp_mb(); */ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+#define AuFillVdir_CALLED 1 -+#define AuFillVdir_WHABLE (1 << 1) -+#define AuFillVdir_SHWH (1 << 2) -+#define au_ftest_fillvdir(flags, name) ((flags) & AuFillVdir_##name) -+#define au_fset_fillvdir(flags, name) \ -+ do { (flags) |= AuFillVdir_##name; } while (0) -+#define au_fclr_fillvdir(flags, name) \ -+ do { (flags) &= ~AuFillVdir_##name; } while (0) -+ -+#ifndef CONFIG_AUFS_SHWH -+#undef AuFillVdir_SHWH -+#define AuFillVdir_SHWH 0 -+#endif -+ -+struct fillvdir_arg { -+ struct dir_context ctx; -+ struct file *file; -+ struct au_vdir *vdir; -+ struct au_nhash delist; -+ struct au_nhash whlist; -+ aufs_bindex_t bindex; -+ unsigned int flags; -+ int err; -+}; -+ -+static int fillvdir(struct dir_context *ctx, const char *__name, int nlen, -+ loff_t offset __maybe_unused, u64 h_ino, -+ unsigned int d_type) -+{ -+ struct fillvdir_arg *arg = container_of(ctx, struct fillvdir_arg, ctx); -+ char *name = (void *)__name; -+ struct super_block *sb; -+ ino_t ino; -+ const unsigned char shwh = !!au_ftest_fillvdir(arg->flags, SHWH); -+ -+ arg->err = 0; -+ sb = arg->file->f_path.dentry->d_sb; -+ au_fset_fillvdir(arg->flags, CALLED); -+ /* smp_mb(); */ -+ if (nlen <= AUFS_WH_PFX_LEN -+ || memcmp(name, AUFS_WH_PFX, AUFS_WH_PFX_LEN)) { -+ if (test_known(&arg->delist, name, nlen) -+ || au_nhash_test_known_wh(&arg->whlist, name, nlen)) -+ goto out; /* already exists or whiteouted */ -+ -+ arg->err = au_ino(sb, arg->bindex, h_ino, d_type, &ino); -+ if (!arg->err) { -+ if (unlikely(nlen > AUFS_MAX_NAMELEN)) -+ d_type = DT_UNKNOWN; -+ arg->err = append_de(arg->vdir, name, nlen, ino, -+ d_type, &arg->delist); -+ } -+ } else if (au_ftest_fillvdir(arg->flags, WHABLE)) { -+ name += AUFS_WH_PFX_LEN; -+ nlen -= AUFS_WH_PFX_LEN; -+ if (au_nhash_test_known_wh(&arg->whlist, name, nlen)) -+ goto out; /* already whiteouted */ -+ -+ if (shwh) -+ arg->err = au_wh_ino(sb, arg->bindex, h_ino, d_type, -+ &ino); -+ if (!arg->err) { -+ if (nlen <= AUFS_MAX_NAMELEN + AUFS_WH_PFX_LEN) -+ d_type = DT_UNKNOWN; -+ arg->err = au_nhash_append_wh -+ (&arg->whlist, name, nlen, ino, d_type, -+ arg->bindex, shwh); -+ } -+ } -+ -+out: -+ if (!arg->err) -+ arg->vdir->vd_jiffy = jiffies; -+ /* smp_mb(); */ -+ AuTraceErr(arg->err); -+ return arg->err; -+} -+ -+static int au_handle_shwh(struct super_block *sb, struct au_vdir *vdir, -+ struct au_nhash *whlist, struct au_nhash *delist) -+{ -+#ifdef CONFIG_AUFS_SHWH -+ int err; -+ unsigned int nh, u; -+ struct hlist_head *head; -+ struct au_vdir_wh *pos; -+ struct hlist_node *n; -+ char *p, *o; -+ struct au_vdir_destr *destr; -+ -+ AuDebugOn(!au_opt_test(au_mntflags(sb), SHWH)); -+ -+ err = -ENOMEM; -+ o = p = (void *)__get_free_page(GFP_NOFS); -+ if (unlikely(!p)) -+ goto out; -+ -+ err = 0; -+ nh = whlist->nh_num; -+ memcpy(p, AUFS_WH_PFX, AUFS_WH_PFX_LEN); -+ p += AUFS_WH_PFX_LEN; -+ for (u = 0; u < nh; u++) { -+ head = whlist->nh_head + u; -+ hlist_for_each_entry_safe(pos, n, head, wh_hash) { -+ destr = &pos->wh_str; -+ memcpy(p, destr->name, destr->len); -+ err = append_de(vdir, o, destr->len + AUFS_WH_PFX_LEN, -+ pos->wh_ino, pos->wh_type, delist); -+ if (unlikely(err)) -+ break; -+ } -+ } -+ -+ au_delayed_free_page((unsigned long)o); -+ -+out: -+ AuTraceErr(err); -+ return err; -+#else -+ return 0; -+#endif -+} -+ -+static int au_do_read_vdir(struct fillvdir_arg *arg) -+{ -+ int err; -+ unsigned int rdhash; -+ loff_t offset; -+ aufs_bindex_t bbot, bindex, btop; -+ unsigned char shwh; -+ struct file *hf, *file; -+ struct super_block *sb; -+ -+ file = arg->file; -+ sb = file->f_path.dentry->d_sb; -+ SiMustAnyLock(sb); -+ -+ rdhash = au_sbi(sb)->si_rdhash; -+ if (!rdhash) -+ rdhash = au_rdhash_est(au_dir_size(file, /*dentry*/NULL)); -+ err = au_nhash_alloc(&arg->delist, rdhash, GFP_NOFS); -+ if (unlikely(err)) -+ goto out; -+ err = au_nhash_alloc(&arg->whlist, rdhash, GFP_NOFS); -+ if (unlikely(err)) -+ goto out_delist; -+ -+ err = 0; -+ arg->flags = 0; -+ shwh = 0; -+ if (au_opt_test(au_mntflags(sb), SHWH)) { -+ shwh = 1; -+ au_fset_fillvdir(arg->flags, SHWH); -+ } -+ btop = au_fbtop(file); -+ bbot = au_fbbot_dir(file); -+ for (bindex = btop; !err && bindex <= bbot; bindex++) { -+ hf = au_hf_dir(file, bindex); -+ if (!hf) -+ continue; -+ -+ offset = vfsub_llseek(hf, 0, SEEK_SET); -+ err = offset; -+ if (unlikely(offset)) -+ break; -+ -+ arg->bindex = bindex; -+ au_fclr_fillvdir(arg->flags, WHABLE); -+ if (shwh -+ || (bindex != bbot -+ && au_br_whable(au_sbr_perm(sb, bindex)))) -+ au_fset_fillvdir(arg->flags, WHABLE); -+ do { -+ arg->err = 0; -+ au_fclr_fillvdir(arg->flags, CALLED); -+ /* smp_mb(); */ -+ err = vfsub_iterate_dir(hf, &arg->ctx); -+ if (err >= 0) -+ err = arg->err; -+ } while (!err && au_ftest_fillvdir(arg->flags, CALLED)); -+ -+ /* -+ * dir_relax() may be good for concurrency, but aufs should not -+ * use it since it will cause a lockdep problem. -+ */ -+ } -+ -+ if (!err && shwh) -+ err = au_handle_shwh(sb, arg->vdir, &arg->whlist, &arg->delist); -+ -+ au_nhash_wh_free(&arg->whlist); -+ -+out_delist: -+ au_nhash_de_free(&arg->delist); -+out: -+ return err; -+} -+ -+static int read_vdir(struct file *file, int may_read) -+{ -+ int err; -+ unsigned long expire; -+ unsigned char do_read; -+ struct fillvdir_arg arg = { -+ .ctx = { -+ .actor = fillvdir -+ } -+ }; -+ struct inode *inode; -+ struct au_vdir *vdir, *allocated; -+ -+ err = 0; -+ inode = file_inode(file); -+ IMustLock(inode); -+ IiMustWriteLock(inode); -+ SiMustAnyLock(inode->i_sb); -+ -+ allocated = NULL; -+ do_read = 0; -+ expire = au_sbi(inode->i_sb)->si_rdcache; -+ vdir = au_ivdir(inode); -+ if (!vdir) { -+ do_read = 1; -+ vdir = alloc_vdir(file); -+ err = PTR_ERR(vdir); -+ if (IS_ERR(vdir)) -+ goto out; -+ err = 0; -+ allocated = vdir; -+ } else if (may_read -+ && (inode->i_version != vdir->vd_version -+ || time_after(jiffies, vdir->vd_jiffy + expire))) { -+ do_read = 1; -+ err = reinit_vdir(vdir); -+ if (unlikely(err)) -+ goto out; -+ } -+ -+ if (!do_read) -+ return 0; /* success */ -+ -+ arg.file = file; -+ arg.vdir = vdir; -+ err = au_do_read_vdir(&arg); -+ if (!err) { -+ /* file->f_pos = 0; */ /* todo: ctx->pos? */ -+ vdir->vd_version = inode->i_version; -+ vdir->vd_last.ul = 0; -+ vdir->vd_last.p.deblk = vdir->vd_deblk[0]; -+ if (allocated) -+ au_set_ivdir(inode, allocated); -+ } else if (allocated) -+ au_vdir_free(allocated, /*atonce*/0); -+ -+out: -+ return err; -+} -+ -+static int copy_vdir(struct au_vdir *tgt, struct au_vdir *src) -+{ -+ int err, rerr; -+ unsigned long ul, n; -+ const unsigned int deblk_sz = src->vd_deblk_sz; -+ -+ AuDebugOn(tgt->vd_nblk != 1); -+ -+ err = -ENOMEM; -+ if (tgt->vd_nblk < src->vd_nblk) { -+ unsigned char **p; -+ -+ p = au_krealloc(tgt->vd_deblk, sizeof(*p) * src->vd_nblk, -+ GFP_NOFS, /*may_shrink*/0); -+ if (unlikely(!p)) -+ goto out; -+ tgt->vd_deblk = p; -+ } -+ -+ if (tgt->vd_deblk_sz != deblk_sz) { -+ unsigned char *p; -+ -+ tgt->vd_deblk_sz = deblk_sz; -+ p = au_krealloc(tgt->vd_deblk[0], deblk_sz, GFP_NOFS, -+ /*may_shrink*/1); -+ if (unlikely(!p)) -+ goto out; -+ tgt->vd_deblk[0] = p; -+ } -+ memcpy(tgt->vd_deblk[0], src->vd_deblk[0], deblk_sz); -+ tgt->vd_version = src->vd_version; -+ tgt->vd_jiffy = src->vd_jiffy; -+ -+ n = src->vd_nblk; -+ for (ul = 1; ul < n; ul++) { -+ tgt->vd_deblk[ul] = kmemdup(src->vd_deblk[ul], deblk_sz, -+ GFP_NOFS); -+ if (unlikely(!tgt->vd_deblk[ul])) -+ goto out; -+ tgt->vd_nblk++; -+ } -+ tgt->vd_nblk = n; -+ tgt->vd_last.ul = tgt->vd_last.ul; -+ tgt->vd_last.p.deblk = tgt->vd_deblk[tgt->vd_last.ul]; -+ tgt->vd_last.p.deblk += src->vd_last.p.deblk -+ - src->vd_deblk[src->vd_last.ul]; -+ /* smp_mb(); */ -+ return 0; /* success */ -+ -+out: -+ rerr = reinit_vdir(tgt); -+ BUG_ON(rerr); -+ return err; -+} -+ -+int au_vdir_init(struct file *file) -+{ -+ int err; -+ struct inode *inode; -+ struct au_vdir *vdir_cache, *allocated; -+ -+ /* test file->f_pos here instead of ctx->pos */ -+ err = read_vdir(file, !file->f_pos); -+ if (unlikely(err)) -+ goto out; -+ -+ allocated = NULL; -+ vdir_cache = au_fvdir_cache(file); -+ if (!vdir_cache) { -+ vdir_cache = alloc_vdir(file); -+ err = PTR_ERR(vdir_cache); -+ if (IS_ERR(vdir_cache)) -+ goto out; -+ allocated = vdir_cache; -+ } else if (!file->f_pos && vdir_cache->vd_version != file->f_version) { -+ /* test file->f_pos here instead of ctx->pos */ -+ err = reinit_vdir(vdir_cache); -+ if (unlikely(err)) -+ goto out; -+ } else -+ return 0; /* success */ -+ -+ inode = file_inode(file); -+ err = copy_vdir(vdir_cache, au_ivdir(inode)); -+ if (!err) { -+ file->f_version = inode->i_version; -+ if (allocated) -+ au_set_fvdir_cache(file, allocated); -+ } else if (allocated) -+ au_vdir_free(allocated, /*atonce*/0); -+ -+out: -+ return err; -+} -+ -+static loff_t calc_offset(struct au_vdir *vdir) -+{ -+ loff_t offset; -+ union au_vdir_deblk_p p; -+ -+ p.deblk = vdir->vd_deblk[vdir->vd_last.ul]; -+ offset = vdir->vd_last.p.deblk - p.deblk; -+ offset += vdir->vd_deblk_sz * vdir->vd_last.ul; -+ return offset; -+} -+ -+/* returns true or false */ -+static int seek_vdir(struct file *file, struct dir_context *ctx) -+{ -+ int valid; -+ unsigned int deblk_sz; -+ unsigned long ul, n; -+ loff_t offset; -+ union au_vdir_deblk_p p, deblk_end; -+ struct au_vdir *vdir_cache; -+ -+ valid = 1; -+ vdir_cache = au_fvdir_cache(file); -+ offset = calc_offset(vdir_cache); -+ AuDbg("offset %lld\n", offset); -+ if (ctx->pos == offset) -+ goto out; -+ -+ vdir_cache->vd_last.ul = 0; -+ vdir_cache->vd_last.p.deblk = vdir_cache->vd_deblk[0]; -+ if (!ctx->pos) -+ goto out; -+ -+ valid = 0; -+ deblk_sz = vdir_cache->vd_deblk_sz; -+ ul = div64_u64(ctx->pos, deblk_sz); -+ AuDbg("ul %lu\n", ul); -+ if (ul >= vdir_cache->vd_nblk) -+ goto out; -+ -+ n = vdir_cache->vd_nblk; -+ for (; ul < n; ul++) { -+ p.deblk = vdir_cache->vd_deblk[ul]; -+ deblk_end.deblk = p.deblk + deblk_sz; -+ offset = ul; -+ offset *= deblk_sz; -+ while (!is_deblk_end(&p, &deblk_end) && offset < ctx->pos) { -+ unsigned int l; -+ -+ l = calc_size(p.de->de_str.len); -+ offset += l; -+ p.deblk += l; -+ } -+ if (!is_deblk_end(&p, &deblk_end)) { -+ valid = 1; -+ vdir_cache->vd_last.ul = ul; -+ vdir_cache->vd_last.p = p; -+ break; -+ } -+ } -+ -+out: -+ /* smp_mb(); */ -+ AuTraceErr(!valid); -+ return valid; -+} -+ -+int au_vdir_fill_de(struct file *file, struct dir_context *ctx) -+{ -+ unsigned int l, deblk_sz; -+ union au_vdir_deblk_p deblk_end; -+ struct au_vdir *vdir_cache; -+ struct au_vdir_de *de; -+ -+ vdir_cache = au_fvdir_cache(file); -+ if (!seek_vdir(file, ctx)) -+ return 0; -+ -+ deblk_sz = vdir_cache->vd_deblk_sz; -+ while (1) { -+ deblk_end.deblk = vdir_cache->vd_deblk[vdir_cache->vd_last.ul]; -+ deblk_end.deblk += deblk_sz; -+ while (!is_deblk_end(&vdir_cache->vd_last.p, &deblk_end)) { -+ de = vdir_cache->vd_last.p.de; -+ AuDbg("%.*s, off%lld, i%lu, dt%d\n", -+ de->de_str.len, de->de_str.name, ctx->pos, -+ (unsigned long)de->de_ino, de->de_type); -+ if (unlikely(!dir_emit(ctx, de->de_str.name, -+ de->de_str.len, de->de_ino, -+ de->de_type))) { -+ /* todo: ignore the error caused by udba? */ -+ /* return err; */ -+ return 0; -+ } -+ -+ l = calc_size(de->de_str.len); -+ vdir_cache->vd_last.p.deblk += l; -+ ctx->pos += l; -+ } -+ if (vdir_cache->vd_last.ul < vdir_cache->vd_nblk - 1) { -+ vdir_cache->vd_last.ul++; -+ vdir_cache->vd_last.p.deblk -+ = vdir_cache->vd_deblk[vdir_cache->vd_last.ul]; -+ ctx->pos = deblk_sz * vdir_cache->vd_last.ul; -+ continue; -+ } -+ break; -+ } -+ -+ /* smp_mb(); */ -+ return 0; -+} -diff --git a/fs/aufs/vfsub.c b/fs/aufs/vfsub.c -new file mode 100644 -index 0000000..2e54bad ---- /dev/null -+++ b/fs/aufs/vfsub.c -@@ -0,0 +1,871 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * sub-routines for VFS -+ */ -+ -+#include -+#include -+#include -+#include -+#include "../fs/mount.h" -+#include "aufs.h" -+ -+#ifdef CONFIG_AUFS_BR_FUSE -+int vfsub_test_mntns(struct vfsmount *mnt, struct super_block *h_sb) -+{ -+ struct nsproxy *ns; -+ -+ if (!au_test_fuse(h_sb) || !au_userns) -+ return 0; -+ -+ ns = current->nsproxy; -+ /* no {get,put}_nsproxy(ns) */ -+ return real_mount(mnt)->mnt_ns == ns->mnt_ns ? 0 : -EACCES; -+} -+#endif -+ -+/* ---------------------------------------------------------------------- */ -+ -+int vfsub_update_h_iattr(struct path *h_path, int *did) -+{ -+ int err; -+ struct kstat st; -+ struct super_block *h_sb; -+ -+ /* for remote fs, leave work for its getattr or d_revalidate */ -+ /* for bad i_attr fs, handle them in aufs_getattr() */ -+ /* still some fs may acquire i_mutex. we need to skip them */ -+ err = 0; -+ if (!did) -+ did = &err; -+ h_sb = h_path->dentry->d_sb; -+ *did = (!au_test_fs_remote(h_sb) && au_test_fs_refresh_iattr(h_sb)); -+ if (*did) -+ err = vfs_getattr(h_path, &st); -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+struct file *vfsub_dentry_open(struct path *path, int flags) -+{ -+ struct file *file; -+ -+ file = dentry_open(path, flags /* | __FMODE_NONOTIFY */, -+ current_cred()); -+ if (!IS_ERR_OR_NULL(file) -+ && (file->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) -+ i_readcount_inc(d_inode(path->dentry)); -+ -+ return file; -+} -+ -+struct file *vfsub_filp_open(const char *path, int oflags, int mode) -+{ -+ struct file *file; -+ -+ lockdep_off(); -+ file = filp_open(path, -+ oflags /* | __FMODE_NONOTIFY */, -+ mode); -+ lockdep_on(); -+ if (IS_ERR(file)) -+ goto out; -+ vfsub_update_h_iattr(&file->f_path, /*did*/NULL); /*ignore*/ -+ -+out: -+ return file; -+} -+ -+/* -+ * Ideally this function should call VFS:do_last() in order to keep all its -+ * checkings. But it is very hard for aufs to regenerate several VFS internal -+ * structure such as nameidata. This is a second (or third) best approach. -+ * cf. linux/fs/namei.c:do_last(), lookup_open() and atomic_open(). -+ */ -+int vfsub_atomic_open(struct inode *dir, struct dentry *dentry, -+ struct vfsub_aopen_args *args, struct au_branch *br) -+{ -+ int err; -+ struct file *file = args->file; -+ /* copied from linux/fs/namei.c:atomic_open() */ -+ struct dentry *const DENTRY_NOT_SET = (void *)-1UL; -+ -+ IMustLock(dir); -+ AuDebugOn(!dir->i_op->atomic_open); -+ -+ err = au_br_test_oflag(args->open_flag, br); -+ if (unlikely(err)) -+ goto out; -+ -+ args->file->f_path.dentry = DENTRY_NOT_SET; -+ args->file->f_path.mnt = au_br_mnt(br); -+ err = dir->i_op->atomic_open(dir, dentry, file, args->open_flag, -+ args->create_mode, args->opened); -+ if (err >= 0) { -+ /* some filesystems don't set FILE_CREATED while succeeded? */ -+ if (*args->opened & FILE_CREATED) -+ fsnotify_create(dir, dentry); -+ } else -+ goto out; -+ -+ -+ if (!err) { -+ /* todo: call VFS:may_open() here */ -+ err = open_check_o_direct(file); -+ /* todo: ima_file_check() too? */ -+ if (!err && (args->open_flag & __FMODE_EXEC)) -+ err = deny_write_access(file); -+ if (unlikely(err)) -+ /* note that the file is created and still opened */ -+ goto out; -+ } -+ -+ au_br_get(br); -+ fsnotify_open(file); -+ -+out: -+ return err; -+} -+ -+int vfsub_kern_path(const char *name, unsigned int flags, struct path *path) -+{ -+ int err; -+ -+ err = kern_path(name, flags, path); -+ if (!err && d_is_positive(path->dentry)) -+ vfsub_update_h_iattr(path, /*did*/NULL); /*ignore*/ -+ return err; -+} -+ -+struct dentry *vfsub_lookup_one_len_unlocked(const char *name, -+ struct dentry *parent, int len) -+{ -+ struct path path = { -+ .mnt = NULL -+ }; -+ -+ path.dentry = lookup_one_len_unlocked(name, parent, len); -+ if (IS_ERR(path.dentry)) -+ goto out; -+ if (d_is_positive(path.dentry)) -+ vfsub_update_h_iattr(&path, /*did*/NULL); /*ignore*/ -+ -+out: -+ AuTraceErrPtr(path.dentry); -+ return path.dentry; -+} -+ -+struct dentry *vfsub_lookup_one_len(const char *name, struct dentry *parent, -+ int len) -+{ -+ struct path path = { -+ .mnt = NULL -+ }; -+ -+ /* VFS checks it too, but by WARN_ON_ONCE() */ -+ IMustLock(d_inode(parent)); -+ -+ path.dentry = lookup_one_len(name, parent, len); -+ if (IS_ERR(path.dentry)) -+ goto out; -+ if (d_is_positive(path.dentry)) -+ vfsub_update_h_iattr(&path, /*did*/NULL); /*ignore*/ -+ -+out: -+ AuTraceErrPtr(path.dentry); -+ return path.dentry; -+} -+ -+void vfsub_call_lkup_one(void *args) -+{ -+ struct vfsub_lkup_one_args *a = args; -+ *a->errp = vfsub_lkup_one(a->name, a->parent); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+struct dentry *vfsub_lock_rename(struct dentry *d1, struct au_hinode *hdir1, -+ struct dentry *d2, struct au_hinode *hdir2) -+{ -+ struct dentry *d; -+ -+ lockdep_off(); -+ d = lock_rename(d1, d2); -+ lockdep_on(); -+ au_hn_suspend(hdir1); -+ if (hdir1 != hdir2) -+ au_hn_suspend(hdir2); -+ -+ return d; -+} -+ -+void vfsub_unlock_rename(struct dentry *d1, struct au_hinode *hdir1, -+ struct dentry *d2, struct au_hinode *hdir2) -+{ -+ au_hn_resume(hdir1); -+ if (hdir1 != hdir2) -+ au_hn_resume(hdir2); -+ lockdep_off(); -+ unlock_rename(d1, d2); -+ lockdep_on(); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+int vfsub_create(struct inode *dir, struct path *path, int mode, bool want_excl) -+{ -+ int err; -+ struct dentry *d; -+ -+ IMustLock(dir); -+ -+ d = path->dentry; -+ path->dentry = d->d_parent; -+ err = security_path_mknod(path, d, mode, 0); -+ path->dentry = d; -+ if (unlikely(err)) -+ goto out; -+ -+ lockdep_off(); -+ err = vfs_create(dir, path->dentry, mode, want_excl); -+ lockdep_on(); -+ if (!err) { -+ struct path tmp = *path; -+ int did; -+ -+ vfsub_update_h_iattr(&tmp, &did); -+ if (did) { -+ tmp.dentry = path->dentry->d_parent; -+ vfsub_update_h_iattr(&tmp, /*did*/NULL); -+ } -+ /*ignore*/ -+ } -+ -+out: -+ return err; -+} -+ -+int vfsub_symlink(struct inode *dir, struct path *path, const char *symname) -+{ -+ int err; -+ struct dentry *d; -+ -+ IMustLock(dir); -+ -+ d = path->dentry; -+ path->dentry = d->d_parent; -+ err = security_path_symlink(path, d, symname); -+ path->dentry = d; -+ if (unlikely(err)) -+ goto out; -+ -+ lockdep_off(); -+ err = vfs_symlink(dir, path->dentry, symname); -+ lockdep_on(); -+ if (!err) { -+ struct path tmp = *path; -+ int did; -+ -+ vfsub_update_h_iattr(&tmp, &did); -+ if (did) { -+ tmp.dentry = path->dentry->d_parent; -+ vfsub_update_h_iattr(&tmp, /*did*/NULL); -+ } -+ /*ignore*/ -+ } -+ -+out: -+ return err; -+} -+ -+int vfsub_mknod(struct inode *dir, struct path *path, int mode, dev_t dev) -+{ -+ int err; -+ struct dentry *d; -+ -+ IMustLock(dir); -+ -+ d = path->dentry; -+ path->dentry = d->d_parent; -+ err = security_path_mknod(path, d, mode, new_encode_dev(dev)); -+ path->dentry = d; -+ if (unlikely(err)) -+ goto out; -+ -+ lockdep_off(); -+ err = vfs_mknod(dir, path->dentry, mode, dev); -+ lockdep_on(); -+ if (!err) { -+ struct path tmp = *path; -+ int did; -+ -+ vfsub_update_h_iattr(&tmp, &did); -+ if (did) { -+ tmp.dentry = path->dentry->d_parent; -+ vfsub_update_h_iattr(&tmp, /*did*/NULL); -+ } -+ /*ignore*/ -+ } -+ -+out: -+ return err; -+} -+ -+static int au_test_nlink(struct inode *inode) -+{ -+ const unsigned int link_max = UINT_MAX >> 1; /* rough margin */ -+ -+ if (!au_test_fs_no_limit_nlink(inode->i_sb) -+ || inode->i_nlink < link_max) -+ return 0; -+ return -EMLINK; -+} -+ -+int vfsub_link(struct dentry *src_dentry, struct inode *dir, struct path *path, -+ struct inode **delegated_inode) -+{ -+ int err; -+ struct dentry *d; -+ -+ IMustLock(dir); -+ -+ err = au_test_nlink(d_inode(src_dentry)); -+ if (unlikely(err)) -+ return err; -+ -+ /* we don't call may_linkat() */ -+ d = path->dentry; -+ path->dentry = d->d_parent; -+ err = security_path_link(src_dentry, path, d); -+ path->dentry = d; -+ if (unlikely(err)) -+ goto out; -+ -+ lockdep_off(); -+ err = vfs_link(src_dentry, dir, path->dentry, delegated_inode); -+ lockdep_on(); -+ if (!err) { -+ struct path tmp = *path; -+ int did; -+ -+ /* fuse has different memory inode for the same inumber */ -+ vfsub_update_h_iattr(&tmp, &did); -+ if (did) { -+ tmp.dentry = path->dentry->d_parent; -+ vfsub_update_h_iattr(&tmp, /*did*/NULL); -+ tmp.dentry = src_dentry; -+ vfsub_update_h_iattr(&tmp, /*did*/NULL); -+ } -+ /*ignore*/ -+ } -+ -+out: -+ return err; -+} -+ -+int vfsub_rename(struct inode *src_dir, struct dentry *src_dentry, -+ struct inode *dir, struct path *path, -+ struct inode **delegated_inode) -+{ -+ int err; -+ struct path tmp = { -+ .mnt = path->mnt -+ }; -+ struct dentry *d; -+ -+ IMustLock(dir); -+ IMustLock(src_dir); -+ -+ d = path->dentry; -+ path->dentry = d->d_parent; -+ tmp.dentry = src_dentry->d_parent; -+ err = security_path_rename(&tmp, src_dentry, path, d, /*flags*/0); -+ path->dentry = d; -+ if (unlikely(err)) -+ goto out; -+ -+ lockdep_off(); -+ err = vfs_rename(src_dir, src_dentry, dir, path->dentry, -+ delegated_inode, /*flags*/0); -+ lockdep_on(); -+ if (!err) { -+ int did; -+ -+ tmp.dentry = d->d_parent; -+ vfsub_update_h_iattr(&tmp, &did); -+ if (did) { -+ tmp.dentry = src_dentry; -+ vfsub_update_h_iattr(&tmp, /*did*/NULL); -+ tmp.dentry = src_dentry->d_parent; -+ vfsub_update_h_iattr(&tmp, /*did*/NULL); -+ } -+ /*ignore*/ -+ } -+ -+out: -+ return err; -+} -+ -+int vfsub_mkdir(struct inode *dir, struct path *path, int mode) -+{ -+ int err; -+ struct dentry *d; -+ -+ IMustLock(dir); -+ -+ d = path->dentry; -+ path->dentry = d->d_parent; -+ err = security_path_mkdir(path, d, mode); -+ path->dentry = d; -+ if (unlikely(err)) -+ goto out; -+ -+ lockdep_off(); -+ err = vfs_mkdir(dir, path->dentry, mode); -+ lockdep_on(); -+ if (!err) { -+ struct path tmp = *path; -+ int did; -+ -+ vfsub_update_h_iattr(&tmp, &did); -+ if (did) { -+ tmp.dentry = path->dentry->d_parent; -+ vfsub_update_h_iattr(&tmp, /*did*/NULL); -+ } -+ /*ignore*/ -+ } -+ -+out: -+ return err; -+} -+ -+int vfsub_rmdir(struct inode *dir, struct path *path) -+{ -+ int err; -+ struct dentry *d; -+ -+ IMustLock(dir); -+ -+ d = path->dentry; -+ path->dentry = d->d_parent; -+ err = security_path_rmdir(path, d); -+ path->dentry = d; -+ if (unlikely(err)) -+ goto out; -+ -+ lockdep_off(); -+ err = vfs_rmdir(dir, path->dentry); -+ lockdep_on(); -+ if (!err) { -+ struct path tmp = { -+ .dentry = path->dentry->d_parent, -+ .mnt = path->mnt -+ }; -+ -+ vfsub_update_h_iattr(&tmp, /*did*/NULL); /*ignore*/ -+ } -+ -+out: -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* todo: support mmap_sem? */ -+ssize_t vfsub_read_u(struct file *file, char __user *ubuf, size_t count, -+ loff_t *ppos) -+{ -+ ssize_t err; -+ -+ lockdep_off(); -+ err = vfs_read(file, ubuf, count, ppos); -+ lockdep_on(); -+ if (err >= 0) -+ vfsub_update_h_iattr(&file->f_path, /*did*/NULL); /*ignore*/ -+ return err; -+} -+ -+/* todo: kernel_read()? */ -+ssize_t vfsub_read_k(struct file *file, void *kbuf, size_t count, -+ loff_t *ppos) -+{ -+ ssize_t err; -+ mm_segment_t oldfs; -+ union { -+ void *k; -+ char __user *u; -+ } buf; -+ -+ buf.k = kbuf; -+ oldfs = get_fs(); -+ set_fs(KERNEL_DS); -+ err = vfsub_read_u(file, buf.u, count, ppos); -+ set_fs(oldfs); -+ return err; -+} -+ -+ssize_t vfsub_write_u(struct file *file, const char __user *ubuf, size_t count, -+ loff_t *ppos) -+{ -+ ssize_t err; -+ -+ lockdep_off(); -+ err = vfs_write(file, ubuf, count, ppos); -+ lockdep_on(); -+ if (err >= 0) -+ vfsub_update_h_iattr(&file->f_path, /*did*/NULL); /*ignore*/ -+ return err; -+} -+ -+ssize_t vfsub_write_k(struct file *file, void *kbuf, size_t count, loff_t *ppos) -+{ -+ ssize_t err; -+ mm_segment_t oldfs; -+ union { -+ void *k; -+ const char __user *u; -+ } buf; -+ -+ buf.k = kbuf; -+ oldfs = get_fs(); -+ set_fs(KERNEL_DS); -+ err = vfsub_write_u(file, buf.u, count, ppos); -+ set_fs(oldfs); -+ return err; -+} -+ -+int vfsub_flush(struct file *file, fl_owner_t id) -+{ -+ int err; -+ -+ err = 0; -+ if (file->f_op->flush) { -+ if (!au_test_nfs(file->f_path.dentry->d_sb)) -+ err = file->f_op->flush(file, id); -+ else { -+ lockdep_off(); -+ err = file->f_op->flush(file, id); -+ lockdep_on(); -+ } -+ if (!err) -+ vfsub_update_h_iattr(&file->f_path, /*did*/NULL); -+ /*ignore*/ -+ } -+ return err; -+} -+ -+int vfsub_iterate_dir(struct file *file, struct dir_context *ctx) -+{ -+ int err; -+ -+ AuDbg("%pD, ctx{%pf, %llu}\n", file, ctx->actor, ctx->pos); -+ -+ lockdep_off(); -+ err = iterate_dir(file, ctx); -+ lockdep_on(); -+ if (err >= 0) -+ vfsub_update_h_iattr(&file->f_path, /*did*/NULL); /*ignore*/ -+ return err; -+} -+ -+long vfsub_splice_to(struct file *in, loff_t *ppos, -+ struct pipe_inode_info *pipe, size_t len, -+ unsigned int flags) -+{ -+ long err; -+ -+ lockdep_off(); -+ err = do_splice_to(in, ppos, pipe, len, flags); -+ lockdep_on(); -+ file_accessed(in); -+ if (err >= 0) -+ vfsub_update_h_iattr(&in->f_path, /*did*/NULL); /*ignore*/ -+ return err; -+} -+ -+long vfsub_splice_from(struct pipe_inode_info *pipe, struct file *out, -+ loff_t *ppos, size_t len, unsigned int flags) -+{ -+ long err; -+ -+ lockdep_off(); -+ err = do_splice_from(pipe, out, ppos, len, flags); -+ lockdep_on(); -+ if (err >= 0) -+ vfsub_update_h_iattr(&out->f_path, /*did*/NULL); /*ignore*/ -+ return err; -+} -+ -+int vfsub_fsync(struct file *file, struct path *path, int datasync) -+{ -+ int err; -+ -+ /* file can be NULL */ -+ lockdep_off(); -+ err = vfs_fsync(file, datasync); -+ lockdep_on(); -+ if (!err) { -+ if (!path) { -+ AuDebugOn(!file); -+ path = &file->f_path; -+ } -+ vfsub_update_h_iattr(path, /*did*/NULL); /*ignore*/ -+ } -+ return err; -+} -+ -+/* cf. open.c:do_sys_truncate() and do_sys_ftruncate() */ -+int vfsub_trunc(struct path *h_path, loff_t length, unsigned int attr, -+ struct file *h_file) -+{ -+ int err; -+ struct inode *h_inode; -+ struct super_block *h_sb; -+ -+ if (!h_file) { -+ err = vfsub_truncate(h_path, length); -+ goto out; -+ } -+ -+ h_inode = d_inode(h_path->dentry); -+ h_sb = h_inode->i_sb; -+ lockdep_off(); -+ sb_start_write(h_sb); -+ lockdep_on(); -+ err = locks_verify_truncate(h_inode, h_file, length); -+ if (!err) -+ err = security_path_truncate(h_path); -+ if (!err) { -+ lockdep_off(); -+ err = do_truncate(h_path->dentry, length, attr, h_file); -+ lockdep_on(); -+ } -+ lockdep_off(); -+ sb_end_write(h_sb); -+ lockdep_on(); -+ -+out: -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+struct au_vfsub_mkdir_args { -+ int *errp; -+ struct inode *dir; -+ struct path *path; -+ int mode; -+}; -+ -+static void au_call_vfsub_mkdir(void *args) -+{ -+ struct au_vfsub_mkdir_args *a = args; -+ *a->errp = vfsub_mkdir(a->dir, a->path, a->mode); -+} -+ -+int vfsub_sio_mkdir(struct inode *dir, struct path *path, int mode) -+{ -+ int err, do_sio, wkq_err; -+ -+ do_sio = au_test_h_perm_sio(dir, MAY_EXEC | MAY_WRITE); -+ if (!do_sio) { -+ lockdep_off(); -+ err = vfsub_mkdir(dir, path, mode); -+ lockdep_on(); -+ } else { -+ struct au_vfsub_mkdir_args args = { -+ .errp = &err, -+ .dir = dir, -+ .path = path, -+ .mode = mode -+ }; -+ wkq_err = au_wkq_wait(au_call_vfsub_mkdir, &args); -+ if (unlikely(wkq_err)) -+ err = wkq_err; -+ } -+ -+ return err; -+} -+ -+struct au_vfsub_rmdir_args { -+ int *errp; -+ struct inode *dir; -+ struct path *path; -+}; -+ -+static void au_call_vfsub_rmdir(void *args) -+{ -+ struct au_vfsub_rmdir_args *a = args; -+ *a->errp = vfsub_rmdir(a->dir, a->path); -+} -+ -+int vfsub_sio_rmdir(struct inode *dir, struct path *path) -+{ -+ int err, do_sio, wkq_err; -+ -+ do_sio = au_test_h_perm_sio(dir, MAY_EXEC | MAY_WRITE); -+ if (!do_sio) { -+ lockdep_off(); -+ err = vfsub_rmdir(dir, path); -+ lockdep_on(); -+ } else { -+ struct au_vfsub_rmdir_args args = { -+ .errp = &err, -+ .dir = dir, -+ .path = path -+ }; -+ wkq_err = au_wkq_wait(au_call_vfsub_rmdir, &args); -+ if (unlikely(wkq_err)) -+ err = wkq_err; -+ } -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+struct notify_change_args { -+ int *errp; -+ struct path *path; -+ struct iattr *ia; -+ struct inode **delegated_inode; -+}; -+ -+static void call_notify_change(void *args) -+{ -+ struct notify_change_args *a = args; -+ struct inode *h_inode; -+ -+ h_inode = d_inode(a->path->dentry); -+ IMustLock(h_inode); -+ -+ *a->errp = -EPERM; -+ if (!IS_IMMUTABLE(h_inode) && !IS_APPEND(h_inode)) { -+ lockdep_off(); -+ *a->errp = notify_change(a->path->dentry, a->ia, -+ a->delegated_inode); -+ lockdep_on(); -+ if (!*a->errp) -+ vfsub_update_h_iattr(a->path, /*did*/NULL); /*ignore*/ -+ } -+ AuTraceErr(*a->errp); -+} -+ -+int vfsub_notify_change(struct path *path, struct iattr *ia, -+ struct inode **delegated_inode) -+{ -+ int err; -+ struct notify_change_args args = { -+ .errp = &err, -+ .path = path, -+ .ia = ia, -+ .delegated_inode = delegated_inode -+ }; -+ -+ call_notify_change(&args); -+ -+ return err; -+} -+ -+int vfsub_sio_notify_change(struct path *path, struct iattr *ia, -+ struct inode **delegated_inode) -+{ -+ int err, wkq_err; -+ struct notify_change_args args = { -+ .errp = &err, -+ .path = path, -+ .ia = ia, -+ .delegated_inode = delegated_inode -+ }; -+ -+ wkq_err = au_wkq_wait(call_notify_change, &args); -+ if (unlikely(wkq_err)) -+ err = wkq_err; -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+struct unlink_args { -+ int *errp; -+ struct inode *dir; -+ struct path *path; -+ struct inode **delegated_inode; -+}; -+ -+static void call_unlink(void *args) -+{ -+ struct unlink_args *a = args; -+ struct dentry *d = a->path->dentry; -+ struct inode *h_inode; -+ const int stop_sillyrename = (au_test_nfs(d->d_sb) -+ && au_dcount(d) == 1); -+ -+ IMustLock(a->dir); -+ -+ a->path->dentry = d->d_parent; -+ *a->errp = security_path_unlink(a->path, d); -+ a->path->dentry = d; -+ if (unlikely(*a->errp)) -+ return; -+ -+ if (!stop_sillyrename) -+ dget(d); -+ h_inode = NULL; -+ if (d_is_positive(d)) { -+ h_inode = d_inode(d); -+ ihold(h_inode); -+ } -+ -+ lockdep_off(); -+ *a->errp = vfs_unlink(a->dir, d, a->delegated_inode); -+ lockdep_on(); -+ if (!*a->errp) { -+ struct path tmp = { -+ .dentry = d->d_parent, -+ .mnt = a->path->mnt -+ }; -+ vfsub_update_h_iattr(&tmp, /*did*/NULL); /*ignore*/ -+ } -+ -+ if (!stop_sillyrename) -+ dput(d); -+ if (h_inode) -+ iput(h_inode); -+ -+ AuTraceErr(*a->errp); -+} -+ -+/* -+ * @dir: must be locked. -+ * @dentry: target dentry. -+ */ -+int vfsub_unlink(struct inode *dir, struct path *path, -+ struct inode **delegated_inode, int force) -+{ -+ int err; -+ struct unlink_args args = { -+ .errp = &err, -+ .dir = dir, -+ .path = path, -+ .delegated_inode = delegated_inode -+ }; -+ -+ if (!force) -+ call_unlink(&args); -+ else { -+ int wkq_err; -+ -+ wkq_err = au_wkq_wait(call_unlink, &args); -+ if (unlikely(wkq_err)) -+ err = wkq_err; -+ } -+ -+ return err; -+} -diff --git a/fs/aufs/vfsub.h b/fs/aufs/vfsub.h -new file mode 100644 -index 0000000..64fff0f ---- /dev/null -+++ b/fs/aufs/vfsub.h -@@ -0,0 +1,303 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * sub-routines for VFS -+ */ -+ -+#ifndef __AUFS_VFSUB_H__ -+#define __AUFS_VFSUB_H__ -+ -+#ifdef __KERNEL__ -+ -+#include -+#include -+#include -+#include -+#include "debug.h" -+ -+/* copied from linux/fs/internal.h */ -+/* todo: BAD approach!! */ -+extern void __mnt_drop_write(struct vfsmount *); -+extern int open_check_o_direct(struct file *f); -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* lock subclass for lower inode */ -+/* default MAX_LOCKDEP_SUBCLASSES(8) is not enough */ -+/* reduce? gave up. */ -+enum { -+ AuLsc_I_Begin = I_MUTEX_PARENT2, /* 5 */ -+ AuLsc_I_PARENT, /* lower inode, parent first */ -+ AuLsc_I_PARENT2, /* copyup dirs */ -+ AuLsc_I_PARENT3, /* copyup wh */ -+ AuLsc_I_CHILD, -+ AuLsc_I_CHILD2, -+ AuLsc_I_End -+}; -+ -+/* to debug easier, do not make them inlined functions */ -+#define MtxMustLock(mtx) AuDebugOn(!mutex_is_locked(mtx)) -+#define IMustLock(i) AuDebugOn(!inode_is_locked(i)) -+ -+/* ---------------------------------------------------------------------- */ -+ -+static inline void vfsub_drop_nlink(struct inode *inode) -+{ -+ AuDebugOn(!inode->i_nlink); -+ drop_nlink(inode); -+} -+ -+static inline void vfsub_dead_dir(struct inode *inode) -+{ -+ AuDebugOn(!S_ISDIR(inode->i_mode)); -+ inode->i_flags |= S_DEAD; -+ clear_nlink(inode); -+} -+ -+static inline int vfsub_native_ro(struct inode *inode) -+{ -+ return (inode->i_sb->s_flags & MS_RDONLY) -+ || IS_RDONLY(inode) -+ /* || IS_APPEND(inode) */ -+ || IS_IMMUTABLE(inode); -+} -+ -+#ifdef CONFIG_AUFS_BR_FUSE -+int vfsub_test_mntns(struct vfsmount *mnt, struct super_block *h_sb); -+#else -+AuStubInt0(vfsub_test_mntns, struct vfsmount *mnt, struct super_block *h_sb); -+#endif -+ -+/* ---------------------------------------------------------------------- */ -+ -+int vfsub_update_h_iattr(struct path *h_path, int *did); -+struct file *vfsub_dentry_open(struct path *path, int flags); -+struct file *vfsub_filp_open(const char *path, int oflags, int mode); -+struct vfsub_aopen_args { -+ struct file *file; -+ unsigned int open_flag; -+ umode_t create_mode; -+ int *opened; -+}; -+struct au_branch; -+int vfsub_atomic_open(struct inode *dir, struct dentry *dentry, -+ struct vfsub_aopen_args *args, struct au_branch *br); -+int vfsub_kern_path(const char *name, unsigned int flags, struct path *path); -+ -+struct dentry *vfsub_lookup_one_len_unlocked(const char *name, -+ struct dentry *parent, int len); -+struct dentry *vfsub_lookup_one_len(const char *name, struct dentry *parent, -+ int len); -+ -+struct vfsub_lkup_one_args { -+ struct dentry **errp; -+ struct qstr *name; -+ struct dentry *parent; -+}; -+ -+static inline struct dentry *vfsub_lkup_one(struct qstr *name, -+ struct dentry *parent) -+{ -+ return vfsub_lookup_one_len(name->name, parent, name->len); -+} -+ -+void vfsub_call_lkup_one(void *args); -+ -+/* ---------------------------------------------------------------------- */ -+ -+static inline int vfsub_mnt_want_write(struct vfsmount *mnt) -+{ -+ int err; -+ -+ lockdep_off(); -+ err = mnt_want_write(mnt); -+ lockdep_on(); -+ return err; -+} -+ -+static inline void vfsub_mnt_drop_write(struct vfsmount *mnt) -+{ -+ lockdep_off(); -+ mnt_drop_write(mnt); -+ lockdep_on(); -+} -+ -+#if 0 /* reserved */ -+static inline void vfsub_mnt_drop_write_file(struct file *file) -+{ -+ lockdep_off(); -+ mnt_drop_write_file(file); -+ lockdep_on(); -+} -+#endif -+ -+/* ---------------------------------------------------------------------- */ -+ -+struct au_hinode; -+struct dentry *vfsub_lock_rename(struct dentry *d1, struct au_hinode *hdir1, -+ struct dentry *d2, struct au_hinode *hdir2); -+void vfsub_unlock_rename(struct dentry *d1, struct au_hinode *hdir1, -+ struct dentry *d2, struct au_hinode *hdir2); -+ -+int vfsub_create(struct inode *dir, struct path *path, int mode, -+ bool want_excl); -+int vfsub_symlink(struct inode *dir, struct path *path, -+ const char *symname); -+int vfsub_mknod(struct inode *dir, struct path *path, int mode, dev_t dev); -+int vfsub_link(struct dentry *src_dentry, struct inode *dir, -+ struct path *path, struct inode **delegated_inode); -+int vfsub_rename(struct inode *src_hdir, struct dentry *src_dentry, -+ struct inode *hdir, struct path *path, -+ struct inode **delegated_inode); -+int vfsub_mkdir(struct inode *dir, struct path *path, int mode); -+int vfsub_rmdir(struct inode *dir, struct path *path); -+ -+/* ---------------------------------------------------------------------- */ -+ -+ssize_t vfsub_read_u(struct file *file, char __user *ubuf, size_t count, -+ loff_t *ppos); -+ssize_t vfsub_read_k(struct file *file, void *kbuf, size_t count, -+ loff_t *ppos); -+ssize_t vfsub_write_u(struct file *file, const char __user *ubuf, size_t count, -+ loff_t *ppos); -+ssize_t vfsub_write_k(struct file *file, void *kbuf, size_t count, -+ loff_t *ppos); -+int vfsub_flush(struct file *file, fl_owner_t id); -+int vfsub_iterate_dir(struct file *file, struct dir_context *ctx); -+ -+static inline loff_t vfsub_f_size_read(struct file *file) -+{ -+ return i_size_read(file_inode(file)); -+} -+ -+static inline unsigned int vfsub_file_flags(struct file *file) -+{ -+ unsigned int flags; -+ -+ spin_lock(&file->f_lock); -+ flags = file->f_flags; -+ spin_unlock(&file->f_lock); -+ -+ return flags; -+} -+ -+static inline int vfsub_file_execed(struct file *file) -+{ -+ /* todo: direct access f_flags */ -+ return !!(vfsub_file_flags(file) & __FMODE_EXEC); -+} -+ -+#if 0 /* reserved */ -+static inline void vfsub_file_accessed(struct file *h_file) -+{ -+ file_accessed(h_file); -+ vfsub_update_h_iattr(&h_file->f_path, /*did*/NULL); /*ignore*/ -+} -+#endif -+ -+#if 0 /* reserved */ -+static inline void vfsub_touch_atime(struct vfsmount *h_mnt, -+ struct dentry *h_dentry) -+{ -+ struct path h_path = { -+ .dentry = h_dentry, -+ .mnt = h_mnt -+ }; -+ touch_atime(&h_path); -+ vfsub_update_h_iattr(&h_path, /*did*/NULL); /*ignore*/ -+} -+#endif -+ -+static inline int vfsub_update_time(struct inode *h_inode, struct timespec *ts, -+ int flags) -+{ -+ return update_time(h_inode, ts, flags); -+ /* no vfsub_update_h_iattr() since we don't have struct path */ -+} -+ -+#ifdef CONFIG_FS_POSIX_ACL -+static inline int vfsub_acl_chmod(struct inode *h_inode, umode_t h_mode) -+{ -+ int err; -+ -+ err = posix_acl_chmod(h_inode, h_mode); -+ if (err == -EOPNOTSUPP) -+ err = 0; -+ return err; -+} -+#else -+AuStubInt0(vfsub_acl_chmod, struct inode *h_inode, umode_t h_mode); -+#endif -+ -+long vfsub_splice_to(struct file *in, loff_t *ppos, -+ struct pipe_inode_info *pipe, size_t len, -+ unsigned int flags); -+long vfsub_splice_from(struct pipe_inode_info *pipe, struct file *out, -+ loff_t *ppos, size_t len, unsigned int flags); -+ -+static inline long vfsub_truncate(struct path *path, loff_t length) -+{ -+ long err; -+ -+ lockdep_off(); -+ err = vfs_truncate(path, length); -+ lockdep_on(); -+ return err; -+} -+ -+int vfsub_trunc(struct path *h_path, loff_t length, unsigned int attr, -+ struct file *h_file); -+int vfsub_fsync(struct file *file, struct path *path, int datasync); -+ -+/* ---------------------------------------------------------------------- */ -+ -+static inline loff_t vfsub_llseek(struct file *file, loff_t offset, int origin) -+{ -+ loff_t err; -+ -+ lockdep_off(); -+ err = vfs_llseek(file, offset, origin); -+ lockdep_on(); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+int vfsub_sio_mkdir(struct inode *dir, struct path *path, int mode); -+int vfsub_sio_rmdir(struct inode *dir, struct path *path); -+int vfsub_sio_notify_change(struct path *path, struct iattr *ia, -+ struct inode **delegated_inode); -+int vfsub_notify_change(struct path *path, struct iattr *ia, -+ struct inode **delegated_inode); -+int vfsub_unlink(struct inode *dir, struct path *path, -+ struct inode **delegated_inode, int force); -+ -+/* ---------------------------------------------------------------------- */ -+ -+static inline int vfsub_setxattr(struct dentry *dentry, const char *name, -+ const void *value, size_t size, int flags) -+{ -+ int err; -+ -+ lockdep_off(); -+ err = vfs_setxattr(dentry, name, value, size, flags); -+ lockdep_on(); -+ -+ return err; -+} -+ -+static inline int vfsub_removexattr(struct dentry *dentry, const char *name) -+{ -+ int err; -+ -+ lockdep_off(); -+ err = vfs_removexattr(dentry, name); -+ lockdep_on(); -+ -+ return err; -+} -+ -+#endif /* __KERNEL__ */ -+#endif /* __AUFS_VFSUB_H__ */ -diff --git a/fs/aufs/wbr_policy.c b/fs/aufs/wbr_policy.c -new file mode 100644 -index 0000000..79eb9b4 ---- /dev/null -+++ b/fs/aufs/wbr_policy.c -@@ -0,0 +1,752 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * policies for selecting one among multiple writable branches -+ */ -+ -+#include -+#include "aufs.h" -+ -+/* subset of cpup_attr() */ -+static noinline_for_stack -+int au_cpdown_attr(struct path *h_path, struct dentry *h_src) -+{ -+ int err, sbits; -+ struct iattr ia; -+ struct inode *h_isrc; -+ -+ h_isrc = d_inode(h_src); -+ ia.ia_valid = ATTR_FORCE | ATTR_MODE | ATTR_UID | ATTR_GID; -+ ia.ia_mode = h_isrc->i_mode; -+ ia.ia_uid = h_isrc->i_uid; -+ ia.ia_gid = h_isrc->i_gid; -+ sbits = !!(ia.ia_mode & (S_ISUID | S_ISGID)); -+ au_cpup_attr_flags(d_inode(h_path->dentry), h_isrc->i_flags); -+ /* no delegation since it is just created */ -+ err = vfsub_sio_notify_change(h_path, &ia, /*delegated*/NULL); -+ -+ /* is this nfs only? */ -+ if (!err && sbits && au_test_nfs(h_path->dentry->d_sb)) { -+ ia.ia_valid = ATTR_FORCE | ATTR_MODE; -+ ia.ia_mode = h_isrc->i_mode; -+ err = vfsub_sio_notify_change(h_path, &ia, /*delegated*/NULL); -+ } -+ -+ return err; -+} -+ -+#define AuCpdown_PARENT_OPQ 1 -+#define AuCpdown_WHED (1 << 1) -+#define AuCpdown_MADE_DIR (1 << 2) -+#define AuCpdown_DIROPQ (1 << 3) -+#define au_ftest_cpdown(flags, name) ((flags) & AuCpdown_##name) -+#define au_fset_cpdown(flags, name) \ -+ do { (flags) |= AuCpdown_##name; } while (0) -+#define au_fclr_cpdown(flags, name) \ -+ do { (flags) &= ~AuCpdown_##name; } while (0) -+ -+static int au_cpdown_dir_opq(struct dentry *dentry, aufs_bindex_t bdst, -+ unsigned int *flags) -+{ -+ int err; -+ struct dentry *opq_dentry; -+ -+ opq_dentry = au_diropq_create(dentry, bdst); -+ err = PTR_ERR(opq_dentry); -+ if (IS_ERR(opq_dentry)) -+ goto out; -+ dput(opq_dentry); -+ au_fset_cpdown(*flags, DIROPQ); -+ -+out: -+ return err; -+} -+ -+static int au_cpdown_dir_wh(struct dentry *dentry, struct dentry *h_parent, -+ struct inode *dir, aufs_bindex_t bdst) -+{ -+ int err; -+ struct path h_path; -+ struct au_branch *br; -+ -+ br = au_sbr(dentry->d_sb, bdst); -+ h_path.dentry = au_wh_lkup(h_parent, &dentry->d_name, br); -+ err = PTR_ERR(h_path.dentry); -+ if (IS_ERR(h_path.dentry)) -+ goto out; -+ -+ err = 0; -+ if (d_is_positive(h_path.dentry)) { -+ h_path.mnt = au_br_mnt(br); -+ err = au_wh_unlink_dentry(au_h_iptr(dir, bdst), &h_path, -+ dentry); -+ } -+ dput(h_path.dentry); -+ -+out: -+ return err; -+} -+ -+static int au_cpdown_dir(struct dentry *dentry, aufs_bindex_t bdst, -+ struct au_pin *pin, -+ struct dentry *h_parent, void *arg) -+{ -+ int err, rerr; -+ aufs_bindex_t bopq, btop; -+ struct path h_path; -+ struct dentry *parent; -+ struct inode *h_dir, *h_inode, *inode, *dir; -+ unsigned int *flags = arg; -+ -+ btop = au_dbtop(dentry); -+ /* dentry is di-locked */ -+ parent = dget_parent(dentry); -+ dir = d_inode(parent); -+ h_dir = d_inode(h_parent); -+ AuDebugOn(h_dir != au_h_iptr(dir, bdst)); -+ IMustLock(h_dir); -+ -+ err = au_lkup_neg(dentry, bdst, /*wh*/0); -+ if (unlikely(err < 0)) -+ goto out; -+ h_path.dentry = au_h_dptr(dentry, bdst); -+ h_path.mnt = au_sbr_mnt(dentry->d_sb, bdst); -+ err = vfsub_sio_mkdir(au_h_iptr(dir, bdst), &h_path, -+ S_IRWXU | S_IRUGO | S_IXUGO); -+ if (unlikely(err)) -+ goto out_put; -+ au_fset_cpdown(*flags, MADE_DIR); -+ -+ bopq = au_dbdiropq(dentry); -+ au_fclr_cpdown(*flags, WHED); -+ au_fclr_cpdown(*flags, DIROPQ); -+ if (au_dbwh(dentry) == bdst) -+ au_fset_cpdown(*flags, WHED); -+ if (!au_ftest_cpdown(*flags, PARENT_OPQ) && bopq <= bdst) -+ au_fset_cpdown(*flags, PARENT_OPQ); -+ h_inode = d_inode(h_path.dentry); -+ inode_lock_nested(h_inode, AuLsc_I_CHILD); -+ if (au_ftest_cpdown(*flags, WHED)) { -+ err = au_cpdown_dir_opq(dentry, bdst, flags); -+ if (unlikely(err)) { -+ inode_unlock(h_inode); -+ goto out_dir; -+ } -+ } -+ -+ err = au_cpdown_attr(&h_path, au_h_dptr(dentry, btop)); -+ inode_unlock(h_inode); -+ if (unlikely(err)) -+ goto out_opq; -+ -+ if (au_ftest_cpdown(*flags, WHED)) { -+ err = au_cpdown_dir_wh(dentry, h_parent, dir, bdst); -+ if (unlikely(err)) -+ goto out_opq; -+ } -+ -+ inode = d_inode(dentry); -+ if (au_ibbot(inode) < bdst) -+ au_set_ibbot(inode, bdst); -+ au_set_h_iptr(inode, bdst, au_igrab(h_inode), -+ au_hi_flags(inode, /*isdir*/1)); -+ au_fhsm_wrote(dentry->d_sb, bdst, /*force*/0); -+ goto out; /* success */ -+ -+ /* revert */ -+out_opq: -+ if (au_ftest_cpdown(*flags, DIROPQ)) { -+ inode_lock_nested(h_inode, AuLsc_I_CHILD); -+ rerr = au_diropq_remove(dentry, bdst); -+ inode_unlock(h_inode); -+ if (unlikely(rerr)) { -+ AuIOErr("failed removing diropq for %pd b%d (%d)\n", -+ dentry, bdst, rerr); -+ err = -EIO; -+ goto out; -+ } -+ } -+out_dir: -+ if (au_ftest_cpdown(*flags, MADE_DIR)) { -+ rerr = vfsub_sio_rmdir(au_h_iptr(dir, bdst), &h_path); -+ if (unlikely(rerr)) { -+ AuIOErr("failed removing %pd b%d (%d)\n", -+ dentry, bdst, rerr); -+ err = -EIO; -+ } -+ } -+out_put: -+ au_set_h_dptr(dentry, bdst, NULL); -+ if (au_dbbot(dentry) == bdst) -+ au_update_dbbot(dentry); -+out: -+ dput(parent); -+ return err; -+} -+ -+int au_cpdown_dirs(struct dentry *dentry, aufs_bindex_t bdst) -+{ -+ int err; -+ unsigned int flags; -+ -+ flags = 0; -+ err = au_cp_dirs(dentry, bdst, au_cpdown_dir, &flags); -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* policies for create */ -+ -+int au_wbr_nonopq(struct dentry *dentry, aufs_bindex_t bindex) -+{ -+ int err, i, j, ndentry; -+ aufs_bindex_t bopq; -+ struct au_dcsub_pages dpages; -+ struct au_dpage *dpage; -+ struct dentry **dentries, *parent, *d; -+ -+ err = au_dpages_init(&dpages, GFP_NOFS); -+ if (unlikely(err)) -+ goto out; -+ parent = dget_parent(dentry); -+ err = au_dcsub_pages_rev_aufs(&dpages, parent, /*do_include*/0); -+ if (unlikely(err)) -+ goto out_free; -+ -+ err = bindex; -+ for (i = 0; i < dpages.ndpage; i++) { -+ dpage = dpages.dpages + i; -+ dentries = dpage->dentries; -+ ndentry = dpage->ndentry; -+ for (j = 0; j < ndentry; j++) { -+ d = dentries[j]; -+ di_read_lock_parent2(d, !AuLock_IR); -+ bopq = au_dbdiropq(d); -+ di_read_unlock(d, !AuLock_IR); -+ if (bopq >= 0 && bopq < err) -+ err = bopq; -+ } -+ } -+ -+out_free: -+ dput(parent); -+ au_dpages_free(&dpages); -+out: -+ return err; -+} -+ -+static int au_wbr_bu(struct super_block *sb, aufs_bindex_t bindex) -+{ -+ for (; bindex >= 0; bindex--) -+ if (!au_br_rdonly(au_sbr(sb, bindex))) -+ return bindex; -+ return -EROFS; -+} -+ -+/* top down parent */ -+static int au_wbr_create_tdp(struct dentry *dentry, -+ unsigned int flags __maybe_unused) -+{ -+ int err; -+ aufs_bindex_t btop, bindex; -+ struct super_block *sb; -+ struct dentry *parent, *h_parent; -+ -+ sb = dentry->d_sb; -+ btop = au_dbtop(dentry); -+ err = btop; -+ if (!au_br_rdonly(au_sbr(sb, btop))) -+ goto out; -+ -+ err = -EROFS; -+ parent = dget_parent(dentry); -+ for (bindex = au_dbtop(parent); bindex < btop; bindex++) { -+ h_parent = au_h_dptr(parent, bindex); -+ if (!h_parent || d_is_negative(h_parent)) -+ continue; -+ -+ if (!au_br_rdonly(au_sbr(sb, bindex))) { -+ err = bindex; -+ break; -+ } -+ } -+ dput(parent); -+ -+ /* bottom up here */ -+ if (unlikely(err < 0)) { -+ err = au_wbr_bu(sb, btop - 1); -+ if (err >= 0) -+ err = au_wbr_nonopq(dentry, err); -+ } -+ -+out: -+ AuDbg("b%d\n", err); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* an exception for the policy other than tdp */ -+static int au_wbr_create_exp(struct dentry *dentry) -+{ -+ int err; -+ aufs_bindex_t bwh, bdiropq; -+ struct dentry *parent; -+ -+ err = -1; -+ bwh = au_dbwh(dentry); -+ parent = dget_parent(dentry); -+ bdiropq = au_dbdiropq(parent); -+ if (bwh >= 0) { -+ if (bdiropq >= 0) -+ err = min(bdiropq, bwh); -+ else -+ err = bwh; -+ AuDbg("%d\n", err); -+ } else if (bdiropq >= 0) { -+ err = bdiropq; -+ AuDbg("%d\n", err); -+ } -+ dput(parent); -+ -+ if (err >= 0) -+ err = au_wbr_nonopq(dentry, err); -+ -+ if (err >= 0 && au_br_rdonly(au_sbr(dentry->d_sb, err))) -+ err = -1; -+ -+ AuDbg("%d\n", err); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* round robin */ -+static int au_wbr_create_init_rr(struct super_block *sb) -+{ -+ int err; -+ -+ err = au_wbr_bu(sb, au_sbbot(sb)); -+ atomic_set(&au_sbi(sb)->si_wbr_rr_next, -err); /* less important */ -+ /* smp_mb(); */ -+ -+ AuDbg("b%d\n", err); -+ return err; -+} -+ -+static int au_wbr_create_rr(struct dentry *dentry, unsigned int flags) -+{ -+ int err, nbr; -+ unsigned int u; -+ aufs_bindex_t bindex, bbot; -+ struct super_block *sb; -+ atomic_t *next; -+ -+ err = au_wbr_create_exp(dentry); -+ if (err >= 0) -+ goto out; -+ -+ sb = dentry->d_sb; -+ next = &au_sbi(sb)->si_wbr_rr_next; -+ bbot = au_sbbot(sb); -+ nbr = bbot + 1; -+ for (bindex = 0; bindex <= bbot; bindex++) { -+ if (!au_ftest_wbr(flags, DIR)) { -+ err = atomic_dec_return(next) + 1; -+ /* modulo for 0 is meaningless */ -+ if (unlikely(!err)) -+ err = atomic_dec_return(next) + 1; -+ } else -+ err = atomic_read(next); -+ AuDbg("%d\n", err); -+ u = err; -+ err = u % nbr; -+ AuDbg("%d\n", err); -+ if (!au_br_rdonly(au_sbr(sb, err))) -+ break; -+ err = -EROFS; -+ } -+ -+ if (err >= 0) -+ err = au_wbr_nonopq(dentry, err); -+ -+out: -+ AuDbg("%d\n", err); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* most free space */ -+static void au_mfs(struct dentry *dentry, struct dentry *parent) -+{ -+ struct super_block *sb; -+ struct au_branch *br; -+ struct au_wbr_mfs *mfs; -+ struct dentry *h_parent; -+ aufs_bindex_t bindex, bbot; -+ int err; -+ unsigned long long b, bavail; -+ struct path h_path; -+ /* reduce the stack usage */ -+ struct kstatfs *st; -+ -+ st = kmalloc(sizeof(*st), GFP_NOFS); -+ if (unlikely(!st)) { -+ AuWarn1("failed updating mfs(%d), ignored\n", -ENOMEM); -+ return; -+ } -+ -+ bavail = 0; -+ sb = dentry->d_sb; -+ mfs = &au_sbi(sb)->si_wbr_mfs; -+ MtxMustLock(&mfs->mfs_lock); -+ mfs->mfs_bindex = -EROFS; -+ mfs->mfsrr_bytes = 0; -+ if (!parent) { -+ bindex = 0; -+ bbot = au_sbbot(sb); -+ } else { -+ bindex = au_dbtop(parent); -+ bbot = au_dbtaildir(parent); -+ } -+ -+ for (; bindex <= bbot; bindex++) { -+ if (parent) { -+ h_parent = au_h_dptr(parent, bindex); -+ if (!h_parent || d_is_negative(h_parent)) -+ continue; -+ } -+ br = au_sbr(sb, bindex); -+ if (au_br_rdonly(br)) -+ continue; -+ -+ /* sb->s_root for NFS is unreliable */ -+ h_path.mnt = au_br_mnt(br); -+ h_path.dentry = h_path.mnt->mnt_root; -+ err = vfs_statfs(&h_path, st); -+ if (unlikely(err)) { -+ AuWarn1("failed statfs, b%d, %d\n", bindex, err); -+ continue; -+ } -+ -+ /* when the available size is equal, select the lower one */ -+ BUILD_BUG_ON(sizeof(b) < sizeof(st->f_bavail) -+ || sizeof(b) < sizeof(st->f_bsize)); -+ b = st->f_bavail * st->f_bsize; -+ br->br_wbr->wbr_bytes = b; -+ if (b >= bavail) { -+ bavail = b; -+ mfs->mfs_bindex = bindex; -+ mfs->mfs_jiffy = jiffies; -+ } -+ } -+ -+ mfs->mfsrr_bytes = bavail; -+ AuDbg("b%d\n", mfs->mfs_bindex); -+ au_delayed_kfree(st); -+} -+ -+static int au_wbr_create_mfs(struct dentry *dentry, unsigned int flags) -+{ -+ int err; -+ struct dentry *parent; -+ struct super_block *sb; -+ struct au_wbr_mfs *mfs; -+ -+ err = au_wbr_create_exp(dentry); -+ if (err >= 0) -+ goto out; -+ -+ sb = dentry->d_sb; -+ parent = NULL; -+ if (au_ftest_wbr(flags, PARENT)) -+ parent = dget_parent(dentry); -+ mfs = &au_sbi(sb)->si_wbr_mfs; -+ mutex_lock(&mfs->mfs_lock); -+ if (time_after(jiffies, mfs->mfs_jiffy + mfs->mfs_expire) -+ || mfs->mfs_bindex < 0 -+ || au_br_rdonly(au_sbr(sb, mfs->mfs_bindex))) -+ au_mfs(dentry, parent); -+ mutex_unlock(&mfs->mfs_lock); -+ err = mfs->mfs_bindex; -+ dput(parent); -+ -+ if (err >= 0) -+ err = au_wbr_nonopq(dentry, err); -+ -+out: -+ AuDbg("b%d\n", err); -+ return err; -+} -+ -+static int au_wbr_create_init_mfs(struct super_block *sb) -+{ -+ struct au_wbr_mfs *mfs; -+ -+ mfs = &au_sbi(sb)->si_wbr_mfs; -+ mutex_init(&mfs->mfs_lock); -+ mfs->mfs_jiffy = 0; -+ mfs->mfs_bindex = -EROFS; -+ -+ return 0; -+} -+ -+static int au_wbr_create_fin_mfs(struct super_block *sb __maybe_unused) -+{ -+ mutex_destroy(&au_sbi(sb)->si_wbr_mfs.mfs_lock); -+ return 0; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* most free space and then round robin */ -+static int au_wbr_create_mfsrr(struct dentry *dentry, unsigned int flags) -+{ -+ int err; -+ struct au_wbr_mfs *mfs; -+ -+ err = au_wbr_create_mfs(dentry, flags); -+ if (err >= 0) { -+ mfs = &au_sbi(dentry->d_sb)->si_wbr_mfs; -+ mutex_lock(&mfs->mfs_lock); -+ if (mfs->mfsrr_bytes < mfs->mfsrr_watermark) -+ err = au_wbr_create_rr(dentry, flags); -+ mutex_unlock(&mfs->mfs_lock); -+ } -+ -+ AuDbg("b%d\n", err); -+ return err; -+} -+ -+static int au_wbr_create_init_mfsrr(struct super_block *sb) -+{ -+ int err; -+ -+ au_wbr_create_init_mfs(sb); /* ignore */ -+ err = au_wbr_create_init_rr(sb); -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* top down parent and most free space */ -+static int au_wbr_create_pmfs(struct dentry *dentry, unsigned int flags) -+{ -+ int err, e2; -+ unsigned long long b; -+ aufs_bindex_t bindex, btop, bbot; -+ struct super_block *sb; -+ struct dentry *parent, *h_parent; -+ struct au_branch *br; -+ -+ err = au_wbr_create_tdp(dentry, flags); -+ if (unlikely(err < 0)) -+ goto out; -+ parent = dget_parent(dentry); -+ btop = au_dbtop(parent); -+ bbot = au_dbtaildir(parent); -+ if (btop == bbot) -+ goto out_parent; /* success */ -+ -+ e2 = au_wbr_create_mfs(dentry, flags); -+ if (e2 < 0) -+ goto out_parent; /* success */ -+ -+ /* when the available size is equal, select upper one */ -+ sb = dentry->d_sb; -+ br = au_sbr(sb, err); -+ b = br->br_wbr->wbr_bytes; -+ AuDbg("b%d, %llu\n", err, b); -+ -+ for (bindex = btop; bindex <= bbot; bindex++) { -+ h_parent = au_h_dptr(parent, bindex); -+ if (!h_parent || d_is_negative(h_parent)) -+ continue; -+ -+ br = au_sbr(sb, bindex); -+ if (!au_br_rdonly(br) && br->br_wbr->wbr_bytes > b) { -+ b = br->br_wbr->wbr_bytes; -+ err = bindex; -+ AuDbg("b%d, %llu\n", err, b); -+ } -+ } -+ -+ if (err >= 0) -+ err = au_wbr_nonopq(dentry, err); -+ -+out_parent: -+ dput(parent); -+out: -+ AuDbg("b%d\n", err); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * - top down parent -+ * - most free space with parent -+ * - most free space round-robin regardless parent -+ */ -+static int au_wbr_create_pmfsrr(struct dentry *dentry, unsigned int flags) -+{ -+ int err; -+ unsigned long long watermark; -+ struct super_block *sb; -+ struct au_branch *br; -+ struct au_wbr_mfs *mfs; -+ -+ err = au_wbr_create_pmfs(dentry, flags | AuWbr_PARENT); -+ if (unlikely(err < 0)) -+ goto out; -+ -+ sb = dentry->d_sb; -+ br = au_sbr(sb, err); -+ mfs = &au_sbi(sb)->si_wbr_mfs; -+ mutex_lock(&mfs->mfs_lock); -+ watermark = mfs->mfsrr_watermark; -+ mutex_unlock(&mfs->mfs_lock); -+ if (br->br_wbr->wbr_bytes < watermark) -+ /* regardless the parent dir */ -+ err = au_wbr_create_mfsrr(dentry, flags); -+ -+out: -+ AuDbg("b%d\n", err); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* policies for copyup */ -+ -+/* top down parent */ -+static int au_wbr_copyup_tdp(struct dentry *dentry) -+{ -+ return au_wbr_create_tdp(dentry, /*flags, anything is ok*/0); -+} -+ -+/* bottom up parent */ -+static int au_wbr_copyup_bup(struct dentry *dentry) -+{ -+ int err; -+ aufs_bindex_t bindex, btop; -+ struct dentry *parent, *h_parent; -+ struct super_block *sb; -+ -+ err = -EROFS; -+ sb = dentry->d_sb; -+ parent = dget_parent(dentry); -+ btop = au_dbtop(parent); -+ for (bindex = au_dbtop(dentry); bindex >= btop; bindex--) { -+ h_parent = au_h_dptr(parent, bindex); -+ if (!h_parent || d_is_negative(h_parent)) -+ continue; -+ -+ if (!au_br_rdonly(au_sbr(sb, bindex))) { -+ err = bindex; -+ break; -+ } -+ } -+ dput(parent); -+ -+ /* bottom up here */ -+ if (unlikely(err < 0)) -+ err = au_wbr_bu(sb, btop - 1); -+ -+ AuDbg("b%d\n", err); -+ return err; -+} -+ -+/* bottom up */ -+int au_wbr_do_copyup_bu(struct dentry *dentry, aufs_bindex_t btop) -+{ -+ int err; -+ -+ err = au_wbr_bu(dentry->d_sb, btop); -+ AuDbg("b%d\n", err); -+ if (err > btop) -+ err = au_wbr_nonopq(dentry, err); -+ -+ AuDbg("b%d\n", err); -+ return err; -+} -+ -+static int au_wbr_copyup_bu(struct dentry *dentry) -+{ -+ int err; -+ aufs_bindex_t btop; -+ -+ btop = au_dbtop(dentry); -+ err = au_wbr_do_copyup_bu(dentry, btop); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+struct au_wbr_copyup_operations au_wbr_copyup_ops[] = { -+ [AuWbrCopyup_TDP] = { -+ .copyup = au_wbr_copyup_tdp -+ }, -+ [AuWbrCopyup_BUP] = { -+ .copyup = au_wbr_copyup_bup -+ }, -+ [AuWbrCopyup_BU] = { -+ .copyup = au_wbr_copyup_bu -+ } -+}; -+ -+struct au_wbr_create_operations au_wbr_create_ops[] = { -+ [AuWbrCreate_TDP] = { -+ .create = au_wbr_create_tdp -+ }, -+ [AuWbrCreate_RR] = { -+ .create = au_wbr_create_rr, -+ .init = au_wbr_create_init_rr -+ }, -+ [AuWbrCreate_MFS] = { -+ .create = au_wbr_create_mfs, -+ .init = au_wbr_create_init_mfs, -+ .fin = au_wbr_create_fin_mfs -+ }, -+ [AuWbrCreate_MFSV] = { -+ .create = au_wbr_create_mfs, -+ .init = au_wbr_create_init_mfs, -+ .fin = au_wbr_create_fin_mfs -+ }, -+ [AuWbrCreate_MFSRR] = { -+ .create = au_wbr_create_mfsrr, -+ .init = au_wbr_create_init_mfsrr, -+ .fin = au_wbr_create_fin_mfs -+ }, -+ [AuWbrCreate_MFSRRV] = { -+ .create = au_wbr_create_mfsrr, -+ .init = au_wbr_create_init_mfsrr, -+ .fin = au_wbr_create_fin_mfs -+ }, -+ [AuWbrCreate_PMFS] = { -+ .create = au_wbr_create_pmfs, -+ .init = au_wbr_create_init_mfs, -+ .fin = au_wbr_create_fin_mfs -+ }, -+ [AuWbrCreate_PMFSV] = { -+ .create = au_wbr_create_pmfs, -+ .init = au_wbr_create_init_mfs, -+ .fin = au_wbr_create_fin_mfs -+ }, -+ [AuWbrCreate_PMFSRR] = { -+ .create = au_wbr_create_pmfsrr, -+ .init = au_wbr_create_init_mfsrr, -+ .fin = au_wbr_create_fin_mfs -+ }, -+ [AuWbrCreate_PMFSRRV] = { -+ .create = au_wbr_create_pmfsrr, -+ .init = au_wbr_create_init_mfsrr, -+ .fin = au_wbr_create_fin_mfs -+ } -+}; -diff --git a/fs/aufs/whout.c b/fs/aufs/whout.c -new file mode 100644 -index 0000000..54feb08 ---- /dev/null -+++ b/fs/aufs/whout.c -@@ -0,0 +1,1047 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * whiteout for logical deletion and opaque directory -+ */ -+ -+#include "aufs.h" -+ -+#define WH_MASK S_IRUGO -+ -+/* -+ * If a directory contains this file, then it is opaque. We start with the -+ * .wh. flag so that it is blocked by lookup. -+ */ -+static struct qstr diropq_name = QSTR_INIT(AUFS_WH_DIROPQ, -+ sizeof(AUFS_WH_DIROPQ) - 1); -+ -+/* -+ * generate whiteout name, which is NOT terminated by NULL. -+ * @name: original d_name.name -+ * @len: original d_name.len -+ * @wh: whiteout qstr -+ * returns zero when succeeds, otherwise error. -+ * succeeded value as wh->name should be freed by kfree(). -+ */ -+int au_wh_name_alloc(struct qstr *wh, const struct qstr *name) -+{ -+ char *p; -+ -+ if (unlikely(name->len > PATH_MAX - AUFS_WH_PFX_LEN)) -+ return -ENAMETOOLONG; -+ -+ wh->len = name->len + AUFS_WH_PFX_LEN; -+ p = kmalloc(wh->len, GFP_NOFS); -+ wh->name = p; -+ if (p) { -+ memcpy(p, AUFS_WH_PFX, AUFS_WH_PFX_LEN); -+ memcpy(p + AUFS_WH_PFX_LEN, name->name, name->len); -+ /* smp_mb(); */ -+ return 0; -+ } -+ return -ENOMEM; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * test if the @wh_name exists under @h_parent. -+ * @try_sio specifies the necessary of super-io. -+ */ -+int au_wh_test(struct dentry *h_parent, struct qstr *wh_name, int try_sio) -+{ -+ int err; -+ struct dentry *wh_dentry; -+ -+ if (!try_sio) -+ wh_dentry = vfsub_lkup_one(wh_name, h_parent); -+ else -+ wh_dentry = au_sio_lkup_one(wh_name, h_parent); -+ err = PTR_ERR(wh_dentry); -+ if (IS_ERR(wh_dentry)) { -+ if (err == -ENAMETOOLONG) -+ err = 0; -+ goto out; -+ } -+ -+ err = 0; -+ if (d_is_negative(wh_dentry)) -+ goto out_wh; /* success */ -+ -+ err = 1; -+ if (d_is_reg(wh_dentry)) -+ goto out_wh; /* success */ -+ -+ err = -EIO; -+ AuIOErr("%pd Invalid whiteout entry type 0%o.\n", -+ wh_dentry, d_inode(wh_dentry)->i_mode); -+ -+out_wh: -+ dput(wh_dentry); -+out: -+ return err; -+} -+ -+/* -+ * test if the @h_dentry sets opaque or not. -+ */ -+int au_diropq_test(struct dentry *h_dentry) -+{ -+ int err; -+ struct inode *h_dir; -+ -+ h_dir = d_inode(h_dentry); -+ err = au_wh_test(h_dentry, &diropq_name, -+ au_test_h_perm_sio(h_dir, MAY_EXEC)); -+ return err; -+} -+ -+/* -+ * returns a negative dentry whose name is unique and temporary. -+ */ -+struct dentry *au_whtmp_lkup(struct dentry *h_parent, struct au_branch *br, -+ struct qstr *prefix) -+{ -+ struct dentry *dentry; -+ int i; -+ char defname[NAME_MAX - AUFS_MAX_NAMELEN + DNAME_INLINE_LEN + 1], -+ *name, *p; -+ /* strict atomic_t is unnecessary here */ -+ static unsigned short cnt; -+ struct qstr qs; -+ -+ BUILD_BUG_ON(sizeof(cnt) * 2 > AUFS_WH_TMP_LEN); -+ -+ name = defname; -+ qs.len = sizeof(defname) - DNAME_INLINE_LEN + prefix->len - 1; -+ if (unlikely(prefix->len > DNAME_INLINE_LEN)) { -+ dentry = ERR_PTR(-ENAMETOOLONG); -+ if (unlikely(qs.len > NAME_MAX)) -+ goto out; -+ dentry = ERR_PTR(-ENOMEM); -+ name = kmalloc(qs.len + 1, GFP_NOFS); -+ if (unlikely(!name)) -+ goto out; -+ } -+ -+ /* doubly whiteout-ed */ -+ memcpy(name, AUFS_WH_PFX AUFS_WH_PFX, AUFS_WH_PFX_LEN * 2); -+ p = name + AUFS_WH_PFX_LEN * 2; -+ memcpy(p, prefix->name, prefix->len); -+ p += prefix->len; -+ *p++ = '.'; -+ AuDebugOn(name + qs.len + 1 - p <= AUFS_WH_TMP_LEN); -+ -+ qs.name = name; -+ for (i = 0; i < 3; i++) { -+ sprintf(p, "%.*x", AUFS_WH_TMP_LEN, cnt++); -+ dentry = au_sio_lkup_one(&qs, h_parent); -+ if (IS_ERR(dentry) || d_is_negative(dentry)) -+ goto out_name; -+ dput(dentry); -+ } -+ /* pr_warn("could not get random name\n"); */ -+ dentry = ERR_PTR(-EEXIST); -+ AuDbg("%.*s\n", AuLNPair(&qs)); -+ BUG(); -+ -+out_name: -+ if (name != defname) -+ au_delayed_kfree(name); -+out: -+ AuTraceErrPtr(dentry); -+ return dentry; -+} -+ -+/* -+ * rename the @h_dentry on @br to the whiteouted temporary name. -+ */ -+int au_whtmp_ren(struct dentry *h_dentry, struct au_branch *br) -+{ -+ int err; -+ struct path h_path = { -+ .mnt = au_br_mnt(br) -+ }; -+ struct inode *h_dir, *delegated; -+ struct dentry *h_parent; -+ -+ h_parent = h_dentry->d_parent; /* dir inode is locked */ -+ h_dir = d_inode(h_parent); -+ IMustLock(h_dir); -+ -+ h_path.dentry = au_whtmp_lkup(h_parent, br, &h_dentry->d_name); -+ err = PTR_ERR(h_path.dentry); -+ if (IS_ERR(h_path.dentry)) -+ goto out; -+ -+ /* under the same dir, no need to lock_rename() */ -+ delegated = NULL; -+ err = vfsub_rename(h_dir, h_dentry, h_dir, &h_path, &delegated); -+ AuTraceErr(err); -+ if (unlikely(err == -EWOULDBLOCK)) { -+ pr_warn("cannot retry for NFSv4 delegation" -+ " for an internal rename\n"); -+ iput(delegated); -+ } -+ dput(h_path.dentry); -+ -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+/* -+ * functions for removing a whiteout -+ */ -+ -+static int do_unlink_wh(struct inode *h_dir, struct path *h_path) -+{ -+ int err, force; -+ struct inode *delegated; -+ -+ /* -+ * forces superio when the dir has a sticky bit. -+ * this may be a violation of unix fs semantics. -+ */ -+ force = (h_dir->i_mode & S_ISVTX) -+ && !uid_eq(current_fsuid(), d_inode(h_path->dentry)->i_uid); -+ delegated = NULL; -+ err = vfsub_unlink(h_dir, h_path, &delegated, force); -+ if (unlikely(err == -EWOULDBLOCK)) { -+ pr_warn("cannot retry for NFSv4 delegation" -+ " for an internal unlink\n"); -+ iput(delegated); -+ } -+ return err; -+} -+ -+int au_wh_unlink_dentry(struct inode *h_dir, struct path *h_path, -+ struct dentry *dentry) -+{ -+ int err; -+ -+ err = do_unlink_wh(h_dir, h_path); -+ if (!err && dentry) -+ au_set_dbwh(dentry, -1); -+ -+ return err; -+} -+ -+static int unlink_wh_name(struct dentry *h_parent, struct qstr *wh, -+ struct au_branch *br) -+{ -+ int err; -+ struct path h_path = { -+ .mnt = au_br_mnt(br) -+ }; -+ -+ err = 0; -+ h_path.dentry = vfsub_lkup_one(wh, h_parent); -+ if (IS_ERR(h_path.dentry)) -+ err = PTR_ERR(h_path.dentry); -+ else { -+ if (d_is_reg(h_path.dentry)) -+ err = do_unlink_wh(d_inode(h_parent), &h_path); -+ dput(h_path.dentry); -+ } -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+/* -+ * initialize/clean whiteout for a branch -+ */ -+ -+static void au_wh_clean(struct inode *h_dir, struct path *whpath, -+ const int isdir) -+{ -+ int err; -+ struct inode *delegated; -+ -+ if (d_is_negative(whpath->dentry)) -+ return; -+ -+ if (isdir) -+ err = vfsub_rmdir(h_dir, whpath); -+ else { -+ delegated = NULL; -+ err = vfsub_unlink(h_dir, whpath, &delegated, /*force*/0); -+ if (unlikely(err == -EWOULDBLOCK)) { -+ pr_warn("cannot retry for NFSv4 delegation" -+ " for an internal unlink\n"); -+ iput(delegated); -+ } -+ } -+ if (unlikely(err)) -+ pr_warn("failed removing %pd (%d), ignored.\n", -+ whpath->dentry, err); -+} -+ -+static int test_linkable(struct dentry *h_root) -+{ -+ struct inode *h_dir = d_inode(h_root); -+ -+ if (h_dir->i_op->link) -+ return 0; -+ -+ pr_err("%pd (%s) doesn't support link(2), use noplink and rw+nolwh\n", -+ h_root, au_sbtype(h_root->d_sb)); -+ return -ENOSYS; -+} -+ -+/* todo: should this mkdir be done in /sbin/mount.aufs helper? */ -+static int au_whdir(struct inode *h_dir, struct path *path) -+{ -+ int err; -+ -+ err = -EEXIST; -+ if (d_is_negative(path->dentry)) { -+ int mode = S_IRWXU; -+ -+ if (au_test_nfs(path->dentry->d_sb)) -+ mode |= S_IXUGO; -+ err = vfsub_mkdir(h_dir, path, mode); -+ } else if (d_is_dir(path->dentry)) -+ err = 0; -+ else -+ pr_err("unknown %pd exists\n", path->dentry); -+ -+ return err; -+} -+ -+struct au_wh_base { -+ const struct qstr *name; -+ struct dentry *dentry; -+}; -+ -+static void au_wh_init_ro(struct inode *h_dir, struct au_wh_base base[], -+ struct path *h_path) -+{ -+ h_path->dentry = base[AuBrWh_BASE].dentry; -+ au_wh_clean(h_dir, h_path, /*isdir*/0); -+ h_path->dentry = base[AuBrWh_PLINK].dentry; -+ au_wh_clean(h_dir, h_path, /*isdir*/1); -+ h_path->dentry = base[AuBrWh_ORPH].dentry; -+ au_wh_clean(h_dir, h_path, /*isdir*/1); -+} -+ -+/* -+ * returns tri-state, -+ * minus: error, caller should print the message -+ * zero: succuess -+ * plus: error, caller should NOT print the message -+ */ -+static int au_wh_init_rw_nolink(struct dentry *h_root, struct au_wbr *wbr, -+ int do_plink, struct au_wh_base base[], -+ struct path *h_path) -+{ -+ int err; -+ struct inode *h_dir; -+ -+ h_dir = d_inode(h_root); -+ h_path->dentry = base[AuBrWh_BASE].dentry; -+ au_wh_clean(h_dir, h_path, /*isdir*/0); -+ h_path->dentry = base[AuBrWh_PLINK].dentry; -+ if (do_plink) { -+ err = test_linkable(h_root); -+ if (unlikely(err)) { -+ err = 1; -+ goto out; -+ } -+ -+ err = au_whdir(h_dir, h_path); -+ if (unlikely(err)) -+ goto out; -+ wbr->wbr_plink = dget(base[AuBrWh_PLINK].dentry); -+ } else -+ au_wh_clean(h_dir, h_path, /*isdir*/1); -+ h_path->dentry = base[AuBrWh_ORPH].dentry; -+ err = au_whdir(h_dir, h_path); -+ if (unlikely(err)) -+ goto out; -+ wbr->wbr_orph = dget(base[AuBrWh_ORPH].dentry); -+ -+out: -+ return err; -+} -+ -+/* -+ * for the moment, aufs supports the branch filesystem which does not support -+ * link(2). testing on FAT which does not support i_op->setattr() fully either, -+ * copyup failed. finally, such filesystem will not be used as the writable -+ * branch. -+ * -+ * returns tri-state, see above. -+ */ -+static int au_wh_init_rw(struct dentry *h_root, struct au_wbr *wbr, -+ int do_plink, struct au_wh_base base[], -+ struct path *h_path) -+{ -+ int err; -+ struct inode *h_dir; -+ -+ WbrWhMustWriteLock(wbr); -+ -+ err = test_linkable(h_root); -+ if (unlikely(err)) { -+ err = 1; -+ goto out; -+ } -+ -+ /* -+ * todo: should this create be done in /sbin/mount.aufs helper? -+ */ -+ err = -EEXIST; -+ h_dir = d_inode(h_root); -+ if (d_is_negative(base[AuBrWh_BASE].dentry)) { -+ h_path->dentry = base[AuBrWh_BASE].dentry; -+ err = vfsub_create(h_dir, h_path, WH_MASK, /*want_excl*/true); -+ } else if (d_is_reg(base[AuBrWh_BASE].dentry)) -+ err = 0; -+ else -+ pr_err("unknown %pd2 exists\n", base[AuBrWh_BASE].dentry); -+ if (unlikely(err)) -+ goto out; -+ -+ h_path->dentry = base[AuBrWh_PLINK].dentry; -+ if (do_plink) { -+ err = au_whdir(h_dir, h_path); -+ if (unlikely(err)) -+ goto out; -+ wbr->wbr_plink = dget(base[AuBrWh_PLINK].dentry); -+ } else -+ au_wh_clean(h_dir, h_path, /*isdir*/1); -+ wbr->wbr_whbase = dget(base[AuBrWh_BASE].dentry); -+ -+ h_path->dentry = base[AuBrWh_ORPH].dentry; -+ err = au_whdir(h_dir, h_path); -+ if (unlikely(err)) -+ goto out; -+ wbr->wbr_orph = dget(base[AuBrWh_ORPH].dentry); -+ -+out: -+ return err; -+} -+ -+/* -+ * initialize the whiteout base file/dir for @br. -+ */ -+int au_wh_init(struct au_branch *br, struct super_block *sb) -+{ -+ int err, i; -+ const unsigned char do_plink -+ = !!au_opt_test(au_mntflags(sb), PLINK); -+ struct inode *h_dir; -+ struct path path = br->br_path; -+ struct dentry *h_root = path.dentry; -+ struct au_wbr *wbr = br->br_wbr; -+ static const struct qstr base_name[] = { -+ [AuBrWh_BASE] = QSTR_INIT(AUFS_BASE_NAME, -+ sizeof(AUFS_BASE_NAME) - 1), -+ [AuBrWh_PLINK] = QSTR_INIT(AUFS_PLINKDIR_NAME, -+ sizeof(AUFS_PLINKDIR_NAME) - 1), -+ [AuBrWh_ORPH] = QSTR_INIT(AUFS_ORPHDIR_NAME, -+ sizeof(AUFS_ORPHDIR_NAME) - 1) -+ }; -+ struct au_wh_base base[] = { -+ [AuBrWh_BASE] = { -+ .name = base_name + AuBrWh_BASE, -+ .dentry = NULL -+ }, -+ [AuBrWh_PLINK] = { -+ .name = base_name + AuBrWh_PLINK, -+ .dentry = NULL -+ }, -+ [AuBrWh_ORPH] = { -+ .name = base_name + AuBrWh_ORPH, -+ .dentry = NULL -+ } -+ }; -+ -+ if (wbr) -+ WbrWhMustWriteLock(wbr); -+ -+ for (i = 0; i < AuBrWh_Last; i++) { -+ /* doubly whiteouted */ -+ struct dentry *d; -+ -+ d = au_wh_lkup(h_root, (void *)base[i].name, br); -+ err = PTR_ERR(d); -+ if (IS_ERR(d)) -+ goto out; -+ -+ base[i].dentry = d; -+ AuDebugOn(wbr -+ && wbr->wbr_wh[i] -+ && wbr->wbr_wh[i] != base[i].dentry); -+ } -+ -+ if (wbr) -+ for (i = 0; i < AuBrWh_Last; i++) { -+ dput(wbr->wbr_wh[i]); -+ wbr->wbr_wh[i] = NULL; -+ } -+ -+ err = 0; -+ if (!au_br_writable(br->br_perm)) { -+ h_dir = d_inode(h_root); -+ au_wh_init_ro(h_dir, base, &path); -+ } else if (!au_br_wh_linkable(br->br_perm)) { -+ err = au_wh_init_rw_nolink(h_root, wbr, do_plink, base, &path); -+ if (err > 0) -+ goto out; -+ else if (err) -+ goto out_err; -+ } else { -+ err = au_wh_init_rw(h_root, wbr, do_plink, base, &path); -+ if (err > 0) -+ goto out; -+ else if (err) -+ goto out_err; -+ } -+ goto out; /* success */ -+ -+out_err: -+ pr_err("an error(%d) on the writable branch %pd(%s)\n", -+ err, h_root, au_sbtype(h_root->d_sb)); -+out: -+ for (i = 0; i < AuBrWh_Last; i++) -+ dput(base[i].dentry); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+/* -+ * whiteouts are all hard-linked usually. -+ * when its link count reaches a ceiling, we create a new whiteout base -+ * asynchronously. -+ */ -+ -+struct reinit_br_wh { -+ struct super_block *sb; -+ struct au_branch *br; -+}; -+ -+static void reinit_br_wh(void *arg) -+{ -+ int err; -+ aufs_bindex_t bindex; -+ struct path h_path; -+ struct reinit_br_wh *a = arg; -+ struct au_wbr *wbr; -+ struct inode *dir, *delegated; -+ struct dentry *h_root; -+ struct au_hinode *hdir; -+ -+ err = 0; -+ wbr = a->br->br_wbr; -+ /* big aufs lock */ -+ si_noflush_write_lock(a->sb); -+ if (!au_br_writable(a->br->br_perm)) -+ goto out; -+ bindex = au_br_index(a->sb, a->br->br_id); -+ if (unlikely(bindex < 0)) -+ goto out; -+ -+ di_read_lock_parent(a->sb->s_root, AuLock_IR); -+ dir = d_inode(a->sb->s_root); -+ hdir = au_hi(dir, bindex); -+ h_root = au_h_dptr(a->sb->s_root, bindex); -+ AuDebugOn(h_root != au_br_dentry(a->br)); -+ -+ au_hn_inode_lock_nested(hdir, AuLsc_I_PARENT); -+ wbr_wh_write_lock(wbr); -+ err = au_h_verify(wbr->wbr_whbase, au_opt_udba(a->sb), hdir->hi_inode, -+ h_root, a->br); -+ if (!err) { -+ h_path.dentry = wbr->wbr_whbase; -+ h_path.mnt = au_br_mnt(a->br); -+ delegated = NULL; -+ err = vfsub_unlink(hdir->hi_inode, &h_path, &delegated, -+ /*force*/0); -+ if (unlikely(err == -EWOULDBLOCK)) { -+ pr_warn("cannot retry for NFSv4 delegation" -+ " for an internal unlink\n"); -+ iput(delegated); -+ } -+ } else { -+ pr_warn("%pd is moved, ignored\n", wbr->wbr_whbase); -+ err = 0; -+ } -+ dput(wbr->wbr_whbase); -+ wbr->wbr_whbase = NULL; -+ if (!err) -+ err = au_wh_init(a->br, a->sb); -+ wbr_wh_write_unlock(wbr); -+ au_hn_inode_unlock(hdir); -+ di_read_unlock(a->sb->s_root, AuLock_IR); -+ if (!err) -+ au_fhsm_wrote(a->sb, bindex, /*force*/0); -+ -+out: -+ if (wbr) -+ atomic_dec(&wbr->wbr_wh_running); -+ au_br_put(a->br); -+ si_write_unlock(a->sb); -+ au_nwt_done(&au_sbi(a->sb)->si_nowait); -+ au_delayed_kfree(arg); -+ if (unlikely(err)) -+ AuIOErr("err %d\n", err); -+} -+ -+static void kick_reinit_br_wh(struct super_block *sb, struct au_branch *br) -+{ -+ int do_dec, wkq_err; -+ struct reinit_br_wh *arg; -+ -+ do_dec = 1; -+ if (atomic_inc_return(&br->br_wbr->wbr_wh_running) != 1) -+ goto out; -+ -+ /* ignore ENOMEM */ -+ arg = kmalloc(sizeof(*arg), GFP_NOFS); -+ if (arg) { -+ /* -+ * dec(wh_running), kfree(arg) and dec(br_count) -+ * in reinit function -+ */ -+ arg->sb = sb; -+ arg->br = br; -+ au_br_get(br); -+ wkq_err = au_wkq_nowait(reinit_br_wh, arg, sb, /*flags*/0); -+ if (unlikely(wkq_err)) { -+ atomic_dec(&br->br_wbr->wbr_wh_running); -+ au_br_put(br); -+ au_delayed_kfree(arg); -+ } -+ do_dec = 0; -+ } -+ -+out: -+ if (do_dec) -+ atomic_dec(&br->br_wbr->wbr_wh_running); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * create the whiteout @wh. -+ */ -+static int link_or_create_wh(struct super_block *sb, aufs_bindex_t bindex, -+ struct dentry *wh) -+{ -+ int err; -+ struct path h_path = { -+ .dentry = wh -+ }; -+ struct au_branch *br; -+ struct au_wbr *wbr; -+ struct dentry *h_parent; -+ struct inode *h_dir, *delegated; -+ -+ h_parent = wh->d_parent; /* dir inode is locked */ -+ h_dir = d_inode(h_parent); -+ IMustLock(h_dir); -+ -+ br = au_sbr(sb, bindex); -+ h_path.mnt = au_br_mnt(br); -+ wbr = br->br_wbr; -+ wbr_wh_read_lock(wbr); -+ if (wbr->wbr_whbase) { -+ delegated = NULL; -+ err = vfsub_link(wbr->wbr_whbase, h_dir, &h_path, &delegated); -+ if (unlikely(err == -EWOULDBLOCK)) { -+ pr_warn("cannot retry for NFSv4 delegation" -+ " for an internal link\n"); -+ iput(delegated); -+ } -+ if (!err || err != -EMLINK) -+ goto out; -+ -+ /* link count full. re-initialize br_whbase. */ -+ kick_reinit_br_wh(sb, br); -+ } -+ -+ /* return this error in this context */ -+ err = vfsub_create(h_dir, &h_path, WH_MASK, /*want_excl*/true); -+ if (!err) -+ au_fhsm_wrote(sb, bindex, /*force*/0); -+ -+out: -+ wbr_wh_read_unlock(wbr); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * create or remove the diropq. -+ */ -+static struct dentry *do_diropq(struct dentry *dentry, aufs_bindex_t bindex, -+ unsigned int flags) -+{ -+ struct dentry *opq_dentry, *h_dentry; -+ struct super_block *sb; -+ struct au_branch *br; -+ int err; -+ -+ sb = dentry->d_sb; -+ br = au_sbr(sb, bindex); -+ h_dentry = au_h_dptr(dentry, bindex); -+ opq_dentry = vfsub_lkup_one(&diropq_name, h_dentry); -+ if (IS_ERR(opq_dentry)) -+ goto out; -+ -+ if (au_ftest_diropq(flags, CREATE)) { -+ err = link_or_create_wh(sb, bindex, opq_dentry); -+ if (!err) { -+ au_set_dbdiropq(dentry, bindex); -+ goto out; /* success */ -+ } -+ } else { -+ struct path tmp = { -+ .dentry = opq_dentry, -+ .mnt = au_br_mnt(br) -+ }; -+ err = do_unlink_wh(au_h_iptr(d_inode(dentry), bindex), &tmp); -+ if (!err) -+ au_set_dbdiropq(dentry, -1); -+ } -+ dput(opq_dentry); -+ opq_dentry = ERR_PTR(err); -+ -+out: -+ return opq_dentry; -+} -+ -+struct do_diropq_args { -+ struct dentry **errp; -+ struct dentry *dentry; -+ aufs_bindex_t bindex; -+ unsigned int flags; -+}; -+ -+static void call_do_diropq(void *args) -+{ -+ struct do_diropq_args *a = args; -+ *a->errp = do_diropq(a->dentry, a->bindex, a->flags); -+} -+ -+struct dentry *au_diropq_sio(struct dentry *dentry, aufs_bindex_t bindex, -+ unsigned int flags) -+{ -+ struct dentry *diropq, *h_dentry; -+ -+ h_dentry = au_h_dptr(dentry, bindex); -+ if (!au_test_h_perm_sio(d_inode(h_dentry), MAY_EXEC | MAY_WRITE)) -+ diropq = do_diropq(dentry, bindex, flags); -+ else { -+ int wkq_err; -+ struct do_diropq_args args = { -+ .errp = &diropq, -+ .dentry = dentry, -+ .bindex = bindex, -+ .flags = flags -+ }; -+ -+ wkq_err = au_wkq_wait(call_do_diropq, &args); -+ if (unlikely(wkq_err)) -+ diropq = ERR_PTR(wkq_err); -+ } -+ -+ return diropq; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * lookup whiteout dentry. -+ * @h_parent: lower parent dentry which must exist and be locked -+ * @base_name: name of dentry which will be whiteouted -+ * returns dentry for whiteout. -+ */ -+struct dentry *au_wh_lkup(struct dentry *h_parent, struct qstr *base_name, -+ struct au_branch *br) -+{ -+ int err; -+ struct qstr wh_name; -+ struct dentry *wh_dentry; -+ -+ err = au_wh_name_alloc(&wh_name, base_name); -+ wh_dentry = ERR_PTR(err); -+ if (!err) { -+ wh_dentry = vfsub_lkup_one(&wh_name, h_parent); -+ au_delayed_kfree(wh_name.name); -+ } -+ return wh_dentry; -+} -+ -+/* -+ * link/create a whiteout for @dentry on @bindex. -+ */ -+struct dentry *au_wh_create(struct dentry *dentry, aufs_bindex_t bindex, -+ struct dentry *h_parent) -+{ -+ struct dentry *wh_dentry; -+ struct super_block *sb; -+ int err; -+ -+ sb = dentry->d_sb; -+ wh_dentry = au_wh_lkup(h_parent, &dentry->d_name, au_sbr(sb, bindex)); -+ if (!IS_ERR(wh_dentry) && d_is_negative(wh_dentry)) { -+ err = link_or_create_wh(sb, bindex, wh_dentry); -+ if (!err) { -+ au_set_dbwh(dentry, bindex); -+ au_fhsm_wrote(sb, bindex, /*force*/0); -+ } else { -+ dput(wh_dentry); -+ wh_dentry = ERR_PTR(err); -+ } -+ } -+ -+ return wh_dentry; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* Delete all whiteouts in this directory on branch bindex. */ -+static int del_wh_children(struct dentry *h_dentry, struct au_nhash *whlist, -+ aufs_bindex_t bindex, struct au_branch *br) -+{ -+ int err; -+ unsigned long ul, n; -+ struct qstr wh_name; -+ char *p; -+ struct hlist_head *head; -+ struct au_vdir_wh *pos; -+ struct au_vdir_destr *str; -+ -+ err = -ENOMEM; -+ p = (void *)__get_free_page(GFP_NOFS); -+ wh_name.name = p; -+ if (unlikely(!wh_name.name)) -+ goto out; -+ -+ err = 0; -+ memcpy(p, AUFS_WH_PFX, AUFS_WH_PFX_LEN); -+ p += AUFS_WH_PFX_LEN; -+ n = whlist->nh_num; -+ head = whlist->nh_head; -+ for (ul = 0; !err && ul < n; ul++, head++) { -+ hlist_for_each_entry(pos, head, wh_hash) { -+ if (pos->wh_bindex != bindex) -+ continue; -+ -+ str = &pos->wh_str; -+ if (str->len + AUFS_WH_PFX_LEN <= PATH_MAX) { -+ memcpy(p, str->name, str->len); -+ wh_name.len = AUFS_WH_PFX_LEN + str->len; -+ err = unlink_wh_name(h_dentry, &wh_name, br); -+ if (!err) -+ continue; -+ break; -+ } -+ AuIOErr("whiteout name too long %.*s\n", -+ str->len, str->name); -+ err = -EIO; -+ break; -+ } -+ } -+ au_delayed_free_page((unsigned long)wh_name.name); -+ -+out: -+ return err; -+} -+ -+struct del_wh_children_args { -+ int *errp; -+ struct dentry *h_dentry; -+ struct au_nhash *whlist; -+ aufs_bindex_t bindex; -+ struct au_branch *br; -+}; -+ -+static void call_del_wh_children(void *args) -+{ -+ struct del_wh_children_args *a = args; -+ *a->errp = del_wh_children(a->h_dentry, a->whlist, a->bindex, a->br); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+struct au_whtmp_rmdir *au_whtmp_rmdir_alloc(struct super_block *sb, gfp_t gfp) -+{ -+ struct au_whtmp_rmdir *whtmp; -+ int err; -+ unsigned int rdhash; -+ -+ SiMustAnyLock(sb); -+ -+ whtmp = kzalloc(sizeof(*whtmp), gfp); -+ if (unlikely(!whtmp)) { -+ whtmp = ERR_PTR(-ENOMEM); -+ goto out; -+ } -+ -+ /* no estimation for dir size */ -+ rdhash = au_sbi(sb)->si_rdhash; -+ if (!rdhash) -+ rdhash = AUFS_RDHASH_DEF; -+ err = au_nhash_alloc(&whtmp->whlist, rdhash, gfp); -+ if (unlikely(err)) { -+ au_delayed_kfree(whtmp); -+ whtmp = ERR_PTR(err); -+ } -+ -+out: -+ return whtmp; -+} -+ -+void au_whtmp_rmdir_free(struct au_whtmp_rmdir *whtmp) -+{ -+ if (whtmp->br) -+ au_br_put(whtmp->br); -+ dput(whtmp->wh_dentry); -+ iput(whtmp->dir); -+ au_nhash_wh_free(&whtmp->whlist); -+ au_delayed_kfree(whtmp); -+} -+ -+/* -+ * rmdir the whiteouted temporary named dir @h_dentry. -+ * @whlist: whiteouted children. -+ */ -+int au_whtmp_rmdir(struct inode *dir, aufs_bindex_t bindex, -+ struct dentry *wh_dentry, struct au_nhash *whlist) -+{ -+ int err; -+ unsigned int h_nlink; -+ struct path h_tmp; -+ struct inode *wh_inode, *h_dir; -+ struct au_branch *br; -+ -+ h_dir = d_inode(wh_dentry->d_parent); /* dir inode is locked */ -+ IMustLock(h_dir); -+ -+ br = au_sbr(dir->i_sb, bindex); -+ wh_inode = d_inode(wh_dentry); -+ inode_lock_nested(wh_inode, AuLsc_I_CHILD); -+ -+ /* -+ * someone else might change some whiteouts while we were sleeping. -+ * it means this whlist may have an obsoleted entry. -+ */ -+ if (!au_test_h_perm_sio(wh_inode, MAY_EXEC | MAY_WRITE)) -+ err = del_wh_children(wh_dentry, whlist, bindex, br); -+ else { -+ int wkq_err; -+ struct del_wh_children_args args = { -+ .errp = &err, -+ .h_dentry = wh_dentry, -+ .whlist = whlist, -+ .bindex = bindex, -+ .br = br -+ }; -+ -+ wkq_err = au_wkq_wait(call_del_wh_children, &args); -+ if (unlikely(wkq_err)) -+ err = wkq_err; -+ } -+ inode_unlock(wh_inode); -+ -+ if (!err) { -+ h_tmp.dentry = wh_dentry; -+ h_tmp.mnt = au_br_mnt(br); -+ h_nlink = h_dir->i_nlink; -+ err = vfsub_rmdir(h_dir, &h_tmp); -+ /* some fs doesn't change the parent nlink in some cases */ -+ h_nlink -= h_dir->i_nlink; -+ } -+ -+ if (!err) { -+ if (au_ibtop(dir) == bindex) { -+ /* todo: dir->i_mutex is necessary */ -+ au_cpup_attr_timesizes(dir); -+ if (h_nlink) -+ vfsub_drop_nlink(dir); -+ } -+ return 0; /* success */ -+ } -+ -+ pr_warn("failed removing %pd(%d), ignored\n", wh_dentry, err); -+ return err; -+} -+ -+static void call_rmdir_whtmp(void *args) -+{ -+ int err; -+ aufs_bindex_t bindex; -+ struct au_whtmp_rmdir *a = args; -+ struct super_block *sb; -+ struct dentry *h_parent; -+ struct inode *h_dir; -+ struct au_hinode *hdir; -+ -+ /* rmdir by nfsd may cause deadlock with this i_mutex */ -+ /* inode_lock(a->dir); */ -+ err = -EROFS; -+ sb = a->dir->i_sb; -+ si_read_lock(sb, !AuLock_FLUSH); -+ if (!au_br_writable(a->br->br_perm)) -+ goto out; -+ bindex = au_br_index(sb, a->br->br_id); -+ if (unlikely(bindex < 0)) -+ goto out; -+ -+ err = -EIO; -+ ii_write_lock_parent(a->dir); -+ h_parent = dget_parent(a->wh_dentry); -+ h_dir = d_inode(h_parent); -+ hdir = au_hi(a->dir, bindex); -+ err = vfsub_mnt_want_write(au_br_mnt(a->br)); -+ if (unlikely(err)) -+ goto out_mnt; -+ au_hn_inode_lock_nested(hdir, AuLsc_I_PARENT); -+ err = au_h_verify(a->wh_dentry, au_opt_udba(sb), h_dir, h_parent, -+ a->br); -+ if (!err) -+ err = au_whtmp_rmdir(a->dir, bindex, a->wh_dentry, &a->whlist); -+ au_hn_inode_unlock(hdir); -+ vfsub_mnt_drop_write(au_br_mnt(a->br)); -+ -+out_mnt: -+ dput(h_parent); -+ ii_write_unlock(a->dir); -+out: -+ /* inode_unlock(a->dir); */ -+ au_whtmp_rmdir_free(a); -+ si_read_unlock(sb); -+ au_nwt_done(&au_sbi(sb)->si_nowait); -+ if (unlikely(err)) -+ AuIOErr("err %d\n", err); -+} -+ -+void au_whtmp_kick_rmdir(struct inode *dir, aufs_bindex_t bindex, -+ struct dentry *wh_dentry, struct au_whtmp_rmdir *args) -+{ -+ int wkq_err; -+ struct super_block *sb; -+ -+ IMustLock(dir); -+ -+ /* all post-process will be done in do_rmdir_whtmp(). */ -+ sb = dir->i_sb; -+ args->dir = au_igrab(dir); -+ args->br = au_sbr(sb, bindex); -+ au_br_get(args->br); -+ args->wh_dentry = dget(wh_dentry); -+ wkq_err = au_wkq_nowait(call_rmdir_whtmp, args, sb, /*flags*/0); -+ if (unlikely(wkq_err)) { -+ pr_warn("rmdir error %pd (%d), ignored\n", wh_dentry, wkq_err); -+ au_whtmp_rmdir_free(args); -+ } -+} -diff --git a/fs/aufs/whout.h b/fs/aufs/whout.h -new file mode 100644 -index 0000000..4077dd1 ---- /dev/null -+++ b/fs/aufs/whout.h -@@ -0,0 +1,72 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * whiteout for logical deletion and opaque directory -+ */ -+ -+#ifndef __AUFS_WHOUT_H__ -+#define __AUFS_WHOUT_H__ -+ -+#ifdef __KERNEL__ -+ -+#include "dir.h" -+ -+/* whout.c */ -+int au_wh_name_alloc(struct qstr *wh, const struct qstr *name); -+int au_wh_test(struct dentry *h_parent, struct qstr *wh_name, int try_sio); -+int au_diropq_test(struct dentry *h_dentry); -+struct au_branch; -+struct dentry *au_whtmp_lkup(struct dentry *h_parent, struct au_branch *br, -+ struct qstr *prefix); -+int au_whtmp_ren(struct dentry *h_dentry, struct au_branch *br); -+int au_wh_unlink_dentry(struct inode *h_dir, struct path *h_path, -+ struct dentry *dentry); -+int au_wh_init(struct au_branch *br, struct super_block *sb); -+ -+/* diropq flags */ -+#define AuDiropq_CREATE 1 -+#define au_ftest_diropq(flags, name) ((flags) & AuDiropq_##name) -+#define au_fset_diropq(flags, name) \ -+ do { (flags) |= AuDiropq_##name; } while (0) -+#define au_fclr_diropq(flags, name) \ -+ do { (flags) &= ~AuDiropq_##name; } while (0) -+ -+struct dentry *au_diropq_sio(struct dentry *dentry, aufs_bindex_t bindex, -+ unsigned int flags); -+struct dentry *au_wh_lkup(struct dentry *h_parent, struct qstr *base_name, -+ struct au_branch *br); -+struct dentry *au_wh_create(struct dentry *dentry, aufs_bindex_t bindex, -+ struct dentry *h_parent); -+ -+/* real rmdir for the whiteout-ed dir */ -+struct au_whtmp_rmdir { -+ struct inode *dir; -+ struct au_branch *br; -+ struct dentry *wh_dentry; -+ struct au_nhash whlist; -+}; -+ -+struct au_whtmp_rmdir *au_whtmp_rmdir_alloc(struct super_block *sb, gfp_t gfp); -+void au_whtmp_rmdir_free(struct au_whtmp_rmdir *whtmp); -+int au_whtmp_rmdir(struct inode *dir, aufs_bindex_t bindex, -+ struct dentry *wh_dentry, struct au_nhash *whlist); -+void au_whtmp_kick_rmdir(struct inode *dir, aufs_bindex_t bindex, -+ struct dentry *wh_dentry, struct au_whtmp_rmdir *args); -+ -+/* ---------------------------------------------------------------------- */ -+ -+static inline struct dentry *au_diropq_create(struct dentry *dentry, -+ aufs_bindex_t bindex) -+{ -+ return au_diropq_sio(dentry, bindex, AuDiropq_CREATE); -+} -+ -+static inline int au_diropq_remove(struct dentry *dentry, aufs_bindex_t bindex) -+{ -+ return PTR_ERR(au_diropq_sio(dentry, bindex, !AuDiropq_CREATE)); -+} -+ -+#endif /* __KERNEL__ */ -+#endif /* __AUFS_WHOUT_H__ */ -diff --git a/fs/aufs/wkq.c b/fs/aufs/wkq.c -new file mode 100644 -index 0000000..216d08f ---- /dev/null -+++ b/fs/aufs/wkq.c -@@ -0,0 +1,200 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * workqueue for asynchronous/super-io operations -+ * todo: try new dredential scheme -+ */ -+ -+#include -+#include "aufs.h" -+ -+/* internal workqueue named AUFS_WKQ_NAME */ -+ -+static struct workqueue_struct *au_wkq; -+ -+struct au_wkinfo { -+ struct work_struct wk; -+ struct kobject *kobj; -+ -+ unsigned int flags; /* see wkq.h */ -+ -+ au_wkq_func_t func; -+ void *args; -+ -+ struct completion *comp; -+}; -+ -+/* ---------------------------------------------------------------------- */ -+ -+static void wkq_func(struct work_struct *wk) -+{ -+ struct au_wkinfo *wkinfo = container_of(wk, struct au_wkinfo, wk); -+ -+ AuDebugOn(!uid_eq(current_fsuid(), GLOBAL_ROOT_UID)); -+ AuDebugOn(rlimit(RLIMIT_FSIZE) != RLIM_INFINITY); -+ -+ wkinfo->func(wkinfo->args); -+ if (au_ftest_wkq(wkinfo->flags, WAIT)) -+ complete(wkinfo->comp); -+ else { -+ kobject_put(wkinfo->kobj); -+ module_put(THIS_MODULE); /* todo: ?? */ -+ au_delayed_kfree(wkinfo); -+ } -+} -+ -+/* -+ * Since struct completion is large, try allocating it dynamically. -+ */ -+#if 1 /* defined(CONFIG_4KSTACKS) || defined(AuTest4KSTACKS) */ -+#define AuWkqCompDeclare(name) struct completion *comp = NULL -+ -+static int au_wkq_comp_alloc(struct au_wkinfo *wkinfo, struct completion **comp) -+{ -+ *comp = kmalloc(sizeof(**comp), GFP_NOFS); -+ if (*comp) { -+ init_completion(*comp); -+ wkinfo->comp = *comp; -+ return 0; -+ } -+ return -ENOMEM; -+} -+ -+static void au_wkq_comp_free(struct completion *comp) -+{ -+ au_delayed_kfree(comp); -+} -+ -+#else -+ -+/* no braces */ -+#define AuWkqCompDeclare(name) \ -+ DECLARE_COMPLETION_ONSTACK(_ ## name); \ -+ struct completion *comp = &_ ## name -+ -+static int au_wkq_comp_alloc(struct au_wkinfo *wkinfo, struct completion **comp) -+{ -+ wkinfo->comp = *comp; -+ return 0; -+} -+ -+static void au_wkq_comp_free(struct completion *comp __maybe_unused) -+{ -+ /* empty */ -+} -+#endif /* 4KSTACKS */ -+ -+static void au_wkq_run(struct au_wkinfo *wkinfo) -+{ -+ if (au_ftest_wkq(wkinfo->flags, NEST)) { -+ if (au_wkq_test()) { -+ AuWarn1("wkq from wkq, unless silly-rename on NFS," -+ " due to a dead dir by UDBA?\n"); -+ AuDebugOn(au_ftest_wkq(wkinfo->flags, WAIT)); -+ } -+ } else -+ au_dbg_verify_kthread(); -+ -+ if (au_ftest_wkq(wkinfo->flags, WAIT)) { -+ INIT_WORK_ONSTACK(&wkinfo->wk, wkq_func); -+ queue_work(au_wkq, &wkinfo->wk); -+ } else { -+ INIT_WORK(&wkinfo->wk, wkq_func); -+ schedule_work(&wkinfo->wk); -+ } -+} -+ -+/* -+ * Be careful. It is easy to make deadlock happen. -+ * processA: lock, wkq and wait -+ * processB: wkq and wait, lock in wkq -+ * --> deadlock -+ */ -+int au_wkq_do_wait(unsigned int flags, au_wkq_func_t func, void *args) -+{ -+ int err; -+ AuWkqCompDeclare(comp); -+ struct au_wkinfo wkinfo = { -+ .flags = flags, -+ .func = func, -+ .args = args -+ }; -+ -+ err = au_wkq_comp_alloc(&wkinfo, &comp); -+ if (!err) { -+ au_wkq_run(&wkinfo); -+ /* no timeout, no interrupt */ -+ wait_for_completion(wkinfo.comp); -+ au_wkq_comp_free(comp); -+ destroy_work_on_stack(&wkinfo.wk); -+ } -+ -+ return err; -+ -+} -+ -+/* -+ * Note: dget/dput() in func for aufs dentries are not supported. It will be a -+ * problem in a concurrent umounting. -+ */ -+int au_wkq_nowait(au_wkq_func_t func, void *args, struct super_block *sb, -+ unsigned int flags) -+{ -+ int err; -+ struct au_wkinfo *wkinfo; -+ -+ atomic_inc(&au_sbi(sb)->si_nowait.nw_len); -+ -+ /* -+ * wkq_func() must free this wkinfo. -+ * it highly depends upon the implementation of workqueue. -+ */ -+ err = 0; -+ wkinfo = kmalloc(sizeof(*wkinfo), GFP_NOFS); -+ if (wkinfo) { -+ wkinfo->kobj = &au_sbi(sb)->si_kobj; -+ wkinfo->flags = flags & ~AuWkq_WAIT; -+ wkinfo->func = func; -+ wkinfo->args = args; -+ wkinfo->comp = NULL; -+ kobject_get(wkinfo->kobj); -+ __module_get(THIS_MODULE); /* todo: ?? */ -+ -+ au_wkq_run(wkinfo); -+ } else { -+ err = -ENOMEM; -+ au_nwt_done(&au_sbi(sb)->si_nowait); -+ } -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+void au_nwt_init(struct au_nowait_tasks *nwt) -+{ -+ atomic_set(&nwt->nw_len, 0); -+ /* smp_mb(); */ /* atomic_set */ -+ init_waitqueue_head(&nwt->nw_wq); -+} -+ -+void au_wkq_fin(void) -+{ -+ destroy_workqueue(au_wkq); -+} -+ -+int __init au_wkq_init(void) -+{ -+ int err; -+ -+ err = 0; -+ au_wkq = alloc_workqueue(AUFS_WKQ_NAME, 0, WQ_DFL_ACTIVE); -+ if (IS_ERR(au_wkq)) -+ err = PTR_ERR(au_wkq); -+ else if (!au_wkq) -+ err = -ENOMEM; -+ -+ return err; -+} -diff --git a/fs/aufs/wkq.h b/fs/aufs/wkq.h -new file mode 100644 -index 0000000..6d63f74 ---- /dev/null -+++ b/fs/aufs/wkq.h -@@ -0,0 +1,80 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * workqueue for asynchronous/super-io operations -+ * todo: try new credentials management scheme -+ */ -+ -+#ifndef __AUFS_WKQ_H__ -+#define __AUFS_WKQ_H__ -+ -+#ifdef __KERNEL__ -+ -+#include -+ -+struct super_block; -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * in the next operation, wait for the 'nowait' tasks in system-wide workqueue -+ */ -+struct au_nowait_tasks { -+ atomic_t nw_len; -+ wait_queue_head_t nw_wq; -+}; -+ -+/* ---------------------------------------------------------------------- */ -+ -+typedef void (*au_wkq_func_t)(void *args); -+ -+/* wkq flags */ -+#define AuWkq_WAIT 1 -+#define AuWkq_NEST (1 << 1) -+#define au_ftest_wkq(flags, name) ((flags) & AuWkq_##name) -+#define au_fset_wkq(flags, name) \ -+ do { (flags) |= AuWkq_##name; } while (0) -+#define au_fclr_wkq(flags, name) \ -+ do { (flags) &= ~AuWkq_##name; } while (0) -+ -+#ifndef CONFIG_AUFS_HNOTIFY -+#undef AuWkq_NEST -+#define AuWkq_NEST 0 -+#endif -+ -+/* wkq.c */ -+int au_wkq_do_wait(unsigned int flags, au_wkq_func_t func, void *args); -+int au_wkq_nowait(au_wkq_func_t func, void *args, struct super_block *sb, -+ unsigned int flags); -+void au_nwt_init(struct au_nowait_tasks *nwt); -+int __init au_wkq_init(void); -+void au_wkq_fin(void); -+ -+/* ---------------------------------------------------------------------- */ -+ -+static inline int au_wkq_test(void) -+{ -+ return current->flags & PF_WQ_WORKER; -+} -+ -+static inline int au_wkq_wait(au_wkq_func_t func, void *args) -+{ -+ return au_wkq_do_wait(AuWkq_WAIT, func, args); -+} -+ -+static inline void au_nwt_done(struct au_nowait_tasks *nwt) -+{ -+ if (atomic_dec_and_test(&nwt->nw_len)) -+ wake_up_all(&nwt->nw_wq); -+} -+ -+static inline int au_nwt_flush(struct au_nowait_tasks *nwt) -+{ -+ wait_event(nwt->nw_wq, !atomic_read(&nwt->nw_len)); -+ return 0; -+} -+ -+#endif /* __KERNEL__ */ -+#endif /* __AUFS_WKQ_H__ */ -diff --git a/fs/aufs/xattr.c b/fs/aufs/xattr.c -new file mode 100644 -index 0000000..2a148c9 ---- /dev/null -+++ b/fs/aufs/xattr.c -@@ -0,0 +1,334 @@ -+/* -+ * Copyright (C) 2014-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * handling xattr functions -+ */ -+ -+#include -+#include "aufs.h" -+ -+static int au_xattr_ignore(int err, char *name, unsigned int ignore_flags) -+{ -+ if (!ignore_flags) -+ goto out; -+ switch (err) { -+ case -ENOMEM: -+ case -EDQUOT: -+ goto out; -+ } -+ -+ if ((ignore_flags & AuBrAttr_ICEX) == AuBrAttr_ICEX) { -+ err = 0; -+ goto out; -+ } -+ -+#define cmp(brattr, prefix) do { \ -+ if (!strncmp(name, XATTR_##prefix##_PREFIX, \ -+ XATTR_##prefix##_PREFIX_LEN)) { \ -+ if (ignore_flags & AuBrAttr_ICEX_##brattr) \ -+ err = 0; \ -+ goto out; \ -+ } \ -+ } while (0) -+ -+ cmp(SEC, SECURITY); -+ cmp(SYS, SYSTEM); -+ cmp(TR, TRUSTED); -+ cmp(USR, USER); -+#undef cmp -+ -+ if (ignore_flags & AuBrAttr_ICEX_OTH) -+ err = 0; -+ -+out: -+ return err; -+} -+ -+static const int au_xattr_out_of_list = AuBrAttr_ICEX_OTH << 1; -+ -+static int au_do_cpup_xattr(struct dentry *h_dst, struct dentry *h_src, -+ char *name, char **buf, unsigned int ignore_flags, -+ unsigned int verbose) -+{ -+ int err; -+ ssize_t ssz; -+ struct inode *h_idst; -+ -+ ssz = vfs_getxattr_alloc(h_src, name, buf, 0, GFP_NOFS); -+ err = ssz; -+ if (unlikely(err <= 0)) { -+ if (err == -ENODATA -+ || (err == -EOPNOTSUPP -+ && ((ignore_flags & au_xattr_out_of_list) -+ || (au_test_nfs_noacl(d_inode(h_src)) -+ && (!strcmp(name, XATTR_NAME_POSIX_ACL_ACCESS) -+ || !strcmp(name, -+ XATTR_NAME_POSIX_ACL_DEFAULT)))) -+ )) -+ err = 0; -+ if (err && (verbose || au_debug_test())) -+ pr_err("%s, err %d\n", name, err); -+ goto out; -+ } -+ -+ /* unlock it temporary */ -+ h_idst = d_inode(h_dst); -+ inode_unlock(h_idst); -+ err = vfsub_setxattr(h_dst, name, *buf, ssz, /*flags*/0); -+ inode_lock_nested(h_idst, AuLsc_I_CHILD2); -+ if (unlikely(err)) { -+ if (verbose || au_debug_test()) -+ pr_err("%s, err %d\n", name, err); -+ err = au_xattr_ignore(err, name, ignore_flags); -+ } -+ -+out: -+ return err; -+} -+ -+int au_cpup_xattr(struct dentry *h_dst, struct dentry *h_src, int ignore_flags, -+ unsigned int verbose) -+{ -+ int err, unlocked, acl_access, acl_default; -+ ssize_t ssz; -+ struct inode *h_isrc, *h_idst; -+ char *value, *p, *o, *e; -+ -+ /* try stopping to update the source inode while we are referencing */ -+ /* there should not be the parent-child relationship between them */ -+ h_isrc = d_inode(h_src); -+ h_idst = d_inode(h_dst); -+ inode_unlock(h_idst); -+ inode_lock_nested(h_isrc, AuLsc_I_CHILD); -+ inode_lock_nested(h_idst, AuLsc_I_CHILD2); -+ unlocked = 0; -+ -+ /* some filesystems don't list POSIX ACL, for example tmpfs */ -+ ssz = vfs_listxattr(h_src, NULL, 0); -+ err = ssz; -+ if (unlikely(err < 0)) { -+ AuTraceErr(err); -+ if (err == -ENODATA -+ || err == -EOPNOTSUPP) -+ err = 0; /* ignore */ -+ goto out; -+ } -+ -+ err = 0; -+ p = NULL; -+ o = NULL; -+ if (ssz) { -+ err = -ENOMEM; -+ p = kmalloc(ssz, GFP_NOFS); -+ o = p; -+ if (unlikely(!p)) -+ goto out; -+ err = vfs_listxattr(h_src, p, ssz); -+ } -+ inode_unlock(h_isrc); -+ unlocked = 1; -+ AuDbg("err %d, ssz %zd\n", err, ssz); -+ if (unlikely(err < 0)) -+ goto out_free; -+ -+ err = 0; -+ e = p + ssz; -+ value = NULL; -+ acl_access = 0; -+ acl_default = 0; -+ while (!err && p < e) { -+ acl_access |= !strncmp(p, XATTR_NAME_POSIX_ACL_ACCESS, -+ sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1); -+ acl_default |= !strncmp(p, XATTR_NAME_POSIX_ACL_DEFAULT, -+ sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) -+ - 1); -+ err = au_do_cpup_xattr(h_dst, h_src, p, &value, ignore_flags, -+ verbose); -+ p += strlen(p) + 1; -+ } -+ AuTraceErr(err); -+ ignore_flags |= au_xattr_out_of_list; -+ if (!err && !acl_access) { -+ err = au_do_cpup_xattr(h_dst, h_src, -+ XATTR_NAME_POSIX_ACL_ACCESS, &value, -+ ignore_flags, verbose); -+ AuTraceErr(err); -+ } -+ if (!err && !acl_default) { -+ err = au_do_cpup_xattr(h_dst, h_src, -+ XATTR_NAME_POSIX_ACL_DEFAULT, &value, -+ ignore_flags, verbose); -+ AuTraceErr(err); -+ } -+ -+ if (value) -+ au_delayed_kfree(value); -+ -+out_free: -+ if (o) -+ au_delayed_kfree(o); -+out: -+ if (!unlocked) -+ inode_unlock(h_isrc); -+ AuTraceErr(err); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+enum { -+ AU_XATTR_LIST, -+ AU_XATTR_GET -+}; -+ -+struct au_lgxattr { -+ int type; -+ union { -+ struct { -+ char *list; -+ size_t size; -+ } list; -+ struct { -+ const char *name; -+ void *value; -+ size_t size; -+ } get; -+ } u; -+}; -+ -+static ssize_t au_lgxattr(struct dentry *dentry, struct au_lgxattr *arg) -+{ -+ ssize_t err; -+ struct path h_path; -+ struct super_block *sb; -+ -+ sb = dentry->d_sb; -+ err = si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLM); -+ if (unlikely(err)) -+ goto out; -+ err = au_h_path_getattr(dentry, /*force*/1, &h_path); -+ if (unlikely(err)) -+ goto out_si; -+ if (unlikely(!h_path.dentry)) -+ /* illegally overlapped or something */ -+ goto out_di; /* pretending success */ -+ -+ /* always topmost entry only */ -+ switch (arg->type) { -+ case AU_XATTR_LIST: -+ err = vfs_listxattr(h_path.dentry, -+ arg->u.list.list, arg->u.list.size); -+ break; -+ case AU_XATTR_GET: -+ AuDebugOn(d_is_negative(h_path.dentry)); -+ err = vfs_getxattr(h_path.dentry, -+ arg->u.get.name, arg->u.get.value, -+ arg->u.get.size); -+ break; -+ } -+ -+out_di: -+ di_read_unlock(dentry, AuLock_IR); -+out_si: -+ si_read_unlock(sb); -+out: -+ AuTraceErr(err); -+ return err; -+} -+ -+ssize_t aufs_listxattr(struct dentry *dentry, char *list, size_t size) -+{ -+ struct au_lgxattr arg = { -+ .type = AU_XATTR_LIST, -+ .u.list = { -+ .list = list, -+ .size = size -+ }, -+ }; -+ -+ return au_lgxattr(dentry, &arg); -+} -+ -+ssize_t aufs_getxattr(struct dentry *dentry, struct inode *inode __maybe_unused, -+ const char *name, void *value, size_t size) -+{ -+ struct au_lgxattr arg = { -+ .type = AU_XATTR_GET, -+ .u.get = { -+ .name = name, -+ .value = value, -+ .size = size -+ }, -+ }; -+ -+ return au_lgxattr(dentry, &arg); -+} -+ -+int aufs_setxattr(struct dentry *dentry, struct inode *inode, const char *name, -+ const void *value, size_t size, int flags) -+{ -+ struct au_srxattr arg = { -+ .type = AU_XATTR_SET, -+ .u.set = { -+ .name = name, -+ .value = value, -+ .size = size, -+ .flags = flags -+ }, -+ }; -+ -+ return au_srxattr(dentry, inode, &arg); -+} -+ -+int aufs_removexattr(struct dentry *dentry, const char *name) -+{ -+ struct au_srxattr arg = { -+ .type = AU_XATTR_REMOVE, -+ .u.remove = { -+ .name = name -+ }, -+ }; -+ -+ return au_srxattr(dentry, d_inode(dentry), &arg); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+#if 0 -+static size_t au_xattr_list(struct dentry *dentry, char *list, size_t list_size, -+ const char *name, size_t name_len, int type) -+{ -+ return aufs_listxattr(dentry, list, list_size); -+} -+ -+static int au_xattr_get(struct dentry *dentry, const char *name, void *buffer, -+ size_t size, int type) -+{ -+ return aufs_getxattr(dentry, name, buffer, size); -+} -+ -+static int au_xattr_set(struct dentry *dentry, const char *name, -+ const void *value, size_t size, int flags, int type) -+{ -+ return aufs_setxattr(dentry, name, value, size, flags); -+} -+ -+static const struct xattr_handler au_xattr_handler = { -+ /* no prefix, no flags */ -+ .list = au_xattr_list, -+ .get = au_xattr_get, -+ .set = au_xattr_set -+ /* why no remove? */ -+}; -+ -+static const struct xattr_handler *au_xattr_handlers[] = { -+ &au_xattr_handler -+}; -+ -+void au_xattr_init(struct super_block *sb) -+{ -+ /* sb->s_xattr = au_xattr_handlers; */ -+} -+#endif -diff --git a/fs/aufs/xino.c b/fs/aufs/xino.c -new file mode 100644 -index 0000000..2a411f9 ---- /dev/null -+++ b/fs/aufs/xino.c -@@ -0,0 +1,1305 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+/* -+ * external inode number translation table and bitmap -+ */ -+ -+#include -+#include -+#include "aufs.h" -+ -+/* todo: unnecessary to support mmap_sem since kernel-space? */ -+ssize_t xino_fread(vfs_readf_t func, struct file *file, void *kbuf, size_t size, -+ loff_t *pos) -+{ -+ ssize_t err; -+ mm_segment_t oldfs; -+ union { -+ void *k; -+ char __user *u; -+ } buf; -+ -+ buf.k = kbuf; -+ oldfs = get_fs(); -+ set_fs(KERNEL_DS); -+ do { -+ /* todo: signal_pending? */ -+ err = func(file, buf.u, size, pos); -+ } while (err == -EAGAIN || err == -EINTR); -+ set_fs(oldfs); -+ -+#if 0 /* reserved for future use */ -+ if (err > 0) -+ fsnotify_access(file->f_path.dentry); -+#endif -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static ssize_t xino_fwrite_wkq(vfs_writef_t func, struct file *file, void *buf, -+ size_t size, loff_t *pos); -+ -+static ssize_t do_xino_fwrite(vfs_writef_t func, struct file *file, void *kbuf, -+ size_t size, loff_t *pos) -+{ -+ ssize_t err; -+ mm_segment_t oldfs; -+ union { -+ void *k; -+ const char __user *u; -+ } buf; -+ int i; -+ const int prevent_endless = 10; -+ -+ i = 0; -+ buf.k = kbuf; -+ oldfs = get_fs(); -+ set_fs(KERNEL_DS); -+ do { -+ err = func(file, buf.u, size, pos); -+ if (err == -EINTR -+ && !au_wkq_test() -+ && fatal_signal_pending(current)) { -+ set_fs(oldfs); -+ err = xino_fwrite_wkq(func, file, kbuf, size, pos); -+ BUG_ON(err == -EINTR); -+ oldfs = get_fs(); -+ set_fs(KERNEL_DS); -+ } -+ } while (i++ < prevent_endless -+ && (err == -EAGAIN || err == -EINTR)); -+ set_fs(oldfs); -+ -+#if 0 /* reserved for future use */ -+ if (err > 0) -+ fsnotify_modify(file->f_path.dentry); -+#endif -+ -+ return err; -+} -+ -+struct do_xino_fwrite_args { -+ ssize_t *errp; -+ vfs_writef_t func; -+ struct file *file; -+ void *buf; -+ size_t size; -+ loff_t *pos; -+}; -+ -+static void call_do_xino_fwrite(void *args) -+{ -+ struct do_xino_fwrite_args *a = args; -+ *a->errp = do_xino_fwrite(a->func, a->file, a->buf, a->size, a->pos); -+} -+ -+static ssize_t xino_fwrite_wkq(vfs_writef_t func, struct file *file, void *buf, -+ size_t size, loff_t *pos) -+{ -+ ssize_t err; -+ int wkq_err; -+ struct do_xino_fwrite_args args = { -+ .errp = &err, -+ .func = func, -+ .file = file, -+ .buf = buf, -+ .size = size, -+ .pos = pos -+ }; -+ -+ /* -+ * it breaks RLIMIT_FSIZE and normal user's limit, -+ * users should care about quota and real 'filesystem full.' -+ */ -+ wkq_err = au_wkq_wait(call_do_xino_fwrite, &args); -+ if (unlikely(wkq_err)) -+ err = wkq_err; -+ -+ return err; -+} -+ -+ssize_t xino_fwrite(vfs_writef_t func, struct file *file, void *buf, -+ size_t size, loff_t *pos) -+{ -+ ssize_t err; -+ -+ if (rlimit(RLIMIT_FSIZE) == RLIM_INFINITY) { -+ lockdep_off(); -+ err = do_xino_fwrite(func, file, buf, size, pos); -+ lockdep_on(); -+ } else -+ err = xino_fwrite_wkq(func, file, buf, size, pos); -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * create a new xinofile at the same place/path as @base_file. -+ */ -+struct file *au_xino_create2(struct file *base_file, struct file *copy_src) -+{ -+ struct file *file; -+ struct dentry *base, *parent; -+ struct inode *dir, *delegated; -+ struct qstr *name; -+ struct path path; -+ int err; -+ -+ base = base_file->f_path.dentry; -+ parent = base->d_parent; /* dir inode is locked */ -+ dir = d_inode(parent); -+ IMustLock(dir); -+ -+ file = ERR_PTR(-EINVAL); -+ name = &base->d_name; -+ path.dentry = vfsub_lookup_one_len(name->name, parent, name->len); -+ if (IS_ERR(path.dentry)) { -+ file = (void *)path.dentry; -+ pr_err("%pd lookup err %ld\n", -+ base, PTR_ERR(path.dentry)); -+ goto out; -+ } -+ -+ /* no need to mnt_want_write() since we call dentry_open() later */ -+ err = vfs_create(dir, path.dentry, S_IRUGO | S_IWUGO, NULL); -+ if (unlikely(err)) { -+ file = ERR_PTR(err); -+ pr_err("%pd create err %d\n", base, err); -+ goto out_dput; -+ } -+ -+ path.mnt = base_file->f_path.mnt; -+ file = vfsub_dentry_open(&path, -+ O_RDWR | O_CREAT | O_EXCL | O_LARGEFILE -+ /* | __FMODE_NONOTIFY */); -+ if (IS_ERR(file)) { -+ pr_err("%pd open err %ld\n", base, PTR_ERR(file)); -+ goto out_dput; -+ } -+ -+ delegated = NULL; -+ err = vfsub_unlink(dir, &file->f_path, &delegated, /*force*/0); -+ if (unlikely(err == -EWOULDBLOCK)) { -+ pr_warn("cannot retry for NFSv4 delegation" -+ " for an internal unlink\n"); -+ iput(delegated); -+ } -+ if (unlikely(err)) { -+ pr_err("%pd unlink err %d\n", base, err); -+ goto out_fput; -+ } -+ -+ if (copy_src) { -+ /* no one can touch copy_src xino */ -+ err = au_copy_file(file, copy_src, vfsub_f_size_read(copy_src)); -+ if (unlikely(err)) { -+ pr_err("%pd copy err %d\n", base, err); -+ goto out_fput; -+ } -+ } -+ goto out_dput; /* success */ -+ -+out_fput: -+ fput(file); -+ file = ERR_PTR(err); -+out_dput: -+ dput(path.dentry); -+out: -+ return file; -+} -+ -+struct au_xino_lock_dir { -+ struct au_hinode *hdir; -+ struct dentry *parent; -+ struct inode *dir; -+}; -+ -+static void au_xino_lock_dir(struct super_block *sb, struct file *xino, -+ struct au_xino_lock_dir *ldir) -+{ -+ aufs_bindex_t brid, bindex; -+ -+ ldir->hdir = NULL; -+ bindex = -1; -+ brid = au_xino_brid(sb); -+ if (brid >= 0) -+ bindex = au_br_index(sb, brid); -+ if (bindex >= 0) { -+ ldir->hdir = au_hi(d_inode(sb->s_root), bindex); -+ au_hn_inode_lock_nested(ldir->hdir, AuLsc_I_PARENT); -+ } else { -+ ldir->parent = dget_parent(xino->f_path.dentry); -+ ldir->dir = d_inode(ldir->parent); -+ inode_lock_nested(ldir->dir, AuLsc_I_PARENT); -+ } -+} -+ -+static void au_xino_unlock_dir(struct au_xino_lock_dir *ldir) -+{ -+ if (ldir->hdir) -+ au_hn_inode_unlock(ldir->hdir); -+ else { -+ inode_unlock(ldir->dir); -+ dput(ldir->parent); -+ } -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* trucate xino files asynchronously */ -+ -+int au_xino_trunc(struct super_block *sb, aufs_bindex_t bindex) -+{ -+ int err; -+ unsigned long jiffy; -+ blkcnt_t blocks; -+ aufs_bindex_t bi, bbot; -+ struct kstatfs *st; -+ struct au_branch *br; -+ struct file *new_xino, *file; -+ struct super_block *h_sb; -+ struct au_xino_lock_dir ldir; -+ -+ err = -ENOMEM; -+ st = kmalloc(sizeof(*st), GFP_NOFS); -+ if (unlikely(!st)) -+ goto out; -+ -+ err = -EINVAL; -+ bbot = au_sbbot(sb); -+ if (unlikely(bindex < 0 || bbot < bindex)) -+ goto out_st; -+ br = au_sbr(sb, bindex); -+ file = br->br_xino.xi_file; -+ if (!file) -+ goto out_st; -+ -+ err = vfs_statfs(&file->f_path, st); -+ if (unlikely(err)) -+ AuErr1("statfs err %d, ignored\n", err); -+ jiffy = jiffies; -+ blocks = file_inode(file)->i_blocks; -+ pr_info("begin truncating xino(b%d), ib%llu, %llu/%llu free blks\n", -+ bindex, (u64)blocks, st->f_bfree, st->f_blocks); -+ -+ au_xino_lock_dir(sb, file, &ldir); -+ /* mnt_want_write() is unnecessary here */ -+ new_xino = au_xino_create2(file, file); -+ au_xino_unlock_dir(&ldir); -+ err = PTR_ERR(new_xino); -+ if (IS_ERR(new_xino)) { -+ pr_err("err %d, ignored\n", err); -+ goto out_st; -+ } -+ err = 0; -+ fput(file); -+ br->br_xino.xi_file = new_xino; -+ -+ h_sb = au_br_sb(br); -+ for (bi = 0; bi <= bbot; bi++) { -+ if (unlikely(bi == bindex)) -+ continue; -+ br = au_sbr(sb, bi); -+ if (au_br_sb(br) != h_sb) -+ continue; -+ -+ fput(br->br_xino.xi_file); -+ br->br_xino.xi_file = new_xino; -+ get_file(new_xino); -+ } -+ -+ err = vfs_statfs(&new_xino->f_path, st); -+ if (!err) { -+ pr_info("end truncating xino(b%d), ib%llu, %llu/%llu free blks\n", -+ bindex, (u64)file_inode(new_xino)->i_blocks, -+ st->f_bfree, st->f_blocks); -+ if (file_inode(new_xino)->i_blocks < blocks) -+ au_sbi(sb)->si_xino_jiffy = jiffy; -+ } else -+ AuErr1("statfs err %d, ignored\n", err); -+ -+out_st: -+ au_delayed_kfree(st); -+out: -+ return err; -+} -+ -+struct xino_do_trunc_args { -+ struct super_block *sb; -+ struct au_branch *br; -+}; -+ -+static void xino_do_trunc(void *_args) -+{ -+ struct xino_do_trunc_args *args = _args; -+ struct super_block *sb; -+ struct au_branch *br; -+ struct inode *dir; -+ int err; -+ aufs_bindex_t bindex; -+ -+ err = 0; -+ sb = args->sb; -+ dir = d_inode(sb->s_root); -+ br = args->br; -+ -+ si_noflush_write_lock(sb); -+ ii_read_lock_parent(dir); -+ bindex = au_br_index(sb, br->br_id); -+ err = au_xino_trunc(sb, bindex); -+ ii_read_unlock(dir); -+ if (unlikely(err)) -+ pr_warn("err b%d, (%d)\n", bindex, err); -+ atomic_dec(&br->br_xino_running); -+ au_br_put(br); -+ si_write_unlock(sb); -+ au_nwt_done(&au_sbi(sb)->si_nowait); -+ au_delayed_kfree(args); -+} -+ -+static int xino_trunc_test(struct super_block *sb, struct au_branch *br) -+{ -+ int err; -+ struct kstatfs st; -+ struct au_sbinfo *sbinfo; -+ -+ /* todo: si_xino_expire and the ratio should be customizable */ -+ sbinfo = au_sbi(sb); -+ if (time_before(jiffies, -+ sbinfo->si_xino_jiffy + sbinfo->si_xino_expire)) -+ return 0; -+ -+ /* truncation border */ -+ err = vfs_statfs(&br->br_xino.xi_file->f_path, &st); -+ if (unlikely(err)) { -+ AuErr1("statfs err %d, ignored\n", err); -+ return 0; -+ } -+ if (div64_u64(st.f_bfree * 100, st.f_blocks) >= AUFS_XINO_DEF_TRUNC) -+ return 0; -+ -+ return 1; -+} -+ -+static void xino_try_trunc(struct super_block *sb, struct au_branch *br) -+{ -+ struct xino_do_trunc_args *args; -+ int wkq_err; -+ -+ if (!xino_trunc_test(sb, br)) -+ return; -+ -+ if (atomic_inc_return(&br->br_xino_running) > 1) -+ goto out; -+ -+ /* lock and kfree() will be called in trunc_xino() */ -+ args = kmalloc(sizeof(*args), GFP_NOFS); -+ if (unlikely(!args)) { -+ AuErr1("no memory\n"); -+ goto out; -+ } -+ -+ au_br_get(br); -+ args->sb = sb; -+ args->br = br; -+ wkq_err = au_wkq_nowait(xino_do_trunc, args, sb, /*flags*/0); -+ if (!wkq_err) -+ return; /* success */ -+ -+ pr_err("wkq %d\n", wkq_err); -+ au_br_put(br); -+ au_delayed_kfree(args); -+ -+out: -+ atomic_dec(&br->br_xino_running); -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static int au_xino_do_write(vfs_writef_t write, struct file *file, -+ ino_t h_ino, ino_t ino) -+{ -+ loff_t pos; -+ ssize_t sz; -+ -+ pos = h_ino; -+ if (unlikely(au_loff_max / sizeof(ino) - 1 < pos)) { -+ AuIOErr1("too large hi%lu\n", (unsigned long)h_ino); -+ return -EFBIG; -+ } -+ pos *= sizeof(ino); -+ sz = xino_fwrite(write, file, &ino, sizeof(ino), &pos); -+ if (sz == sizeof(ino)) -+ return 0; /* success */ -+ -+ AuIOErr("write failed (%zd)\n", sz); -+ return -EIO; -+} -+ -+/* -+ * write @ino to the xinofile for the specified branch{@sb, @bindex} -+ * at the position of @h_ino. -+ * even if @ino is zero, it is written to the xinofile and means no entry. -+ * if the size of the xino file on a specific filesystem exceeds the watermark, -+ * try truncating it. -+ */ -+int au_xino_write(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino, -+ ino_t ino) -+{ -+ int err; -+ unsigned int mnt_flags; -+ struct au_branch *br; -+ -+ BUILD_BUG_ON(sizeof(long long) != sizeof(au_loff_max) -+ || ((loff_t)-1) > 0); -+ SiMustAnyLock(sb); -+ -+ mnt_flags = au_mntflags(sb); -+ if (!au_opt_test(mnt_flags, XINO)) -+ return 0; -+ -+ br = au_sbr(sb, bindex); -+ err = au_xino_do_write(au_sbi(sb)->si_xwrite, br->br_xino.xi_file, -+ h_ino, ino); -+ if (!err) { -+ if (au_opt_test(mnt_flags, TRUNC_XINO) -+ && au_test_fs_trunc_xino(au_br_sb(br))) -+ xino_try_trunc(sb, br); -+ return 0; /* success */ -+ } -+ -+ AuIOErr("write failed (%d)\n", err); -+ return -EIO; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* aufs inode number bitmap */ -+ -+static const int page_bits = (int)PAGE_SIZE * BITS_PER_BYTE; -+static ino_t xib_calc_ino(unsigned long pindex, int bit) -+{ -+ ino_t ino; -+ -+ AuDebugOn(bit < 0 || page_bits <= bit); -+ ino = AUFS_FIRST_INO + pindex * page_bits + bit; -+ return ino; -+} -+ -+static void xib_calc_bit(ino_t ino, unsigned long *pindex, int *bit) -+{ -+ AuDebugOn(ino < AUFS_FIRST_INO); -+ ino -= AUFS_FIRST_INO; -+ *pindex = ino / page_bits; -+ *bit = ino % page_bits; -+} -+ -+static int xib_pindex(struct super_block *sb, unsigned long pindex) -+{ -+ int err; -+ loff_t pos; -+ ssize_t sz; -+ struct au_sbinfo *sbinfo; -+ struct file *xib; -+ unsigned long *p; -+ -+ sbinfo = au_sbi(sb); -+ MtxMustLock(&sbinfo->si_xib_mtx); -+ AuDebugOn(pindex > ULONG_MAX / PAGE_SIZE -+ || !au_opt_test(sbinfo->si_mntflags, XINO)); -+ -+ if (pindex == sbinfo->si_xib_last_pindex) -+ return 0; -+ -+ xib = sbinfo->si_xib; -+ p = sbinfo->si_xib_buf; -+ pos = sbinfo->si_xib_last_pindex; -+ pos *= PAGE_SIZE; -+ sz = xino_fwrite(sbinfo->si_xwrite, xib, p, PAGE_SIZE, &pos); -+ if (unlikely(sz != PAGE_SIZE)) -+ goto out; -+ -+ pos = pindex; -+ pos *= PAGE_SIZE; -+ if (vfsub_f_size_read(xib) >= pos + PAGE_SIZE) -+ sz = xino_fread(sbinfo->si_xread, xib, p, PAGE_SIZE, &pos); -+ else { -+ memset(p, 0, PAGE_SIZE); -+ sz = xino_fwrite(sbinfo->si_xwrite, xib, p, PAGE_SIZE, &pos); -+ } -+ if (sz == PAGE_SIZE) { -+ sbinfo->si_xib_last_pindex = pindex; -+ return 0; /* success */ -+ } -+ -+out: -+ AuIOErr1("write failed (%zd)\n", sz); -+ err = sz; -+ if (sz >= 0) -+ err = -EIO; -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+static void au_xib_clear_bit(struct inode *inode) -+{ -+ int err, bit; -+ unsigned long pindex; -+ struct super_block *sb; -+ struct au_sbinfo *sbinfo; -+ -+ AuDebugOn(inode->i_nlink); -+ -+ sb = inode->i_sb; -+ xib_calc_bit(inode->i_ino, &pindex, &bit); -+ AuDebugOn(page_bits <= bit); -+ sbinfo = au_sbi(sb); -+ mutex_lock(&sbinfo->si_xib_mtx); -+ err = xib_pindex(sb, pindex); -+ if (!err) { -+ clear_bit(bit, sbinfo->si_xib_buf); -+ sbinfo->si_xib_next_bit = bit; -+ } -+ mutex_unlock(&sbinfo->si_xib_mtx); -+} -+ -+/* for s_op->delete_inode() */ -+void au_xino_delete_inode(struct inode *inode, const int unlinked) -+{ -+ int err; -+ unsigned int mnt_flags; -+ aufs_bindex_t bindex, bbot, bi; -+ unsigned char try_trunc; -+ struct au_iinfo *iinfo; -+ struct super_block *sb; -+ struct au_hinode *hi; -+ struct inode *h_inode; -+ struct au_branch *br; -+ vfs_writef_t xwrite; -+ -+ AuDebugOn(au_is_bad_inode(inode)); -+ -+ sb = inode->i_sb; -+ mnt_flags = au_mntflags(sb); -+ if (!au_opt_test(mnt_flags, XINO) -+ || inode->i_ino == AUFS_ROOT_INO) -+ return; -+ -+ if (unlinked) { -+ au_xigen_inc(inode); -+ au_xib_clear_bit(inode); -+ } -+ -+ iinfo = au_ii(inode); -+ bindex = iinfo->ii_btop; -+ if (bindex < 0) -+ return; -+ -+ xwrite = au_sbi(sb)->si_xwrite; -+ try_trunc = !!au_opt_test(mnt_flags, TRUNC_XINO); -+ hi = au_hinode(iinfo, bindex); -+ bbot = iinfo->ii_bbot; -+ for (; bindex <= bbot; bindex++, hi++) { -+ h_inode = hi->hi_inode; -+ if (!h_inode -+ || (!unlinked && h_inode->i_nlink)) -+ continue; -+ -+ /* inode may not be revalidated */ -+ bi = au_br_index(sb, hi->hi_id); -+ if (bi < 0) -+ continue; -+ -+ br = au_sbr(sb, bi); -+ err = au_xino_do_write(xwrite, br->br_xino.xi_file, -+ h_inode->i_ino, /*ino*/0); -+ if (!err && try_trunc -+ && au_test_fs_trunc_xino(au_br_sb(br))) -+ xino_try_trunc(sb, br); -+ } -+} -+ -+/* get an unused inode number from bitmap */ -+ino_t au_xino_new_ino(struct super_block *sb) -+{ -+ ino_t ino; -+ unsigned long *p, pindex, ul, pend; -+ struct au_sbinfo *sbinfo; -+ struct file *file; -+ int free_bit, err; -+ -+ if (!au_opt_test(au_mntflags(sb), XINO)) -+ return iunique(sb, AUFS_FIRST_INO); -+ -+ sbinfo = au_sbi(sb); -+ mutex_lock(&sbinfo->si_xib_mtx); -+ p = sbinfo->si_xib_buf; -+ free_bit = sbinfo->si_xib_next_bit; -+ if (free_bit < page_bits && !test_bit(free_bit, p)) -+ goto out; /* success */ -+ free_bit = find_first_zero_bit(p, page_bits); -+ if (free_bit < page_bits) -+ goto out; /* success */ -+ -+ pindex = sbinfo->si_xib_last_pindex; -+ for (ul = pindex - 1; ul < ULONG_MAX; ul--) { -+ err = xib_pindex(sb, ul); -+ if (unlikely(err)) -+ goto out_err; -+ free_bit = find_first_zero_bit(p, page_bits); -+ if (free_bit < page_bits) -+ goto out; /* success */ -+ } -+ -+ file = sbinfo->si_xib; -+ pend = vfsub_f_size_read(file) / PAGE_SIZE; -+ for (ul = pindex + 1; ul <= pend; ul++) { -+ err = xib_pindex(sb, ul); -+ if (unlikely(err)) -+ goto out_err; -+ free_bit = find_first_zero_bit(p, page_bits); -+ if (free_bit < page_bits) -+ goto out; /* success */ -+ } -+ BUG(); -+ -+out: -+ set_bit(free_bit, p); -+ sbinfo->si_xib_next_bit = free_bit + 1; -+ pindex = sbinfo->si_xib_last_pindex; -+ mutex_unlock(&sbinfo->si_xib_mtx); -+ ino = xib_calc_ino(pindex, free_bit); -+ AuDbg("i%lu\n", (unsigned long)ino); -+ return ino; -+out_err: -+ mutex_unlock(&sbinfo->si_xib_mtx); -+ AuDbg("i0\n"); -+ return 0; -+} -+ -+/* -+ * read @ino from xinofile for the specified branch{@sb, @bindex} -+ * at the position of @h_ino. -+ * if @ino does not exist and @do_new is true, get new one. -+ */ -+int au_xino_read(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino, -+ ino_t *ino) -+{ -+ int err; -+ ssize_t sz; -+ loff_t pos; -+ struct file *file; -+ struct au_sbinfo *sbinfo; -+ -+ *ino = 0; -+ if (!au_opt_test(au_mntflags(sb), XINO)) -+ return 0; /* no xino */ -+ -+ err = 0; -+ sbinfo = au_sbi(sb); -+ pos = h_ino; -+ if (unlikely(au_loff_max / sizeof(*ino) - 1 < pos)) { -+ AuIOErr1("too large hi%lu\n", (unsigned long)h_ino); -+ return -EFBIG; -+ } -+ pos *= sizeof(*ino); -+ -+ file = au_sbr(sb, bindex)->br_xino.xi_file; -+ if (vfsub_f_size_read(file) < pos + sizeof(*ino)) -+ return 0; /* no ino */ -+ -+ sz = xino_fread(sbinfo->si_xread, file, ino, sizeof(*ino), &pos); -+ if (sz == sizeof(*ino)) -+ return 0; /* success */ -+ -+ err = sz; -+ if (unlikely(sz >= 0)) { -+ err = -EIO; -+ AuIOErr("xino read error (%zd)\n", sz); -+ } -+ -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* create and set a new xino file */ -+ -+struct file *au_xino_create(struct super_block *sb, char *fname, int silent) -+{ -+ struct file *file; -+ struct dentry *h_parent, *d; -+ struct inode *h_dir, *inode; -+ int err; -+ -+ /* -+ * at mount-time, and the xino file is the default path, -+ * hnotify is disabled so we have no notify events to ignore. -+ * when a user specified the xino, we cannot get au_hdir to be ignored. -+ */ -+ file = vfsub_filp_open(fname, O_RDWR | O_CREAT | O_EXCL | O_LARGEFILE -+ /* | __FMODE_NONOTIFY */, -+ S_IRUGO | S_IWUGO); -+ if (IS_ERR(file)) { -+ if (!silent) -+ pr_err("open %s(%ld)\n", fname, PTR_ERR(file)); -+ return file; -+ } -+ -+ /* keep file count */ -+ err = 0; -+ inode = file_inode(file); -+ h_parent = dget_parent(file->f_path.dentry); -+ h_dir = d_inode(h_parent); -+ inode_lock_nested(h_dir, AuLsc_I_PARENT); -+ /* mnt_want_write() is unnecessary here */ -+ /* no delegation since it is just created */ -+ if (inode->i_nlink) -+ err = vfsub_unlink(h_dir, &file->f_path, /*delegated*/NULL, -+ /*force*/0); -+ inode_unlock(h_dir); -+ dput(h_parent); -+ if (unlikely(err)) { -+ if (!silent) -+ pr_err("unlink %s(%d)\n", fname, err); -+ goto out; -+ } -+ -+ err = -EINVAL; -+ d = file->f_path.dentry; -+ if (unlikely(sb == d->d_sb)) { -+ if (!silent) -+ pr_err("%s must be outside\n", fname); -+ goto out; -+ } -+ if (unlikely(au_test_fs_bad_xino(d->d_sb))) { -+ if (!silent) -+ pr_err("xino doesn't support %s(%s)\n", -+ fname, au_sbtype(d->d_sb)); -+ goto out; -+ } -+ return file; /* success */ -+ -+out: -+ fput(file); -+ file = ERR_PTR(err); -+ return file; -+} -+ -+/* -+ * find another branch who is on the same filesystem of the specified -+ * branch{@btgt}. search until @bbot. -+ */ -+static int is_sb_shared(struct super_block *sb, aufs_bindex_t btgt, -+ aufs_bindex_t bbot) -+{ -+ aufs_bindex_t bindex; -+ struct super_block *tgt_sb = au_sbr_sb(sb, btgt); -+ -+ for (bindex = 0; bindex < btgt; bindex++) -+ if (unlikely(tgt_sb == au_sbr_sb(sb, bindex))) -+ return bindex; -+ for (bindex++; bindex <= bbot; bindex++) -+ if (unlikely(tgt_sb == au_sbr_sb(sb, bindex))) -+ return bindex; -+ return -1; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * initialize the xinofile for the specified branch @br -+ * at the place/path where @base_file indicates. -+ * test whether another branch is on the same filesystem or not, -+ * if @do_test is true. -+ */ -+int au_xino_br(struct super_block *sb, struct au_branch *br, ino_t h_ino, -+ struct file *base_file, int do_test) -+{ -+ int err; -+ ino_t ino; -+ aufs_bindex_t bbot, bindex; -+ struct au_branch *shared_br, *b; -+ struct file *file; -+ struct super_block *tgt_sb; -+ -+ shared_br = NULL; -+ bbot = au_sbbot(sb); -+ if (do_test) { -+ tgt_sb = au_br_sb(br); -+ for (bindex = 0; bindex <= bbot; bindex++) { -+ b = au_sbr(sb, bindex); -+ if (tgt_sb == au_br_sb(b)) { -+ shared_br = b; -+ break; -+ } -+ } -+ } -+ -+ if (!shared_br || !shared_br->br_xino.xi_file) { -+ struct au_xino_lock_dir ldir; -+ -+ au_xino_lock_dir(sb, base_file, &ldir); -+ /* mnt_want_write() is unnecessary here */ -+ file = au_xino_create2(base_file, NULL); -+ au_xino_unlock_dir(&ldir); -+ err = PTR_ERR(file); -+ if (IS_ERR(file)) -+ goto out; -+ br->br_xino.xi_file = file; -+ } else { -+ br->br_xino.xi_file = shared_br->br_xino.xi_file; -+ get_file(br->br_xino.xi_file); -+ } -+ -+ ino = AUFS_ROOT_INO; -+ err = au_xino_do_write(au_sbi(sb)->si_xwrite, br->br_xino.xi_file, -+ h_ino, ino); -+ if (unlikely(err)) { -+ fput(br->br_xino.xi_file); -+ br->br_xino.xi_file = NULL; -+ } -+ -+out: -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* trucate a xino bitmap file */ -+ -+/* todo: slow */ -+static int do_xib_restore(struct super_block *sb, struct file *file, void *page) -+{ -+ int err, bit; -+ ssize_t sz; -+ unsigned long pindex; -+ loff_t pos, pend; -+ struct au_sbinfo *sbinfo; -+ vfs_readf_t func; -+ ino_t *ino; -+ unsigned long *p; -+ -+ err = 0; -+ sbinfo = au_sbi(sb); -+ MtxMustLock(&sbinfo->si_xib_mtx); -+ p = sbinfo->si_xib_buf; -+ func = sbinfo->si_xread; -+ pend = vfsub_f_size_read(file); -+ pos = 0; -+ while (pos < pend) { -+ sz = xino_fread(func, file, page, PAGE_SIZE, &pos); -+ err = sz; -+ if (unlikely(sz <= 0)) -+ goto out; -+ -+ err = 0; -+ for (ino = page; sz > 0; ino++, sz -= sizeof(ino)) { -+ if (unlikely(*ino < AUFS_FIRST_INO)) -+ continue; -+ -+ xib_calc_bit(*ino, &pindex, &bit); -+ AuDebugOn(page_bits <= bit); -+ err = xib_pindex(sb, pindex); -+ if (!err) -+ set_bit(bit, p); -+ else -+ goto out; -+ } -+ } -+ -+out: -+ return err; -+} -+ -+static int xib_restore(struct super_block *sb) -+{ -+ int err; -+ aufs_bindex_t bindex, bbot; -+ void *page; -+ -+ err = -ENOMEM; -+ page = (void *)__get_free_page(GFP_NOFS); -+ if (unlikely(!page)) -+ goto out; -+ -+ err = 0; -+ bbot = au_sbbot(sb); -+ for (bindex = 0; !err && bindex <= bbot; bindex++) -+ if (!bindex || is_sb_shared(sb, bindex, bindex - 1) < 0) -+ err = do_xib_restore -+ (sb, au_sbr(sb, bindex)->br_xino.xi_file, page); -+ else -+ AuDbg("b%d\n", bindex); -+ au_delayed_free_page((unsigned long)page); -+ -+out: -+ return err; -+} -+ -+int au_xib_trunc(struct super_block *sb) -+{ -+ int err; -+ ssize_t sz; -+ loff_t pos; -+ struct au_xino_lock_dir ldir; -+ struct au_sbinfo *sbinfo; -+ unsigned long *p; -+ struct file *file; -+ -+ SiMustWriteLock(sb); -+ -+ err = 0; -+ sbinfo = au_sbi(sb); -+ if (!au_opt_test(sbinfo->si_mntflags, XINO)) -+ goto out; -+ -+ file = sbinfo->si_xib; -+ if (vfsub_f_size_read(file) <= PAGE_SIZE) -+ goto out; -+ -+ au_xino_lock_dir(sb, file, &ldir); -+ /* mnt_want_write() is unnecessary here */ -+ file = au_xino_create2(sbinfo->si_xib, NULL); -+ au_xino_unlock_dir(&ldir); -+ err = PTR_ERR(file); -+ if (IS_ERR(file)) -+ goto out; -+ fput(sbinfo->si_xib); -+ sbinfo->si_xib = file; -+ -+ p = sbinfo->si_xib_buf; -+ memset(p, 0, PAGE_SIZE); -+ pos = 0; -+ sz = xino_fwrite(sbinfo->si_xwrite, sbinfo->si_xib, p, PAGE_SIZE, &pos); -+ if (unlikely(sz != PAGE_SIZE)) { -+ err = sz; -+ AuIOErr("err %d\n", err); -+ if (sz >= 0) -+ err = -EIO; -+ goto out; -+ } -+ -+ mutex_lock(&sbinfo->si_xib_mtx); -+ /* mnt_want_write() is unnecessary here */ -+ err = xib_restore(sb); -+ mutex_unlock(&sbinfo->si_xib_mtx); -+ -+out: -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * xino mount option handlers -+ */ -+ -+/* xino bitmap */ -+static void xino_clear_xib(struct super_block *sb) -+{ -+ struct au_sbinfo *sbinfo; -+ -+ SiMustWriteLock(sb); -+ -+ sbinfo = au_sbi(sb); -+ sbinfo->si_xread = NULL; -+ sbinfo->si_xwrite = NULL; -+ if (sbinfo->si_xib) -+ fput(sbinfo->si_xib); -+ sbinfo->si_xib = NULL; -+ if (sbinfo->si_xib_buf) -+ au_delayed_free_page((unsigned long)sbinfo->si_xib_buf); -+ sbinfo->si_xib_buf = NULL; -+} -+ -+static int au_xino_set_xib(struct super_block *sb, struct file *base) -+{ -+ int err; -+ loff_t pos; -+ struct au_sbinfo *sbinfo; -+ struct file *file; -+ -+ SiMustWriteLock(sb); -+ -+ sbinfo = au_sbi(sb); -+ file = au_xino_create2(base, sbinfo->si_xib); -+ err = PTR_ERR(file); -+ if (IS_ERR(file)) -+ goto out; -+ if (sbinfo->si_xib) -+ fput(sbinfo->si_xib); -+ sbinfo->si_xib = file; -+ sbinfo->si_xread = vfs_readf(file); -+ sbinfo->si_xwrite = vfs_writef(file); -+ -+ err = -ENOMEM; -+ if (!sbinfo->si_xib_buf) -+ sbinfo->si_xib_buf = (void *)get_zeroed_page(GFP_NOFS); -+ if (unlikely(!sbinfo->si_xib_buf)) -+ goto out_unset; -+ -+ sbinfo->si_xib_last_pindex = 0; -+ sbinfo->si_xib_next_bit = 0; -+ if (vfsub_f_size_read(file) < PAGE_SIZE) { -+ pos = 0; -+ err = xino_fwrite(sbinfo->si_xwrite, file, sbinfo->si_xib_buf, -+ PAGE_SIZE, &pos); -+ if (unlikely(err != PAGE_SIZE)) -+ goto out_free; -+ } -+ err = 0; -+ goto out; /* success */ -+ -+out_free: -+ if (sbinfo->si_xib_buf) -+ au_delayed_free_page((unsigned long)sbinfo->si_xib_buf); -+ sbinfo->si_xib_buf = NULL; -+ if (err >= 0) -+ err = -EIO; -+out_unset: -+ fput(sbinfo->si_xib); -+ sbinfo->si_xib = NULL; -+ sbinfo->si_xread = NULL; -+ sbinfo->si_xwrite = NULL; -+out: -+ return err; -+} -+ -+/* xino for each branch */ -+static void xino_clear_br(struct super_block *sb) -+{ -+ aufs_bindex_t bindex, bbot; -+ struct au_branch *br; -+ -+ bbot = au_sbbot(sb); -+ for (bindex = 0; bindex <= bbot; bindex++) { -+ br = au_sbr(sb, bindex); -+ if (!br || !br->br_xino.xi_file) -+ continue; -+ -+ fput(br->br_xino.xi_file); -+ br->br_xino.xi_file = NULL; -+ } -+} -+ -+static int au_xino_set_br(struct super_block *sb, struct file *base) -+{ -+ int err; -+ ino_t ino; -+ aufs_bindex_t bindex, bbot, bshared; -+ struct { -+ struct file *old, *new; -+ } *fpair, *p; -+ struct au_branch *br; -+ struct inode *inode; -+ vfs_writef_t writef; -+ -+ SiMustWriteLock(sb); -+ -+ err = -ENOMEM; -+ bbot = au_sbbot(sb); -+ fpair = kcalloc(bbot + 1, sizeof(*fpair), GFP_NOFS); -+ if (unlikely(!fpair)) -+ goto out; -+ -+ inode = d_inode(sb->s_root); -+ ino = AUFS_ROOT_INO; -+ writef = au_sbi(sb)->si_xwrite; -+ for (bindex = 0, p = fpair; bindex <= bbot; bindex++, p++) { -+ bshared = is_sb_shared(sb, bindex, bindex - 1); -+ if (bshared >= 0) { -+ /* shared xino */ -+ *p = fpair[bshared]; -+ get_file(p->new); -+ } -+ -+ if (!p->new) { -+ /* new xino */ -+ br = au_sbr(sb, bindex); -+ p->old = br->br_xino.xi_file; -+ p->new = au_xino_create2(base, br->br_xino.xi_file); -+ err = PTR_ERR(p->new); -+ if (IS_ERR(p->new)) { -+ p->new = NULL; -+ goto out_pair; -+ } -+ } -+ -+ err = au_xino_do_write(writef, p->new, -+ au_h_iptr(inode, bindex)->i_ino, ino); -+ if (unlikely(err)) -+ goto out_pair; -+ } -+ -+ for (bindex = 0, p = fpair; bindex <= bbot; bindex++, p++) { -+ br = au_sbr(sb, bindex); -+ if (br->br_xino.xi_file) -+ fput(br->br_xino.xi_file); -+ get_file(p->new); -+ br->br_xino.xi_file = p->new; -+ } -+ -+out_pair: -+ for (bindex = 0, p = fpair; bindex <= bbot; bindex++, p++) -+ if (p->new) -+ fput(p->new); -+ else -+ break; -+ au_delayed_kfree(fpair); -+out: -+ return err; -+} -+ -+void au_xino_clr(struct super_block *sb) -+{ -+ struct au_sbinfo *sbinfo; -+ -+ au_xigen_clr(sb); -+ xino_clear_xib(sb); -+ xino_clear_br(sb); -+ sbinfo = au_sbi(sb); -+ /* lvalue, do not call au_mntflags() */ -+ au_opt_clr(sbinfo->si_mntflags, XINO); -+} -+ -+int au_xino_set(struct super_block *sb, struct au_opt_xino *xino, int remount) -+{ -+ int err, skip; -+ struct dentry *parent, *cur_parent; -+ struct qstr *dname, *cur_name; -+ struct file *cur_xino; -+ struct inode *dir; -+ struct au_sbinfo *sbinfo; -+ -+ SiMustWriteLock(sb); -+ -+ err = 0; -+ sbinfo = au_sbi(sb); -+ parent = dget_parent(xino->file->f_path.dentry); -+ if (remount) { -+ skip = 0; -+ dname = &xino->file->f_path.dentry->d_name; -+ cur_xino = sbinfo->si_xib; -+ if (cur_xino) { -+ cur_parent = dget_parent(cur_xino->f_path.dentry); -+ cur_name = &cur_xino->f_path.dentry->d_name; -+ skip = (cur_parent == parent -+ && au_qstreq(dname, cur_name)); -+ dput(cur_parent); -+ } -+ if (skip) -+ goto out; -+ } -+ -+ au_opt_set(sbinfo->si_mntflags, XINO); -+ dir = d_inode(parent); -+ inode_lock_nested(dir, AuLsc_I_PARENT); -+ /* mnt_want_write() is unnecessary here */ -+ err = au_xino_set_xib(sb, xino->file); -+ if (!err) -+ err = au_xigen_set(sb, xino->file); -+ if (!err) -+ err = au_xino_set_br(sb, xino->file); -+ inode_unlock(dir); -+ if (!err) -+ goto out; /* success */ -+ -+ /* reset all */ -+ AuIOErr("failed creating xino(%d).\n", err); -+ au_xigen_clr(sb); -+ xino_clear_xib(sb); -+ -+out: -+ dput(parent); -+ return err; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* -+ * create a xinofile at the default place/path. -+ */ -+struct file *au_xino_def(struct super_block *sb) -+{ -+ struct file *file; -+ char *page, *p; -+ struct au_branch *br; -+ struct super_block *h_sb; -+ struct path path; -+ aufs_bindex_t bbot, bindex, bwr; -+ -+ br = NULL; -+ bbot = au_sbbot(sb); -+ bwr = -1; -+ for (bindex = 0; bindex <= bbot; bindex++) { -+ br = au_sbr(sb, bindex); -+ if (au_br_writable(br->br_perm) -+ && !au_test_fs_bad_xino(au_br_sb(br))) { -+ bwr = bindex; -+ break; -+ } -+ } -+ -+ if (bwr >= 0) { -+ file = ERR_PTR(-ENOMEM); -+ page = (void *)__get_free_page(GFP_NOFS); -+ if (unlikely(!page)) -+ goto out; -+ path.mnt = au_br_mnt(br); -+ path.dentry = au_h_dptr(sb->s_root, bwr); -+ p = d_path(&path, page, PATH_MAX - sizeof(AUFS_XINO_FNAME)); -+ file = (void *)p; -+ if (!IS_ERR(p)) { -+ strcat(p, "/" AUFS_XINO_FNAME); -+ AuDbg("%s\n", p); -+ file = au_xino_create(sb, p, /*silent*/0); -+ if (!IS_ERR(file)) -+ au_xino_brid_set(sb, br->br_id); -+ } -+ au_delayed_free_page((unsigned long)page); -+ } else { -+ file = au_xino_create(sb, AUFS_XINO_DEFPATH, /*silent*/0); -+ if (IS_ERR(file)) -+ goto out; -+ h_sb = file->f_path.dentry->d_sb; -+ if (unlikely(au_test_fs_bad_xino(h_sb))) { -+ pr_err("xino doesn't support %s(%s)\n", -+ AUFS_XINO_DEFPATH, au_sbtype(h_sb)); -+ fput(file); -+ file = ERR_PTR(-EINVAL); -+ } -+ if (!IS_ERR(file)) -+ au_xino_brid_set(sb, -1); -+ } -+ -+out: -+ return file; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+int au_xino_path(struct seq_file *seq, struct file *file) -+{ -+ int err; -+ -+ err = au_seq_path(seq, &file->f_path); -+ if (unlikely(err)) -+ goto out; -+ -+#define Deleted "\\040(deleted)" -+ seq->count -= sizeof(Deleted) - 1; -+ AuDebugOn(memcmp(seq->buf + seq->count, Deleted, -+ sizeof(Deleted) - 1)); -+#undef Deleted -+ -+out: -+ return err; -+} -diff --git a/fs/dcache.c b/fs/dcache.c -index 5c7cc95..df0268c 100644 ---- a/fs/dcache.c -+++ b/fs/dcache.c -@@ -1164,7 +1164,7 @@ enum d_walk_ret { - * - * The @enter() and @finish() callbacks are called with d_lock held. - */ --static void d_walk(struct dentry *parent, void *data, -+void d_walk(struct dentry *parent, void *data, - enum d_walk_ret (*enter)(void *, struct dentry *), - void (*finish)(void *)) - { -diff --git a/fs/fcntl.c b/fs/fcntl.c -index 350a2c8..6f42279 100644 ---- a/fs/fcntl.c -+++ b/fs/fcntl.c -@@ -29,7 +29,7 @@ - - #define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME) - --static int setfl(int fd, struct file * filp, unsigned long arg) -+int setfl(int fd, struct file * filp, unsigned long arg) - { - struct inode * inode = file_inode(filp); - int error = 0; -@@ -60,6 +60,8 @@ static int setfl(int fd, struct file * filp, unsigned long arg) - - if (filp->f_op->check_flags) - error = filp->f_op->check_flags(arg); -+ if (!error && filp->f_op->setfl) -+ error = filp->f_op->setfl(filp, arg); - if (error) - return error; - -diff --git a/fs/inode.c b/fs/inode.c -index 7e3ef3a..675fe84 100644 ---- a/fs/inode.c -+++ b/fs/inode.c -@@ -1593,7 +1593,7 @@ EXPORT_SYMBOL(generic_update_time); - * This does the actual work of updating an inodes time or version. Must have - * had called mnt_want_write() before calling this. - */ --static int update_time(struct inode *inode, struct timespec *time, int flags) -+int update_time(struct inode *inode, struct timespec *time, int flags) - { - int (*update_time)(struct inode *, struct timespec *, int); - -diff --git a/fs/proc/base.c b/fs/proc/base.c -index ac0df4d..42255e5 100644 ---- a/fs/proc/base.c -+++ b/fs/proc/base.c -@@ -1938,7 +1938,7 @@ static int map_files_get_link(struct dentry *dentry, struct path *path) - down_read(&mm->mmap_sem); - vma = find_exact_vma(mm, vm_start, vm_end); - if (vma && vma->vm_file) { -- *path = vma->vm_file->f_path; -+ *path = vma_pr_or_file(vma)->f_path; - path_get(path); - rc = 0; - } -diff --git a/fs/proc/nommu.c b/fs/proc/nommu.c -index f8595e8..cb8eda0 100644 ---- a/fs/proc/nommu.c -+++ b/fs/proc/nommu.c -@@ -45,7 +45,10 @@ static int nommu_region_show(struct seq_file *m, struct vm_region *region) - file = region->vm_file; - - if (file) { -- struct inode *inode = file_inode(region->vm_file); -+ struct inode *inode; -+ -+ file = vmr_pr_or_file(region); -+ inode = file_inode(file); - dev = inode->i_sb->s_dev; - ino = inode->i_ino; - } -diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c -index f6fa99e..2750949 100644 ---- a/fs/proc/task_mmu.c -+++ b/fs/proc/task_mmu.c -@@ -298,7 +298,10 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid) - const char *name = NULL; - - if (file) { -- struct inode *inode = file_inode(vma->vm_file); -+ struct inode *inode; -+ -+ file = vma_pr_or_file(vma); -+ inode = file_inode(file); - dev = inode->i_sb->s_dev; - ino = inode->i_ino; - pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT; -@@ -1634,7 +1637,7 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid) - struct proc_maps_private *proc_priv = &numa_priv->proc_maps; - struct vm_area_struct *vma = v; - struct numa_maps *md = &numa_priv->md; -- struct file *file = vma->vm_file; -+ struct file *file = vma_pr_or_file(vma); - struct mm_struct *mm = vma->vm_mm; - struct mm_walk walk = { - .hugetlb_entry = gather_hugetlb_stats, -diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c -index faacb0c..17b43be 100644 ---- a/fs/proc/task_nommu.c -+++ b/fs/proc/task_nommu.c -@@ -163,7 +163,10 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma, - file = vma->vm_file; - - if (file) { -- struct inode *inode = file_inode(vma->vm_file); -+ struct inode *inode; -+ -+ file = vma_pr_or_file(vma); -+ inode = file_inode(file); - dev = inode->i_sb->s_dev; - ino = inode->i_ino; - pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT; -diff --git a/fs/read_write.c b/fs/read_write.c -index 66215a7..a1da117 100644 ---- a/fs/read_write.c -+++ b/fs/read_write.c -@@ -515,6 +515,28 @@ ssize_t __vfs_write(struct file *file, const char __user *p, size_t count, - } - EXPORT_SYMBOL(__vfs_write); - -+vfs_readf_t vfs_readf(struct file *file) -+{ -+ const struct file_operations *fop = file->f_op; -+ -+ if (fop->read) -+ return fop->read; -+ if (fop->read_iter) -+ return new_sync_read; -+ return ERR_PTR(-ENOSYS); -+} -+ -+vfs_writef_t vfs_writef(struct file *file) -+{ -+ const struct file_operations *fop = file->f_op; -+ -+ if (fop->write) -+ return fop->write; -+ if (fop->write_iter) -+ return new_sync_write; -+ return ERR_PTR(-ENOSYS); -+} -+ - ssize_t __kernel_write(struct file *file, const char *buf, size_t count, loff_t *pos) - { - mm_segment_t old_fs; -diff --git a/fs/splice.c b/fs/splice.c -index dd9bf7e..9326c2a 100644 ---- a/fs/splice.c -+++ b/fs/splice.c -@@ -1111,8 +1111,8 @@ EXPORT_SYMBOL(generic_splice_sendpage); - /* - * Attempt to initiate a splice from pipe to file. - */ --static long do_splice_from(struct pipe_inode_info *pipe, struct file *out, -- loff_t *ppos, size_t len, unsigned int flags) -+long do_splice_from(struct pipe_inode_info *pipe, struct file *out, -+ loff_t *ppos, size_t len, unsigned int flags) - { - ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, - loff_t *, size_t, unsigned int); -@@ -1128,9 +1128,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out, - /* - * Attempt to initiate a splice from a file to a pipe. - */ --static long do_splice_to(struct file *in, loff_t *ppos, -- struct pipe_inode_info *pipe, size_t len, -- unsigned int flags) -+long do_splice_to(struct file *in, loff_t *ppos, -+ struct pipe_inode_info *pipe, size_t len, -+ unsigned int flags) - { - ssize_t (*splice_read)(struct file *, loff_t *, - struct pipe_inode_info *, size_t, unsigned int); -diff --git a/include/linux/file.h b/include/linux/file.h -index 7444f5f..bdac0be 100644 ---- a/include/linux/file.h -+++ b/include/linux/file.h -@@ -19,6 +19,7 @@ struct dentry; - struct path; - extern struct file *alloc_file(struct path *, fmode_t mode, - const struct file_operations *fop); -+extern struct file *get_empty_filp(void); - - static inline void fput_light(struct file *file, int fput_needed) - { -diff --git a/include/linux/fs.h b/include/linux/fs.h -index 901e25d..a71aa9e 100644 ---- a/include/linux/fs.h -+++ b/include/linux/fs.h -@@ -1275,6 +1275,7 @@ extern void fasync_free(struct fasync_struct *); - /* can be called from interrupts */ - extern void kill_fasync(struct fasync_struct **, int, int); - -+extern int setfl(int fd, struct file * filp, unsigned long arg); - extern void __f_setown(struct file *filp, struct pid *, enum pid_type, int force); - extern void f_setown(struct file *filp, unsigned long arg, int force); - extern void f_delown(struct file *filp); -@@ -1699,6 +1700,7 @@ struct file_operations { - ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int); - unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); - int (*check_flags)(int); -+ int (*setfl)(struct file *, unsigned long); - int (*flock) (struct file *, int, struct file_lock *); - ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); - ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); -@@ -1759,6 +1761,12 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, - struct iovec *fast_pointer, - struct iovec **ret_pointer); - -+typedef ssize_t (*vfs_readf_t)(struct file *, char __user *, size_t, loff_t *); -+typedef ssize_t (*vfs_writef_t)(struct file *, const char __user *, size_t, -+ loff_t *); -+vfs_readf_t vfs_readf(struct file *file); -+vfs_writef_t vfs_writef(struct file *file); -+ - extern ssize_t __vfs_read(struct file *, char __user *, size_t, loff_t *); - extern ssize_t __vfs_write(struct file *, const char __user *, size_t, loff_t *); - extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *); -@@ -2123,6 +2131,7 @@ extern int current_umask(void); - extern void ihold(struct inode * inode); - extern void iput(struct inode *); - extern int generic_update_time(struct inode *, struct timespec *, int); -+extern int update_time(struct inode *, struct timespec *, int); - - /* /sys/fs */ - extern struct kobject *fs_kobj; -diff --git a/include/linux/mm.h b/include/linux/mm.h -index ef815b9..a772481 100644 ---- a/include/linux/mm.h -+++ b/include/linux/mm.h -@@ -1278,6 +1278,28 @@ static inline int fixup_user_fault(struct task_struct *tsk, - } - #endif - -+extern void vma_do_file_update_time(struct vm_area_struct *, const char[], int); -+extern struct file *vma_do_pr_or_file(struct vm_area_struct *, const char[], -+ int); -+extern void vma_do_get_file(struct vm_area_struct *, const char[], int); -+extern void vma_do_fput(struct vm_area_struct *, const char[], int); -+ -+#define vma_file_update_time(vma) vma_do_file_update_time(vma, __func__, \ -+ __LINE__) -+#define vma_pr_or_file(vma) vma_do_pr_or_file(vma, __func__, \ -+ __LINE__) -+#define vma_get_file(vma) vma_do_get_file(vma, __func__, __LINE__) -+#define vma_fput(vma) vma_do_fput(vma, __func__, __LINE__) -+ -+#ifndef CONFIG_MMU -+extern struct file *vmr_do_pr_or_file(struct vm_region *, const char[], int); -+extern void vmr_do_fput(struct vm_region *, const char[], int); -+ -+#define vmr_pr_or_file(region) vmr_do_pr_or_file(region, __func__, \ -+ __LINE__) -+#define vmr_fput(region) vmr_do_fput(region, __func__, __LINE__) -+#endif /* !CONFIG_MMU */ -+ - extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); - extern int access_remote_vm(struct mm_struct *mm, unsigned long addr, - void *buf, int len, int write); -diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h -index 903200f..55fc528 100644 ---- a/include/linux/mm_types.h -+++ b/include/linux/mm_types.h -@@ -275,6 +275,7 @@ struct vm_region { - unsigned long vm_top; /* region allocated to here */ - unsigned long vm_pgoff; /* the offset in vm_file corresponding to vm_start */ - struct file *vm_file; /* the backing file or NULL */ -+ struct file *vm_prfile; /* the virtual backing file or NULL */ - - int vm_usage; /* region usage count (access under nommu_region_sem) */ - bool vm_icache_flushed : 1; /* true if the icache has been flushed for -@@ -349,6 +350,7 @@ struct vm_area_struct { - unsigned long vm_pgoff; /* Offset (within vm_file) in PAGE_SIZE - units */ - struct file * vm_file; /* File we map to (can be NULL). */ -+ struct file *vm_prfile; /* shadow of vm_file */ - void * vm_private_data; /* was vm_pte (shared mem) */ - - #ifndef CONFIG_MMU -diff --git a/include/linux/splice.h b/include/linux/splice.h -index da2751d..2e0fca6 100644 ---- a/include/linux/splice.h -+++ b/include/linux/splice.h -@@ -83,4 +83,10 @@ extern void splice_shrink_spd(struct splice_pipe_desc *); - extern void spd_release_page(struct splice_pipe_desc *, unsigned int); - - extern const struct pipe_buf_operations page_cache_pipe_buf_ops; -+ -+extern long do_splice_from(struct pipe_inode_info *pipe, struct file *out, -+ loff_t *ppos, size_t len, unsigned int flags); -+extern long do_splice_to(struct file *in, loff_t *ppos, -+ struct pipe_inode_info *pipe, size_t len, -+ unsigned int flags); - #endif -diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild -index 185f8ea..5deb0d1 100644 ---- a/include/uapi/linux/Kbuild -+++ b/include/uapi/linux/Kbuild -@@ -59,6 +59,7 @@ header-y += atmsvc.h - header-y += atm_tcp.h - header-y += atm_zatm.h - header-y += audit.h -+header-y += aufs_type.h - header-y += auto_fs4.h - header-y += auto_fs.h - header-y += auxvec.h -diff --git a/include/uapi/linux/aufs_type.h b/include/uapi/linux/aufs_type.h -new file mode 100644 -index 0000000..e220283 ---- /dev/null -+++ b/include/uapi/linux/aufs_type.h -@@ -0,0 +1,406 @@ -+/* -+ * Copyright (C) 2005-2016 Junjiro R. Okajima -+ */ -+ -+#ifndef __AUFS_TYPE_H__ -+#define __AUFS_TYPE_H__ -+ -+#define AUFS_NAME "aufs" -+ -+#ifdef __KERNEL__ -+/* -+ * define it before including all other headers. -+ * sched.h may use pr_* macros before defining "current", so define the -+ * no-current version first, and re-define later. -+ */ -+#define pr_fmt(fmt) AUFS_NAME " %s:%d: " fmt, __func__, __LINE__ -+#include -+#undef pr_fmt -+#define pr_fmt(fmt) \ -+ AUFS_NAME " %s:%d:%.*s[%d]: " fmt, __func__, __LINE__, \ -+ (int)sizeof(current->comm), current->comm, current->pid -+#else -+#include -+#include -+#endif /* __KERNEL__ */ -+ -+#include -+ -+#define AUFS_VERSION "4.8" -+ -+/* todo? move this to linux-2.6.19/include/magic.h */ -+#define AUFS_SUPER_MAGIC ('a' << 24 | 'u' << 16 | 'f' << 8 | 's') -+ -+/* ---------------------------------------------------------------------- */ -+ -+#ifdef CONFIG_AUFS_BRANCH_MAX_127 -+typedef int8_t aufs_bindex_t; -+#define AUFS_BRANCH_MAX 127 -+#else -+typedef int16_t aufs_bindex_t; -+#ifdef CONFIG_AUFS_BRANCH_MAX_511 -+#define AUFS_BRANCH_MAX 511 -+#elif defined(CONFIG_AUFS_BRANCH_MAX_1023) -+#define AUFS_BRANCH_MAX 1023 -+#elif defined(CONFIG_AUFS_BRANCH_MAX_32767) -+#define AUFS_BRANCH_MAX 32767 -+#endif -+#endif -+ -+#ifdef __KERNEL__ -+#ifndef AUFS_BRANCH_MAX -+#error unknown CONFIG_AUFS_BRANCH_MAX value -+#endif -+#endif /* __KERNEL__ */ -+ -+/* ---------------------------------------------------------------------- */ -+ -+#define AUFS_FSTYPE AUFS_NAME -+ -+#define AUFS_ROOT_INO 2 -+#define AUFS_FIRST_INO 11 -+ -+#define AUFS_WH_PFX ".wh." -+#define AUFS_WH_PFX_LEN ((int)sizeof(AUFS_WH_PFX) - 1) -+#define AUFS_WH_TMP_LEN 4 -+/* a limit for rmdir/rename a dir and copyup */ -+#define AUFS_MAX_NAMELEN (NAME_MAX \ -+ - AUFS_WH_PFX_LEN * 2 /* doubly whiteouted */\ -+ - 1 /* dot */\ -+ - AUFS_WH_TMP_LEN) /* hex */ -+#define AUFS_XINO_FNAME "." AUFS_NAME ".xino" -+#define AUFS_XINO_DEFPATH "/tmp/" AUFS_XINO_FNAME -+#define AUFS_XINO_DEF_SEC 30 /* seconds */ -+#define AUFS_XINO_DEF_TRUNC 45 /* percentage */ -+#define AUFS_DIRWH_DEF 3 -+#define AUFS_RDCACHE_DEF 10 /* seconds */ -+#define AUFS_RDCACHE_MAX 3600 /* seconds */ -+#define AUFS_RDBLK_DEF 512 /* bytes */ -+#define AUFS_RDHASH_DEF 32 -+#define AUFS_WKQ_NAME AUFS_NAME "d" -+#define AUFS_MFS_DEF_SEC 30 /* seconds */ -+#define AUFS_MFS_MAX_SEC 3600 /* seconds */ -+#define AUFS_FHSM_CACHE_DEF_SEC 30 /* seconds */ -+#define AUFS_PLINK_WARN 50 /* number of plinks in a single bucket */ -+ -+/* pseudo-link maintenace under /proc */ -+#define AUFS_PLINK_MAINT_NAME "plink_maint" -+#define AUFS_PLINK_MAINT_DIR "fs/" AUFS_NAME -+#define AUFS_PLINK_MAINT_PATH AUFS_PLINK_MAINT_DIR "/" AUFS_PLINK_MAINT_NAME -+ -+#define AUFS_DIROPQ_NAME AUFS_WH_PFX ".opq" /* whiteouted doubly */ -+#define AUFS_WH_DIROPQ AUFS_WH_PFX AUFS_DIROPQ_NAME -+ -+#define AUFS_BASE_NAME AUFS_WH_PFX AUFS_NAME -+#define AUFS_PLINKDIR_NAME AUFS_WH_PFX "plnk" -+#define AUFS_ORPHDIR_NAME AUFS_WH_PFX "orph" -+ -+/* doubly whiteouted */ -+#define AUFS_WH_BASE AUFS_WH_PFX AUFS_BASE_NAME -+#define AUFS_WH_PLINKDIR AUFS_WH_PFX AUFS_PLINKDIR_NAME -+#define AUFS_WH_ORPHDIR AUFS_WH_PFX AUFS_ORPHDIR_NAME -+ -+/* branch permissions and attributes */ -+#define AUFS_BRPERM_RW "rw" -+#define AUFS_BRPERM_RO "ro" -+#define AUFS_BRPERM_RR "rr" -+#define AUFS_BRATTR_COO_REG "coo_reg" -+#define AUFS_BRATTR_COO_ALL "coo_all" -+#define AUFS_BRATTR_FHSM "fhsm" -+#define AUFS_BRATTR_UNPIN "unpin" -+#define AUFS_BRATTR_ICEX "icex" -+#define AUFS_BRATTR_ICEX_SEC "icexsec" -+#define AUFS_BRATTR_ICEX_SYS "icexsys" -+#define AUFS_BRATTR_ICEX_TR "icextr" -+#define AUFS_BRATTR_ICEX_USR "icexusr" -+#define AUFS_BRATTR_ICEX_OTH "icexoth" -+#define AUFS_BRRATTR_WH "wh" -+#define AUFS_BRWATTR_NLWH "nolwh" -+#define AUFS_BRWATTR_MOO "moo" -+ -+#define AuBrPerm_RW 1 /* writable, hardlinkable wh */ -+#define AuBrPerm_RO (1 << 1) /* readonly */ -+#define AuBrPerm_RR (1 << 2) /* natively readonly */ -+#define AuBrPerm_Mask (AuBrPerm_RW | AuBrPerm_RO | AuBrPerm_RR) -+ -+#define AuBrAttr_COO_REG (1 << 3) /* copy-up on open */ -+#define AuBrAttr_COO_ALL (1 << 4) -+#define AuBrAttr_COO_Mask (AuBrAttr_COO_REG | AuBrAttr_COO_ALL) -+ -+#define AuBrAttr_FHSM (1 << 5) /* file-based hsm */ -+#define AuBrAttr_UNPIN (1 << 6) /* rename-able top dir of -+ branch. meaningless since -+ linux-3.18-rc1 */ -+ -+/* ignore error in copying XATTR */ -+#define AuBrAttr_ICEX_SEC (1 << 7) -+#define AuBrAttr_ICEX_SYS (1 << 8) -+#define AuBrAttr_ICEX_TR (1 << 9) -+#define AuBrAttr_ICEX_USR (1 << 10) -+#define AuBrAttr_ICEX_OTH (1 << 11) -+#define AuBrAttr_ICEX (AuBrAttr_ICEX_SEC \ -+ | AuBrAttr_ICEX_SYS \ -+ | AuBrAttr_ICEX_TR \ -+ | AuBrAttr_ICEX_USR \ -+ | AuBrAttr_ICEX_OTH) -+ -+#define AuBrRAttr_WH (1 << 12) /* whiteout-able */ -+#define AuBrRAttr_Mask AuBrRAttr_WH -+ -+#define AuBrWAttr_NoLinkWH (1 << 13) /* un-hardlinkable whiteouts */ -+#define AuBrWAttr_MOO (1 << 14) /* move-up on open */ -+#define AuBrWAttr_Mask (AuBrWAttr_NoLinkWH | AuBrWAttr_MOO) -+ -+#define AuBrAttr_CMOO_Mask (AuBrAttr_COO_Mask | AuBrWAttr_MOO) -+ -+/* #warning test userspace */ -+#ifdef __KERNEL__ -+#ifndef CONFIG_AUFS_FHSM -+#undef AuBrAttr_FHSM -+#define AuBrAttr_FHSM 0 -+#endif -+#ifndef CONFIG_AUFS_XATTR -+#undef AuBrAttr_ICEX -+#define AuBrAttr_ICEX 0 -+#undef AuBrAttr_ICEX_SEC -+#define AuBrAttr_ICEX_SEC 0 -+#undef AuBrAttr_ICEX_SYS -+#define AuBrAttr_ICEX_SYS 0 -+#undef AuBrAttr_ICEX_TR -+#define AuBrAttr_ICEX_TR 0 -+#undef AuBrAttr_ICEX_USR -+#define AuBrAttr_ICEX_USR 0 -+#undef AuBrAttr_ICEX_OTH -+#define AuBrAttr_ICEX_OTH 0 -+#endif -+#endif -+ -+/* the longest combination */ -+/* AUFS_BRATTR_ICEX and AUFS_BRATTR_ICEX_TR don't affect here */ -+#define AuBrPermStrSz sizeof(AUFS_BRPERM_RW \ -+ "+" AUFS_BRATTR_COO_REG \ -+ "+" AUFS_BRATTR_FHSM \ -+ "+" AUFS_BRATTR_UNPIN \ -+ "+" AUFS_BRATTR_ICEX_SEC \ -+ "+" AUFS_BRATTR_ICEX_SYS \ -+ "+" AUFS_BRATTR_ICEX_USR \ -+ "+" AUFS_BRATTR_ICEX_OTH \ -+ "+" AUFS_BRWATTR_NLWH) -+ -+typedef struct { -+ char a[AuBrPermStrSz]; -+} au_br_perm_str_t; -+ -+static inline int au_br_writable(int brperm) -+{ -+ return brperm & AuBrPerm_RW; -+} -+ -+static inline int au_br_whable(int brperm) -+{ -+ return brperm & (AuBrPerm_RW | AuBrRAttr_WH); -+} -+ -+static inline int au_br_wh_linkable(int brperm) -+{ -+ return !(brperm & AuBrWAttr_NoLinkWH); -+} -+ -+static inline int au_br_cmoo(int brperm) -+{ -+ return brperm & AuBrAttr_CMOO_Mask; -+} -+ -+static inline int au_br_fhsm(int brperm) -+{ -+ return brperm & AuBrAttr_FHSM; -+} -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* ioctl */ -+enum { -+ /* readdir in userspace */ -+ AuCtl_RDU, -+ AuCtl_RDU_INO, -+ -+ AuCtl_WBR_FD, /* pathconf wrapper */ -+ AuCtl_IBUSY, /* busy inode */ -+ AuCtl_MVDOWN, /* move-down */ -+ AuCtl_BR, /* info about branches */ -+ AuCtl_FHSM_FD /* connection for fhsm */ -+}; -+ -+/* borrowed from linux/include/linux/kernel.h */ -+#ifndef ALIGN -+#define ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a)-1) -+#define __ALIGN_MASK(x, mask) (((x)+(mask))&~(mask)) -+#endif -+ -+/* borrowed from linux/include/linux/compiler-gcc3.h */ -+#ifndef __aligned -+#define __aligned(x) __attribute__((aligned(x))) -+#endif -+ -+#ifdef __KERNEL__ -+#ifndef __packed -+#define __packed __attribute__((packed)) -+#endif -+#endif -+ -+struct au_rdu_cookie { -+ uint64_t h_pos; -+ int16_t bindex; -+ uint8_t flags; -+ uint8_t pad; -+ uint32_t generation; -+} __aligned(8); -+ -+struct au_rdu_ent { -+ uint64_t ino; -+ int16_t bindex; -+ uint8_t type; -+ uint8_t nlen; -+ uint8_t wh; -+ char name[0]; -+} __aligned(8); -+ -+static inline int au_rdu_len(int nlen) -+{ -+ /* include the terminating NULL */ -+ return ALIGN(sizeof(struct au_rdu_ent) + nlen + 1, -+ sizeof(uint64_t)); -+} -+ -+union au_rdu_ent_ul { -+ struct au_rdu_ent __user *e; -+ uint64_t ul; -+}; -+ -+enum { -+ AufsCtlRduV_SZ, -+ AufsCtlRduV_End -+}; -+ -+struct aufs_rdu { -+ /* input */ -+ union { -+ uint64_t sz; /* AuCtl_RDU */ -+ uint64_t nent; /* AuCtl_RDU_INO */ -+ }; -+ union au_rdu_ent_ul ent; -+ uint16_t verify[AufsCtlRduV_End]; -+ -+ /* input/output */ -+ uint32_t blk; -+ -+ /* output */ -+ union au_rdu_ent_ul tail; -+ /* number of entries which were added in a single call */ -+ uint64_t rent; -+ uint8_t full; -+ uint8_t shwh; -+ -+ struct au_rdu_cookie cookie; -+} __aligned(8); -+ -+/* ---------------------------------------------------------------------- */ -+ -+struct aufs_wbr_fd { -+ uint32_t oflags; -+ int16_t brid; -+} __aligned(8); -+ -+/* ---------------------------------------------------------------------- */ -+ -+struct aufs_ibusy { -+ uint64_t ino, h_ino; -+ int16_t bindex; -+} __aligned(8); -+ -+/* ---------------------------------------------------------------------- */ -+ -+/* error code for move-down */ -+/* the actual message strings are implemented in aufs-util.git */ -+enum { -+ EAU_MVDOWN_OPAQUE = 1, -+ EAU_MVDOWN_WHITEOUT, -+ EAU_MVDOWN_UPPER, -+ EAU_MVDOWN_BOTTOM, -+ EAU_MVDOWN_NOUPPER, -+ EAU_MVDOWN_NOLOWERBR, -+ EAU_Last -+}; -+ -+/* flags for move-down */ -+#define AUFS_MVDOWN_DMSG 1 -+#define AUFS_MVDOWN_OWLOWER (1 << 1) /* overwrite lower */ -+#define AUFS_MVDOWN_KUPPER (1 << 2) /* keep upper */ -+#define AUFS_MVDOWN_ROLOWER (1 << 3) /* do even if lower is RO */ -+#define AUFS_MVDOWN_ROLOWER_R (1 << 4) /* did on lower RO */ -+#define AUFS_MVDOWN_ROUPPER (1 << 5) /* do even if upper is RO */ -+#define AUFS_MVDOWN_ROUPPER_R (1 << 6) /* did on upper RO */ -+#define AUFS_MVDOWN_BRID_UPPER (1 << 7) /* upper brid */ -+#define AUFS_MVDOWN_BRID_LOWER (1 << 8) /* lower brid */ -+#define AUFS_MVDOWN_FHSM_LOWER (1 << 9) /* find fhsm attr for lower */ -+#define AUFS_MVDOWN_STFS (1 << 10) /* req. stfs */ -+#define AUFS_MVDOWN_STFS_FAILED (1 << 11) /* output: stfs is unusable */ -+#define AUFS_MVDOWN_BOTTOM (1 << 12) /* output: no more lowers */ -+ -+/* index for move-down */ -+enum { -+ AUFS_MVDOWN_UPPER, -+ AUFS_MVDOWN_LOWER, -+ AUFS_MVDOWN_NARRAY -+}; -+ -+/* -+ * additional info of move-down -+ * number of free blocks and inodes. -+ * subset of struct kstatfs, but smaller and always 64bit. -+ */ -+struct aufs_stfs { -+ uint64_t f_blocks; -+ uint64_t f_bavail; -+ uint64_t f_files; -+ uint64_t f_ffree; -+}; -+ -+struct aufs_stbr { -+ int16_t brid; /* optional input */ -+ int16_t bindex; /* output */ -+ struct aufs_stfs stfs; /* output when AUFS_MVDOWN_STFS set */ -+} __aligned(8); -+ -+struct aufs_mvdown { -+ uint32_t flags; /* input/output */ -+ struct aufs_stbr stbr[AUFS_MVDOWN_NARRAY]; /* input/output */ -+ int8_t au_errno; /* output */ -+} __aligned(8); -+ -+/* ---------------------------------------------------------------------- */ -+ -+union aufs_brinfo { -+ /* PATH_MAX may differ between kernel-space and user-space */ -+ char _spacer[4096]; -+ struct { -+ int16_t id; -+ int perm; -+ char path[0]; -+ }; -+} __aligned(8); -+ -+/* ---------------------------------------------------------------------- */ -+ -+#define AuCtlType 'A' -+#define AUFS_CTL_RDU _IOWR(AuCtlType, AuCtl_RDU, struct aufs_rdu) -+#define AUFS_CTL_RDU_INO _IOWR(AuCtlType, AuCtl_RDU_INO, struct aufs_rdu) -+#define AUFS_CTL_WBR_FD _IOW(AuCtlType, AuCtl_WBR_FD, \ -+ struct aufs_wbr_fd) -+#define AUFS_CTL_IBUSY _IOWR(AuCtlType, AuCtl_IBUSY, struct aufs_ibusy) -+#define AUFS_CTL_MVDOWN _IOWR(AuCtlType, AuCtl_MVDOWN, \ -+ struct aufs_mvdown) -+#define AUFS_CTL_BRINFO _IOW(AuCtlType, AuCtl_BR, union aufs_brinfo) -+#define AUFS_CTL_FHSM_FD _IOW(AuCtlType, AuCtl_FHSM_FD, int) -+ -+#endif /* __AUFS_TYPE_H__ */ -diff --git a/kernel/fork.c b/kernel/fork.c -index beb3172..ad4cfa8 100644 ---- a/kernel/fork.c -+++ b/kernel/fork.c -@@ -477,7 +477,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) - struct inode *inode = file_inode(file); - struct address_space *mapping = file->f_mapping; - -- get_file(file); -+ vma_get_file(tmp); - if (tmp->vm_flags & VM_DENYWRITE) - atomic_dec(&inode->i_writecount); - i_mmap_lock_write(mapping); -diff --git a/mm/Makefile b/mm/Makefile -index 2ca1faf..6b9da3f 100644 ---- a/mm/Makefile -+++ b/mm/Makefile -@@ -40,7 +40,7 @@ obj-y := filemap.o mempool.o oom_kill.o \ - mm_init.o mmu_context.o percpu.o slab_common.o \ - compaction.o vmacache.o \ - interval_tree.o list_lru.o workingset.o \ -- debug.o $(mmu-y) -+ prfile.o debug.o $(mmu-y) - - obj-y += init-mm.o - -diff --git a/mm/filemap.c b/mm/filemap.c -index 2d0986a..4a31bad 100644 ---- a/mm/filemap.c -+++ b/mm/filemap.c -@@ -2284,7 +2284,7 @@ int filemap_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) - int ret = VM_FAULT_LOCKED; - - sb_start_pagefault(inode->i_sb); -- file_update_time(vma->vm_file); -+ vma_file_update_time(vma); - lock_page(page); - if (page->mapping != inode->i_mapping) { - unlock_page(page); -diff --git a/mm/memory.c b/mm/memory.c -index 793fe0f..45f39f3 100644 ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -2113,7 +2113,7 @@ static inline int wp_page_reuse(struct fault_env *fe, pte_t orig_pte, - } - - if (!page_mkwrite) -- file_update_time(vma->vm_file); -+ vma_file_update_time(vma); - } - - return VM_FAULT_WRITE; -diff --git a/mm/mmap.c b/mm/mmap.c -index ca9d91b..f3ebc5a 100644 ---- a/mm/mmap.c -+++ b/mm/mmap.c -@@ -163,7 +163,7 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma) - if (vma->vm_ops && vma->vm_ops->close) - vma->vm_ops->close(vma); - if (vma->vm_file) -- fput(vma->vm_file); -+ vma_fput(vma); - mpol_put(vma_policy(vma)); - kmem_cache_free(vm_area_cachep, vma); - return next; -@@ -790,7 +790,7 @@ again: - if (remove_next) { - if (file) { - uprobe_munmap(next, next->vm_start, next->vm_end); -- fput(file); -+ vma_fput(vma); - } - if (next->anon_vma) - anon_vma_merge(vma, next); -@@ -1574,8 +1574,8 @@ out: - return addr; - - unmap_and_free_vma: -+ vma_fput(vma); - vma->vm_file = NULL; -- fput(file); - - /* Undo any partial mapping done by a device driver. */ - unmap_region(mm, vma, prev, vma->vm_start, vma->vm_end); -@@ -2380,7 +2380,7 @@ static int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma, - goto out_free_mpol; - - if (new->vm_file) -- get_file(new->vm_file); -+ vma_get_file(new); - - if (new->vm_ops && new->vm_ops->open) - new->vm_ops->open(new); -@@ -2399,7 +2399,7 @@ static int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma, - if (new->vm_ops && new->vm_ops->close) - new->vm_ops->close(new); - if (new->vm_file) -- fput(new->vm_file); -+ vma_fput(new); - unlink_anon_vmas(new); - out_free_mpol: - mpol_put(vma_policy(new)); -@@ -2550,7 +2550,7 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, - struct vm_area_struct *vma; - unsigned long populate = 0; - unsigned long ret = -EINVAL; -- struct file *file; -+ struct file *file, *prfile; - - pr_warn_once("%s (%d) uses deprecated remap_file_pages() syscall. See Documentation/vm/remap_file_pages.txt.\n", - current->comm, current->pid); -@@ -2625,10 +2625,27 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, - } - } - -- file = get_file(vma->vm_file); -+ vma_get_file(vma); -+ file = vma->vm_file; -+ prfile = vma->vm_prfile; - ret = do_mmap_pgoff(vma->vm_file, start, size, - prot, flags, pgoff, &populate); -+ if (!IS_ERR_VALUE(ret) && file && prfile) { -+ struct vm_area_struct *new_vma; -+ -+ new_vma = find_vma(mm, ret); -+ if (!new_vma->vm_prfile) -+ new_vma->vm_prfile = prfile; -+ if (new_vma != vma) -+ get_file(prfile); -+ } -+ /* -+ * two fput()s instead of vma_fput(vma), -+ * coz vma may not be available anymore. -+ */ - fput(file); -+ if (prfile) -+ fput(prfile); - out: - up_write(&mm->mmap_sem); - if (populate) -@@ -2903,7 +2920,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, - if (anon_vma_clone(new_vma, vma)) - goto out_free_mempol; - if (new_vma->vm_file) -- get_file(new_vma->vm_file); -+ vma_get_file(new_vma); - if (new_vma->vm_ops && new_vma->vm_ops->open) - new_vma->vm_ops->open(new_vma); - vma_link(mm, new_vma, prev, rb_link, rb_parent); -diff --git a/mm/nommu.c b/mm/nommu.c -index 95daf81..5086a29 100644 ---- a/mm/nommu.c -+++ b/mm/nommu.c -@@ -644,7 +644,7 @@ static void __put_nommu_region(struct vm_region *region) - up_write(&nommu_region_sem); - - if (region->vm_file) -- fput(region->vm_file); -+ vmr_fput(region); - - /* IO memory and memory shared directly out of the pagecache - * from ramfs/tmpfs mustn't be released here */ -@@ -802,7 +802,7 @@ static void delete_vma(struct mm_struct *mm, struct vm_area_struct *vma) - if (vma->vm_ops && vma->vm_ops->close) - vma->vm_ops->close(vma); - if (vma->vm_file) -- fput(vma->vm_file); -+ vma_fput(vma); - put_nommu_region(vma->vm_region); - kmem_cache_free(vm_area_cachep, vma); - } -@@ -1328,7 +1328,7 @@ unsigned long do_mmap(struct file *file, - goto error_just_free; - } - } -- fput(region->vm_file); -+ vmr_fput(region); - kmem_cache_free(vm_region_jar, region); - region = pregion; - result = start; -@@ -1403,10 +1403,10 @@ error_just_free: - up_write(&nommu_region_sem); - error: - if (region->vm_file) -- fput(region->vm_file); -+ vmr_fput(region); - kmem_cache_free(vm_region_jar, region); - if (vma->vm_file) -- fput(vma->vm_file); -+ vma_fput(vma); - kmem_cache_free(vm_area_cachep, vma); - return ret; - -diff --git a/mm/prfile.c b/mm/prfile.c -new file mode 100644 -index 0000000..b323b8a ---- /dev/null -+++ b/mm/prfile.c -@@ -0,0 +1,86 @@ -+/* -+ * Mainly for aufs which mmap(2) diffrent file and wants to print different path -+ * in /proc/PID/maps. -+ * Call these functions via macros defined in linux/mm.h. -+ * -+ * See Documentation/filesystems/aufs/design/06mmap.txt -+ * -+ * Copyright (c) 2014 Junjro R. Okajima -+ * Copyright (c) 2014 Ian Campbell -+ */ -+ -+#include -+#include -+#include -+ -+/* #define PRFILE_TRACE */ -+static inline void prfile_trace(struct file *f, struct file *pr, -+ const char func[], int line, const char func2[]) -+{ -+#ifdef PRFILE_TRACE -+ if (pr) -+ pr_info("%s:%d: %s, %s\n", func, line, func2, -+ f ? (char *)f->f_path.dentry->d_name.name : "(null)"); -+#endif -+} -+ -+void vma_do_file_update_time(struct vm_area_struct *vma, const char func[], -+ int line) -+{ -+ struct file *f = vma->vm_file, *pr = vma->vm_prfile; -+ -+ prfile_trace(f, pr, func, line, __func__); -+ file_update_time(f); -+ if (f && pr) -+ file_update_time(pr); -+} -+ -+struct file *vma_do_pr_or_file(struct vm_area_struct *vma, const char func[], -+ int line) -+{ -+ struct file *f = vma->vm_file, *pr = vma->vm_prfile; -+ -+ prfile_trace(f, pr, func, line, __func__); -+ return (f && pr) ? pr : f; -+} -+ -+void vma_do_get_file(struct vm_area_struct *vma, const char func[], int line) -+{ -+ struct file *f = vma->vm_file, *pr = vma->vm_prfile; -+ -+ prfile_trace(f, pr, func, line, __func__); -+ get_file(f); -+ if (f && pr) -+ get_file(pr); -+} -+ -+void vma_do_fput(struct vm_area_struct *vma, const char func[], int line) -+{ -+ struct file *f = vma->vm_file, *pr = vma->vm_prfile; -+ -+ prfile_trace(f, pr, func, line, __func__); -+ fput(f); -+ if (f && pr) -+ fput(pr); -+} -+ -+#ifndef CONFIG_MMU -+struct file *vmr_do_pr_or_file(struct vm_region *region, const char func[], -+ int line) -+{ -+ struct file *f = region->vm_file, *pr = region->vm_prfile; -+ -+ prfile_trace(f, pr, func, line, __func__); -+ return (f && pr) ? pr : f; -+} -+ -+void vmr_do_fput(struct vm_region *region, const char func[], int line) -+{ -+ struct file *f = region->vm_file, *pr = region->vm_prfile; -+ -+ prfile_trace(f, pr, func, line, __func__); -+ fput(f); -+ if (f && pr) -+ fput(pr); -+} -+#endif /* !CONFIG_MMU */ diff --git a/kernel/kernel/files/patches/mageia/gpu-drm-mach64.patch b/kernel/kernel/files/patches/mageia/gpu-drm-mach64.patch index 9ab07df9..409981fc 100644 --- a/kernel/kernel/files/patches/mageia/gpu-drm-mach64.patch +++ b/kernel/kernel/files/patches/mageia/gpu-drm-mach64.patch @@ -4112,11 +4112,11 @@ head: c99566fb810c9d8cae5e9cd39d1772b55e2f514c + + return 0; +} ---- linux/drivers/gpu/drm/Kconfig.gpu-drm-mach64.orig 2014-03-08 18:52:34.979768492 +0200 -+++ linux/drivers/gpu/drm/Kconfig 2014-03-08 18:55:18.769681473 +0200 -@@ -130,6 +130,17 @@ config DRM_I810 - - source "drivers/gpu/drm/i915/Kconfig" +--- linux/drivers/gpu/drm/Kconfig.gpu-drm-mach64.orig ++++ linux/drivers/gpu/drm/Kconfig +@@ -267,6 +267,17 @@ config DRM_I810 + selected, the module will be called i810. AGP support is required + for this driver to work. +config DRM_MACH64 + tristate "ATI Rage Pro (Mach64)" @@ -4134,11 +4134,11 @@ head: c99566fb810c9d8cae5e9cd39d1772b55e2f514c depends on DRM && PCI --- linux/drivers/gpu/drm/Makefile.gpu-drm-mach64.orig +++ linux/drivers/gpu/drm/Makefile -@@ -38,6 +38,7 @@ obj-$(CONFIG_DRM_R128) += r128/ +@@ -47,6 +47,7 @@ obj-$(CONFIG_DRM_R128) += r128/ obj-$(CONFIG_HSA_AMD) += amd/amdkfd/ obj-$(CONFIG_DRM_RADEON)+= radeon/ obj-$(CONFIG_DRM_AMDGPU)+= amd/amdgpu/ +obj-$(CONFIG_DRM_MACH64)+= mach64/ obj-$(CONFIG_DRM_MGA) += mga/ obj-$(CONFIG_DRM_I810) += i810/ - obj-$(CONFIG_DRM_I915) += i915/ + obj-$(CONFIG_DRM_I915) += i915/ diff --git a/kernel/kernel/files/patches/mageia/linux-BFQ-v8r4.patch b/kernel/kernel/files/patches/mageia/linux-BFQ-v8r4.patch deleted file mode 100644 index abb33847..00000000 --- a/kernel/kernel/files/patches/mageia/linux-BFQ-v8r4.patch +++ /dev/null @@ -1,9004 +0,0 @@ -diff -w -uNr '--exclude=.git' linux-4.8/block/bfq-cgroup.c linux-4.8-bfq/block/bfq-cgroup.c ---- linux-4.8/block/bfq-cgroup.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-4.8-bfq/block/bfq-cgroup.c 2016-10-18 12:57:57.691164881 +0200 -@@ -0,0 +1,1196 @@ -+/* -+ * BFQ: CGROUPS support. -+ * -+ * Based on ideas and code from CFQ: -+ * Copyright (C) 2003 Jens Axboe -+ * -+ * Copyright (C) 2008 Fabio Checconi -+ * Paolo Valente -+ * -+ * Copyright (C) 2015 Paolo Valente -+ * -+ * Copyright (C) 2016 Paolo Valente -+ * -+ * Licensed under the GPL-2 as detailed in the accompanying COPYING.BFQ -+ * file. -+ */ -+ -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ -+/* bfqg stats flags */ -+enum bfqg_stats_flags { -+ BFQG_stats_waiting = 0, -+ BFQG_stats_idling, -+ BFQG_stats_empty, -+}; -+ -+#define BFQG_FLAG_FNS(name) \ -+static void bfqg_stats_mark_##name(struct bfqg_stats *stats) \ -+{ \ -+ stats->flags |= (1 << BFQG_stats_##name); \ -+} \ -+static void bfqg_stats_clear_##name(struct bfqg_stats *stats) \ -+{ \ -+ stats->flags &= ~(1 << BFQG_stats_##name); \ -+} \ -+static int bfqg_stats_##name(struct bfqg_stats *stats) \ -+{ \ -+ return (stats->flags & (1 << BFQG_stats_##name)) != 0; \ -+} \ -+ -+BFQG_FLAG_FNS(waiting) -+BFQG_FLAG_FNS(idling) -+BFQG_FLAG_FNS(empty) -+#undef BFQG_FLAG_FNS -+ -+/* This should be called with the queue_lock held. */ -+static void bfqg_stats_update_group_wait_time(struct bfqg_stats *stats) -+{ -+ unsigned long long now; -+ -+ if (!bfqg_stats_waiting(stats)) -+ return; -+ -+ now = sched_clock(); -+ if (time_after64(now, stats->start_group_wait_time)) -+ blkg_stat_add(&stats->group_wait_time, -+ now - stats->start_group_wait_time); -+ bfqg_stats_clear_waiting(stats); -+} -+ -+/* This should be called with the queue_lock held. */ -+static void bfqg_stats_set_start_group_wait_time(struct bfq_group *bfqg, -+ struct bfq_group *curr_bfqg) -+{ -+ struct bfqg_stats *stats = &bfqg->stats; -+ -+ if (bfqg_stats_waiting(stats)) -+ return; -+ if (bfqg == curr_bfqg) -+ return; -+ stats->start_group_wait_time = sched_clock(); -+ bfqg_stats_mark_waiting(stats); -+} -+ -+/* This should be called with the queue_lock held. */ -+static void bfqg_stats_end_empty_time(struct bfqg_stats *stats) -+{ -+ unsigned long long now; -+ -+ if (!bfqg_stats_empty(stats)) -+ return; -+ -+ now = sched_clock(); -+ if (time_after64(now, stats->start_empty_time)) -+ blkg_stat_add(&stats->empty_time, -+ now - stats->start_empty_time); -+ bfqg_stats_clear_empty(stats); -+} -+ -+static void bfqg_stats_update_dequeue(struct bfq_group *bfqg) -+{ -+ blkg_stat_add(&bfqg->stats.dequeue, 1); -+} -+ -+static void bfqg_stats_set_start_empty_time(struct bfq_group *bfqg) -+{ -+ struct bfqg_stats *stats = &bfqg->stats; -+ -+ if (blkg_rwstat_total(&stats->queued)) -+ return; -+ -+ /* -+ * group is already marked empty. This can happen if bfqq got new -+ * request in parent group and moved to this group while being added -+ * to service tree. Just ignore the event and move on. -+ */ -+ if (bfqg_stats_empty(stats)) -+ return; -+ -+ stats->start_empty_time = sched_clock(); -+ bfqg_stats_mark_empty(stats); -+} -+ -+static void bfqg_stats_update_idle_time(struct bfq_group *bfqg) -+{ -+ struct bfqg_stats *stats = &bfqg->stats; -+ -+ if (bfqg_stats_idling(stats)) { -+ unsigned long long now = sched_clock(); -+ -+ if (time_after64(now, stats->start_idle_time)) -+ blkg_stat_add(&stats->idle_time, -+ now - stats->start_idle_time); -+ bfqg_stats_clear_idling(stats); -+ } -+} -+ -+static void bfqg_stats_set_start_idle_time(struct bfq_group *bfqg) -+{ -+ struct bfqg_stats *stats = &bfqg->stats; -+ -+ stats->start_idle_time = sched_clock(); -+ bfqg_stats_mark_idling(stats); -+} -+ -+static void bfqg_stats_update_avg_queue_size(struct bfq_group *bfqg) -+{ -+ struct bfqg_stats *stats = &bfqg->stats; -+ -+ blkg_stat_add(&stats->avg_queue_size_sum, -+ blkg_rwstat_total(&stats->queued)); -+ blkg_stat_add(&stats->avg_queue_size_samples, 1); -+ bfqg_stats_update_group_wait_time(stats); -+} -+ -+static struct blkcg_policy blkcg_policy_bfq; -+ -+/* -+ * blk-cgroup policy-related handlers -+ * The following functions help in converting between blk-cgroup -+ * internal structures and BFQ-specific structures. -+ */ -+ -+static struct bfq_group *pd_to_bfqg(struct blkg_policy_data *pd) -+{ -+ return pd ? container_of(pd, struct bfq_group, pd) : NULL; -+} -+ -+static struct blkcg_gq *bfqg_to_blkg(struct bfq_group *bfqg) -+{ -+ return pd_to_blkg(&bfqg->pd); -+} -+ -+static struct bfq_group *blkg_to_bfqg(struct blkcg_gq *blkg) -+{ -+ struct blkg_policy_data *pd = blkg_to_pd(blkg, &blkcg_policy_bfq); -+ -+ return pd_to_bfqg(pd); -+} -+ -+/* -+ * bfq_group handlers -+ * The following functions help in navigating the bfq_group hierarchy -+ * by allowing to find the parent of a bfq_group or the bfq_group -+ * associated to a bfq_queue. -+ */ -+ -+static struct bfq_group *bfqg_parent(struct bfq_group *bfqg) -+{ -+ struct blkcg_gq *pblkg = bfqg_to_blkg(bfqg)->parent; -+ -+ return pblkg ? blkg_to_bfqg(pblkg) : NULL; -+} -+ -+static struct bfq_group *bfqq_group(struct bfq_queue *bfqq) -+{ -+ struct bfq_entity *group_entity = bfqq->entity.parent; -+ -+ return group_entity ? container_of(group_entity, struct bfq_group, -+ entity) : -+ bfqq->bfqd->root_group; -+} -+ -+/* -+ * The following two functions handle get and put of a bfq_group by -+ * wrapping the related blk-cgroup hooks. -+ */ -+ -+static void bfqg_get(struct bfq_group *bfqg) -+{ -+ return blkg_get(bfqg_to_blkg(bfqg)); -+} -+ -+static void bfqg_put(struct bfq_group *bfqg) -+{ -+ return blkg_put(bfqg_to_blkg(bfqg)); -+} -+ -+static void bfqg_stats_update_io_add(struct bfq_group *bfqg, -+ struct bfq_queue *bfqq, -+ int op, int op_flags) -+{ -+ blkg_rwstat_add(&bfqg->stats.queued, op, op_flags, 1); -+ bfqg_stats_end_empty_time(&bfqg->stats); -+ if (!(bfqq == ((struct bfq_data *)bfqg->bfqd)->in_service_queue)) -+ bfqg_stats_set_start_group_wait_time(bfqg, bfqq_group(bfqq)); -+} -+ -+static void bfqg_stats_update_io_remove(struct bfq_group *bfqg, int op, -+ int op_flags) -+{ -+ blkg_rwstat_add(&bfqg->stats.queued, op, op_flags, -1); -+} -+ -+static void bfqg_stats_update_io_merged(struct bfq_group *bfqg, int op, -+ int op_flags) -+{ -+ blkg_rwstat_add(&bfqg->stats.merged, op, op_flags, 1); -+} -+ -+static void bfqg_stats_update_completion(struct bfq_group *bfqg, -+ uint64_t start_time, uint64_t io_start_time, int op, -+ int op_flags) -+{ -+ struct bfqg_stats *stats = &bfqg->stats; -+ unsigned long long now = sched_clock(); -+ -+ if (time_after64(now, io_start_time)) -+ blkg_rwstat_add(&stats->service_time, op, op_flags, -+ now - io_start_time); -+ if (time_after64(io_start_time, start_time)) -+ blkg_rwstat_add(&stats->wait_time, op, op_flags, -+ io_start_time - start_time); -+} -+ -+/* @stats = 0 */ -+static void bfqg_stats_reset(struct bfqg_stats *stats) -+{ -+ /* queued stats shouldn't be cleared */ -+ blkg_rwstat_reset(&stats->merged); -+ blkg_rwstat_reset(&stats->service_time); -+ blkg_rwstat_reset(&stats->wait_time); -+ blkg_stat_reset(&stats->time); -+ blkg_stat_reset(&stats->avg_queue_size_sum); -+ blkg_stat_reset(&stats->avg_queue_size_samples); -+ blkg_stat_reset(&stats->dequeue); -+ blkg_stat_reset(&stats->group_wait_time); -+ blkg_stat_reset(&stats->idle_time); -+ blkg_stat_reset(&stats->empty_time); -+} -+ -+/* @to += @from */ -+static void bfqg_stats_add_aux(struct bfqg_stats *to, struct bfqg_stats *from) -+{ -+ if (!to || !from) -+ return; -+ -+ /* queued stats shouldn't be cleared */ -+ blkg_rwstat_add_aux(&to->merged, &from->merged); -+ blkg_rwstat_add_aux(&to->service_time, &from->service_time); -+ blkg_rwstat_add_aux(&to->wait_time, &from->wait_time); -+ blkg_stat_add_aux(&from->time, &from->time); -+ blkg_stat_add_aux(&to->avg_queue_size_sum, &from->avg_queue_size_sum); -+ blkg_stat_add_aux(&to->avg_queue_size_samples, -+ &from->avg_queue_size_samples); -+ blkg_stat_add_aux(&to->dequeue, &from->dequeue); -+ blkg_stat_add_aux(&to->group_wait_time, &from->group_wait_time); -+ blkg_stat_add_aux(&to->idle_time, &from->idle_time); -+ blkg_stat_add_aux(&to->empty_time, &from->empty_time); -+} -+ -+/* -+ * Transfer @bfqg's stats to its parent's dead_stats so that the ancestors' -+ * recursive stats can still account for the amount used by this bfqg after -+ * it's gone. -+ */ -+static void bfqg_stats_xfer_dead(struct bfq_group *bfqg) -+{ -+ struct bfq_group *parent; -+ -+ if (!bfqg) /* root_group */ -+ return; -+ -+ parent = bfqg_parent(bfqg); -+ -+ lockdep_assert_held(bfqg_to_blkg(bfqg)->q->queue_lock); -+ -+ if (unlikely(!parent)) -+ return; -+ -+ bfqg_stats_add_aux(&parent->stats, &bfqg->stats); -+ bfqg_stats_reset(&bfqg->stats); -+} -+ -+static void bfq_init_entity(struct bfq_entity *entity, -+ struct bfq_group *bfqg) -+{ -+ struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); -+ -+ entity->weight = entity->new_weight; -+ entity->orig_weight = entity->new_weight; -+ if (bfqq) { -+ bfqq->ioprio = bfqq->new_ioprio; -+ bfqq->ioprio_class = bfqq->new_ioprio_class; -+ bfqg_get(bfqg); -+ } -+ entity->parent = bfqg->my_entity; -+ entity->sched_data = &bfqg->sched_data; -+} -+ -+static void bfqg_stats_exit(struct bfqg_stats *stats) -+{ -+ blkg_rwstat_exit(&stats->merged); -+ blkg_rwstat_exit(&stats->service_time); -+ blkg_rwstat_exit(&stats->wait_time); -+ blkg_rwstat_exit(&stats->queued); -+ blkg_stat_exit(&stats->time); -+ blkg_stat_exit(&stats->avg_queue_size_sum); -+ blkg_stat_exit(&stats->avg_queue_size_samples); -+ blkg_stat_exit(&stats->dequeue); -+ blkg_stat_exit(&stats->group_wait_time); -+ blkg_stat_exit(&stats->idle_time); -+ blkg_stat_exit(&stats->empty_time); -+} -+ -+static int bfqg_stats_init(struct bfqg_stats *stats, gfp_t gfp) -+{ -+ if (blkg_rwstat_init(&stats->merged, gfp) || -+ blkg_rwstat_init(&stats->service_time, gfp) || -+ blkg_rwstat_init(&stats->wait_time, gfp) || -+ blkg_rwstat_init(&stats->queued, gfp) || -+ blkg_stat_init(&stats->time, gfp) || -+ blkg_stat_init(&stats->avg_queue_size_sum, gfp) || -+ blkg_stat_init(&stats->avg_queue_size_samples, gfp) || -+ blkg_stat_init(&stats->dequeue, gfp) || -+ blkg_stat_init(&stats->group_wait_time, gfp) || -+ blkg_stat_init(&stats->idle_time, gfp) || -+ blkg_stat_init(&stats->empty_time, gfp)) { -+ bfqg_stats_exit(stats); -+ return -ENOMEM; -+ } -+ -+ return 0; -+} -+ -+static struct bfq_group_data *cpd_to_bfqgd(struct blkcg_policy_data *cpd) -+{ -+ return cpd ? container_of(cpd, struct bfq_group_data, pd) : NULL; -+} -+ -+static struct bfq_group_data *blkcg_to_bfqgd(struct blkcg *blkcg) -+{ -+ return cpd_to_bfqgd(blkcg_to_cpd(blkcg, &blkcg_policy_bfq)); -+} -+ -+static struct blkcg_policy_data *bfq_cpd_alloc(gfp_t gfp) -+{ -+ struct bfq_group_data *bgd; -+ -+ bgd = kzalloc(sizeof(*bgd), GFP_KERNEL); -+ if (!bgd) -+ return NULL; -+ return &bgd->pd; -+} -+ -+static void bfq_cpd_init(struct blkcg_policy_data *cpd) -+{ -+ struct bfq_group_data *d = cpd_to_bfqgd(cpd); -+ -+ d->weight = cgroup_subsys_on_dfl(io_cgrp_subsys) ? -+ CGROUP_WEIGHT_DFL : BFQ_WEIGHT_LEGACY_DFL; -+} -+ -+static void bfq_cpd_free(struct blkcg_policy_data *cpd) -+{ -+ kfree(cpd_to_bfqgd(cpd)); -+} -+ -+static struct blkg_policy_data *bfq_pd_alloc(gfp_t gfp, int node) -+{ -+ struct bfq_group *bfqg; -+ -+ bfqg = kzalloc_node(sizeof(*bfqg), gfp, node); -+ if (!bfqg) -+ return NULL; -+ -+ if (bfqg_stats_init(&bfqg->stats, gfp)) { -+ kfree(bfqg); -+ return NULL; -+ } -+ -+ return &bfqg->pd; -+} -+ -+static void bfq_pd_init(struct blkg_policy_data *pd) -+{ -+ struct blkcg_gq *blkg; -+ struct bfq_group *bfqg; -+ struct bfq_data *bfqd; -+ struct bfq_entity *entity; -+ struct bfq_group_data *d; -+ -+ blkg = pd_to_blkg(pd); -+ BUG_ON(!blkg); -+ bfqg = blkg_to_bfqg(blkg); -+ bfqd = blkg->q->elevator->elevator_data; -+ entity = &bfqg->entity; -+ d = blkcg_to_bfqgd(blkg->blkcg); -+ -+ entity->orig_weight = entity->weight = entity->new_weight = d->weight; -+ entity->my_sched_data = &bfqg->sched_data; -+ bfqg->my_entity = entity; /* -+ * the root_group's will be set to NULL -+ * in bfq_init_queue() -+ */ -+ bfqg->bfqd = bfqd; -+ bfqg->active_entities = 0; -+ bfqg->rq_pos_tree = RB_ROOT; -+} -+ -+static void bfq_pd_free(struct blkg_policy_data *pd) -+{ -+ struct bfq_group *bfqg = pd_to_bfqg(pd); -+ -+ bfqg_stats_exit(&bfqg->stats); -+ return kfree(bfqg); -+} -+ -+static void bfq_pd_reset_stats(struct blkg_policy_data *pd) -+{ -+ struct bfq_group *bfqg = pd_to_bfqg(pd); -+ -+ bfqg_stats_reset(&bfqg->stats); -+} -+ -+static void bfq_group_set_parent(struct bfq_group *bfqg, -+ struct bfq_group *parent) -+{ -+ struct bfq_entity *entity; -+ -+ BUG_ON(!parent); -+ BUG_ON(!bfqg); -+ BUG_ON(bfqg == parent); -+ -+ entity = &bfqg->entity; -+ entity->parent = parent->my_entity; -+ entity->sched_data = &parent->sched_data; -+} -+ -+static struct bfq_group *bfq_lookup_bfqg(struct bfq_data *bfqd, -+ struct blkcg *blkcg) -+{ -+ struct blkcg_gq *blkg; -+ -+ blkg = blkg_lookup(blkcg, bfqd->queue); -+ if (likely(blkg)) -+ return blkg_to_bfqg(blkg); -+ return NULL; -+} -+ -+static struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd, -+ struct blkcg *blkcg) -+{ -+ struct bfq_group *bfqg, *parent; -+ struct bfq_entity *entity; -+ -+ assert_spin_locked(bfqd->queue->queue_lock); -+ -+ bfqg = bfq_lookup_bfqg(bfqd, blkcg); -+ -+ if (unlikely(!bfqg)) -+ return NULL; -+ -+ /* -+ * Update chain of bfq_groups as we might be handling a leaf group -+ * which, along with some of its relatives, has not been hooked yet -+ * to the private hierarchy of BFQ. -+ */ -+ entity = &bfqg->entity; -+ for_each_entity(entity) { -+ bfqg = container_of(entity, struct bfq_group, entity); -+ BUG_ON(!bfqg); -+ if (bfqg != bfqd->root_group) { -+ parent = bfqg_parent(bfqg); -+ if (!parent) -+ parent = bfqd->root_group; -+ BUG_ON(!parent); -+ bfq_group_set_parent(bfqg, parent); -+ } -+ } -+ -+ return bfqg; -+} -+ -+static void bfq_pos_tree_add_move(struct bfq_data *bfqd, -+ struct bfq_queue *bfqq); -+ -+static void bfq_bfqq_expire(struct bfq_data *bfqd, -+ struct bfq_queue *bfqq, -+ bool compensate, -+ enum bfqq_expiration reason); -+ -+/** -+ * bfq_bfqq_move - migrate @bfqq to @bfqg. -+ * @bfqd: queue descriptor. -+ * @bfqq: the queue to move. -+ * @bfqg: the group to move to. -+ * -+ * Move @bfqq to @bfqg, deactivating it from its old group and reactivating -+ * it on the new one. Avoid putting the entity on the old group idle tree. -+ * -+ * Must be called under the queue lock; the cgroup owning @bfqg must -+ * not disappear (by now this just means that we are called under -+ * rcu_read_lock()). -+ */ -+static void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq, -+ struct bfq_group *bfqg) -+{ -+ struct bfq_entity *entity = &bfqq->entity; -+ -+ BUG_ON(!bfq_bfqq_busy(bfqq) && !RB_EMPTY_ROOT(&bfqq->sort_list)); -+ BUG_ON(!RB_EMPTY_ROOT(&bfqq->sort_list) && !entity->on_st); -+ BUG_ON(bfq_bfqq_busy(bfqq) && RB_EMPTY_ROOT(&bfqq->sort_list) -+ && entity->on_st && -+ bfqq != bfqd->in_service_queue); -+ BUG_ON(!bfq_bfqq_busy(bfqq) && bfqq == bfqd->in_service_queue); -+ -+ /* If bfqq is empty, then bfq_bfqq_expire also invokes -+ * bfq_del_bfqq_busy, thereby removing bfqq and its entity -+ * from data structures related to current group. Otherwise we -+ * need to remove bfqq explicitly with bfq_deactivate_bfqq, as -+ * we do below. -+ */ -+ if (bfqq == bfqd->in_service_queue) -+ bfq_bfqq_expire(bfqd, bfqd->in_service_queue, -+ false, BFQ_BFQQ_PREEMPTED); -+ -+ BUG_ON(entity->on_st && !bfq_bfqq_busy(bfqq) -+ && &bfq_entity_service_tree(entity)->idle != -+ entity->tree); -+ -+ BUG_ON(RB_EMPTY_ROOT(&bfqq->sort_list) && bfq_bfqq_busy(bfqq)); -+ -+ if (bfq_bfqq_busy(bfqq)) -+ bfq_deactivate_bfqq(bfqd, bfqq, 0); -+ else if (entity->on_st) { -+ BUG_ON(&bfq_entity_service_tree(entity)->idle != -+ entity->tree); -+ bfq_put_idle_entity(bfq_entity_service_tree(entity), entity); -+ } -+ bfqg_put(bfqq_group(bfqq)); -+ -+ /* -+ * Here we use a reference to bfqg. We don't need a refcounter -+ * as the cgroup reference will not be dropped, so that its -+ * destroy() callback will not be invoked. -+ */ -+ entity->parent = bfqg->my_entity; -+ entity->sched_data = &bfqg->sched_data; -+ bfqg_get(bfqg); -+ -+ BUG_ON(RB_EMPTY_ROOT(&bfqq->sort_list) && bfq_bfqq_busy(bfqq)); -+ if (bfq_bfqq_busy(bfqq)) { -+ bfq_pos_tree_add_move(bfqd, bfqq); -+ bfq_activate_bfqq(bfqd, bfqq); -+ } -+ -+ if (!bfqd->in_service_queue && !bfqd->rq_in_driver) -+ bfq_schedule_dispatch(bfqd); -+ BUG_ON(entity->on_st && !bfq_bfqq_busy(bfqq) -+ && &bfq_entity_service_tree(entity)->idle != -+ entity->tree); -+} -+ -+/** -+ * __bfq_bic_change_cgroup - move @bic to @cgroup. -+ * @bfqd: the queue descriptor. -+ * @bic: the bic to move. -+ * @blkcg: the blk-cgroup to move to. -+ * -+ * Move bic to blkcg, assuming that bfqd->queue is locked; the caller -+ * has to make sure that the reference to cgroup is valid across the call. -+ * -+ * NOTE: an alternative approach might have been to store the current -+ * cgroup in bfqq and getting a reference to it, reducing the lookup -+ * time here, at the price of slightly more complex code. -+ */ -+static struct bfq_group *__bfq_bic_change_cgroup(struct bfq_data *bfqd, -+ struct bfq_io_cq *bic, -+ struct blkcg *blkcg) -+{ -+ struct bfq_queue *async_bfqq = bic_to_bfqq(bic, 0); -+ struct bfq_queue *sync_bfqq = bic_to_bfqq(bic, 1); -+ struct bfq_group *bfqg; -+ struct bfq_entity *entity; -+ -+ lockdep_assert_held(bfqd->queue->queue_lock); -+ -+ bfqg = bfq_find_set_group(bfqd, blkcg); -+ -+ if (unlikely(!bfqg)) -+ bfqg = bfqd->root_group; -+ -+ if (async_bfqq) { -+ entity = &async_bfqq->entity; -+ -+ if (entity->sched_data != &bfqg->sched_data) { -+ bic_set_bfqq(bic, NULL, 0); -+ bfq_log_bfqq(bfqd, async_bfqq, -+ "bic_change_group: %p %d", -+ async_bfqq, -+ async_bfqq->ref); -+ bfq_put_queue(async_bfqq); -+ } -+ } -+ -+ if (sync_bfqq) { -+ entity = &sync_bfqq->entity; -+ if (entity->sched_data != &bfqg->sched_data) -+ bfq_bfqq_move(bfqd, sync_bfqq, bfqg); -+ } -+ -+ return bfqg; -+} -+ -+static void bfq_bic_update_cgroup(struct bfq_io_cq *bic, struct bio *bio) -+{ -+ struct bfq_data *bfqd = bic_to_bfqd(bic); -+ struct bfq_group *bfqg = NULL; -+ uint64_t serial_nr; -+ -+ rcu_read_lock(); -+ serial_nr = bio_blkcg(bio)->css.serial_nr; -+ -+ /* -+ * Check whether blkcg has changed. The condition may trigger -+ * spuriously on a newly created cic but there's no harm. -+ */ -+ if (unlikely(!bfqd) || likely(bic->blkcg_serial_nr == serial_nr)) -+ goto out; -+ -+ bfqg = __bfq_bic_change_cgroup(bfqd, bic, bio_blkcg(bio)); -+ bic->blkcg_serial_nr = serial_nr; -+out: -+ rcu_read_unlock(); -+} -+ -+/** -+ * bfq_flush_idle_tree - deactivate any entity on the idle tree of @st. -+ * @st: the service tree being flushed. -+ */ -+static void bfq_flush_idle_tree(struct bfq_service_tree *st) -+{ -+ struct bfq_entity *entity = st->first_idle; -+ -+ for (; entity ; entity = st->first_idle) -+ __bfq_deactivate_entity(entity, 0); -+} -+ -+/** -+ * bfq_reparent_leaf_entity - move leaf entity to the root_group. -+ * @bfqd: the device data structure with the root group. -+ * @entity: the entity to move. -+ */ -+static void bfq_reparent_leaf_entity(struct bfq_data *bfqd, -+ struct bfq_entity *entity) -+{ -+ struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); -+ -+ BUG_ON(!bfqq); -+ bfq_bfqq_move(bfqd, bfqq, bfqd->root_group); -+} -+ -+/** -+ * bfq_reparent_active_entities - move to the root group all active -+ * entities. -+ * @bfqd: the device data structure with the root group. -+ * @bfqg: the group to move from. -+ * @st: the service tree with the entities. -+ * -+ * Needs queue_lock to be taken and reference to be valid over the call. -+ */ -+static void bfq_reparent_active_entities(struct bfq_data *bfqd, -+ struct bfq_group *bfqg, -+ struct bfq_service_tree *st) -+{ -+ struct rb_root *active = &st->active; -+ struct bfq_entity *entity = NULL; -+ -+ if (!RB_EMPTY_ROOT(&st->active)) -+ entity = bfq_entity_of(rb_first(active)); -+ -+ for (; entity ; entity = bfq_entity_of(rb_first(active))) -+ bfq_reparent_leaf_entity(bfqd, entity); -+ -+ if (bfqg->sched_data.in_service_entity) -+ bfq_reparent_leaf_entity(bfqd, -+ bfqg->sched_data.in_service_entity); -+} -+ -+/** -+ * bfq_pd_offline - deactivate the entity associated with @pd, -+ * and reparent its children entities. -+ * @pd: descriptor of the policy going offline. -+ * -+ * blkio already grabs the queue_lock for us, so no need to use -+ * RCU-based magic -+ */ -+static void bfq_pd_offline(struct blkg_policy_data *pd) -+{ -+ struct bfq_service_tree *st; -+ struct bfq_group *bfqg; -+ struct bfq_data *bfqd; -+ struct bfq_entity *entity; -+ int i; -+ -+ BUG_ON(!pd); -+ bfqg = pd_to_bfqg(pd); -+ BUG_ON(!bfqg); -+ bfqd = bfqg->bfqd; -+ BUG_ON(bfqd && !bfqd->root_group); -+ -+ entity = bfqg->my_entity; -+ -+ if (!entity) /* root group */ -+ return; -+ -+ /* -+ * Empty all service_trees belonging to this group before -+ * deactivating the group itself. -+ */ -+ for (i = 0; i < BFQ_IOPRIO_CLASSES; i++) { -+ BUG_ON(!bfqg->sched_data.service_tree); -+ st = bfqg->sched_data.service_tree + i; -+ /* -+ * The idle tree may still contain bfq_queues belonging -+ * to exited task because they never migrated to a different -+ * cgroup from the one being destroyed now. No one else -+ * can access them so it's safe to act without any lock. -+ */ -+ bfq_flush_idle_tree(st); -+ -+ /* -+ * It may happen that some queues are still active -+ * (busy) upon group destruction (if the corresponding -+ * processes have been forced to terminate). We move -+ * all the leaf entities corresponding to these queues -+ * to the root_group. -+ * Also, it may happen that the group has an entity -+ * in service, which is disconnected from the active -+ * tree: it must be moved, too. -+ * There is no need to put the sync queues, as the -+ * scheduler has taken no reference. -+ */ -+ bfq_reparent_active_entities(bfqd, bfqg, st); -+ BUG_ON(!RB_EMPTY_ROOT(&st->active)); -+ BUG_ON(!RB_EMPTY_ROOT(&st->idle)); -+ } -+ BUG_ON(bfqg->sched_data.next_in_service); -+ BUG_ON(bfqg->sched_data.in_service_entity); -+ -+ __bfq_deactivate_entity(entity, 0); -+ bfq_put_async_queues(bfqd, bfqg); -+ BUG_ON(entity->tree); -+ -+ /* -+ * @blkg is going offline and will be ignored by -+ * blkg_[rw]stat_recursive_sum(). Transfer stats to the parent so -+ * that they don't get lost. If IOs complete after this point, the -+ * stats for them will be lost. Oh well... -+ */ -+ bfqg_stats_xfer_dead(bfqg); -+} -+ -+static void bfq_end_wr_async(struct bfq_data *bfqd) -+{ -+ struct blkcg_gq *blkg; -+ -+ list_for_each_entry(blkg, &bfqd->queue->blkg_list, q_node) { -+ struct bfq_group *bfqg = blkg_to_bfqg(blkg); -+ BUG_ON(!bfqg); -+ -+ bfq_end_wr_async_queues(bfqd, bfqg); -+ } -+ bfq_end_wr_async_queues(bfqd, bfqd->root_group); -+} -+ -+static int bfq_io_show_weight(struct seq_file *sf, void *v) -+{ -+ struct blkcg *blkcg = css_to_blkcg(seq_css(sf)); -+ struct bfq_group_data *bfqgd = blkcg_to_bfqgd(blkcg); -+ unsigned int val = 0; -+ -+ if (bfqgd) -+ val = bfqgd->weight; -+ -+ seq_printf(sf, "%u\n", val); -+ -+ return 0; -+} -+ -+static int bfq_io_set_weight_legacy(struct cgroup_subsys_state *css, -+ struct cftype *cftype, -+ u64 val) -+{ -+ struct blkcg *blkcg = css_to_blkcg(css); -+ struct bfq_group_data *bfqgd = blkcg_to_bfqgd(blkcg); -+ struct blkcg_gq *blkg; -+ int ret = -ERANGE; -+ -+ if (val < BFQ_MIN_WEIGHT || val > BFQ_MAX_WEIGHT) -+ return ret; -+ -+ ret = 0; -+ spin_lock_irq(&blkcg->lock); -+ bfqgd->weight = (unsigned short)val; -+ hlist_for_each_entry(blkg, &blkcg->blkg_list, blkcg_node) { -+ struct bfq_group *bfqg = blkg_to_bfqg(blkg); -+ -+ if (!bfqg) -+ continue; -+ /* -+ * Setting the prio_changed flag of the entity -+ * to 1 with new_weight == weight would re-set -+ * the value of the weight to its ioprio mapping. -+ * Set the flag only if necessary. -+ */ -+ if ((unsigned short)val != bfqg->entity.new_weight) { -+ bfqg->entity.new_weight = (unsigned short)val; -+ /* -+ * Make sure that the above new value has been -+ * stored in bfqg->entity.new_weight before -+ * setting the prio_changed flag. In fact, -+ * this flag may be read asynchronously (in -+ * critical sections protected by a different -+ * lock than that held here), and finding this -+ * flag set may cause the execution of the code -+ * for updating parameters whose value may -+ * depend also on bfqg->entity.new_weight (in -+ * __bfq_entity_update_weight_prio). -+ * This barrier makes sure that the new value -+ * of bfqg->entity.new_weight is correctly -+ * seen in that code. -+ */ -+ smp_wmb(); -+ bfqg->entity.prio_changed = 1; -+ } -+ } -+ spin_unlock_irq(&blkcg->lock); -+ -+ return ret; -+} -+ -+static ssize_t bfq_io_set_weight(struct kernfs_open_file *of, -+ char *buf, size_t nbytes, -+ loff_t off) -+{ -+ u64 weight; -+ /* First unsigned long found in the file is used */ -+ int ret = kstrtoull(strim(buf), 0, &weight); -+ -+ if (ret) -+ return ret; -+ -+ return bfq_io_set_weight_legacy(of_css(of), NULL, weight); -+} -+ -+static int bfqg_print_stat(struct seq_file *sf, void *v) -+{ -+ blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), blkg_prfill_stat, -+ &blkcg_policy_bfq, seq_cft(sf)->private, false); -+ return 0; -+} -+ -+static int bfqg_print_rwstat(struct seq_file *sf, void *v) -+{ -+ blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), blkg_prfill_rwstat, -+ &blkcg_policy_bfq, seq_cft(sf)->private, true); -+ return 0; -+} -+ -+static u64 bfqg_prfill_stat_recursive(struct seq_file *sf, -+ struct blkg_policy_data *pd, int off) -+{ -+ u64 sum = blkg_stat_recursive_sum(pd_to_blkg(pd), -+ &blkcg_policy_bfq, off); -+ return __blkg_prfill_u64(sf, pd, sum); -+} -+ -+static u64 bfqg_prfill_rwstat_recursive(struct seq_file *sf, -+ struct blkg_policy_data *pd, int off) -+{ -+ struct blkg_rwstat sum = blkg_rwstat_recursive_sum(pd_to_blkg(pd), -+ &blkcg_policy_bfq, -+ off); -+ return __blkg_prfill_rwstat(sf, pd, &sum); -+} -+ -+static int bfqg_print_stat_recursive(struct seq_file *sf, void *v) -+{ -+ blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), -+ bfqg_prfill_stat_recursive, &blkcg_policy_bfq, -+ seq_cft(sf)->private, false); -+ return 0; -+} -+ -+static int bfqg_print_rwstat_recursive(struct seq_file *sf, void *v) -+{ -+ blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), -+ bfqg_prfill_rwstat_recursive, &blkcg_policy_bfq, -+ seq_cft(sf)->private, true); -+ return 0; -+} -+ -+static u64 bfqg_prfill_sectors(struct seq_file *sf, struct blkg_policy_data *pd, -+ int off) -+{ -+ u64 sum = blkg_rwstat_total(&pd->blkg->stat_bytes); -+ -+ return __blkg_prfill_u64(sf, pd, sum >> 9); -+} -+ -+static int bfqg_print_stat_sectors(struct seq_file *sf, void *v) -+{ -+ blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), -+ bfqg_prfill_sectors, &blkcg_policy_bfq, 0, false); -+ return 0; -+} -+ -+static u64 bfqg_prfill_sectors_recursive(struct seq_file *sf, -+ struct blkg_policy_data *pd, int off) -+{ -+ struct blkg_rwstat tmp = blkg_rwstat_recursive_sum(pd->blkg, NULL, -+ offsetof(struct blkcg_gq, stat_bytes)); -+ u64 sum = atomic64_read(&tmp.aux_cnt[BLKG_RWSTAT_READ]) + -+ atomic64_read(&tmp.aux_cnt[BLKG_RWSTAT_WRITE]); -+ -+ return __blkg_prfill_u64(sf, pd, sum >> 9); -+} -+ -+static int bfqg_print_stat_sectors_recursive(struct seq_file *sf, void *v) -+{ -+ blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), -+ bfqg_prfill_sectors_recursive, &blkcg_policy_bfq, 0, -+ false); -+ return 0; -+} -+ -+ -+static u64 bfqg_prfill_avg_queue_size(struct seq_file *sf, -+ struct blkg_policy_data *pd, int off) -+{ -+ struct bfq_group *bfqg = pd_to_bfqg(pd); -+ u64 samples = blkg_stat_read(&bfqg->stats.avg_queue_size_samples); -+ u64 v = 0; -+ -+ if (samples) { -+ v = blkg_stat_read(&bfqg->stats.avg_queue_size_sum); -+ v = div64_u64(v, samples); -+ } -+ __blkg_prfill_u64(sf, pd, v); -+ return 0; -+} -+ -+/* print avg_queue_size */ -+static int bfqg_print_avg_queue_size(struct seq_file *sf, void *v) -+{ -+ blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), -+ bfqg_prfill_avg_queue_size, &blkcg_policy_bfq, -+ 0, false); -+ return 0; -+} -+ -+static struct bfq_group * -+bfq_create_group_hierarchy(struct bfq_data *bfqd, int node) -+{ -+ int ret; -+ -+ ret = blkcg_activate_policy(bfqd->queue, &blkcg_policy_bfq); -+ if (ret) -+ return NULL; -+ -+ return blkg_to_bfqg(bfqd->queue->root_blkg); -+} -+ -+static struct cftype bfq_blkcg_legacy_files[] = { -+ { -+ .name = "bfq.weight", -+ .flags = CFTYPE_NOT_ON_ROOT, -+ .seq_show = bfq_io_show_weight, -+ .write_u64 = bfq_io_set_weight_legacy, -+ }, -+ -+ /* statistics, covers only the tasks in the bfqg */ -+ { -+ .name = "bfq.time", -+ .private = offsetof(struct bfq_group, stats.time), -+ .seq_show = bfqg_print_stat, -+ }, -+ { -+ .name = "bfq.sectors", -+ .seq_show = bfqg_print_stat_sectors, -+ }, -+ { -+ .name = "bfq.io_service_bytes", -+ .private = (unsigned long)&blkcg_policy_bfq, -+ .seq_show = blkg_print_stat_bytes, -+ }, -+ { -+ .name = "bfq.io_serviced", -+ .private = (unsigned long)&blkcg_policy_bfq, -+ .seq_show = blkg_print_stat_ios, -+ }, -+ { -+ .name = "bfq.io_service_time", -+ .private = offsetof(struct bfq_group, stats.service_time), -+ .seq_show = bfqg_print_rwstat, -+ }, -+ { -+ .name = "bfq.io_wait_time", -+ .private = offsetof(struct bfq_group, stats.wait_time), -+ .seq_show = bfqg_print_rwstat, -+ }, -+ { -+ .name = "bfq.io_merged", -+ .private = offsetof(struct bfq_group, stats.merged), -+ .seq_show = bfqg_print_rwstat, -+ }, -+ { -+ .name = "bfq.io_queued", -+ .private = offsetof(struct bfq_group, stats.queued), -+ .seq_show = bfqg_print_rwstat, -+ }, -+ -+ /* the same statictics which cover the bfqg and its descendants */ -+ { -+ .name = "bfq.time_recursive", -+ .private = offsetof(struct bfq_group, stats.time), -+ .seq_show = bfqg_print_stat_recursive, -+ }, -+ { -+ .name = "bfq.sectors_recursive", -+ .seq_show = bfqg_print_stat_sectors_recursive, -+ }, -+ { -+ .name = "bfq.io_service_bytes_recursive", -+ .private = (unsigned long)&blkcg_policy_bfq, -+ .seq_show = blkg_print_stat_bytes_recursive, -+ }, -+ { -+ .name = "bfq.io_serviced_recursive", -+ .private = (unsigned long)&blkcg_policy_bfq, -+ .seq_show = blkg_print_stat_ios_recursive, -+ }, -+ { -+ .name = "bfq.io_service_time_recursive", -+ .private = offsetof(struct bfq_group, stats.service_time), -+ .seq_show = bfqg_print_rwstat_recursive, -+ }, -+ { -+ .name = "bfq.io_wait_time_recursive", -+ .private = offsetof(struct bfq_group, stats.wait_time), -+ .seq_show = bfqg_print_rwstat_recursive, -+ }, -+ { -+ .name = "bfq.io_merged_recursive", -+ .private = offsetof(struct bfq_group, stats.merged), -+ .seq_show = bfqg_print_rwstat_recursive, -+ }, -+ { -+ .name = "bfq.io_queued_recursive", -+ .private = offsetof(struct bfq_group, stats.queued), -+ .seq_show = bfqg_print_rwstat_recursive, -+ }, -+ { -+ .name = "bfq.avg_queue_size", -+ .seq_show = bfqg_print_avg_queue_size, -+ }, -+ { -+ .name = "bfq.group_wait_time", -+ .private = offsetof(struct bfq_group, stats.group_wait_time), -+ .seq_show = bfqg_print_stat, -+ }, -+ { -+ .name = "bfq.idle_time", -+ .private = offsetof(struct bfq_group, stats.idle_time), -+ .seq_show = bfqg_print_stat, -+ }, -+ { -+ .name = "bfq.empty_time", -+ .private = offsetof(struct bfq_group, stats.empty_time), -+ .seq_show = bfqg_print_stat, -+ }, -+ { -+ .name = "bfq.dequeue", -+ .private = offsetof(struct bfq_group, stats.dequeue), -+ .seq_show = bfqg_print_stat, -+ }, -+ { } /* terminate */ -+}; -+ -+static struct cftype bfq_blkg_files[] = { -+ { -+ .name = "bfq.weight", -+ .flags = CFTYPE_NOT_ON_ROOT, -+ .seq_show = bfq_io_show_weight, -+ .write = bfq_io_set_weight, -+ }, -+ {} /* terminate */ -+}; -+ -+#else /* CONFIG_BFQ_GROUP_IOSCHED */ -+ -+static inline void bfqg_stats_update_io_add(struct bfq_group *bfqg, -+ struct bfq_queue *bfqq, int op, int op_flags) { } -+static inline void -+bfqg_stats_update_io_remove(struct bfq_group *bfqg, int op, int op_flags) { } -+static inline void -+bfqg_stats_update_io_merged(struct bfq_group *bfqg, int op, int op_flags) { } -+static inline void bfqg_stats_update_completion(struct bfq_group *bfqg, -+ uint64_t start_time, uint64_t io_start_time, int op, -+ int op_flags) { } -+static inline void -+bfqg_stats_set_start_group_wait_time(struct bfq_group *bfqg, -+ struct bfq_group *curr_bfqg) { } -+static inline void bfqg_stats_end_empty_time(struct bfqg_stats *stats) { } -+static inline void bfqg_stats_update_dequeue(struct bfq_group *bfqg) { } -+static inline void bfqg_stats_set_start_empty_time(struct bfq_group *bfqg) { } -+static inline void bfqg_stats_update_idle_time(struct bfq_group *bfqg) { } -+static inline void bfqg_stats_set_start_idle_time(struct bfq_group *bfqg) { } -+static inline void bfqg_stats_update_avg_queue_size(struct bfq_group *bfqg) { } -+ -+static void bfq_init_entity(struct bfq_entity *entity, -+ struct bfq_group *bfqg) -+{ -+ struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); -+ -+ entity->weight = entity->new_weight; -+ entity->orig_weight = entity->new_weight; -+ if (bfqq) { -+ bfqq->ioprio = bfqq->new_ioprio; -+ bfqq->ioprio_class = bfqq->new_ioprio_class; -+ } -+ entity->sched_data = &bfqg->sched_data; -+} -+ -+static struct bfq_group * -+bfq_bic_update_cgroup(struct bfq_io_cq *bic, struct bio *bio) -+{ -+ struct bfq_data *bfqd = bic_to_bfqd(bic); -+ -+ return bfqd->root_group; -+} -+ -+static void bfq_end_wr_async(struct bfq_data *bfqd) -+{ -+ bfq_end_wr_async_queues(bfqd, bfqd->root_group); -+} -+ -+static struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd, -+ struct blkcg *blkcg) -+{ -+ return bfqd->root_group; -+} -+ -+static struct bfq_group *bfqq_group(struct bfq_queue *bfqq) -+{ -+ return bfqq->bfqd->root_group; -+} -+ -+static struct bfq_group * -+bfq_create_group_hierarchy(struct bfq_data *bfqd, int node) -+{ -+ struct bfq_group *bfqg; -+ int i; -+ -+ bfqg = kmalloc_node(sizeof(*bfqg), GFP_KERNEL | __GFP_ZERO, node); -+ if (!bfqg) -+ return NULL; -+ -+ for (i = 0; i < BFQ_IOPRIO_CLASSES; i++) -+ bfqg->sched_data.service_tree[i] = BFQ_SERVICE_TREE_INIT; -+ -+ return bfqg; -+} -+#endif -diff -w -uNr '--exclude=.git' linux-4.8/block/bfq.h linux-4.8-bfq/block/bfq.h ---- linux-4.8/block/bfq.h 1970-01-01 01:00:00.000000000 +0100 -+++ linux-4.8-bfq/block/bfq.h 2016-10-18 12:57:57.691164881 +0200 -@@ -0,0 +1,886 @@ -+/* -+ * BFQ-v8r4 for 4.8.0: data structures and common functions prototypes. -+ * -+ * Based on ideas and code from CFQ: -+ * Copyright (C) 2003 Jens Axboe -+ * -+ * Copyright (C) 2008 Fabio Checconi -+ * Paolo Valente -+ * -+ * Copyright (C) 2015 Paolo Valente -+ * -+ * Copyright (C) 2016 Paolo Valente -+ */ -+ -+#ifndef _BFQ_H -+#define _BFQ_H -+ -+#include -+#include -+#include -+#include -+#include -+ -+#define BFQ_IOPRIO_CLASSES 3 -+#define BFQ_CL_IDLE_TIMEOUT (HZ/5) -+ -+#define BFQ_MIN_WEIGHT 1 -+#define BFQ_MAX_WEIGHT 1000 -+#define BFQ_WEIGHT_CONVERSION_COEFF 10 -+ -+#define BFQ_DEFAULT_QUEUE_IOPRIO 4 -+ -+#define BFQ_WEIGHT_LEGACY_DFL 100 -+#define BFQ_DEFAULT_GRP_IOPRIO 0 -+#define BFQ_DEFAULT_GRP_CLASS IOPRIO_CLASS_BE -+ -+/* -+ * Soft real-time applications are extremely more latency sensitive -+ * than interactive ones. Over-raise the weight of the former to -+ * privilege them against the latter. -+ */ -+#define BFQ_SOFTRT_WEIGHT_FACTOR 100 -+ -+struct bfq_entity; -+ -+/** -+ * struct bfq_service_tree - per ioprio_class service tree. -+ * -+ * Each service tree represents a B-WF2Q+ scheduler on its own. Each -+ * ioprio_class has its own independent scheduler, and so its own -+ * bfq_service_tree. All the fields are protected by the queue lock -+ * of the containing bfqd. -+ */ -+struct bfq_service_tree { -+ /* tree for active entities (i.e., those backlogged) */ -+ struct rb_root active; -+ /* tree for idle entities (i.e., not backlogged, with V <= F_i)*/ -+ struct rb_root idle; -+ -+ struct bfq_entity *first_idle; /* idle entity with minimum F_i */ -+ struct bfq_entity *last_idle; /* idle entity with maximum F_i */ -+ -+ u64 vtime; /* scheduler virtual time */ -+ /* scheduler weight sum; active and idle entities contribute to it */ -+ unsigned long wsum; -+}; -+ -+/** -+ * struct bfq_sched_data - multi-class scheduler. -+ * -+ * bfq_sched_data is the basic scheduler queue. It supports three -+ * ioprio_classes, and can be used either as a toplevel queue or as an -+ * intermediate queue on a hierarchical setup. @next_in_service -+ * points to the active entity of the sched_data service trees that -+ * will be scheduled next. It is used to reduce the number of steps -+ * needed for each hierarchical-schedule update. -+ * -+ * The supported ioprio_classes are the same as in CFQ, in descending -+ * priority order, IOPRIO_CLASS_RT, IOPRIO_CLASS_BE, IOPRIO_CLASS_IDLE. -+ * Requests from higher priority queues are served before all the -+ * requests from lower priority queues; among requests of the same -+ * queue requests are served according to B-WF2Q+. -+ * All the fields are protected by the queue lock of the containing bfqd. -+ */ -+struct bfq_sched_data { -+ struct bfq_entity *in_service_entity; /* entity in service */ -+ /* head-of-the-line entity in the scheduler (see comments above) */ -+ struct bfq_entity *next_in_service; -+ /* array of service trees, one per ioprio_class */ -+ struct bfq_service_tree service_tree[BFQ_IOPRIO_CLASSES]; -+}; -+ -+/** -+ * struct bfq_weight_counter - counter of the number of all active entities -+ * with a given weight. -+ */ -+struct bfq_weight_counter { -+ unsigned int weight; /* weight of the entities this counter refers to */ -+ unsigned int num_active; /* nr of active entities with this weight */ -+ /* -+ * Weights tree member (see bfq_data's @queue_weights_tree and -+ * @group_weights_tree) -+ */ -+ struct rb_node weights_node; -+}; -+ -+/** -+ * struct bfq_entity - schedulable entity. -+ * -+ * A bfq_entity is used to represent either a bfq_queue (leaf node in the -+ * cgroup hierarchy) or a bfq_group into the upper level scheduler. Each -+ * entity belongs to the sched_data of the parent group in the cgroup -+ * hierarchy. Non-leaf entities have also their own sched_data, stored -+ * in @my_sched_data. -+ * -+ * Each entity stores independently its priority values; this would -+ * allow different weights on different devices, but this -+ * functionality is not exported to userspace by now. Priorities and -+ * weights are updated lazily, first storing the new values into the -+ * new_* fields, then setting the @prio_changed flag. As soon as -+ * there is a transition in the entity state that allows the priority -+ * update to take place the effective and the requested priority -+ * values are synchronized. -+ * -+ * Unless cgroups are used, the weight value is calculated from the -+ * ioprio to export the same interface as CFQ. When dealing with -+ * ``well-behaved'' queues (i.e., queues that do not spend too much -+ * time to consume their budget and have true sequential behavior, and -+ * when there are no external factors breaking anticipation) the -+ * relative weights at each level of the cgroups hierarchy should be -+ * guaranteed. All the fields are protected by the queue lock of the -+ * containing bfqd. -+ */ -+struct bfq_entity { -+ struct rb_node rb_node; /* service_tree member */ -+ /* pointer to the weight counter associated with this entity */ -+ struct bfq_weight_counter *weight_counter; -+ -+ /* -+ * flag, true if the entity is on a tree (either the active or -+ * the idle one of its service_tree). -+ */ -+ int on_st; -+ -+ u64 finish; /* B-WF2Q+ finish timestamp (aka F_i) */ -+ u64 start; /* B-WF2Q+ start timestamp (aka S_i) */ -+ -+ /* tree the entity is enqueued into; %NULL if not on a tree */ -+ struct rb_root *tree; -+ -+ /* -+ * minimum start time of the (active) subtree rooted at this -+ * entity; used for O(log N) lookups into active trees -+ */ -+ u64 min_start; -+ -+ /* amount of service received during the last service slot */ -+ int service; -+ -+ /* budget, used also to calculate F_i: F_i = S_i + @budget / @weight */ -+ int budget; -+ -+ unsigned int weight; /* weight of the queue */ -+ unsigned int new_weight; /* next weight if a change is in progress */ -+ -+ /* original weight, used to implement weight boosting */ -+ unsigned int orig_weight; -+ -+ /* parent entity, for hierarchical scheduling */ -+ struct bfq_entity *parent; -+ -+ /* -+ * For non-leaf nodes in the hierarchy, the associated -+ * scheduler queue, %NULL on leaf nodes. -+ */ -+ struct bfq_sched_data *my_sched_data; -+ /* the scheduler queue this entity belongs to */ -+ struct bfq_sched_data *sched_data; -+ -+ /* flag, set to request a weight, ioprio or ioprio_class change */ -+ int prio_changed; -+}; -+ -+struct bfq_group; -+ -+/** -+ * struct bfq_queue - leaf schedulable entity. -+ * -+ * A bfq_queue is a leaf request queue; it can be associated with an -+ * io_context or more, if it is async or shared between cooperating -+ * processes. @cgroup holds a reference to the cgroup, to be sure that it -+ * does not disappear while a bfqq still references it (mostly to avoid -+ * races between request issuing and task migration followed by cgroup -+ * destruction). -+ * All the fields are protected by the queue lock of the containing bfqd. -+ */ -+struct bfq_queue { -+ /* reference counter */ -+ int ref; -+ /* parent bfq_data */ -+ struct bfq_data *bfqd; -+ -+ /* current ioprio and ioprio class */ -+ unsigned short ioprio, ioprio_class; -+ /* next ioprio and ioprio class if a change is in progress */ -+ unsigned short new_ioprio, new_ioprio_class; -+ -+ /* -+ * Shared bfq_queue if queue is cooperating with one or more -+ * other queues. -+ */ -+ struct bfq_queue *new_bfqq; -+ /* request-position tree member (see bfq_group's @rq_pos_tree) */ -+ struct rb_node pos_node; -+ /* request-position tree root (see bfq_group's @rq_pos_tree) */ -+ struct rb_root *pos_root; -+ -+ /* sorted list of pending requests */ -+ struct rb_root sort_list; -+ /* if fifo isn't expired, next request to serve */ -+ struct request *next_rq; -+ /* number of sync and async requests queued */ -+ int queued[2]; -+ /* number of sync and async requests currently allocated */ -+ int allocated[2]; -+ /* number of pending metadata requests */ -+ int meta_pending; -+ /* fifo list of requests in sort_list */ -+ struct list_head fifo; -+ -+ /* entity representing this queue in the scheduler */ -+ struct bfq_entity entity; -+ -+ /* maximum budget allowed from the feedback mechanism */ -+ int max_budget; -+ /* budget expiration (in jiffies) */ -+ unsigned long budget_timeout; -+ -+ /* number of requests on the dispatch list or inside driver */ -+ int dispatched; -+ -+ unsigned int flags; /* status flags.*/ -+ -+ /* node for active/idle bfqq list inside parent bfqd */ -+ struct list_head bfqq_list; -+ -+ /* bit vector: a 1 for each seeky requests in history */ -+ u32 seek_history; -+ -+ /* node for the device's burst list */ -+ struct hlist_node burst_list_node; -+ -+ /* position of the last request enqueued */ -+ sector_t last_request_pos; -+ -+ /* Number of consecutive pairs of request completion and -+ * arrival, such that the queue becomes idle after the -+ * completion, but the next request arrives within an idle -+ * time slice; used only if the queue's IO_bound flag has been -+ * cleared. -+ */ -+ unsigned int requests_within_timer; -+ -+ /* pid of the process owning the queue, used for logging purposes */ -+ pid_t pid; -+ -+ /* -+ * Pointer to the bfq_io_cq owning the bfq_queue, set to %NULL -+ * if the queue is shared. -+ */ -+ struct bfq_io_cq *bic; -+ -+ /* current maximum weight-raising time for this queue */ -+ unsigned long wr_cur_max_time; -+ /* -+ * Minimum time instant such that, only if a new request is -+ * enqueued after this time instant in an idle @bfq_queue with -+ * no outstanding requests, then the task associated with the -+ * queue it is deemed as soft real-time (see the comments on -+ * the function bfq_bfqq_softrt_next_start()) -+ */ -+ unsigned long soft_rt_next_start; -+ /* -+ * Start time of the current weight-raising period if -+ * the @bfq-queue is being weight-raised, otherwise -+ * finish time of the last weight-raising period. -+ */ -+ unsigned long last_wr_start_finish; -+ /* factor by which the weight of this queue is multiplied */ -+ unsigned int wr_coeff; -+ /* -+ * Time of the last transition of the @bfq_queue from idle to -+ * backlogged. -+ */ -+ unsigned long last_idle_bklogged; -+ /* -+ * Cumulative service received from the @bfq_queue since the -+ * last transition from idle to backlogged. -+ */ -+ unsigned long service_from_backlogged; -+ /* -+ * Value of wr start time when switching to soft rt -+ */ -+ unsigned long wr_start_at_switch_to_srt; -+ -+ unsigned long split_time; /* time of last split */ -+}; -+ -+/** -+ * struct bfq_ttime - per process thinktime stats. -+ */ -+struct bfq_ttime { -+ u64 last_end_request; /* completion time of last request */ -+ -+ u64 ttime_total; /* total process thinktime */ -+ unsigned long ttime_samples; /* number of thinktime samples */ -+ u64 ttime_mean; /* average process thinktime */ -+ -+}; -+ -+/** -+ * struct bfq_io_cq - per (request_queue, io_context) structure. -+ */ -+struct bfq_io_cq { -+ /* associated io_cq structure */ -+ struct io_cq icq; /* must be the first member */ -+ /* array of two process queues, the sync and the async */ -+ struct bfq_queue *bfqq[2]; -+ /* associated @bfq_ttime struct */ -+ struct bfq_ttime ttime; -+ /* per (request_queue, blkcg) ioprio */ -+ int ioprio; -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ uint64_t blkcg_serial_nr; /* the current blkcg serial */ -+#endif -+ -+ /* -+ * Snapshot of the idle window before merging; taken to -+ * remember this value while the queue is merged, so as to be -+ * able to restore it in case of split. -+ */ -+ bool saved_idle_window; -+ /* -+ * Same purpose as the previous two fields for the I/O bound -+ * classification of a queue. -+ */ -+ bool saved_IO_bound; -+ -+ /* -+ * Same purpose as the previous fields for the value of the -+ * field keeping the queue's belonging to a large burst -+ */ -+ bool saved_in_large_burst; -+ /* -+ * True if the queue belonged to a burst list before its merge -+ * with another cooperating queue. -+ */ -+ bool was_in_burst_list; -+ -+ /* -+ * Similar to previous fields: save wr information. -+ */ -+ unsigned long saved_wr_coeff; -+ unsigned long saved_last_wr_start_finish; -+ unsigned long saved_wr_start_at_switch_to_srt; -+}; -+ -+enum bfq_device_speed { -+ BFQ_BFQD_FAST, -+ BFQ_BFQD_SLOW, -+}; -+ -+/** -+ * struct bfq_data - per-device data structure. -+ * -+ * All the fields are protected by the @queue lock. -+ */ -+struct bfq_data { -+ /* request queue for the device */ -+ struct request_queue *queue; -+ -+ /* root bfq_group for the device */ -+ struct bfq_group *root_group; -+ -+ /* -+ * rbtree of weight counters of @bfq_queues, sorted by -+ * weight. Used to keep track of whether all @bfq_queues have -+ * the same weight. The tree contains one counter for each -+ * distinct weight associated to some active and not -+ * weight-raised @bfq_queue (see the comments to the functions -+ * bfq_weights_tree_[add|remove] for further details). -+ */ -+ struct rb_root queue_weights_tree; -+ /* -+ * rbtree of non-queue @bfq_entity weight counters, sorted by -+ * weight. Used to keep track of whether all @bfq_groups have -+ * the same weight. The tree contains one counter for each -+ * distinct weight associated to some active @bfq_group (see -+ * the comments to the functions bfq_weights_tree_[add|remove] -+ * for further details). -+ */ -+ struct rb_root group_weights_tree; -+ -+ /* -+ * Number of bfq_queues containing requests (including the -+ * queue in service, even if it is idling). -+ */ -+ int busy_queues; -+ /* number of weight-raised busy @bfq_queues */ -+ int wr_busy_queues; -+ /* number of queued requests */ -+ int queued; -+ /* number of requests dispatched and waiting for completion */ -+ int rq_in_driver; -+ -+ /* -+ * Maximum number of requests in driver in the last -+ * @hw_tag_samples completed requests. -+ */ -+ int max_rq_in_driver; -+ /* number of samples used to calculate hw_tag */ -+ int hw_tag_samples; -+ /* flag set to one if the driver is showing a queueing behavior */ -+ int hw_tag; -+ -+ /* number of budgets assigned */ -+ int budgets_assigned; -+ -+ /* -+ * Timer set when idling (waiting) for the next request from -+ * the queue in service. -+ */ -+ struct hrtimer idle_slice_timer; -+ /* delayed work to restart dispatching on the request queue */ -+ struct work_struct unplug_work; -+ -+ /* bfq_queue in service */ -+ struct bfq_queue *in_service_queue; -+ /* bfq_io_cq (bic) associated with the @in_service_queue */ -+ struct bfq_io_cq *in_service_bic; -+ -+ /* on-disk position of the last served request */ -+ sector_t last_position; -+ -+ /* time of last request completion (ns) */ -+ u64 last_completion; -+ -+ /* time of first rq dispatch in current observation interval (ns) */ -+ u64 first_dispatch; -+ /* time of last rq dispatch in current observation interval (ns) */ -+ u64 last_dispatch; -+ -+ /* beginning of the last budget */ -+ ktime_t last_budget_start; -+ /* beginning of the last idle slice */ -+ ktime_t last_idling_start; -+ -+ /* number of samples in current observation interval */ -+ int peak_rate_samples; -+ /* num of samples of seq dispatches in current observation interval */ -+ u32 sequential_samples; -+ /* total num of sectors transferred in current observation interval */ -+ u64 tot_sectors_dispatched; -+ /* max rq size seen during current observation interval (sectors) */ -+ u32 last_rq_max_size; -+ /* time elapsed from first dispatch in current observ. interval (us) */ -+ u64 delta_from_first; -+ /* current estimate of device peak rate */ -+ u32 peak_rate; -+ -+ /* maximum budget allotted to a bfq_queue before rescheduling */ -+ int bfq_max_budget; -+ -+ /* list of all the bfq_queues active on the device */ -+ struct list_head active_list; -+ /* list of all the bfq_queues idle on the device */ -+ struct list_head idle_list; -+ -+ /* -+ * Timeout for async/sync requests; when it fires, requests -+ * are served in fifo order. -+ */ -+ u64 bfq_fifo_expire[2]; -+ /* weight of backward seeks wrt forward ones */ -+ unsigned int bfq_back_penalty; -+ /* maximum allowed backward seek */ -+ unsigned int bfq_back_max; -+ /* maximum idling time */ -+ u32 bfq_slice_idle; -+ /* last time CLASS_IDLE was served */ -+ u64 bfq_class_idle_last_service; -+ -+ /* user-configured max budget value (0 for auto-tuning) */ -+ int bfq_user_max_budget; -+ /* -+ * Timeout for bfq_queues to consume their budget; used to -+ * prevent seeky queues from imposing long latencies to -+ * sequential or quasi-sequential ones (this also implies that -+ * seeky queues cannot receive guarantees in the service -+ * domain; after a timeout they are charged for the time they -+ * have been in service, to preserve fairness among them, but -+ * without service-domain guarantees). -+ */ -+ unsigned int bfq_timeout; -+ -+ /* -+ * Number of consecutive requests that must be issued within -+ * the idle time slice to set again idling to a queue which -+ * was marked as non-I/O-bound (see the definition of the -+ * IO_bound flag for further details). -+ */ -+ unsigned int bfq_requests_within_timer; -+ -+ /* -+ * Force device idling whenever needed to provide accurate -+ * service guarantees, without caring about throughput -+ * issues. CAVEAT: this may even increase latencies, in case -+ * of useless idling for processes that did stop doing I/O. -+ */ -+ bool strict_guarantees; -+ -+ /* -+ * Last time at which a queue entered the current burst of -+ * queues being activated shortly after each other; for more -+ * details about this and the following parameters related to -+ * a burst of activations, see the comments on the function -+ * bfq_handle_burst. -+ */ -+ unsigned long last_ins_in_burst; -+ /* -+ * Reference time interval used to decide whether a queue has -+ * been activated shortly after @last_ins_in_burst. -+ */ -+ unsigned long bfq_burst_interval; -+ /* number of queues in the current burst of queue activations */ -+ int burst_size; -+ -+ /* common parent entity for the queues in the burst */ -+ struct bfq_entity *burst_parent_entity; -+ /* Maximum burst size above which the current queue-activation -+ * burst is deemed as 'large'. -+ */ -+ unsigned long bfq_large_burst_thresh; -+ /* true if a large queue-activation burst is in progress */ -+ bool large_burst; -+ /* -+ * Head of the burst list (as for the above fields, more -+ * details in the comments on the function bfq_handle_burst). -+ */ -+ struct hlist_head burst_list; -+ -+ /* if set to true, low-latency heuristics are enabled */ -+ bool low_latency; -+ /* -+ * Maximum factor by which the weight of a weight-raised queue -+ * is multiplied. -+ */ -+ unsigned int bfq_wr_coeff; -+ /* maximum duration of a weight-raising period (jiffies) */ -+ unsigned int bfq_wr_max_time; -+ -+ /* Maximum weight-raising duration for soft real-time processes */ -+ unsigned int bfq_wr_rt_max_time; -+ /* -+ * Minimum idle period after which weight-raising may be -+ * reactivated for a queue (in jiffies). -+ */ -+ unsigned int bfq_wr_min_idle_time; -+ /* -+ * Minimum period between request arrivals after which -+ * weight-raising may be reactivated for an already busy async -+ * queue (in jiffies). -+ */ -+ unsigned long bfq_wr_min_inter_arr_async; -+ -+ /* Max service-rate for a soft real-time queue, in sectors/sec */ -+ unsigned int bfq_wr_max_softrt_rate; -+ /* -+ * Cached value of the product R*T, used for computing the -+ * maximum duration of weight raising automatically. -+ */ -+ u64 RT_prod; -+ /* device-speed class for the low-latency heuristic */ -+ enum bfq_device_speed device_speed; -+ -+ /* fallback dummy bfqq for extreme OOM conditions */ -+ struct bfq_queue oom_bfqq; -+}; -+ -+enum bfqq_state_flags { -+ BFQ_BFQQ_FLAG_just_created = 0, /* queue just allocated */ -+ BFQ_BFQQ_FLAG_busy, /* has requests or is in service */ -+ BFQ_BFQQ_FLAG_wait_request, /* waiting for a request */ -+ BFQ_BFQQ_FLAG_non_blocking_wait_rq, /* -+ * waiting for a request -+ * without idling the device -+ */ -+ BFQ_BFQQ_FLAG_must_alloc, /* must be allowed rq alloc */ -+ BFQ_BFQQ_FLAG_fifo_expire, /* FIFO checked in this slice */ -+ BFQ_BFQQ_FLAG_idle_window, /* slice idling enabled */ -+ BFQ_BFQQ_FLAG_sync, /* synchronous queue */ -+ BFQ_BFQQ_FLAG_IO_bound, /* -+ * bfqq has timed-out at least once -+ * having consumed at most 2/10 of -+ * its budget -+ */ -+ BFQ_BFQQ_FLAG_in_large_burst, /* -+ * bfqq activated in a large burst, -+ * see comments to bfq_handle_burst. -+ */ -+ BFQ_BFQQ_FLAG_softrt_update, /* -+ * may need softrt-next-start -+ * update -+ */ -+ BFQ_BFQQ_FLAG_coop, /* bfqq is shared */ -+ BFQ_BFQQ_FLAG_split_coop /* shared bfqq will be split */ -+}; -+ -+#define BFQ_BFQQ_FNS(name) \ -+static void bfq_mark_bfqq_##name(struct bfq_queue *bfqq) \ -+{ \ -+ (bfqq)->flags |= (1 << BFQ_BFQQ_FLAG_##name); \ -+} \ -+static void bfq_clear_bfqq_##name(struct bfq_queue *bfqq) \ -+{ \ -+ (bfqq)->flags &= ~(1 << BFQ_BFQQ_FLAG_##name); \ -+} \ -+static int bfq_bfqq_##name(const struct bfq_queue *bfqq) \ -+{ \ -+ return ((bfqq)->flags & (1 << BFQ_BFQQ_FLAG_##name)) != 0; \ -+} -+ -+BFQ_BFQQ_FNS(just_created); -+BFQ_BFQQ_FNS(busy); -+BFQ_BFQQ_FNS(wait_request); -+BFQ_BFQQ_FNS(non_blocking_wait_rq); -+BFQ_BFQQ_FNS(must_alloc); -+BFQ_BFQQ_FNS(fifo_expire); -+BFQ_BFQQ_FNS(idle_window); -+BFQ_BFQQ_FNS(sync); -+BFQ_BFQQ_FNS(IO_bound); -+BFQ_BFQQ_FNS(in_large_burst); -+BFQ_BFQQ_FNS(coop); -+BFQ_BFQQ_FNS(split_coop); -+BFQ_BFQQ_FNS(softrt_update); -+#undef BFQ_BFQQ_FNS -+ -+/* Logging facilities. */ -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+static struct bfq_group *bfqq_group(struct bfq_queue *bfqq); -+static struct blkcg_gq *bfqg_to_blkg(struct bfq_group *bfqg); -+ -+#define bfq_log_bfqq(bfqd, bfqq, fmt, args...) do { \ -+ char __pbuf[128]; \ -+ \ -+ assert_spin_locked((bfqd)->queue->queue_lock); \ -+ blkg_path(bfqg_to_blkg(bfqq_group(bfqq)), __pbuf, sizeof(__pbuf)); \ -+ blk_add_trace_msg((bfqd)->queue, "bfq%d%c %s " fmt, \ -+ (bfqq)->pid, \ -+ bfq_bfqq_sync((bfqq)) ? 'S' : 'A', \ -+ __pbuf, ##args); \ -+} while (0) -+ -+#define bfq_log_bfqg(bfqd, bfqg, fmt, args...) do { \ -+ char __pbuf[128]; \ -+ \ -+ blkg_path(bfqg_to_blkg(bfqg), __pbuf, sizeof(__pbuf)); \ -+ blk_add_trace_msg((bfqd)->queue, "%s " fmt, __pbuf, ##args); \ -+} while (0) -+ -+#else /* CONFIG_BFQ_GROUP_IOSCHED */ -+ -+#define bfq_log_bfqq(bfqd, bfqq, fmt, args...) \ -+ blk_add_trace_msg((bfqd)->queue, "bfq%d%c " fmt, (bfqq)->pid, \ -+ bfq_bfqq_sync((bfqq)) ? 'S' : 'A', \ -+ ##args) -+#define bfq_log_bfqg(bfqd, bfqg, fmt, args...) do {} while (0) -+ -+#endif /* CONFIG_BFQ_GROUP_IOSCHED */ -+ -+#define bfq_log(bfqd, fmt, args...) \ -+ blk_add_trace_msg((bfqd)->queue, "bfq " fmt, ##args) -+ -+/* Expiration reasons. */ -+enum bfqq_expiration { -+ BFQ_BFQQ_TOO_IDLE = 0, /* -+ * queue has been idling for -+ * too long -+ */ -+ BFQ_BFQQ_BUDGET_TIMEOUT, /* budget took too long to be used */ -+ BFQ_BFQQ_BUDGET_EXHAUSTED, /* budget consumed */ -+ BFQ_BFQQ_NO_MORE_REQUESTS, /* the queue has no more requests */ -+ BFQ_BFQQ_PREEMPTED /* preemption in progress */ -+}; -+ -+ -+struct bfqg_stats { -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ /* number of ios merged */ -+ struct blkg_rwstat merged; -+ /* total time spent on device in ns, may not be accurate w/ queueing */ -+ struct blkg_rwstat service_time; -+ /* total time spent waiting in scheduler queue in ns */ -+ struct blkg_rwstat wait_time; -+ /* number of IOs queued up */ -+ struct blkg_rwstat queued; -+ /* total disk time and nr sectors dispatched by this group */ -+ struct blkg_stat time; -+ /* sum of number of ios queued across all samples */ -+ struct blkg_stat avg_queue_size_sum; -+ /* count of samples taken for average */ -+ struct blkg_stat avg_queue_size_samples; -+ /* how many times this group has been removed from service tree */ -+ struct blkg_stat dequeue; -+ /* total time spent waiting for it to be assigned a timeslice. */ -+ struct blkg_stat group_wait_time; -+ /* time spent idling for this blkcg_gq */ -+ struct blkg_stat idle_time; -+ /* total time with empty current active q with other requests queued */ -+ struct blkg_stat empty_time; -+ /* fields after this shouldn't be cleared on stat reset */ -+ uint64_t start_group_wait_time; -+ uint64_t start_idle_time; -+ uint64_t start_empty_time; -+ uint16_t flags; -+#endif -+}; -+ -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+/* -+ * struct bfq_group_data - per-blkcg storage for the blkio subsystem. -+ * -+ * @ps: @blkcg_policy_storage that this structure inherits -+ * @weight: weight of the bfq_group -+ */ -+struct bfq_group_data { -+ /* must be the first member */ -+ struct blkcg_policy_data pd; -+ -+ unsigned int weight; -+}; -+ -+/** -+ * struct bfq_group - per (device, cgroup) data structure. -+ * @entity: schedulable entity to insert into the parent group sched_data. -+ * @sched_data: own sched_data, to contain child entities (they may be -+ * both bfq_queues and bfq_groups). -+ * @bfqd: the bfq_data for the device this group acts upon. -+ * @async_bfqq: array of async queues for all the tasks belonging to -+ * the group, one queue per ioprio value per ioprio_class, -+ * except for the idle class that has only one queue. -+ * @async_idle_bfqq: async queue for the idle class (ioprio is ignored). -+ * @my_entity: pointer to @entity, %NULL for the toplevel group; used -+ * to avoid too many special cases during group creation/ -+ * migration. -+ * @active_entities: number of active entities belonging to the group; -+ * unused for the root group. Used to know whether there -+ * are groups with more than one active @bfq_entity -+ * (see the comments to the function -+ * bfq_bfqq_may_idle()). -+ * @rq_pos_tree: rbtree sorted by next_request position, used when -+ * determining if two or more queues have interleaving -+ * requests (see bfq_find_close_cooperator()). -+ * -+ * Each (device, cgroup) pair has its own bfq_group, i.e., for each cgroup -+ * there is a set of bfq_groups, each one collecting the lower-level -+ * entities belonging to the group that are acting on the same device. -+ * -+ * Locking works as follows: -+ * o @bfqd is protected by the queue lock, RCU is used to access it -+ * from the readers. -+ * o All the other fields are protected by the @bfqd queue lock. -+ */ -+struct bfq_group { -+ /* must be the first member */ -+ struct blkg_policy_data pd; -+ -+ struct bfq_entity entity; -+ struct bfq_sched_data sched_data; -+ -+ void *bfqd; -+ -+ struct bfq_queue *async_bfqq[2][IOPRIO_BE_NR]; -+ struct bfq_queue *async_idle_bfqq; -+ -+ struct bfq_entity *my_entity; -+ -+ int active_entities; -+ -+ struct rb_root rq_pos_tree; -+ -+ struct bfqg_stats stats; -+}; -+ -+#else -+struct bfq_group { -+ struct bfq_sched_data sched_data; -+ -+ struct bfq_queue *async_bfqq[2][IOPRIO_BE_NR]; -+ struct bfq_queue *async_idle_bfqq; -+ -+ struct rb_root rq_pos_tree; -+}; -+#endif -+ -+static struct bfq_queue *bfq_entity_to_bfqq(struct bfq_entity *entity); -+ -+static struct bfq_service_tree * -+bfq_entity_service_tree(struct bfq_entity *entity) -+{ -+ struct bfq_sched_data *sched_data = entity->sched_data; -+ struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); -+ unsigned int idx = bfqq ? bfqq->ioprio_class - 1 : -+ BFQ_DEFAULT_GRP_CLASS - 1; -+ -+ BUG_ON(idx >= BFQ_IOPRIO_CLASSES); -+ BUG_ON(sched_data == NULL); -+ -+ if (bfqq) -+ bfq_log_bfqq(bfqq->bfqd, bfqq, -+ "entity_service_tree %p %d", -+ sched_data->service_tree + idx, idx); -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ else { -+ struct bfq_group *bfqg = -+ container_of(entity, struct bfq_group, entity); -+ -+ bfq_log_bfqg((struct bfq_data *)bfqg->bfqd, bfqg, -+ "entity_service_tree %p %d", -+ sched_data->service_tree + idx, idx); -+ } -+#endif -+ return sched_data->service_tree + idx; -+} -+ -+static struct bfq_queue *bic_to_bfqq(struct bfq_io_cq *bic, bool is_sync) -+{ -+ return bic->bfqq[is_sync]; -+} -+ -+static void bic_set_bfqq(struct bfq_io_cq *bic, struct bfq_queue *bfqq, -+ bool is_sync) -+{ -+ bic->bfqq[is_sync] = bfqq; -+} -+ -+static struct bfq_data *bic_to_bfqd(struct bfq_io_cq *bic) -+{ -+ return bic->icq.q->elevator->elevator_data; -+} -+ -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ -+static struct bfq_group *bfq_bfqq_to_bfqg(struct bfq_queue *bfqq) -+{ -+ struct bfq_entity *group_entity = bfqq->entity.parent; -+ -+ if (!group_entity) -+ group_entity = &bfqq->bfqd->root_group->entity; -+ -+ return container_of(group_entity, struct bfq_group, entity); -+} -+ -+#else -+ -+static struct bfq_group *bfq_bfqq_to_bfqg(struct bfq_queue *bfqq) -+{ -+ return bfqq->bfqd->root_group; -+} -+ -+#endif -+ -+static void bfq_check_ioprio_change(struct bfq_io_cq *bic, struct bio *bio); -+static void bfq_put_queue(struct bfq_queue *bfqq); -+static void bfq_dispatch_insert(struct request_queue *q, struct request *rq); -+static struct bfq_queue *bfq_get_queue(struct bfq_data *bfqd, -+ struct bio *bio, bool is_sync, -+ struct bfq_io_cq *bic); -+static void bfq_end_wr_async_queues(struct bfq_data *bfqd, -+ struct bfq_group *bfqg); -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+static void bfq_put_async_queues(struct bfq_data *bfqd, struct bfq_group *bfqg); -+#endif -+static void bfq_exit_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq); -+ -+#endif /* _BFQ_H */ -diff -w -uNr '--exclude=.git' linux-4.8/block/bfq-ioc.c linux-4.8-bfq/block/bfq-ioc.c ---- linux-4.8/block/bfq-ioc.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-4.8-bfq/block/bfq-ioc.c 2016-10-18 12:57:57.691164881 +0200 -@@ -0,0 +1,36 @@ -+/* -+ * BFQ: I/O context handling. -+ * -+ * Based on ideas and code from CFQ: -+ * Copyright (C) 2003 Jens Axboe -+ * -+ * Copyright (C) 2008 Fabio Checconi -+ * Paolo Valente -+ * -+ * Copyright (C) 2010 Paolo Valente -+ */ -+ -+/** -+ * icq_to_bic - convert iocontext queue structure to bfq_io_cq. -+ * @icq: the iocontext queue. -+ */ -+static struct bfq_io_cq *icq_to_bic(struct io_cq *icq) -+{ -+ /* bic->icq is the first member, %NULL will convert to %NULL */ -+ return container_of(icq, struct bfq_io_cq, icq); -+} -+ -+/** -+ * bfq_bic_lookup - search into @ioc a bic associated to @bfqd. -+ * @bfqd: the lookup key. -+ * @ioc: the io_context of the process doing I/O. -+ * -+ * Queue lock must be held. -+ */ -+static struct bfq_io_cq *bfq_bic_lookup(struct bfq_data *bfqd, -+ struct io_context *ioc) -+{ -+ if (ioc) -+ return icq_to_bic(ioc_lookup_icq(ioc, bfqd->queue)); -+ return NULL; -+} -diff -w -uNr '--exclude=.git' linux-4.8/block/bfq-iosched.c linux-4.8-bfq/block/bfq-iosched.c ---- linux-4.8/block/bfq-iosched.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-4.8-bfq/block/bfq-iosched.c 2016-10-18 12:57:57.691164881 +0200 -@@ -0,0 +1,5288 @@ -+/* -+ * Budget Fair Queueing (BFQ) disk scheduler. -+ * -+ * Based on ideas and code from CFQ: -+ * Copyright (C) 2003 Jens Axboe -+ * -+ * Copyright (C) 2008 Fabio Checconi -+ * Paolo Valente -+ * -+ * Copyright (C) 2015 Paolo Valente -+ * -+ * Copyright (C) 2016 Paolo Valente -+ * -+ * Licensed under the GPL-2 as detailed in the accompanying COPYING.BFQ -+ * file. -+ * -+ * BFQ is a proportional-share storage-I/O scheduling algorithm based -+ * on the slice-by-slice service scheme of CFQ. But BFQ assigns -+ * budgets, measured in number of sectors, to processes instead of -+ * time slices. The device is not granted to the in-service process -+ * for a given time slice, but until it has exhausted its assigned -+ * budget. This change from the time to the service domain enables BFQ -+ * to distribute the device throughput among processes as desired, -+ * without any distortion due to throughput fluctuations, or to device -+ * internal queueing. BFQ uses an ad hoc internal scheduler, called -+ * B-WF2Q+, to schedule processes according to their budgets. More -+ * precisely, BFQ schedules queues associated with processes. Thanks to -+ * the accurate policy of B-WF2Q+, BFQ can afford to assign high -+ * budgets to I/O-bound processes issuing sequential requests (to -+ * boost the throughput), and yet guarantee a low latency to -+ * interactive and soft real-time applications. -+ * -+ * BFQ is described in [1], where also a reference to the initial, more -+ * theoretical paper on BFQ can be found. The interested reader can find -+ * in the latter paper full details on the main algorithm, as well as -+ * formulas of the guarantees and formal proofs of all the properties. -+ * With respect to the version of BFQ presented in these papers, this -+ * implementation adds a few more heuristics, such as the one that -+ * guarantees a low latency to soft real-time applications, and a -+ * hierarchical extension based on H-WF2Q+. -+ * -+ * B-WF2Q+ is based on WF2Q+, that is described in [2], together with -+ * H-WF2Q+, while the augmented tree used to implement B-WF2Q+ with O(log N) -+ * complexity derives from the one introduced with EEVDF in [3]. -+ * -+ * [1] P. Valente and M. Andreolini, ``Improving Application Responsiveness -+ * with the BFQ Disk I/O Scheduler'', -+ * Proceedings of the 5th Annual International Systems and Storage -+ * Conference (SYSTOR '12), June 2012. -+ * -+ * http://algogroup.unimo.it/people/paolo/disk_sched/bf1-v1-suite-results.pdf -+ * -+ * [2] Jon C.R. Bennett and H. Zhang, ``Hierarchical Packet Fair Queueing -+ * Algorithms,'' IEEE/ACM Transactions on Networking, 5(5):675-689, -+ * Oct 1997. -+ * -+ * http://www.cs.cmu.edu/~hzhang/papers/TON-97-Oct.ps.gz -+ * -+ * [3] I. Stoica and H. Abdel-Wahab, ``Earliest Eligible Virtual Deadline -+ * First: A Flexible and Accurate Mechanism for Proportional Share -+ * Resource Allocation,'' technical report. -+ * -+ * http://www.cs.berkeley.edu/~istoica/papers/eevdf-tr-95.pdf -+ */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "bfq.h" -+#include "blk.h" -+ -+/* Expiration time of sync (0) and async (1) requests, in ns. */ -+static const u64 bfq_fifo_expire[2] = { NSEC_PER_SEC / 4, NSEC_PER_SEC / 8 }; -+ -+/* Maximum backwards seek, in KiB. */ -+static const int bfq_back_max = 16 * 1024; -+ -+/* Penalty of a backwards seek, in number of sectors. */ -+static const int bfq_back_penalty = 2; -+ -+/* Idling period duration, in ns. */ -+static u32 bfq_slice_idle = NSEC_PER_SEC / 125; -+ -+/* Minimum number of assigned budgets for which stats are safe to compute. */ -+static const int bfq_stats_min_budgets = 194; -+ -+/* Default maximum budget values, in sectors and number of requests. */ -+static const int bfq_default_max_budget = 16 * 1024; -+ -+/* -+ * Async to sync throughput distribution is controlled as follows: -+ * when an async request is served, the entity is charged the number -+ * of sectors of the request, multiplied by the factor below -+ */ -+static const int bfq_async_charge_factor = 10; -+ -+/* Default timeout values, in jiffies, approximating CFQ defaults. */ -+static const int bfq_timeout = HZ / 8; -+ -+struct kmem_cache *bfq_pool; -+ -+/* Below this threshold (in ns), we consider thinktime immediate. */ -+#define BFQ_MIN_TT (2 * NSEC_PER_MSEC) -+ -+/* hw_tag detection: parallel requests threshold and min samples needed. */ -+#define BFQ_HW_QUEUE_THRESHOLD 4 -+#define BFQ_HW_QUEUE_SAMPLES 32 -+ -+#define BFQQ_SEEK_THR (sector_t)(8 * 100) -+#define BFQQ_CLOSE_THR (sector_t)(8 * 1024) -+#define BFQQ_SEEKY(bfqq) (hweight32(bfqq->seek_history) > 32/8) -+ -+/* Min number of samples required to perform peak-rate update */ -+#define BFQ_RATE_MIN_SAMPLES 32 -+/* Min observation time interval required to perform a peak-rate update (ns) */ -+#define BFQ_RATE_MIN_INTERVAL 300*NSEC_PER_MSEC -+/* Target observation time interval for a peak-rate update (ns) */ -+#define BFQ_RATE_REF_INTERVAL NSEC_PER_SEC -+ -+/* Shift used for peak rate fixed precision calculations. */ -+#define BFQ_RATE_SHIFT 16 -+ -+/* -+ * By default, BFQ computes the duration of the weight raising for -+ * interactive applications automatically, using the following formula: -+ * duration = (R / r) * T, where r is the peak rate of the device, and -+ * R and T are two reference parameters. -+ * In particular, R is the peak rate of the reference device (see below), -+ * and T is a reference time: given the systems that are likely to be -+ * installed on the reference device according to its speed class, T is -+ * about the maximum time needed, under BFQ and while reading two files in -+ * parallel, to load typical large applications on these systems. -+ * In practice, the slower/faster the device at hand is, the more/less it -+ * takes to load applications with respect to the reference device. -+ * Accordingly, the longer/shorter BFQ grants weight raising to interactive -+ * applications. -+ * -+ * BFQ uses four different reference pairs (R, T), depending on: -+ * . whether the device is rotational or non-rotational; -+ * . whether the device is slow, such as old or portable HDDs, as well as -+ * SD cards, or fast, such as newer HDDs and SSDs. -+ * -+ * The device's speed class is dynamically (re)detected in -+ * bfq_update_peak_rate() every time the estimated peak rate is updated. -+ * -+ * In the following definitions, R_slow[0]/R_fast[0] and -+ * T_slow[0]/T_fast[0] are the reference values for a slow/fast -+ * rotational device, whereas R_slow[1]/R_fast[1] and -+ * T_slow[1]/T_fast[1] are the reference values for a slow/fast -+ * non-rotational device. Finally, device_speed_thresh are the -+ * thresholds used to switch between speed classes. The reference -+ * rates are not the actual peak rates of the devices used as a -+ * reference, but slightly lower values. The reason for using these -+ * slightly lower values is that the peak-rate estimator tends to -+ * yield slightly lower values than the actual peak rate (it can yield -+ * the actual peak rate only if there is only one process doing I/O, -+ * and the process does sequential I/O). -+ * -+ * Both the reference peak rates and the thresholds are measured in -+ * sectors/usec, left-shifted by BFQ_RATE_SHIFT. -+ */ -+static int R_slow[2] = {1000, 10700}; -+static int R_fast[2] = {14000, 33000}; -+/* -+ * To improve readability, a conversion function is used to initialize the -+ * following arrays, which entails that they can be initialized only in a -+ * function. -+ */ -+static int T_slow[2]; -+static int T_fast[2]; -+static int device_speed_thresh[2]; -+ -+#define BFQ_SERVICE_TREE_INIT ((struct bfq_service_tree) \ -+ { RB_ROOT, RB_ROOT, NULL, NULL, 0, 0 }) -+ -+#define RQ_BIC(rq) ((struct bfq_io_cq *) (rq)->elv.priv[0]) -+#define RQ_BFQQ(rq) ((rq)->elv.priv[1]) -+ -+static void bfq_schedule_dispatch(struct bfq_data *bfqd); -+ -+#include "bfq-ioc.c" -+#include "bfq-sched.c" -+#include "bfq-cgroup.c" -+ -+#define bfq_class_idle(bfqq) ((bfqq)->ioprio_class == IOPRIO_CLASS_IDLE) -+#define bfq_class_rt(bfqq) ((bfqq)->ioprio_class == IOPRIO_CLASS_RT) -+ -+#define bfq_sample_valid(samples) ((samples) > 80) -+ -+/* -+ * We regard a request as SYNC, if either it's a read or has the SYNC bit -+ * set (in which case it could also be a direct WRITE). -+ */ -+static int bfq_bio_sync(struct bio *bio) -+{ -+ return bio_data_dir(bio) == READ || (bio->bi_opf & REQ_SYNC); -+} -+ -+/* -+ * Scheduler run of queue, if there are requests pending and no one in the -+ * driver that will restart queueing. -+ */ -+static void bfq_schedule_dispatch(struct bfq_data *bfqd) -+{ -+ if (bfqd->queued != 0) { -+ bfq_log(bfqd, "schedule dispatch"); -+ kblockd_schedule_work(&bfqd->unplug_work); -+ } -+} -+ -+/* -+ * Lifted from AS - choose which of rq1 and rq2 that is best served now. -+ * We choose the request that is closesr to the head right now. Distance -+ * behind the head is penalized and only allowed to a certain extent. -+ */ -+static struct request *bfq_choose_req(struct bfq_data *bfqd, -+ struct request *rq1, -+ struct request *rq2, -+ sector_t last) -+{ -+ sector_t s1, s2, d1 = 0, d2 = 0; -+ unsigned long back_max; -+#define BFQ_RQ1_WRAP 0x01 /* request 1 wraps */ -+#define BFQ_RQ2_WRAP 0x02 /* request 2 wraps */ -+ unsigned int wrap = 0; /* bit mask: requests behind the disk head? */ -+ -+ if (!rq1 || rq1 == rq2) -+ return rq2; -+ if (!rq2) -+ return rq1; -+ -+ if (rq_is_sync(rq1) && !rq_is_sync(rq2)) -+ return rq1; -+ else if (rq_is_sync(rq2) && !rq_is_sync(rq1)) -+ return rq2; -+ if ((rq1->cmd_flags & REQ_META) && !(rq2->cmd_flags & REQ_META)) -+ return rq1; -+ else if ((rq2->cmd_flags & REQ_META) && !(rq1->cmd_flags & REQ_META)) -+ return rq2; -+ -+ s1 = blk_rq_pos(rq1); -+ s2 = blk_rq_pos(rq2); -+ -+ /* -+ * By definition, 1KiB is 2 sectors. -+ */ -+ back_max = bfqd->bfq_back_max * 2; -+ -+ /* -+ * Strict one way elevator _except_ in the case where we allow -+ * short backward seeks which are biased as twice the cost of a -+ * similar forward seek. -+ */ -+ if (s1 >= last) -+ d1 = s1 - last; -+ else if (s1 + back_max >= last) -+ d1 = (last - s1) * bfqd->bfq_back_penalty; -+ else -+ wrap |= BFQ_RQ1_WRAP; -+ -+ if (s2 >= last) -+ d2 = s2 - last; -+ else if (s2 + back_max >= last) -+ d2 = (last - s2) * bfqd->bfq_back_penalty; -+ else -+ wrap |= BFQ_RQ2_WRAP; -+ -+ /* Found required data */ -+ -+ /* -+ * By doing switch() on the bit mask "wrap" we avoid having to -+ * check two variables for all permutations: --> faster! -+ */ -+ switch (wrap) { -+ case 0: /* common case for CFQ: rq1 and rq2 not wrapped */ -+ if (d1 < d2) -+ return rq1; -+ else if (d2 < d1) -+ return rq2; -+ -+ if (s1 >= s2) -+ return rq1; -+ else -+ return rq2; -+ -+ case BFQ_RQ2_WRAP: -+ return rq1; -+ case BFQ_RQ1_WRAP: -+ return rq2; -+ case (BFQ_RQ1_WRAP|BFQ_RQ2_WRAP): /* both rqs wrapped */ -+ default: -+ /* -+ * Since both rqs are wrapped, -+ * start with the one that's further behind head -+ * (--> only *one* back seek required), -+ * since back seek takes more time than forward. -+ */ -+ if (s1 <= s2) -+ return rq1; -+ else -+ return rq2; -+ } -+} -+ -+static struct bfq_queue * -+bfq_rq_pos_tree_lookup(struct bfq_data *bfqd, struct rb_root *root, -+ sector_t sector, struct rb_node **ret_parent, -+ struct rb_node ***rb_link) -+{ -+ struct rb_node **p, *parent; -+ struct bfq_queue *bfqq = NULL; -+ -+ parent = NULL; -+ p = &root->rb_node; -+ while (*p) { -+ struct rb_node **n; -+ -+ parent = *p; -+ bfqq = rb_entry(parent, struct bfq_queue, pos_node); -+ -+ /* -+ * Sort strictly based on sector. Smallest to the left, -+ * largest to the right. -+ */ -+ if (sector > blk_rq_pos(bfqq->next_rq)) -+ n = &(*p)->rb_right; -+ else if (sector < blk_rq_pos(bfqq->next_rq)) -+ n = &(*p)->rb_left; -+ else -+ break; -+ p = n; -+ bfqq = NULL; -+ } -+ -+ *ret_parent = parent; -+ if (rb_link) -+ *rb_link = p; -+ -+ bfq_log(bfqd, "rq_pos_tree_lookup %llu: returning %d", -+ (unsigned long long) sector, -+ bfqq ? bfqq->pid : 0); -+ -+ return bfqq; -+} -+ -+static void bfq_pos_tree_add_move(struct bfq_data *bfqd, struct bfq_queue *bfqq) -+{ -+ struct rb_node **p, *parent; -+ struct bfq_queue *__bfqq; -+ -+ if (bfqq->pos_root) { -+ rb_erase(&bfqq->pos_node, bfqq->pos_root); -+ bfqq->pos_root = NULL; -+ } -+ -+ if (bfq_class_idle(bfqq)) -+ return; -+ if (!bfqq->next_rq) -+ return; -+ -+ bfqq->pos_root = &bfq_bfqq_to_bfqg(bfqq)->rq_pos_tree; -+ __bfqq = bfq_rq_pos_tree_lookup(bfqd, bfqq->pos_root, -+ blk_rq_pos(bfqq->next_rq), &parent, &p); -+ if (!__bfqq) { -+ rb_link_node(&bfqq->pos_node, parent, p); -+ rb_insert_color(&bfqq->pos_node, bfqq->pos_root); -+ } else -+ bfqq->pos_root = NULL; -+} -+ -+/* -+ * Tell whether there are active queues or groups with differentiated weights. -+ */ -+static bool bfq_differentiated_weights(struct bfq_data *bfqd) -+{ -+ /* -+ * For weights to differ, at least one of the trees must contain -+ * at least two nodes. -+ */ -+ return (!RB_EMPTY_ROOT(&bfqd->queue_weights_tree) && -+ (bfqd->queue_weights_tree.rb_node->rb_left || -+ bfqd->queue_weights_tree.rb_node->rb_right) -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ ) || -+ (!RB_EMPTY_ROOT(&bfqd->group_weights_tree) && -+ (bfqd->group_weights_tree.rb_node->rb_left || -+ bfqd->group_weights_tree.rb_node->rb_right) -+#endif -+ ); -+} -+ -+/* -+ * The following function returns true if every queue must receive the -+ * same share of the throughput (this condition is used when deciding -+ * whether idling may be disabled, see the comments in the function -+ * bfq_bfqq_may_idle()). -+ * -+ * Such a scenario occurs when: -+ * 1) all active queues have the same weight, -+ * 2) all active groups at the same level in the groups tree have the same -+ * weight, -+ * 3) all active groups at the same level in the groups tree have the same -+ * number of children. -+ * -+ * Unfortunately, keeping the necessary state for evaluating exactly the -+ * above symmetry conditions would be quite complex and time-consuming. -+ * Therefore this function evaluates, instead, the following stronger -+ * sub-conditions, for which it is much easier to maintain the needed -+ * state: -+ * 1) all active queues have the same weight, -+ * 2) all active groups have the same weight, -+ * 3) all active groups have at most one active child each. -+ * In particular, the last two conditions are always true if hierarchical -+ * support and the cgroups interface are not enabled, thus no state needs -+ * to be maintained in this case. -+ */ -+static bool bfq_symmetric_scenario(struct bfq_data *bfqd) -+{ -+ return !bfq_differentiated_weights(bfqd); -+} -+ -+/* -+ * If the weight-counter tree passed as input contains no counter for -+ * the weight of the input entity, then add that counter; otherwise just -+ * increment the existing counter. -+ * -+ * Note that weight-counter trees contain few nodes in mostly symmetric -+ * scenarios. For example, if all queues have the same weight, then the -+ * weight-counter tree for the queues may contain at most one node. -+ * This holds even if low_latency is on, because weight-raised queues -+ * are not inserted in the tree. -+ * In most scenarios, the rate at which nodes are created/destroyed -+ * should be low too. -+ */ -+static void bfq_weights_tree_add(struct bfq_data *bfqd, -+ struct bfq_entity *entity, -+ struct rb_root *root) -+{ -+ struct rb_node **new = &(root->rb_node), *parent = NULL; -+ -+ /* -+ * Do not insert if the entity is already associated with a -+ * counter, which happens if: -+ * 1) the entity is associated with a queue, -+ * 2) a request arrival has caused the queue to become both -+ * non-weight-raised, and hence change its weight, and -+ * backlogged; in this respect, each of the two events -+ * causes an invocation of this function, -+ * 3) this is the invocation of this function caused by the -+ * second event. This second invocation is actually useless, -+ * and we handle this fact by exiting immediately. More -+ * efficient or clearer solutions might possibly be adopted. -+ */ -+ if (entity->weight_counter) -+ return; -+ -+ while (*new) { -+ struct bfq_weight_counter *__counter = container_of(*new, -+ struct bfq_weight_counter, -+ weights_node); -+ parent = *new; -+ -+ if (entity->weight == __counter->weight) { -+ entity->weight_counter = __counter; -+ goto inc_counter; -+ } -+ if (entity->weight < __counter->weight) -+ new = &((*new)->rb_left); -+ else -+ new = &((*new)->rb_right); -+ } -+ -+ entity->weight_counter = kzalloc(sizeof(struct bfq_weight_counter), -+ GFP_ATOMIC); -+ entity->weight_counter->weight = entity->weight; -+ rb_link_node(&entity->weight_counter->weights_node, parent, new); -+ rb_insert_color(&entity->weight_counter->weights_node, root); -+ -+inc_counter: -+ entity->weight_counter->num_active++; -+} -+ -+/* -+ * Decrement the weight counter associated with the entity, and, if the -+ * counter reaches 0, remove the counter from the tree. -+ * See the comments to the function bfq_weights_tree_add() for considerations -+ * about overhead. -+ */ -+static void bfq_weights_tree_remove(struct bfq_data *bfqd, -+ struct bfq_entity *entity, -+ struct rb_root *root) -+{ -+ if (!entity->weight_counter) -+ return; -+ -+ BUG_ON(RB_EMPTY_ROOT(root)); -+ BUG_ON(entity->weight_counter->weight != entity->weight); -+ -+ BUG_ON(!entity->weight_counter->num_active); -+ entity->weight_counter->num_active--; -+ if (entity->weight_counter->num_active > 0) -+ goto reset_entity_pointer; -+ -+ rb_erase(&entity->weight_counter->weights_node, root); -+ kfree(entity->weight_counter); -+ -+reset_entity_pointer: -+ entity->weight_counter = NULL; -+} -+ -+static struct request *bfq_find_next_rq(struct bfq_data *bfqd, -+ struct bfq_queue *bfqq, -+ struct request *last) -+{ -+ struct rb_node *rbnext = rb_next(&last->rb_node); -+ struct rb_node *rbprev = rb_prev(&last->rb_node); -+ struct request *next = NULL, *prev = NULL; -+ -+ BUG_ON(RB_EMPTY_NODE(&last->rb_node)); -+ -+ if (rbprev) -+ prev = rb_entry_rq(rbprev); -+ -+ if (rbnext) -+ next = rb_entry_rq(rbnext); -+ else { -+ rbnext = rb_first(&bfqq->sort_list); -+ if (rbnext && rbnext != &last->rb_node) -+ next = rb_entry_rq(rbnext); -+ } -+ -+ return bfq_choose_req(bfqd, next, prev, blk_rq_pos(last)); -+} -+ -+/* see the definition of bfq_async_charge_factor for details */ -+static unsigned long bfq_serv_to_charge(struct request *rq, -+ struct bfq_queue *bfqq) -+{ -+ if (bfq_bfqq_sync(bfqq) || bfqq->wr_coeff > 1) -+ return blk_rq_sectors(rq); -+ -+ /* -+ * If there are no weight-raised queues, then amplify service -+ * by just the async charge factor; otherwise amplify service -+ * by twice the async charge factor, to further reduce latency -+ * for weight-raised queues. -+ */ -+ if (bfqq->bfqd->wr_busy_queues == 0) -+ return blk_rq_sectors(rq) * bfq_async_charge_factor; -+ -+ return blk_rq_sectors(rq) * 2 * bfq_async_charge_factor; -+} -+ -+/** -+ * bfq_updated_next_req - update the queue after a new next_rq selection. -+ * @bfqd: the device data the queue belongs to. -+ * @bfqq: the queue to update. -+ * -+ * If the first request of a queue changes we make sure that the queue -+ * has enough budget to serve at least its first request (if the -+ * request has grown). We do this because if the queue has not enough -+ * budget for its first request, it has to go through two dispatch -+ * rounds to actually get it dispatched. -+ */ -+static void bfq_updated_next_req(struct bfq_data *bfqd, -+ struct bfq_queue *bfqq) -+{ -+ struct bfq_entity *entity = &bfqq->entity; -+ struct bfq_service_tree *st = bfq_entity_service_tree(entity); -+ struct request *next_rq = bfqq->next_rq; -+ unsigned long new_budget; -+ -+ if (!next_rq) -+ return; -+ -+ if (bfqq == bfqd->in_service_queue) -+ /* -+ * In order not to break guarantees, budgets cannot be -+ * changed after an entity has been selected. -+ */ -+ return; -+ -+ BUG_ON(entity->tree != &st->active); -+ BUG_ON(entity == entity->sched_data->in_service_entity); -+ -+ new_budget = max_t(unsigned long, bfqq->max_budget, -+ bfq_serv_to_charge(next_rq, bfqq)); -+ if (entity->budget != new_budget) { -+ entity->budget = new_budget; -+ bfq_log_bfqq(bfqd, bfqq, "updated next rq: new budget %lu", -+ new_budget); -+ bfq_activate_bfqq(bfqd, bfqq); -+ } -+} -+ -+static unsigned int bfq_wr_duration(struct bfq_data *bfqd) -+{ -+ u64 dur; -+ -+ if (bfqd->bfq_wr_max_time > 0) -+ return bfqd->bfq_wr_max_time; -+ -+ dur = bfqd->RT_prod; -+ do_div(dur, bfqd->peak_rate); -+ -+ /* -+ * Limit duration between 3 and 13 seconds. Tests show that -+ * higher values than 13 seconds often yield the opposite of -+ * the desired result, i.e., worsen responsiveness by letting -+ * non-interactive and non-soft-real-time applications -+ * preserve weight raising for a too long time interval. -+ * -+ * On the other end, lower values than 3 seconds make it -+ * difficult for most interactive tasks to complete their jobs -+ * before weight-raising finishes. -+ */ -+ if (dur > msecs_to_jiffies(13000)) -+ dur = msecs_to_jiffies(13000); -+ else if (dur < msecs_to_jiffies(3000)) -+ dur = msecs_to_jiffies(3000); -+ -+ return dur; -+} -+ -+static void -+bfq_bfqq_resume_state(struct bfq_queue *bfqq, struct bfq_io_cq *bic) -+{ -+ if (bic->saved_idle_window) -+ bfq_mark_bfqq_idle_window(bfqq); -+ else -+ bfq_clear_bfqq_idle_window(bfqq); -+ -+ if (bic->saved_IO_bound) -+ bfq_mark_bfqq_IO_bound(bfqq); -+ else -+ bfq_clear_bfqq_IO_bound(bfqq); -+ -+ bfqq->wr_coeff = bic->saved_wr_coeff; -+ bfqq->wr_start_at_switch_to_srt = bic->saved_wr_start_at_switch_to_srt; -+ BUG_ON(time_is_after_jiffies(bfqq->wr_start_at_switch_to_srt)); -+ bfqq->last_wr_start_finish = bic->saved_last_wr_start_finish; -+ BUG_ON(time_is_after_jiffies(bfqq->last_wr_start_finish)); -+ -+ if (bfqq->wr_coeff > 1 && (bfq_bfqq_in_large_burst(bfqq) || -+ time_is_before_jiffies(bfqq->last_wr_start_finish + -+ bfqq->wr_cur_max_time))) { -+ bfq_log_bfqq(bfqq->bfqd, bfqq, -+ "resume state: switching off wr"); -+ -+ bfqq->wr_coeff = 1; -+ } -+ /* make sure weight will be updated, however we got here */ -+ bfqq->entity.prio_changed = 1; -+} -+ -+static int bfqq_process_refs(struct bfq_queue *bfqq) -+{ -+ int process_refs, io_refs; -+ -+ lockdep_assert_held(bfqq->bfqd->queue->queue_lock); -+ -+ io_refs = bfqq->allocated[READ] + bfqq->allocated[WRITE]; -+ process_refs = bfqq->ref - io_refs - bfqq->entity.on_st; -+ BUG_ON(process_refs < 0); -+ return process_refs; -+} -+ -+/* Empty burst list and add just bfqq (see comments to bfq_handle_burst) */ -+static void bfq_reset_burst_list(struct bfq_data *bfqd, struct bfq_queue *bfqq) -+{ -+ struct bfq_queue *item; -+ struct hlist_node *n; -+ -+ hlist_for_each_entry_safe(item, n, &bfqd->burst_list, burst_list_node) -+ hlist_del_init(&item->burst_list_node); -+ hlist_add_head(&bfqq->burst_list_node, &bfqd->burst_list); -+ bfqd->burst_size = 1; -+ bfqd->burst_parent_entity = bfqq->entity.parent; -+} -+ -+/* Add bfqq to the list of queues in current burst (see bfq_handle_burst) */ -+static void bfq_add_to_burst(struct bfq_data *bfqd, struct bfq_queue *bfqq) -+{ -+ /* Increment burst size to take into account also bfqq */ -+ bfqd->burst_size++; -+ -+ bfq_log_bfqq(bfqd, bfqq, "add_to_burst %d", bfqd->burst_size); -+ -+ BUG_ON(bfqd->burst_size > bfqd->bfq_large_burst_thresh); -+ -+ if (bfqd->burst_size == bfqd->bfq_large_burst_thresh) { -+ struct bfq_queue *pos, *bfqq_item; -+ struct hlist_node *n; -+ -+ /* -+ * Enough queues have been activated shortly after each -+ * other to consider this burst as large. -+ */ -+ bfqd->large_burst = true; -+ bfq_log_bfqq(bfqd, bfqq, "add_to_burst: large burst started"); -+ -+ /* -+ * We can now mark all queues in the burst list as -+ * belonging to a large burst. -+ */ -+ hlist_for_each_entry(bfqq_item, &bfqd->burst_list, -+ burst_list_node) { -+ bfq_mark_bfqq_in_large_burst(bfqq_item); -+ bfq_log_bfqq(bfqd, bfqq_item, "marked in large burst"); -+ } -+ bfq_mark_bfqq_in_large_burst(bfqq); -+ bfq_log_bfqq(bfqd, bfqq, "marked in large burst"); -+ -+ /* -+ * From now on, and until the current burst finishes, any -+ * new queue being activated shortly after the last queue -+ * was inserted in the burst can be immediately marked as -+ * belonging to a large burst. So the burst list is not -+ * needed any more. Remove it. -+ */ -+ hlist_for_each_entry_safe(pos, n, &bfqd->burst_list, -+ burst_list_node) -+ hlist_del_init(&pos->burst_list_node); -+ } else /* -+ * Burst not yet large: add bfqq to the burst list. Do -+ * not increment the ref counter for bfqq, because bfqq -+ * is removed from the burst list before freeing bfqq -+ * in put_queue. -+ */ -+ hlist_add_head(&bfqq->burst_list_node, &bfqd->burst_list); -+} -+ -+/* -+ * If many queues belonging to the same group happen to be created -+ * shortly after each other, then the processes associated with these -+ * queues have typically a common goal. In particular, bursts of queue -+ * creations are usually caused by services or applications that spawn -+ * many parallel threads/processes. Examples are systemd during boot, -+ * or git grep. To help these processes get their job done as soon as -+ * possible, it is usually better to not grant either weight-raising -+ * or device idling to their queues. -+ * -+ * In this comment we describe, firstly, the reasons why this fact -+ * holds, and, secondly, the next function, which implements the main -+ * steps needed to properly mark these queues so that they can then be -+ * treated in a different way. -+ * -+ * The above services or applications benefit mostly from a high -+ * throughput: the quicker the requests of the activated queues are -+ * cumulatively served, the sooner the target job of these queues gets -+ * completed. As a consequence, weight-raising any of these queues, -+ * which also implies idling the device for it, is almost always -+ * counterproductive. In most cases it just lowers throughput. -+ * -+ * On the other hand, a burst of queue creations may be caused also by -+ * the start of an application that does not consist of a lot of -+ * parallel I/O-bound threads. In fact, with a complex application, -+ * several short processes may need to be executed to start-up the -+ * application. In this respect, to start an application as quickly as -+ * possible, the best thing to do is in any case to privilege the I/O -+ * related to the application with respect to all other -+ * I/O. Therefore, the best strategy to start as quickly as possible -+ * an application that causes a burst of queue creations is to -+ * weight-raise all the queues created during the burst. This is the -+ * exact opposite of the best strategy for the other type of bursts. -+ * -+ * In the end, to take the best action for each of the two cases, the -+ * two types of bursts need to be distinguished. Fortunately, this -+ * seems relatively easy, by looking at the sizes of the bursts. In -+ * particular, we found a threshold such that only bursts with a -+ * larger size than that threshold are apparently caused by -+ * services or commands such as systemd or git grep. For brevity, -+ * hereafter we call just 'large' these bursts. BFQ *does not* -+ * weight-raise queues whose creation occurs in a large burst. In -+ * addition, for each of these queues BFQ performs or does not perform -+ * idling depending on which choice boosts the throughput more. The -+ * exact choice depends on the device and request pattern at -+ * hand. -+ * -+ * Unfortunately, false positives may occur while an interactive task -+ * is starting (e.g., an application is being started). The -+ * consequence is that the queues associated with the task do not -+ * enjoy weight raising as expected. Fortunately these false positives -+ * are very rare. They typically occur if some service happens to -+ * start doing I/O exactly when the interactive task starts. -+ * -+ * Turning back to the next function, it implements all the steps -+ * needed to detect the occurrence of a large burst and to properly -+ * mark all the queues belonging to it (so that they can then be -+ * treated in a different way). This goal is achieved by maintaining a -+ * "burst list" that holds, temporarily, the queues that belong to the -+ * burst in progress. The list is then used to mark these queues as -+ * belonging to a large burst if the burst does become large. The main -+ * steps are the following. -+ * -+ * . when the very first queue is created, the queue is inserted into the -+ * list (as it could be the first queue in a possible burst) -+ * -+ * . if the current burst has not yet become large, and a queue Q that does -+ * not yet belong to the burst is activated shortly after the last time -+ * at which a new queue entered the burst list, then the function appends -+ * Q to the burst list -+ * -+ * . if, as a consequence of the previous step, the burst size reaches -+ * the large-burst threshold, then -+ * -+ * . all the queues in the burst list are marked as belonging to a -+ * large burst -+ * -+ * . the burst list is deleted; in fact, the burst list already served -+ * its purpose (keeping temporarily track of the queues in a burst, -+ * so as to be able to mark them as belonging to a large burst in the -+ * previous sub-step), and now is not needed any more -+ * -+ * . the device enters a large-burst mode -+ * -+ * . if a queue Q that does not belong to the burst is created while -+ * the device is in large-burst mode and shortly after the last time -+ * at which a queue either entered the burst list or was marked as -+ * belonging to the current large burst, then Q is immediately marked -+ * as belonging to a large burst. -+ * -+ * . if a queue Q that does not belong to the burst is created a while -+ * later, i.e., not shortly after, than the last time at which a queue -+ * either entered the burst list or was marked as belonging to the -+ * current large burst, then the current burst is deemed as finished and: -+ * -+ * . the large-burst mode is reset if set -+ * -+ * . the burst list is emptied -+ * -+ * . Q is inserted in the burst list, as Q may be the first queue -+ * in a possible new burst (then the burst list contains just Q -+ * after this step). -+ */ -+static void bfq_handle_burst(struct bfq_data *bfqd, struct bfq_queue *bfqq) -+{ -+ /* -+ * If bfqq is already in the burst list or is part of a large -+ * burst, or finally has just been split, then there is -+ * nothing else to do. -+ */ -+ if (!hlist_unhashed(&bfqq->burst_list_node) || -+ bfq_bfqq_in_large_burst(bfqq) || -+ time_is_after_eq_jiffies(bfqq->split_time + -+ msecs_to_jiffies(10))) -+ return; -+ -+ /* -+ * If bfqq's creation happens late enough, or bfqq belongs to -+ * a different group than the burst group, then the current -+ * burst is finished, and related data structures must be -+ * reset. -+ * -+ * In this respect, consider the special case where bfqq is -+ * the very first queue created after BFQ is selected for this -+ * device. In this case, last_ins_in_burst and -+ * burst_parent_entity are not yet significant when we get -+ * here. But it is easy to verify that, whether or not the -+ * following condition is true, bfqq will end up being -+ * inserted into the burst list. In particular the list will -+ * happen to contain only bfqq. And this is exactly what has -+ * to happen, as bfqq may be the first queue of the first -+ * burst. -+ */ -+ if (time_is_before_jiffies(bfqd->last_ins_in_burst + -+ bfqd->bfq_burst_interval) || -+ bfqq->entity.parent != bfqd->burst_parent_entity) { -+ bfqd->large_burst = false; -+ bfq_reset_burst_list(bfqd, bfqq); -+ bfq_log_bfqq(bfqd, bfqq, -+ "handle_burst: late activation or different group"); -+ goto end; -+ } -+ -+ /* -+ * If we get here, then bfqq is being activated shortly after the -+ * last queue. So, if the current burst is also large, we can mark -+ * bfqq as belonging to this large burst immediately. -+ */ -+ if (bfqd->large_burst) { -+ bfq_log_bfqq(bfqd, bfqq, "handle_burst: marked in burst"); -+ bfq_mark_bfqq_in_large_burst(bfqq); -+ goto end; -+ } -+ -+ /* -+ * If we get here, then a large-burst state has not yet been -+ * reached, but bfqq is being activated shortly after the last -+ * queue. Then we add bfqq to the burst. -+ */ -+ bfq_add_to_burst(bfqd, bfqq); -+end: -+ /* -+ * At this point, bfqq either has been added to the current -+ * burst or has caused the current burst to terminate and a -+ * possible new burst to start. In particular, in the second -+ * case, bfqq has become the first queue in the possible new -+ * burst. In both cases last_ins_in_burst needs to be moved -+ * forward. -+ */ -+ bfqd->last_ins_in_burst = jiffies; -+ -+} -+ -+static int bfq_bfqq_budget_left(struct bfq_queue *bfqq) -+{ -+ struct bfq_entity *entity = &bfqq->entity; -+ -+ return entity->budget - entity->service; -+} -+ -+/* -+ * If enough samples have been computed, return the current max budget -+ * stored in bfqd, which is dynamically updated according to the -+ * estimated disk peak rate; otherwise return the default max budget -+ */ -+static int bfq_max_budget(struct bfq_data *bfqd) -+{ -+ if (bfqd->budgets_assigned < bfq_stats_min_budgets) -+ return bfq_default_max_budget; -+ else -+ return bfqd->bfq_max_budget; -+} -+ -+/* -+ * Return min budget, which is a fraction of the current or default -+ * max budget (trying with 1/32) -+ */ -+static int bfq_min_budget(struct bfq_data *bfqd) -+{ -+ if (bfqd->budgets_assigned < bfq_stats_min_budgets) -+ return bfq_default_max_budget / 32; -+ else -+ return bfqd->bfq_max_budget / 32; -+} -+ -+static void bfq_bfqq_expire(struct bfq_data *bfqd, -+ struct bfq_queue *bfqq, -+ bool compensate, -+ enum bfqq_expiration reason); -+ -+/* -+ * The next function, invoked after the input queue bfqq switches from -+ * idle to busy, updates the budget of bfqq. The function also tells -+ * whether the in-service queue should be expired, by returning -+ * true. The purpose of expiring the in-service queue is to give bfqq -+ * the chance to possibly preempt the in-service queue, and the reason -+ * for preempting the in-service queue is to achieve one of the two -+ * goals below. -+ * -+ * 1. Guarantee to bfqq its reserved bandwidth even if bfqq has -+ * expired because it has remained idle. In particular, bfqq may have -+ * expired for one of the following two reasons: -+ * -+ * - BFQ_BFQQ_NO_MORE_REQUEST bfqq did not enjoy any device idling and -+ * did not make it to issue a new request before its last request -+ * was served; -+ * -+ * - BFQ_BFQQ_TOO_IDLE bfqq did enjoy device idling, but did not issue -+ * a new request before the expiration of the idling-time. -+ * -+ * Even if bfqq has expired for one of the above reasons, the process -+ * associated with the queue may be however issuing requests greedily, -+ * and thus be sensitive to the bandwidth it receives (bfqq may have -+ * remained idle for other reasons: CPU high load, bfqq not enjoying -+ * idling, I/O throttling somewhere in the path from the process to -+ * the I/O scheduler, ...). But if, after every expiration for one of -+ * the above two reasons, bfqq has to wait for the service of at least -+ * one full budget of another queue before being served again, then -+ * bfqq is likely to get a much lower bandwidth or resource time than -+ * its reserved ones. To address this issue, two countermeasures need -+ * to be taken. -+ * -+ * First, the budget and the timestamps of bfqq need to be updated in -+ * a special way on bfqq reactivation: they need to be updated as if -+ * bfqq did not remain idle and did not expire. In fact, if they are -+ * computed as if bfqq expired and remained idle until reactivation, -+ * then the process associated with bfqq is treated as if, instead of -+ * being greedy, it stopped issuing requests when bfqq remained idle, -+ * and restarts issuing requests only on this reactivation. In other -+ * words, the scheduler does not help the process recover the "service -+ * hole" between bfqq expiration and reactivation. As a consequence, -+ * the process receives a lower bandwidth than its reserved one. In -+ * contrast, to recover this hole, the budget must be updated as if -+ * bfqq was not expired at all before this reactivation, i.e., it must -+ * be set to the value of the remaining budget when bfqq was -+ * expired. Along the same line, timestamps need to be assigned the -+ * value they had the last time bfqq was selected for service, i.e., -+ * before last expiration. Thus timestamps need to be back-shifted -+ * with respect to their normal computation (see [1] for more details -+ * on this tricky aspect). -+ * -+ * Secondly, to allow the process to recover the hole, the in-service -+ * queue must be expired too, to give bfqq the chance to preempt it -+ * immediately. In fact, if bfqq has to wait for a full budget of the -+ * in-service queue to be completed, then it may become impossible to -+ * let the process recover the hole, even if the back-shifted -+ * timestamps of bfqq are lower than those of the in-service queue. If -+ * this happens for most or all of the holes, then the process may not -+ * receive its reserved bandwidth. In this respect, it is worth noting -+ * that, being the service of outstanding requests unpreemptible, a -+ * little fraction of the holes may however be unrecoverable, thereby -+ * causing a little loss of bandwidth. -+ * -+ * The last important point is detecting whether bfqq does need this -+ * bandwidth recovery. In this respect, the next function deems the -+ * process associated with bfqq greedy, and thus allows it to recover -+ * the hole, if: 1) the process is waiting for the arrival of a new -+ * request (which implies that bfqq expired for one of the above two -+ * reasons), and 2) such a request has arrived soon. The first -+ * condition is controlled through the flag non_blocking_wait_rq, -+ * while the second through the flag arrived_in_time. If both -+ * conditions hold, then the function computes the budget in the -+ * above-described special way, and signals that the in-service queue -+ * should be expired. Timestamp back-shifting is done later in -+ * __bfq_activate_entity. -+ * -+ * 2. Reduce latency. Even if timestamps are not backshifted to let -+ * the process associated with bfqq recover a service hole, bfqq may -+ * however happen to have, after being (re)activated, a lower finish -+ * timestamp than the in-service queue. That is, the next budget of -+ * bfqq may have to be completed before the one of the in-service -+ * queue. If this is the case, then preempting the in-service queue -+ * allows this goal to be achieved, apart from the unpreemptible, -+ * outstanding requests mentioned above. -+ * -+ * Unfortunately, regardless of which of the above two goals one wants -+ * to achieve, service trees need first to be updated to know whether -+ * the in-service queue must be preempted. To have service trees -+ * correctly updated, the in-service queue must be expired and -+ * rescheduled, and bfqq must be scheduled too. This is one of the -+ * most costly operations (in future versions, the scheduling -+ * mechanism may be re-designed in such a way to make it possible to -+ * know whether preemption is needed without needing to update service -+ * trees). In addition, queue preemptions almost always cause random -+ * I/O, and thus loss of throughput. Because of these facts, the next -+ * function adopts the following simple scheme to avoid both costly -+ * operations and too frequent preemptions: it requests the expiration -+ * of the in-service queue (unconditionally) only for queues that need -+ * to recover a hole, or that either are weight-raised or deserve to -+ * be weight-raised. -+ */ -+static bool bfq_bfqq_update_budg_for_activation(struct bfq_data *bfqd, -+ struct bfq_queue *bfqq, -+ bool arrived_in_time, -+ bool wr_or_deserves_wr) -+{ -+ struct bfq_entity *entity = &bfqq->entity; -+ -+ if (bfq_bfqq_non_blocking_wait_rq(bfqq) && arrived_in_time) { -+ /* -+ * We do not clear the flag non_blocking_wait_rq here, as -+ * the latter is used in bfq_activate_bfqq to signal -+ * that timestamps need to be back-shifted (and is -+ * cleared right after). -+ */ -+ -+ /* -+ * In next assignment we rely on that either -+ * entity->service or entity->budget are not updated -+ * on expiration if bfqq is empty (see -+ * __bfq_bfqq_recalc_budget). Thus both quantities -+ * remain unchanged after such an expiration, and the -+ * following statement therefore assigns to -+ * entity->budget the remaining budget on such an -+ * expiration. For clarity, entity->service is not -+ * updated on expiration in any case, and, in normal -+ * operation, is reset only when bfqq is selected for -+ * service (see bfq_get_next_queue). -+ */ -+ BUG_ON(bfqq->max_budget < 0); -+ entity->budget = min_t(unsigned long, -+ bfq_bfqq_budget_left(bfqq), -+ bfqq->max_budget); -+ -+ BUG_ON(entity->budget < 0); -+ return true; -+ } -+ -+ BUG_ON(bfqq->max_budget < 0); -+ entity->budget = max_t(unsigned long, bfqq->max_budget, -+ bfq_serv_to_charge(bfqq->next_rq, bfqq)); -+ BUG_ON(entity->budget < 0); -+ -+ bfq_clear_bfqq_non_blocking_wait_rq(bfqq); -+ return wr_or_deserves_wr; -+} -+ -+static void bfq_update_bfqq_wr_on_rq_arrival(struct bfq_data *bfqd, -+ struct bfq_queue *bfqq, -+ unsigned int old_wr_coeff, -+ bool wr_or_deserves_wr, -+ bool interactive, -+ bool in_burst, -+ bool soft_rt) -+{ -+ if (old_wr_coeff == 1 && wr_or_deserves_wr) { -+ /* start a weight-raising period */ -+ if (interactive) { -+ bfqq->wr_coeff = bfqd->bfq_wr_coeff; -+ bfqq->wr_cur_max_time = bfq_wr_duration(bfqd); -+ } else { -+ bfqq->wr_start_at_switch_to_srt = jiffies; -+ bfqq->wr_coeff = bfqd->bfq_wr_coeff * -+ BFQ_SOFTRT_WEIGHT_FACTOR; -+ bfqq->wr_cur_max_time = -+ bfqd->bfq_wr_rt_max_time; -+ } -+ /* -+ * If needed, further reduce budget to make sure it is -+ * close to bfqq's backlog, so as to reduce the -+ * scheduling-error component due to a too large -+ * budget. Do not care about throughput consequences, -+ * but only about latency. Finally, do not assign a -+ * too small budget either, to avoid increasing -+ * latency by causing too frequent expirations. -+ */ -+ bfqq->entity.budget = min_t(unsigned long, -+ bfqq->entity.budget, -+ 2 * bfq_min_budget(bfqd)); -+ -+ bfq_log_bfqq(bfqd, bfqq, -+ "wrais starting at %lu, rais_max_time %u", -+ jiffies, -+ jiffies_to_msecs(bfqq->wr_cur_max_time)); -+ } else if (old_wr_coeff > 1) { -+ if (interactive) { /* update wr coeff and duration */ -+ bfqq->wr_coeff = bfqd->bfq_wr_coeff; -+ bfqq->wr_cur_max_time = bfq_wr_duration(bfqd); -+ } else if (in_burst) { -+ bfqq->wr_coeff = 1; -+ bfq_log_bfqq(bfqd, bfqq, -+ "wrais ending at %lu, rais_max_time %u", -+ jiffies, -+ jiffies_to_msecs(bfqq-> -+ wr_cur_max_time)); -+ } else if (soft_rt) { -+ /* -+ * The application is now or still meeting the -+ * requirements for being deemed soft rt. We -+ * can then correctly and safely (re)charge -+ * the weight-raising duration for the -+ * application with the weight-raising -+ * duration for soft rt applications. -+ * -+ * In particular, doing this recharge now, i.e., -+ * before the weight-raising period for the -+ * application finishes, reduces the probability -+ * of the following negative scenario: -+ * 1) the weight of a soft rt application is -+ * raised at startup (as for any newly -+ * created application), -+ * 2) since the application is not interactive, -+ * at a certain time weight-raising is -+ * stopped for the application, -+ * 3) at that time the application happens to -+ * still have pending requests, and hence -+ * is destined to not have a chance to be -+ * deemed soft rt before these requests are -+ * completed (see the comments to the -+ * function bfq_bfqq_softrt_next_start() -+ * for details on soft rt detection), -+ * 4) these pending requests experience a high -+ * latency because the application is not -+ * weight-raised while they are pending. -+ */ -+ if (bfqq->wr_cur_max_time != -+ bfqd->bfq_wr_rt_max_time) { -+ bfqq->wr_start_at_switch_to_srt = -+ bfqq->last_wr_start_finish; -+ BUG_ON(time_is_after_jiffies(bfqq->last_wr_start_finish)); -+ -+ bfqq->wr_cur_max_time = -+ bfqd->bfq_wr_rt_max_time; -+ bfqq->wr_coeff = bfqd->bfq_wr_coeff * -+ BFQ_SOFTRT_WEIGHT_FACTOR; -+ bfq_log_bfqq(bfqd, bfqq, -+ "switching to soft_rt wr"); -+ } else -+ bfq_log_bfqq(bfqd, bfqq, -+ "moving forward soft_rt wr duration"); -+ bfqq->last_wr_start_finish = jiffies; -+ } -+ } -+} -+ -+static bool bfq_bfqq_idle_for_long_time(struct bfq_data *bfqd, -+ struct bfq_queue *bfqq) -+{ -+ return bfqq->dispatched == 0 && -+ time_is_before_jiffies( -+ bfqq->budget_timeout + -+ bfqd->bfq_wr_min_idle_time); -+} -+ -+static void bfq_bfqq_handle_idle_busy_switch(struct bfq_data *bfqd, -+ struct bfq_queue *bfqq, -+ int old_wr_coeff, -+ struct request *rq, -+ bool *interactive) -+{ -+ bool soft_rt, in_burst, wr_or_deserves_wr, -+ bfqq_wants_to_preempt, -+ idle_for_long_time = bfq_bfqq_idle_for_long_time(bfqd, bfqq), -+ /* -+ * See the comments on -+ * bfq_bfqq_update_budg_for_activation for -+ * details on the usage of the next variable. -+ */ -+ arrived_in_time = ktime_get_ns() <= -+ RQ_BIC(rq)->ttime.last_end_request + -+ bfqd->bfq_slice_idle * 3; -+ -+ bfq_log_bfqq(bfqd, bfqq, -+ "bfq_add_request non-busy: " -+ "jiffies %lu, in_time %d, idle_long %d busyw %d " -+ "wr_coeff %u", -+ jiffies, arrived_in_time, -+ idle_for_long_time, -+ bfq_bfqq_non_blocking_wait_rq(bfqq), -+ old_wr_coeff); -+ -+ BUG_ON(bfqq->entity.budget < bfqq->entity.service); -+ -+ BUG_ON(bfqq == bfqd->in_service_queue); -+ bfqg_stats_update_io_add(bfqq_group(RQ_BFQQ(rq)), bfqq, -+ req_op(rq), rq->cmd_flags); -+ -+ /* -+ * bfqq deserves to be weight-raised if: -+ * - it is sync, -+ * - it does not belong to a large burst, -+ * - it has been idle for enough time or is soft real-time, -+ * - is linked to a bfq_io_cq (it is not shared in any sense) -+ */ -+ in_burst = bfq_bfqq_in_large_burst(bfqq); -+ soft_rt = bfqd->bfq_wr_max_softrt_rate > 0 && -+ !in_burst && -+ time_is_before_jiffies(bfqq->soft_rt_next_start); -+ *interactive = -+ !in_burst && -+ idle_for_long_time; -+ wr_or_deserves_wr = bfqd->low_latency && -+ (bfqq->wr_coeff > 1 || -+ (bfq_bfqq_sync(bfqq) && -+ bfqq->bic && (*interactive || soft_rt))); -+ -+ bfq_log_bfqq(bfqd, bfqq, -+ "bfq_add_request: " -+ "in_burst %d, " -+ "soft_rt %d (next %lu), inter %d, bic %p", -+ bfq_bfqq_in_large_burst(bfqq), soft_rt, -+ bfqq->soft_rt_next_start, -+ *interactive, -+ bfqq->bic); -+ -+ /* -+ * Using the last flag, update budget and check whether bfqq -+ * may want to preempt the in-service queue. -+ */ -+ bfqq_wants_to_preempt = -+ bfq_bfqq_update_budg_for_activation(bfqd, bfqq, -+ arrived_in_time, -+ wr_or_deserves_wr); -+ -+ /* -+ * If bfqq happened to be activated in a burst, but has been -+ * idle for much more than an interactive queue, then we -+ * assume that, in the overall I/O initiated in the burst, the -+ * I/O associated with bfqq is finished. So bfqq does not need -+ * to be treated as a queue belonging to a burst -+ * anymore. Accordingly, we reset bfqq's in_large_burst flag -+ * if set, and remove bfqq from the burst list if it's -+ * there. We do not decrement burst_size, because the fact -+ * that bfqq does not need to belong to the burst list any -+ * more does not invalidate the fact that bfqq was created in -+ * a burst. -+ */ -+ if (likely(!bfq_bfqq_just_created(bfqq)) && -+ idle_for_long_time && -+ time_is_before_jiffies( -+ bfqq->budget_timeout + -+ msecs_to_jiffies(10000))) { -+ hlist_del_init(&bfqq->burst_list_node); -+ bfq_clear_bfqq_in_large_burst(bfqq); -+ } -+ -+ bfq_clear_bfqq_just_created(bfqq); -+ -+ if (!bfq_bfqq_IO_bound(bfqq)) { -+ if (arrived_in_time) { -+ bfqq->requests_within_timer++; -+ if (bfqq->requests_within_timer >= -+ bfqd->bfq_requests_within_timer) -+ bfq_mark_bfqq_IO_bound(bfqq); -+ } else -+ bfqq->requests_within_timer = 0; -+ bfq_log_bfqq(bfqd, bfqq, "requests in time %d", -+ bfqq->requests_within_timer); -+ } -+ -+ if (bfqd->low_latency) { -+ if (unlikely(time_is_after_jiffies(bfqq->split_time))) -+ /* wraparound */ -+ bfqq->split_time = -+ jiffies - bfqd->bfq_wr_min_idle_time - 1; -+ -+ if (time_is_before_jiffies(bfqq->split_time + -+ bfqd->bfq_wr_min_idle_time)) { -+ bfq_update_bfqq_wr_on_rq_arrival(bfqd, bfqq, -+ old_wr_coeff, -+ wr_or_deserves_wr, -+ *interactive, -+ in_burst, -+ soft_rt); -+ -+ if (old_wr_coeff != bfqq->wr_coeff) -+ bfqq->entity.prio_changed = 1; -+ } -+ } -+ -+ bfqq->last_idle_bklogged = jiffies; -+ bfqq->service_from_backlogged = 0; -+ bfq_clear_bfqq_softrt_update(bfqq); -+ -+ bfq_add_bfqq_busy(bfqd, bfqq); -+ -+ /* -+ * Expire in-service queue only if preemption may be needed -+ * for guarantees. In this respect, the function -+ * next_queue_may_preempt just checks a simple, necessary -+ * condition, and not a sufficient condition based on -+ * timestamps. In fact, for the latter condition to be -+ * evaluated, timestamps would need first to be updated, and -+ * this operation is quite costly (see the comments on the -+ * function bfq_bfqq_update_budg_for_activation). -+ */ -+ if (bfqd->in_service_queue && bfqq_wants_to_preempt && -+ bfqd->in_service_queue->wr_coeff < bfqq->wr_coeff && -+ next_queue_may_preempt(bfqd)) { -+ struct bfq_queue *in_serv = -+ bfqd->in_service_queue; -+ BUG_ON(in_serv == bfqq); -+ -+ bfq_bfqq_expire(bfqd, bfqd->in_service_queue, -+ false, BFQ_BFQQ_PREEMPTED); -+ BUG_ON(in_serv->entity.budget < 0); -+ } -+} -+ -+static void bfq_add_request(struct request *rq) -+{ -+ struct bfq_queue *bfqq = RQ_BFQQ(rq); -+ struct bfq_data *bfqd = bfqq->bfqd; -+ struct request *next_rq, *prev; -+ unsigned int old_wr_coeff = bfqq->wr_coeff; -+ bool interactive = false; -+ -+ bfq_log_bfqq(bfqd, bfqq, "add_request: size %u %s", -+ blk_rq_sectors(rq), rq_is_sync(rq) ? "S" : "A"); -+ -+ if (bfqq->wr_coeff > 1) /* queue is being weight-raised */ -+ bfq_log_bfqq(bfqd, bfqq, -+ "raising period dur %u/%u msec, old coeff %u, w %d(%d)", -+ jiffies_to_msecs(jiffies - bfqq->last_wr_start_finish), -+ jiffies_to_msecs(bfqq->wr_cur_max_time), -+ bfqq->wr_coeff, -+ bfqq->entity.weight, bfqq->entity.orig_weight); -+ -+ bfqq->queued[rq_is_sync(rq)]++; -+ bfqd->queued++; -+ -+ elv_rb_add(&bfqq->sort_list, rq); -+ -+ /* -+ * Check if this request is a better next-to-serve candidate. -+ */ -+ prev = bfqq->next_rq; -+ next_rq = bfq_choose_req(bfqd, bfqq->next_rq, rq, bfqd->last_position); -+ BUG_ON(!next_rq); -+ bfqq->next_rq = next_rq; -+ -+ /* -+ * Adjust priority tree position, if next_rq changes. -+ */ -+ if (prev != bfqq->next_rq) -+ bfq_pos_tree_add_move(bfqd, bfqq); -+ -+ if (!bfq_bfqq_busy(bfqq)) /* switching to busy ... */ -+ bfq_bfqq_handle_idle_busy_switch(bfqd, bfqq, old_wr_coeff, -+ rq, &interactive); -+ else { -+ if (bfqd->low_latency && old_wr_coeff == 1 && !rq_is_sync(rq) && -+ time_is_before_jiffies( -+ bfqq->last_wr_start_finish + -+ bfqd->bfq_wr_min_inter_arr_async)) { -+ bfqq->wr_coeff = bfqd->bfq_wr_coeff; -+ bfqq->wr_cur_max_time = bfq_wr_duration(bfqd); -+ -+ bfqd->wr_busy_queues++; -+ bfqq->entity.prio_changed = 1; -+ bfq_log_bfqq(bfqd, bfqq, -+ "non-idle wrais starting, " -+ "wr_max_time %u wr_busy %d", -+ jiffies_to_msecs(bfqq->wr_cur_max_time), -+ bfqd->wr_busy_queues); -+ } -+ if (prev != bfqq->next_rq) -+ bfq_updated_next_req(bfqd, bfqq); -+ } -+ -+ /* -+ * Assign jiffies to last_wr_start_finish in the following -+ * cases: -+ * -+ * . if bfqq is not going to be weight-raised, because, for -+ * non weight-raised queues, last_wr_start_finish stores the -+ * arrival time of the last request; as of now, this piece -+ * of information is used only for deciding whether to -+ * weight-raise async queues -+ * -+ * . if bfqq is not weight-raised, because, if bfqq is now -+ * switching to weight-raised, then last_wr_start_finish -+ * stores the time when weight-raising starts -+ * -+ * . if bfqq is interactive, because, regardless of whether -+ * bfqq is currently weight-raised, the weight-raising -+ * period must start or restart (this case is considered -+ * separately because it is not detected by the above -+ * conditions, if bfqq is already weight-raised) -+ * -+ * last_wr_start_finish has to be updated also if bfqq is soft -+ * real-time, because the weight-raising period is constantly -+ * restarted on idle-to-busy transitions for these queues, but -+ * this is already done in bfq_bfqq_handle_idle_busy_switch if -+ * needed. -+ */ -+ if (bfqd->low_latency && -+ (old_wr_coeff == 1 || bfqq->wr_coeff == 1 || interactive)) -+ bfqq->last_wr_start_finish = jiffies; -+} -+ -+static struct request *bfq_find_rq_fmerge(struct bfq_data *bfqd, -+ struct bio *bio) -+{ -+ struct task_struct *tsk = current; -+ struct bfq_io_cq *bic; -+ struct bfq_queue *bfqq; -+ -+ bic = bfq_bic_lookup(bfqd, tsk->io_context); -+ if (!bic) -+ return NULL; -+ -+ bfqq = bic_to_bfqq(bic, bfq_bio_sync(bio)); -+ if (bfqq) -+ return elv_rb_find(&bfqq->sort_list, bio_end_sector(bio)); -+ -+ return NULL; -+} -+ -+static sector_t get_sdist(sector_t last_pos, struct request *rq) -+{ -+ sector_t sdist = 0; -+ -+ if (last_pos) { -+ if (last_pos < blk_rq_pos(rq)) -+ sdist = blk_rq_pos(rq) - last_pos; -+ else -+ sdist = last_pos - blk_rq_pos(rq); -+ } -+ -+ return sdist; -+} -+ -+static void bfq_activate_request(struct request_queue *q, struct request *rq) -+{ -+ struct bfq_data *bfqd = q->elevator->elevator_data; -+ bfqd->rq_in_driver++; -+} -+ -+static void bfq_deactivate_request(struct request_queue *q, struct request *rq) -+{ -+ struct bfq_data *bfqd = q->elevator->elevator_data; -+ -+ BUG_ON(bfqd->rq_in_driver == 0); -+ bfqd->rq_in_driver--; -+} -+ -+static void bfq_remove_request(struct request *rq) -+{ -+ struct bfq_queue *bfqq = RQ_BFQQ(rq); -+ struct bfq_data *bfqd = bfqq->bfqd; -+ const int sync = rq_is_sync(rq); -+ -+ BUG_ON(bfqq->entity.service > bfqq->entity.budget && -+ bfqq == bfqd->in_service_queue); -+ -+ if (bfqq->next_rq == rq) { -+ bfqq->next_rq = bfq_find_next_rq(bfqd, bfqq, rq); -+ bfq_updated_next_req(bfqd, bfqq); -+ } -+ -+ if (rq->queuelist.prev != &rq->queuelist) -+ list_del_init(&rq->queuelist); -+ BUG_ON(bfqq->queued[sync] == 0); -+ bfqq->queued[sync]--; -+ bfqd->queued--; -+ elv_rb_del(&bfqq->sort_list, rq); -+ -+ if (RB_EMPTY_ROOT(&bfqq->sort_list)) { -+ BUG_ON(bfqq->entity.budget < 0); -+ -+ if (bfq_bfqq_busy(bfqq) && bfqq != bfqd->in_service_queue) { -+ bfq_del_bfqq_busy(bfqd, bfqq, 1); -+ -+ /* bfqq emptied. In normal operation, when -+ * bfqq is empty, bfqq->entity.service and -+ * bfqq->entity.budget must contain, -+ * respectively, the service received and the -+ * budget used last time bfqq emptied. These -+ * facts do not hold in this case, as at least -+ * this last removal occurred while bfqq is -+ * not in service. To avoid inconsistencies, -+ * reset both bfqq->entity.service and -+ * bfqq->entity.budget. -+ */ -+ bfqq->entity.budget = bfqq->entity.service = 0; -+ } -+ -+ /* -+ * Remove queue from request-position tree as it is empty. -+ */ -+ if (bfqq->pos_root) { -+ rb_erase(&bfqq->pos_node, bfqq->pos_root); -+ bfqq->pos_root = NULL; -+ } -+ } -+ -+ if (rq->cmd_flags & REQ_META) { -+ BUG_ON(bfqq->meta_pending == 0); -+ bfqq->meta_pending--; -+ } -+ bfqg_stats_update_io_remove(bfqq_group(bfqq), req_op(rq), -+ rq->cmd_flags); -+} -+ -+static int bfq_merge(struct request_queue *q, struct request **req, -+ struct bio *bio) -+{ -+ struct bfq_data *bfqd = q->elevator->elevator_data; -+ struct request *__rq; -+ -+ __rq = bfq_find_rq_fmerge(bfqd, bio); -+ if (__rq && elv_bio_merge_ok(__rq, bio)) { -+ *req = __rq; -+ return ELEVATOR_FRONT_MERGE; -+ } -+ -+ return ELEVATOR_NO_MERGE; -+} -+ -+static void bfq_merged_request(struct request_queue *q, struct request *req, -+ int type) -+{ -+ if (type == ELEVATOR_FRONT_MERGE && -+ rb_prev(&req->rb_node) && -+ blk_rq_pos(req) < -+ blk_rq_pos(container_of(rb_prev(&req->rb_node), -+ struct request, rb_node))) { -+ struct bfq_queue *bfqq = RQ_BFQQ(req); -+ struct bfq_data *bfqd = bfqq->bfqd; -+ struct request *prev, *next_rq; -+ -+ /* Reposition request in its sort_list */ -+ elv_rb_del(&bfqq->sort_list, req); -+ elv_rb_add(&bfqq->sort_list, req); -+ /* Choose next request to be served for bfqq */ -+ prev = bfqq->next_rq; -+ next_rq = bfq_choose_req(bfqd, bfqq->next_rq, req, -+ bfqd->last_position); -+ BUG_ON(!next_rq); -+ bfqq->next_rq = next_rq; -+ /* -+ * If next_rq changes, update both the queue's budget to -+ * fit the new request and the queue's position in its -+ * rq_pos_tree. -+ */ -+ if (prev != bfqq->next_rq) { -+ bfq_updated_next_req(bfqd, bfqq); -+ bfq_pos_tree_add_move(bfqd, bfqq); -+ } -+ } -+} -+ -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+static void bfq_bio_merged(struct request_queue *q, struct request *req, -+ struct bio *bio) -+{ -+ bfqg_stats_update_io_merged(bfqq_group(RQ_BFQQ(req)), bio_op(bio), -+ bio->bi_opf); -+} -+#endif -+ -+static void bfq_merged_requests(struct request_queue *q, struct request *rq, -+ struct request *next) -+{ -+ struct bfq_queue *bfqq = RQ_BFQQ(rq), *next_bfqq = RQ_BFQQ(next); -+ -+ /* -+ * If next and rq belong to the same bfq_queue and next is older -+ * than rq, then reposition rq in the fifo (by substituting next -+ * with rq). Otherwise, if next and rq belong to different -+ * bfq_queues, never reposition rq: in fact, we would have to -+ * reposition it with respect to next's position in its own fifo, -+ * which would most certainly be too expensive with respect to -+ * the benefits. -+ */ -+ if (bfqq == next_bfqq && -+ !list_empty(&rq->queuelist) && !list_empty(&next->queuelist) && -+ next->fifo_time < rq->fifo_time) { -+ list_del_init(&rq->queuelist); -+ list_replace_init(&next->queuelist, &rq->queuelist); -+ rq->fifo_time = next->fifo_time; -+ } -+ -+ if (bfqq->next_rq == next) -+ bfqq->next_rq = rq; -+ -+ bfq_remove_request(next); -+ bfqg_stats_update_io_merged(bfqq_group(bfqq), req_op(next), -+ next->cmd_flags); -+} -+ -+/* Must be called with bfqq != NULL */ -+static void bfq_bfqq_end_wr(struct bfq_queue *bfqq) -+{ -+ BUG_ON(!bfqq); -+ -+ if (bfq_bfqq_busy(bfqq)) -+ bfqq->bfqd->wr_busy_queues--; -+ bfqq->wr_coeff = 1; -+ bfqq->wr_cur_max_time = 0; -+ bfqq->last_wr_start_finish = jiffies; -+ /* -+ * Trigger a weight change on the next invocation of -+ * __bfq_entity_update_weight_prio. -+ */ -+ bfqq->entity.prio_changed = 1; -+ bfq_log_bfqq(bfqq->bfqd, bfqq, -+ "end_wr: wrais ending at %lu, rais_max_time %u", -+ bfqq->last_wr_start_finish, -+ jiffies_to_msecs(bfqq->wr_cur_max_time)); -+ bfq_log_bfqq(bfqq->bfqd, bfqq, "end_wr: wr_busy %d", -+ bfqq->bfqd->wr_busy_queues); -+} -+ -+static void bfq_end_wr_async_queues(struct bfq_data *bfqd, -+ struct bfq_group *bfqg) -+{ -+ int i, j; -+ -+ for (i = 0; i < 2; i++) -+ for (j = 0; j < IOPRIO_BE_NR; j++) -+ if (bfqg->async_bfqq[i][j]) -+ bfq_bfqq_end_wr(bfqg->async_bfqq[i][j]); -+ if (bfqg->async_idle_bfqq) -+ bfq_bfqq_end_wr(bfqg->async_idle_bfqq); -+} -+ -+static void bfq_end_wr(struct bfq_data *bfqd) -+{ -+ struct bfq_queue *bfqq; -+ -+ spin_lock_irq(bfqd->queue->queue_lock); -+ -+ list_for_each_entry(bfqq, &bfqd->active_list, bfqq_list) -+ bfq_bfqq_end_wr(bfqq); -+ list_for_each_entry(bfqq, &bfqd->idle_list, bfqq_list) -+ bfq_bfqq_end_wr(bfqq); -+ bfq_end_wr_async(bfqd); -+ -+ spin_unlock_irq(bfqd->queue->queue_lock); -+} -+ -+static sector_t bfq_io_struct_pos(void *io_struct, bool request) -+{ -+ if (request) -+ return blk_rq_pos(io_struct); -+ else -+ return ((struct bio *)io_struct)->bi_iter.bi_sector; -+} -+ -+static int bfq_rq_close_to_sector(void *io_struct, bool request, -+ sector_t sector) -+{ -+ return abs(bfq_io_struct_pos(io_struct, request) - sector) <= -+ BFQQ_CLOSE_THR; -+} -+ -+static struct bfq_queue *bfqq_find_close(struct bfq_data *bfqd, -+ struct bfq_queue *bfqq, -+ sector_t sector) -+{ -+ struct rb_root *root = &bfq_bfqq_to_bfqg(bfqq)->rq_pos_tree; -+ struct rb_node *parent, *node; -+ struct bfq_queue *__bfqq; -+ -+ if (RB_EMPTY_ROOT(root)) -+ return NULL; -+ -+ /* -+ * First, if we find a request starting at the end of the last -+ * request, choose it. -+ */ -+ __bfqq = bfq_rq_pos_tree_lookup(bfqd, root, sector, &parent, NULL); -+ if (__bfqq) -+ return __bfqq; -+ -+ /* -+ * If the exact sector wasn't found, the parent of the NULL leaf -+ * will contain the closest sector (rq_pos_tree sorted by -+ * next_request position). -+ */ -+ __bfqq = rb_entry(parent, struct bfq_queue, pos_node); -+ if (bfq_rq_close_to_sector(__bfqq->next_rq, true, sector)) -+ return __bfqq; -+ -+ if (blk_rq_pos(__bfqq->next_rq) < sector) -+ node = rb_next(&__bfqq->pos_node); -+ else -+ node = rb_prev(&__bfqq->pos_node); -+ if (!node) -+ return NULL; -+ -+ __bfqq = rb_entry(node, struct bfq_queue, pos_node); -+ if (bfq_rq_close_to_sector(__bfqq->next_rq, true, sector)) -+ return __bfqq; -+ -+ return NULL; -+} -+ -+static struct bfq_queue *bfq_find_close_cooperator(struct bfq_data *bfqd, -+ struct bfq_queue *cur_bfqq, -+ sector_t sector) -+{ -+ struct bfq_queue *bfqq; -+ -+ /* -+ * We shall notice if some of the queues are cooperating, -+ * e.g., working closely on the same area of the device. In -+ * that case, we can group them together and: 1) don't waste -+ * time idling, and 2) serve the union of their requests in -+ * the best possible order for throughput. -+ */ -+ bfqq = bfqq_find_close(bfqd, cur_bfqq, sector); -+ if (!bfqq || bfqq == cur_bfqq) -+ return NULL; -+ -+ return bfqq; -+} -+ -+static struct bfq_queue * -+bfq_setup_merge(struct bfq_queue *bfqq, struct bfq_queue *new_bfqq) -+{ -+ int process_refs, new_process_refs; -+ struct bfq_queue *__bfqq; -+ -+ /* -+ * If there are no process references on the new_bfqq, then it is -+ * unsafe to follow the ->new_bfqq chain as other bfqq's in the chain -+ * may have dropped their last reference (not just their last process -+ * reference). -+ */ -+ if (!bfqq_process_refs(new_bfqq)) -+ return NULL; -+ -+ /* Avoid a circular list and skip interim queue merges. */ -+ while ((__bfqq = new_bfqq->new_bfqq)) { -+ if (__bfqq == bfqq) -+ return NULL; -+ new_bfqq = __bfqq; -+ } -+ -+ process_refs = bfqq_process_refs(bfqq); -+ new_process_refs = bfqq_process_refs(new_bfqq); -+ /* -+ * If the process for the bfqq has gone away, there is no -+ * sense in merging the queues. -+ */ -+ if (process_refs == 0 || new_process_refs == 0) -+ return NULL; -+ -+ bfq_log_bfqq(bfqq->bfqd, bfqq, "scheduling merge with queue %d", -+ new_bfqq->pid); -+ -+ /* -+ * Merging is just a redirection: the requests of the process -+ * owning one of the two queues are redirected to the other queue. -+ * The latter queue, in its turn, is set as shared if this is the -+ * first time that the requests of some process are redirected to -+ * it. -+ * -+ * We redirect bfqq to new_bfqq and not the opposite, because we -+ * are in the context of the process owning bfqq, hence we have -+ * the io_cq of this process. So we can immediately configure this -+ * io_cq to redirect the requests of the process to new_bfqq. -+ * -+ * NOTE, even if new_bfqq coincides with the in-service queue, the -+ * io_cq of new_bfqq is not available, because, if the in-service -+ * queue is shared, bfqd->in_service_bic may not point to the -+ * io_cq of the in-service queue. -+ * Redirecting the requests of the process owning bfqq to the -+ * currently in-service queue is in any case the best option, as -+ * we feed the in-service queue with new requests close to the -+ * last request served and, by doing so, hopefully increase the -+ * throughput. -+ */ -+ bfqq->new_bfqq = new_bfqq; -+ new_bfqq->ref += process_refs; -+ return new_bfqq; -+} -+ -+static bool bfq_may_be_close_cooperator(struct bfq_queue *bfqq, -+ struct bfq_queue *new_bfqq) -+{ -+ if (bfq_class_idle(bfqq) || bfq_class_idle(new_bfqq) || -+ (bfqq->ioprio_class != new_bfqq->ioprio_class)) -+ return false; -+ -+ /* -+ * If either of the queues has already been detected as seeky, -+ * then merging it with the other queue is unlikely to lead to -+ * sequential I/O. -+ */ -+ if (BFQQ_SEEKY(bfqq) || BFQQ_SEEKY(new_bfqq)) -+ return false; -+ -+ /* -+ * Interleaved I/O is known to be done by (some) applications -+ * only for reads, so it does not make sense to merge async -+ * queues. -+ */ -+ if (!bfq_bfqq_sync(bfqq) || !bfq_bfqq_sync(new_bfqq)) -+ return false; -+ -+ return true; -+} -+ -+/* -+ * If this function returns true, then bfqq cannot be merged. The idea -+ * is that true cooperation happens very early after processes start -+ * to do I/O. Usually, late cooperations are just accidental false -+ * positives. In case bfqq is weight-raised, such false positives -+ * would evidently degrade latency guarantees for bfqq. -+ */ -+bool wr_from_too_long(struct bfq_queue *bfqq) -+{ -+ return bfqq->wr_coeff > 1 && -+ time_is_before_jiffies(bfqq->last_wr_start_finish + -+ msecs_to_jiffies(100)); -+} -+ -+/* -+ * Attempt to schedule a merge of bfqq with the currently in-service -+ * queue or with a close queue among the scheduled queues. Return -+ * NULL if no merge was scheduled, a pointer to the shared bfq_queue -+ * structure otherwise. -+ * -+ * The OOM queue is not allowed to participate to cooperation: in fact, since -+ * the requests temporarily redirected to the OOM queue could be redirected -+ * again to dedicated queues at any time, the state needed to correctly -+ * handle merging with the OOM queue would be quite complex and expensive -+ * to maintain. Besides, in such a critical condition as an out of memory, -+ * the benefits of queue merging may be little relevant, or even negligible. -+ * -+ * Weight-raised queues can be merged only if their weight-raising -+ * period has just started. In fact cooperating processes are usually -+ * started together. Thus, with this filter we avoid false positives -+ * that would jeopardize low-latency guarantees. -+ * -+ * WARNING: queue merging may impair fairness among non-weight raised -+ * queues, for at least two reasons: 1) the original weight of a -+ * merged queue may change during the merged state, 2) even being the -+ * weight the same, a merged queue may be bloated with many more -+ * requests than the ones produced by its originally-associated -+ * process. -+ */ -+static struct bfq_queue * -+bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq, -+ void *io_struct, bool request) -+{ -+ struct bfq_queue *in_service_bfqq, *new_bfqq; -+ -+ if (bfqq->new_bfqq) -+ return bfqq->new_bfqq; -+ -+ if (io_struct && wr_from_too_long(bfqq) && -+ likely(bfqq != &bfqd->oom_bfqq)) -+ bfq_log_bfqq(bfqd, bfqq, -+ "would have looked for coop, but bfq%d wr", -+ bfqq->pid); -+ -+ if (!io_struct || -+ wr_from_too_long(bfqq) || -+ unlikely(bfqq == &bfqd->oom_bfqq)) -+ return NULL; -+ -+ /* If there is only one backlogged queue, don't search. */ -+ if (bfqd->busy_queues == 1) -+ return NULL; -+ -+ in_service_bfqq = bfqd->in_service_queue; -+ -+ if (in_service_bfqq && in_service_bfqq != bfqq && -+ bfqd->in_service_bic && wr_from_too_long(in_service_bfqq) -+ && likely(in_service_bfqq == &bfqd->oom_bfqq)) -+ bfq_log_bfqq(bfqd, bfqq, -+ "would have tried merge with in-service-queue, but wr"); -+ -+ if (!in_service_bfqq || in_service_bfqq == bfqq || -+ !bfqd->in_service_bic || wr_from_too_long(in_service_bfqq) || -+ unlikely(in_service_bfqq == &bfqd->oom_bfqq)) -+ goto check_scheduled; -+ -+ if (bfq_rq_close_to_sector(io_struct, request, bfqd->last_position) && -+ bfqq->entity.parent == in_service_bfqq->entity.parent && -+ bfq_may_be_close_cooperator(bfqq, in_service_bfqq)) { -+ new_bfqq = bfq_setup_merge(bfqq, in_service_bfqq); -+ if (new_bfqq) -+ return new_bfqq; -+ } -+ /* -+ * Check whether there is a cooperator among currently scheduled -+ * queues. The only thing we need is that the bio/request is not -+ * NULL, as we need it to establish whether a cooperator exists. -+ */ -+check_scheduled: -+ new_bfqq = bfq_find_close_cooperator(bfqd, bfqq, -+ bfq_io_struct_pos(io_struct, request)); -+ -+ BUG_ON(new_bfqq && bfqq->entity.parent != new_bfqq->entity.parent); -+ -+ if (new_bfqq && wr_from_too_long(new_bfqq) && -+ likely(new_bfqq != &bfqd->oom_bfqq) && -+ bfq_may_be_close_cooperator(bfqq, new_bfqq)) -+ bfq_log_bfqq(bfqd, bfqq, -+ "would have merged with bfq%d, but wr", -+ new_bfqq->pid); -+ -+ if (new_bfqq && !wr_from_too_long(new_bfqq) && -+ likely(new_bfqq != &bfqd->oom_bfqq) && -+ bfq_may_be_close_cooperator(bfqq, new_bfqq)) -+ return bfq_setup_merge(bfqq, new_bfqq); -+ -+ return NULL; -+} -+ -+static void bfq_bfqq_save_state(struct bfq_queue *bfqq) -+{ -+ struct bfq_io_cq *bic = bfqq->bic; -+ -+ /* -+ * If !bfqq->bic, the queue is already shared or its requests -+ * have already been redirected to a shared queue; both idle window -+ * and weight raising state have already been saved. Do nothing. -+ */ -+ if (!bic) -+ return; -+ -+ bic->saved_idle_window = bfq_bfqq_idle_window(bfqq); -+ bic->saved_IO_bound = bfq_bfqq_IO_bound(bfqq); -+ bic->saved_in_large_burst = bfq_bfqq_in_large_burst(bfqq); -+ bic->was_in_burst_list = !hlist_unhashed(&bfqq->burst_list_node); -+ bic->saved_wr_coeff = bfqq->wr_coeff; -+ bic->saved_wr_start_at_switch_to_srt = bfqq->wr_start_at_switch_to_srt; -+ bic->saved_last_wr_start_finish = bfqq->last_wr_start_finish; -+ BUG_ON(time_is_after_jiffies(bfqq->last_wr_start_finish)); -+} -+ -+static void bfq_get_bic_reference(struct bfq_queue *bfqq) -+{ -+ /* -+ * If bfqq->bic has a non-NULL value, the bic to which it belongs -+ * is about to begin using a shared bfq_queue. -+ */ -+ if (bfqq->bic) -+ atomic_long_inc(&bfqq->bic->icq.ioc->refcount); -+} -+ -+static void -+bfq_merge_bfqqs(struct bfq_data *bfqd, struct bfq_io_cq *bic, -+ struct bfq_queue *bfqq, struct bfq_queue *new_bfqq) -+{ -+ bfq_log_bfqq(bfqd, bfqq, "merging with queue %lu", -+ (unsigned long) new_bfqq->pid); -+ /* Save weight raising and idle window of the merged queues */ -+ bfq_bfqq_save_state(bfqq); -+ bfq_bfqq_save_state(new_bfqq); -+ if (bfq_bfqq_IO_bound(bfqq)) -+ bfq_mark_bfqq_IO_bound(new_bfqq); -+ bfq_clear_bfqq_IO_bound(bfqq); -+ -+ /* -+ * If bfqq is weight-raised, then let new_bfqq inherit -+ * weight-raising. To reduce false positives, neglect the case -+ * where bfqq has just been created, but has not yet made it -+ * to be weight-raised (which may happen because EQM may merge -+ * bfqq even before bfq_add_request is executed for the first -+ * time for bfqq). Handling this case would however be very -+ * easy, thanks to the flag just_created. -+ */ -+ if (new_bfqq->wr_coeff == 1 && bfqq->wr_coeff > 1) { -+ new_bfqq->wr_coeff = bfqq->wr_coeff; -+ new_bfqq->wr_cur_max_time = bfqq->wr_cur_max_time; -+ new_bfqq->last_wr_start_finish = bfqq->last_wr_start_finish; -+ new_bfqq->wr_start_at_switch_to_srt = bfqq->wr_start_at_switch_to_srt; -+ if (bfq_bfqq_busy(new_bfqq)) -+ bfqd->wr_busy_queues++; -+ new_bfqq->entity.prio_changed = 1; -+ bfq_log_bfqq(bfqd, new_bfqq, -+ "wr start after merge with %d, rais_max_time %u", -+ bfqq->pid, -+ jiffies_to_msecs(bfqq->wr_cur_max_time)); -+ } -+ -+ if (bfqq->wr_coeff > 1) { /* bfqq has given its wr to new_bfqq */ -+ bfqq->wr_coeff = 1; -+ bfqq->entity.prio_changed = 1; -+ if (bfq_bfqq_busy(bfqq)) -+ bfqd->wr_busy_queues--; -+ } -+ -+ bfq_log_bfqq(bfqd, new_bfqq, "merge_bfqqs: wr_busy %d", -+ bfqd->wr_busy_queues); -+ -+ /* -+ * Grab a reference to the bic, to prevent it from being destroyed -+ * before being possibly touched by a bfq_split_bfqq(). -+ */ -+ bfq_get_bic_reference(bfqq); -+ bfq_get_bic_reference(new_bfqq); -+ /* -+ * Merge queues (that is, let bic redirect its requests to new_bfqq) -+ */ -+ bic_set_bfqq(bic, new_bfqq, 1); -+ bfq_mark_bfqq_coop(new_bfqq); -+ /* -+ * new_bfqq now belongs to at least two bics (it is a shared queue): -+ * set new_bfqq->bic to NULL. bfqq either: -+ * - does not belong to any bic any more, and hence bfqq->bic must -+ * be set to NULL, or -+ * - is a queue whose owning bics have already been redirected to a -+ * different queue, hence the queue is destined to not belong to -+ * any bic soon and bfqq->bic is already NULL (therefore the next -+ * assignment causes no harm). -+ */ -+ new_bfqq->bic = NULL; -+ bfqq->bic = NULL; -+ bfq_put_queue(bfqq); -+} -+ -+static int bfq_allow_bio_merge(struct request_queue *q, struct request *rq, -+ struct bio *bio) -+{ -+ struct bfq_data *bfqd = q->elevator->elevator_data; -+ struct bfq_io_cq *bic; -+ struct bfq_queue *bfqq, *new_bfqq; -+ -+ /* -+ * Disallow merge of a sync bio into an async request. -+ */ -+ if (bfq_bio_sync(bio) && !rq_is_sync(rq)) -+ return false; -+ -+ /* -+ * Lookup the bfqq that this bio will be queued with. Allow -+ * merge only if rq is queued there. -+ * Queue lock is held here. -+ */ -+ bic = bfq_bic_lookup(bfqd, current->io_context); -+ if (!bic) -+ return false; -+ -+ bfqq = bic_to_bfqq(bic, bfq_bio_sync(bio)); -+ /* -+ * We take advantage of this function to perform an early merge -+ * of the queues of possible cooperating processes. -+ */ -+ if (bfqq) { -+ new_bfqq = bfq_setup_cooperator(bfqd, bfqq, bio, false); -+ if (new_bfqq) { -+ bfq_merge_bfqqs(bfqd, bic, bfqq, new_bfqq); -+ /* -+ * If we get here, the bio will be queued in the -+ * shared queue, i.e., new_bfqq, so use new_bfqq -+ * to decide whether bio and rq can be merged. -+ */ -+ bfqq = new_bfqq; -+ } -+ } -+ -+ return bfqq == RQ_BFQQ(rq); -+} -+ -+static int bfq_allow_rq_merge(struct request_queue *q, struct request *rq, -+ struct request *next) -+{ -+ return RQ_BFQQ(rq) == RQ_BFQQ(next); -+} -+ -+/* -+ * Set the maximum time for the in-service queue to consume its -+ * budget. This prevents seeky processes from lowering the throughput. -+ * In practice, a time-slice service scheme is used with seeky -+ * processes. -+ */ -+static void bfq_set_budget_timeout(struct bfq_data *bfqd, -+ struct bfq_queue *bfqq) -+{ -+ unsigned int timeout_coeff; -+ -+ if (bfqq->wr_cur_max_time == bfqd->bfq_wr_rt_max_time) -+ timeout_coeff = 1; -+ else -+ timeout_coeff = bfqq->entity.weight / bfqq->entity.orig_weight; -+ -+ bfqd->last_budget_start = ktime_get(); -+ -+ bfqq->budget_timeout = jiffies + -+ bfqd->bfq_timeout * timeout_coeff; -+ -+ bfq_log_bfqq(bfqd, bfqq, "set budget_timeout %u", -+ jiffies_to_msecs(bfqd->bfq_timeout * timeout_coeff)); -+} -+ -+static void __bfq_set_in_service_queue(struct bfq_data *bfqd, -+ struct bfq_queue *bfqq) -+{ -+ if (bfqq) { -+ bfqg_stats_update_avg_queue_size(bfqq_group(bfqq)); -+ bfq_mark_bfqq_must_alloc(bfqq); -+ bfq_clear_bfqq_fifo_expire(bfqq); -+ -+ bfqd->budgets_assigned = (bfqd->budgets_assigned*7 + 256) / 8; -+ -+ BUG_ON(bfqq == bfqd->in_service_queue); -+ BUG_ON(RB_EMPTY_ROOT(&bfqq->sort_list)); -+ -+ if (time_is_before_jiffies(bfqq->last_wr_start_finish) && -+ bfqq->wr_coeff > 1 && -+ bfqq->wr_cur_max_time == bfqd->bfq_wr_rt_max_time && -+ time_is_before_jiffies(bfqq->budget_timeout)) { -+ /* -+ * For soft real-time queues, move the start -+ * of the weight-raising period forward by the -+ * time the queue has not received any -+ * service. Otherwise, a relatively long -+ * service delay is likely to cause the -+ * weight-raising period of the queue to end, -+ * because of the short duration of the -+ * weight-raising period of a soft real-time -+ * queue. It is worth noting that this move -+ * is not so dangerous for the other queues, -+ * because soft real-time queues are not -+ * greedy. -+ * -+ * To not add a further variable, we use the -+ * overloaded field budget_timeout to -+ * determine for how long the queue has not -+ * received service, i.e., how much time has -+ * elapsed since the queue expired. However, -+ * this is a little imprecise, because -+ * budget_timeout is set to jiffies if bfqq -+ * not only expires, but also remains with no -+ * request. -+ */ -+ bfqq->last_wr_start_finish += jiffies - -+ max_t(unsigned long, bfqq->last_wr_start_finish, -+ bfqq->budget_timeout); -+ if (time_is_after_jiffies(bfqq->last_wr_start_finish)) { -+ pr_crit( -+ "BFQ WARNING:last %lu budget %lu jiffies %lu", -+ bfqq->last_wr_start_finish, -+ bfqq->budget_timeout, -+ jiffies); -+ pr_crit("diff %lu", jiffies - -+ max_t(unsigned long, -+ bfqq->last_wr_start_finish, -+ bfqq->budget_timeout)); -+ bfqq->last_wr_start_finish = jiffies; -+ } -+ } -+ -+ bfq_set_budget_timeout(bfqd, bfqq); -+ bfq_log_bfqq(bfqd, bfqq, -+ "set_in_service_queue, cur-budget = %d", -+ bfqq->entity.budget); -+ } else -+ bfq_log(bfqd, "set_in_service_queue: NULL"); -+ -+ bfqd->in_service_queue = bfqq; -+} -+ -+/* -+ * Get and set a new queue for service. -+ */ -+static struct bfq_queue *bfq_set_in_service_queue(struct bfq_data *bfqd) -+{ -+ struct bfq_queue *bfqq = bfq_get_next_queue(bfqd); -+ -+ __bfq_set_in_service_queue(bfqd, bfqq); -+ return bfqq; -+} -+ -+static void bfq_arm_slice_timer(struct bfq_data *bfqd) -+{ -+ struct bfq_queue *bfqq = bfqd->in_service_queue; -+ struct bfq_io_cq *bic; -+ u32 sl; -+ -+ BUG_ON(!RB_EMPTY_ROOT(&bfqq->sort_list)); -+ -+ /* Processes have exited, don't wait. */ -+ bic = bfqd->in_service_bic; -+ if (!bic || atomic_read(&bic->icq.ioc->active_ref) == 0) -+ return; -+ -+ bfq_mark_bfqq_wait_request(bfqq); -+ -+ /* -+ * We don't want to idle for seeks, but we do want to allow -+ * fair distribution of slice time for a process doing back-to-back -+ * seeks. So allow a little bit of time for him to submit a new rq. -+ * -+ * To prevent processes with (partly) seeky workloads from -+ * being too ill-treated, grant them a small fraction of the -+ * assigned budget before reducing the waiting time to -+ * BFQ_MIN_TT. This happened to help reduce latency. -+ */ -+ sl = bfqd->bfq_slice_idle; -+ /* -+ * Unless the queue is being weight-raised or the scenario is -+ * asymmetric, grant only minimum idle time if the queue -+ * is seeky. A long idling is preserved for a weight-raised -+ * queue, or, more in general, in an asymemtric scenario, -+ * because a long idling is needed for guaranteeing to a queue -+ * its reserved share of the throughput (in particular, it is -+ * needed if the queue has a higher weight than some other -+ * queue). -+ */ -+ if (BFQQ_SEEKY(bfqq) && bfqq->wr_coeff == 1 && -+ bfq_symmetric_scenario(bfqd)) -+ sl = min_t(u32, sl, BFQ_MIN_TT); -+ -+ bfqd->last_idling_start = ktime_get(); -+ hrtimer_start(&bfqd->idle_slice_timer, ns_to_ktime(sl), -+ HRTIMER_MODE_REL); -+ bfqg_stats_set_start_idle_time(bfqq_group(bfqq)); -+ bfq_log(bfqd, "arm idle: %ld/%ld ms", -+ sl / NSEC_PER_MSEC, bfqd->bfq_slice_idle / NSEC_PER_MSEC); -+} -+ -+/* -+ * In autotuning mode, max_budget is dynamically recomputed as the -+ * amount of sectors transferred in timeout at the estimated peak -+ * rate. This enables BFQ to utilize a full timeslice with a full -+ * budget, even if the in-service queue is served at peak rate. And -+ * this maximises throughput with sequential workloads. -+ */ -+static unsigned long bfq_calc_max_budget(struct bfq_data *bfqd) -+{ -+ return (u64)bfqd->peak_rate * USEC_PER_MSEC * -+ jiffies_to_msecs(bfqd->bfq_timeout)>>BFQ_RATE_SHIFT; -+} -+ -+/* -+ * Update parameters related to throughput and responsiveness, as a -+ * function of the estimated peak rate. See comments on -+ * bfq_calc_max_budget(), and on T_slow and T_fast arrays. -+ */ -+void update_thr_responsiveness_params(struct bfq_data *bfqd) -+{ -+ int dev_type = blk_queue_nonrot(bfqd->queue); -+ -+ if (bfqd->bfq_user_max_budget == 0) { -+ bfqd->bfq_max_budget = -+ bfq_calc_max_budget(bfqd); -+ BUG_ON(bfqd->bfq_max_budget < 0); -+ bfq_log(bfqd, "new max_budget = %d", -+ bfqd->bfq_max_budget); -+ } -+ -+ if (bfqd->device_speed == BFQ_BFQD_FAST && -+ bfqd->peak_rate < device_speed_thresh[dev_type]) { -+ bfqd->device_speed = BFQ_BFQD_SLOW; -+ bfqd->RT_prod = R_slow[dev_type] * -+ T_slow[dev_type]; -+ } else if (bfqd->device_speed == BFQ_BFQD_SLOW && -+ bfqd->peak_rate > device_speed_thresh[dev_type]) { -+ bfqd->device_speed = BFQ_BFQD_FAST; -+ bfqd->RT_prod = R_fast[dev_type] * -+ T_fast[dev_type]; -+ } -+ -+ bfq_log(bfqd, -+"dev_type %s dev_speed_class = %s (%llu sects/sec), thresh %llu setcs/sec", -+ dev_type == 0 ? "ROT" : "NONROT", -+ bfqd->device_speed == BFQ_BFQD_FAST ? "FAST" : "SLOW", -+ bfqd->device_speed == BFQ_BFQD_FAST ? -+ (USEC_PER_SEC*(u64)R_fast[dev_type])>>BFQ_RATE_SHIFT : -+ (USEC_PER_SEC*(u64)R_slow[dev_type])>>BFQ_RATE_SHIFT, -+ (USEC_PER_SEC*(u64)device_speed_thresh[dev_type])>> -+ BFQ_RATE_SHIFT); -+} -+ -+void bfq_reset_rate_computation(struct bfq_data *bfqd, struct request *rq) -+{ -+ if (rq != NULL) { /* new rq dispatch now, reset accordingly */ -+ bfqd->last_dispatch = bfqd->first_dispatch = ktime_get_ns() ; -+ bfqd->peak_rate_samples = 1; -+ bfqd->sequential_samples = 0; -+ bfqd->tot_sectors_dispatched = bfqd->last_rq_max_size = -+ blk_rq_sectors(rq); -+ } else /* no new rq dispatched, just reset the number of samples */ -+ bfqd->peak_rate_samples = 0; /* full re-init on next disp. */ -+ -+ bfq_log(bfqd, -+ "reset_rate_computation at end, sample %u/%u tot_sects %llu", -+ bfqd->peak_rate_samples, bfqd->sequential_samples, -+ bfqd->tot_sectors_dispatched); -+} -+ -+void bfq_update_rate_reset(struct bfq_data *bfqd, struct request *rq) -+{ -+ u32 rate, weight, divisor; -+ -+ /* -+ * For the convergence property to hold (see comments on -+ * bfq_update_peak_rate()) and for the assessment to be -+ * reliable, a minimum number of samples must be present, and -+ * a minimum amount of time must have elapsed. If not so, do -+ * not compute new rate. Just reset parameters, to get ready -+ * for a new evaluation attempt. -+ */ -+ if (bfqd->peak_rate_samples < BFQ_RATE_MIN_SAMPLES || -+ bfqd->delta_from_first < BFQ_RATE_MIN_INTERVAL) { -+ bfq_log(bfqd, -+ "update_rate_reset: only resetting, delta_first %lluus samples %d", -+ bfqd->delta_from_first>>10, bfqd->peak_rate_samples); -+ goto reset_computation; -+ } -+ -+ /* -+ * If a new request completion has occurred after last -+ * dispatch, then, to approximate the rate at which requests -+ * have been served by the device, it is more precise to -+ * extend the observation interval to the last completion. -+ */ -+ bfqd->delta_from_first = -+ max_t(u64, bfqd->delta_from_first, -+ bfqd->last_completion - bfqd->first_dispatch); -+ -+ BUG_ON(bfqd->delta_from_first == 0); -+ /* -+ * Rate computed in sects/usec, and not sects/nsec, for -+ * precision issues. -+ */ -+ rate = div64_ul(bfqd->tot_sectors_dispatched<delta_from_first, NSEC_PER_USEC)); -+ -+ bfq_log(bfqd, -+"update_rate_reset: tot_sects %llu delta_first %lluus rate %llu sects/s (%d)", -+ bfqd->tot_sectors_dispatched, bfqd->delta_from_first>>10, -+ ((USEC_PER_SEC*(u64)rate)>>BFQ_RATE_SHIFT), -+ rate > 20< 20M sectors/sec) -+ */ -+ if ((bfqd->peak_rate_samples > (3 * bfqd->sequential_samples)>>2 && -+ rate <= bfqd->peak_rate) || -+ rate > 20<peak_rate_samples, bfqd->sequential_samples, -+ ((USEC_PER_SEC*(u64)rate)>>BFQ_RATE_SHIFT), -+ ((USEC_PER_SEC*(u64)bfqd->peak_rate)>>BFQ_RATE_SHIFT)); -+ goto reset_computation; -+ } else { -+ bfq_log(bfqd, -+ "update_rate_reset: do update, samples %u/%u rate/peak %llu/%llu", -+ bfqd->peak_rate_samples, bfqd->sequential_samples, -+ ((USEC_PER_SEC*(u64)rate)>>BFQ_RATE_SHIFT), -+ ((USEC_PER_SEC*(u64)bfqd->peak_rate)>>BFQ_RATE_SHIFT)); -+ } -+ -+ /* -+ * We have to update the peak rate, at last! To this purpose, -+ * we use a low-pass filter. We compute the smoothing constant -+ * of the filter as a function of the 'weight' of the new -+ * measured rate. -+ * -+ * As can be seen in next formulas, we define this weight as a -+ * quantity proportional to how sequential the workload is, -+ * and to how long the observation time interval is. -+ * -+ * The weight runs from 0 to 8. The maximum value of the -+ * weight, 8, yields the minimum value for the smoothing -+ * constant. At this minimum value for the smoothing constant, -+ * the measured rate contributes for half of the next value of -+ * the estimated peak rate. -+ * -+ * So, the first step is to compute the weight as a function -+ * of how sequential the workload is. Note that the weight -+ * cannot reach 9, because bfqd->sequential_samples cannot -+ * become equal to bfqd->peak_rate_samples, which, in its -+ * turn, holds true because bfqd->sequential_samples is not -+ * incremented for the first sample. -+ */ -+ weight = (9 * bfqd->sequential_samples) / bfqd->peak_rate_samples; -+ -+ /* -+ * Second step: further refine the weight as a function of the -+ * duration of the observation interval. -+ */ -+ weight = min_t(u32, 8, -+ div_u64(weight * bfqd->delta_from_first, -+ BFQ_RATE_REF_INTERVAL)); -+ -+ /* -+ * Divisor ranging from 10, for minimum weight, to 2, for -+ * maximum weight. -+ */ -+ divisor = 10 - weight; -+ BUG_ON(divisor == 0); -+ -+ /* -+ * Finally, update peak rate: -+ * -+ * peak_rate = peak_rate * (divisor-1) / divisor + rate / divisor -+ */ -+ bfqd->peak_rate *= divisor-1; -+ bfqd->peak_rate /= divisor; -+ rate /= divisor; /* smoothing constant alpha = 1/divisor */ -+ -+ bfq_log(bfqd, -+ "update_rate_reset: divisor %d tmp_peak_rate %llu tmp_rate %u", -+ divisor, -+ ((USEC_PER_SEC*(u64)bfqd->peak_rate)>>BFQ_RATE_SHIFT), -+ (u32)((USEC_PER_SEC*(u64)rate)>>BFQ_RATE_SHIFT)); -+ -+ BUG_ON(bfqd->peak_rate == 0); -+ BUG_ON(bfqd->peak_rate > 20<peak_rate += rate; -+ update_thr_responsiveness_params(bfqd); -+ BUG_ON(bfqd->peak_rate > 20<peak_rate_samples == 0) { /* first dispatch */ -+ bfq_log(bfqd, -+ "update_peak_rate: goto reset, samples %d", -+ bfqd->peak_rate_samples) ; -+ bfq_reset_rate_computation(bfqd, rq); -+ goto update_last_values; /* will add one sample */ -+ } -+ -+ /* -+ * Device idle for very long: the observation interval lasting -+ * up to this dispatch cannot be a valid observation interval -+ * for computing a new peak rate (similarly to the late- -+ * completion event in bfq_completed_request()). Go to -+ * update_rate_and_reset to have the following three steps -+ * taken: -+ * - close the observation interval at the last (previous) -+ * request dispatch or completion -+ * - compute rate, if possible, for that observation interval -+ * - start a new observation interval with this dispatch -+ */ -+ if (now_ns - bfqd->last_dispatch > 100*NSEC_PER_MSEC && -+ bfqd->rq_in_driver == 0) { -+ bfq_log(bfqd, -+"update_peak_rate: jumping to updating&resetting delta_last %lluus samples %d", -+ (now_ns - bfqd->last_dispatch)>>10, -+ bfqd->peak_rate_samples) ; -+ goto update_rate_and_reset; -+ } -+ -+ /* Update sampling information */ -+ bfqd->peak_rate_samples++; -+ -+ if ((bfqd->rq_in_driver > 0 || -+ now_ns - bfqd->last_completion < BFQ_MIN_TT) -+ && get_sdist(bfqd->last_position, rq) < BFQQ_SEEK_THR) -+ bfqd->sequential_samples++; -+ -+ bfqd->tot_sectors_dispatched += blk_rq_sectors(rq); -+ -+ /* Reset max observed rq size every 32 dispatches */ -+ if (likely(bfqd->peak_rate_samples % 32)) -+ bfqd->last_rq_max_size = -+ max_t(u32, blk_rq_sectors(rq), bfqd->last_rq_max_size); -+ else -+ bfqd->last_rq_max_size = blk_rq_sectors(rq); -+ -+ bfqd->delta_from_first = now_ns - bfqd->first_dispatch; -+ -+ bfq_log(bfqd, -+ "update_peak_rate: added samples %u/%u tot_sects %llu delta_first %lluus", -+ bfqd->peak_rate_samples, bfqd->sequential_samples, -+ bfqd->tot_sectors_dispatched, -+ bfqd->delta_from_first>>10); -+ -+ /* Target observation interval not yet reached, go on sampling */ -+ if (bfqd->delta_from_first < BFQ_RATE_REF_INTERVAL) -+ goto update_last_values; -+ -+update_rate_and_reset: -+ bfq_update_rate_reset(bfqd, rq); -+update_last_values: -+ bfqd->last_position = blk_rq_pos(rq) + blk_rq_sectors(rq); -+ bfqd->last_dispatch = now_ns; -+ -+ bfq_log(bfqd, -+ "update_peak_rate: delta_first %lluus last_pos %llu peak_rate %llu", -+ (now_ns - bfqd->first_dispatch)>>10, -+ (unsigned long long) bfqd->last_position, -+ ((USEC_PER_SEC*(u64)bfqd->peak_rate)>>BFQ_RATE_SHIFT)); -+ bfq_log(bfqd, -+ "update_peak_rate: samples at end %d", bfqd->peak_rate_samples); -+} -+ -+/* -+ * Move request from internal lists to the dispatch list of the request queue -+ */ -+static void bfq_dispatch_insert(struct request_queue *q, struct request *rq) -+{ -+ struct bfq_queue *bfqq = RQ_BFQQ(rq); -+ -+ /* -+ * For consistency, the next instruction should have been executed -+ * after removing the request from the queue and dispatching it. -+ * We execute instead this instruction before bfq_remove_request() -+ * (and hence introduce a temporary inconsistency), for efficiency. -+ * In fact, in a forced_dispatch, this prevents two counters related -+ * to bfqq->dispatched to risk to be uselessly decremented if bfqq -+ * is not in service, and then to be incremented again after -+ * incrementing bfqq->dispatched. -+ */ -+ bfqq->dispatched++; -+ bfq_update_peak_rate(q->elevator->elevator_data, rq); -+ -+ bfq_remove_request(rq); -+ elv_dispatch_sort(q, rq); -+} -+ -+/* -+ * Return expired entry, or NULL to just start from scratch in rbtree. -+ */ -+static struct request *bfq_check_fifo(struct bfq_queue *bfqq) -+{ -+ struct request *rq = NULL; -+ -+ if (bfq_bfqq_fifo_expire(bfqq)) -+ return NULL; -+ -+ bfq_mark_bfqq_fifo_expire(bfqq); -+ -+ if (list_empty(&bfqq->fifo)) -+ return NULL; -+ -+ rq = rq_entry_fifo(bfqq->fifo.next); -+ -+ if (ktime_get_ns() < rq->fifo_time) -+ return NULL; -+ -+ return rq; -+} -+ -+static void __bfq_bfqq_expire(struct bfq_data *bfqd, struct bfq_queue *bfqq) -+{ -+ BUG_ON(bfqq != bfqd->in_service_queue); -+ -+ __bfq_bfqd_reset_in_service(bfqd); -+ -+ /* -+ * If this bfqq is shared between multiple processes, check -+ * to make sure that those processes are still issuing I/Os -+ * within the mean seek distance. If not, it may be time to -+ * break the queues apart again. -+ */ -+ if (bfq_bfqq_coop(bfqq) && BFQQ_SEEKY(bfqq)) -+ bfq_mark_bfqq_split_coop(bfqq); -+ -+ if (RB_EMPTY_ROOT(&bfqq->sort_list)) { -+ if (bfqq->dispatched == 0) -+ /* -+ * Overloading budget_timeout field to store -+ * the time at which the queue remains with no -+ * backlog and no outstanding request; used by -+ * the weight-raising mechanism. -+ */ -+ bfqq->budget_timeout = jiffies; -+ -+ bfq_del_bfqq_busy(bfqd, bfqq, 1); -+ } else { -+ bfq_activate_bfqq(bfqd, bfqq); -+ /* -+ * Resort priority tree of potential close cooperators. -+ */ -+ bfq_pos_tree_add_move(bfqd, bfqq); -+ } -+} -+ -+/** -+ * __bfq_bfqq_recalc_budget - try to adapt the budget to the @bfqq behavior. -+ * @bfqd: device data. -+ * @bfqq: queue to update. -+ * @reason: reason for expiration. -+ * -+ * Handle the feedback on @bfqq budget at queue expiration. -+ * See the body for detailed comments. -+ */ -+static void __bfq_bfqq_recalc_budget(struct bfq_data *bfqd, -+ struct bfq_queue *bfqq, -+ enum bfqq_expiration reason) -+{ -+ struct request *next_rq; -+ int budget, min_budget; -+ -+ BUG_ON(bfqq != bfqd->in_service_queue); -+ -+ min_budget = bfq_min_budget(bfqd); -+ -+ if (bfqq->wr_coeff == 1) -+ budget = bfqq->max_budget; -+ else /* -+ * Use a constant, low budget for weight-raised queues, -+ * to help achieve a low latency. Keep it slightly higher -+ * than the minimum possible budget, to cause a little -+ * bit fewer expirations. -+ */ -+ budget = 2 * min_budget; -+ -+ bfq_log_bfqq(bfqd, bfqq, "recalc_budg: last budg %d, budg left %d", -+ bfqq->entity.budget, bfq_bfqq_budget_left(bfqq)); -+ bfq_log_bfqq(bfqd, bfqq, "recalc_budg: last max_budg %d, min budg %d", -+ budget, bfq_min_budget(bfqd)); -+ bfq_log_bfqq(bfqd, bfqq, "recalc_budg: sync %d, seeky %d", -+ bfq_bfqq_sync(bfqq), BFQQ_SEEKY(bfqd->in_service_queue)); -+ -+ if (bfq_bfqq_sync(bfqq) && bfqq->wr_coeff == 1) { -+ switch (reason) { -+ /* -+ * Caveat: in all the following cases we trade latency -+ * for throughput. -+ */ -+ case BFQ_BFQQ_TOO_IDLE: -+ /* -+ * This is the only case where we may reduce -+ * the budget: if there is no request of the -+ * process still waiting for completion, then -+ * we assume (tentatively) that the timer has -+ * expired because the batch of requests of -+ * the process could have been served with a -+ * smaller budget. Hence, betting that -+ * process will behave in the same way when it -+ * becomes backlogged again, we reduce its -+ * next budget. As long as we guess right, -+ * this budget cut reduces the latency -+ * experienced by the process. -+ * -+ * However, if there are still outstanding -+ * requests, then the process may have not yet -+ * issued its next request just because it is -+ * still waiting for the completion of some of -+ * the still outstanding ones. So in this -+ * subcase we do not reduce its budget, on the -+ * contrary we increase it to possibly boost -+ * the throughput, as discussed in the -+ * comments to the BUDGET_TIMEOUT case. -+ */ -+ if (bfqq->dispatched > 0) /* still outstanding reqs */ -+ budget = min(budget * 2, bfqd->bfq_max_budget); -+ else { -+ if (budget > 5 * min_budget) -+ budget -= 4 * min_budget; -+ else -+ budget = min_budget; -+ } -+ break; -+ case BFQ_BFQQ_BUDGET_TIMEOUT: -+ /* -+ * We double the budget here because it gives -+ * the chance to boost the throughput if this -+ * is not a seeky process (and has bumped into -+ * this timeout because of, e.g., ZBR). -+ */ -+ budget = min(budget * 2, bfqd->bfq_max_budget); -+ break; -+ case BFQ_BFQQ_BUDGET_EXHAUSTED: -+ /* -+ * The process still has backlog, and did not -+ * let either the budget timeout or the disk -+ * idling timeout expire. Hence it is not -+ * seeky, has a short thinktime and may be -+ * happy with a higher budget too. So -+ * definitely increase the budget of this good -+ * candidate to boost the disk throughput. -+ */ -+ budget = min(budget * 4, bfqd->bfq_max_budget); -+ break; -+ case BFQ_BFQQ_NO_MORE_REQUESTS: -+ /* -+ * For queues that expire for this reason, it -+ * is particularly important to keep the -+ * budget close to the actual service they -+ * need. Doing so reduces the timestamp -+ * misalignment problem described in the -+ * comments in the body of -+ * __bfq_activate_entity. In fact, suppose -+ * that a queue systematically expires for -+ * BFQ_BFQQ_NO_MORE_REQUESTS and presents a -+ * new request in time to enjoy timestamp -+ * back-shifting. The larger the budget of the -+ * queue is with respect to the service the -+ * queue actually requests in each service -+ * slot, the more times the queue can be -+ * reactivated with the same virtual finish -+ * time. It follows that, even if this finish -+ * time is pushed to the system virtual time -+ * to reduce the consequent timestamp -+ * misalignment, the queue unjustly enjoys for -+ * many re-activations a lower finish time -+ * than all newly activated queues. -+ * -+ * The service needed by bfqq is measured -+ * quite precisely by bfqq->entity.service. -+ * Since bfqq does not enjoy device idling, -+ * bfqq->entity.service is equal to the number -+ * of sectors that the process associated with -+ * bfqq requested to read/write before waiting -+ * for request completions, or blocking for -+ * other reasons. -+ */ -+ budget = max_t(int, bfqq->entity.service, min_budget); -+ break; -+ default: -+ return; -+ } -+ } else if (!bfq_bfqq_sync(bfqq)) -+ /* -+ * Async queues get always the maximum possible -+ * budget, as for them we do not care about latency -+ * (in addition, their ability to dispatch is limited -+ * by the charging factor). -+ */ -+ budget = bfqd->bfq_max_budget; -+ -+ bfqq->max_budget = budget; -+ -+ if (bfqd->budgets_assigned >= bfq_stats_min_budgets && -+ !bfqd->bfq_user_max_budget) -+ bfqq->max_budget = min(bfqq->max_budget, bfqd->bfq_max_budget); -+ -+ /* -+ * If there is still backlog, then assign a new budget, making -+ * sure that it is large enough for the next request. Since -+ * the finish time of bfqq must be kept in sync with the -+ * budget, be sure to call __bfq_bfqq_expire() *after* this -+ * update. -+ * -+ * If there is no backlog, then no need to update the budget; -+ * it will be updated on the arrival of a new request. -+ */ -+ next_rq = bfqq->next_rq; -+ if (next_rq) { -+ BUG_ON(reason == BFQ_BFQQ_TOO_IDLE || -+ reason == BFQ_BFQQ_NO_MORE_REQUESTS); -+ bfqq->entity.budget = max_t(unsigned long, bfqq->max_budget, -+ bfq_serv_to_charge(next_rq, bfqq)); -+ BUG_ON(!bfq_bfqq_busy(bfqq)); -+ BUG_ON(RB_EMPTY_ROOT(&bfqq->sort_list)); -+ } -+ -+ bfq_log_bfqq(bfqd, bfqq, "head sect: %u, new budget %d", -+ next_rq ? blk_rq_sectors(next_rq) : 0, -+ bfqq->entity.budget); -+} -+ -+/* -+ * Return true if the process associated with bfqq is "slow". The slow -+ * flag is used, in addition to the budget timeout, to reduce the -+ * amount of service provided to seeky processes, and thus reduce -+ * their chances to lower the throughput. More details in the comments -+ * on the function bfq_bfqq_expire(). -+ * -+ * An important observation is in order: as discussed in the comments -+ * on the function bfq_update_peak_rate(), with devices with internal -+ * queues, it is hard if ever possible to know when and for how long -+ * an I/O request is processed by the device (apart from the trivial -+ * I/O pattern where a new request is dispatched only after the -+ * previous one has been completed). This makes it hard to evaluate -+ * the real rate at which the I/O requests of each bfq_queue are -+ * served. In fact, for an I/O scheduler like BFQ, serving a -+ * bfq_queue means just dispatching its requests during its service -+ * slot (i.e., until the budget of the queue is exhausted, or the -+ * queue remains idle, or, finally, a timeout fires). But, during the -+ * service slot of a bfq_queue, around 100 ms at most, the device may -+ * be even still processing requests of bfq_queues served in previous -+ * service slots. On the opposite end, the requests of the in-service -+ * bfq_queue may be completed after the service slot of the queue -+ * finishes. -+ * -+ * Anyway, unless more sophisticated solutions are used -+ * (where possible), the sum of the sizes of the requests dispatched -+ * during the service slot of a bfq_queue is probably the only -+ * approximation available for the service received by the bfq_queue -+ * during its service slot. And this sum is the quantity used in this -+ * function to evaluate the I/O speed of a process. -+ */ -+static bool bfq_bfqq_is_slow(struct bfq_data *bfqd, struct bfq_queue *bfqq, -+ bool compensate, enum bfqq_expiration reason, -+ unsigned long *delta_ms) -+{ -+ ktime_t delta_ktime; -+ u32 delta_usecs; -+ bool slow = BFQQ_SEEKY(bfqq); /* if delta too short, use seekyness */ -+ -+ if (!bfq_bfqq_sync(bfqq)) -+ return false; -+ -+ if (compensate) -+ delta_ktime = bfqd->last_idling_start; -+ else -+ delta_ktime = ktime_get(); -+ delta_ktime = ktime_sub(delta_ktime, bfqd->last_budget_start); -+ delta_usecs = ktime_to_us(delta_ktime); -+ -+ /* don't trust short/unrealistic values. */ -+ if (delta_usecs < 1000 || delta_usecs >= LONG_MAX) { -+ if (blk_queue_nonrot(bfqd->queue)) -+ /* -+ * give same worst-case guarantees as idling -+ * for seeky -+ */ -+ *delta_ms = BFQ_MIN_TT / NSEC_PER_MSEC; -+ else /* charge at least one seek */ -+ *delta_ms = bfq_slice_idle / NSEC_PER_MSEC; -+ -+ bfq_log(bfqd, "bfq_bfqq_is_slow: unrealistic %u", delta_usecs); -+ -+ return slow; -+ } -+ -+ *delta_ms = delta_usecs / USEC_PER_MSEC; -+ -+ /* -+ * Use only long (> 20ms) intervals to filter out excessive -+ * spikes in service rate estimation. -+ */ -+ if (delta_usecs > 20000) { -+ /* -+ * Caveat for rotational devices: processes doing I/O -+ * in the slower disk zones tend to be slow(er) even -+ * if not seeky. In this respect, the estimated peak -+ * rate is likely to be an average over the disk -+ * surface. Accordingly, to not be too harsh with -+ * unlucky processes, a process is deemed slow only if -+ * its rate has been lower than half of the estimated -+ * peak rate. -+ */ -+ slow = bfqq->entity.service < bfqd->bfq_max_budget / 2; -+ bfq_log(bfqd, "bfq_bfqq_is_slow: relative rate %d/%d", -+ bfqq->entity.service, bfqd->bfq_max_budget); -+ } -+ -+ bfq_log_bfqq(bfqd, bfqq, "bfq_bfqq_is_slow: slow %d", slow); -+ -+ return slow; -+} -+ -+/* -+ * To be deemed as soft real-time, an application must meet two -+ * requirements. First, the application must not require an average -+ * bandwidth higher than the approximate bandwidth required to playback or -+ * record a compressed high-definition video. -+ * The next function is invoked on the completion of the last request of a -+ * batch, to compute the next-start time instant, soft_rt_next_start, such -+ * that, if the next request of the application does not arrive before -+ * soft_rt_next_start, then the above requirement on the bandwidth is met. -+ * -+ * The second requirement is that the request pattern of the application is -+ * isochronous, i.e., that, after issuing a request or a batch of requests, -+ * the application stops issuing new requests until all its pending requests -+ * have been completed. After that, the application may issue a new batch, -+ * and so on. -+ * For this reason the next function is invoked to compute -+ * soft_rt_next_start only for applications that meet this requirement, -+ * whereas soft_rt_next_start is set to infinity for applications that do -+ * not. -+ * -+ * Unfortunately, even a greedy application may happen to behave in an -+ * isochronous way if the CPU load is high. In fact, the application may -+ * stop issuing requests while the CPUs are busy serving other processes, -+ * then restart, then stop again for a while, and so on. In addition, if -+ * the disk achieves a low enough throughput with the request pattern -+ * issued by the application (e.g., because the request pattern is random -+ * and/or the device is slow), then the application may meet the above -+ * bandwidth requirement too. To prevent such a greedy application to be -+ * deemed as soft real-time, a further rule is used in the computation of -+ * soft_rt_next_start: soft_rt_next_start must be higher than the current -+ * time plus the maximum time for which the arrival of a request is waited -+ * for when a sync queue becomes idle, namely bfqd->bfq_slice_idle. -+ * This filters out greedy applications, as the latter issue instead their -+ * next request as soon as possible after the last one has been completed -+ * (in contrast, when a batch of requests is completed, a soft real-time -+ * application spends some time processing data). -+ * -+ * Unfortunately, the last filter may easily generate false positives if -+ * only bfqd->bfq_slice_idle is used as a reference time interval and one -+ * or both the following cases occur: -+ * 1) HZ is so low that the duration of a jiffy is comparable to or higher -+ * than bfqd->bfq_slice_idle. This happens, e.g., on slow devices with -+ * HZ=100. -+ * 2) jiffies, instead of increasing at a constant rate, may stop increasing -+ * for a while, then suddenly 'jump' by several units to recover the lost -+ * increments. This seems to happen, e.g., inside virtual machines. -+ * To address this issue, we do not use as a reference time interval just -+ * bfqd->bfq_slice_idle, but bfqd->bfq_slice_idle plus a few jiffies. In -+ * particular we add the minimum number of jiffies for which the filter -+ * seems to be quite precise also in embedded systems and KVM/QEMU virtual -+ * machines. -+ */ -+static unsigned long bfq_bfqq_softrt_next_start(struct bfq_data *bfqd, -+ struct bfq_queue *bfqq) -+{ -+ bfq_log_bfqq(bfqd, bfqq, -+"softrt_next_start: service_blkg %lu soft_rate %u sects/sec interval %u", -+ bfqq->service_from_backlogged, -+ bfqd->bfq_wr_max_softrt_rate, -+ jiffies_to_msecs(HZ * bfqq->service_from_backlogged / -+ bfqd->bfq_wr_max_softrt_rate)); -+ -+ return max(bfqq->last_idle_bklogged + -+ HZ * bfqq->service_from_backlogged / -+ bfqd->bfq_wr_max_softrt_rate, -+ jiffies + nsecs_to_jiffies(bfqq->bfqd->bfq_slice_idle) + 4); -+} -+ -+/* -+ * Return the farthest future time instant according to jiffies -+ * macros. -+ */ -+static unsigned long bfq_greatest_from_now(void) -+{ -+ return jiffies + MAX_JIFFY_OFFSET; -+} -+ -+/* -+ * Return the farthest past time instant according to jiffies -+ * macros. -+ */ -+static unsigned long bfq_smallest_from_now(void) -+{ -+ return jiffies - MAX_JIFFY_OFFSET; -+} -+ -+/** -+ * bfq_bfqq_expire - expire a queue. -+ * @bfqd: device owning the queue. -+ * @bfqq: the queue to expire. -+ * @compensate: if true, compensate for the time spent idling. -+ * @reason: the reason causing the expiration. -+ * -+ * If the process associated with bfqq does slow I/O (e.g., because it -+ * issues random requests), we charge bfqq with the time it has been -+ * in service instead of the service it has received (see -+ * bfq_bfqq_charge_time for details on how this goal is achieved). As -+ * a consequence, bfqq will typically get higher timestamps upon -+ * reactivation, and hence it will be rescheduled as if it had -+ * received more service than what it has actually received. In the -+ * end, bfqq receives less service in proportion to how slowly its -+ * associated process consumes its budgets (and hence how seriously it -+ * tends to lower the throughput). In addition, this time-charging -+ * strategy guarantees time fairness among slow processes. In -+ * contrast, if the process associated with bfqq is not slow, we -+ * charge bfqq exactly with the service it has received. -+ * -+ * Charging time to the first type of queues and the exact service to -+ * the other has the effect of using the WF2Q+ policy to schedule the -+ * former on a timeslice basis, without violating service domain -+ * guarantees among the latter. -+ */ -+static void bfq_bfqq_expire(struct bfq_data *bfqd, -+ struct bfq_queue *bfqq, -+ bool compensate, -+ enum bfqq_expiration reason) -+{ -+ bool slow; -+ unsigned long delta = 0; -+ struct bfq_entity *entity = &bfqq->entity; -+ -+ BUG_ON(bfqq != bfqd->in_service_queue); -+ -+ /* -+ * Check whether the process is slow (see bfq_bfqq_is_slow). -+ */ -+ slow = bfq_bfqq_is_slow(bfqd, bfqq, compensate, reason, &delta); -+ -+ /* -+ * Increase service_from_backlogged before next statement, -+ * because the possible next invocation of -+ * bfq_bfqq_charge_time would likely inflate -+ * entity->service. In contrast, service_from_backlogged must -+ * contain real service, to enable the soft real-time -+ * heuristic to correctly compute the bandwidth consumed by -+ * bfqq. -+ */ -+ bfqq->service_from_backlogged += entity->service; -+ -+ /* -+ * As above explained, charge slow (typically seeky) and -+ * timed-out queues with the time and not the service -+ * received, to favor sequential workloads. -+ * -+ * Processes doing I/O in the slower disk zones will tend to -+ * be slow(er) even if not seeky. Therefore, since the -+ * estimated peak rate is actually an average over the disk -+ * surface, these processes may timeout just for bad luck. To -+ * avoid punishing them, do not charge time to processes that -+ * succeeded in consuming at least 2/3 of their budget. This -+ * allows BFQ to preserve enough elasticity to still perform -+ * bandwidth, and not time, distribution with little unlucky -+ * or quasi-sequential processes. -+ */ -+ if (bfqq->wr_coeff == 1 && -+ (slow || -+ (reason == BFQ_BFQQ_BUDGET_TIMEOUT && -+ bfq_bfqq_budget_left(bfqq) >= entity->budget / 3))) -+ bfq_bfqq_charge_time(bfqd, bfqq, delta); -+ -+ BUG_ON(bfqq->entity.budget < bfqq->entity.service); -+ -+ if (reason == BFQ_BFQQ_TOO_IDLE && -+ entity->service <= 2 * entity->budget / 10) -+ bfq_clear_bfqq_IO_bound(bfqq); -+ -+ if (bfqd->low_latency && bfqq->wr_coeff == 1) -+ bfqq->last_wr_start_finish = jiffies; -+ -+ if (bfqd->low_latency && bfqd->bfq_wr_max_softrt_rate > 0 && -+ RB_EMPTY_ROOT(&bfqq->sort_list)) { -+ /* -+ * If we get here, and there are no outstanding -+ * requests, then the request pattern is isochronous -+ * (see the comments on the function -+ * bfq_bfqq_softrt_next_start()). Thus we can compute -+ * soft_rt_next_start. If, instead, the queue still -+ * has outstanding requests, then we have to wait for -+ * the completion of all the outstanding requests to -+ * discover whether the request pattern is actually -+ * isochronous. -+ */ -+ BUG_ON(bfqd->busy_queues < 1); -+ if (bfqq->dispatched == 0) { -+ bfqq->soft_rt_next_start = -+ bfq_bfqq_softrt_next_start(bfqd, bfqq); -+ bfq_log_bfqq(bfqd, bfqq, "new soft_rt_next %lu", -+ bfqq->soft_rt_next_start); -+ } else { -+ /* -+ * The application is still waiting for the -+ * completion of one or more requests: -+ * prevent it from possibly being incorrectly -+ * deemed as soft real-time by setting its -+ * soft_rt_next_start to infinity. In fact, -+ * without this assignment, the application -+ * would be incorrectly deemed as soft -+ * real-time if: -+ * 1) it issued a new request before the -+ * completion of all its in-flight -+ * requests, and -+ * 2) at that time, its soft_rt_next_start -+ * happened to be in the past. -+ */ -+ bfqq->soft_rt_next_start = -+ bfq_greatest_from_now(); -+ /* -+ * Schedule an update of soft_rt_next_start to when -+ * the task may be discovered to be isochronous. -+ */ -+ bfq_mark_bfqq_softrt_update(bfqq); -+ } -+ } -+ -+ bfq_log_bfqq(bfqd, bfqq, -+ "expire (%d, slow %d, num_disp %d, idle_win %d, weight %d)", -+ reason, slow, bfqq->dispatched, -+ bfq_bfqq_idle_window(bfqq), entity->weight); -+ -+ /* -+ * Increase, decrease or leave budget unchanged according to -+ * reason. -+ */ -+ BUG_ON(bfqq->entity.budget < bfqq->entity.service); -+ __bfq_bfqq_recalc_budget(bfqd, bfqq, reason); -+ BUG_ON(bfqq->next_rq == NULL && -+ bfqq->entity.budget < bfqq->entity.service); -+ __bfq_bfqq_expire(bfqd, bfqq); -+ -+ BUG_ON(!bfq_bfqq_busy(bfqq) && reason == BFQ_BFQQ_BUDGET_EXHAUSTED && -+ !bfq_class_idle(bfqq)); -+ -+ if (!bfq_bfqq_busy(bfqq) && -+ reason != BFQ_BFQQ_BUDGET_TIMEOUT && -+ reason != BFQ_BFQQ_BUDGET_EXHAUSTED) -+ bfq_mark_bfqq_non_blocking_wait_rq(bfqq); -+} -+ -+/* -+ * Budget timeout is not implemented through a dedicated timer, but -+ * just checked on request arrivals and completions, as well as on -+ * idle timer expirations. -+ */ -+static bool bfq_bfqq_budget_timeout(struct bfq_queue *bfqq) -+{ -+ return time_is_before_eq_jiffies(bfqq->budget_timeout); -+} -+ -+/* -+ * If we expire a queue that is actively waiting (i.e., with the -+ * device idled) for the arrival of a new request, then we may incur -+ * the timestamp misalignment problem described in the body of the -+ * function __bfq_activate_entity. Hence we return true only if this -+ * condition does not hold, or if the queue is slow enough to deserve -+ * only to be kicked off for preserving a high throughput. -+ */ -+static bool bfq_may_expire_for_budg_timeout(struct bfq_queue *bfqq) -+{ -+ bfq_log_bfqq(bfqq->bfqd, bfqq, -+ "may_budget_timeout: wait_request %d left %d timeout %d", -+ bfq_bfqq_wait_request(bfqq), -+ bfq_bfqq_budget_left(bfqq) >= bfqq->entity.budget / 3, -+ bfq_bfqq_budget_timeout(bfqq)); -+ -+ return (!bfq_bfqq_wait_request(bfqq) || -+ bfq_bfqq_budget_left(bfqq) >= bfqq->entity.budget / 3) -+ && -+ bfq_bfqq_budget_timeout(bfqq); -+} -+ -+/* -+ * For a queue that becomes empty, device idling is allowed only if -+ * this function returns true for that queue. As a consequence, since -+ * device idling plays a critical role for both throughput boosting -+ * and service guarantees, the return value of this function plays a -+ * critical role as well. -+ * -+ * In a nutshell, this function returns true only if idling is -+ * beneficial for throughput or, even if detrimental for throughput, -+ * idling is however necessary to preserve service guarantees (low -+ * latency, desired throughput distribution, ...). In particular, on -+ * NCQ-capable devices, this function tries to return false, so as to -+ * help keep the drives' internal queues full, whenever this helps the -+ * device boost the throughput without causing any service-guarantee -+ * issue. -+ * -+ * In more detail, the return value of this function is obtained by, -+ * first, computing a number of boolean variables that take into -+ * account throughput and service-guarantee issues, and, then, -+ * combining these variables in a logical expression. Most of the -+ * issues taken into account are not trivial. We discuss these issues -+ * while introducing the variables. -+ */ -+static bool bfq_bfqq_may_idle(struct bfq_queue *bfqq) -+{ -+ struct bfq_data *bfqd = bfqq->bfqd; -+ bool idling_boosts_thr, idling_boosts_thr_without_issues, -+ idling_needed_for_service_guarantees, -+ asymmetric_scenario; -+ -+ if (bfqd->strict_guarantees) -+ return true; -+ -+ /* -+ * The next variable takes into account the cases where idling -+ * boosts the throughput. -+ * -+ * The value of the variable is computed considering, first, that -+ * idling is virtually always beneficial for the throughput if: -+ * (a) the device is not NCQ-capable, or -+ * (b) regardless of the presence of NCQ, the device is rotational -+ * and the request pattern for bfqq is I/O-bound and sequential. -+ * -+ * Secondly, and in contrast to the above item (b), idling an -+ * NCQ-capable flash-based device would not boost the -+ * throughput even with sequential I/O; rather it would lower -+ * the throughput in proportion to how fast the device -+ * is. Accordingly, the next variable is true if any of the -+ * above conditions (a) and (b) is true, and, in particular, -+ * happens to be false if bfqd is an NCQ-capable flash-based -+ * device. -+ */ -+ idling_boosts_thr = !bfqd->hw_tag || -+ (!blk_queue_nonrot(bfqd->queue) && bfq_bfqq_IO_bound(bfqq) && -+ bfq_bfqq_idle_window(bfqq)); -+ -+ /* -+ * The value of the next variable, -+ * idling_boosts_thr_without_issues, is equal to that of -+ * idling_boosts_thr, unless a special case holds. In this -+ * special case, described below, idling may cause problems to -+ * weight-raised queues. -+ * -+ * When the request pool is saturated (e.g., in the presence -+ * of write hogs), if the processes associated with -+ * non-weight-raised queues ask for requests at a lower rate, -+ * then processes associated with weight-raised queues have a -+ * higher probability to get a request from the pool -+ * immediately (or at least soon) when they need one. Thus -+ * they have a higher probability to actually get a fraction -+ * of the device throughput proportional to their high -+ * weight. This is especially true with NCQ-capable drives, -+ * which enqueue several requests in advance, and further -+ * reorder internally-queued requests. -+ * -+ * For this reason, we force to false the value of -+ * idling_boosts_thr_without_issues if there are weight-raised -+ * busy queues. In this case, and if bfqq is not weight-raised, -+ * this guarantees that the device is not idled for bfqq (if, -+ * instead, bfqq is weight-raised, then idling will be -+ * guaranteed by another variable, see below). Combined with -+ * the timestamping rules of BFQ (see [1] for details), this -+ * behavior causes bfqq, and hence any sync non-weight-raised -+ * queue, to get a lower number of requests served, and thus -+ * to ask for a lower number of requests from the request -+ * pool, before the busy weight-raised queues get served -+ * again. This often mitigates starvation problems in the -+ * presence of heavy write workloads and NCQ, thereby -+ * guaranteeing a higher application and system responsiveness -+ * in these hostile scenarios. -+ */ -+ idling_boosts_thr_without_issues = idling_boosts_thr && -+ bfqd->wr_busy_queues == 0; -+ -+ /* -+ * There is then a case where idling must be performed not -+ * for throughput concerns, but to preserve service -+ * guarantees. -+ * -+ * To introduce this case, we can note that allowing the drive -+ * to enqueue more than one request at a time, and hence -+ * delegating de facto final scheduling decisions to the -+ * drive's internal scheduler, entails loss of control on the -+ * actual request service order. In particular, the critical -+ * situation is when requests from different processes happen -+ * to be present, at the same time, in the internal queue(s) -+ * of the drive. In such a situation, the drive, by deciding -+ * the service order of the internally-queued requests, does -+ * determine also the actual throughput distribution among -+ * these processes. But the drive typically has no notion or -+ * concern about per-process throughput distribution, and -+ * makes its decisions only on a per-request basis. Therefore, -+ * the service distribution enforced by the drive's internal -+ * scheduler is likely to coincide with the desired -+ * device-throughput distribution only in a completely -+ * symmetric scenario where: -+ * (i) each of these processes must get the same throughput as -+ * the others; -+ * (ii) all these processes have the same I/O pattern -+ * (either sequential or random). -+ * In fact, in such a scenario, the drive will tend to treat -+ * the requests of each of these processes in about the same -+ * way as the requests of the others, and thus to provide -+ * each of these processes with about the same throughput -+ * (which is exactly the desired throughput distribution). In -+ * contrast, in any asymmetric scenario, device idling is -+ * certainly needed to guarantee that bfqq receives its -+ * assigned fraction of the device throughput (see [1] for -+ * details). -+ * -+ * We address this issue by controlling, actually, only the -+ * symmetry sub-condition (i), i.e., provided that -+ * sub-condition (i) holds, idling is not performed, -+ * regardless of whether sub-condition (ii) holds. In other -+ * words, only if sub-condition (i) holds, then idling is -+ * allowed, and the device tends to be prevented from queueing -+ * many requests, possibly of several processes. The reason -+ * for not controlling also sub-condition (ii) is that we -+ * exploit preemption to preserve guarantees in case of -+ * symmetric scenarios, even if (ii) does not hold, as -+ * explained in the next two paragraphs. -+ * -+ * Even if a queue, say Q, is expired when it remains idle, Q -+ * can still preempt the new in-service queue if the next -+ * request of Q arrives soon (see the comments on -+ * bfq_bfqq_update_budg_for_activation). If all queues and -+ * groups have the same weight, this form of preemption, -+ * combined with the hole-recovery heuristic described in the -+ * comments on function bfq_bfqq_update_budg_for_activation, -+ * are enough to preserve a correct bandwidth distribution in -+ * the mid term, even without idling. In fact, even if not -+ * idling allows the internal queues of the device to contain -+ * many requests, and thus to reorder requests, we can rather -+ * safely assume that the internal scheduler still preserves a -+ * minimum of mid-term fairness. The motivation for using -+ * preemption instead of idling is that, by not idling, -+ * service guarantees are preserved without minimally -+ * sacrificing throughput. In other words, both a high -+ * throughput and its desired distribution are obtained. -+ * -+ * More precisely, this preemption-based, idleless approach -+ * provides fairness in terms of IOPS, and not sectors per -+ * second. This can be seen with a simple example. Suppose -+ * that there are two queues with the same weight, but that -+ * the first queue receives requests of 8 sectors, while the -+ * second queue receives requests of 1024 sectors. In -+ * addition, suppose that each of the two queues contains at -+ * most one request at a time, which implies that each queue -+ * always remains idle after it is served. Finally, after -+ * remaining idle, each queue receives very quickly a new -+ * request. It follows that the two queues are served -+ * alternatively, preempting each other if needed. This -+ * implies that, although both queues have the same weight, -+ * the queue with large requests receives a service that is -+ * 1024/8 times as high as the service received by the other -+ * queue. -+ * -+ * On the other hand, device idling is performed, and thus -+ * pure sector-domain guarantees are provided, for the -+ * following queues, which are likely to need stronger -+ * throughput guarantees: weight-raised queues, and queues -+ * with a higher weight than other queues. When such queues -+ * are active, sub-condition (i) is false, which triggers -+ * device idling. -+ * -+ * According to the above considerations, the next variable is -+ * true (only) if sub-condition (i) holds. To compute the -+ * value of this variable, we not only use the return value of -+ * the function bfq_symmetric_scenario(), but also check -+ * whether bfqq is being weight-raised, because -+ * bfq_symmetric_scenario() does not take into account also -+ * weight-raised queues (see comments on -+ * bfq_weights_tree_add()). -+ * -+ * As a side note, it is worth considering that the above -+ * device-idling countermeasures may however fail in the -+ * following unlucky scenario: if idling is (correctly) -+ * disabled in a time period during which all symmetry -+ * sub-conditions hold, and hence the device is allowed to -+ * enqueue many requests, but at some later point in time some -+ * sub-condition stops to hold, then it may become impossible -+ * to let requests be served in the desired order until all -+ * the requests already queued in the device have been served. -+ */ -+ asymmetric_scenario = bfqq->wr_coeff > 1 || -+ !bfq_symmetric_scenario(bfqd); -+ -+ /* -+ * Finally, there is a case where maximizing throughput is the -+ * best choice even if it may cause unfairness toward -+ * bfqq. Such a case is when bfqq became active in a burst of -+ * queue activations. Queues that became active during a large -+ * burst benefit only from throughput, as discussed in the -+ * comments on bfq_handle_burst. Thus, if bfqq became active -+ * in a burst and not idling the device maximizes throughput, -+ * then the device must no be idled, because not idling the -+ * device provides bfqq and all other queues in the burst with -+ * maximum benefit. Combining this and the above case, we can -+ * now establish when idling is actually needed to preserve -+ * service guarantees. -+ */ -+ idling_needed_for_service_guarantees = -+ asymmetric_scenario && !bfq_bfqq_in_large_burst(bfqq); -+ -+ /* -+ * We have now all the components we need to compute the return -+ * value of the function, which is true only if both the following -+ * conditions hold: -+ * 1) bfqq is sync, because idling make sense only for sync queues; -+ * 2) idling either boosts the throughput (without issues), or -+ * is necessary to preserve service guarantees. -+ */ -+ bfq_log_bfqq(bfqd, bfqq, "may_idle: sync %d idling_boosts_thr %d", -+ bfq_bfqq_sync(bfqq), idling_boosts_thr); -+ -+ bfq_log_bfqq(bfqd, bfqq, -+ "may_idle: wr_busy %d boosts %d IO-bound %d guar %d", -+ bfqd->wr_busy_queues, -+ idling_boosts_thr_without_issues, -+ bfq_bfqq_IO_bound(bfqq), -+ idling_needed_for_service_guarantees); -+ -+ return bfq_bfqq_sync(bfqq) && -+ (idling_boosts_thr_without_issues || -+ idling_needed_for_service_guarantees); -+} -+ -+/* -+ * If the in-service queue is empty but the function bfq_bfqq_may_idle -+ * returns true, then: -+ * 1) the queue must remain in service and cannot be expired, and -+ * 2) the device must be idled to wait for the possible arrival of a new -+ * request for the queue. -+ * See the comments on the function bfq_bfqq_may_idle for the reasons -+ * why performing device idling is the best choice to boost the throughput -+ * and preserve service guarantees when bfq_bfqq_may_idle itself -+ * returns true. -+ */ -+static bool bfq_bfqq_must_idle(struct bfq_queue *bfqq) -+{ -+ struct bfq_data *bfqd = bfqq->bfqd; -+ -+ return RB_EMPTY_ROOT(&bfqq->sort_list) && bfqd->bfq_slice_idle != 0 && -+ bfq_bfqq_may_idle(bfqq); -+} -+ -+/* -+ * Select a queue for service. If we have a current queue in service, -+ * check whether to continue servicing it, or retrieve and set a new one. -+ */ -+static struct bfq_queue *bfq_select_queue(struct bfq_data *bfqd) -+{ -+ struct bfq_queue *bfqq; -+ struct request *next_rq; -+ enum bfqq_expiration reason = BFQ_BFQQ_BUDGET_TIMEOUT; -+ -+ bfqq = bfqd->in_service_queue; -+ if (!bfqq) -+ goto new_queue; -+ -+ bfq_log_bfqq(bfqd, bfqq, "select_queue: already in-service queue"); -+ -+ if (bfq_may_expire_for_budg_timeout(bfqq) && -+ !hrtimer_active(&bfqd->idle_slice_timer) && -+ !bfq_bfqq_must_idle(bfqq)) -+ goto expire; -+ -+ next_rq = bfqq->next_rq; -+ /* -+ * If bfqq has requests queued and it has enough budget left to -+ * serve them, keep the queue, otherwise expire it. -+ */ -+ if (next_rq) { -+ if (bfq_serv_to_charge(next_rq, bfqq) > -+ bfq_bfqq_budget_left(bfqq)) { -+ reason = BFQ_BFQQ_BUDGET_EXHAUSTED; -+ goto expire; -+ } else { -+ /* -+ * The idle timer may be pending because we may -+ * not disable disk idling even when a new request -+ * arrives. -+ */ -+ if (bfq_bfqq_wait_request(bfqq)) { -+ BUG_ON(!hrtimer_active(&bfqd->idle_slice_timer)); -+ /* -+ * If we get here: 1) at least a new request -+ * has arrived but we have not disabled the -+ * timer because the request was too small, -+ * 2) then the block layer has unplugged -+ * the device, causing the dispatch to be -+ * invoked. -+ * -+ * Since the device is unplugged, now the -+ * requests are probably large enough to -+ * provide a reasonable throughput. -+ * So we disable idling. -+ */ -+ bfq_clear_bfqq_wait_request(bfqq); -+ hrtimer_try_to_cancel(&bfqd->idle_slice_timer); -+ bfqg_stats_update_idle_time(bfqq_group(bfqq)); -+ } -+ goto keep_queue; -+ } -+ } -+ -+ /* -+ * No requests pending. However, if the in-service queue is idling -+ * for a new request, or has requests waiting for a completion and -+ * may idle after their completion, then keep it anyway. -+ */ -+ if (hrtimer_active(&bfqd->idle_slice_timer) || -+ (bfqq->dispatched != 0 && bfq_bfqq_may_idle(bfqq))) { -+ bfqq = NULL; -+ goto keep_queue; -+ } -+ -+ reason = BFQ_BFQQ_NO_MORE_REQUESTS; -+expire: -+ bfq_bfqq_expire(bfqd, bfqq, false, reason); -+new_queue: -+ bfqq = bfq_set_in_service_queue(bfqd); -+ bfq_log(bfqd, "select_queue: new queue %d returned", -+ bfqq ? bfqq->pid : 0); -+keep_queue: -+ return bfqq; -+} -+ -+static void bfq_update_wr_data(struct bfq_data *bfqd, struct bfq_queue *bfqq) -+{ -+ struct bfq_entity *entity = &bfqq->entity; -+ -+ if (bfqq->wr_coeff > 1) { /* queue is being weight-raised */ -+ BUG_ON(bfqq->wr_cur_max_time == bfqd->bfq_wr_rt_max_time && -+ time_is_after_jiffies(bfqq->last_wr_start_finish)); -+ -+ bfq_log_bfqq(bfqd, bfqq, -+ "raising period dur %u/%u msec, old coeff %u, w %d(%d)", -+ jiffies_to_msecs(jiffies - bfqq->last_wr_start_finish), -+ jiffies_to_msecs(bfqq->wr_cur_max_time), -+ bfqq->wr_coeff, -+ bfqq->entity.weight, bfqq->entity.orig_weight); -+ -+ BUG_ON(bfqq != bfqd->in_service_queue && entity->weight != -+ entity->orig_weight * bfqq->wr_coeff); -+ if (entity->prio_changed) -+ bfq_log_bfqq(bfqd, bfqq, "WARN: pending prio change"); -+ -+ /* -+ * If the queue was activated in a burst, or too much -+ * time has elapsed from the beginning of this -+ * weight-raising period, then end weight raising. -+ */ -+ if (bfq_bfqq_in_large_burst(bfqq)) -+ bfq_bfqq_end_wr(bfqq); -+ else if (time_is_before_jiffies(bfqq->last_wr_start_finish + -+ bfqq->wr_cur_max_time)) { -+ if (bfqq->wr_cur_max_time != bfqd->bfq_wr_rt_max_time || -+ time_is_before_jiffies(bfqq->wr_start_at_switch_to_srt + -+ bfq_wr_duration(bfqd))) -+ bfq_bfqq_end_wr(bfqq); -+ else { -+ /* switch back to interactive wr */ -+ bfqq->wr_coeff = bfqd->bfq_wr_coeff; -+ bfqq->wr_cur_max_time = bfq_wr_duration(bfqd); -+ bfqq->last_wr_start_finish = -+ bfqq->wr_start_at_switch_to_srt; -+ BUG_ON(time_is_after_jiffies( -+ bfqq->last_wr_start_finish)); -+ bfqq->entity.prio_changed = 1; -+ bfq_log_bfqq(bfqd, bfqq, -+ "back to interactive wr"); -+ } -+ } -+ } -+ /* Update weight both if it must be raised and if it must be lowered */ -+ if ((entity->weight > entity->orig_weight) != (bfqq->wr_coeff > 1)) -+ __bfq_entity_update_weight_prio( -+ bfq_entity_service_tree(entity), -+ entity); -+} -+ -+/* -+ * Dispatch one request from bfqq, moving it to the request queue -+ * dispatch list. -+ */ -+static int bfq_dispatch_request(struct bfq_data *bfqd, -+ struct bfq_queue *bfqq) -+{ -+ int dispatched = 0; -+ struct request *rq; -+ unsigned long service_to_charge; -+ -+ BUG_ON(RB_EMPTY_ROOT(&bfqq->sort_list)); -+ -+ /* Follow expired path, else get first next available. */ -+ rq = bfq_check_fifo(bfqq); -+ if (!rq) -+ rq = bfqq->next_rq; -+ service_to_charge = bfq_serv_to_charge(rq, bfqq); -+ -+ if (service_to_charge > bfq_bfqq_budget_left(bfqq)) { -+ /* -+ * This may happen if the next rq is chosen in fifo order -+ * instead of sector order. The budget is properly -+ * dimensioned to be always sufficient to serve the next -+ * request only if it is chosen in sector order. The reason -+ * is that it would be quite inefficient and little useful -+ * to always make sure that the budget is large enough to -+ * serve even the possible next rq in fifo order. -+ * In fact, requests are seldom served in fifo order. -+ * -+ * Expire the queue for budget exhaustion, and make sure -+ * that the next act_budget is enough to serve the next -+ * request, even if it comes from the fifo expired path. -+ */ -+ bfqq->next_rq = rq; -+ /* -+ * Since this dispatch is failed, make sure that -+ * a new one will be performed -+ */ -+ if (!bfqd->rq_in_driver) -+ bfq_schedule_dispatch(bfqd); -+ BUG_ON(bfqq->entity.budget < bfqq->entity.service); -+ goto expire; -+ } -+ -+ BUG_ON(bfqq->entity.budget < bfqq->entity.service); -+ /* Finally, insert request into driver dispatch list. */ -+ bfq_bfqq_served(bfqq, service_to_charge); -+ -+ BUG_ON(bfqq->entity.budget < bfqq->entity.service); -+ -+ bfq_dispatch_insert(bfqd->queue, rq); -+ -+ /* -+ * If weight raising has to terminate for bfqq, then next -+ * function causes an immediate update of bfqq's weight, -+ * without waiting for next activation. As a consequence, on -+ * expiration, bfqq will be timestamped as if has never been -+ * weight-raised during this service slot, even if it has -+ * received part or even most of the service as a -+ * weight-raised queue. This inflates bfqq's timestamps, which -+ * is beneficial, as bfqq is then more willing to leave the -+ * device immediately to possible other weight-raised queues. -+ */ -+ bfq_update_wr_data(bfqd, bfqq); -+ -+ bfq_log_bfqq(bfqd, bfqq, -+ "dispatched %u sec req (%llu), budg left %d", -+ blk_rq_sectors(rq), -+ (unsigned long long) blk_rq_pos(rq), -+ bfq_bfqq_budget_left(bfqq)); -+ -+ dispatched++; -+ -+ if (!bfqd->in_service_bic) { -+ atomic_long_inc(&RQ_BIC(rq)->icq.ioc->refcount); -+ bfqd->in_service_bic = RQ_BIC(rq); -+ } -+ -+ if (bfqd->busy_queues > 1 && bfq_class_idle(bfqq)) -+ goto expire; -+ -+ return dispatched; -+ -+expire: -+ bfq_bfqq_expire(bfqd, bfqq, false, BFQ_BFQQ_BUDGET_EXHAUSTED); -+ return dispatched; -+} -+ -+static int __bfq_forced_dispatch_bfqq(struct bfq_queue *bfqq) -+{ -+ int dispatched = 0; -+ -+ while (bfqq->next_rq) { -+ bfq_dispatch_insert(bfqq->bfqd->queue, bfqq->next_rq); -+ dispatched++; -+ } -+ -+ BUG_ON(!list_empty(&bfqq->fifo)); -+ return dispatched; -+} -+ -+/* -+ * Drain our current requests. -+ * Used for barriers and when switching io schedulers on-the-fly. -+ */ -+static int bfq_forced_dispatch(struct bfq_data *bfqd) -+{ -+ struct bfq_queue *bfqq, *n; -+ struct bfq_service_tree *st; -+ int dispatched = 0; -+ -+ bfqq = bfqd->in_service_queue; -+ if (bfqq) -+ __bfq_bfqq_expire(bfqd, bfqq); -+ -+ /* -+ * Loop through classes, and be careful to leave the scheduler -+ * in a consistent state, as feedback mechanisms and vtime -+ * updates cannot be disabled during the process. -+ */ -+ list_for_each_entry_safe(bfqq, n, &bfqd->active_list, bfqq_list) { -+ st = bfq_entity_service_tree(&bfqq->entity); -+ -+ dispatched += __bfq_forced_dispatch_bfqq(bfqq); -+ -+ bfqq->max_budget = bfq_max_budget(bfqd); -+ bfq_forget_idle(st); -+ } -+ -+ BUG_ON(bfqd->busy_queues != 0); -+ -+ return dispatched; -+} -+ -+static int bfq_dispatch_requests(struct request_queue *q, int force) -+{ -+ struct bfq_data *bfqd = q->elevator->elevator_data; -+ struct bfq_queue *bfqq; -+ -+ bfq_log(bfqd, "dispatch requests: %d busy queues", bfqd->busy_queues); -+ -+ if (bfqd->busy_queues == 0) -+ return 0; -+ -+ if (unlikely(force)) -+ return bfq_forced_dispatch(bfqd); -+ -+ /* -+ * Force device to serve one request at a time if -+ * strict_guarantees is true. Forcing this service scheme is -+ * currently the ONLY way to guarantee that the request -+ * service order enforced by the scheduler is respected by a -+ * queueing device. Otherwise the device is free even to make -+ * some unlucky request wait for as long as the device -+ * wishes. -+ * -+ * Of course, serving one request at at time may cause loss of -+ * throughput. -+ */ -+ if (bfqd->strict_guarantees && bfqd->rq_in_driver > 0) -+ return 0; -+ -+ bfqq = bfq_select_queue(bfqd); -+ if (!bfqq) -+ return 0; -+ -+ BUG_ON(bfqq->entity.budget < bfqq->entity.service); -+ -+ BUG_ON(bfq_bfqq_wait_request(bfqq)); -+ -+ if (!bfq_dispatch_request(bfqd, bfqq)) -+ return 0; -+ -+ bfq_log_bfqq(bfqd, bfqq, "dispatched %s request", -+ bfq_bfqq_sync(bfqq) ? "sync" : "async"); -+ -+ BUG_ON(bfqq->next_rq == NULL && -+ bfqq->entity.budget < bfqq->entity.service); -+ return 1; -+} -+ -+/* -+ * Task holds one reference to the queue, dropped when task exits. Each rq -+ * in-flight on this queue also holds a reference, dropped when rq is freed. -+ * -+ * Queue lock must be held here. -+ */ -+static void bfq_put_queue(struct bfq_queue *bfqq) -+{ -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ struct bfq_group *bfqg = bfqq_group(bfqq); -+#endif -+ -+ BUG_ON(bfqq->ref <= 0); -+ -+ bfq_log_bfqq(bfqq->bfqd, bfqq, "put_queue: %p %d", bfqq, bfqq->ref); -+ bfqq->ref--; -+ if (bfqq->ref) -+ return; -+ -+ BUG_ON(rb_first(&bfqq->sort_list)); -+ BUG_ON(bfqq->allocated[READ] + bfqq->allocated[WRITE] != 0); -+ BUG_ON(bfqq->entity.tree); -+ BUG_ON(bfq_bfqq_busy(bfqq)); -+ BUG_ON(bfqq->bfqd->in_service_queue == bfqq); -+ -+ if (bfq_bfqq_sync(bfqq)) -+ /* -+ * The fact that this queue is being destroyed does not -+ * invalidate the fact that this queue may have been -+ * activated during the current burst. As a consequence, -+ * although the queue does not exist anymore, and hence -+ * needs to be removed from the burst list if there, -+ * the burst size has not to be decremented. -+ */ -+ hlist_del_init(&bfqq->burst_list_node); -+ -+ bfq_log_bfqq(bfqq->bfqd, bfqq, "put_queue: %p freed", bfqq); -+ -+ kmem_cache_free(bfq_pool, bfqq); -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ bfqg_put(bfqg); -+#endif -+} -+ -+static void bfq_put_cooperator(struct bfq_queue *bfqq) -+{ -+ struct bfq_queue *__bfqq, *next; -+ -+ /* -+ * If this queue was scheduled to merge with another queue, be -+ * sure to drop the reference taken on that queue (and others in -+ * the merge chain). See bfq_setup_merge and bfq_merge_bfqqs. -+ */ -+ __bfqq = bfqq->new_bfqq; -+ while (__bfqq) { -+ if (__bfqq == bfqq) -+ break; -+ next = __bfqq->new_bfqq; -+ bfq_put_queue(__bfqq); -+ __bfqq = next; -+ } -+} -+ -+static void bfq_exit_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq) -+{ -+ if (bfqq == bfqd->in_service_queue) { -+ __bfq_bfqq_expire(bfqd, bfqq); -+ bfq_schedule_dispatch(bfqd); -+ } -+ -+ bfq_log_bfqq(bfqd, bfqq, "exit_bfqq: %p, %d", bfqq, bfqq->ref); -+ -+ bfq_put_cooperator(bfqq); -+ -+ bfq_put_queue(bfqq); -+} -+ -+static void bfq_init_icq(struct io_cq *icq) -+{ -+ icq_to_bic(icq)->ttime.last_end_request = ktime_get_ns() - (1ULL<<32); -+} -+ -+static void bfq_exit_icq(struct io_cq *icq) -+{ -+ struct bfq_io_cq *bic = icq_to_bic(icq); -+ struct bfq_data *bfqd = bic_to_bfqd(bic); -+ -+ if (bic_to_bfqq(bic, false)) { -+ bfq_exit_bfqq(bfqd, bic_to_bfqq(bic, false)); -+ bic_set_bfqq(bic, NULL, false); -+ } -+ -+ if (bic_to_bfqq(bic, true)) { -+ /* -+ * If the bic is using a shared queue, put the reference -+ * taken on the io_context when the bic started using a -+ * shared bfq_queue. -+ */ -+ if (bfq_bfqq_coop(bic_to_bfqq(bic, true))) -+ put_io_context(icq->ioc); -+ bfq_exit_bfqq(bfqd, bic_to_bfqq(bic, true)); -+ bic_set_bfqq(bic, NULL, true); -+ } -+} -+ -+/* -+ * Update the entity prio values; note that the new values will not -+ * be used until the next (re)activation. -+ */ -+static void bfq_set_next_ioprio_data(struct bfq_queue *bfqq, -+ struct bfq_io_cq *bic) -+{ -+ struct task_struct *tsk = current; -+ int ioprio_class; -+ -+ ioprio_class = IOPRIO_PRIO_CLASS(bic->ioprio); -+ switch (ioprio_class) { -+ default: -+ dev_err(bfqq->bfqd->queue->backing_dev_info.dev, -+ "bfq: bad prio class %d\n", ioprio_class); -+ case IOPRIO_CLASS_NONE: -+ /* -+ * No prio set, inherit CPU scheduling settings. -+ */ -+ bfqq->new_ioprio = task_nice_ioprio(tsk); -+ bfqq->new_ioprio_class = task_nice_ioclass(tsk); -+ break; -+ case IOPRIO_CLASS_RT: -+ bfqq->new_ioprio = IOPRIO_PRIO_DATA(bic->ioprio); -+ bfqq->new_ioprio_class = IOPRIO_CLASS_RT; -+ break; -+ case IOPRIO_CLASS_BE: -+ bfqq->new_ioprio = IOPRIO_PRIO_DATA(bic->ioprio); -+ bfqq->new_ioprio_class = IOPRIO_CLASS_BE; -+ break; -+ case IOPRIO_CLASS_IDLE: -+ bfqq->new_ioprio_class = IOPRIO_CLASS_IDLE; -+ bfqq->new_ioprio = 7; -+ bfq_clear_bfqq_idle_window(bfqq); -+ break; -+ } -+ -+ if (bfqq->new_ioprio >= IOPRIO_BE_NR) { -+ pr_crit("bfq_set_next_ioprio_data: new_ioprio %d\n", -+ bfqq->new_ioprio); -+ BUG(); -+ } -+ -+ bfqq->entity.new_weight = bfq_ioprio_to_weight(bfqq->new_ioprio); -+ bfqq->entity.prio_changed = 1; -+ bfq_log_bfqq(bfqq->bfqd, bfqq, -+ "set_next_ioprio_data: bic_class %d prio %d class %d", -+ ioprio_class, bfqq->new_ioprio, bfqq->new_ioprio_class); -+} -+ -+static void bfq_check_ioprio_change(struct bfq_io_cq *bic, struct bio *bio) -+{ -+ struct bfq_data *bfqd = bic_to_bfqd(bic); -+ struct bfq_queue *bfqq; -+ unsigned long uninitialized_var(flags); -+ int ioprio = bic->icq.ioc->ioprio; -+ -+ /* -+ * This condition may trigger on a newly created bic, be sure to -+ * drop the lock before returning. -+ */ -+ if (unlikely(!bfqd) || likely(bic->ioprio == ioprio)) -+ return; -+ -+ bic->ioprio = ioprio; -+ -+ bfqq = bic_to_bfqq(bic, false); -+ if (bfqq) { -+ bfq_put_queue(bfqq); -+ bfqq = bfq_get_queue(bfqd, bio, BLK_RW_ASYNC, bic); -+ bic_set_bfqq(bic, bfqq, false); -+ bfq_log_bfqq(bfqd, bfqq, -+ "check_ioprio_change: bfqq %p %d", -+ bfqq, bfqq->ref); -+ } -+ -+ bfqq = bic_to_bfqq(bic, true); -+ if (bfqq) -+ bfq_set_next_ioprio_data(bfqq, bic); -+} -+ -+static void bfq_init_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq, -+ struct bfq_io_cq *bic, pid_t pid, int is_sync) -+{ -+ RB_CLEAR_NODE(&bfqq->entity.rb_node); -+ INIT_LIST_HEAD(&bfqq->fifo); -+ INIT_HLIST_NODE(&bfqq->burst_list_node); -+ BUG_ON(!hlist_unhashed(&bfqq->burst_list_node)); -+ -+ bfqq->ref = 0; -+ bfqq->bfqd = bfqd; -+ -+ if (bic) -+ bfq_set_next_ioprio_data(bfqq, bic); -+ -+ if (is_sync) { -+ if (!bfq_class_idle(bfqq)) -+ bfq_mark_bfqq_idle_window(bfqq); -+ bfq_mark_bfqq_sync(bfqq); -+ bfq_mark_bfqq_just_created(bfqq); -+ } else -+ bfq_clear_bfqq_sync(bfqq); -+ bfq_mark_bfqq_IO_bound(bfqq); -+ -+ /* Tentative initial value to trade off between thr and lat */ -+ bfqq->max_budget = (2 * bfq_max_budget(bfqd)) / 3; -+ bfqq->pid = pid; -+ -+ bfqq->wr_coeff = 1; -+ bfqq->last_wr_start_finish = jiffies; -+ bfqq->wr_start_at_switch_to_srt = bfq_smallest_from_now(); -+ bfqq->budget_timeout = bfq_smallest_from_now(); -+ bfqq->split_time = bfq_smallest_from_now(); -+ -+ /* -+ * Set to the value for which bfqq will not be deemed as -+ * soft rt when it becomes backlogged. -+ */ -+ bfqq->soft_rt_next_start = bfq_greatest_from_now(); -+ -+ /* first request is almost certainly seeky */ -+ bfqq->seek_history = 1; -+} -+ -+static struct bfq_queue **bfq_async_queue_prio(struct bfq_data *bfqd, -+ struct bfq_group *bfqg, -+ int ioprio_class, int ioprio) -+{ -+ switch (ioprio_class) { -+ case IOPRIO_CLASS_RT: -+ return &bfqg->async_bfqq[0][ioprio]; -+ case IOPRIO_CLASS_NONE: -+ ioprio = IOPRIO_NORM; -+ /* fall through */ -+ case IOPRIO_CLASS_BE: -+ return &bfqg->async_bfqq[1][ioprio]; -+ case IOPRIO_CLASS_IDLE: -+ return &bfqg->async_idle_bfqq; -+ default: -+ BUG(); -+ } -+} -+ -+static struct bfq_queue *bfq_get_queue(struct bfq_data *bfqd, -+ struct bio *bio, bool is_sync, -+ struct bfq_io_cq *bic) -+{ -+ const int ioprio = IOPRIO_PRIO_DATA(bic->ioprio); -+ const int ioprio_class = IOPRIO_PRIO_CLASS(bic->ioprio); -+ struct bfq_queue **async_bfqq = NULL; -+ struct bfq_queue *bfqq; -+ struct bfq_group *bfqg; -+ -+ rcu_read_lock(); -+ -+ bfqg = bfq_find_set_group(bfqd, bio_blkcg(bio)); -+ if (!bfqg) { -+ bfqq = &bfqd->oom_bfqq; -+ goto out; -+ } -+ -+ if (!is_sync) { -+ async_bfqq = bfq_async_queue_prio(bfqd, bfqg, ioprio_class, -+ ioprio); -+ bfqq = *async_bfqq; -+ if (bfqq) -+ goto out; -+ } -+ -+ bfqq = kmem_cache_alloc_node(bfq_pool, GFP_NOWAIT | __GFP_ZERO, -+ bfqd->queue->node); -+ -+ if (bfqq) { -+ bfq_init_bfqq(bfqd, bfqq, bic, current->pid, -+ is_sync); -+ bfq_init_entity(&bfqq->entity, bfqg); -+ bfq_log_bfqq(bfqd, bfqq, "allocated"); -+ } else { -+ bfqq = &bfqd->oom_bfqq; -+ bfq_log_bfqq(bfqd, bfqq, "using oom bfqq"); -+ goto out; -+ } -+ -+ /* -+ * Pin the queue now that it's allocated, scheduler exit will -+ * prune it. -+ */ -+ if (async_bfqq) { -+ bfqq->ref++; -+ bfq_log_bfqq(bfqd, bfqq, "get_queue, bfqq not in async: %p, %d", -+ bfqq, bfqq->ref); -+ *async_bfqq = bfqq; -+ } -+ -+out: -+ bfqq->ref++; -+ bfq_log_bfqq(bfqd, bfqq, "get_queue, at end: %p, %d", bfqq, bfqq->ref); -+ rcu_read_unlock(); -+ return bfqq; -+} -+ -+static void bfq_update_io_thinktime(struct bfq_data *bfqd, -+ struct bfq_io_cq *bic) -+{ -+ struct bfq_ttime *ttime = &bic->ttime; -+ u64 elapsed = ktime_get_ns() - bic->ttime.last_end_request; -+ -+ elapsed = min_t(u64, elapsed, 2 * bfqd->bfq_slice_idle); -+ -+ ttime->ttime_samples = (7*bic->ttime.ttime_samples + 256) / 8; -+ ttime->ttime_total = div_u64(7*ttime->ttime_total + 256*elapsed, 8); -+ ttime->ttime_mean = div64_ul(ttime->ttime_total + 128, -+ ttime->ttime_samples); -+} -+ -+static void -+bfq_update_io_seektime(struct bfq_data *bfqd, struct bfq_queue *bfqq, -+ struct request *rq) -+{ -+ bfqq->seek_history <<= 1; -+ bfqq->seek_history |= -+ get_sdist(bfqq->last_request_pos, rq) > BFQQ_SEEK_THR; -+} -+ -+/* -+ * Disable idle window if the process thinks too long or seeks so much that -+ * it doesn't matter. -+ */ -+static void bfq_update_idle_window(struct bfq_data *bfqd, -+ struct bfq_queue *bfqq, -+ struct bfq_io_cq *bic) -+{ -+ int enable_idle; -+ -+ /* Don't idle for async or idle io prio class. */ -+ if (!bfq_bfqq_sync(bfqq) || bfq_class_idle(bfqq)) -+ return; -+ -+ /* Idle window just restored, statistics are meaningless. */ -+ if (time_is_after_eq_jiffies(bfqq->split_time + -+ bfqd->bfq_wr_min_idle_time)) -+ return; -+ -+ enable_idle = bfq_bfqq_idle_window(bfqq); -+ -+ if (atomic_read(&bic->icq.ioc->active_ref) == 0 || -+ bfqd->bfq_slice_idle == 0 || -+ (bfqd->hw_tag && BFQQ_SEEKY(bfqq) && -+ bfqq->wr_coeff == 1)) -+ enable_idle = 0; -+ else if (bfq_sample_valid(bic->ttime.ttime_samples)) { -+ if (bic->ttime.ttime_mean > bfqd->bfq_slice_idle && -+ bfqq->wr_coeff == 1) -+ enable_idle = 0; -+ else -+ enable_idle = 1; -+ } -+ bfq_log_bfqq(bfqd, bfqq, "update_idle_window: enable_idle %d", -+ enable_idle); -+ -+ if (enable_idle) -+ bfq_mark_bfqq_idle_window(bfqq); -+ else -+ bfq_clear_bfqq_idle_window(bfqq); -+} -+ -+/* -+ * Called when a new fs request (rq) is added to bfqq. Check if there's -+ * something we should do about it. -+ */ -+static void bfq_rq_enqueued(struct bfq_data *bfqd, struct bfq_queue *bfqq, -+ struct request *rq) -+{ -+ struct bfq_io_cq *bic = RQ_BIC(rq); -+ -+ if (rq->cmd_flags & REQ_META) -+ bfqq->meta_pending++; -+ -+ bfq_update_io_thinktime(bfqd, bic); -+ bfq_update_io_seektime(bfqd, bfqq, rq); -+ if (bfqq->entity.service > bfq_max_budget(bfqd) / 8 || -+ !BFQQ_SEEKY(bfqq)) -+ bfq_update_idle_window(bfqd, bfqq, bic); -+ -+ bfq_log_bfqq(bfqd, bfqq, -+ "rq_enqueued: idle_window=%d (seeky %d)", -+ bfq_bfqq_idle_window(bfqq), BFQQ_SEEKY(bfqq)); -+ -+ bfqq->last_request_pos = blk_rq_pos(rq) + blk_rq_sectors(rq); -+ -+ if (bfqq == bfqd->in_service_queue && bfq_bfqq_wait_request(bfqq)) { -+ bool small_req = bfqq->queued[rq_is_sync(rq)] == 1 && -+ blk_rq_sectors(rq) < 32; -+ bool budget_timeout = bfq_bfqq_budget_timeout(bfqq); -+ -+ /* -+ * There is just this request queued: if the request -+ * is small and the queue is not to be expired, then -+ * just exit. -+ * -+ * In this way, if the device is being idled to wait -+ * for a new request from the in-service queue, we -+ * avoid unplugging the device and committing the -+ * device to serve just a small request. On the -+ * contrary, we wait for the block layer to decide -+ * when to unplug the device: hopefully, new requests -+ * will be merged to this one quickly, then the device -+ * will be unplugged and larger requests will be -+ * dispatched. -+ */ -+ if (small_req && !budget_timeout) -+ return; -+ -+ /* -+ * A large enough request arrived, or the queue is to -+ * be expired: in both cases disk idling is to be -+ * stopped, so clear wait_request flag and reset -+ * timer. -+ */ -+ bfq_clear_bfqq_wait_request(bfqq); -+ hrtimer_try_to_cancel(&bfqd->idle_slice_timer); -+ bfqg_stats_update_idle_time(bfqq_group(bfqq)); -+ -+ /* -+ * The queue is not empty, because a new request just -+ * arrived. Hence we can safely expire the queue, in -+ * case of budget timeout, without risking that the -+ * timestamps of the queue are not updated correctly. -+ * See [1] for more details. -+ */ -+ if (budget_timeout) -+ bfq_bfqq_expire(bfqd, bfqq, false, -+ BFQ_BFQQ_BUDGET_TIMEOUT); -+ -+ /* -+ * Let the request rip immediately, or let a new queue be -+ * selected if bfqq has just been expired. -+ */ -+ __blk_run_queue(bfqd->queue); -+ } -+} -+ -+static void bfq_insert_request(struct request_queue *q, struct request *rq) -+{ -+ struct bfq_data *bfqd = q->elevator->elevator_data; -+ struct bfq_queue *bfqq = RQ_BFQQ(rq), *new_bfqq; -+ -+ assert_spin_locked(bfqd->queue->queue_lock); -+ -+ /* -+ * An unplug may trigger a requeue of a request from the device -+ * driver: make sure we are in process context while trying to -+ * merge two bfq_queues. -+ */ -+ if (!in_interrupt()) { -+ new_bfqq = bfq_setup_cooperator(bfqd, bfqq, rq, true); -+ if (new_bfqq) { -+ if (bic_to_bfqq(RQ_BIC(rq), 1) != bfqq) -+ new_bfqq = bic_to_bfqq(RQ_BIC(rq), 1); -+ /* -+ * Release the request's reference to the old bfqq -+ * and make sure one is taken to the shared queue. -+ */ -+ new_bfqq->allocated[rq_data_dir(rq)]++; -+ bfqq->allocated[rq_data_dir(rq)]--; -+ new_bfqq->ref++; -+ bfq_clear_bfqq_just_created(bfqq); -+ bfq_put_queue(bfqq); -+ if (bic_to_bfqq(RQ_BIC(rq), 1) == bfqq) -+ bfq_merge_bfqqs(bfqd, RQ_BIC(rq), -+ bfqq, new_bfqq); -+ rq->elv.priv[1] = new_bfqq; -+ bfqq = new_bfqq; -+ } -+ } -+ -+ bfq_add_request(rq); -+ -+ rq->fifo_time = ktime_get_ns() + -+ jiffies_to_nsecs(bfqd->bfq_fifo_expire[rq_is_sync(rq)]); -+ list_add_tail(&rq->queuelist, &bfqq->fifo); -+ -+ bfq_rq_enqueued(bfqd, bfqq, rq); -+} -+ -+static void bfq_update_hw_tag(struct bfq_data *bfqd) -+{ -+ bfqd->max_rq_in_driver = max_t(int, bfqd->max_rq_in_driver, -+ bfqd->rq_in_driver); -+ -+ if (bfqd->hw_tag == 1) -+ return; -+ -+ /* -+ * This sample is valid if the number of outstanding requests -+ * is large enough to allow a queueing behavior. Note that the -+ * sum is not exact, as it's not taking into account deactivated -+ * requests. -+ */ -+ if (bfqd->rq_in_driver + bfqd->queued < BFQ_HW_QUEUE_THRESHOLD) -+ return; -+ -+ if (bfqd->hw_tag_samples++ < BFQ_HW_QUEUE_SAMPLES) -+ return; -+ -+ bfqd->hw_tag = bfqd->max_rq_in_driver > BFQ_HW_QUEUE_THRESHOLD; -+ bfqd->max_rq_in_driver = 0; -+ bfqd->hw_tag_samples = 0; -+} -+ -+static void bfq_completed_request(struct request_queue *q, struct request *rq) -+{ -+ struct bfq_queue *bfqq = RQ_BFQQ(rq); -+ struct bfq_data *bfqd = bfqq->bfqd; -+ u64 now_ns; -+ u32 delta_us; -+ -+ bfq_log_bfqq(bfqd, bfqq, "completed one req with %u sects left", -+ blk_rq_sectors(rq)); -+ -+ assert_spin_locked(bfqd->queue->queue_lock); -+ bfq_update_hw_tag(bfqd); -+ -+ BUG_ON(!bfqd->rq_in_driver); -+ BUG_ON(!bfqq->dispatched); -+ bfqd->rq_in_driver--; -+ bfqq->dispatched--; -+ bfqg_stats_update_completion(bfqq_group(bfqq), -+ rq_start_time_ns(rq), -+ rq_io_start_time_ns(rq), req_op(rq), -+ rq->cmd_flags); -+ -+ if (!bfqq->dispatched && !bfq_bfqq_busy(bfqq)) { -+ BUG_ON(!RB_EMPTY_ROOT(&bfqq->sort_list)); -+ /* -+ * Set budget_timeout (which we overload to store the -+ * time at which the queue remains with no backlog and -+ * no outstanding request; used by the weight-raising -+ * mechanism). -+ */ -+ bfqq->budget_timeout = jiffies; -+ -+ bfq_weights_tree_remove(bfqd, &bfqq->entity, -+ &bfqd->queue_weights_tree); -+ } -+ -+ now_ns = ktime_get_ns(); -+ -+ RQ_BIC(rq)->ttime.last_end_request = now_ns; -+ -+ /* -+ * Using us instead of ns, to get a reasonable precision in -+ * computing rate in next check. -+ */ -+ delta_us = div_u64(now_ns - bfqd->last_completion, NSEC_PER_USEC); -+ -+ bfq_log(bfqd, "rq_completed: delta %uus/%luus max_size %u rate %llu/%llu", -+ delta_us, BFQ_MIN_TT/NSEC_PER_USEC, bfqd->last_rq_max_size, -+ (USEC_PER_SEC* -+ (u64)((bfqd->last_rq_max_size<>BFQ_RATE_SHIFT, -+ (USEC_PER_SEC*(u64)(1UL<<(BFQ_RATE_SHIFT-10)))>>BFQ_RATE_SHIFT); -+ -+ /* -+ * If the request took rather long to complete, and, according -+ * to the maximum request size recorded, this completion latency -+ * implies that the request was certainly served at a very low -+ * rate (less than 1M sectors/sec), then the whole observation -+ * interval that lasts up to this time instant cannot be a -+ * valid time interval for computing a new peak rate. Invoke -+ * bfq_update_rate_reset to have the following three steps -+ * taken: -+ * - close the observation interval at the last (previous) -+ * request dispatch or completion -+ * - compute rate, if possible, for that observation interval -+ * - reset to zero samples, which will trigger a proper -+ * re-initialization of the observation interval on next -+ * dispatch -+ */ -+ if (delta_us > BFQ_MIN_TT/NSEC_PER_USEC && -+ (bfqd->last_rq_max_size<last_completion = now_ns; -+ -+ /* -+ * If we are waiting to discover whether the request pattern -+ * of the task associated with the queue is actually -+ * isochronous, and both requisites for this condition to hold -+ * are now satisfied, then compute soft_rt_next_start (see the -+ * comments on the function bfq_bfqq_softrt_next_start()). We -+ * schedule this delayed check when bfqq expires, if it still -+ * has in-flight requests. -+ */ -+ if (bfq_bfqq_softrt_update(bfqq) && bfqq->dispatched == 0 && -+ RB_EMPTY_ROOT(&bfqq->sort_list)) -+ bfqq->soft_rt_next_start = -+ bfq_bfqq_softrt_next_start(bfqd, bfqq); -+ -+ /* -+ * If this is the in-service queue, check if it needs to be expired, -+ * or if we want to idle in case it has no pending requests. -+ */ -+ if (bfqd->in_service_queue == bfqq) { -+ if (bfqq->dispatched == 0 && bfq_bfqq_must_idle(bfqq)) { -+ bfq_arm_slice_timer(bfqd); -+ goto out; -+ } else if (bfq_may_expire_for_budg_timeout(bfqq)) -+ bfq_bfqq_expire(bfqd, bfqq, false, -+ BFQ_BFQQ_BUDGET_TIMEOUT); -+ else if (RB_EMPTY_ROOT(&bfqq->sort_list) && -+ (bfqq->dispatched == 0 || -+ !bfq_bfqq_may_idle(bfqq))) -+ bfq_bfqq_expire(bfqd, bfqq, false, -+ BFQ_BFQQ_NO_MORE_REQUESTS); -+ } -+ -+ if (!bfqd->rq_in_driver) -+ bfq_schedule_dispatch(bfqd); -+ -+out: -+ return; -+} -+ -+static int __bfq_may_queue(struct bfq_queue *bfqq) -+{ -+ if (bfq_bfqq_wait_request(bfqq) && bfq_bfqq_must_alloc(bfqq)) { -+ bfq_clear_bfqq_must_alloc(bfqq); -+ return ELV_MQUEUE_MUST; -+ } -+ -+ return ELV_MQUEUE_MAY; -+} -+ -+static int bfq_may_queue(struct request_queue *q, int op, int op_flags) -+{ -+ struct bfq_data *bfqd = q->elevator->elevator_data; -+ struct task_struct *tsk = current; -+ struct bfq_io_cq *bic; -+ struct bfq_queue *bfqq; -+ -+ /* -+ * Don't force setup of a queue from here, as a call to may_queue -+ * does not necessarily imply that a request actually will be -+ * queued. So just lookup a possibly existing queue, or return -+ * 'may queue' if that fails. -+ */ -+ bic = bfq_bic_lookup(bfqd, tsk->io_context); -+ if (!bic) -+ return ELV_MQUEUE_MAY; -+ -+ bfqq = bic_to_bfqq(bic, rw_is_sync(op, op_flags)); -+ if (bfqq) -+ return __bfq_may_queue(bfqq); -+ -+ return ELV_MQUEUE_MAY; -+} -+ -+/* -+ * Queue lock held here. -+ */ -+static void bfq_put_request(struct request *rq) -+{ -+ struct bfq_queue *bfqq = RQ_BFQQ(rq); -+ -+ if (bfqq) { -+ const int rw = rq_data_dir(rq); -+ -+ BUG_ON(!bfqq->allocated[rw]); -+ bfqq->allocated[rw]--; -+ -+ rq->elv.priv[0] = NULL; -+ rq->elv.priv[1] = NULL; -+ -+ bfq_log_bfqq(bfqq->bfqd, bfqq, "put_request %p, %d", -+ bfqq, bfqq->ref); -+ bfq_put_queue(bfqq); -+ } -+} -+ -+/* -+ * Returns NULL if a new bfqq should be allocated, or the old bfqq if this -+ * was the last process referring to that bfqq. -+ */ -+static struct bfq_queue * -+bfq_split_bfqq(struct bfq_io_cq *bic, struct bfq_queue *bfqq) -+{ -+ bfq_log_bfqq(bfqq->bfqd, bfqq, "splitting queue"); -+ -+ put_io_context(bic->icq.ioc); -+ -+ if (bfqq_process_refs(bfqq) == 1) { -+ bfqq->pid = current->pid; -+ bfq_clear_bfqq_coop(bfqq); -+ bfq_clear_bfqq_split_coop(bfqq); -+ return bfqq; -+ } -+ -+ bic_set_bfqq(bic, NULL, 1); -+ -+ bfq_put_cooperator(bfqq); -+ -+ bfq_put_queue(bfqq); -+ return NULL; -+} -+ -+/* -+ * Allocate bfq data structures associated with this request. -+ */ -+static int bfq_set_request(struct request_queue *q, struct request *rq, -+ struct bio *bio, gfp_t gfp_mask) -+{ -+ struct bfq_data *bfqd = q->elevator->elevator_data; -+ struct bfq_io_cq *bic = icq_to_bic(rq->elv.icq); -+ const int rw = rq_data_dir(rq); -+ const int is_sync = rq_is_sync(rq); -+ struct bfq_queue *bfqq; -+ unsigned long flags; -+ bool split = false; -+ -+ spin_lock_irqsave(q->queue_lock, flags); -+ bfq_check_ioprio_change(bic, bio); -+ -+ if (!bic) -+ goto queue_fail; -+ -+ bfq_bic_update_cgroup(bic, bio); -+ -+new_queue: -+ bfqq = bic_to_bfqq(bic, is_sync); -+ if (!bfqq || bfqq == &bfqd->oom_bfqq) { -+ if (bfqq) -+ bfq_put_queue(bfqq); -+ bfqq = bfq_get_queue(bfqd, bio, is_sync, bic); -+ BUG_ON(!hlist_unhashed(&bfqq->burst_list_node)); -+ -+ bic_set_bfqq(bic, bfqq, is_sync); -+ if (split && is_sync) { -+ bfq_log_bfqq(bfqd, bfqq, -+ "set_request: was_in_list %d " -+ "was_in_large_burst %d " -+ "large burst in progress %d", -+ bic->was_in_burst_list, -+ bic->saved_in_large_burst, -+ bfqd->large_burst); -+ -+ if ((bic->was_in_burst_list && bfqd->large_burst) || -+ bic->saved_in_large_burst) { -+ bfq_log_bfqq(bfqd, bfqq, -+ "set_request: marking in " -+ "large burst"); -+ bfq_mark_bfqq_in_large_burst(bfqq); -+ } else { -+ bfq_log_bfqq(bfqd, bfqq, -+ "set_request: clearing in " -+ "large burst"); -+ bfq_clear_bfqq_in_large_burst(bfqq); -+ if (bic->was_in_burst_list) -+ hlist_add_head(&bfqq->burst_list_node, -+ &bfqd->burst_list); -+ } -+ bfqq->split_time = jiffies; -+ } -+ } else { -+ /* If the queue was seeky for too long, break it apart. */ -+ if (bfq_bfqq_coop(bfqq) && bfq_bfqq_split_coop(bfqq)) { -+ bfq_log_bfqq(bfqd, bfqq, "breaking apart bfqq"); -+ -+ /* Update bic before losing reference to bfqq */ -+ if (bfq_bfqq_in_large_burst(bfqq)) -+ bic->saved_in_large_burst = true; -+ -+ bfqq = bfq_split_bfqq(bic, bfqq); -+ split = true; -+ if (!bfqq) -+ goto new_queue; -+ } -+ } -+ -+ bfqq->allocated[rw]++; -+ bfqq->ref++; -+ bfq_log_bfqq(bfqd, bfqq, "set_request: bfqq %p, %d", bfqq, bfqq->ref); -+ -+ rq->elv.priv[0] = bic; -+ rq->elv.priv[1] = bfqq; -+ -+ /* -+ * If a bfq_queue has only one process reference, it is owned -+ * by only one bfq_io_cq: we can set the bic field of the -+ * bfq_queue to the address of that structure. Also, if the -+ * queue has just been split, mark a flag so that the -+ * information is available to the other scheduler hooks. -+ */ -+ if (likely(bfqq != &bfqd->oom_bfqq) && bfqq_process_refs(bfqq) == 1) { -+ bfqq->bic = bic; -+ if (split) { -+ /* -+ * If the queue has just been split from a shared -+ * queue, restore the idle window and the possible -+ * weight raising period. -+ */ -+ bfq_bfqq_resume_state(bfqq, bic); -+ } -+ } -+ -+ if (unlikely(bfq_bfqq_just_created(bfqq))) -+ bfq_handle_burst(bfqd, bfqq); -+ -+ spin_unlock_irqrestore(q->queue_lock, flags); -+ -+ return 0; -+ -+queue_fail: -+ bfq_schedule_dispatch(bfqd); -+ spin_unlock_irqrestore(q->queue_lock, flags); -+ -+ return 1; -+} -+ -+static void bfq_kick_queue(struct work_struct *work) -+{ -+ struct bfq_data *bfqd = -+ container_of(work, struct bfq_data, unplug_work); -+ struct request_queue *q = bfqd->queue; -+ -+ spin_lock_irq(q->queue_lock); -+ __blk_run_queue(q); -+ spin_unlock_irq(q->queue_lock); -+} -+ -+/* -+ * Handler of the expiration of the timer running if the in-service queue -+ * is idling inside its time slice. -+ */ -+static enum hrtimer_restart bfq_idle_slice_timer(struct hrtimer *timer) -+{ -+ struct bfq_data *bfqd = container_of(timer, struct bfq_data, -+ idle_slice_timer); -+ struct bfq_queue *bfqq; -+ unsigned long flags; -+ enum bfqq_expiration reason; -+ -+ spin_lock_irqsave(bfqd->queue->queue_lock, flags); -+ -+ bfqq = bfqd->in_service_queue; -+ /* -+ * Theoretical race here: the in-service queue can be NULL or -+ * different from the queue that was idling if the timer handler -+ * spins on the queue_lock and a new request arrives for the -+ * current queue and there is a full dispatch cycle that changes -+ * the in-service queue. This can hardly happen, but in the worst -+ * case we just expire a queue too early. -+ */ -+ if (bfqq) { -+ bfq_log_bfqq(bfqd, bfqq, "slice_timer expired"); -+ bfq_clear_bfqq_wait_request(bfqq); -+ -+ if (bfq_bfqq_budget_timeout(bfqq)) -+ /* -+ * Also here the queue can be safely expired -+ * for budget timeout without wasting -+ * guarantees -+ */ -+ reason = BFQ_BFQQ_BUDGET_TIMEOUT; -+ else if (bfqq->queued[0] == 0 && bfqq->queued[1] == 0) -+ /* -+ * The queue may not be empty upon timer expiration, -+ * because we may not disable the timer when the -+ * first request of the in-service queue arrives -+ * during disk idling. -+ */ -+ reason = BFQ_BFQQ_TOO_IDLE; -+ else -+ goto schedule_dispatch; -+ -+ bfq_bfqq_expire(bfqd, bfqq, true, reason); -+ } -+ -+schedule_dispatch: -+ bfq_schedule_dispatch(bfqd); -+ -+ spin_unlock_irqrestore(bfqd->queue->queue_lock, flags); -+ return HRTIMER_NORESTART; -+} -+ -+static void bfq_shutdown_timer_wq(struct bfq_data *bfqd) -+{ -+ hrtimer_cancel(&bfqd->idle_slice_timer); -+ cancel_work_sync(&bfqd->unplug_work); -+} -+ -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+static void __bfq_put_async_bfqq(struct bfq_data *bfqd, -+ struct bfq_queue **bfqq_ptr) -+{ -+ struct bfq_group *root_group = bfqd->root_group; -+ struct bfq_queue *bfqq = *bfqq_ptr; -+ -+ bfq_log(bfqd, "put_async_bfqq: %p", bfqq); -+ if (bfqq) { -+ bfq_bfqq_move(bfqd, bfqq, root_group); -+ bfq_log_bfqq(bfqd, bfqq, "put_async_bfqq: putting %p, %d", -+ bfqq, bfqq->ref); -+ bfq_put_queue(bfqq); -+ *bfqq_ptr = NULL; -+ } -+} -+ -+/* -+ * Release all the bfqg references to its async queues. If we are -+ * deallocating the group these queues may still contain requests, so -+ * we reparent them to the root cgroup (i.e., the only one that will -+ * exist for sure until all the requests on a device are gone). -+ */ -+static void bfq_put_async_queues(struct bfq_data *bfqd, struct bfq_group *bfqg) -+{ -+ int i, j; -+ -+ for (i = 0; i < 2; i++) -+ for (j = 0; j < IOPRIO_BE_NR; j++) -+ __bfq_put_async_bfqq(bfqd, &bfqg->async_bfqq[i][j]); -+ -+ __bfq_put_async_bfqq(bfqd, &bfqg->async_idle_bfqq); -+} -+#endif -+ -+static void bfq_exit_queue(struct elevator_queue *e) -+{ -+ struct bfq_data *bfqd = e->elevator_data; -+ struct request_queue *q = bfqd->queue; -+ struct bfq_queue *bfqq, *n; -+ -+ bfq_shutdown_timer_wq(bfqd); -+ -+ spin_lock_irq(q->queue_lock); -+ -+ BUG_ON(bfqd->in_service_queue); -+ list_for_each_entry_safe(bfqq, n, &bfqd->idle_list, bfqq_list) -+ bfq_deactivate_bfqq(bfqd, bfqq, 0); -+ -+ spin_unlock_irq(q->queue_lock); -+ -+ bfq_shutdown_timer_wq(bfqd); -+ -+ BUG_ON(hrtimer_active(&bfqd->idle_slice_timer)); -+ -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ blkcg_deactivate_policy(q, &blkcg_policy_bfq); -+#else -+ kfree(bfqd->root_group); -+#endif -+ -+ kfree(bfqd); -+} -+ -+static void bfq_init_root_group(struct bfq_group *root_group, -+ struct bfq_data *bfqd) -+{ -+ int i; -+ -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ root_group->entity.parent = NULL; -+ root_group->my_entity = NULL; -+ root_group->bfqd = bfqd; -+#endif -+ root_group->rq_pos_tree = RB_ROOT; -+ for (i = 0; i < BFQ_IOPRIO_CLASSES; i++) -+ root_group->sched_data.service_tree[i] = BFQ_SERVICE_TREE_INIT; -+} -+ -+static int bfq_init_queue(struct request_queue *q, struct elevator_type *e) -+{ -+ struct bfq_data *bfqd; -+ struct elevator_queue *eq; -+ -+ eq = elevator_alloc(q, e); -+ if (!eq) -+ return -ENOMEM; -+ -+ bfqd = kzalloc_node(sizeof(*bfqd), GFP_KERNEL, q->node); -+ if (!bfqd) { -+ kobject_put(&eq->kobj); -+ return -ENOMEM; -+ } -+ eq->elevator_data = bfqd; -+ -+ /* -+ * Our fallback bfqq if bfq_find_alloc_queue() runs into OOM issues. -+ * Grab a permanent reference to it, so that the normal code flow -+ * will not attempt to free it. -+ */ -+ bfq_init_bfqq(bfqd, &bfqd->oom_bfqq, NULL, 1, 0); -+ bfqd->oom_bfqq.ref++; -+ bfqd->oom_bfqq.new_ioprio = BFQ_DEFAULT_QUEUE_IOPRIO; -+ bfqd->oom_bfqq.new_ioprio_class = IOPRIO_CLASS_BE; -+ bfqd->oom_bfqq.entity.new_weight = -+ bfq_ioprio_to_weight(bfqd->oom_bfqq.new_ioprio); -+ -+ /* oom_bfqq does not participate to bursts */ -+ bfq_clear_bfqq_just_created(&bfqd->oom_bfqq); -+ /* -+ * Trigger weight initialization, according to ioprio, at the -+ * oom_bfqq's first activation. The oom_bfqq's ioprio and ioprio -+ * class won't be changed any more. -+ */ -+ bfqd->oom_bfqq.entity.prio_changed = 1; -+ -+ bfqd->queue = q; -+ -+ spin_lock_irq(q->queue_lock); -+ q->elevator = eq; -+ spin_unlock_irq(q->queue_lock); -+ -+ bfqd->root_group = bfq_create_group_hierarchy(bfqd, q->node); -+ if (!bfqd->root_group) -+ goto out_free; -+ bfq_init_root_group(bfqd->root_group, bfqd); -+ bfq_init_entity(&bfqd->oom_bfqq.entity, bfqd->root_group); -+ -+ hrtimer_init(&bfqd->idle_slice_timer, CLOCK_MONOTONIC, -+ HRTIMER_MODE_REL); -+ bfqd->idle_slice_timer.function = bfq_idle_slice_timer; -+ -+ bfqd->queue_weights_tree = RB_ROOT; -+ bfqd->group_weights_tree = RB_ROOT; -+ -+ INIT_WORK(&bfqd->unplug_work, bfq_kick_queue); -+ -+ INIT_LIST_HEAD(&bfqd->active_list); -+ INIT_LIST_HEAD(&bfqd->idle_list); -+ INIT_HLIST_HEAD(&bfqd->burst_list); -+ -+ bfqd->hw_tag = -1; -+ -+ bfqd->bfq_max_budget = bfq_default_max_budget; -+ -+ bfqd->bfq_fifo_expire[0] = bfq_fifo_expire[0]; -+ bfqd->bfq_fifo_expire[1] = bfq_fifo_expire[1]; -+ bfqd->bfq_back_max = bfq_back_max; -+ bfqd->bfq_back_penalty = bfq_back_penalty; -+ bfqd->bfq_slice_idle = bfq_slice_idle; -+ bfqd->bfq_class_idle_last_service = 0; -+ bfqd->bfq_timeout = bfq_timeout; -+ -+ bfqd->bfq_requests_within_timer = 120; -+ -+ bfqd->bfq_large_burst_thresh = 8; -+ bfqd->bfq_burst_interval = msecs_to_jiffies(180); -+ -+ bfqd->low_latency = true; -+ -+ /* -+ * Trade-off between responsiveness and fairness. -+ */ -+ bfqd->bfq_wr_coeff = 30; -+ bfqd->bfq_wr_rt_max_time = msecs_to_jiffies(300); -+ bfqd->bfq_wr_max_time = 0; -+ bfqd->bfq_wr_min_idle_time = msecs_to_jiffies(2000); -+ bfqd->bfq_wr_min_inter_arr_async = msecs_to_jiffies(500); -+ bfqd->bfq_wr_max_softrt_rate = 7000; /* -+ * Approximate rate required -+ * to playback or record a -+ * high-definition compressed -+ * video. -+ */ -+ bfqd->wr_busy_queues = 0; -+ -+ /* -+ * Begin by assuming, optimistically, that the device is a -+ * high-speed one, and that its peak rate is equal to 2/3 of -+ * the highest reference rate. -+ */ -+ bfqd->RT_prod = R_fast[blk_queue_nonrot(bfqd->queue)] * -+ T_fast[blk_queue_nonrot(bfqd->queue)]; -+ bfqd->peak_rate = R_fast[blk_queue_nonrot(bfqd->queue)] * 2 / 3; -+ bfqd->device_speed = BFQ_BFQD_FAST; -+ -+ return 0; -+ -+out_free: -+ kfree(bfqd); -+ kobject_put(&eq->kobj); -+ return -ENOMEM; -+} -+ -+static void bfq_slab_kill(void) -+{ -+ kmem_cache_destroy(bfq_pool); -+} -+ -+static int __init bfq_slab_setup(void) -+{ -+ bfq_pool = KMEM_CACHE(bfq_queue, 0); -+ if (!bfq_pool) -+ return -ENOMEM; -+ return 0; -+} -+ -+static ssize_t bfq_var_show(unsigned int var, char *page) -+{ -+ return sprintf(page, "%u\n", var); -+} -+ -+static ssize_t bfq_var_store(unsigned long *var, const char *page, -+ size_t count) -+{ -+ unsigned long new_val; -+ int ret = kstrtoul(page, 10, &new_val); -+ -+ if (ret == 0) -+ *var = new_val; -+ -+ return count; -+} -+ -+static ssize_t bfq_wr_max_time_show(struct elevator_queue *e, char *page) -+{ -+ struct bfq_data *bfqd = e->elevator_data; -+ -+ return sprintf(page, "%d\n", bfqd->bfq_wr_max_time > 0 ? -+ jiffies_to_msecs(bfqd->bfq_wr_max_time) : -+ jiffies_to_msecs(bfq_wr_duration(bfqd))); -+} -+ -+static ssize_t bfq_weights_show(struct elevator_queue *e, char *page) -+{ -+ struct bfq_queue *bfqq; -+ struct bfq_data *bfqd = e->elevator_data; -+ ssize_t num_char = 0; -+ -+ num_char += sprintf(page + num_char, "Tot reqs queued %d\n\n", -+ bfqd->queued); -+ -+ spin_lock_irq(bfqd->queue->queue_lock); -+ -+ num_char += sprintf(page + num_char, "Active:\n"); -+ list_for_each_entry(bfqq, &bfqd->active_list, bfqq_list) { -+ num_char += sprintf(page + num_char, -+ "pid%d: weight %hu, nr_queued %d %d, ", -+ bfqq->pid, -+ bfqq->entity.weight, -+ bfqq->queued[0], -+ bfqq->queued[1]); -+ num_char += sprintf(page + num_char, -+ "dur %d/%u\n", -+ jiffies_to_msecs( -+ jiffies - -+ bfqq->last_wr_start_finish), -+ jiffies_to_msecs(bfqq->wr_cur_max_time)); -+ } -+ -+ num_char += sprintf(page + num_char, "Idle:\n"); -+ list_for_each_entry(bfqq, &bfqd->idle_list, bfqq_list) { -+ num_char += sprintf(page + num_char, -+ "pid%d: weight %hu, dur %d/%u\n", -+ bfqq->pid, -+ bfqq->entity.weight, -+ jiffies_to_msecs(jiffies - -+ bfqq->last_wr_start_finish), -+ jiffies_to_msecs(bfqq->wr_cur_max_time)); -+ } -+ -+ spin_unlock_irq(bfqd->queue->queue_lock); -+ -+ return num_char; -+} -+ -+#define SHOW_FUNCTION(__FUNC, __VAR, __CONV) \ -+static ssize_t __FUNC(struct elevator_queue *e, char *page) \ -+{ \ -+ struct bfq_data *bfqd = e->elevator_data; \ -+ u64 __data = __VAR; \ -+ if (__CONV == 1) \ -+ __data = jiffies_to_msecs(__data); \ -+ else if (__CONV == 2) \ -+ __data = div_u64(__data, NSEC_PER_MSEC); \ -+ return bfq_var_show(__data, (page)); \ -+} -+SHOW_FUNCTION(bfq_fifo_expire_sync_show, bfqd->bfq_fifo_expire[1], 2); -+SHOW_FUNCTION(bfq_fifo_expire_async_show, bfqd->bfq_fifo_expire[0], 2); -+SHOW_FUNCTION(bfq_back_seek_max_show, bfqd->bfq_back_max, 0); -+SHOW_FUNCTION(bfq_back_seek_penalty_show, bfqd->bfq_back_penalty, 0); -+SHOW_FUNCTION(bfq_slice_idle_show, bfqd->bfq_slice_idle, 2); -+SHOW_FUNCTION(bfq_max_budget_show, bfqd->bfq_user_max_budget, 0); -+SHOW_FUNCTION(bfq_timeout_sync_show, bfqd->bfq_timeout, 1); -+SHOW_FUNCTION(bfq_strict_guarantees_show, bfqd->strict_guarantees, 0); -+SHOW_FUNCTION(bfq_low_latency_show, bfqd->low_latency, 0); -+SHOW_FUNCTION(bfq_wr_coeff_show, bfqd->bfq_wr_coeff, 0); -+SHOW_FUNCTION(bfq_wr_rt_max_time_show, bfqd->bfq_wr_rt_max_time, 1); -+SHOW_FUNCTION(bfq_wr_min_idle_time_show, bfqd->bfq_wr_min_idle_time, 1); -+SHOW_FUNCTION(bfq_wr_min_inter_arr_async_show, bfqd->bfq_wr_min_inter_arr_async, -+ 1); -+SHOW_FUNCTION(bfq_wr_max_softrt_rate_show, bfqd->bfq_wr_max_softrt_rate, 0); -+#undef SHOW_FUNCTION -+ -+#define USEC_SHOW_FUNCTION(__FUNC, __VAR) \ -+static ssize_t __FUNC(struct elevator_queue *e, char *page) \ -+{ \ -+ struct bfq_data *bfqd = e->elevator_data; \ -+ u64 __data = __VAR; \ -+ __data = div_u64(__data, NSEC_PER_USEC); \ -+ return bfq_var_show(__data, (page)); \ -+} -+USEC_SHOW_FUNCTION(bfq_slice_idle_us_show, bfqd->bfq_slice_idle); -+#undef USEC_SHOW_FUNCTION -+ -+#define STORE_FUNCTION(__FUNC, __PTR, MIN, MAX, __CONV) \ -+static ssize_t \ -+__FUNC(struct elevator_queue *e, const char *page, size_t count) \ -+{ \ -+ struct bfq_data *bfqd = e->elevator_data; \ -+ unsigned long uninitialized_var(__data); \ -+ int ret = bfq_var_store(&__data, (page), count); \ -+ if (__data < (MIN)) \ -+ __data = (MIN); \ -+ else if (__data > (MAX)) \ -+ __data = (MAX); \ -+ if (__CONV == 1) \ -+ *(__PTR) = msecs_to_jiffies(__data); \ -+ else if (__CONV == 2) \ -+ *(__PTR) = (u64)__data * NSEC_PER_MSEC; \ -+ else \ -+ *(__PTR) = __data; \ -+ return ret; \ -+} -+STORE_FUNCTION(bfq_fifo_expire_sync_store, &bfqd->bfq_fifo_expire[1], 1, -+ INT_MAX, 2); -+STORE_FUNCTION(bfq_fifo_expire_async_store, &bfqd->bfq_fifo_expire[0], 1, -+ INT_MAX, 2); -+STORE_FUNCTION(bfq_back_seek_max_store, &bfqd->bfq_back_max, 0, INT_MAX, 0); -+STORE_FUNCTION(bfq_back_seek_penalty_store, &bfqd->bfq_back_penalty, 1, -+ INT_MAX, 0); -+STORE_FUNCTION(bfq_slice_idle_store, &bfqd->bfq_slice_idle, 0, INT_MAX, 2); -+STORE_FUNCTION(bfq_wr_coeff_store, &bfqd->bfq_wr_coeff, 1, INT_MAX, 0); -+STORE_FUNCTION(bfq_wr_max_time_store, &bfqd->bfq_wr_max_time, 0, INT_MAX, 1); -+STORE_FUNCTION(bfq_wr_rt_max_time_store, &bfqd->bfq_wr_rt_max_time, 0, INT_MAX, -+ 1); -+STORE_FUNCTION(bfq_wr_min_idle_time_store, &bfqd->bfq_wr_min_idle_time, 0, -+ INT_MAX, 1); -+STORE_FUNCTION(bfq_wr_min_inter_arr_async_store, -+ &bfqd->bfq_wr_min_inter_arr_async, 0, INT_MAX, 1); -+STORE_FUNCTION(bfq_wr_max_softrt_rate_store, &bfqd->bfq_wr_max_softrt_rate, 0, -+ INT_MAX, 0); -+#undef STORE_FUNCTION -+ -+#define USEC_STORE_FUNCTION(__FUNC, __PTR, MIN, MAX) \ -+static ssize_t __FUNC(struct elevator_queue *e, const char *page, size_t count)\ -+{ \ -+ struct bfq_data *bfqd = e->elevator_data; \ -+ unsigned long __data; \ -+ int ret = bfq_var_store(&__data, (page), count); \ -+ if (__data < (MIN)) \ -+ __data = (MIN); \ -+ else if (__data > (MAX)) \ -+ __data = (MAX); \ -+ *(__PTR) = (u64)__data * NSEC_PER_USEC; \ -+ return ret; \ -+} -+USEC_STORE_FUNCTION(bfq_slice_idle_us_store, &bfqd->bfq_slice_idle, 0, -+ UINT_MAX); -+#undef USEC_STORE_FUNCTION -+ -+/* do nothing for the moment */ -+static ssize_t bfq_weights_store(struct elevator_queue *e, -+ const char *page, size_t count) -+{ -+ return count; -+} -+ -+static ssize_t bfq_max_budget_store(struct elevator_queue *e, -+ const char *page, size_t count) -+{ -+ struct bfq_data *bfqd = e->elevator_data; -+ unsigned long uninitialized_var(__data); -+ int ret = bfq_var_store(&__data, (page), count); -+ -+ if (__data == 0) -+ bfqd->bfq_max_budget = bfq_calc_max_budget(bfqd); -+ else { -+ if (__data > INT_MAX) -+ __data = INT_MAX; -+ bfqd->bfq_max_budget = __data; -+ } -+ -+ bfqd->bfq_user_max_budget = __data; -+ -+ return ret; -+} -+ -+/* -+ * Leaving this name to preserve name compatibility with cfq -+ * parameters, but this timeout is used for both sync and async. -+ */ -+static ssize_t bfq_timeout_sync_store(struct elevator_queue *e, -+ const char *page, size_t count) -+{ -+ struct bfq_data *bfqd = e->elevator_data; -+ unsigned long uninitialized_var(__data); -+ int ret = bfq_var_store(&__data, (page), count); -+ -+ if (__data < 1) -+ __data = 1; -+ else if (__data > INT_MAX) -+ __data = INT_MAX; -+ -+ bfqd->bfq_timeout = msecs_to_jiffies(__data); -+ if (bfqd->bfq_user_max_budget == 0) -+ bfqd->bfq_max_budget = bfq_calc_max_budget(bfqd); -+ -+ return ret; -+} -+ -+static ssize_t bfq_strict_guarantees_store(struct elevator_queue *e, -+ const char *page, size_t count) -+{ -+ struct bfq_data *bfqd = e->elevator_data; -+ unsigned long uninitialized_var(__data); -+ int ret = bfq_var_store(&__data, (page), count); -+ -+ if (__data > 1) -+ __data = 1; -+ if (!bfqd->strict_guarantees && __data == 1 -+ && bfqd->bfq_slice_idle < 8 * NSEC_PER_MSEC) -+ bfqd->bfq_slice_idle = 8 * NSEC_PER_MSEC; -+ -+ bfqd->strict_guarantees = __data; -+ -+ return ret; -+} -+ -+static ssize_t bfq_low_latency_store(struct elevator_queue *e, -+ const char *page, size_t count) -+{ -+ struct bfq_data *bfqd = e->elevator_data; -+ unsigned long uninitialized_var(__data); -+ int ret = bfq_var_store(&__data, (page), count); -+ -+ if (__data > 1) -+ __data = 1; -+ if (__data == 0 && bfqd->low_latency != 0) -+ bfq_end_wr(bfqd); -+ bfqd->low_latency = __data; -+ -+ return ret; -+} -+ -+#define BFQ_ATTR(name) \ -+ __ATTR(name, S_IRUGO|S_IWUSR, bfq_##name##_show, bfq_##name##_store) -+ -+static struct elv_fs_entry bfq_attrs[] = { -+ BFQ_ATTR(fifo_expire_sync), -+ BFQ_ATTR(fifo_expire_async), -+ BFQ_ATTR(back_seek_max), -+ BFQ_ATTR(back_seek_penalty), -+ BFQ_ATTR(slice_idle), -+ BFQ_ATTR(slice_idle_us), -+ BFQ_ATTR(max_budget), -+ BFQ_ATTR(timeout_sync), -+ BFQ_ATTR(strict_guarantees), -+ BFQ_ATTR(low_latency), -+ BFQ_ATTR(wr_coeff), -+ BFQ_ATTR(wr_max_time), -+ BFQ_ATTR(wr_rt_max_time), -+ BFQ_ATTR(wr_min_idle_time), -+ BFQ_ATTR(wr_min_inter_arr_async), -+ BFQ_ATTR(wr_max_softrt_rate), -+ BFQ_ATTR(weights), -+ __ATTR_NULL -+}; -+ -+static struct elevator_type iosched_bfq = { -+ .ops = { -+ .elevator_merge_fn = bfq_merge, -+ .elevator_merged_fn = bfq_merged_request, -+ .elevator_merge_req_fn = bfq_merged_requests, -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ .elevator_bio_merged_fn = bfq_bio_merged, -+#endif -+ .elevator_allow_bio_merge_fn = bfq_allow_bio_merge, -+ .elevator_allow_rq_merge_fn = bfq_allow_rq_merge, -+ .elevator_dispatch_fn = bfq_dispatch_requests, -+ .elevator_add_req_fn = bfq_insert_request, -+ .elevator_activate_req_fn = bfq_activate_request, -+ .elevator_deactivate_req_fn = bfq_deactivate_request, -+ .elevator_completed_req_fn = bfq_completed_request, -+ .elevator_former_req_fn = elv_rb_former_request, -+ .elevator_latter_req_fn = elv_rb_latter_request, -+ .elevator_init_icq_fn = bfq_init_icq, -+ .elevator_exit_icq_fn = bfq_exit_icq, -+ .elevator_set_req_fn = bfq_set_request, -+ .elevator_put_req_fn = bfq_put_request, -+ .elevator_may_queue_fn = bfq_may_queue, -+ .elevator_init_fn = bfq_init_queue, -+ .elevator_exit_fn = bfq_exit_queue, -+ }, -+ .icq_size = sizeof(struct bfq_io_cq), -+ .icq_align = __alignof__(struct bfq_io_cq), -+ .elevator_attrs = bfq_attrs, -+ .elevator_name = "bfq", -+ .elevator_owner = THIS_MODULE, -+}; -+ -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+static struct blkcg_policy blkcg_policy_bfq = { -+ .dfl_cftypes = bfq_blkg_files, -+ .legacy_cftypes = bfq_blkcg_legacy_files, -+ -+ .cpd_alloc_fn = bfq_cpd_alloc, -+ .cpd_init_fn = bfq_cpd_init, -+ .cpd_bind_fn = bfq_cpd_init, -+ .cpd_free_fn = bfq_cpd_free, -+ -+ .pd_alloc_fn = bfq_pd_alloc, -+ .pd_init_fn = bfq_pd_init, -+ .pd_offline_fn = bfq_pd_offline, -+ .pd_free_fn = bfq_pd_free, -+ .pd_reset_stats_fn = bfq_pd_reset_stats, -+}; -+#endif -+ -+static int __init bfq_init(void) -+{ -+ int ret; -+ char msg[50] = "BFQ I/O-scheduler: v8r4"; -+ -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ ret = blkcg_policy_register(&blkcg_policy_bfq); -+ if (ret) -+ return ret; -+#endif -+ -+ ret = -ENOMEM; -+ if (bfq_slab_setup()) -+ goto err_pol_unreg; -+ -+ /* -+ * Times to load large popular applications for the typical -+ * systems installed on the reference devices (see the -+ * comments before the definitions of the next two -+ * arrays). Actually, we use slightly slower values, as the -+ * estimated peak rate tends to be smaller than the actual -+ * peak rate. The reason for this last fact is that estimates -+ * are computed over much shorter time intervals than the long -+ * intervals typically used for benchmarking. Why? First, to -+ * adapt more quickly to variations. Second, because an I/O -+ * scheduler cannot rely on a peak-rate-evaluation workload to -+ * be run for a long time. -+ */ -+ T_slow[0] = msecs_to_jiffies(3500); /* actually 4 sec */ -+ T_slow[1] = msecs_to_jiffies(1000); /* actually 1.5 sec */ -+ T_fast[0] = msecs_to_jiffies(7000); /* actually 8 sec */ -+ T_fast[1] = msecs_to_jiffies(2500); /* actually 3 sec */ -+ -+ /* -+ * Thresholds that determine the switch between speed classes -+ * (see the comments before the definition of the array -+ * device_speed_thresh). These thresholds are biased towards -+ * transitions to the fast class. This is safer than the -+ * opposite bias. In fact, a wrong transition to the slow -+ * class results in short weight-raising periods, because the -+ * speed of the device then tends to be higher that the -+ * reference peak rate. On the opposite end, a wrong -+ * transition to the fast class tends to increase -+ * weight-raising periods, because of the opposite reason. -+ */ -+ device_speed_thresh[0] = (4 * R_slow[0]) / 3; -+ device_speed_thresh[1] = (4 * R_slow[1]) / 3; -+ -+ ret = elv_register(&iosched_bfq); -+ if (ret) -+ goto err_pol_unreg; -+ -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ strcat(msg, " (with cgroups support)"); -+#endif -+ pr_info("%s", msg); -+ -+ return 0; -+ -+err_pol_unreg: -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ blkcg_policy_unregister(&blkcg_policy_bfq); -+#endif -+ return ret; -+} -+ -+static void __exit bfq_exit(void) -+{ -+ elv_unregister(&iosched_bfq); -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ blkcg_policy_unregister(&blkcg_policy_bfq); -+#endif -+ bfq_slab_kill(); -+} -+ -+module_init(bfq_init); -+module_exit(bfq_exit); -+ -+MODULE_AUTHOR("Arianna Avanzini, Fabio Checconi, Paolo Valente"); -+MODULE_LICENSE("GPL"); -diff -w -uNr '--exclude=.git' linux-4.8/block/bfq-sched.c linux-4.8-bfq/block/bfq-sched.c ---- linux-4.8/block/bfq-sched.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-4.8-bfq/block/bfq-sched.c 2016-10-18 12:57:57.691164881 +0200 -@@ -0,0 +1,1501 @@ -+/* -+ * BFQ: Hierarchical B-WF2Q+ scheduler. -+ * -+ * Based on ideas and code from CFQ: -+ * Copyright (C) 2003 Jens Axboe -+ * -+ * Copyright (C) 2008 Fabio Checconi -+ * Paolo Valente -+ * -+ * Copyright (C) 2015 Paolo Valente -+ * -+ * Copyright (C) 2016 Paolo Valente -+ */ -+ -+static struct bfq_group *bfqq_group(struct bfq_queue *bfqq); -+ -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+#define for_each_entity(entity) \ -+ for (; entity ; entity = entity->parent) -+ -+#define for_each_entity_safe(entity, parent) \ -+ for (; entity && ({ parent = entity->parent; 1; }); entity = parent) -+ -+ -+static struct bfq_entity *bfq_lookup_next_entity(struct bfq_sched_data *sd, -+ int extract, -+ struct bfq_data *bfqd); -+ -+static void bfq_update_budget(struct bfq_entity *next_in_service) -+{ -+ struct bfq_entity *bfqg_entity; -+ struct bfq_group *bfqg; -+ struct bfq_sched_data *group_sd; -+ -+ BUG_ON(!next_in_service); -+ -+ group_sd = next_in_service->sched_data; -+ -+ bfqg = container_of(group_sd, struct bfq_group, sched_data); -+ /* -+ * bfq_group's my_entity field is not NULL only if the group -+ * is not the root group. We must not touch the root entity -+ * as it must never become an in-service entity. -+ */ -+ bfqg_entity = bfqg->my_entity; -+ if (bfqg_entity) -+ bfqg_entity->budget = next_in_service->budget; -+} -+ -+static int bfq_update_next_in_service(struct bfq_sched_data *sd) -+{ -+ struct bfq_entity *next_in_service; -+ struct bfq_queue *bfqq; -+ -+ if (sd->in_service_entity) -+ /* will update/requeue at the end of service */ -+ return 0; -+ -+ /* -+ * NOTE: this can be improved in many ways, such as returning -+ * 1 (and thus propagating upwards the update) only when the -+ * budget changes, or caching the bfqq that will be scheduled -+ * next from this subtree. By now we worry more about -+ * correctness than about performance... -+ */ -+ next_in_service = bfq_lookup_next_entity(sd, 0, NULL); -+ sd->next_in_service = next_in_service; -+ -+ if (next_in_service) -+ bfq_update_budget(next_in_service); -+ else -+ goto exit; -+ -+ bfqq = bfq_entity_to_bfqq(next_in_service); -+ if (bfqq) -+ bfq_log_bfqq(bfqq->bfqd, bfqq, -+ "update_next_in_service: chosen this queue"); -+ else { -+ struct bfq_group *bfqg = -+ container_of(next_in_service, -+ struct bfq_group, entity); -+ -+ bfq_log_bfqg((struct bfq_data *)bfqg->bfqd, bfqg, -+ "update_next_in_service: chosen this entity"); -+ } -+exit: -+ return 1; -+} -+ -+static void bfq_check_next_in_service(struct bfq_sched_data *sd, -+ struct bfq_entity *entity) -+{ -+ WARN_ON(sd->next_in_service != entity); -+} -+#else -+#define for_each_entity(entity) \ -+ for (; entity ; entity = NULL) -+ -+#define for_each_entity_safe(entity, parent) \ -+ for (parent = NULL; entity ; entity = parent) -+ -+static int bfq_update_next_in_service(struct bfq_sched_data *sd) -+{ -+ return 0; -+} -+ -+static void bfq_check_next_in_service(struct bfq_sched_data *sd, -+ struct bfq_entity *entity) -+{ -+} -+ -+static void bfq_update_budget(struct bfq_entity *next_in_service) -+{ -+} -+#endif -+ -+/* -+ * Shift for timestamp calculations. This actually limits the maximum -+ * service allowed in one timestamp delta (small shift values increase it), -+ * the maximum total weight that can be used for the queues in the system -+ * (big shift values increase it), and the period of virtual time -+ * wraparounds. -+ */ -+#define WFQ_SERVICE_SHIFT 22 -+ -+/** -+ * bfq_gt - compare two timestamps. -+ * @a: first ts. -+ * @b: second ts. -+ * -+ * Return @a > @b, dealing with wrapping correctly. -+ */ -+static int bfq_gt(u64 a, u64 b) -+{ -+ return (s64)(a - b) > 0; -+} -+ -+static struct bfq_queue *bfq_entity_to_bfqq(struct bfq_entity *entity) -+{ -+ struct bfq_queue *bfqq = NULL; -+ -+ BUG_ON(!entity); -+ -+ if (!entity->my_sched_data) -+ bfqq = container_of(entity, struct bfq_queue, entity); -+ -+ return bfqq; -+} -+ -+ -+/** -+ * bfq_delta - map service into the virtual time domain. -+ * @service: amount of service. -+ * @weight: scale factor (weight of an entity or weight sum). -+ */ -+static u64 bfq_delta(unsigned long service, unsigned long weight) -+{ -+ u64 d = (u64)service << WFQ_SERVICE_SHIFT; -+ -+ do_div(d, weight); -+ return d; -+} -+ -+/** -+ * bfq_calc_finish - assign the finish time to an entity. -+ * @entity: the entity to act upon. -+ * @service: the service to be charged to the entity. -+ */ -+static void bfq_calc_finish(struct bfq_entity *entity, unsigned long service) -+{ -+ struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); -+ unsigned long long start, finish, delta; -+ -+ BUG_ON(entity->weight == 0); -+ -+ entity->finish = entity->start + -+ bfq_delta(service, entity->weight); -+ -+ start = ((entity->start>>10)*1000)>>12; -+ finish = ((entity->finish>>10)*1000)>>12; -+ delta = ((bfq_delta(service, entity->weight)>>10)*1000)>>12; -+ -+ if (bfqq) { -+ bfq_log_bfqq(bfqq->bfqd, bfqq, -+ "calc_finish: serv %lu, w %d", -+ service, entity->weight); -+ bfq_log_bfqq(bfqq->bfqd, bfqq, -+ "calc_finish: start %llu, finish %llu, delta %llu", -+ start, finish, delta); -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ } else { -+ struct bfq_group *bfqg = -+ container_of(entity, struct bfq_group, entity); -+ -+ bfq_log_bfqg((struct bfq_data *)bfqg->bfqd, bfqg, -+ "calc_finish group: serv %lu, w %d", -+ service, entity->weight); -+ bfq_log_bfqg((struct bfq_data *)bfqg->bfqd, bfqg, -+ "calc_finish group: start %llu, finish %llu, delta %llu", -+ start, finish, delta); -+#endif -+ } -+} -+ -+/** -+ * bfq_entity_of - get an entity from a node. -+ * @node: the node field of the entity. -+ * -+ * Convert a node pointer to the relative entity. This is used only -+ * to simplify the logic of some functions and not as the generic -+ * conversion mechanism because, e.g., in the tree walking functions, -+ * the check for a %NULL value would be redundant. -+ */ -+static struct bfq_entity *bfq_entity_of(struct rb_node *node) -+{ -+ struct bfq_entity *entity = NULL; -+ -+ if (node) -+ entity = rb_entry(node, struct bfq_entity, rb_node); -+ -+ return entity; -+} -+ -+/** -+ * bfq_extract - remove an entity from a tree. -+ * @root: the tree root. -+ * @entity: the entity to remove. -+ */ -+static void bfq_extract(struct rb_root *root, struct bfq_entity *entity) -+{ -+ BUG_ON(entity->tree != root); -+ -+ entity->tree = NULL; -+ rb_erase(&entity->rb_node, root); -+} -+ -+/** -+ * bfq_idle_extract - extract an entity from the idle tree. -+ * @st: the service tree of the owning @entity. -+ * @entity: the entity being removed. -+ */ -+static void bfq_idle_extract(struct bfq_service_tree *st, -+ struct bfq_entity *entity) -+{ -+ struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); -+ struct rb_node *next; -+ -+ BUG_ON(entity->tree != &st->idle); -+ -+ if (entity == st->first_idle) { -+ next = rb_next(&entity->rb_node); -+ st->first_idle = bfq_entity_of(next); -+ } -+ -+ if (entity == st->last_idle) { -+ next = rb_prev(&entity->rb_node); -+ st->last_idle = bfq_entity_of(next); -+ } -+ -+ bfq_extract(&st->idle, entity); -+ -+ if (bfqq) -+ list_del(&bfqq->bfqq_list); -+} -+ -+/** -+ * bfq_insert - generic tree insertion. -+ * @root: tree root. -+ * @entity: entity to insert. -+ * -+ * This is used for the idle and the active tree, since they are both -+ * ordered by finish time. -+ */ -+static void bfq_insert(struct rb_root *root, struct bfq_entity *entity) -+{ -+ struct bfq_entity *entry; -+ struct rb_node **node = &root->rb_node; -+ struct rb_node *parent = NULL; -+ -+ BUG_ON(entity->tree); -+ -+ while (*node) { -+ parent = *node; -+ entry = rb_entry(parent, struct bfq_entity, rb_node); -+ -+ if (bfq_gt(entry->finish, entity->finish)) -+ node = &parent->rb_left; -+ else -+ node = &parent->rb_right; -+ } -+ -+ rb_link_node(&entity->rb_node, parent, node); -+ rb_insert_color(&entity->rb_node, root); -+ -+ entity->tree = root; -+} -+ -+/** -+ * bfq_update_min - update the min_start field of a entity. -+ * @entity: the entity to update. -+ * @node: one of its children. -+ * -+ * This function is called when @entity may store an invalid value for -+ * min_start due to updates to the active tree. The function assumes -+ * that the subtree rooted at @node (which may be its left or its right -+ * child) has a valid min_start value. -+ */ -+static void bfq_update_min(struct bfq_entity *entity, struct rb_node *node) -+{ -+ struct bfq_entity *child; -+ -+ if (node) { -+ child = rb_entry(node, struct bfq_entity, rb_node); -+ if (bfq_gt(entity->min_start, child->min_start)) -+ entity->min_start = child->min_start; -+ } -+} -+ -+/** -+ * bfq_update_active_node - recalculate min_start. -+ * @node: the node to update. -+ * -+ * @node may have changed position or one of its children may have moved, -+ * this function updates its min_start value. The left and right subtrees -+ * are assumed to hold a correct min_start value. -+ */ -+static void bfq_update_active_node(struct rb_node *node) -+{ -+ struct bfq_entity *entity = rb_entry(node, struct bfq_entity, rb_node); -+ struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); -+ -+ entity->min_start = entity->start; -+ bfq_update_min(entity, node->rb_right); -+ bfq_update_min(entity, node->rb_left); -+ -+ if (bfqq) { -+ bfq_log_bfqq(bfqq->bfqd, bfqq, -+ "update_active_node: new min_start %llu", -+ ((entity->min_start>>10)*1000)>>12); -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ } else { -+ struct bfq_group *bfqg = -+ container_of(entity, struct bfq_group, entity); -+ -+ bfq_log_bfqg((struct bfq_data *)bfqg->bfqd, bfqg, -+ "update_active_node: new min_start %llu", -+ ((entity->min_start>>10)*1000)>>12); -+#endif -+ } -+} -+ -+/** -+ * bfq_update_active_tree - update min_start for the whole active tree. -+ * @node: the starting node. -+ * -+ * @node must be the deepest modified node after an update. This function -+ * updates its min_start using the values held by its children, assuming -+ * that they did not change, and then updates all the nodes that may have -+ * changed in the path to the root. The only nodes that may have changed -+ * are the ones in the path or their siblings. -+ */ -+static void bfq_update_active_tree(struct rb_node *node) -+{ -+ struct rb_node *parent; -+ -+up: -+ bfq_update_active_node(node); -+ -+ parent = rb_parent(node); -+ if (!parent) -+ return; -+ -+ if (node == parent->rb_left && parent->rb_right) -+ bfq_update_active_node(parent->rb_right); -+ else if (parent->rb_left) -+ bfq_update_active_node(parent->rb_left); -+ -+ node = parent; -+ goto up; -+} -+ -+static void bfq_weights_tree_add(struct bfq_data *bfqd, -+ struct bfq_entity *entity, -+ struct rb_root *root); -+ -+static void bfq_weights_tree_remove(struct bfq_data *bfqd, -+ struct bfq_entity *entity, -+ struct rb_root *root); -+ -+ -+/** -+ * bfq_active_insert - insert an entity in the active tree of its -+ * group/device. -+ * @st: the service tree of the entity. -+ * @entity: the entity being inserted. -+ * -+ * The active tree is ordered by finish time, but an extra key is kept -+ * per each node, containing the minimum value for the start times of -+ * its children (and the node itself), so it's possible to search for -+ * the eligible node with the lowest finish time in logarithmic time. -+ */ -+static void bfq_active_insert(struct bfq_service_tree *st, -+ struct bfq_entity *entity) -+{ -+ struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); -+ struct rb_node *node = &entity->rb_node; -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ struct bfq_sched_data *sd = NULL; -+ struct bfq_group *bfqg = NULL; -+ struct bfq_data *bfqd = NULL; -+#endif -+ -+ bfq_insert(&st->active, entity); -+ -+ if (node->rb_left) -+ node = node->rb_left; -+ else if (node->rb_right) -+ node = node->rb_right; -+ -+ bfq_update_active_tree(node); -+ -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ sd = entity->sched_data; -+ bfqg = container_of(sd, struct bfq_group, sched_data); -+ BUG_ON(!bfqg); -+ bfqd = (struct bfq_data *)bfqg->bfqd; -+#endif -+ if (bfqq) -+ list_add(&bfqq->bfqq_list, &bfqq->bfqd->active_list); -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ else { /* bfq_group */ -+ BUG_ON(!bfqd); -+ bfq_weights_tree_add(bfqd, entity, &bfqd->group_weights_tree); -+ } -+ if (bfqg != bfqd->root_group) { -+ BUG_ON(!bfqg); -+ BUG_ON(!bfqd); -+ bfqg->active_entities++; -+ } -+#endif -+} -+ -+/** -+ * bfq_ioprio_to_weight - calc a weight from an ioprio. -+ * @ioprio: the ioprio value to convert. -+ */ -+static unsigned short bfq_ioprio_to_weight(int ioprio) -+{ -+ BUG_ON(ioprio < 0 || ioprio >= IOPRIO_BE_NR); -+ return (IOPRIO_BE_NR - ioprio) * BFQ_WEIGHT_CONVERSION_COEFF; -+} -+ -+/** -+ * bfq_weight_to_ioprio - calc an ioprio from a weight. -+ * @weight: the weight value to convert. -+ * -+ * To preserve as much as possible the old only-ioprio user interface, -+ * 0 is used as an escape ioprio value for weights (numerically) equal or -+ * larger than IOPRIO_BE_NR * BFQ_WEIGHT_CONVERSION_COEFF. -+ */ -+static unsigned short bfq_weight_to_ioprio(int weight) -+{ -+ BUG_ON(weight < BFQ_MIN_WEIGHT || weight > BFQ_MAX_WEIGHT); -+ return IOPRIO_BE_NR * BFQ_WEIGHT_CONVERSION_COEFF - weight < 0 ? -+ 0 : IOPRIO_BE_NR * BFQ_WEIGHT_CONVERSION_COEFF - weight; -+} -+ -+static void bfq_get_entity(struct bfq_entity *entity) -+{ -+ struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); -+ -+ if (bfqq) { -+ bfqq->ref++; -+ bfq_log_bfqq(bfqq->bfqd, bfqq, "get_entity: %p %d", -+ bfqq, bfqq->ref); -+ } -+} -+ -+/** -+ * bfq_find_deepest - find the deepest node that an extraction can modify. -+ * @node: the node being removed. -+ * -+ * Do the first step of an extraction in an rb tree, looking for the -+ * node that will replace @node, and returning the deepest node that -+ * the following modifications to the tree can touch. If @node is the -+ * last node in the tree return %NULL. -+ */ -+static struct rb_node *bfq_find_deepest(struct rb_node *node) -+{ -+ struct rb_node *deepest; -+ -+ if (!node->rb_right && !node->rb_left) -+ deepest = rb_parent(node); -+ else if (!node->rb_right) -+ deepest = node->rb_left; -+ else if (!node->rb_left) -+ deepest = node->rb_right; -+ else { -+ deepest = rb_next(node); -+ if (deepest->rb_right) -+ deepest = deepest->rb_right; -+ else if (rb_parent(deepest) != node) -+ deepest = rb_parent(deepest); -+ } -+ -+ return deepest; -+} -+ -+/** -+ * bfq_active_extract - remove an entity from the active tree. -+ * @st: the service_tree containing the tree. -+ * @entity: the entity being removed. -+ */ -+static void bfq_active_extract(struct bfq_service_tree *st, -+ struct bfq_entity *entity) -+{ -+ struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); -+ struct rb_node *node; -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ struct bfq_sched_data *sd = NULL; -+ struct bfq_group *bfqg = NULL; -+ struct bfq_data *bfqd = NULL; -+#endif -+ -+ node = bfq_find_deepest(&entity->rb_node); -+ bfq_extract(&st->active, entity); -+ -+ if (node) -+ bfq_update_active_tree(node); -+ -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ sd = entity->sched_data; -+ bfqg = container_of(sd, struct bfq_group, sched_data); -+ BUG_ON(!bfqg); -+ bfqd = (struct bfq_data *)bfqg->bfqd; -+#endif -+ if (bfqq) -+ list_del(&bfqq->bfqq_list); -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ else { /* bfq_group */ -+ BUG_ON(!bfqd); -+ bfq_weights_tree_remove(bfqd, entity, -+ &bfqd->group_weights_tree); -+ } -+ if (bfqg != bfqd->root_group) { -+ BUG_ON(!bfqg); -+ BUG_ON(!bfqd); -+ BUG_ON(!bfqg->active_entities); -+ bfqg->active_entities--; -+ } -+#endif -+} -+ -+/** -+ * bfq_idle_insert - insert an entity into the idle tree. -+ * @st: the service tree containing the tree. -+ * @entity: the entity to insert. -+ */ -+static void bfq_idle_insert(struct bfq_service_tree *st, -+ struct bfq_entity *entity) -+{ -+ struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); -+ struct bfq_entity *first_idle = st->first_idle; -+ struct bfq_entity *last_idle = st->last_idle; -+ -+ if (!first_idle || bfq_gt(first_idle->finish, entity->finish)) -+ st->first_idle = entity; -+ if (!last_idle || bfq_gt(entity->finish, last_idle->finish)) -+ st->last_idle = entity; -+ -+ bfq_insert(&st->idle, entity); -+ -+ if (bfqq) -+ list_add(&bfqq->bfqq_list, &bfqq->bfqd->idle_list); -+} -+ -+/** -+ * bfq_forget_entity - remove an entity from the wfq trees. -+ * @st: the service tree. -+ * @entity: the entity being removed. -+ * -+ * Update the device status and forget everything about @entity, putting -+ * the device reference to it, if it is a queue. Entities belonging to -+ * groups are not refcounted. -+ */ -+static void bfq_forget_entity(struct bfq_service_tree *st, -+ struct bfq_entity *entity) -+{ -+ struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); -+ struct bfq_sched_data *sd; -+ -+ BUG_ON(!entity->on_st); -+ -+ entity->on_st = 0; -+ st->wsum -= entity->weight; -+ if (bfqq) { -+ sd = entity->sched_data; -+ bfq_log_bfqq(bfqq->bfqd, bfqq, "forget_entity: %p %d", -+ bfqq, bfqq->ref); -+ bfq_put_queue(bfqq); -+ } -+} -+ -+/** -+ * bfq_put_idle_entity - release the idle tree ref of an entity. -+ * @st: service tree for the entity. -+ * @entity: the entity being released. -+ */ -+static void bfq_put_idle_entity(struct bfq_service_tree *st, -+ struct bfq_entity *entity) -+{ -+ bfq_idle_extract(st, entity); -+ bfq_forget_entity(st, entity); -+} -+ -+/** -+ * bfq_forget_idle - update the idle tree if necessary. -+ * @st: the service tree to act upon. -+ * -+ * To preserve the global O(log N) complexity we only remove one entry here; -+ * as the idle tree will not grow indefinitely this can be done safely. -+ */ -+static void bfq_forget_idle(struct bfq_service_tree *st) -+{ -+ struct bfq_entity *first_idle = st->first_idle; -+ struct bfq_entity *last_idle = st->last_idle; -+ -+ if (RB_EMPTY_ROOT(&st->active) && last_idle && -+ !bfq_gt(last_idle->finish, st->vtime)) { -+ /* -+ * Forget the whole idle tree, increasing the vtime past -+ * the last finish time of idle entities. -+ */ -+ st->vtime = last_idle->finish; -+ } -+ -+ if (first_idle && !bfq_gt(first_idle->finish, st->vtime)) -+ bfq_put_idle_entity(st, first_idle); -+} -+ -+static struct bfq_service_tree * -+__bfq_entity_update_weight_prio(struct bfq_service_tree *old_st, -+ struct bfq_entity *entity) -+{ -+ struct bfq_service_tree *new_st = old_st; -+ -+ if (entity->prio_changed) { -+ struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); -+ unsigned int prev_weight, new_weight; -+ struct bfq_data *bfqd = NULL; -+ struct rb_root *root; -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ struct bfq_sched_data *sd; -+ struct bfq_group *bfqg; -+#endif -+ -+ if (bfqq) -+ bfqd = bfqq->bfqd; -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ else { -+ sd = entity->my_sched_data; -+ bfqg = container_of(sd, struct bfq_group, sched_data); -+ BUG_ON(!bfqg); -+ bfqd = (struct bfq_data *)bfqg->bfqd; -+ BUG_ON(!bfqd); -+ } -+#endif -+ -+ BUG_ON(old_st->wsum < entity->weight); -+ old_st->wsum -= entity->weight; -+ -+ if (entity->new_weight != entity->orig_weight) { -+ if (entity->new_weight < BFQ_MIN_WEIGHT || -+ entity->new_weight > BFQ_MAX_WEIGHT) { -+ pr_crit("update_weight_prio: new_weight %d\n", -+ entity->new_weight); -+ if (entity->new_weight < BFQ_MIN_WEIGHT) -+ entity->new_weight = BFQ_MIN_WEIGHT; -+ else -+ entity->new_weight = BFQ_MAX_WEIGHT; -+ } -+ entity->orig_weight = entity->new_weight; -+ if (bfqq) -+ bfqq->ioprio = -+ bfq_weight_to_ioprio(entity->orig_weight); -+ } -+ -+ if (bfqq) -+ bfqq->ioprio_class = bfqq->new_ioprio_class; -+ entity->prio_changed = 0; -+ -+ /* -+ * NOTE: here we may be changing the weight too early, -+ * this will cause unfairness. The correct approach -+ * would have required additional complexity to defer -+ * weight changes to the proper time instants (i.e., -+ * when entity->finish <= old_st->vtime). -+ */ -+ new_st = bfq_entity_service_tree(entity); -+ -+ prev_weight = entity->weight; -+ new_weight = entity->orig_weight * -+ (bfqq ? bfqq->wr_coeff : 1); -+ /* -+ * If the weight of the entity changes, remove the entity -+ * from its old weight counter (if there is a counter -+ * associated with the entity), and add it to the counter -+ * associated with its new weight. -+ */ -+ if (prev_weight != new_weight) { -+ if (bfqq) -+ bfq_log_bfqq(bfqq->bfqd, bfqq, -+ "weight changed %d %d(%d %d)", -+ prev_weight, new_weight, -+ entity->orig_weight, -+ bfqq->wr_coeff); -+ -+ root = bfqq ? &bfqd->queue_weights_tree : -+ &bfqd->group_weights_tree; -+ bfq_weights_tree_remove(bfqd, entity, root); -+ } -+ entity->weight = new_weight; -+ /* -+ * Add the entity to its weights tree only if it is -+ * not associated with a weight-raised queue. -+ */ -+ if (prev_weight != new_weight && -+ (bfqq ? bfqq->wr_coeff == 1 : 1)) -+ /* If we get here, root has been initialized. */ -+ bfq_weights_tree_add(bfqd, entity, root); -+ -+ new_st->wsum += entity->weight; -+ -+ if (new_st != old_st) -+ entity->start = new_st->vtime; -+ } -+ -+ return new_st; -+} -+ -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+static void bfqg_stats_set_start_empty_time(struct bfq_group *bfqg); -+#endif -+ -+/** -+ * bfq_bfqq_served - update the scheduler status after selection for -+ * service. -+ * @bfqq: the queue being served. -+ * @served: bytes to transfer. -+ * -+ * NOTE: this can be optimized, as the timestamps of upper level entities -+ * are synchronized every time a new bfqq is selected for service. By now, -+ * we keep it to better check consistency. -+ */ -+static void bfq_bfqq_served(struct bfq_queue *bfqq, int served) -+{ -+ struct bfq_entity *entity = &bfqq->entity; -+ struct bfq_service_tree *st; -+ -+ for_each_entity(entity) { -+ st = bfq_entity_service_tree(entity); -+ -+ entity->service += served; -+ -+ BUG_ON(st->wsum == 0); -+ -+ st->vtime += bfq_delta(served, st->wsum); -+ bfq_forget_idle(st); -+ } -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ bfqg_stats_set_start_empty_time(bfqq_group(bfqq)); -+#endif -+ st = bfq_entity_service_tree(&bfqq->entity); -+ bfq_log_bfqq(bfqq->bfqd, bfqq, "bfqq_served %d secs, vtime %llu on %p", -+ served, ((st->vtime>>10)*1000)>>12, st); -+} -+ -+/** -+ * bfq_bfqq_charge_time - charge an amount of service equivalent to the length -+ * of the time interval during which bfqq has been in -+ * service. -+ * @bfqd: the device -+ * @bfqq: the queue that needs a service update. -+ * @time_ms: the amount of time during which the queue has received service -+ * -+ * If a queue does not consume its budget fast enough, then providing -+ * the queue with service fairness may impair throughput, more or less -+ * severely. For this reason, queues that consume their budget slowly -+ * are provided with time fairness instead of service fairness. This -+ * goal is achieved through the BFQ scheduling engine, even if such an -+ * engine works in the service, and not in the time domain. The trick -+ * is charging these queues with an inflated amount of service, equal -+ * to the amount of service that they would have received during their -+ * service slot if they had been fast, i.e., if their requests had -+ * been dispatched at a rate equal to the estimated peak rate. -+ * -+ * It is worth noting that time fairness can cause important -+ * distortions in terms of bandwidth distribution, on devices with -+ * internal queueing. The reason is that I/O requests dispatched -+ * during the service slot of a queue may be served after that service -+ * slot is finished, and may have a total processing time loosely -+ * correlated with the duration of the service slot. This is -+ * especially true for short service slots. -+ */ -+static void bfq_bfqq_charge_time(struct bfq_data *bfqd, struct bfq_queue *bfqq, -+ unsigned long time_ms) -+{ -+ struct bfq_entity *entity = &bfqq->entity; -+ int tot_serv_to_charge = entity->service; -+ unsigned int timeout_ms = jiffies_to_msecs(bfq_timeout); -+ -+ if (time_ms > 0 && time_ms < timeout_ms) -+ tot_serv_to_charge = -+ (bfqd->bfq_max_budget * time_ms) / timeout_ms; -+ -+ if (tot_serv_to_charge < entity->service) -+ tot_serv_to_charge = entity->service; -+ -+ bfq_log_bfqq(bfqq->bfqd, bfqq, -+ "charge_time: %lu/%u ms, %d/%d/%d sectors", -+ time_ms, timeout_ms, entity->service, -+ tot_serv_to_charge, entity->budget); -+ -+ /* Increase budget to avoid inconsistencies */ -+ if (tot_serv_to_charge > entity->budget) -+ entity->budget = tot_serv_to_charge; -+ -+ bfq_bfqq_served(bfqq, -+ max_t(int, 0, tot_serv_to_charge - entity->service)); -+} -+ -+/** -+ * __bfq_activate_entity - activate an entity. -+ * @entity: the entity being activated. -+ * @non_blocking_wait_rq: true if this entity was waiting for a request -+ * -+ * Called whenever an entity is activated, i.e., it is not active and one -+ * of its children receives a new request, or has to be reactivated due to -+ * budget exhaustion. It uses the current budget of the entity (and the -+ * service received if @entity is active) of the queue to calculate its -+ * timestamps. -+ */ -+static void __bfq_activate_entity(struct bfq_entity *entity, -+ bool non_blocking_wait_rq) -+{ -+ struct bfq_sched_data *sd = entity->sched_data; -+ struct bfq_service_tree *st = bfq_entity_service_tree(entity); -+ struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); -+ bool backshifted = false; -+ -+ BUG_ON(!sd); -+ BUG_ON(!st); -+ if (entity == sd->in_service_entity) { -+ BUG_ON(entity->tree); -+ /* -+ * If we are requeueing the current entity we have -+ * to take care of not charging to it service it has -+ * not received. -+ */ -+ bfq_calc_finish(entity, entity->service); -+ entity->start = entity->finish; -+ sd->in_service_entity = NULL; -+ } else if (entity->tree == &st->active) { -+ /* -+ * Requeueing an entity due to a change of some -+ * next_in_service entity below it. We reuse the -+ * old start time. -+ */ -+ bfq_active_extract(st, entity); -+ } else { -+ unsigned long long min_vstart; -+ -+ /* See comments on bfq_fqq_update_budg_for_activation */ -+ if (non_blocking_wait_rq && bfq_gt(st->vtime, entity->finish)) { -+ backshifted = true; -+ min_vstart = entity->finish; -+ } else -+ min_vstart = st->vtime; -+ -+ if (entity->tree == &st->idle) { -+ /* -+ * Must be on the idle tree, bfq_idle_extract() will -+ * check for that. -+ */ -+ bfq_idle_extract(st, entity); -+ entity->start = bfq_gt(min_vstart, entity->finish) ? -+ min_vstart : entity->finish; -+ } else { -+ /* -+ * The finish time of the entity may be invalid, and -+ * it is in the past for sure, otherwise the queue -+ * would have been on the idle tree. -+ */ -+ entity->start = min_vstart; -+ st->wsum += entity->weight; -+ bfq_get_entity(entity); -+ -+ BUG_ON(entity->on_st); -+ entity->on_st = 1; -+ } -+ } -+ -+ st = __bfq_entity_update_weight_prio(st, entity); -+ bfq_calc_finish(entity, entity->budget); -+ -+ /* -+ * If some queues enjoy backshifting for a while, then their -+ * (virtual) finish timestamps may happen to become lower and -+ * lower than the system virtual time. In particular, if -+ * these queues often happen to be idle for short time -+ * periods, and during such time periods other queues with -+ * higher timestamps happen to be busy, then the backshifted -+ * timestamps of the former queues can become much lower than -+ * the system virtual time. In fact, to serve the queues with -+ * higher timestamps while the ones with lower timestamps are -+ * idle, the system virtual time may be pushed-up to much -+ * higher values than the finish timestamps of the idle -+ * queues. As a consequence, the finish timestamps of all new -+ * or newly activated queues may end up being much larger than -+ * those of lucky queues with backshifted timestamps. The -+ * latter queues may then monopolize the device for a lot of -+ * time. This would simply break service guarantees. -+ * -+ * To reduce this problem, push up a little bit the -+ * backshifted timestamps of the queue associated with this -+ * entity (only a queue can happen to have the backshifted -+ * flag set): just enough to let the finish timestamp of the -+ * queue be equal to the current value of the system virtual -+ * time. This may introduce a little unfairness among queues -+ * with backshifted timestamps, but it does not break -+ * worst-case fairness guarantees. -+ * -+ * As a special case, if bfqq is weight-raised, push up -+ * timestamps much less, to keep very low the probability that -+ * this push up causes the backshifted finish timestamps of -+ * weight-raised queues to become higher than the backshifted -+ * finish timestamps of non weight-raised queues. -+ */ -+ if (backshifted && bfq_gt(st->vtime, entity->finish)) { -+ unsigned long delta = st->vtime - entity->finish; -+ -+ if (bfqq) -+ delta /= bfqq->wr_coeff; -+ -+ entity->start += delta; -+ entity->finish += delta; -+ -+ if (bfqq) { -+ bfq_log_bfqq(bfqq->bfqd, bfqq, -+ "__activate_entity: new queue finish %llu", -+ ((entity->finish>>10)*1000)>>12); -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ } else { -+ struct bfq_group *bfqg = -+ container_of(entity, struct bfq_group, entity); -+ -+ bfq_log_bfqg((struct bfq_data *)bfqg->bfqd, bfqg, -+ "__activate_entity: new group finish %llu", -+ ((entity->finish>>10)*1000)>>12); -+#endif -+ } -+ } -+ -+ bfq_active_insert(st, entity); -+ -+ if (bfqq) { -+ bfq_log_bfqq(bfqq->bfqd, bfqq, -+ "__activate_entity: queue %seligible in st %p", -+ entity->start <= st->vtime ? "" : "non ", st); -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ } else { -+ struct bfq_group *bfqg = -+ container_of(entity, struct bfq_group, entity); -+ -+ bfq_log_bfqg((struct bfq_data *)bfqg->bfqd, bfqg, -+ "__activate_entity: group %seligible in st %p", -+ entity->start <= st->vtime ? "" : "non ", st); -+#endif -+ } -+} -+ -+/** -+ * bfq_activate_entity - activate an entity and its ancestors if necessary. -+ * @entity: the entity to activate. -+ * @non_blocking_wait_rq: true if this entity was waiting for a request -+ * -+ * Activate @entity and all the entities on the path from it to the root. -+ */ -+static void bfq_activate_entity(struct bfq_entity *entity, -+ bool non_blocking_wait_rq) -+{ -+ struct bfq_sched_data *sd; -+ -+ for_each_entity(entity) { -+ BUG_ON(!entity); -+ __bfq_activate_entity(entity, non_blocking_wait_rq); -+ -+ sd = entity->sched_data; -+ if (!bfq_update_next_in_service(sd)) -+ /* -+ * No need to propagate the activation to the -+ * upper entities, as they will be updated when -+ * the in-service entity is rescheduled. -+ */ -+ break; -+ } -+} -+ -+/** -+ * __bfq_deactivate_entity - deactivate an entity from its service tree. -+ * @entity: the entity to deactivate. -+ * @requeue: if false, the entity will not be put into the idle tree. -+ * -+ * Deactivate an entity, independently from its previous state. If the -+ * entity was not on a service tree just return, otherwise if it is on -+ * any scheduler tree, extract it from that tree, and if necessary -+ * and if the caller did not specify @requeue, put it on the idle tree. -+ * -+ * Return %1 if the caller should update the entity hierarchy, i.e., -+ * if the entity was in service or if it was the next_in_service for -+ * its sched_data; return %0 otherwise. -+ */ -+static int __bfq_deactivate_entity(struct bfq_entity *entity, int requeue) -+{ -+ struct bfq_sched_data *sd = entity->sched_data; -+ struct bfq_service_tree *st; -+ int was_in_service; -+ int ret = 0; -+ -+ if (sd == NULL || !entity->on_st) /* never activated, or inactive */ -+ return 0; -+ -+ st = bfq_entity_service_tree(entity); -+ was_in_service = entity == sd->in_service_entity; -+ -+ BUG_ON(was_in_service && entity->tree); -+ -+ if (was_in_service) { -+ bfq_calc_finish(entity, entity->service); -+ sd->in_service_entity = NULL; -+ } else if (entity->tree == &st->active) -+ bfq_active_extract(st, entity); -+ else if (entity->tree == &st->idle) -+ bfq_idle_extract(st, entity); -+ else if (entity->tree) -+ BUG(); -+ -+ if (was_in_service || sd->next_in_service == entity) -+ ret = bfq_update_next_in_service(sd); -+ -+ if (!requeue || !bfq_gt(entity->finish, st->vtime)) -+ bfq_forget_entity(st, entity); -+ else -+ bfq_idle_insert(st, entity); -+ -+ BUG_ON(sd->in_service_entity == entity); -+ BUG_ON(sd->next_in_service == entity); -+ -+ return ret; -+} -+ -+/** -+ * bfq_deactivate_entity - deactivate an entity. -+ * @entity: the entity to deactivate. -+ * @requeue: true if the entity can be put on the idle tree -+ */ -+static void bfq_deactivate_entity(struct bfq_entity *entity, int requeue) -+{ -+ struct bfq_sched_data *sd; -+ struct bfq_entity *parent; -+ -+ for_each_entity_safe(entity, parent) { -+ sd = entity->sched_data; -+ -+ if (!__bfq_deactivate_entity(entity, requeue)) -+ /* -+ * next_in_service has not been changed, so -+ * no upwards update is needed -+ */ -+ break; -+ -+ if (sd->next_in_service) -+ /* -+ * The parent entity is still backlogged, -+ * because next_in_service is not NULL, and -+ * next_in_service has been updated (see -+ * comment on the body of the above if): -+ * upwards update of the schedule is needed. -+ */ -+ goto update; -+ -+ /* -+ * If we get here, then the parent is no more backlogged and -+ * we want to propagate the deactivation upwards. -+ */ -+ requeue = 1; -+ } -+ -+ return; -+ -+update: -+ entity = parent; -+ for_each_entity(entity) { -+ struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); -+ __bfq_activate_entity(entity, false); -+ -+ sd = entity->sched_data; -+ if (bfqq) -+ bfq_log_bfqq(bfqq->bfqd, bfqq, -+ "invoking udpdate_next for this queue"); -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ else { -+ struct bfq_group *bfqg = -+ container_of(entity, -+ struct bfq_group, entity); -+ -+ bfq_log_bfqg((struct bfq_data *)bfqg->bfqd, bfqg, -+ "invoking udpdate_next for this entity"); -+ } -+#endif -+ if (!bfq_update_next_in_service(sd)) -+ break; -+ } -+} -+ -+/** -+ * bfq_update_vtime - update vtime if necessary. -+ * @st: the service tree to act upon. -+ * -+ * If necessary update the service tree vtime to have at least one -+ * eligible entity, skipping to its start time. Assumes that the -+ * active tree of the device is not empty. -+ * -+ * NOTE: this hierarchical implementation updates vtimes quite often, -+ * we may end up with reactivated processes getting timestamps after a -+ * vtime skip done because we needed a ->first_active entity on some -+ * intermediate node. -+ */ -+static void bfq_update_vtime(struct bfq_service_tree *st) -+{ -+ struct bfq_entity *entry; -+ struct rb_node *node = st->active.rb_node; -+ -+ entry = rb_entry(node, struct bfq_entity, rb_node); -+ if (bfq_gt(entry->min_start, st->vtime)) { -+ struct bfq_queue *bfqq = bfq_entity_to_bfqq(entry); -+ st->vtime = entry->min_start; -+ -+ if (bfqq) -+ bfq_log_bfqq(bfqq->bfqd, bfqq, -+ "update_vtime: new vtime %llu %p", -+ ((st->vtime>>10)*1000)>>12, st); -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ else { -+ struct bfq_group *bfqg = -+ container_of(entry, struct bfq_group, entity); -+ -+ bfq_log_bfqg((struct bfq_data *)bfqg->bfqd, bfqg, -+ "update_vtime: new vtime %llu %p", -+ ((st->vtime>>10)*1000)>>12, st); -+ } -+#endif -+ bfq_forget_idle(st); -+ } -+} -+ -+/** -+ * bfq_first_active_entity - find the eligible entity with -+ * the smallest finish time -+ * @st: the service tree to select from. -+ * -+ * This function searches the first schedulable entity, starting from the -+ * root of the tree and going on the left every time on this side there is -+ * a subtree with at least one eligible (start >= vtime) entity. The path on -+ * the right is followed only if a) the left subtree contains no eligible -+ * entities and b) no eligible entity has been found yet. -+ */ -+static struct bfq_entity *bfq_first_active_entity(struct bfq_service_tree *st) -+{ -+ struct bfq_entity *entry, *first = NULL; -+ struct rb_node *node = st->active.rb_node; -+ -+ while (node) { -+ entry = rb_entry(node, struct bfq_entity, rb_node); -+left: -+ if (!bfq_gt(entry->start, st->vtime)) -+ first = entry; -+ -+ BUG_ON(bfq_gt(entry->min_start, st->vtime)); -+ -+ if (node->rb_left) { -+ entry = rb_entry(node->rb_left, -+ struct bfq_entity, rb_node); -+ if (!bfq_gt(entry->min_start, st->vtime)) { -+ node = node->rb_left; -+ goto left; -+ } -+ } -+ if (first) -+ break; -+ node = node->rb_right; -+ } -+ -+ BUG_ON(!first && !RB_EMPTY_ROOT(&st->active)); -+ return first; -+} -+ -+/** -+ * __bfq_lookup_next_entity - return the first eligible entity in @st. -+ * @st: the service tree. -+ * -+ * Update the virtual time in @st and return the first eligible entity -+ * it contains. -+ */ -+static struct bfq_entity * -+__bfq_lookup_next_entity(struct bfq_service_tree *st, bool force) -+{ -+ struct bfq_entity *entity, *new_next_in_service = NULL; -+ struct bfq_queue *bfqq; -+ -+ if (RB_EMPTY_ROOT(&st->active)) -+ return NULL; -+ -+ bfq_update_vtime(st); -+ entity = bfq_first_active_entity(st); -+ BUG_ON(bfq_gt(entity->start, st->vtime)); -+ -+ bfqq = bfq_entity_to_bfqq(entity); -+ if (bfqq) -+ bfq_log_bfqq(bfqq->bfqd, bfqq, -+ "__lookup_next: start %llu vtime %llu st %p", -+ ((entity->start>>10)*1000)>>12, -+ ((st->vtime>>10)*1000)>>12, st); -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ else { -+ struct bfq_group *bfqg = -+ container_of(entity, struct bfq_group, entity); -+ -+ bfq_log_bfqg((struct bfq_data *)bfqg->bfqd, bfqg, -+ "__lookup_next: start %llu vtime %llu st %p", -+ ((entity->start>>10)*1000)>>12, -+ ((st->vtime>>10)*1000)>>12, st); -+ } -+#endif -+ -+ /* -+ * If the chosen entity does not match with the sched_data's -+ * next_in_service and we are forcedly serving the IDLE priority -+ * class tree, bubble up budget update. -+ */ -+ if (unlikely(force && entity != entity->sched_data->next_in_service)) { -+ new_next_in_service = entity; -+ for_each_entity(new_next_in_service) -+ bfq_update_budget(new_next_in_service); -+ } -+ -+ return entity; -+} -+ -+/** -+ * bfq_lookup_next_entity - return the first eligible entity in @sd. -+ * @sd: the sched_data. -+ * @extract: if true the returned entity will be also extracted from @sd. -+ * -+ * NOTE: since we cache the next_in_service entity at each level of the -+ * hierarchy, the complexity of the lookup can be decreased with -+ * absolutely no effort just returning the cached next_in_service value; -+ * we prefer to do full lookups to test the consistency of * the data -+ * structures. -+ */ -+static struct bfq_entity *bfq_lookup_next_entity(struct bfq_sched_data *sd, -+ int extract, -+ struct bfq_data *bfqd) -+{ -+ struct bfq_service_tree *st = sd->service_tree; -+ struct bfq_entity *entity; -+ int i = 0; -+ -+ BUG_ON(sd->in_service_entity); -+ -+ /* -+ * Choose from idle class, if needed to guarantee a minimum -+ * bandwidth to this class. This should also mitigate -+ * priority-inversion problems in case a low priority task is -+ * holding file system resources. -+ */ -+ if (bfqd && -+ jiffies - bfqd->bfq_class_idle_last_service > -+ BFQ_CL_IDLE_TIMEOUT) { -+ entity = __bfq_lookup_next_entity(st + BFQ_IOPRIO_CLASSES - 1, -+ true); -+ if (entity) { -+ struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); -+ -+ if (bfqq) -+ bfq_log_bfqq(bfqd, bfqq, -+ "idle chosen from st %p %d", -+ st + BFQ_IOPRIO_CLASSES - 1, -+ BFQ_IOPRIO_CLASSES - 1); -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ else { -+ struct bfq_group *bfqg = -+ container_of(entity, struct bfq_group, entity); -+ -+ bfq_log_bfqg(bfqd, bfqg, -+ "idle chosen from st %p %d", -+ st + BFQ_IOPRIO_CLASSES - 1, -+ BFQ_IOPRIO_CLASSES - 1); -+ } -+#endif -+ i = BFQ_IOPRIO_CLASSES - 1; -+ bfqd->bfq_class_idle_last_service = jiffies; -+ sd->next_in_service = entity; -+ } -+ } -+ for (; i < BFQ_IOPRIO_CLASSES; i++) { -+ entity = __bfq_lookup_next_entity(st + i, false); -+ if (entity) { -+ if (bfqd != NULL) { -+ struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); -+ -+ if (bfqq) -+ bfq_log_bfqq(bfqd, bfqq, -+ "chosen from st %p %d", -+ st + i, i); -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ else { -+ struct bfq_group *bfqg = -+ container_of(entity, struct bfq_group, entity); -+ -+ bfq_log_bfqg(bfqd, bfqg, -+ "chosen from st %p %d", -+ st + i, i); -+ } -+#endif -+ } -+ -+ if (extract) { -+ bfq_check_next_in_service(sd, entity); -+ bfq_active_extract(st + i, entity); -+ sd->in_service_entity = entity; -+ sd->next_in_service = NULL; -+ } -+ break; -+ } -+ } -+ -+ return entity; -+} -+ -+static bool next_queue_may_preempt(struct bfq_data *bfqd) -+{ -+ struct bfq_sched_data *sd = &bfqd->root_group->sched_data; -+ -+ return sd->next_in_service != sd->in_service_entity; -+} -+ -+/* -+ * Get next queue for service. -+ */ -+static struct bfq_queue *bfq_get_next_queue(struct bfq_data *bfqd) -+{ -+ struct bfq_entity *entity = NULL; -+ struct bfq_sched_data *sd; -+ struct bfq_queue *bfqq; -+ -+ BUG_ON(bfqd->in_service_queue); -+ -+ if (bfqd->busy_queues == 0) -+ return NULL; -+ -+ sd = &bfqd->root_group->sched_data; -+ for (; sd ; sd = entity->my_sched_data) { -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ if (entity) { -+ struct bfq_group *bfqg = -+ container_of(entity, struct bfq_group, entity); -+ -+ bfq_log_bfqg(bfqd, bfqg, -+ "get_next_queue: lookup in this group"); -+ } else -+ bfq_log_bfqg(bfqd, bfqd->root_group, -+ "get_next_queue: lookup in root group"); -+#endif -+ -+ entity = bfq_lookup_next_entity(sd, 1, bfqd); -+ -+ bfqq = bfq_entity_to_bfqq(entity); -+ if (bfqq) -+ bfq_log_bfqq(bfqd, bfqq, -+ "get_next_queue: this queue, finish %llu", -+ (((entity->finish>>10)*1000)>>10)>>2); -+#ifdef CONFIG_BFQ_GROUP_IOSCHED -+ else { -+ struct bfq_group *bfqg = -+ container_of(entity, struct bfq_group, entity); -+ -+ bfq_log_bfqg(bfqd, bfqg, -+ "get_next_queue: this entity, finish %llu", -+ (((entity->finish>>10)*1000)>>10)>>2); -+ } -+#endif -+ -+ BUG_ON(!entity); -+ entity->service = 0; -+ } -+ -+ bfqq = bfq_entity_to_bfqq(entity); -+ BUG_ON(!bfqq); -+ -+ return bfqq; -+} -+ -+static void __bfq_bfqd_reset_in_service(struct bfq_data *bfqd) -+{ -+ if (bfqd->in_service_bic) { -+ put_io_context(bfqd->in_service_bic->icq.ioc); -+ bfqd->in_service_bic = NULL; -+ } -+ -+ bfq_clear_bfqq_wait_request(bfqd->in_service_queue); -+ hrtimer_try_to_cancel(&bfqd->idle_slice_timer); -+ bfqd->in_service_queue = NULL; -+} -+ -+static void bfq_deactivate_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq, -+ int requeue) -+{ -+ struct bfq_entity *entity = &bfqq->entity; -+ -+ BUG_ON(bfqq == bfqd->in_service_queue); -+ bfq_deactivate_entity(entity, requeue); -+} -+ -+static void bfq_activate_bfqq(struct bfq_data *bfqd, struct bfq_queue *bfqq) -+{ -+ struct bfq_entity *entity = &bfqq->entity; -+ -+ bfq_activate_entity(entity, bfq_bfqq_non_blocking_wait_rq(bfqq)); -+ bfq_clear_bfqq_non_blocking_wait_rq(bfqq); -+} -+ -+static void bfqg_stats_update_dequeue(struct bfq_group *bfqg); -+ -+/* -+ * Called when the bfqq no longer has requests pending, remove it from -+ * the service tree. -+ */ -+static void bfq_del_bfqq_busy(struct bfq_data *bfqd, struct bfq_queue *bfqq, -+ int requeue) -+{ -+ BUG_ON(!bfq_bfqq_busy(bfqq)); -+ BUG_ON(!RB_EMPTY_ROOT(&bfqq->sort_list)); -+ BUG_ON(bfqq == bfqd->in_service_queue); -+ -+ bfq_log_bfqq(bfqd, bfqq, "del from busy"); -+ -+ bfq_clear_bfqq_busy(bfqq); -+ -+ BUG_ON(bfqd->busy_queues == 0); -+ bfqd->busy_queues--; -+ -+ if (!bfqq->dispatched) -+ bfq_weights_tree_remove(bfqd, &bfqq->entity, -+ &bfqd->queue_weights_tree); -+ -+ if (bfqq->wr_coeff > 1) -+ bfqd->wr_busy_queues--; -+ -+ bfqg_stats_update_dequeue(bfqq_group(bfqq)); -+ -+ BUG_ON(bfqq->entity.budget < 0); -+ -+ bfq_deactivate_bfqq(bfqd, bfqq, requeue); -+ -+ BUG_ON(bfqq->entity.budget < 0); -+} -+ -+/* -+ * Called when an inactive queue receives a new request. -+ */ -+static void bfq_add_bfqq_busy(struct bfq_data *bfqd, struct bfq_queue *bfqq) -+{ -+ BUG_ON(bfq_bfqq_busy(bfqq)); -+ BUG_ON(bfqq == bfqd->in_service_queue); -+ -+ bfq_log_bfqq(bfqd, bfqq, "add to busy"); -+ -+ bfq_activate_bfqq(bfqd, bfqq); -+ -+ bfq_mark_bfqq_busy(bfqq); -+ bfqd->busy_queues++; -+ -+ if (!bfqq->dispatched) -+ if (bfqq->wr_coeff == 1) -+ bfq_weights_tree_add(bfqd, &bfqq->entity, -+ &bfqd->queue_weights_tree); -+ -+ if (bfqq->wr_coeff > 1) -+ bfqd->wr_busy_queues++; -+} -diff -w -uNr '--exclude=.git' linux-4.8/block/Kconfig.iosched linux-4.8-bfq/block/Kconfig.iosched ---- linux-4.8/block/Kconfig.iosched 2016-10-03 01:24:33.000000000 +0200 -+++ linux-4.8-bfq/block/Kconfig.iosched 2016-10-18 12:57:57.691164881 +0200 -@@ -39,6 +39,25 @@ - ---help--- - Enable group IO scheduling in CFQ. - -+config IOSCHED_BFQ -+ tristate "BFQ I/O scheduler" -+ default n -+ ---help--- -+ The BFQ I/O scheduler tries to distribute bandwidth among -+ all processes according to their weights. -+ It aims at distributing the bandwidth as desired, independently of -+ the disk parameters and with any workload. It also tries to -+ guarantee low latency to interactive and soft real-time -+ applications. If compiled built-in (saying Y here), BFQ can -+ be configured to support hierarchical scheduling. -+ -+config BFQ_GROUP_IOSCHED -+ bool "BFQ hierarchical scheduling support" -+ depends on IOSCHED_BFQ && BLK_CGROUP -+ default n -+ ---help--- -+ Enable hierarchical scheduling in BFQ, using the blkio controller. -+ - choice - prompt "Default I/O scheduler" - default DEFAULT_CFQ -@@ -52,6 +71,16 @@ - config DEFAULT_CFQ - bool "CFQ" if IOSCHED_CFQ=y - -+ config DEFAULT_BFQ -+ bool "BFQ" if IOSCHED_BFQ=y -+ help -+ Selects BFQ as the default I/O scheduler which will be -+ used by default for all block devices. -+ The BFQ I/O scheduler aims at distributing the bandwidth -+ as desired, independently of the disk parameters and with -+ any workload. It also tries to guarantee low latency to -+ interactive and soft real-time applications. -+ - config DEFAULT_NOOP - bool "No-op" - -@@ -61,6 +90,7 @@ - string - default "deadline" if DEFAULT_DEADLINE - default "cfq" if DEFAULT_CFQ -+ default "bfq" if DEFAULT_BFQ - default "noop" if DEFAULT_NOOP - - endmenu -diff -w -uNr '--exclude=.git' linux-4.8/block/Makefile linux-4.8-bfq/block/Makefile ---- linux-4.8/block/Makefile 2016-10-03 01:24:33.000000000 +0200 -+++ linux-4.8-bfq/block/Makefile 2016-10-18 12:57:57.691164881 +0200 -@@ -18,6 +18,7 @@ - obj-$(CONFIG_IOSCHED_NOOP) += noop-iosched.o - obj-$(CONFIG_IOSCHED_DEADLINE) += deadline-iosched.o - obj-$(CONFIG_IOSCHED_CFQ) += cfq-iosched.o -+obj-$(CONFIG_IOSCHED_BFQ) += bfq-iosched.o - - obj-$(CONFIG_BLOCK_COMPAT) += compat_ioctl.o - obj-$(CONFIG_BLK_CMDLINE_PARSER) += cmdline-parser.o -diff -w -uNr '--exclude=.git' linux-4.8/include/linux/blkdev.h linux-4.8-bfq/include/linux/blkdev.h ---- linux-4.8/include/linux/blkdev.h 2016-10-03 01:24:33.000000000 +0200 -+++ linux-4.8-bfq/include/linux/blkdev.h 2016-10-18 12:57:59.951179412 +0200 -@@ -45,7 +45,7 @@ - * Maximum number of blkcg policies allowed to be registered concurrently. - * Defined here to simplify include dependency. - */ --#define BLKCG_MAX_POLS 2 -+#define BLKCG_MAX_POLS 3 - - typedef void (rq_end_io_fn)(struct request *, int); - diff --git a/kernel/kernel/files/patches/mageia/net-wireless-rtlwifi-Fix-regression-caused-by-commit-d86e64768859.patch b/kernel/kernel/files/patches/mageia/net-wireless-rtlwifi-Fix-regression-caused-by-commit-d86e64768859.patch deleted file mode 100644 index c251e081..00000000 --- a/kernel/kernel/files/patches/mageia/net-wireless-rtlwifi-Fix-regression-caused-by-commit-d86e64768859.patch +++ /dev/null @@ -1,429 +0,0 @@ -From cf4747d7535a936105f0abe8d8109d3fe339162b Mon Sep 17 00:00:00 2001 -From: Larry Finger -Date: Wed, 12 Oct 2016 13:54:04 -0500 -Subject: [PATCH] rtlwifi: Fix regression caused by commit d86e64768859 - -In commit d86e64768859 ("rtlwifi: rtl818x: constify local structures"), -the configuration struct for most of the drivers was changed to be -constant. The problem is that five of the modified drivers need to be -able to update the firmware name based on the exact model of the card. -As the file names were stored in one of the members of that struct, -these drivers would fail with a kernel BUG splat when they tried to -update the firmware name. - -Rather than reverting the previous commit, I used a suggestion by -Johannes Berg and made the firmware file name pointers be local to -the routines that update the software variables. - -The configuration struct of rtl8192cu, which was not touched in the -previous patch, is now constantfied. - -Fixes: d86e64768859 ("rtlwifi: rtl818x: constify local structures") -Suggested-by: Johannes Berg -Signed-off-by: Larry Finger -Cc: Stable # 4.8 -Cc: Julia Lawall -Signed-off-by: Kalle Valo ---- - drivers/net/wireless/realtek/rtlwifi/core.c | 2 +- - drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c | 8 ++++---- - drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c | 13 +++++-------- - drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c | 12 ++++++------ - drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c | 6 +++--- - drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c | 8 ++++---- - drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c | 9 +++++---- - drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c | 12 +++++------- - drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c | 6 +++--- - drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c | 18 +++++++++--------- - drivers/net/wireless/realtek/rtlwifi/wifi.h | 2 -- - 11 files changed, 45 insertions(+), 51 deletions(-) - -diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c -index f95760c..8e7f23c 100644 ---- a/drivers/net/wireless/realtek/rtlwifi/core.c -+++ b/drivers/net/wireless/realtek/rtlwifi/core.c -@@ -111,7 +111,7 @@ static void rtl_fw_do_work(const struct firmware *firmware, void *context, - if (!err) - goto found_alt; - } -- pr_err("Firmware %s not available\n", rtlpriv->cfg->fw_name); -+ pr_err("Selected firmware is not available\n"); - rtlpriv->max_fw_size = 0; - return; - } -diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c -index e7b11b4..f361808 100644 ---- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c -+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c -@@ -86,6 +86,7 @@ int rtl88e_init_sw_vars(struct ieee80211_hw *hw) - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - u8 tid; -+ char *fw_name; - - rtl8188ee_bt_reg_init(hw); - rtlpriv->dm.dm_initialgain_enable = 1; -@@ -169,10 +170,10 @@ int rtl88e_init_sw_vars(struct ieee80211_hw *hw) - return 1; - } - -- rtlpriv->cfg->fw_name = "rtlwifi/rtl8188efw.bin"; -+ fw_name = "rtlwifi/rtl8188efw.bin"; - rtlpriv->max_fw_size = 0x8000; -- pr_info("Using firmware %s\n", rtlpriv->cfg->fw_name); -- err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, -+ pr_info("Using firmware %s\n", fw_name); -+ err = request_firmware_nowait(THIS_MODULE, 1, fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl_fw_cb); - if (err) { -@@ -284,7 +285,6 @@ static const struct rtl_hal_cfg rtl88ee_hal_cfg = { - .bar_id = 2, - .write_readback = true, - .name = "rtl88e_pci", -- .fw_name = "rtlwifi/rtl8188efw.bin", - .ops = &rtl8188ee_hal_ops, - .mod_params = &rtl88ee_mod_params, - -diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c -index 87aa209..8b6e37c 100644 ---- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c -+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c -@@ -96,6 +96,7 @@ int rtl92c_init_sw_vars(struct ieee80211_hw *hw) - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); -+ char *fw_name = "rtlwifi/rtl8192cfwU.bin"; - - rtl8192ce_bt_reg_init(hw); - -@@ -167,15 +168,12 @@ int rtl92c_init_sw_vars(struct ieee80211_hw *hw) - } - - /* request fw */ -- if (IS_VENDOR_UMC_A_CUT(rtlhal->version) && -- !IS_92C_SERIAL(rtlhal->version)) -- rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cfwU.bin"; -- else if (IS_81XXC_VENDOR_UMC_B_CUT(rtlhal->version)) -- rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cfwU_B.bin"; -+ if (IS_81XXC_VENDOR_UMC_B_CUT(rtlhal->version)) -+ fw_name = "rtlwifi/rtl8192cfwU_B.bin"; - - rtlpriv->max_fw_size = 0x4000; -- pr_info("Using firmware %s\n", rtlpriv->cfg->fw_name); -- err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, -+ pr_info("Using firmware %s\n", fw_name); -+ err = request_firmware_nowait(THIS_MODULE, 1, fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl_fw_cb); - if (err) { -@@ -262,7 +260,6 @@ static const struct rtl_hal_cfg rtl92ce_hal_cfg = { - .bar_id = 2, - .write_readback = true, - .name = "rtl92c_pci", -- .fw_name = "rtlwifi/rtl8192cfw.bin", - .ops = &rtl8192ce_hal_ops, - .mod_params = &rtl92ce_mod_params, - -diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c -index 7c6f7f0..f953320 100644 ---- a/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c -+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c -@@ -59,6 +59,7 @@ static int rtl92cu_init_sw_vars(struct ieee80211_hw *hw) - { - struct rtl_priv *rtlpriv = rtl_priv(hw); - int err; -+ char *fw_name; - - rtlpriv->dm.dm_initialgain_enable = true; - rtlpriv->dm.dm_flag = 0; -@@ -77,18 +78,18 @@ static int rtl92cu_init_sw_vars(struct ieee80211_hw *hw) - } - if (IS_VENDOR_UMC_A_CUT(rtlpriv->rtlhal.version) && - !IS_92C_SERIAL(rtlpriv->rtlhal.version)) { -- rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cufw_A.bin"; -+ fw_name = "rtlwifi/rtl8192cufw_A.bin"; - } else if (IS_81XXC_VENDOR_UMC_B_CUT(rtlpriv->rtlhal.version)) { -- rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cufw_B.bin"; -+ fw_name = "rtlwifi/rtl8192cufw_B.bin"; - } else { -- rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cufw_TMSC.bin"; -+ fw_name = "rtlwifi/rtl8192cufw_TMSC.bin"; - } - /* provide name of alternative file */ - rtlpriv->cfg->alt_fw_name = "rtlwifi/rtl8192cufw.bin"; -- pr_info("Loading firmware %s\n", rtlpriv->cfg->fw_name); -+ pr_info("Loading firmware %s\n", fw_name); - rtlpriv->max_fw_size = 0x4000; - err = request_firmware_nowait(THIS_MODULE, 1, -- rtlpriv->cfg->fw_name, rtlpriv->io.dev, -+ fw_name, rtlpriv->io.dev, - GFP_KERNEL, hw, rtl_fw_cb); - return err; - } -@@ -187,7 +188,6 @@ static struct rtl_hal_usbint_cfg rtl92cu_interface_cfg = { - - static struct rtl_hal_cfg rtl92cu_hal_cfg = { - .name = "rtl92c_usb", -- .fw_name = "rtlwifi/rtl8192cufw.bin", - .ops = &rtl8192cu_hal_ops, - .mod_params = &rtl92cu_mod_params, - .usb_interface_cfg = &rtl92cu_interface_cfg, -diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c -index 0538a4d..1ebfee1 100644 ---- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c -+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c -@@ -92,6 +92,7 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw) - u8 tid; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); -+ char *fw_name = "rtlwifi/rtl8192defw.bin"; - - rtlpriv->dm.dm_initialgain_enable = true; - rtlpriv->dm.dm_flag = 0; -@@ -181,10 +182,10 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw) - - rtlpriv->max_fw_size = 0x8000; - pr_info("Driver for Realtek RTL8192DE WLAN interface\n"); -- pr_info("Loading firmware file %s\n", rtlpriv->cfg->fw_name); -+ pr_info("Loading firmware file %s\n", fw_name); - - /* request fw */ -- err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, -+ err = request_firmware_nowait(THIS_MODULE, 1, fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl_fw_cb); - if (err) { -@@ -266,7 +267,6 @@ static const struct rtl_hal_cfg rtl92de_hal_cfg = { - .bar_id = 2, - .write_readback = true, - .name = "rtl8192de", -- .fw_name = "rtlwifi/rtl8192defw.bin", - .ops = &rtl8192de_hal_ops, - .mod_params = &rtl92de_mod_params, - -diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c -index ac299cb..46b605de3 100644 ---- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c -+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c -@@ -91,6 +91,7 @@ int rtl92ee_init_sw_vars(struct ieee80211_hw *hw) - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - int err = 0; -+ char *fw_name; - - rtl92ee_bt_reg_init(hw); - rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support; -@@ -170,11 +171,11 @@ int rtl92ee_init_sw_vars(struct ieee80211_hw *hw) - } - - /* request fw */ -- rtlpriv->cfg->fw_name = "rtlwifi/rtl8192eefw.bin"; -+ fw_name = "rtlwifi/rtl8192eefw.bin"; - - rtlpriv->max_fw_size = 0x8000; -- pr_info("Using firmware %s\n", rtlpriv->cfg->fw_name); -- err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, -+ pr_info("Using firmware %s\n", fw_name); -+ err = request_firmware_nowait(THIS_MODULE, 1, fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl_fw_cb); - if (err) { -@@ -266,7 +267,6 @@ static const struct rtl_hal_cfg rtl92ee_hal_cfg = { - .bar_id = 2, - .write_readback = true, - .name = "rtl92ee_pci", -- .fw_name = "rtlwifi/rtl8192eefw.bin", - .ops = &rtl8192ee_hal_ops, - .mod_params = &rtl92ee_mod_params, - -diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c -index 5e8e02d..3e1eaea 100644 ---- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c -+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c -@@ -89,12 +89,13 @@ static void rtl92se_fw_cb(const struct firmware *firmware, void *context) - struct ieee80211_hw *hw = context; - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rt_firmware *pfirmware = NULL; -+ char *fw_name = "rtlwifi/rtl8192sefw.bin"; - - RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD, - "Firmware callback routine entered!\n"); - complete(&rtlpriv->firmware_loading_complete); - if (!firmware) { -- pr_err("Firmware %s not available\n", rtlpriv->cfg->fw_name); -+ pr_err("Firmware %s not available\n", fw_name); - rtlpriv->max_fw_size = 0; - return; - } -@@ -117,6 +118,7 @@ static int rtl92s_init_sw_vars(struct ieee80211_hw *hw) - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - int err = 0; - u16 earlyrxthreshold = 7; -+ char *fw_name = "rtlwifi/rtl8192sefw.bin"; - - rtlpriv->dm.dm_initialgain_enable = true; - rtlpriv->dm.dm_flag = 0; -@@ -214,9 +216,9 @@ static int rtl92s_init_sw_vars(struct ieee80211_hw *hw) - rtlpriv->max_fw_size = RTL8190_MAX_FIRMWARE_CODE_SIZE*2 + - sizeof(struct fw_hdr); - pr_info("Driver for Realtek RTL8192SE/RTL8191SE\n" -- "Loading firmware %s\n", rtlpriv->cfg->fw_name); -+ "Loading firmware %s\n", fw_name); - /* request fw */ -- err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, -+ err = request_firmware_nowait(THIS_MODULE, 1, fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl92se_fw_cb); - if (err) { -@@ -310,7 +312,6 @@ static const struct rtl_hal_cfg rtl92se_hal_cfg = { - .bar_id = 1, - .write_readback = false, - .name = "rtl92s_pci", -- .fw_name = "rtlwifi/rtl8192sefw.bin", - .ops = &rtl8192se_hal_ops, - .mod_params = &rtl92se_mod_params, - -diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c -index 89c828a..c51a9e8 100644 ---- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c -+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c -@@ -94,6 +94,7 @@ int rtl8723e_init_sw_vars(struct ieee80211_hw *hw) - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); - int err = 0; -+ char *fw_name = "rtlwifi/rtl8723fw.bin"; - - rtl8723e_bt_reg_init(hw); - -@@ -176,14 +177,12 @@ int rtl8723e_init_sw_vars(struct ieee80211_hw *hw) - return 1; - } - -- if (IS_VENDOR_8723_A_CUT(rtlhal->version)) -- rtlpriv->cfg->fw_name = "rtlwifi/rtl8723fw.bin"; -- else if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version)) -- rtlpriv->cfg->fw_name = "rtlwifi/rtl8723fw_B.bin"; -+ if (IS_81xxC_VENDOR_UMC_B_CUT(rtlhal->version)) -+ fw_name = "rtlwifi/rtl8723fw_B.bin"; - - rtlpriv->max_fw_size = 0x6000; -- pr_info("Using firmware %s\n", rtlpriv->cfg->fw_name); -- err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, -+ pr_info("Using firmware %s\n", fw_name); -+ err = request_firmware_nowait(THIS_MODULE, 1, fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl_fw_cb); - if (err) { -@@ -280,7 +279,6 @@ static const struct rtl_hal_cfg rtl8723e_hal_cfg = { - .bar_id = 2, - .write_readback = true, - .name = "rtl8723e_pci", -- .fw_name = "rtlwifi/rtl8723efw.bin", - .ops = &rtl8723e_hal_ops, - .mod_params = &rtl8723e_mod_params, - .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL, -diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c -index 20b53f0..847644d 100644 ---- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c -+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c -@@ -91,6 +91,7 @@ int rtl8723be_init_sw_vars(struct ieee80211_hw *hw) - struct rtl_priv *rtlpriv = rtl_priv(hw); - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); -+ char *fw_name = "rtlwifi/rtl8723befw.bin"; - - rtl8723be_bt_reg_init(hw); - rtlpriv->btcoexist.btc_ops = rtl_btc_get_ops_pointer(); -@@ -184,8 +185,8 @@ int rtl8723be_init_sw_vars(struct ieee80211_hw *hw) - } - - rtlpriv->max_fw_size = 0x8000; -- pr_info("Using firmware %s\n", rtlpriv->cfg->fw_name); -- err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, -+ pr_info("Using firmware %s\n", fw_name); -+ err = request_firmware_nowait(THIS_MODULE, 1, fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl_fw_cb); - if (err) { -@@ -280,7 +281,6 @@ static const struct rtl_hal_cfg rtl8723be_hal_cfg = { - .bar_id = 2, - .write_readback = true, - .name = "rtl8723be_pci", -- .fw_name = "rtlwifi/rtl8723befw.bin", - .ops = &rtl8723be_hal_ops, - .mod_params = &rtl8723be_mod_params, - .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL, -diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c -index 22f687b1..297938e 100644 ---- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c -+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c -@@ -93,6 +93,7 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw) - struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); - struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); - struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); -+ char *fw_name, *wowlan_fw_name; - - rtl8821ae_bt_reg_init(hw); - rtlpriv->btcoexist.btc_ops = rtl_btc_get_ops_pointer(); -@@ -203,17 +204,17 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw) - } - - if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) { -- rtlpriv->cfg->fw_name = "rtlwifi/rtl8812aefw.bin"; -- rtlpriv->cfg->wowlan_fw_name = "rtlwifi/rtl8812aefw_wowlan.bin"; -+ fw_name = "rtlwifi/rtl8812aefw.bin"; -+ wowlan_fw_name = "rtlwifi/rtl8812aefw_wowlan.bin"; - } else { -- rtlpriv->cfg->fw_name = "rtlwifi/rtl8821aefw.bin"; -- rtlpriv->cfg->wowlan_fw_name = "rtlwifi/rtl8821aefw_wowlan.bin"; -+ fw_name = "rtlwifi/rtl8821aefw.bin"; -+ wowlan_fw_name = "rtlwifi/rtl8821aefw_wowlan.bin"; - } - - rtlpriv->max_fw_size = 0x8000; - /*load normal firmware*/ -- pr_info("Using firmware %s\n", rtlpriv->cfg->fw_name); -- err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, -+ pr_info("Using firmware %s\n", fw_name); -+ err = request_firmware_nowait(THIS_MODULE, 1, fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl_fw_cb); - if (err) { -@@ -222,9 +223,9 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw) - return 1; - } - /*load wowlan firmware*/ -- pr_info("Using firmware %s\n", rtlpriv->cfg->wowlan_fw_name); -+ pr_info("Using firmware %s\n", wowlan_fw_name); - err = request_firmware_nowait(THIS_MODULE, 1, -- rtlpriv->cfg->wowlan_fw_name, -+ wowlan_fw_name, - rtlpriv->io.dev, GFP_KERNEL, hw, - rtl_wowlan_fw_cb); - if (err) { -@@ -320,7 +321,6 @@ static const struct rtl_hal_cfg rtl8821ae_hal_cfg = { - .bar_id = 2, - .write_readback = true, - .name = "rtl8821ae_pci", -- .fw_name = "rtlwifi/rtl8821aefw.bin", - .ops = &rtl8821ae_hal_ops, - .mod_params = &rtl8821ae_mod_params, - .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL, -diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h -index 595f7d5..dafe486 100644 ---- a/drivers/net/wireless/realtek/rtlwifi/wifi.h -+++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h -@@ -2278,9 +2278,7 @@ struct rtl_hal_cfg { - u8 bar_id; - bool write_readback; - char *name; -- char *fw_name; - char *alt_fw_name; -- char *wowlan_fw_name; - struct rtl_hal_ops *ops; - struct rtl_mod_params *mod_params; - struct rtl_hal_usbint_cfg *usb_interface_cfg; --- -2.10.1 - diff --git a/kernel/kernel/files/patches/mageia/nvmepatch1-V4.patch b/kernel/kernel/files/patches/mageia/nvmepatch1-V4.patch deleted file mode 100644 index 9bcefef0..00000000 --- a/kernel/kernel/files/patches/mageia/nvmepatch1-V4.patch +++ /dev/null @@ -1,111 +0,0 @@ -diff --git a/drivers/nvme/host/scsi.c b/drivers/nvme/host/scsi.c -index e947e298a737..44009105f8c8 100644 ---- a/drivers/nvme/host/scsi.c -+++ b/drivers/nvme/host/scsi.c -@@ -72,15 +72,6 @@ static int sg_version_num = 30534; /* 2 digits for each component */ - #define ALL_LUNS_RETURNED 0x02 - #define ALL_WELL_KNOWN_LUNS_RETURNED 0x01 - #define RESTRICTED_LUNS_RETURNED 0x00 --#define NVME_POWER_STATE_START_VALID 0x00 --#define NVME_POWER_STATE_ACTIVE 0x01 --#define NVME_POWER_STATE_IDLE 0x02 --#define NVME_POWER_STATE_STANDBY 0x03 --#define NVME_POWER_STATE_LU_CONTROL 0x07 --#define POWER_STATE_0 0 --#define POWER_STATE_1 1 --#define POWER_STATE_2 2 --#define POWER_STATE_3 3 - #define DOWNLOAD_SAVE_ACTIVATE 0x05 - #define DOWNLOAD_SAVE_DEFER_ACTIVATE 0x0E - #define ACTIVATE_DEFERRED_MICROCODE 0x0F -@@ -1229,64 +1220,6 @@ static void nvme_trans_fill_read_cap(u8 *response, struct nvme_id_ns *id_ns, - - /* Start Stop Unit Helper Functions */ - --static int nvme_trans_power_state(struct nvme_ns *ns, struct sg_io_hdr *hdr, -- u8 pc, u8 pcmod, u8 start) --{ -- int res; -- int nvme_sc; -- struct nvme_id_ctrl *id_ctrl; -- int lowest_pow_st; /* max npss = lowest power consumption */ -- unsigned ps_desired = 0; -- -- nvme_sc = nvme_identify_ctrl(ns->ctrl, &id_ctrl); -- res = nvme_trans_status_code(hdr, nvme_sc); -- if (res) -- return res; -- -- lowest_pow_st = max(POWER_STATE_0, (int)(id_ctrl->npss - 1)); -- kfree(id_ctrl); -- -- switch (pc) { -- case NVME_POWER_STATE_START_VALID: -- /* Action unspecified if POWER CONDITION MODIFIER != 0 */ -- if (pcmod == 0 && start == 0x1) -- ps_desired = POWER_STATE_0; -- if (pcmod == 0 && start == 0x0) -- ps_desired = lowest_pow_st; -- break; -- case NVME_POWER_STATE_ACTIVE: -- /* Action unspecified if POWER CONDITION MODIFIER != 0 */ -- if (pcmod == 0) -- ps_desired = POWER_STATE_0; -- break; -- case NVME_POWER_STATE_IDLE: -- /* Action unspecified if POWER CONDITION MODIFIER != [0,1,2] */ -- if (pcmod == 0x0) -- ps_desired = POWER_STATE_1; -- else if (pcmod == 0x1) -- ps_desired = POWER_STATE_2; -- else if (pcmod == 0x2) -- ps_desired = POWER_STATE_3; -- break; -- case NVME_POWER_STATE_STANDBY: -- /* Action unspecified if POWER CONDITION MODIFIER != [0,1] */ -- if (pcmod == 0x0) -- ps_desired = max(POWER_STATE_0, (lowest_pow_st - 2)); -- else if (pcmod == 0x1) -- ps_desired = max(POWER_STATE_0, (lowest_pow_st - 1)); -- break; -- case NVME_POWER_STATE_LU_CONTROL: -- default: -- res = nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION, -- ILLEGAL_REQUEST, SCSI_ASC_INVALID_CDB, -- SCSI_ASCQ_CAUSE_NOT_REPORTABLE); -- break; -- } -- nvme_sc = nvme_set_features(ns->ctrl, NVME_FEAT_POWER_MGMT, ps_desired, 0, -- NULL); -- return nvme_trans_status_code(hdr, nvme_sc); --} -- - static int nvme_trans_send_activate_fw_cmd(struct nvme_ns *ns, struct sg_io_hdr *hdr, - u8 buffer_id) - { -@@ -2235,11 +2168,10 @@ static int nvme_trans_synchronize_cache(struct nvme_ns *ns, - static int nvme_trans_start_stop(struct nvme_ns *ns, struct sg_io_hdr *hdr, - u8 *cmd) - { -- u8 immed, pcmod, pc, no_flush, start; -+ u8 immed, pcmod, no_flush, start; - - immed = cmd[1] & 0x01; - pcmod = cmd[3] & 0x0f; -- pc = (cmd[4] & 0xf0) >> 4; - no_flush = cmd[4] & 0x04; - start = cmd[4] & 0x01; - -@@ -2254,8 +2186,8 @@ static int nvme_trans_start_stop(struct nvme_ns *ns, struct sg_io_hdr *hdr, - if (res) - return res; - } -- /* Setup the expected power state transition */ -- return nvme_trans_power_state(ns, hdr, pc, pcmod, start); -+ -+ return 0; - } - } - --- -2.7.4 diff --git a/kernel/kernel/files/patches/mageia/nvmepatch2-V4.patch b/kernel/kernel/files/patches/mageia/nvmepatch2-V4.patch deleted file mode 100644 index 454cb4a5..00000000 --- a/kernel/kernel/files/patches/mageia/nvmepatch2-V4.patch +++ /dev/null @@ -1,107 +0,0 @@ -diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c -index 2feacc70bf61..b92a7f767bfc 100644 ---- a/drivers/nvme/host/core.c -+++ b/drivers/nvme/host/core.c -@@ -597,7 +597,7 @@ int nvme_identify_ns(struct nvme_ctrl *dev, unsigned nsid, - } - - int nvme_get_features(struct nvme_ctrl *dev, unsigned fid, unsigned nsid, -- dma_addr_t dma_addr, u32 *result) -+ void *buffer, size_t buflen, u32 *result) - { - struct nvme_command c; - struct nvme_completion cqe; -@@ -606,10 +606,9 @@ int nvme_get_features(struct nvme_ctrl *dev, unsigned fid, unsigned nsid, - memset(&c, 0, sizeof(c)); - c.features.opcode = nvme_admin_get_features; - c.features.nsid = cpu_to_le32(nsid); -- c.features.dptr.prp1 = cpu_to_le64(dma_addr); - c.features.fid = cpu_to_le32(fid); - -- ret = __nvme_submit_sync_cmd(dev->admin_q, &c, &cqe, NULL, 0, 0, -+ ret = __nvme_submit_sync_cmd(dev->admin_q, &c, &cqe, buffer, buflen, 0, - NVME_QID_ANY, 0, 0); - if (ret >= 0 && result) - *result = le32_to_cpu(cqe.result); -@@ -617,7 +616,7 @@ int nvme_get_features(struct nvme_ctrl *dev, unsigned fid, unsigned nsid, - } - - int nvme_set_features(struct nvme_ctrl *dev, unsigned fid, unsigned dword11, -- dma_addr_t dma_addr, u32 *result) -+ void *buffer, size_t buflen, u32 *result) - { - struct nvme_command c; - struct nvme_completion cqe; -@@ -625,12 +624,11 @@ int nvme_set_features(struct nvme_ctrl *dev, unsigned fid, unsigned dword11, - - memset(&c, 0, sizeof(c)); - c.features.opcode = nvme_admin_set_features; -- c.features.dptr.prp1 = cpu_to_le64(dma_addr); - c.features.fid = cpu_to_le32(fid); - c.features.dword11 = cpu_to_le32(dword11); - -- ret = __nvme_submit_sync_cmd(dev->admin_q, &c, &cqe, NULL, 0, 0, -- NVME_QID_ANY, 0, 0); -+ ret = __nvme_submit_sync_cmd(dev->admin_q, &c, &cqe, -+ buffer, buflen, 0, NVME_QID_ANY, 0, 0); - if (ret >= 0 && result) - *result = le32_to_cpu(cqe.result); - return ret; -@@ -664,7 +662,7 @@ int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count) - u32 result; - int status, nr_io_queues; - -- status = nvme_set_features(ctrl, NVME_FEAT_NUM_QUEUES, q_count, 0, -+ status = nvme_set_features(ctrl, NVME_FEAT_NUM_QUEUES, q_count, NULL, 0, - &result); - if (status < 0) - return status; -diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h -index ab18b78102bf..c2151761ec5f 100644 ---- a/drivers/nvme/host/nvme.h -+++ b/drivers/nvme/host/nvme.h -@@ -292,9 +292,9 @@ int nvme_identify_ns(struct nvme_ctrl *dev, unsigned nsid, - struct nvme_id_ns **id); - int nvme_get_log_page(struct nvme_ctrl *dev, struct nvme_smart_log **log); - int nvme_get_features(struct nvme_ctrl *dev, unsigned fid, unsigned nsid, -- dma_addr_t dma_addr, u32 *result); -+ void *buffer, size_t buflen, u32 *result); - int nvme_set_features(struct nvme_ctrl *dev, unsigned fid, unsigned dword11, -- dma_addr_t dma_addr, u32 *result); -+ void *buffer, size_t buflen, u32 *result); - int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count); - void nvme_start_keep_alive(struct nvme_ctrl *ctrl); - void nvme_stop_keep_alive(struct nvme_ctrl *ctrl); -diff --git a/drivers/nvme/host/scsi.c b/drivers/nvme/host/scsi.c -index 44009105f8c8..c2a0a1c7d05d 100644 ---- a/drivers/nvme/host/scsi.c -+++ b/drivers/nvme/host/scsi.c -@@ -906,7 +906,7 @@ static int nvme_trans_log_temperature(struct nvme_ns *ns, struct sg_io_hdr *hdr, - kfree(smart_log); - - /* Get Features for Temp Threshold */ -- res = nvme_get_features(ns->ctrl, NVME_FEAT_TEMP_THRESH, 0, 0, -+ res = nvme_get_features(ns->ctrl, NVME_FEAT_TEMP_THRESH, 0, NULL, 0, - &feature_resp); - if (res != NVME_SC_SUCCESS) - temp_c_thresh = LOG_TEMP_UNKNOWN; -@@ -1039,7 +1039,7 @@ static int nvme_trans_fill_caching_page(struct nvme_ns *ns, - if (len < MODE_PAGE_CACHING_LEN) - return -EINVAL; - -- nvme_sc = nvme_get_features(ns->ctrl, NVME_FEAT_VOLATILE_WC, 0, 0, -+ nvme_sc = nvme_get_features(ns->ctrl, NVME_FEAT_VOLATILE_WC, 0, NULL, 0, - &feature_resp); - res = nvme_trans_status_code(hdr, nvme_sc); - if (res) -@@ -1328,7 +1328,7 @@ static int nvme_trans_modesel_get_mp(struct nvme_ns *ns, struct sg_io_hdr *hdr, - case MODE_PAGE_CACHING: - dword11 = ((mode_page[2] & CACHING_MODE_PAGE_WCE_MASK) ? 1 : 0); - nvme_sc = nvme_set_features(ns->ctrl, NVME_FEAT_VOLATILE_WC, -- dword11, 0, NULL); -+ dword11, NULL, 0, NULL); - res = nvme_trans_status_code(hdr, nvme_sc); - break; - case MODE_PAGE_CONTROL: --- -2.7.4 diff --git a/kernel/kernel/files/patches/mageia/nvmepatch3-V4.patch b/kernel/kernel/files/patches/mageia/nvmepatch3-V4.patch deleted file mode 100644 index 797c4681..00000000 --- a/kernel/kernel/files/patches/mageia/nvmepatch3-V4.patch +++ /dev/null @@ -1,264 +0,0 @@ -diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c -index b92a7f767bfc..a143c72c3d0d 100644 ---- a/drivers/nvme/host/core.c -+++ b/drivers/nvme/host/core.c -@@ -56,6 +56,11 @@ EXPORT_SYMBOL_GPL(nvme_max_retries); - static int nvme_char_major; - module_param(nvme_char_major, int, 0); - -+static unsigned long default_ps_max_latency_us = 25000; -+module_param(default_ps_max_latency_us, ulong, 0644); -+MODULE_PARM_DESC(ps_max_latency_us, -+ "default max power saving latency; overridden per device in sysfs"); -+ - static LIST_HEAD(nvme_ctrl_list); - static DEFINE_SPINLOCK(dev_list_lock); - -@@ -1205,6 +1210,98 @@ static void nvme_set_queue_limits(struct nvme_ctrl *ctrl, - blk_queue_write_cache(q, vwc, vwc); - } - -+static void nvme_configure_apst(struct nvme_ctrl *ctrl) -+{ -+ /* -+ * APST (Autonomous Power State Transition) lets us program a -+ * table of power state transitions that the controller will -+ * perform automatically. We configure it with a simple -+ * heuristic: we are willing to spend at most 2% of the time -+ * transitioning between power states. Therefore, when running -+ * in any given state, we will enter the next lower-power -+ * non-operational state after waiting 100 * (enlat + exlat) -+ * microseconds, as long as that state's total latency is under -+ * the requested maximum latency. -+ * -+ * We will not autonomously enter any non-operational state for -+ * which the total latency exceeds ps_max_latency_us. Users -+ * can set ps_max_latency_us to zero to turn off APST. -+ */ -+ -+ unsigned apste; -+ struct nvme_feat_auto_pst *table; -+ int ret; -+ -+ if (!ctrl->apsta) -+ return; /* APST isn't supported. */ -+ -+ if (ctrl->npss > 31) { -+ dev_warn(ctrl->device, "NPSS is invalid; not using APST\n"); -+ return; -+ } -+ -+ table = kzalloc(sizeof(*table), GFP_KERNEL); -+ if (!table) -+ return; -+ -+ if (ctrl->ps_max_latency_us == 0) { -+ /* Turn off APST. */ -+ apste = 0; -+ } else { -+ __le64 target = cpu_to_le64(0); -+ int state; -+ -+ /* -+ * Walk through all states from lowest- to highest-power. -+ * According to the spec, lower-numbered states use more -+ * power. NPSS, despite the name, is the index of the -+ * lowest-power state, not the number of states. -+ */ -+ for (state = (int)ctrl->npss; state >= 0; state--) { -+ u64 total_latency_us, transition_ms; -+ -+ if (target) -+ table->entries[state] = target; -+ -+ /* -+ * Is this state a useful non-operational state for -+ * higher-power states to autonomously transition to? -+ */ -+ if (!(ctrl->psd[state].flags & 2)) -+ continue; /* It's an operational state. */ -+ -+ total_latency_us = -+ (u64)cpu_to_le32(ctrl->psd[state].entry_lat) + -+ + cpu_to_le32(ctrl->psd[state].exit_lat); -+ if (total_latency_us > ctrl->ps_max_latency_us) -+ continue; -+ -+ /* -+ * This state is good. Use it as the APST idle -+ * target for higher power states. -+ */ -+ transition_ms = total_latency_us + 19; -+ do_div(transition_ms, 20); -+ if (transition_ms >= (1 << 24)) -+ transition_ms = (1 << 24); -+ -+ target = cpu_to_le64((state << 3) | -+ (transition_ms << 8)); -+ } -+ -+ apste = 1; -+ } -+ -+ ret = nvme_set_features(ctrl, NVME_FEAT_AUTO_PST, apste, -+ table, sizeof(*table), NULL); -+ if (ret) -+ dev_err(ctrl->device, "failed to set APST feature (%d)\n", ret); -+ -+ kfree(table); -+} -+ -+static struct attribute_group nvme_dev_dynamic_attrs_group; -+ - /* - * Initialize the cached copies of the Identify data and various controller - * register in our nvme_ctrl structure. This should be called as soon as -@@ -1271,6 +1368,10 @@ int nvme_init_identify(struct nvme_ctrl *ctrl) - ctrl->sgls = le32_to_cpu(id->sgls); - ctrl->kas = le16_to_cpu(id->kas); - -+ ctrl->npss = id->npss; -+ ctrl->apsta = id->apsta; -+ memcpy(ctrl->psd, id->psd, sizeof(ctrl->psd)); -+ - if (ctrl->ops->is_fabrics) { - ctrl->icdoff = le16_to_cpu(id->icdoff); - ctrl->ioccsz = le32_to_cpu(id->ioccsz); -@@ -1294,6 +1395,10 @@ int nvme_init_identify(struct nvme_ctrl *ctrl) - } - - kfree(id); -+ -+ nvme_configure_apst(ctrl); -+ -+ sysfs_update_group(&ctrl->device->kobj, &nvme_dev_dynamic_attrs_group); - return ret; - } - EXPORT_SYMBOL_GPL(nvme_init_identify); -@@ -1564,6 +1669,41 @@ static ssize_t nvme_sysfs_show_address(struct device *dev, - } - static DEVICE_ATTR(address, S_IRUGO, nvme_sysfs_show_address, NULL); - -+static ssize_t nvme_sysfs_show_ps_max_latency_us( -+ struct device *dev, -+ struct device_attribute *attr, -+ char *buf) -+{ -+ struct nvme_ctrl *ctrl = dev_get_drvdata(dev); -+ -+ return snprintf(buf, PAGE_SIZE, "%llu\n", ctrl->ps_max_latency_us); -+} -+ -+static ssize_t nvme_sysfs_store_ps_max_latency_us( -+ struct device *dev, -+ struct device_attribute *attr, -+ const char *buf, size_t size) -+{ -+ struct nvme_ctrl *ctrl = dev_get_drvdata(dev); -+ int ret; -+ u64 val; -+ -+ ret = kstrtoull(buf, 10, &val); -+ if (ret) -+ return ret; -+ -+ if (ctrl->ps_max_latency_us != val) { -+ ctrl->ps_max_latency_us = val; -+ nvme_configure_apst(ctrl); -+ } -+ -+ return size; -+} -+ -+static DEVICE_ATTR(ps_max_latency_us, 0644, -+ nvme_sysfs_show_ps_max_latency_us, -+ nvme_sysfs_store_ps_max_latency_us); -+ - static struct attribute *nvme_dev_attrs[] = { - &dev_attr_reset_controller.attr, - &dev_attr_rescan_controller.attr, -@@ -1605,8 +1745,33 @@ static struct attribute_group nvme_dev_attrs_group = { - .is_visible = nvme_dev_attrs_are_visible, - }; - -+static struct attribute *nvme_dev_dynamic_attrs[] = { -+ &dev_attr_ps_max_latency_us.attr, -+ NULL -+}; -+ -+static umode_t nvme_dev_dynamic_attrs_are_visible(struct kobject *kobj, -+ struct attribute *a, int n) -+{ -+ struct device *dev = container_of(kobj, struct device, kobj); -+ struct nvme_ctrl *ctrl = dev_get_drvdata(dev); -+ -+ if (a == &dev_attr_ps_max_latency_us.attr) { -+ if (!ctrl->apsta) -+ return 0; -+ } -+ -+ return a->mode; -+} -+ -+static struct attribute_group nvme_dev_dynamic_attrs_group = { -+ .attrs = nvme_dev_dynamic_attrs, -+ .is_visible = nvme_dev_dynamic_attrs_are_visible, -+}; -+ - static const struct attribute_group *nvme_dev_attr_groups[] = { - &nvme_dev_attrs_group, -+ &nvme_dev_dynamic_attrs_group, - NULL, - }; - -@@ -1991,6 +2156,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev, - ctrl->quirks = quirks; - INIT_WORK(&ctrl->scan_work, nvme_scan_work); - INIT_WORK(&ctrl->async_event_work, nvme_async_event_work); -+ ctrl->ps_max_latency_us = default_ps_max_latency_us; - - ret = nvme_set_instance(ctrl); - if (ret) -diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h -index c2151761ec5f..16d51006afc0 100644 ---- a/drivers/nvme/host/nvme.h -+++ b/drivers/nvme/host/nvme.h -@@ -129,13 +129,19 @@ struct nvme_ctrl { - u32 vs; - u32 sgls; - u16 kas; -+ u8 npss; -+ u8 apsta; - unsigned int kato; - bool subsystem; - unsigned long quirks; -+ struct nvme_id_power_state psd[32]; - struct work_struct scan_work; - struct work_struct async_event_work; - struct delayed_work ka_work; - -+ /* Power saving configuration */ -+ u64 ps_max_latency_us; -+ - /* Fabrics only */ - u16 sqsize; - u32 ioccsz; -diff --git a/include/linux/nvme.h b/include/linux/nvme.h -index d8b37bab2887..a76237dac4b0 100644 ---- a/include/linux/nvme.h -+++ b/include/linux/nvme.h -@@ -543,6 +543,12 @@ struct nvme_dsm_range { - __le64 slba; - }; - -+/* Features */ -+ -+struct nvme_feat_auto_pst { -+ __le64 entries[32]; -+}; -+ - /* Admin commands */ - - enum nvme_admin_opcode { --- -2.7.4 diff --git a/kernel/kernel/files/patches/mageia/series b/kernel/kernel/files/patches/mageia/series index 2a2a481b..ca9b5050 100644 --- a/kernel/kernel/files/patches/mageia/series +++ b/kernel/kernel/files/patches/mageia/series @@ -14,7 +14,14 @@ ### ### Stable Queue ### -patch-4.8.10-rc1.patch + +# CVE-2016-8405 +stable-fbdev-color-map-copying-bounds-checking.patch + +stable-tile-ptrace-preserve-previous-registers-for-short-regset-write.patch +stable-drm-schedule-the-output_poll_work-with-1s-delay-if-we-have-delayed-event.patch +stable-drm-fix-broken-vt-switch-with-video-1366x768-option.patch +stable-drm-i915-ignore-bogus-plane-coordinates-on-skl-when-the-plane-is-not-visible.patch ### ### Arch x86 @@ -78,6 +85,9 @@ acpi-processor-M720SR-limit-to-C2.patch # backlight fixes ACPI-video-Add-a-quirk-to-force-acpi-video-backlight.patch +# drop obsolete warn +acpi-do-not-warn-if-_BQC-does-not-exist.patch + ### ### Block ### @@ -122,15 +132,10 @@ block-Make-CFQ-default-to-IOPS-mode-on-SSDs.patch # Include new BFQ I/O scheduler # (See http://algo.ing.unimo.it/people/paolo/disk_sched) -# -# Release of BFQ I/O scheduler v8r4 (rediffed from git https://github.com/linusw/linux-bfq) -linux-BFQ-v8r4.patch - -# Let NVME drives enter in power state -# (see https://github.com/damige/linux-nvme/tree/master/src) -nvmepatch1-V4.patch -nvmepatch2-V4.patch -nvmepatch3-V4.patch +block-cgroups-kconfig-build-bits-for-BFQ-v7r11-4.5.0.patch +block-introduce-the-BFQ-v7r11-I-O-sched-for-4.5.0.patch +block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v7r11-for.patch +block-Turn-into-BFQ-v8r6-for-4.9.0.patch ### ### Char @@ -139,13 +144,22 @@ nvmepatch3-V4.patch # hard locks Dell R720xd Revert-ipmi-Start-the-timer-and-thread-on-internal-m.patch +# tpm_crb fixes for SkyLake +char-tpm-tpm_crb-implement-tpm-crb-idle-state.patch +char-tmp-tpm_crb-fix-Intel-PTT-hw-bug-during-idle-state.patch +char-tpm-tpm_crb-open-code-the-crb_init-into-acpi_add.patch +char-tmp-tpm_crb-implement-runtime-pm-for-tpm_crb.patch + ### ### File-system ### # aufs from: http://aufs.sourceforge.net/ (mga#8314) -fs-aufs-4.8.patch -fs-aufs-4.8-modular.patch +fs-aufs-4.9.patch +fs-aufs-4.9-modular.patch + +# needed for mdadm: imsm: enable bad block support for imsm metadata +fs-seq_file-reset-iterator-to-first-record-for-zero-off.patch ### ### FireWire @@ -180,6 +194,12 @@ gpu-drm-mach64-linux-3.14-buildfix.patch gpu-drm-mach64-3.17-buildfix.patch gpu-drm-mach64-3.18-buildfix.patch +# i915 skl/kbl speedup +gpu-drm-i915-skl-drop-workarounds-for-A0-and-B0-revisions.patch +gpu-drm-i915-skl-drop-workarounds-for-D0-revision.patch +gpu-drm-i915-skl-drop-workarounds-for-E0-revision.patch +gpu-drm-i915-Remove-WaDisableLSQCROPERFforOCL-KBL-workaround.patch + ### ### Hardware Monitoring ### @@ -230,9 +250,14 @@ net-netfilter-IFWLOG-remove-unused-label.patch net-netfilter-psd.patch net-netfilter-psd-mdv.patch net-netfilter-psd-2.6.35-buildfix.patch +net-netfilter-psd-fix-redefines.patch -# rtlwifi regression -net-wireless-rtlwifi-Fix-regression-caused-by-commit-d86e64768859.patch +# rtlwifi fixes +net-wireless-rtlwifi-Use-dev_kfree_skb_irq-instead-of-kfree_skb.patch +net-wireless-rtlwifi-Fix-kernel-oops-introduced-with-commit-e4965.patch + +# fix speed regression +net-wireless-brcmfmac-fix-incorrect-event-channel-deduction.patch ### ### Platform drivers @@ -338,8 +363,6 @@ video-mageia-logo.patch # add rtl8723bs support (mga#15874) 3rd-rtl8723bs.patch -3rd-rtl8723bs-4.7-buildfix.patch -3rd-rtl8723bs-4.8-buildfix.patch ### ### Security @@ -368,6 +391,11 @@ video-mageia-logo.patch # wipe powerpc refrence so we can nuke dangling symlinks (mga#17676) tools-testing-selftest-Makefile-remove-powerpc-reference.patch +# perf build fixes +tools-build-Make-fixdep-parsing-wait-for-last-target.patch +tools-perf-tools-Force-fixdep-compilation-at-the-start-of-.patch +tools-perf-tools-Move-perf-build-related-variables-under-n.patch + ### ### UAPI ### diff --git a/kernel/kernel/files/patches/mageia/tools-testing-selftest-Makefile-remove-powerpc-reference.patch b/kernel/kernel/files/patches/mageia/tools-testing-selftest-Makefile-remove-powerpc-reference.patch index 677e97df..fea25f61 100644 --- a/kernel/kernel/files/patches/mageia/tools-testing-selftest-Makefile-remove-powerpc-reference.patch +++ b/kernel/kernel/files/patches/mageia/tools-testing-selftest-Makefile-remove-powerpc-reference.patch @@ -1,9 +1,9 @@ --- linux/tools/testing/selftests/Makefile.orig +++ linux/tools/testing/selftests/Makefile -@@ -15,7 +15,6 @@ TARGETS += memory-hotplug - TARGETS += mount +@@ -16,7 +16,6 @@ TARGETS += mount TARGETS += mqueue TARGETS += net + TARGETS += nsfs -TARGETS += powerpc TARGETS += pstore TARGETS += ptrace diff --git a/kernel/kernel/pspec.xml b/kernel/kernel/pspec.xml index 7fc3e080..29a9d1e1 100644 --- a/kernel/kernel/pspec.xml +++ b/kernel/kernel/pspec.xml @@ -12,7 +12,7 @@ kernel The Linux kernel (the core of the Linux operating system) for Pisi Linux kernel contains the Linux kernel, the core of any Linux operating system. The kernel handles the basic functions of the operating system: memory allocation, process allocation, device input and output, etc. - https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.8.tar.gz + https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.9.tar.gz configs/kernel-i686-config configs/kernel-x86_64-config @@ -28,15 +28,16 @@ - patches/linux/patch-4.8.13.xz - + patches/linux/patch-4.9.6.xz + + + patches/mageia/stable-fbdev-color-map-copying-bounds-checking.patch + patches/mageia/stable-tile-ptrace-preserve-previous-registers-for-short-regset-write.patch + patches/mageia/stable-drm-schedule-the-output_poll_work-with-1s-delay-if-we-have-delayed-event.patch + patches/mageia/stable-drm-fix-broken-vt-switch-with-video-1366x768-option.patch + patches/mageia/stable-drm-i915-ignore-bogus-plane-coordinates-on-skl-when-the-plane-is-not-visible.patch - patches/mageia/Revert-ipmi-Start-the-timer-and-thread-on-internal-m.patch - patches/mageia/x86-pci-toshiba-equium-a60-assign-busses.patch - patches/mageia/x86-boot-video-80x25-if-break.patch - patches/mageia/x86-default_poweroff_up_machines.patch - patches/mageia/x86-increase-default-minimum-vmalloc-area-by-64MB-to-192MB.patch patches/mageia/Revert-cpufreq-pcc-Enable-autoload-of-pcc-cpufreq-fo.patch patches/mageia/Revert-x86-mm-mtrr-Remove-kernel-internal-MTRR-inter.patch patches/mageia/base-cacheinfo-silence-DT-warnings.patch @@ -45,6 +46,7 @@ patches/mageia/acpi-CLEVO-M360S-disable_acpi_irq.patch patches/mageia/acpi-processor-M720SR-limit-to-C2.patch patches/mageia/ACPI-video-Add-a-quirk-to-force-acpi-video-backlight.patch + patches/mageia/acpi-do-not-warn-if-_BQC-does-not-exist.patch + patches/mageia/char-tpm-tpm_crb-implement-tpm-crb-idle-state.patch + patches/mageia/char-tmp-tpm_crb-fix-Intel-PTT-hw-bug-during-idle-state.patch + patches/mageia/char-tpm-tpm_crb-open-code-the-crb_init-into-acpi_add.patch + patches/mageia/char-tmp-tpm_crb-implement-runtime-pm-for-tpm_crb.patch + patches/mageia/fs-aufs-4.9.patch + patches/mageia/fs-aufs-4.9-modular.patch + patches/mageia/fs-seq_file-reset-iterator-to-first-record-for-zero-off.patch patches/mageia/firewire-ieee1394-module-aliases.patch patches/mageia/char-agp-intel-new-Q57-id.patch @@ -83,7 +90,11 @@ patches/mageia/gpu-drm-mach64-restore-mach64_PCI_IDS.patch patches/mageia/gpu-drm-mach64-linux-3.14-buildfix.patch patches/mageia/gpu-drm-mach64-3.17-buildfix.patch - patches/mageia/gpu-drm-mach64-3.18-buildfix.patch + patches/mageia/gpu-drm-mach64-3.18-buildfix.patch + patches/mageia/gpu-drm-i915-skl-drop-workarounds-for-A0-and-B0-revisions.patch + patches/mageia/gpu-drm-i915-skl-drop-workarounds-for-D0-revision.patch + patches/mageia/gpu-drm-i915-skl-drop-workarounds-for-E0-revision.patch + patches/mageia/gpu-drm-i915-Remove-WaDisableLSQCROPERFforOCL-KBL-workaround.patch patches/mageia/input-i8042-quirks-for-Fujitsu-Lifebook-A544-and-Lif.patch patches/mageia/net-sis190-fix-list-usage.patch patches/mageia/net-netfilter-IFWLOG.patch @@ -96,7 +107,10 @@ patches/mageia/net-netfilter-psd.patch patches/mageia/net-netfilter-psd-mdv.patch patches/mageia/net-netfilter-psd-2.6.35-buildfix.patch - patches/mageia/net-wireless-rtlwifi-Fix-regression-caused-by-commit-d86e64768859.patch + patches/mageia/net-netfilter-psd-fix-redefines.patch + patches/mageia/net-wireless-rtlwifi-Use-dev_kfree_skb_irq-instead-of-kfree_skb.patch + patches/mageia/net-wireless-rtlwifi-Fix-kernel-oops-introduced-with-commit-e4965.patch + patches/mageia/net-wireless-brcmfmac-fix-incorrect-event-channel-deduction.patch patches/mageia/platform-x86-add-shuttle-wmi-driver.patch patches/mageia/platform-x86-shuttle-wmi-drop-devinit-exit.patch patches/mageia/platform-x86-shuttle-wmi-4.2-buildfix.patch @@ -131,9 +145,10 @@ patches/mageia/3rd-viahss-2.6.35-buildfix.patch patches/mageia/3rd-viahss-3.0-buildfix.patch patches/mageia/3rd-rtl8723bs.patch - patches/mageia/3rd-rtl8723bs-4.7-buildfix.patch - patches/mageia/3rd-rtl8723bs-4.8-buildfix.patch patches/mageia/tools-testing-selftest-Makefile-remove-powerpc-reference.patch + patches/mageia/tools-build-Make-fixdep-parsing-wait-for-last-target.patch + patches/mageia/tools-perf-tools-Force-fixdep-compilation-at-the-start-of-.patch + patches/mageia/tools-perf-tools-Move-perf-build-related-variables-under-n.patch @@ -189,6 +204,17 @@ + + 2017-01-27 + 4.9.6 + Version Bump. + security + + systemRestart + + Ertuğrul Erata + ertugrulerata@gmail.com + 2016-12-10 4.8.13 diff --git a/pisi-index.xml b/pisi-index.xml index b14ef288..08490501 100644 --- a/pisi-index.xml +++ b/pisi-index.xml @@ -403,6 +403,126 @@ glibc-32bit + + + xmlto + https://fedorahosted.org/xmlto/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2+ + app:console + office.docbook + A frontend to an XSL toolchain + XML ve DocBook için dönüşüm aracı + The purpose of xmlto is to convert an XML file to the desired format using whatever means necessary. + xmlto uygulamasının amacı verilen bir XML dosyasını istenen bir biçime dönüştürmektir. + https://fedorahosted.org/releases/x/m/xmlto/xmlto-0.0.28.tar.gz + + libxslt-devel + util-linux + docbook-xsl + docbook-xml + + office/docbook/xmlto/pspec.xml + + + xmlto + + docbook-xsl + docbook-xml + + + /usr/bin + /usr/share/doc/xmlto + /usr/share/xmlto + /usr/share/man + + + + + 2017-01-24 + 0.0.28 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 0.0.28 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-19 + 0.0.28 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + sgml-common + http://www.linuxfromscratch.org/blfs/view/svn/pst/sgml-common.html + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + data + office.docbook + Base ISO character entities and utilities for SGML + SGML ISO karakter nesneleri ve yardımcı programları + Sgml-common is a collection of entities and document type definitions (DTDs) useful for SGML processing. + sgml-common SGML uygulamaları için kullanışlı olan içerikler ve belge tip belirtimleri (DTD) topluluğudur. + http://gd.tuwien.ac.at/hci/kde/devel/docbook/SOURCES/sgml-common-0.6.3.tgz + + sgml-common-0.6.3-configure.in.patch + sgml-common-0.6.3-manpage-1.patch + + office/docbook/sgml-common/pspec.xml + + + sgml-common + + /etc/sgml + /usr/bin + /usr/share/doc/sgml-common + /usr/share/man + /usr/share/sgml + + + System.Package + + + + + 2017-01-24 + 0.6.3 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 0.6.3 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2014-05-18 + 0.6.3 + First release + Serdar Soytetir + kaptan@pisilinux.org + + + docbook-xsl @@ -532,201 +652,6 @@ - - - xmlto - https://fedorahosted.org/xmlto/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2+ - app:console - office.docbook - A frontend to an XSL toolchain - XML ve DocBook için dönüşüm aracı - The purpose of xmlto is to convert an XML file to the desired format using whatever means necessary. - xmlto uygulamasının amacı verilen bir XML dosyasını istenen bir biçime dönüştürmektir. - https://fedorahosted.org/releases/x/m/xmlto/xmlto-0.0.28.tar.gz - - libxslt-devel - util-linux - docbook-xsl - docbook-xml - - office/docbook/xmlto/pspec.xml - - - xmlto - - docbook-xsl - docbook-xml - - - /usr/bin - /usr/share/doc/xmlto - /usr/share/xmlto - /usr/share/man - - - - - 2017-01-24 - 0.0.28 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 0.0.28 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-19 - 0.0.28 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - sgml-common - http://www.linuxfromscratch.org/blfs/view/svn/pst/sgml-common.html - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - data - office.docbook - Base ISO character entities and utilities for SGML - SGML ISO karakter nesneleri ve yardımcı programları - Sgml-common is a collection of entities and document type definitions (DTDs) useful for SGML processing. - sgml-common SGML uygulamaları için kullanışlı olan içerikler ve belge tip belirtimleri (DTD) topluluğudur. - http://gd.tuwien.ac.at/hci/kde/devel/docbook/SOURCES/sgml-common-0.6.3.tgz - - sgml-common-0.6.3-configure.in.patch - sgml-common-0.6.3-manpage-1.patch - - office/docbook/sgml-common/pspec.xml - - - sgml-common - - /etc/sgml - /usr/bin - /usr/share/doc/sgml-common - /usr/share/man - /usr/share/sgml - - - System.Package - - - - - 2017-01-24 - 0.6.3 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 0.6.3 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2014-05-18 - 0.6.3 - First release - Serdar Soytetir - kaptan@pisilinux.org - - - - - - slang - http://www.jedsoft.org/slang/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - Artistic - app:console - programming.library - Console display library used by most text viewer - Bir çok metin gösterici yazılım tarfından kullanılan konsol görüntüleme kütüphanesi - S-Lang est une librarie de programmation multi-plateforme conçue pour permettre aux développeur de développer des logiciels robustes et portables. Elle fournit les mécanismes requis pour développer une application interactive telle que la gestion d'affichages/écrans, entrées clavier, disposition de touches et ainsi de suite. La fonctionnalité la plus attractive de cette librairie reste l'interpréteur slang qui peut être embarqué au sein même d'un programme pour le rendre extensible. - S-Lang is a multi-platform programmer's library designed to allow a developer to create robust multi-platform software. It provides facilities required by interactive applications such as display/screen management, keyboard input, keymaps, and so on. The most exciting feature of the library is the slang interpreter that may be easily embedded into a program to make it extensible. - S-lang, yazılım geliştiricilerin bütün işletim sistemlerinde çalışabilen güçlü uygulamalar geliştirmesine yardımcı olan bir uygulama kitaplığıdır. İnteraktif uygulamalar için ekran yönetimi ve klavye girişi gibi araçlar sunar. Kitaplığın en ilginç özelliği programların içine kolayca gömülebilen ve programı genişletilebilir kılan slang yorumlayıcısıdır. - ftp://ftp.ntua.gr/pub/lang/slang/slang/v2.2/slang-2.2.4.tar.bz2 - - libpng-devel - libpcre-devel - ncurses-devel - readline-devel - zlib-devel - - programming/library/slang/pspec.xml - - - slang - - libpng - libpcre - zlib - - - /etc - /usr/bin - /usr/share/slsh - /usr/lib - /usr/share/doc/slang - /usr/share/man - - - - slang-devel - Development files for slang - slang için geliştirme dosyaları - system.devel - - slang - - - /usr/include - /usr/lib/pkgconfig - /usr/share/doc/slang/html - /usr/share/man/man3 - - - - - 2016-04-27 - 2.2.4 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2014-05-11 - 2.2.4 - First release - Marcin Bojara - marcin@pisilinux.org - - - libpng @@ -815,712 +740,76 @@ - freetype - http://www.freetype.org/ - - PisiLinux Community - admins@pisilinux.org - - FTL - GPLv2 - library - desktop.font - A high-quality and portable font engine - Yüksek kaliteli ve taşınabilir yazıtipi düzeneği - FreeType2 est un moteur logiciel de fontes conçu pour être petit, efficace, très flexible et portable tout en étant capable de produire une sortie de très haute qualité. Il peut être utilisé dans les librairies graphiques, les serveurs d'affichage, les outils de conversion, les outils de génération d'images textuelles, ainsi que beaucoup d'autres produits. - FreeType 2 is a software font engine that is designed to be small, efficient, highly customizable, and portable while capable of producing high-quality output. It can be used in graphics libraries, display servers, font conversion tools, text image generation tools, and many other products as well. - FreeType 2; küçük, verimli, özelleştirilebilir, taşınabilir ve yüksek kaliteli çıktı oluşturan bir yazıtipi düzeneğidir. Grafik kütüphaneleri, görüntü sunucuları ve yazıtipi değiştirme araçları gibi birçok üründe kullanılabilir. - mirrors://sourceforge/freetype/freetype-2.6.3.tar.bz2 - - zlib-devel - bzip2 - libpng-devel - - desktop/font/freetype/pspec.xml - - - freetype - - zlib - bzip2 - libpng - - - /usr/lib - /usr/share/doc - /usr/share/man - - - - freetype-devel - Development files for freetype - freetype için geliştirme dosyaları - - freetype - zlib-devel - libpng-devel - - - /usr/bin - /usr/include - /usr/lib/pkgconfig - /usr/lib32/pkgconfig - /usr/share/aclocal - - - - freetype-32bit - 32-bit shared libraries for freetype - freetype için 32-bit paylaşımlı kitaplıklar - emul32 - emul32 - - zlib-32bit - libpng-32bit - - - zlib-32bit - libpng-32bit - - - /usr/lib32 - - - - - 2016-04-27 - 2.6.3 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 2.6.3 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - busybox-mkinitcpio - http://www.busybox.net + slang + http://www.jedsoft.org/slang/ PisiLinux Community admins@pisilinux.org GPLv2 - app:console - system.boot - Statically linked binary providing simplified versions of system commands - Statik bağlanmış sistem komutları bütünü - busybox is a single binary which includes versions of a large number of system commands, including a shell. - busybox, kabuk da dahil olmak üzere çeşitli sistem komutlarını içeren tek bir çalıştırılabilir dosyadır. - http://busybox.net/downloads/busybox-1.24.1.tar.bz2 - - config - - - fix-include.patch - - system/boot/busybox-mkinitcpio/pspec.xml - - - busybox-mkinitcpio - - /usr/lib/initcpio/busybox - - - - - 2016-04-27 - 1.24.1 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-04-23 - 1.24.1 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - grub2 - http://www.gnu.org/software/grub/ - - Serdar Soytetir - kaptan@pisilinux.org - - GPLv3 - app:gui - system.boot - GNU GRUB is a Multiboot boot loader. - GNU GRUB (short for GNU GRand Unified Bootloader) is a boot loader package from the GNU Project. - ftp://alpha.gnu.org/gnu/grub/grub-2.02~beta2.tar.xz - http://source.pisilinux.org/1.0/grub2_extras_915resolution_r10.tar.xz - http://ftp.gnu.org/gnu/unifont/unifont-6.3.20131217/unifont-6.3.20131217.bdf.gz - https://sourceforge.net/projects/pisilinux/files/source/grub2-theme-pisilinux-0.4.tar.xz - - autogen - binutils - bison - flex - gcc - help2man - texinfo - freetype-devel - zlib-devel - ncurses-devel - xz-devel - fuse-devel - lvm2-devel - device-mapper-devel - gettext-devel - noto-fonts - - - mkconfig-fix.patch - pisi_name_and_initramfs.patch - - system/boot/grub2/pspec.xml - - - grub2 - - freetype - xz - fuse - lvm2 - device-mapper - mtools - os-prober - - - /usr/bin - /usr/sbin - /usr/lib/grub/i386-pc/ - /usr/lib/grub/x86_64-efi - /usr/share/doc - /usr/share/grub - /usr/share/info - /boot/grub2 - /usr/share/locale - /usr/share/man/man1 - /usr/share/man/man8 - /etc/bash_completion.d - /etc/grub.d - /etc/default - - - pisi-grub-bg.png - grub-defaults - 30_uefi-firmware - update-grub - - - - - 2016-08-21 - 2.02_beta2 - New theme - PisiLinux Community - admin@pisilinux.org - - - 2016-07-30 - 2.02_beta2 - Add windows 42_custom remove - PisiLinux Community - admin@pisilinux.org - - - 2016-07-12 - 2.02_beta2 - Add windows 42_custom - PisiLinux Community - admin@pisilinux.org - - - 2016-06-25 - 2.02_beta2 - Add efi - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 2.02_beta2 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-04-20 - 2.02_beta2 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - os-prober - http://joey.kitenet.net/code/os-prober/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2+ - app:console - system.boot - Utility to detect other OSes on a set of drives - Narzędzie do wykrywania innych systemów operacyjnych na dyskach - os-probe detects other OSes available on a system and outputs the results in a generic machine-readable format. Support for new OSes and Linux distributions can be added easily. - os-prober wykrywa inne systemy operacyjne dostępne na komputerze i przekazuje rezultaty w standardowym, odczytywalnym maszynowo, formacie. - http://http.debian.net/debian/pool/main/o/os-prober/os-prober_1.71.tar.xz - system/boot/os-prober/pspec.xml - - - os-prober - - /usr/bin - /usr/lib - /var/lib/os-prober - /usr/share/os-prober - /usr/share/doc/os-prober - - - - - 2016-04-27 - 1.71 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 1.71 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - wireless-tools - http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - system.base - A collection of tools to configure wireless lan cards - Kablosuz ağ kartlarını yapılandırmak için kullanılan bir araç seti - Les outils sans fil (Wireless Tools ou WT) est un ensemble d'outils permettant de manipuler les extensions sans fil, c'est une interface de programmation d'application (API) générique permettant à un pilote d'exposer à l'espace utilisateur la configuration ainsi que des statistiques spécifiques aux LANs sans fil communs. Ils utilisent une interface textuelle assez rugueuse, mais ont pour objectif de couvrir la totalité de l'extension sans fil. - The Wireless Tools (WT) is a set of tools allowing to manipulate the Wireless Extensions, a generic application programming interface allowing a driver to expose to the user space configuration and statistics specific to common Wireless LANs. They use a textual interface and are rather crude, but aim to support the full Wireless Extension. - Wireless Extensions, sürücülerin bilinen kablosuz ağların ayarlarını yapmak ve istatistiklerini görüntülemek amacıyla kullandığı bir yazılım programlama arayüzüdür. Wireless Tools ise Wireless Extensions ayarlarını modifiye etmek için kullanılan araçları içeren bir pakettir. Grafik arayüzü bulunmaz, biraz da kabadır; ancak Wireless Extension'u tam olarak desteklemeyi hedefler. - http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/wireless_tools.30.pre9.tar.gz - - no-ldconfig.patch - wireless_tools.27-wireless-man-upd.patch - wireless-tools-29-makefile.patch - - system/base/wireless-tools/pspec.xml - - - wireless-tools - - comar - - - /sbin - /usr/lib - /usr/share/man - /usr/share/doc - - - - wireless-tools-devel - Development files for wireless-tools - wireless-tools için geliştirme dosyaları - system.devel - - wireless-tools - - - /usr/include - /usr/share/man/man3 - - - - - 2016-04-27 - 30 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-04 - 30 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - perl - http://www.perl.org/ - - PisiLinux Community - admins@pisilinux.org - Artistic - GPLv2 app:console - system.base - Larry Wall's Practical Extraction and Reporting Language - Perl dili - Perl est un langage de programmation multi-plateforme stable. - Perl is a high-level programming language with roots in C, sed, awk and shell scripting. Perl is good at handling processes and files, and is especially good at handling text. Perl's hallmarks are practicality and efficiency. While it is used to do a lot of different things, Perl's most common applications are system administration utilities and web programming. A large proportion of the CGI scripts on the web are written in Perl. You need the perl package installed on your system so that your system can handle Perl scripts. - Perl kararlı, platform bağımsız programlama dilidir. - Perl ist eine stabile, plattformunabhängige Programmiersprache - http://www.cpan.org/src/5.0/perl-5.24.0.tar.bz2 + programming.library + Console display library used by most text viewer + Bir çok metin gösterici yazılım tarfından kullanılan konsol görüntüleme kütüphanesi + S-Lang est une librarie de programmation multi-plateforme conçue pour permettre aux développeur de développer des logiciels robustes et portables. Elle fournit les mécanismes requis pour développer une application interactive telle que la gestion d'affichages/écrans, entrées clavier, disposition de touches et ainsi de suite. La fonctionnalité la plus attractive de cette librairie reste l'interpréteur slang qui peut être embarqué au sein même d'un programme pour le rendre extensible. + S-Lang is a multi-platform programmer's library designed to allow a developer to create robust multi-platform software. It provides facilities required by interactive applications such as display/screen management, keyboard input, keymaps, and so on. The most exciting feature of the library is the slang interpreter that may be easily embedded into a program to make it extensible. + S-lang, yazılım geliştiricilerin bütün işletim sistemlerinde çalışabilen güçlü uygulamalar geliştirmesine yardımcı olan bir uygulama kitaplığıdır. İnteraktif uygulamalar için ekran yönetimi ve klavye girişi gibi araçlar sunar. Kitaplığın en ilginç özelliği programların içine kolayca gömülebilen ve programı genişletilebilir kılan slang yorumlayıcısıdır. + ftp://ftp.ntua.gr/pub/lang/slang/slang/v2.2/slang-2.2.4.tar.bz2 - db-devel - gdbm-devel + libpng-devel + libpcre-devel + ncurses-devel + readline-devel zlib-devel - system/base/perl/pspec.xml + programming/library/slang/pspec.xml - perl-docs - Documentation files for perl - programming.language.perl - - /usr/share/doc/html - /usr/share/doc/perl/html - /usr/share/man/ - - - - perl + slang - db - gdbm + libpng + libpcre zlib + /etc /usr/bin + /usr/share/slsh /usr/lib - /usr/share/doc - - - Turkish.pm - - - - - 2017-01-21 - 5.24.0 - Vesion Bump - Ayhan Yalçınsoy - ayhanyalcinsoy@pisilinux.org - - - 2016-04-27 - 5.22.1 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-01 - 5.22.1 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - libunistring - http://www.gnu.org/software/libunistring - - PisiLinux Community - admins@pisilinux.org - - GPLv3 - LGPLv3 - library - system.base - Unicode string library - Unicode karakter dizisi kitaplığı - This library provides functions for manipulating Unicode strings and for manipulating C strings according to the Unicode standard. - Bu kitaplığı unicode standartına göre unicode ve C karakter dizilerinde değişiklik yapmak için kullanılabilecek fonksiyonlar sunar. - mirrors://gnu/libunistring/libunistring-0.9.7.tar.gz - system/base/libunistring/pspec.xml - - - libunistring - - /usr/lib - /usr/share/doc - /usr/share/info - - - - libunistring-devel - Development files for libunistring - libunistring için geliştirme dosyaları - system.devel - - libunistring - - - /usr/include - - - - - 2017-01-08 - 0.9.7 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 0.9.6 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-08 - 0.9.6 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - mudur - http://www.pisilinux.org - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - system.base - Pisi Linux boot and initialization system - Pisi Linux açılış sistemi - Gère le montage de systèmes de fichier, le chargement de pilotes de périphérique, le démarrage des services système et d'autres tâches pendant les séquences de démarrage et d'arrêt de Pisi Linux. - mudur handles mounting of the filesystems, loading of the device drivers, starting of the system services, and other jobs during the Pisi Linux boot and shutdown sequences. - Pisi Linux açılış ve kapanışı sırasında, dosya sistemlerinin bağlanması, donanım sürücülerinin yüklenmesi, servislerin başlatılması gibi işleri yürütür. - http://source.pisilinux.org/1.0/mudur-4.4.0.tar.xz - - set_file_mode.patch - no_err-no_msg.patch - recreate_dir_if_new_uid_or_gid.patch - boot_option.patch - mount_cgroupfs.patch - - system/base/mudur/pspec.xml - - - mudur - - kbd - bash - dbus - kmod - eudev - comar - procps - python - rsyslog - sysvinit - coreutils - e2fsprogs - net-tools - baselayout - util-linux - wireless-tools - pisilinux-python - - - /etc/conf.d - /etc/mudur/services - /etc/init.d - /sbin - /bin - /usr/share/locale - - - System.PackageHandler - System.Service - System.Package - System.Settings - Disk.Manager - - - - - 2016-04-27 - 4.4.0 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-11 - 4.4.0 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - nspr - http://www.mozilla.org/projects/nspr/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - library - system.base - Netscape Portable Runtime - Netscape Taşınabilir Çalışma Zamanı - Netscape Portable Runtime (NSPR -- Exécutable Portable Netscape) fourni une API neutre au sens de la plate-forme pour les fonctions de niveau système ou de type libc. Cette API est utilisée au sein du client Mozilla ainsi que de nombreuses solutions logicielles de Netscape/AOL/iPlanet. - Netscape Portable Runtime (NSPR) provides a platform-neutral API for system level and libc like functions. The API is used in the Mozilla client, many of Netscape/AOL/iPlanet's and other software offerings. - Netscape Taşınabilir çalışma Zamanı (NSPR) sistem seviyesindeki libc ve benzeri fonksiyonlar için platform bağımsız bir programlama arayüzü sunar. Bu arayüz, Mozilla istemcilerinde, Netscape/AOL/iPlanet'in diğer yazılımlarında kullanılmaktadır. - Netscape Portable Runtime (NSPR) provee un API independiente de la plataforma a nivel de sistema y funciones como libc. El API está usado en el cliente Mozilla, y muchos otros software de Netscape/AOL/iPlanet. - https://ftp.mozilla.org/pub/nspr/releases/v4.12/src/nspr-4.12.tar.gz - - nspr.pc.in - generate-pc-config.sh - - system/base/nspr/pspec.xml - - - nspr - - /usr/lib - - - - nspr-devel - Development files for nspr - nspr için geliştirme dosyaları - system.devel - - nspr - - - /usr/include - /usr/lib/pkgconfig - /usr/bin - - - - - 2016-04-27 - 4.12 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-06 - 4.12 - First release - Ayhan Yalçınsoy - ayhanyalcinsoy@pisilinux.org - - - - - - sysfsutils - http://linux-diag.sourceforge.net/Sysfsutils.html - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - system.base - System Utilities Based on Sysfs - Çeşitli sistem araç ve gereçleri - Ceci est un ensemble d'utilitaires se basant sur sysfsm un nouveau système de fichier virtuel des noyaux Linux 2.5 et + exposant l'arbre des périphériques du système. - These are a set of utilites built upon sysfs, a new virtual filesystem in Linux kernel versions 2.5+ that exposes a system's device tree. - sysfsutils sysfs sanal dosya sistemi üzerine kurulu bir araç setidir. - mirrors://sourceforge/linux-diag/sysfsutils-2.1.0.tar.gz - - sysfsutils-2.0.0-class-dup.patch - sysfsutils-2.1.0-get_link.patch - - system/base/sysfsutils/pspec.xml - - - sysfsutils - - /usr/bin - /lib - /usr/lib - /usr/share/doc + /usr/share/doc/slang /usr/share/man - sysfsutils-devel - Development files for sysfsutils - sysfsutils için geliştirme dosyaları + slang-devel + Development files for slang + slang için geliştirme dosyaları system.devel - sysfsutils + slang /usr/include + /usr/lib/pkgconfig + /usr/share/doc/slang/html /usr/share/man/man3 2016-04-27 - 2.1.0 + 2.2.4 Release Bump PisiLinux Community admin@pisilinux.org - 2016-03-06 - 2.1.0 + 2014-05-11 + 2.2.4 First release - Alihan Öztürk - alihan@pisilinux.org + Marcin Bojara + marcin@pisilinux.org @@ -1604,50 +893,54 @@ - libestr - http://libestr.adiscon.com + ca-certificates + http://packages.qa.debian.org/c/ca-certificates.html - Marcin Bojara - marcin@pisilinux.org + PisiLinux Community + admins@pisilinux.org - LGPLv2.1 - library + GPLv2 + MPL-1.1 + app:web system.base - Library for some string essentials - libestr - some essentials for string handling (and a bit more) - http://libestr.adiscon.com/files/download/libestr-0.1.10.tar.gz - system/base/libestr/pspec.xml + Common CA certificates + Common CA certificates + http://ftp.debian.org/debian/pool/main/c/ca-certificates/ca-certificates_20161130.tar.xz + system/base/ca-certificates/pspec.xml - libestr - - /usr/lib/libestr.so* - /usr/share/doc/libestr - - - - libestr-devel - Development files for libestr - system.devel + ca-certificates - libestr + run-parts - /usr/include/libestr.h - /usr/lib/pkgconfig/libestr.pc + /etc + /usr/share/man + /usr/sbin + /usr/share/ca-certificates + + System.Package + + + 2017-01-08 + 20160130 + Version Bump + PisiLinux Community + admin@pisilinux.org + 2016-04-27 - 0.1.10 + 20160104 Release Bump PisiLinux Community admin@pisilinux.org - 2016-03-08 - 0.1.10 + 2016-03-03 + 20160104 First release Alihan Öztürk alihan@pisilinux.org @@ -1670,7 +963,7 @@ Un client daemon DHCP conforme aux RFC2131 et RFC1541. dhcpcd obtient une adresse IP ainsi que d'autres informations depuis le serveur DHCP correspondant, configure l'interface réseau automatiquement et essaie de renouveler le bail selont les RFC2131 et EFC1541 en fonction des options de la ligne de commande. An RFC2131 and RFC1541 compliant DHCP client daemon. dhcpcd gets an IP address and other information from a corresponding DHCP server, configures the network interface automatically, and tries to renew the lease time according to RFC2131 or RFC1541 depending on the command line option. RFC2131 ve RFC1541 uyumlu bir DHCP istemci servisi.dhcpcd ilgili bir DHCP sunucusundan bir IP adresi ve gerekli diğer bilgileri alır, ağ arayüzünü otomatik olarak yapılandırır ve RFC2131 veya RFC1541 komut satırı özelliğine bağlı olarak kiralama zamanını yenilemeyi dener. - http://ftp.osuosl.org/pub/blfs/conglomeration/dhcpcd/dhcpcd-6.10.1.tar.xz + http://ftp.osuosl.org/pub/blfs/conglomeration/dhcpcd/dhcpcd-6.11.5.tar.xz system/base/dhcpcd/pspec.xml @@ -1687,6 +980,13 @@ + + 2017-01-29 + 6.11.5 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + 2016-04-27 6.10.1 @@ -1705,132 +1005,65 @@ - spidermonkey - http://www.mozilla.org/js/spidermonkey/ + bc + http://www.gnu.org/software/bc PisiLinux Community admins@pisilinux.org - NPL-1.1 - library + GPLv2 + app:console system.base - Stand-alone JavaScript C Library - Javascript C Kitaplığı - Spidermonkey est l'Implémentation C de Javascript par Mozilla. - Spidermonkey is Mozilla's C implementation of JavaScript. - Mozilla'nın Javascript'in C implementasyonu. - Spidermonkey es la implementación de JavaScript con C de Mozilla. - http://ftp.mozilla.org/pub/mozilla.org/js/mozjs17.0.0.tar.gz + Console-based calculator utility + Konsol temelli hesap makinesi + bc est un langage de calcul numérique à précision arbitraire qui peut être utilisé comme calculatrice. La syntaxe est similaire au C, avec quelques différences notables. Il supporte par exemple l'exécution interactive de commandes. + bc is an arbitrary precision numeric processing language and can be used as a calculator. Syntax is similar to C, but differs in many substantial areas. For example, it supports interactive execution of statements. + bc, herhangi bir keskinlikte sayısal işlemler yapmayı sağlayan bir programlama dilidir ve bir hesap makinesi olarak kullanılabilir. Sözdizimi C programlama diline benzer, ancak C'den birçok önemli farkları vardır. Örneğin, ifadelerin etkileşimli bir şekilde çalışmasına olanak tanır. + ftp://alpha.gnu.org/gnu/bc/bc-1.06.95.tar.bz2 - zlib-devel - nspr-devel + flex + texinfo readline-devel - libffi-devel - system/base/spidermonkey/pspec.xml + + fedora/bc-1.06.95-memleak.patch + fedora/bc-1.06-dc_ibase.patch + fedora/bc-1.06.95-matlib.patch + fedora/bc-1.06.95-sigintmasking.patch + fedora/bc-1.06.95-doc.patch + + system/base/bc/pspec.xml - spidermonkey + bc - nspr - zlib - libgcc readline /usr/bin - /usr/lib - /usr/share/doc - - - - spidermonkey-devel - Development files for spidermonkey - spidermonkey için geliştirme dosyaları - system.devel - - spidermonkey - nspr-devel - - - /usr/include - /usr/lib/pkgconfig - /usr/bin/js17-config - - - - - 2016-04-27 - 17.0.0 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-06 - 17.0.0 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - bzip2 - http://www.bzip.org/ - - PisiLinux Community - admins@pisilinux.org - - BZIP2 - app:console - system.base - A high-quality data compressor - Yüksek kaliteli bir veri sıkıştırma uygulaması - bzip2 est un compresseur de données de très grand qualité. Il compresse typiquement les fichiers à un ratio entre 10 et 15% des meilleurs techniques disponibles (la famille des compresseurs statistiques de famille PPM) tout en étant environ deux fois plus rapide à la compression et six fois plus rapide à la décompression. - bzip2 is high-quality data compressor. It typically compresses files to within 10% to 15% of the best available techniques (the PPM family of statistical compressors), whilst being around twice as fast at compression and six times faster at decompression. - bzip2 yüksek kaliteli bir veri sıkıştırma programıdır. Program genellikle dosyaları mümkün olan en iyi teknikler ile (PPM istatistiksel sıkıştırıcı ailesi) %10 - %15'e kadar sıkışıtırabilmektedir. Sıkıştırma işleminde iki kata kadar hızlı iken açma hızında yaklaşık altı kat daha hızlıdır. - bzip2 ist ein hochwertiger Daten-Kompressor. Es komprimiert Dateien üblicherweise auf 10% bis 15% der bestmöglichen Techniken (die PPM Familie der statistischen Kompressoren), während es ungefähr doppelt so schnell komprimiert und sechsfach schneller extrahiert - http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz - - bzip2-1.0.2-progress.patch - bzip2-1.0.4-bzip2recover.patch - bzip2-1.0.4-man-links.patch - bzip2-1.0.6-saneso.patch - manpath.patch - - system/base/bzip2/pspec.xml - - - bzip2 - - /bin - /lib - /usr/lib /usr/share/doc /usr/share/man - /usr/include + /usr/share/info - 2017-01-07 - 1.0.6 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com + 2017-01-27 + 1.06.95 + Release Bump + PisiLinux Community + admin@pisilinux.org 2016-04-27 - 1.0.6 + 1.06.95 Release Bump PisiLinux Community admin@pisilinux.org - 2016-02-28 - 1.0.6 + 2016-03-05 + 1.06.95 First release Ertuğrul Erata ertugrulerata@gmail.com @@ -1839,568 +1072,7 @@ - polkit - http://www.freedesktop.org/wiki/Software/PolicyKit - - PisiLinux Community - admins@pisilinux.org - - LGPLv2+ - service - library - app:console - system.base - PolicyKit Authorization Framework - Sistem bileşenleri için erişim politikası servisi - polkit est un cadre de développement (framework) pour définir des politiques à appliquer à des composants du système ainsi que fournir à des parties du bureau la possibilité de les configurer. - polkit is a toolkit for defining and handling authorizations. It is used for allowing unprivileged processes to speak to privileged processes. - polkit, sistem genelindeki bileşenlerin ve masaüstü bileşenlerinin ayarlayabileceği şekilde ilkeler tanımlamak için araçlardan oluşur. - http://www.freedesktop.org/software/polkit/releases/polkit-0.113.tar.gz - - dbus-devel - pam-devel - glib2-devel - expat-devel - spidermonkey-devel - gobject-introspection-devel - intltool - - - use-system-locale-in-gobject-api.diff - - system/base/polkit/pspec.xml - - - polkit-devel - Development headers for polkit - polkit geliştirme başlıkları - system.devel - - polkit - glib2-devel - - - /usr/include - /usr/lib/pkgconfig - - - - polkit - - pam - glib2 - expat - spidermonkey - - - /etc - /usr/lib - /usr/libexec - /usr/bin - /usr/sbin - /usr/share/locale - /usr/share/polkit-1 - /usr/share/dbus-1 - /usr/share/gir-1.0 - /var/lib/polkit-1 - /lib/systemd - /usr/share/man - /usr/share/doc - - - man/pklocalauthority.8 - man/polkit.8 - man/polkitd.8 - man/pkaction.1 - man/pkcheck.1 - man/pkexec.1 - 70-desktop-policy.conf - - - - - 2016-04-27 - 0.113 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-09 - 0.113 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - pisi - http://www.pisilinux.org/ - - Marcin Bojara - marcin@pisilinux.org - - GPLv2 - app:console - system.base - PISI is the package management system of Pisi Linux - PİSİ PiSi Linux'un paket yönetim sistemidir - PiSi – menadżer pakietów dla PiSi Linux. - PISI est gestionnaire de paquets moderne implémenté en Python.Ces principales fonctionnalités sont les suivantes : - Les paquets sources sont écrits en XML et en python - Implemente tout les fonctions à travers une API simple d'utilisation - Intègre aussi bien les fonctionnalités de bas niveaux que de haut niveau de gestion de paquets. - PISI is a modern package management system implemented in Python. Some of its main features are: package sources are written in XML and python, implements all functions through a simple-to-use API, integrates low-level and high-level package management features. - PİSİ Python'da yazılmış modern bir paket yöneticisidir. Bazı ana özellikleri: Paket kaynakları XML ve python kullanılarak yazılır, bütün işlevleri kullanması kolay bir API ile sağlar ve düşük ve yüksek seviyeli paket yönetim işlevlerini birleştirir. - PISI jest podstawowym narzędziem do instalacji, aktualizacji i usuwania pakietów. Obsługuje zależności dla poszczególnych pakietów, bibliotek i zadań ÇOMAR-a. Instalacja oprogramowania odbywa się w łatwy i przyjazny sposób. Do przechowywania informacji o pakietach wykorzystuje bazę Berkeley DP, co zapewnia większą stabilność i szybkość. - http://source.pisilinux.org/1.0/pisi-2.6.tar.xz - - pisi.conf-i686 - pisi.conf-x86_64 - - - comar - plyvel - python - gettext - libunwind-devel - intltool - leveldb-devel - - - initialize_filesdb_once.patch - no_clean_if_ignore_comar.patch - orphaned_pkgs.patch - improve_pisi_ix.patch - fix_emul32_flags.patch - pisi-2.6-pisitools.dopixmaps-add.patch - emergeup.patch - fetch.patch - - system/base/pisi/pspec.xml - - - pisi - - tar - file - comar - plyvel - python - gettext - leveldb - piksemel - comar-api - urlgrabber - python-psutil - libunwind - python-pyliblzma - mudur - - - /usr/bin - /usr/sbin - /usr/lib/pardus/pisi - /usr/lib/pisilinux/pisi - /usr/share/locale - /usr/share/doc - /etc/pisi - /usr/share/mime/packages - /usr/lib/tmpfiles.d/pisi.conf - /run/lock/files.ldb/LOCK - /var/lib/pisi/info/files.ldb/LOCK - - - System.Package - System.Manager - - - mirrors.conf - sandbox.conf - pisi.xml - pkgconfig.py - tmpfiles.conf - qt5.py - kde5.py - - - - - 2017-01-22 - 2.6 - Rebuild with new toolchain. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-08-03 - 2.6 - add parameters - PisiLinux Community - admin@pisilinux.org - - - 2016-06-07 - 2.6 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 2.6 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-04-17 - 2.6 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - xz - http://tukaani.org/xz/ - - PisiLinux Community - admins@pisilinux.org - - LGPLv2+ - GPLv2+ - GPLv3 - app:console - library - system.base - XZ compression utilities - XZ sıkıştırma araçları - XZ Utils provide a general purpose data compression library and command line tools. The .xz format supports multiple compression algorithms, which are called "filters" in context of XZ Utils. The primary filter is currently LZMA2. - xz, genel amaçlı bir veri sıkıştırma kütüphanesi ve konut satırı araçları içerir. xz dosya biçimi filtre adı verilen sıkıştırma algoritmalarını destekler, öntanımlı filtre ise LZMA2 algoritmasıdır. - http://tukaani.org/xz/xz-5.2.3.tar.xz - system/base/xz/pspec.xml - - - xz - - /usr/bin - /usr/lib - /usr/share/man - /usr/share/doc - /usr/share/locale - - - - xz-devel - Development files for XZ - XZ için geliştirme dosyaları - system.devel - - xz - - - /usr/include - /usr/lib/pkgconfig - /usr/lib32/pkgconfig - - - - xz-32bit - 32bit shared libraries for xz - XZ için 32-bit paylaşımlı kitaplıklar - emul32 - emul32 - - xz - - - /usr/lib32 - - - - - 2017-01-07 - 5.2.3 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 5.2.2 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-02-28 - 5.2.2 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - comar-api - http://www.pisilinux.org - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - library - system.base - Utility functions for Comar scripts - Çomar betikleri için yardımcı fonksiyonlar - Librairie utilitaire générique pour les opérations communes de scripts Comar. - Generic utility library for common Comar script operations. - Çomar betiklerinde sıkça yapılan ortak işlemler için yardımcı fonksiyonlar kitaplığı. - http://source.pisilinux.org/1.0/comar-api-2.4.9.tar.gz - - python - - - run_dir.patch - pisilinux.patch - add-stopdependencies.patch - - system/base/comar-api/pspec.xml - - - comar-api - - python - pisilinux-python - - - /usr/lib/pisilinux - /usr/lib/python2.7 - - - - - 2016-04-27 - 2.4.9 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-11 - 2.4.9 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - libpipeline - http://libpipeline.nongnu.org - - PisiLinux Community - admins@pisilinux.org - - GPLv3+ - library - system.base - pipeline manipulation library - pipeline yönetim kitaplığı - libpipeline is a C library for manipulating pipelines of subprocesses in a flexible and convenient way. - libpipeline, alt-süreç girdi/çıktı hatlarını (pipeline) yönetmek için geliştirilmiş bir C kitaplığıdır. - http://download.savannah.gnu.org/releases/libpipeline/libpipeline-1.4.1.tar.gz - system/base/libpipeline/pspec.xml - - - libpipeline - - /usr/lib - /usr/share/doc - - - - libpipeline-devel - Development files for libpipeline - libpipeline için geliştirme dosyaları - system.devel - - libpipeline - - - /usr/include - /usr/lib/pkgconfig - /usr/share/man - - - - - 2017-01-24 - 1.4.1 - Rebuild. - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 1.4.1 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-08 - 1.4.1 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - vixie-cron - http://www.gentoo.org/ - - PisiLinux Community - admins@pisilinux.org - - as-is - service - system.base - Paul Vixie's cron daemon, a fully featured crond implementation - Tam teşekküllü bir crond uyarlaması - Vixie cron (Cron est un daemon qui lance des tâches planifiées) est une implémentation riche basée sur le cron SysV. Chaque utilisateur possède sa propre table de planification (ou crontab - la CRON TABle de Crontab) est un fichier qui contient le planning de cron) et a la possibilité de spécifier des variables d'environnement au sein de la table. - Vixie cron (Cron is a daemon that runs scheduled tasks.) is a full featured cron implementation based on SysV cron. Each user has his own crontab ( Crontab (CRON TABle) is a file which contains the schedule of cron) and is allowed to specify environment variables within that crontab. - Vixie-cron (cron, zamanlanmış görevleri çalıştıran dinleyici programdır.) SysV cron tabanlı tam sürüm cron uygulamasıdır. Her kullanıcı kendi crontab 'ına (crontab cron listesini içeren dosyadır.) sahiptir ve bu crontab içinde ortam değişkenlerini yazmasına müsade edilmiştir. - http://ftp.linux.org.tr/gentoo/distfiles/vixie-cron-4.1.tar.bz2 - - sed - pam-devel - - - vixie-cron-4.1-gentoo-r4.patch.bz2 - crontab.5.diff - vixie-cron-4.1-commandline.patch - vixie-cron-4.1-pam.patch - vixie-cron-4.1-CAN-2005-1038.patch - CVE-2006-2607.patch - CVE-2007-1856.patch - - system/base/vixie-cron/pspec.xml - - - vixie-cron - - pam - comar-api - - - /usr/sbin - /usr/bin - /etc - /var/spool - /usr/share/doc - /usr/share/man - - - System.Package - System.Service - - - run-crons-0.3.1 - crontab - vixie-cron-4.1-cron.deny - cron.pam.d - - - - - 2016-04-27 - 4.1 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-11 - 4.1 - First release - Kamil Atlı - suvari@pisilinux.org - - - - - - less - http://www.greenwoodsoftware.com/ - - PisiLinux Community - admins@pisilinux.org - - GPLv3 - app:console - system.base - Excellent lecteur de fichier texte - Excellent text file viewer - Mükemmel bir metin görüntüleyici - Ausgezeichneter Textbetrachter - The less utility is a text file browser that resembles more, but has more capabilities. Less allows you to move backwards in the file as well as forwards. Since less doesn't have to read the entire input file before it starts, less starts up more quickly than text editors (for example, vi). - http://www.greenwoodsoftware.com/less/less-481.tar.gz - - ncurses-devel - - system/base/less/pspec.xml - - - less - - ncurses - - - /etc/env.d - /usr/bin - /usr/share/doc - /usr/share/man - - - lesspipe.sh - 70less - code2color - - - - - 2017-01-23 - 481 - Rebuild. - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 481 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-02-29 - 481 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - dbus-python + dbus http://dbus.freedesktop.org/ PisiLinux Community @@ -2408,74 +1080,477 @@ GPLv2 AFL-2.1 - library + service system.base - D-Bus Python bindings - D-Bus için Python bağlayıcıları - dbus-python provides a Python module which wraps the D-Bus programming API. - https://dbus.freedesktop.org/releases/dbus-python/dbus-python-1.2.4.tar.gz + A message bus system, a simple way for applications to talk to each other + Uygulamaların birbirleriyle haberleşmesinin basit bir yöntemi + D-Bus fourni à la fois un daemon système (pour les événements els que l'"ajout d'un nouveau périphérique" ou "file d'impression changée") et un daemon propre à chaque session utilisateur (pour les besoins généraux de communication entre processus utilisateurs). De plus, le bus de message est construit en se basant sur un framework (cadre de développement) de passage de message de un-vers-un pouvant être utilisé par n'importe quelles applications pour communiquer directement (sans passer par le daemon de bus de message). Pour l'instant les applications pouvant communiquer doivent être situées sur le même ordinateur, mais l'option TCP/IP est disponible et le support de processus distant est prévu. + D-Bus supplies both a system daemon (for events such as "new hardware device added" or "printer queue changed") and a per-user-login-session daemon (for general IPC needs among user applications). Also, the message bus is built on top of a general one-to-one message passing framework, which can be used by any two apps to communicate directly (without going through the message bus daemon). Currently the communicating applications are on one computer, but TCP/IP option is available and remote support planned. + D-Bus, sistem ve kullanıcılar için olmak üzere iki tane artalan süreci (daemon) sunar. Mesaj yolu, bire bir mesaj geçiş araçları üzerine inşa edilmiştir. Bu sayede iki program birbiriyle bir mesaj yolu artalan süreci kullanmadan, direkt olarak haberleşebilir. Şu an için haberleşme araçları aynı bilgisayar üzerinde çalışabilmektedir, fakat TCP/IP ile uzaktan haberleşme de planlanmaktadır. + https://dbus.freedesktop.org/releases/dbus/dbus-1.11.8.tar.gz - python-devel - dbus-devel - dbus-glib-devel - glib2-devel - libpcre-devel + expat-devel + libX11-devel + libcap-ng-devel + autoconf-archive - - suppress-warnings.patch - - system/base/dbus-python/pspec.xml + system/base/dbus/pspec.xml - dbus-python-common - Common dbus-python files shared between dbus-python and dbus-python3 + dbus + + expat + libcap-ng + + + /etc/dbus-1 + /usr/lib/tmpfiles.d/dbus.conf + /usr/bin + /usr/lib + /usr/libexec + /usr/share/dbus-1 + /usr/share/doc + /usr/share/man + /usr/share/xml + /run/dbus + /var/lib/dbus + /lib/systemd/system + + + System.Package + + + tmpfiles.conf + + + + dbus-x11 + x11.util + + libX11 + dbus + + + /usr/bin/dbus-launch + + + + dbus-devel + Development files for dbus + dbus için geliştirme dosyaları system.devel - dbus-devel - dbus-python + dbus /usr/include /usr/lib/pkgconfig - /usr/share/doc + /usr/lib32/pkgconfig + /usr/lib/dbus-1.0/include + /usr/share/man/man3 - dbus-python - - python - dbus - glib2 - dbus-glib - + dbus-32bit + 32-bit shared libraries for dbus + dbus için 32-bit paylaşımlı kitaplıklar + emul32 + emul32 + + expat-32bit + - /usr/lib/python2* + /usr/lib32 - - 2017-01-26 - 1.2.4 - Rebuild. + + 2017-01-25 + 1.11.8 + Version Bump Ertuğrul Erata ertugrulerata@gmail.com + + 2016-09-14 + 1.11.0 + Release Bump + Ergün Salman + poyraz76@pisilinux.org + + + 2016-09-14 + 1.11.0 + Fix Release + Ergün Salman + poyraz76@pisilinux.org + 2016-04-27 - 1.2.4 + 1.11.0 Release Bump PisiLinux Community admin@pisilinux.org - 2016-03-10 - 1.2.4 + 2016-03-04 + 1.11.0 + First release + Hakan Yıldız + hknuldz93@gmail.com + + + + + + libgcrypt + http://www.gnupg.org/ + + PisiLinux Community + admins@pisilinux.org + + LGPLv2.1 + library + system.base + Librairie générale de cryptographie basée sur le code utilisé dans GnuPG. + General purpose crypto library + Genel amaçlı bir şifreleme kitaplığı + Libgcrypt is a general purpose crypto library based on the code used in GNU Privacy Guard. + Libgcrypt, GNU Privacy Guard kodunu temel alan genel amaçlı bir şifreleme kitaplığıdır. + http://gd.tuwien.ac.at/pub/gnupg/libgcrypt/libgcrypt-1.7.6.tar.bz2 + + libgpg-error-devel + + system/base/libgcrypt/pspec.xml + + + libgcrypt + + libgpg-error + + + /usr/lib + /usr/share/man + /usr/share/doc + /etc/gcrypt + /usr/bin + /usr/share/info + + + + libgcrypt-devel + Development files for libgcrypt + libgcrypt için geliştirme dosyaları + system.devel + + libgcrypt + libgpg-error-devel + + + /usr/include + /usr/lib/pkgconfig + /usr/share/aclocal + /usr/lib32/pkgconfig + /usr/bin/*-config + + + + libgcrypt-32bit + 32-bit shared libraries for libgcrypt + libgcrypt için 32-bit paylaşımlı kitaplıklar + emul32 + emul32 + + libgpg-error-32bit + + + libgpg-error-32bit + libgcrypt + + + /usr/lib32 + + + + + 2017-01-24 + 1.7.6 + Version bump.. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-12-24 + 1.7.5 + Version bump. + Stefan Gronewold + groni@pisilinux.org + + + 2016-04-27 + 1.6.5 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-08 + 1.6.5 First release Alihan Öztürk alihan@pisilinux.org + + + findutils + http://www.gnu.org/software/findutils/findutils.html + + PisiLinux Community + admins@pisilinux.org + + GPLv3+ + app:console + system.base + GNU utilities to find files + Dosya bulmak için kullanılan GNU uygulamaları + Les utilitaires de recherche GNU sont les utilitaire de recherche de répertoire basique du système d'exploitation GNU. Ces programmes sont typiquement associés à d'autres programmes pour leur fournir une capacité de recherche de fichier et de répertoire puissante et modulaire à d'autres commandes. + The GNU Find Utilities are the basic directory searching utilities of the GNU operating system. These programs are typically used in conjunction with other programs to provide modular and powerful directory search and file locating capabilities to other commands. + GNU Find Utilities GNU işletim sisteminin temel dizin arama uygulamalarıdır. Bu uygulamalar diğer komutlara başka programlar ile birlikte çalışarak modüler ve güçlü dizin ve dosya arama yetenekleri sunar. + http://ftp.gnu.org/pub/gnu/findutils/findutils-4.6.0.tar.gz + + gettext + texinfo + + system/base/findutils/pspec.xml + + + findutils + + /usr/bin + /usr/lib/find + /usr/libexec + /usr/share/doc + /usr/share/man + /usr/share/info + /usr/share/locale + /var + + + + + 2017-01-23 + 4.6.0 + Rebuild.. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 4.6.0 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-02-28 + 4.6.0 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + lzo + http://www.oberhumer.com/opensource/lzo/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + library + system.base + An extremely fast compression and decompression library + Çok hızlı bir sıkıştırma/açma kütüphanesi + lzo is a library with very high compression and decompression speeds and very small memory usage. Provides low compression ratios but very high speeds. + lzo hızlı bir sıkıştırma/açma kütüphanesidir. Düşük sıkıştırma oranları verir fakat hem sıkıştırma hem açma işleminde bellek kullanımı çok düşüktür ve işlem hızı yüksektir. + http://www.oberhumer.com/opensource/lzo/download/lzo-2.09.tar.gz + system/base/lzo/pspec.xml + + + lzo + + /usr/lib + /usr/share/doc + + + + lzo-devel + Development files for lzo + lzo için geliştirme dosyaları + + lzo + + + /usr/include + + + + lzo-32bit + 32-bit shared libraries for lzo + emul32 + emul32 + + /usr/lib32 + + + + + 2017-01-21 + 2.09 + Rebuild with new toolchain. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 2.09 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-09 + 2.09 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + file + http://www.darwinsys.com/file/ + + PisiLinux Community + admins@pisilinux.org + + as-is + app:console + system.base + Program to identify a file's format by scanning binary data for patterns + Dosya tipini belirlemek için kullanılan bir uygulamadır + Programme servant à identifiant le format d'un fichier en analysant les données binaires en cherchant des patrons connus. + Program to identify a file's format by scanning binary data for patterns. + İkili veri taraması kullanarak (dosya uzantısına bakmadan) dosya biçimini tanımlamaya yarayan bir uygulamadır. + ftp://ftp.astron.com/pub/file/file-5.29.tar.gz + + zlib-devel + python-setuptools + + system/base/file/pspec.xml + + + file + + zlib + python + + + /usr/bin + /usr/lib + /usr/share/doc + /usr/share/man + /usr/share/misc + /usr/include + + + + + 2017-01-08 + 5.29 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 5.25 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-02-28 + 5.25 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + perl-Locale-gettext + http://search.cpan.org/dist/gettext + + PisiLinux Community + admins@pisilinux.org + + Artistic + library + system.base + A Perl module for accessing the GNU locale utilities + GNU yerel araçlarına erişim için Perl modülü + The gettext module permits access from Perl to the gettext() family of functions for retrieving message strings from databases constructed to internationalize software. + Bu modül, çoklu dil desteğini sağlayan gettext() ailesine Perl üzerinden erişimi sağlar. + El módulo gettext permite Perl acceder a la familia de funciones gettext() para obtener cadenas de mensajes (traducidos) desde bases de datos para la internacionalización de software. + http://search.cpan.org/CPAN/authors/id/P/PV/PVANDRY/gettext-1.07.tar.gz + + perl + + system/base/perl-Locale-gettext/pspec.xml + + + perl-Locale-gettext + + perl + + + /usr/lib + /usr/share/perl + /usr/share/doc + /usr/share/man + + + + + 2017-01-24 + 1.07 + Rebuild for new toolchain + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 1.07 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-03 + 1.07 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + lsb-release @@ -2542,757 +1617,119 @@ - help2man - http://www.gnu.org/software/help2man + zip + http://www.info-zip.org/Zip.html PisiLinux Community admins@pisilinux.org - GPLv2 + Info-ZIP app:console system.base - GNU utility to convert program --help output to a man page - Geleneksel --help çıktılarını man sayfalarına dönüştüren bir GNU yazılımı - Help2man is a tool which generate man page from help text of programs. - Help2man programların help çıktılarını man sayfalarına dönüştüren bir araçtır. - http://ftp.gnu.org/gnu/help2man/help2man-1.47.3.tar.xz - - perl-Locale-gettext - - system/base/help2man/pspec.xml + Info ZIP (encryption support) + ZIP programı (şifreleme desteği ile birlikte) + Zip est un outil de compression et d'archivage/packaging. Zip est utile pour distribuer un ensemble de fichier sous forme de paquets, et pour sauvegarder de l'espace disque en compressant temporairement les fichiers et répertoires inutilisés. + Zip is a compression and file packaging/archive utility. Zip is useful for packaging a set of files for distribution, for archiving files, and for saving disk space by temporarily compressing unused files or directories. + Zip bir sıkıştırma ve dosya paketleme/arşivleme uygulamasıdır. Zip dosyaları dağıtmak, arşivlemek ve kullanılmayan dosyaları ve dizinleri geçici olarak sıkıştırarak disk boşluğundan tasarruf için kullanılabilecek kullanışlı bir uygulamadır. + ftp://ftp.info-zip.org/pub/infozip/src/zip30.tgz + system/base/zip/pspec.xml - help2man + zip - perl-Locale-gettext + bzip2 /usr/bin - /usr/lib - /usr/share/doc - /usr/share/info - /usr/share/locale - /usr/share/man - - - - - 2016-04-27 - 1.47.3 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-08 - 1.47.3 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - gettext - http://www.gnu.org/software/gettext/gettext.html - - PisiLinux Community - admins@pisilinux.org - - GPLv3+ - app:console - library - system.base - GNU libraries and utilities for producing multi-lingual messages - Farklı dillerde ileti katalogları üretmek için gerekli GNU araçları ve kütüphaneleri - gettext est une librairie d'internationalisation GNU. - The GNU gettext package provides a set of tools and documentation for producing multi-lingual messages in programs. Tools include a set of conventions about how programs should be written to support message catalogs, a directory and file naming organization for the message catalogs, a runtime library which supports the retrieval of translated messages, and stand-alone programs for handling the translatable and the already translated strings. Gettext provides an easy to use library and tools for creating, using, and modifying natural language catalogs and is a powerful and simple method for internationalizing programs. - gettext, uygulamalarda farklı dillerde iletiler kullanılmasını sağlayan yerelleştirme araçları ve kütüphanelerini içerir. - gettext ist eine GNU Bibliothek für Internationalisierung - http://ftp.gnu.org/pub/gnu/gettext/gettext-0.19.8.1.tar.gz - - acl-devel - glib2-devel - ncurses-devel - libunistring-devel - libxml2-devel - - system/base/gettext/pspec.xml - - - gettext-docs - system.doc - - gettext - - - /usr/share/doc/gettext/html - - - - gettext - - acl - glib2 - ncurses - libgcc - libunistring - libgomp - libxml2 - - - /usr/bin - /usr/lib - /usr/share/gettext - /usr/share/locale - /usr/share/info - /usr/share/man - /usr/share/doc - - - - gettext-devel - Development files for gettext - gettext için geliştirme dosyaları - system.devel - - gettext - - - /usr/share/aclocal - /usr/include - /usr/share/man/man3 - - - - - 2017-01-08 - 0.19.8.1 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 0.19.7 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-02-28 - 0.19.7 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - python-psutil - https://github.com/giampaolo/psutil - - PisiLinux Community - admins@pisilinux.org - - BSD - library - system.base - A cross-platform process utilities module for Python - Platform bağımsız, süreçler hakkında bilgi sağlayan bir Python modülü - python-psutil is a module providing an interface for retrieving information on all running processes and system utilization (CPU, memory) in a portable way by using Python, implementing many functionalities offered by command line tools like ps, top, kill, lsof and netstat. - python-psutil, bütün çalışan süreçler ve sistem kullanımı (MİB - Merkezi İşlem Birim(CPU) ve hafıza gibi) hakkında bilgilere erişimek için arayüz sunan bir Python modülüdür. ps, top, kill, lsof, netstat gibi bir çok komut satırı araçlarının sunduğu işlevselliği sağlamaktadır. - https://github.com/giampaolo/psutil/archive/release-5.0.1.tar.gz - - python-devel - - system/base/python-psutil/pspec.xml - - - python-psutil - - python - - - /usr/lib - /usr/share/doc - - - - - 2017-01-22 - 5.0.1 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 4.0.0 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-02 - 4.0.0 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - libpcre - http://www.pcre.org/ - - PisiLinux Community - admins@pisilinux.org - - BSD - library - system.base - Perl-compatible regular expression library - Perl-uyumlu sıradan ifade kütüphanesi - La librairie PCRE (Expressions Régulières Compatible avec Perl) est un ensemble de fonctions implémentant la recherche de motifs de texte à l'aide d'expressions régulières utilisant la même syntaxe et la même sémantique que Perl5. - The PCRE (Perl Compatible Regular Expressions) library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5. - PCRE kütüphanesi, Perl 5 programlama dili sözdizimi ve semantiği ile kalıp eşleştirme (pattern matching) görevini yürüten fonksiyonları barındırır. - http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.bz2 - - readline-devel - - system/base/libpcre/pspec.xml - - - libpcre - - libgcc - readline - - - /usr/lib - /usr/share/man - /usr/share/doc - /usr/bin - - - - libpcre-devel - Development files for libpcre - libpcre için geliştirme dosyaları - system.devel - - libpcre - - - /usr/include - /usr/share/man/man3 - /usr/lib/pkgconfig - /usr/lib32/pkgconfig - /usr/share/doc/libpcre/html - /usr/bin/pcre-config - /usr/share/man/man1/pcre-config.1* - /usr/share/doc/libpcre/pcre-config.txt - - - - libpcre-32bit - 32-bit shared libraries for libpcre - libpcre için 32-bit paylaşımlı kitaplıklar - emul32 - emul32 - - readline-32bit - - - libgcc - libpcre - - - /usr/lib32 - - - - - 2017-01-20 - 8.40 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2017-01-07 - 8.38 - Rebuild with new toolchain. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 8.38 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-02-25 - 8.38 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - coreutils - http://www.gnu.org/software/coreutils/ - - Pisi Linux Admins - admins@pisilinux.org - - GPLv3+ - app:console - system.base - A set of basic GNU tools commonly used in shell scripts - Standart dosya, metin ve kabuk uygulamaları - Utilitaires standards GNU pour fichiers (chmod, cp, dd, dir, ls...), utilitaires texte (sort, tr, head, wc...) et utilitaires d'interpréteur de commande (shell) (whoami, who...) - GNU dosya uygulamaları (chmod, cp, dd, dir, ls...), sh uygulamaları (whoami, who,...) ve metin uygulamalarının (sort, tr, head, wc..) birlikteliğinden oluşmaktadır. - http://ftp.gnu.org/gnu/coreutils/coreutils-8.26.tar.xz - - acl-devel - attr-devel - perl - shadow - gettext-devel - ncurses-devel - gmp-devel - libcap-devel - texinfo - - - remove_am_silent_rules.patch - - system/base/coreutils/pspec.xml - - - coreutils - - acl - attr - gmp - libcap - - - /bin - /etc - /usr/bin - /usr/libexec - /usr/lib /usr/share/doc /usr/share/man - /usr/share/info - /usr/share/locale - - - - - 2016-04-27 - 8.26 - Version Bump. - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 8.25 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-02-28 - 8.25 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - man-pages - http://www.win.tue.nl/~aeb/linux/man/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - data:doc - system.base - Une collection de pages de manuel Linux compréhensibles d'une certaine manière. - A somewhat comprehensive collection of Linux man pages - Kapsamlı Linux kılavuz dökümanları - A large collection of man pages (documentation) from the Linux Documentation Project (LDP). - https://www.kernel.org/pub/linux/docs/man-pages/man-pages-4.09.tar.xz - http://www.kernel.org/pub/linux/docs/man-pages/man-pages-posix/man-pages-posix-2003-a.tar.xz - system/base/man-pages/pspec.xml - - - man-pages - - man-db - - - /usr/share/doc - /usr/share/man - - - man1/getent.1 - man1/sprof.1 - - - - - 2017-01-24 - 4.09 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 4.04 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-09 - 4.04 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - pypolkit - http://www.pisilinux.org - - PisiLinux Community - admins@pisilinux.org - - MIT - library - system.base - Python binding of PolicyKit - PolicyKit için Python bağlayıcısı - pypolkit is a Python binding for the PolicyKit library. - pypolkit PolicyKit için geliştirilmiş bir Python bağlayıcısıdır. - http://source.pisilinux.org/1.0/pypolkit-1.0.2.tar.gz - - glib2-devel - python-devel - polkit-devel - - system/base/pypolkit/pspec.xml - - - pypolkit - - glib2 - polkit - python - - - /usr/lib - /usr/share/doc - - - - - 2016-04-27 - 1.0.2 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-09 - 1.0.2 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - perl-Locale-gettext - http://search.cpan.org/dist/gettext - - PisiLinux Community - admins@pisilinux.org - - Artistic - library - system.base - A Perl module for accessing the GNU locale utilities - GNU yerel araçlarına erişim için Perl modülü - The gettext module permits access from Perl to the gettext() family of functions for retrieving message strings from databases constructed to internationalize software. - Bu modül, çoklu dil desteğini sağlayan gettext() ailesine Perl üzerinden erişimi sağlar. - El módulo gettext permite Perl acceder a la familia de funciones gettext() para obtener cadenas de mensajes (traducidos) desde bases de datos para la internacionalización de software. - http://search.cpan.org/CPAN/authors/id/P/PV/PVANDRY/gettext-1.07.tar.gz - - perl - - system/base/perl-Locale-gettext/pspec.xml - - - perl-Locale-gettext - - perl - - - /usr/lib - /usr/share/perl - /usr/share/doc - /usr/share/man - - - - - 2017-01-24 - 1.07 - Rebuild for new toolchain - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 1.07 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-03 - 1.07 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - python-pyliblzma - http://pypi.python.org/pypi/pyliblzma - - PisiLinux Community - admins@pisilinux.org - - LGPLv3 - library - system.base - Python bindings for lzma - Python için lzma bağlayıcıları - pyliblzma provides a python interface for the liblzma library to read/write data that has been compressed/decompressed with lzma utils. - pyliblzma, lzma araçlarıyla sıkıştırılmış verileri açmak ve lzma kitaplığı kullanarak veri sıkıştırmak için python programlama arayüzü sunan bir pakettir. - http://pypi.python.org/packages/source/p/pyliblzma/pyliblzma-0.5.3.tar.bz2 - - xz-devel - python-setuptools - python-devel - - system/base/python-pyliblzma/pspec.xml - - - python-pyliblzma - - xz - python - - - /usr/lib/python2* - /usr/share/doc - - - - - 2017-01-22 - 0.5.3 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 0.5.3 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-02 - 0.5.3 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - libuser - https://fedorahosted.org/libuser - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - library - system.base - A user and group account administration library - Kullanıcı ve grup hesap yönetim kitaplığı - libuser implements a standardized interface for manipulating and administering user and group accounts. The library uses pluggable back-ends to interface to its data sources. - libuser kullanıcı ve grup hesaplarını yönetmek ve işlemek için standart bir arayüz sunar. Kitaplık, sağladığı arayüzün verilere erişimi için genişletilebilir arkauçlar kullanmaktadır. - https://fedorahosted.org/releases/l/i/libuser/libuser-0.62.tar.xz - - pam-devel - popt-devel - glib2-devel - python-devel - - - libuser-0.56.15-fix_blowfish.patch - libuser-0.56.9-fix-str-fmt.patch - - system/base/libuser/pspec.xml - - - libuser - - pam - popt - glib2 - python - - - /etc - /usr/share/man - /usr/share/doc - /usr/share/locale - /usr/bin - /usr/sbin - /usr/lib - - - - libuser-devel - Development files for libuser - libuser için geliştirme dosyaları - system.devel - - libuser - glib2-devel - - - /usr/include - /usr/lib/pkgconfig - - - - - 2017-01-25 - 0.62 - Rebuild. - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 0.62 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-08 - 0.62 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - sed - http://sed.sourceforge.net/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - system.base - GNU Stream Editor - GNU stream düzenleyici - Sed est un éditeur de flux. Un éditeur de flux est utilisé pour réaliser des opérations basiques de modification de texte sur un flux d'entrée (un fichier ou un tuyau unix). - Sed is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline). - Sed bir dosyadan veya standart girdiden (klavyeden) bilgi okur ve standart çıktıya (ekrana) okuduğu bilgileri kullanıcının belirlediği düzene sokarak yazar. - mirrors://gnu/sed/sed-4.3.tar.xz - - gettext - attr-devel - acl-devel - - system/base/sed/pspec.xml - - - sed - - acl - - - /bin - /usr/bin - /usr/share/doc - /usr/share/man - /usr/share/info - /usr/share/locale 2017-01-23 - 4.3 - Version Bump. + 3.0 + Release Bump PisiLinux Community admin@pisilinux.org 2016-04-27 - 4.2.2 + 3.0 Release Bump PisiLinux Community admin@pisilinux.org - 2016-02-28 - 4.2.2 + 2016-03-02 + 3.0 First release Ertuğrul Erata ertugrulerata@gmail.com + + + timezone + ftp://elsie.nci.nih.gov/pub/ + + PisiLinux Community + admins@pisilinux.org + + BSD + public-domain + app:console + data + system.base + Timezone data files and tools + Zamandilimi veri dosyaları ve araçları + timezone includes timezone data files and tools to use them. Package contents are synchronized with glibc tree. + timezone zamandilimi veri dosyaları ve bu dosyaları kullanmak için gerekli araçları içerir. Paket içeriği glibc gelişim ağacından oluşturulmaktadır. + http://www.iana.org/time-zones/repository/releases/tzdata2016j.tar.gz + + perl + gawk + + system/base/timezone/pspec.xml + + + timezone + + /usr/share/zoneinfo + + + + + 2017-01-07 + 2016j + Rebuild with new toolchain. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2017-01-01 + 2016j + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 2016a + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 2016a + First release + Alihan Öztürk + alihan@pisilinux.org + + + acl @@ -3369,338 +1806,67 @@ - biosdevname - http://linux.dell.com/biosdevname/ + less + http://www.greenwoodsoftware.com/ - Serdar Soytetir - kaptan@pisilinux.org + PisiLinux Community + admins@pisilinux.org - GPLv2 - app:gui + GPLv3 + app:console system.base - Biosdevname is a udev helper utility developed - Biosdevname is a udev helper utility developed by Dell and released under the GNU General Public License (GPL). It provides a consistent naming mechanism for network devices based on their physical location as suggested by the system BIOS. - http://linux.dell.com/biosdevname/biosdevname-0.7.1/biosdevname-0.7.1.tar.gz + Excellent lecteur de fichier texte + Excellent text file viewer + Mükemmel bir metin görüntüleyici + Ausgezeichneter Textbetrachter + The less utility is a text file browser that resembles more, but has more capabilities. Less allows you to move backwards in the file as well as forwards. Since less doesn't have to read the entire input file before it starts, less starts up more quickly than text editors (for example, vi). + http://www.greenwoodsoftware.com/less/less-481.tar.gz - pciutils-devel - glibc-devel - zlib-devel + ncurses-devel - system/base/biosdevname/pspec.xml + system/base/less/pspec.xml - biosdevname + less - pciutils + ncurses - /sbin - /lib/udev/rules.d - /usr/sbin + /etc/env.d + /usr/bin /usr/share/doc /usr/share/man + + lesspipe.sh + 70less + code2color + + + 2017-01-23 + 481 + Rebuild. + PisiLinux Community + admin@pisilinux.org + 2016-04-27 - 0.7.1 + 481 Release Bump PisiLinux Community admin@pisilinux.org - 2016-03-06 - 0.7.1 + 2016-02-29 + 481 First release Ertuğrul Erata ertugrulerata@gmail.com - - - ca-certificates - http://packages.qa.debian.org/c/ca-certificates.html - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - MPL-1.1 - app:web - system.base - Common CA certificates - Common CA certificates - http://ftp.debian.org/debian/pool/main/c/ca-certificates/ca-certificates_20161130.tar.xz - system/base/ca-certificates/pspec.xml - - - ca-certificates - - run-parts - - - /etc - /usr/share/man - /usr/sbin - /usr/share/ca-certificates - - - System.Package - - - - - 2017-01-08 - 20160130 - Version Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 20160104 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-03 - 20160104 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - nettle - http://www.gnu.org - - PisiLinux Community - admins@pisilinux.org - - LGPLv2.1 - library - system.base - The Nettle package contains the low-level cryptographic library. - Nettle - biblioteka kryptograficzna. - The Nettle package contains the low-level cryptographic library that is designed to fit easily in many contexts. - ftp://ftp.gnu.org/gnu/nettle/nettle-3.2.tar.gz - - gmp-devel - - system/base/nettle/pspec.xml - - - nettle - - gmp - - - /usr/bin - /usr/lib - /usr/share/info - /usr/share/doc - - - - nettle-devel - Nettle için geliştirme dosyaları - nettle için geliştirme dosyaları. - Pliki nagłówkowe biblioteki nettle. - - nettle - - - /usr/include - /usr/lib/pkgconfig/nettle.pc - /usr/lib/pkgconfig/hogweed.pc - /usr/lib32/pkgconfig/nettle.pc - /usr/lib32/pkgconfig/hogweed.pc - - - - nettle-32bit - 32-bit shared libraries for nettle - emul32 - emul32 - - gmp-32bit - - - nettle - gmp-32bit - - - /usr/lib32/ - - - - - 2016-04-27 - 3.2 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-09 - 3.2 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - unzip - ftp://ftp.info-zip.org/pub/infozip/UnZip.html - - Pisi Gnu/Linux Community - cpisimail@yandex.com - - Info-ZIP - app:console - system.base - Unzipper for pkzip-compressed files - pkzip ile sıkıştırılmış dosyalar için açıcı - Unzip nous permet d'extraires des archives compressées aux format .zip (également appelées "fichiers zip"). - UnZip enables us to extract archives compressed in .zip format (also called "zipfiles"). - UnZip, zip formatında sıkıştırılmış dosyaları açmamızı sağlar. - mirrors://sourceforge/infozip/unzip60.zip - - bzip2 - bash - - - overflow-fsize.patch - cve20149636.patch - test_compr_eb.patch - getZip64Data.patch - crc32.patch - empty-input.patch - csiz-underflow.patch - nextbyte-overflow.patch - - system/base/unzip/pspec.xml - - - unzip - - bzip2 - bash - - - /usr/bin - /usr/share/doc - /usr/share/man - - - - - 2017-01-23 - 60 - Rebuild. - Pisi Gnu/Linux Community - cpisimail@yandex.com - - - 2016-12-17 - 60 - Version Bump. - Pisi Gnu/Linux Community - cpisimail@yandex.com - - - 2016-12-17 - 610b - Rebuild. - Pisi Gnu/Linux Community - cpisimail@yandex.com - - - 2016-07-26 - 610b - First Release - Pisi Gnu/Linux Community - cpisimail@yandex.com - - - - - - fuse - http://fuse.sourceforge.net - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - library - system.base - Interface implémentée dans l'environnement utilisateur (userpace) pour les systèmes de fichier. - An interface for filesystems implemented in userspace - Kullanıcı düzeyinde dosya sistemi oluştumaya yarayan kitaplık - Una interfaz para sistemas de archivos implementados en el espacio de usuario - fuse is a backend allowing regular users to (un)mount filesystems for their own use. - FUSE, kullanıcıların kendileri için dosya sistemleri oluşturmasına, bağlamasına ve bağı koparmasına imkân veren bir arkauç kitaplıktır. - https://github.com/libfuse/libfuse/releases/download/fuse_2_9_5/fuse-2.9.5.tar.gz - - gettext-devel - - - skip_umount_test.patch - - system/base/fuse/pspec.xml - - - fuse - - glibc - - - /bin - /sbin - /usr/bin - /lib - /usr/share/doc - /usr/share/man - - - - fuse-devel - Development files for fuse - fuse için geliştirme dosyaları - system.devel - - fuse - - - /usr/include - /usr/lib/pkgconfig - - - - - 2016-04-27 - 2.9.5 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2015-08-18 - 2.9.5 - First release - Ayhan Yalçınsoy - ayhanyalcinsoy@pisilinux.org - - - man-db @@ -3777,679 +1943,6 @@ - - - libunwind - http://www.nongnu.org/libunwind/ - - PisiLinux Community - admins@pisilinux.org - - MIT - library - system.base - Call chain tracer of a program - Yazılım çağrıları geri izleme aracı - libunwind is a portable and efficient C programming interface (API) to determine the call chain of a program. - libunwind bir yazılımın çağrı sıralamasını takip etmek için kullanılan, hızlı çalışan ve taşınabilir bir C programlama arabirimidir. - http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz - - xz-devel - - system/base/libunwind/pspec.xml - - - libunwind - - xz - - - /usr/lib - /usr/share/doc/libunwind - /usr/share/man - /usr/share/man/man3 - - - - libunwind-devel - Development files for libunwind - libunwind için geliştirme dosyaları - - libunwind - - - /usr/include - /usr/lib/pkgconfig - - - - - 2017-01-21 - 1.1 - Rebuild with new toolchain. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 1.1 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-02 - 1.1 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - which - http://www.xs4all.nl/~carlo17/which/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - system.base - Prints the location of specified executable in your path - Verilen komutun çalıştırma yolundaki önceliğe göre yerini gösterir - which, localise un programme dans le chemin de l'utilisateur. - which , Locates a program file in the user's path. - which, kullanıcı dizinindeki program dosyalarının yarini bulur. - which, findet eine Anwendungsdatei im Benutzerverzeichnis - mirrors://gnu/which/which-2.21.tar.gz - system/base/which/pspec.xml - - - which - - /usr/bin - /usr/share/doc - /usr/share/man - /usr/share/info - - - - - 2017-01-23 - 2.21 - Rebuild. - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 2.21 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-02 - 2.21 - First release - Ayhan Yalçınsoy - ayhanyalcinsoy@pisilinux.org - - - - - - pcmciautils - http://www.kernel.org/pub/linux/utils/kernel/pcmcia/pcmcia.html - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - system.base - Utilitaires divers concernant le bus PCMCIA. - Various utilities dealing with the PCMCIA bus - PCMCIA veriyolu işlevleri ile ilgili çeşitli araçlar - Verschiedene Werkzeuge, um mit dem PCMCIA Bus umzugehen - pcmciautils contains the initialization tools necessary to allow the PCMCIA subsystem to behave as every other hotpluggable bus system. - pcmciautils PCMCIA altyapısının tak/çıkar veriyolları gibi davranmasını sağlayan araçları içerir. - https://sources.archlinux.org/other/pcmciautils/pcmciautils-018.tar.xz - - sysfsutils-devel - - system/base/pcmciautils/pspec.xml - - - pcmciautils - - sysfsutils - - - /sbin - /lib/udev - /etc/pcmcia - /usr/share/doc - /usr/share/man - /lib/udev/rules.d - - - - - 2016-04-27 - 018 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-09 - 018 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - v86d - http://dev.gentoo.org/~spock/projects/uvesafb/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - service - system.base - Userspace helper for uvesafb - uvesafb için kullanıcı uzayı yardımcısı - Program pomocniczy uvesafb uruchamiający kod x86 w emulowanym środowisku - v86d is a userspace helper that runs x86 code in an emulated environment. It is used by the kernel framebuffer driver uvesafb. - v86d, öykünmüş bir ortamda x86 kodu çalıştıran yardımcı bir kullanıcı uzayı yardımcısıdır. Çekirdekteki uvesafb framebuffer sürücüsü tarafından kullanılır. - v86d to działający w przestrzeni użytkownika program pomocniczy uruchamiający kod x86. Jest wykorzystywany przez sterownik jądra Linuksa uvesafb. - http://source.pisilinux.org/1.0/v86d-0.1.10.tar.bz2 - system/base/v86d/pspec.xml - - - v86d - - /sbin - /usr/share/doc - - - - - 2016-04-27 - 0.1.10 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-05 - 0.1.10 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - rsyslog - http://www.rsyslog.com - - PisiLinux Community - admins@pisilinux.org - - GPLv3+ - service - system.base - Enhanced system logging and kernel message trapping daemons - Gelişmiş sistem günlükleme hizmeti - rsyslog is an enhanced multi-threaded syslogd supporting, among others, MySQL, syslog/tcp, RFC 3195, permitted sender lists, filtering on any message part, and fine grain output format control. It is quite compatible with stock sysklogd and can be used as a drop-in replacement. - rsyslog, çoklu iş parçacığı, MySQL, syslog/tcp, RFC 3195, izin verilen gönderici listesi, gelişmiş ileti filtreleme gibi özelliklere sahip gelişmiş bir sistem günlükleme hizmetidir. - http://www.rsyslog.com/files/download/rsyslog/rsyslog-8.11.0.tar.gz - - zlib-devel - json-c-devel - libestr-devel - libgcrypt-devel - liblogging-devel - - system/base/rsyslog/pspec.xml - - - rsyslog - - zlib - json-c - libestr - libgcrypt - liblogging - - - /usr/bin/rsyslogd - /usr/lib/rsyslog - /usr/share/man - /usr/share/doc - /etc/logrotate.d - /etc/conf.d - /etc/rsyslog.d - /etc/rsyslog.conf - /var - - - System.Service - - - rsyslog.logrotate - rsyslog.conf - 50-default.conf - rsyslog.sysconfig - - - - - 2016-04-27 - 8.11.0 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 8.11.0 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - gdbm - http://www.gnu.org/software/gdbm/gdbm.html - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - library - system.base - Standard GNU database libraries included for compatibility with Perl - Perl uyumlu standart GNU veritabanı kütüphaneleri - GNU dbm est un ensemble de routines de base de données utilisant extensivement les dictionnaires (hashing). Il fonctionne de manière similaire aux routines dbm UNIX standards. - GNU dbm is a set of database routines that use extensible hashing. It works similar to the standard UNIX dbm routines. - GNU dbm genişletilebilir hash yapabilen veritabanı işlevleri sağlar. Standart UNIX dbm uygulamaları ile aynı şekilde çalışır. - mirrors://gnu/gdbm/gdbm-1.12.tar.gz - - gdbm-1.10-zeroheaders.patch - - system/base/gdbm/pspec.xml - - - gdbm - - /usr/bin - /usr/lib - /usr/share/doc - /usr/share/locale - /usr/share/man - /usr/share/info - - - - gdbm-devel - Development files for gdbm - gdbm için geliştirme dosyaları - system.devel - - gdbm - - - /usr/include - - - - - 2017-01-07 - 1.12 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 1.11 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-02 - 1.11 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - usbutils - http://linux-usb.sourceforge.net/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2+ - app:console - system.base - Linux USB utilities - USB listeleme araçları - Usbutils fournit des utilitaires d'énumération usb. - usbutils provides utilities for inspecting devices connected to a USB bus. - usbutils, USB aygıt veritabanı ile sistemdeki USB aygıtları listelemeye yarayan lsusb aracını içerir. - https://www.kernel.org/pub/linux/utils/usb/usbutils/usbutils-008.tar.xz - - usb.ids - - - libusb-devel - eudev-devel - - system/base/usbutils/pspec.xml - - - usbutils - - libusb - eudev - - - /usr/bin - /usr/sbin - /usr/share/man - /usr/share/doc - /usr/share/misc - /usr/share/pkgconfig - - - usb.ids - - - - - 2016-06-16 - 008 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 008 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-11 - 008 - First release - Stefan Gronewold - groni@pisilinux.org - - - - - - tar - http://www.gnu.org/software/tar/ - - PisiLinux Community - admins@pisilinux.org - - GPLv3+ - app:console - system.base - A GNU file archiving program - GNU dosya arşivleme uygulaması - Le programme tar fournit la possibilité de manipuler des archives de type tar. Vous pouvez l'utiliser pour créer ou extraires des archives. Ajouter des fichiers à des archives existantes, les mettre à jour ou tout simplement lister leur contenu. - The GNU tar program saves many files together in one archive and can restore individual files (or all of the files) from that archive. - GNU tar birden fazla dosyayı tek bir arşiv dosyasında birleştiren ve daha sonra bu arşiv dosyasından geri çıkartabilen bir uygulamadır. - http://mirrors.kernel.org/gnu/tar/tar-1.29.tar.xz - - tar.1 - - - acl-devel - gettext - - system/base/tar/pspec.xml - - - tar - - acl - glibc - - - /bin - /sbin - /usr/share/doc - /usr/share/man - /usr/share/locale - /usr/share/info - - - - - 2017-01-06 - 1.29 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 1.28 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-02-28 - 1.28 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - timezone - ftp://elsie.nci.nih.gov/pub/ - - PisiLinux Community - admins@pisilinux.org - - BSD - public-domain - app:console - data - system.base - Timezone data files and tools - Zamandilimi veri dosyaları ve araçları - timezone includes timezone data files and tools to use them. Package contents are synchronized with glibc tree. - timezone zamandilimi veri dosyaları ve bu dosyaları kullanmak için gerekli araçları içerir. Paket içeriği glibc gelişim ağacından oluşturulmaktadır. - http://www.iana.org/time-zones/repository/releases/tzdata2016j.tar.gz - - perl - gawk - - system/base/timezone/pspec.xml - - - timezone - - /usr/share/zoneinfo - - - - - 2017-01-07 - 2016j - Rebuild with new toolchain. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2017-01-01 - 2016j - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 2016a - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 2016a - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - bc - http://www.gnu.org/software/bc - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - system.base - Console-based calculator utility - Konsol temelli hesap makinesi - bc est un langage de calcul numérique à précision arbitraire qui peut être utilisé comme calculatrice. La syntaxe est similaire au C, avec quelques différences notables. Il supporte par exemple l'exécution interactive de commandes. - bc is an arbitrary precision numeric processing language and can be used as a calculator. Syntax is similar to C, but differs in many substantial areas. For example, it supports interactive execution of statements. - bc, herhangi bir keskinlikte sayısal işlemler yapmayı sağlayan bir programlama dilidir ve bir hesap makinesi olarak kullanılabilir. Sözdizimi C programlama diline benzer, ancak C'den birçok önemli farkları vardır. Örneğin, ifadelerin etkileşimli bir şekilde çalışmasına olanak tanır. - ftp://alpha.gnu.org/gnu/bc/bc-1.06.95.tar.bz2 - - flex - texinfo - readline-devel - - - fedora/bc-1.06.95-memleak.patch - fedora/bc-1.06-dc_ibase.patch - fedora/bc-1.06.95-matlib.patch - - system/base/bc/pspec.xml - - - bc - - readline - - - /usr/bin - /usr/share/doc - /usr/share/man - /usr/share/info - - - - - 2016-04-27 - 1.06.95 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-05 - 1.06.95 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - findutils - http://www.gnu.org/software/findutils/findutils.html - - PisiLinux Community - admins@pisilinux.org - - GPLv3+ - app:console - system.base - GNU utilities to find files - Dosya bulmak için kullanılan GNU uygulamaları - Les utilitaires de recherche GNU sont les utilitaire de recherche de répertoire basique du système d'exploitation GNU. Ces programmes sont typiquement associés à d'autres programmes pour leur fournir une capacité de recherche de fichier et de répertoire puissante et modulaire à d'autres commandes. - The GNU Find Utilities are the basic directory searching utilities of the GNU operating system. These programs are typically used in conjunction with other programs to provide modular and powerful directory search and file locating capabilities to other commands. - GNU Find Utilities GNU işletim sisteminin temel dizin arama uygulamalarıdır. Bu uygulamalar diğer komutlara başka programlar ile birlikte çalışarak modüler ve güçlü dizin ve dosya arama yetenekleri sunar. - http://ftp.gnu.org/pub/gnu/findutils/findutils-4.6.0.tar.gz - - gettext - texinfo - - system/base/findutils/pspec.xml - - - findutils - - /usr/bin - /usr/lib/find - /usr/libexec - /usr/share/doc - /usr/share/man - /usr/share/info - /usr/share/locale - /var - - - - - 2017-01-23 - 4.6.0 - Rebuild.. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 4.6.0 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-02-28 - 4.6.0 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - util-linux @@ -4626,64 +2119,566 @@ - plyvel - https://pypi.python.org/pypi/plyvel + db + http://www.oracle.com/technology/products/berkeley-db/db/index.html - Alihan Öztürk - alihan@pisilinux.org + PisiLinux Community + admins@pisilinux.org - BSD + DB app:console system.base - Plyvel, a fast and feature-rich Python interface to LevelDB. - Plyvel, LevelDB için, hızlı ve zengin özellikli Python arabirimi. - Plyvel has a rich feature set, high performance, and a friendly Pythonic API. - Plyvel zengin özelliklere sahip bir set, yüksek performanslı, ve kullanıcı dostu bir Pythonic API. - https://pypi.python.org/packages/source/p/plyvel/plyvel-0.9.tar.gz - - cython - python-devel - leveldb-devel - python-setuptools - - system/base/plyvel/pspec.xml + Quatrième version de Berkeley DB + Oracle Berkeley DB + Oracle Berkeley DB + Ein einbettbares Datenbank Engine, dass die Entwickler mit schnellen, zuverlässigen und lokalen Persistenz unterstützt und null Administration erfordert. + The Berkeley Database (Berkeley DB) is a programmatic toolkit that provides embedded database support for both traditional and client/server applications. The Berkeley DB includes B+tree, Extended Linear Hashing, Fixed and Variable-length record access methods, transactions, locking, logging, shared memory caching, and database recovery. The Berkeley DB supports C, C++, Java, and Perl APIs. It is used by many applications, including Python and Perl, so this should be installed on all systems. + Berkeley DB geliştiricilere yerel süreklilik sağlayan ve herhangi bir ayar gerektirmeden (zero administration) kullanılan, hızlı ve gömülebilir bir veritabanı motorudur. + http://download.oracle.com/berkeley-db/db-6.2.23.tar.gz + system/base/db/pspec.xml - plyvel + db libgcc - python - leveldb + /usr/bin /usr/lib + /usr/sbin + + + db5 + + + + db-devel + Development files for db + + db + + + /usr/include + + + db5-devel + + + + db-docs + Documentation for db + system.doc + + db + + /usr/share/doc + + db5-docs + 2017-01-21 - 0.9 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com + 6.2.23 + Version Bump + Ayhan Yalçınsoy + ayhanyalcinsoy@pisilinux.org 2016-04-27 - 0.9 + 6.1.26 Release Bump PisiLinux Community admin@pisilinux.org 2016-03-02 - 0.9 + 6.1.26 First release Ertuğrul Erata ertugrulerata@gmail.com + + + libssh2 + http://www.libssh2.org/ + + PisiLinux Community + admins@pisilinux.org + + BSD + library + system.base + A library implementing the SSH2 protocol + SSH2 protokolü için kütüphane + libssh2 is a library implementing the SSH2 protocol as defined by Internet Drafts: SECSH-TRANS, SECSH-USERAUTH, SECSH-CONNECTION, SECSH-ARCH, SECSH-FILEXFER, SECSH-DHGEX, SECSH-NUMBERS, and SECSH-PUBLICKEY. + libssh2, SECSH-TRANS, SECSH-USERAUTH, SECSH-CONNECTION, SECSH-ARCH, SECSH-FILEXFER, SECSH-DHGEX, SECSH-NUMBERS ve SECSH-PUBLICKEY gibi Internet Taslakları tarafından belirlenen SSH2 protokolü için geliştirilmiş bir kütüphanedir. + https://www.libssh2.org/download/libssh2-1.8.0.tar.gz + + openssl-devel + zlib-devel + + system/base/libssh2/pspec.xml + + + libssh2 + + openssl + zlib + + + /usr/lib + /usr/share/doc + + + + libssh2-devel + Development files for libssh2 + libssh2 için geliştirme dosyaları + system.devel + + libssh2 + + + /usr/include + /usr/lib/pkgconfig + /usr/share/man + + + + + 2017-01-22 + 1.8.0 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 1.7.0 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-08 + 1.7.0 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + rsyslog + http://www.rsyslog.com + + PisiLinux Community + admins@pisilinux.org + + GPLv3+ + service + system.base + Enhanced system logging and kernel message trapping daemons + Gelişmiş sistem günlükleme hizmeti + rsyslog is an enhanced multi-threaded syslogd supporting, among others, MySQL, syslog/tcp, RFC 3195, permitted sender lists, filtering on any message part, and fine grain output format control. It is quite compatible with stock sysklogd and can be used as a drop-in replacement. + rsyslog, çoklu iş parçacığı, MySQL, syslog/tcp, RFC 3195, izin verilen gönderici listesi, gelişmiş ileti filtreleme gibi özelliklere sahip gelişmiş bir sistem günlükleme hizmetidir. + http://www.rsyslog.com/files/download/rsyslog/rsyslog-8.11.0.tar.gz + + zlib-devel + json-c-devel + libestr-devel + libgcrypt-devel + liblogging-devel + + system/base/rsyslog/pspec.xml + + + rsyslog + + zlib + json-c + libestr + libgcrypt + liblogging + + + /usr/bin/rsyslogd + /usr/lib/rsyslog + /usr/share/man + /usr/share/doc + /etc/logrotate.d + /etc/conf.d + /etc/rsyslog.d + /etc/rsyslog.conf + /var + + + System.Service + + + rsyslog.logrotate + rsyslog.conf + 50-default.conf + rsyslog.sysconfig + + + + + 2016-04-27 + 8.11.0 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 8.11.0 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + ncompress + http://ncompress.sourceforge.net + + PisiLinux Community + admins@pisilinux.org + + public-domain + app:console + system.base + Un autre outil de décompression de données pour compatibilité + Another uncompressor for compatibility + Bir başka sıkışmış dosya açma programı + Ein weiterer Nichtkompressor zu Kompatibilitätszwecken + The ncompress package contains the compress and uncompress file compression and decompression utilities, which are compatible with the original UNIX compress utility (.Z file extensions). These utilities can't handle gzipped (.gz file extensions) files, but gzip can handle compressed files. + mirrors://sourceforge/ncompress/ncompress-4.2.4.4.tar.gz + + ncompress-4.2.4-make.patch + ncompress-4.2.4-lfs2.patch + ncompress-2GB.patch + ncompress-4.2.4-endians.patch + + system/base/ncompress/pspec.xml + + + ncompress + + /usr/bin + /usr/share/man + + + + + 2016-04-27 + 4.2.4.4 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-09 + 4.2.4.4 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + libpipeline + http://libpipeline.nongnu.org + + PisiLinux Community + admins@pisilinux.org + + GPLv3+ + library + system.base + pipeline manipulation library + pipeline yönetim kitaplığı + libpipeline is a C library for manipulating pipelines of subprocesses in a flexible and convenient way. + libpipeline, alt-süreç girdi/çıktı hatlarını (pipeline) yönetmek için geliştirilmiş bir C kitaplığıdır. + http://download.savannah.gnu.org/releases/libpipeline/libpipeline-1.4.1.tar.gz + system/base/libpipeline/pspec.xml + + + libpipeline + + /usr/lib + /usr/share/doc + + + + libpipeline-devel + Development files for libpipeline + libpipeline için geliştirme dosyaları + system.devel + + libpipeline + + + /usr/include + /usr/lib/pkgconfig + /usr/share/man + + + + + 2017-01-24 + 1.4.1 + Rebuild. + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 1.4.1 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-08 + 1.4.1 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + usbutils + http://linux-usb.sourceforge.net/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2+ + app:console + system.base + Linux USB utilities + USB listeleme araçları + Usbutils fournit des utilitaires d'énumération usb. + usbutils provides utilities for inspecting devices connected to a USB bus. + usbutils, USB aygıt veritabanı ile sistemdeki USB aygıtları listelemeye yarayan lsusb aracını içerir. + https://www.kernel.org/pub/linux/utils/usb/usbutils/usbutils-008.tar.xz + + usb.ids + + + libusb-devel + eudev-devel + + system/base/usbutils/pspec.xml + + + usbutils + + libusb + eudev + + + /usr/bin + /usr/sbin + /usr/share/man + /usr/share/doc + /usr/share/misc + /usr/share/pkgconfig + + + usb.ids + + + + + 2016-06-16 + 008 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 008 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-11 + 008 + First release + Stefan Gronewold + groni@pisilinux.org + + + + + + gdbm + http://www.gnu.org/software/gdbm/gdbm.html + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + library + system.base + Standard GNU database libraries included for compatibility with Perl + Perl uyumlu standart GNU veritabanı kütüphaneleri + GNU dbm est un ensemble de routines de base de données utilisant extensivement les dictionnaires (hashing). Il fonctionne de manière similaire aux routines dbm UNIX standards. + GNU dbm is a set of database routines that use extensible hashing. It works similar to the standard UNIX dbm routines. + GNU dbm genişletilebilir hash yapabilen veritabanı işlevleri sağlar. Standart UNIX dbm uygulamaları ile aynı şekilde çalışır. + mirrors://gnu/gdbm/gdbm-1.12.tar.gz + + gdbm-1.10-zeroheaders.patch + + system/base/gdbm/pspec.xml + + + gdbm + + /usr/bin + /usr/lib + /usr/share/doc + /usr/share/locale + /usr/share/man + /usr/share/info + + + + gdbm-devel + Development files for gdbm + gdbm için geliştirme dosyaları + system.devel + + gdbm + + + /usr/include + + + + + 2017-01-07 + 1.12 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 1.11 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-02 + 1.11 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + e2fsprogs + http://e2fsprogs.sourceforge.net/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + system.base + Standard ext2/3/4 filesystem utilities + Standart ext2, ext3, ext4 dosya sistemi uygulamaları + e2frprogs fournit les outils de système de fichier à utiliser avec les systèmes de fichier de type ext2. Il prend également en charge les système de fichier de type ext3/4 avec support de la journalisation. + e2fsprogs provides the filesystem utilities for use with the ext2 filesystem. It also supports the ext3/4 filesystem with journaling support. + e2fsprogs ext2 dosya sistemi için standart dosya sistemi uygulamaları sağlar. ext3/4 dosya sistemlerinin günlüğe kaydetme özelliklerini de destekler. + mirrors://sourceforge/e2fsprogs/e2fsprogs-1.43.3.tar.gz + + libutil-linux-devel + gettext + + + ntfs-3g.patch + + system/base/e2fsprogs/pspec.xml + + + e2fsprogs + + libutil-linux + + + /etc + /bin + /usr/bin + /lib + /usr/lib + /sbin + /usr/sbin + /usr/share/et + /usr/share/ss + /usr/share/locale + /usr/share/info + /usr/share/man + /usr/share/doc + + + + e2fsprogs-devel + Development files for e2fsprogs + e2fsprogs için geliştirme dosyaları + system.devel + + e2fsprogs + + + /usr/include + /usr/lib/pkgconfig + /usr/share/man/man3 + + + + + 2017-01-29 + 1.43.3 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 1.42.13 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-19 + 1.42.13 + First release + Alihan Öztürk + alihan@pisilinux.org + + + expat @@ -4780,114 +2775,117 @@ - bash - http://cnswww.cns.cwru.edu/~chet/bash/bashtop.html + libestr + http://libestr.adiscon.com - Pisi Linux Admins - admins@pisilinux.org + Marcin Bojara + marcin@pisilinux.org - GPLv2 - app:console + LGPLv2.1 + library system.base - The standard GNU Bourne again shell - GNU Bource again kabuğu - Bash est le Bourne Again SHell du projet GNU, une implémentation complête du POSIX IEEE et des spécifications d'interprétation de commande (shell) de l'Open Group, avec édition interactive de ligne de commande et des fonctionnalités à la csh tels que la substitution dans l'historique de commande. - Bash is the GNU Project's Bourne Again SHell, a complete implementation of the IEEE POSIX and Open Group shell specification with interactive command line editing, csh-like features such as history substitution. - Bash, IEEE POSIX ve Open Group'un interaktif komut satırı düzenleme, geçmiş komutları tamamlama gibi csh tipi özellikler gibi kabuk uygulamaları tariflerinin tam olarak uygulayan GNU Projesinin Bourne Again SHell kabuk programıdır. - mirrors://gnu/bash/bash-4.3.30.tar.gz - - ncurses-devel - - - official/bash43-031.tar.gz - official/bash43-032.tar.gz - official/bash43-033.tar.gz - official/bash43-034.tar.gz - official/bash43-035.tar.gz - official/bash43-036.tar.gz - official/bash43-037.tar.gz - official/bash43-038.tar.gz - official/bash43-039.tar.gz - official/bash43-040.tar.gz - official/bash43-041.tar.gz - official/bash43-042.tar.gz - official/bash43-043.tar.gz - official/bash43-044.tar.gz - official/bash43-045.tar.gz - official/bash43-046.tar.gz - official/bash43-047.tar.gz - official/bash43-048.tar.gz - fedora/bash-2.02-security.patch - fedora/bash-2.03-paths.patch - fedora/bash-2.03-profile.patch - fedora/bash-2.05a-interpreter.patch - fedora/bash-2.05b-debuginfo.patch - fedora/bash-2.05b-manso.patch - fedora/bash-2.05b-pgrp_sync.patch - fedora/bash-2.05b-readline-oom.patch - fedora/bash-2.05b-xcc.patch - fedora/bash-3.2-audit.patch - fedora/bash-3.2-ssh_source_bash.patch - fedora/bash-4.0-nobits.patch - fedora/bash-4.1-broken_pipe.patch - fedora/bash-4.1-defer-sigchld-trap.patch - fedora/bash-4.1-examples.patch - fedora/bash-4.2-coverity.patch - fedora/bash-4.2-manpage_trap.patch - fedora/bash-4.2-rc2-logout.patch - fedora/bash-4.2-size_type.patch - fedora/bash-bashbug.patch - fedora/bash-infotags.patch - fedora/bash-requires.patch - fedora/bash-setlocale.patch - fedora/bash-tty-tests.patch - - system/base/bash/pspec.xml + Library for some string essentials + libestr - some essentials for string handling (and a bit more) + http://libestr.adiscon.com/files/download/libestr-0.1.10.tar.gz + system/base/libestr/pspec.xml - bash + libestr + + /usr/lib/libestr.so* + /usr/share/doc/libestr + + + + libestr-devel + Development files for libestr + system.devel - ncurses + libestr - /etc - /bin - /usr/bin - /usr/share/doc - /usr/share/info - /usr/share/man - /usr/share/locale + /usr/include/libestr.h + /usr/lib/pkgconfig/libestr.pc - - bashrc - command-not-found.sh - - - 2017-01-06 - 4.3_p48 - Rebuild with new toolchain. - PisiLinux Community - admin@pisilinux.org - - - 2016-11-12 - 4.3_p48 - Release Bump - PisiLinux Community - admin@pisilinux.org - 2016-04-27 - 4.3_p39 + 0.1.10 Release Bump PisiLinux Community admin@pisilinux.org - 2016-02-28 - 4.3_p39 + 2016-03-08 + 0.1.10 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + leveldb + https://code.google.com/p/leveldb + + Alihan Öztürk + alihan@pisilinux.org + + BSD + app:console + system.base + A fast and lightweight key/value database library + Hızlı ve hafif bir anahtar/değer veri kütüphanesi + LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values. + LevelDB dize değerleri ile dize anahtarlarını eşleme sağlayan, Google'da yazılmış hızlı bir anahtar-değer depolama kütüphanesidir. + https://github.com/google/leveldb/archive/v1.18.tar.gz + + gperftools-devel + snappy-devel + + system/base/leveldb/pspec.xml + + + leveldb + + libgcc + snappy + gperftools + + + /usr/lib + /usr/share/doc + + + + leveldb-devel + + leveldb + + + /usr/include + + + + + 2017-01-21 + 1.18 + Rebuild with new toolchain. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 1.18 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-02 + 1.18 First release Ertuğrul Erata ertugrulerata@gmail.com @@ -4896,8 +2894,69 @@ - ncurses - http://www.gnu.org/software/ncurses/ncurses.html + nspr + http://www.mozilla.org/projects/nspr/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + library + system.base + Netscape Portable Runtime + Netscape Taşınabilir Çalışma Zamanı + Netscape Portable Runtime (NSPR -- Exécutable Portable Netscape) fourni une API neutre au sens de la plate-forme pour les fonctions de niveau système ou de type libc. Cette API est utilisée au sein du client Mozilla ainsi que de nombreuses solutions logicielles de Netscape/AOL/iPlanet. + Netscape Portable Runtime (NSPR) provides a platform-neutral API for system level and libc like functions. The API is used in the Mozilla client, many of Netscape/AOL/iPlanet's and other software offerings. + Netscape Taşınabilir çalışma Zamanı (NSPR) sistem seviyesindeki libc ve benzeri fonksiyonlar için platform bağımsız bir programlama arayüzü sunar. Bu arayüz, Mozilla istemcilerinde, Netscape/AOL/iPlanet'in diğer yazılımlarında kullanılmaktadır. + Netscape Portable Runtime (NSPR) provee un API independiente de la plataforma a nivel de sistema y funciones como libc. El API está usado en el cliente Mozilla, y muchos otros software de Netscape/AOL/iPlanet. + https://ftp.mozilla.org/pub/nspr/releases/v4.12/src/nspr-4.12.tar.gz + + nspr.pc.in + generate-pc-config.sh + + system/base/nspr/pspec.xml + + + nspr + + /usr/lib + + + + nspr-devel + Development files for nspr + nspr için geliştirme dosyaları + system.devel + + nspr + + + /usr/include + /usr/lib/pkgconfig + /usr/bin + + + + + 2016-04-27 + 4.12 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-06 + 4.12 + First release + Ayhan Yalçınsoy + ayhanyalcinsoy@pisilinux.org + + + + + + json-c + http://oss.metaparadigm.com/json-c PisiLinux Community admins@pisilinux.org @@ -4905,78 +2964,308 @@ MIT library system.base - Console display library - Konsol görsel kütüphanesi - NCurses est une librairie de fonction gérant l'affichage des applications pour terminaux en mode caractères. La libraries NCurses défini de nombreuses fonctionalités telles le mouvement de la souris et du curseur, la disposition du clavier et l'affichage en couleur. - The NCurses is a library of functions that manage an application's display on character-cell terminals. The NCurses library defines many functions such as moving mouse and cursor, keyboard mapping and dispaying in color. - NCurses, bir uygulamanın karakter tabanlı uçbirimlerde görüntüleri üzerinde çalışabilmeyi sağlayan işlevler kütüphanesidir. Uygulama programları için imleci hareket ettirmek, pencereler oluşturmak, renkler üretmek, fare ile oynamak v.b. işlevler sağlamaktadır. - mirrors://gnu/ncurses/ncurses-6.0.tar.gz - - gnuconfig - - system/base/ncurses/pspec.xml + A JSON implementation in C + C dilinde JSON gerçeklemesi + json-c implements a reference counting object model that allows you to easily construct JSON objects in C, output them as JSON formatted strings and parse JSON formatted strings back into the C representation of JSON objects. + json-c, C dilinde kolayca JSON nesneleri yaratılmasını sağlayan bir referans sayma modeli gerçekleyen bir kitaplıktır. + https://github.com/json-c/json-c/archive/json-c-0.12-20140410.tar.gz + + wno-werror.patch + + system/base/json-c/pspec.xml - ncurses + json-c - /etc - /lib - /usr/bin - /usr/lib - /usr/share/terminfo - /usr/share/tabset - /usr/share/man /usr/share/doc + /usr/share/man + /usr/lib - ncurses-devel - Development files for ncurses - ncurses için geliştirme dosyaları + json-c-devel + Development files for json-c + json-c için geliştirme dosyaları system.devel - ncurses + json-c /usr/include - /usr/lib/pkgconfig - /usr/lib/static - /usr/lib32/static - /usr/share/man/man3 - /usr/share/pkgconfig - - - - ncurses-32bit - 32-bit shared libraries for ncurses - emul32 - _emul32 - - ncurses - - - /usr/lib32 + /usr/lib/pkgconfig /usr/lib32/pkgconfig + + json-c-32bit + 32-bit shared libraries for json-c + emul32 + emul32 + + /usr/lib32 + + - - 2017-01-04 - 6.0 - Rebuild with new toolchain. - Ertuğrul Erata - ertugrulerata@gmail.com - 2016-04-27 - 6.0 + 0.12 Release Bump PisiLinux Community admin@pisilinux.org - 2016-02-28 - 6.0 + 2016-03-08 + 0.12 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + comar-api + http://www.pisilinux.org + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + library + system.base + Utility functions for Comar scripts + Çomar betikleri için yardımcı fonksiyonlar + Librairie utilitaire générique pour les opérations communes de scripts Comar. + Generic utility library for common Comar script operations. + Çomar betiklerinde sıkça yapılan ortak işlemler için yardımcı fonksiyonlar kitaplığı. + http://source.pisilinux.org/1.0/comar-api-2.4.9.tar.gz + + python + + + run_dir.patch + pisilinux.patch + add-stopdependencies.patch + + system/base/comar-api/pspec.xml + + + comar-api + + python + pisilinux-python + + + /usr/lib/pisilinux + /usr/lib/python2.7 + + + + + 2016-04-27 + 2.4.9 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-11 + 2.4.9 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + comar + http://www.pisilinux.org + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + service + system.base + Manages system configuration + Sistem yapılandırmasını yönetir + Les programmes Pisi Linux sont mis sous forme de paquets à l'aide de petits scripts. Ces derniers les configure afin qu'ils s'intègrent entre eux et avec le système. Çomar est l'outil qui gère et exécute ces scripts. + Pisi Linux programs are packaged with small scripts which configures them to entegrate with system and each other. Çomar is the tool which manages and executes these scripts. + Pisi Linux yazılımları, birbirleri ve sistemle otomatik olarak uyum sağlayabilmek için yanlarında ufak programcıklar ile paketlenmektedir. Bu programcıkların yönetimi ve işletilmesi Çomar aracı tarafından yapılmaktadır. + Pisi Linux Programme werden mit einem kleinen Skript paketiert, welches sie konfiguriert, um die Integrität mit dem System und anderen Programmen sicherzustellen. Comar ist das Werkzeug, das diese Skripte verwaltet und ausführt. + http://source.pisilinux.org/1.0/comar-3.0.3.tar.bz2 + + dbus-devel + python-devel + cmake + + + run_dir.patch + fix-flags.patch + update-system-manager-model.patch + + system/base/comar/pspec.xml + + + comar + + dbus + python + polkit + dbus-python + + + /usr/bin + /usr/sbin + /etc + /usr/share/dbus-1/system-services + /usr/share/polkit-1/actions + /usr/share/doc/ + /var/db + + + System.Package + + + + + 2016-04-27 + 3.0.3 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-11 + 3.0.3 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + pisi + http://www.pisilinux.org/ + + Marcin Bojara + marcin@pisilinux.org + + GPLv2 + app:console + system.base + PISI is the package management system of Pisi Linux + PİSİ PiSi Linux'un paket yönetim sistemidir + PiSi – menadżer pakietów dla PiSi Linux. + PISI est gestionnaire de paquets moderne implémenté en Python.Ces principales fonctionnalités sont les suivantes : - Les paquets sources sont écrits en XML et en python - Implemente tout les fonctions à travers une API simple d'utilisation - Intègre aussi bien les fonctionnalités de bas niveaux que de haut niveau de gestion de paquets. + PISI is a modern package management system implemented in Python. Some of its main features are: package sources are written in XML and python, implements all functions through a simple-to-use API, integrates low-level and high-level package management features. + PİSİ Python'da yazılmış modern bir paket yöneticisidir. Bazı ana özellikleri: Paket kaynakları XML ve python kullanılarak yazılır, bütün işlevleri kullanması kolay bir API ile sağlar ve düşük ve yüksek seviyeli paket yönetim işlevlerini birleştirir. + PISI jest podstawowym narzędziem do instalacji, aktualizacji i usuwania pakietów. Obsługuje zależności dla poszczególnych pakietów, bibliotek i zadań ÇOMAR-a. Instalacja oprogramowania odbywa się w łatwy i przyjazny sposób. Do przechowywania informacji o pakietach wykorzystuje bazę Berkeley DP, co zapewnia większą stabilność i szybkość. + http://source.pisilinux.org/1.0/pisi-2.6.tar.xz + + pisi.conf-i686 + pisi.conf-x86_64 + + + comar + plyvel + python + gettext + libunwind-devel + intltool + leveldb-devel + + + initialize_filesdb_once.patch + no_clean_if_ignore_comar.patch + orphaned_pkgs.patch + improve_pisi_ix.patch + fix_emul32_flags.patch + pisi-2.6-pisitools.dopixmaps-add.patch + emergeup.patch + fetch.patch + + system/base/pisi/pspec.xml + + + pisi + + tar + file + comar + plyvel + python + gettext + leveldb + piksemel + comar-api + urlgrabber + python-psutil + libunwind + python-pyliblzma + mudur + + + /usr/bin + /usr/sbin + /usr/lib/pardus/pisi + /usr/lib/pisilinux/pisi + /usr/share/locale + /usr/share/doc + /etc/pisi + /usr/share/mime/packages + /usr/lib/tmpfiles.d/pisi.conf + /run/lock/files.ldb/LOCK + /var/lib/pisi/info/files.ldb/LOCK + + + System.Package + System.Manager + + + mirrors.conf + sandbox.conf + pisi.xml + pkgconfig.py + tmpfiles.conf + qt5.py + kde5.py + + + + + 2017-01-22 + 2.6 + Rebuild with new toolchain. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-08-03 + 2.6 + add parameters + PisiLinux Community + admin@pisilinux.org + + + 2016-06-07 + 2.6 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 2.6 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-04-17 + 2.6 First release Ertuğrul Erata ertugrulerata@gmail.com @@ -4985,8 +3274,1316 @@ - libusb - http://libusb.org/ + python-psutil + https://github.com/giampaolo/psutil + + PisiLinux Community + admins@pisilinux.org + + BSD + library + system.base + A cross-platform process utilities module for Python + Platform bağımsız, süreçler hakkında bilgi sağlayan bir Python modülü + python-psutil is a module providing an interface for retrieving information on all running processes and system utilization (CPU, memory) in a portable way by using Python, implementing many functionalities offered by command line tools like ps, top, kill, lsof and netstat. + python-psutil, bütün çalışan süreçler ve sistem kullanımı (MİB - Merkezi İşlem Birim(CPU) ve hafıza gibi) hakkında bilgilere erişimek için arayüz sunan bir Python modülüdür. ps, top, kill, lsof, netstat gibi bir çok komut satırı araçlarının sunduğu işlevselliği sağlamaktadır. + https://github.com/giampaolo/psutil/archive/release-5.0.1.tar.gz + + python-devel + + system/base/python-psutil/pspec.xml + + + python-psutil + + python + + + /usr/lib + /usr/share/doc + + + + + 2017-01-22 + 5.0.1 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 4.0.0 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-02 + 4.0.0 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + libgpg-error + http://www.gnupg.org/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + LGPLv2.1 + library + system.base + Contient les fonctions de gestion d'erreur utilisées par le logiciel GnuPG. + Library for error values used by GnuPG components + GnuPG bileşenlerinin kullandığı hata değerleri için kitaplık + libgpg-error is a library that defines common error values for all GnuPG components. + libgpg-error, tüm GnuPG bileşenleri için ortak olan hata değerlerini tanımlayan bir kitaplıktır. + http://gd.tuwien.ac.at/pub/gnupg/libgpg-error/libgpg-error-1.26.tar.bz2 + system/base/libgpg-error/pspec.xml + + + libgpg-error + + /usr/bin + /usr/lib + /usr/share/doc + /usr/share/info + /usr/share/man + /usr/share/libgpg-error/ + /usr/share/locale + + + + libgpg-error-devel + Development files for libgpg-error + libgpg-error için geliştirme dosyaları + system.devel + + libgpg-error + + + /usr/bin/gpg-error-config + /usr/include + /usr/lib/pkgconfig + /usr/lib32/pkgconfig + /usr/share/aclocal + + + + libgpg-error-32bit + 32-bit shared libraries for libgpg-error + libgpg-error için 32-bit paylaşımlı kitaplıklar + emul32 + emul32 + + libgpg-error + + + /usr/lib32 + + + + + 2017-01-24 + 1.26 + Rebuild + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-12-24 + 1.26 + Version bump. + Stefan Gronewold + groni@pisilinux.org + + + 2016-04-27 + 1.21 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-08 + 1.21 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + pam + http://www.kernel.org/pub/linux/libs/pam/ + + PisiLinux Community + admins@pisilinux.org + + PAM + library + system.base + Modules d'Authentification en Greffon (Pluggable Authentication Modules) + Pluggable Authentication Modules + PAM - Eklenebilir Yetkilendirme Modülleri + PAM (Pluggable Authentication Modules) is a system security tool that allows system administrators to set authentication policy without having to recompile programs that handle authentication. + http://www.linux-pam.org/library/Linux-PAM-1.3.0.tar.bz2 + + dlopen.sh + dlopen-test.sh + + + perl + gettext + cracklib-devel + libxslt-devel + docbook-xsl + + system/base/pam/pspec.xml + + + pam + + cracklib + + + /etc + /lib + /var/run/console + /usr/lib + /sbin + /usr/sbin + /usr/share/doc + /usr/share/man + /usr/share/locale + + + System.Package + + + 90-nproc.conf + + + + pam-devel + Development files for pam + pam için geliştirme dosyaları + system.devel + + pam + + + /usr/include + /usr/share/man/man3 + + + + + 2017-01-24 + 1.3.0 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 1.2.1 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-05 + 1.2.1 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + snappy + http://code.google.com/p/snappy/ + + Alihan Öztürk + alihan@pisilinux.org + + BSD + library + system.base + A fast compressor/decompressor librar + Linux için sıkıştırma/ayıklama kütüphanesidir. + Snappy is a compression/decompression library. It does not aim for maximum compression, or compatibility with any other compression library; instead, it aims for very high speeds and reasonable compression. + Linux için sıkıştırma/ayıklama kütüphanesidir. Yüksek hızda sıkıştırma yapmak için yazılmış bir kütüphanedir. + https://github.com/google/snappy/releases/download/1.1.3/snappy-1.1.3.tar.gz + + lzo-devel + zlib-devel + + + snappy-unittest.patch + + system/base/snappy/pspec.xml + + + snappy + + libgcc + + + /usr/lib + /usr/share/doc + /usr/share + + + + snappy-devel + snappy için geliştirme dosyaları + + snappy + + + /usr/include + + + + + 2017-01-21 + 1.1.3 + Rebuild with new toolchain. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 1.1.3 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-02 + 1.1.3 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + tcp-wrappers + http://ftp.porcupine.org/pub/security/index.html + + PisiLinux Community + admins@pisilinux.org + + BSD + app:console + system.base + TCP Wrappers + TCP Wrappers + Avec ce paquet, vous pouvez surveiller et filtrer les requêtes entrante pour les services réseaux SYSTAT, FINGER, FTP, TELNET, RLOGIN, RSH, EXEC, TFTP, TALK et autres. Il supporte à la fois les canaux de communication (sockets) de type 4.3BSD et TLI de type System V.4. + With this package you can monitor and filter incoming requests for the SYSTAT, FINGER, FTP, TELNET, RLOGIN, RSH, EXEC, TFTP, TALK, and other network services. It supports both 4.3BSD-style sockets and System V.4-style TLI. + Bu paket ile birlikte SYSTAT, FINGER, FTP, TELNET, RLOGIN, RSH, EXEC, TFTP, TALK ve diğer ağ servisleri için gelen istekleri izleyebilir ve süzebilirsiniz. Program 4.3BSD-tipi soketler ve System V.4-tipi TLI'ın ikisini de destekler. + http://ftp.porcupine.org/pub/security/tcp_wrappers_7.6.tar.gz + + sed + + + Makefile-Pisi.patch + tcp-wrappers-7.6-makefile.patch + tcp_wrappers-7.6-ldflags.patch + 01_all_redhat-bug11881.patch + 02_all_redhat-bug17795.patch + 03_all_wildcard.patch + 04_all_fixgethostbyname.patch + 07_all_sig.patch + 08_all_strerror.patch + 09_all_gcc-3.4.patch + 10_all_more-headers.patch + tcp-wrappers-7.6-ipv6-1.14.diff + tcp-wrappers-7.6-shared.patch + host.allow.example.patch + match-port.patch + + system/base/tcp-wrappers/pspec.xml + + + tcp-wrappers + + /usr/sbin + /usr/lib + /lib + /etc + /usr/share/man + /usr/share/doc + + + hosts.allow + hosts.deny + + + + tcp-wrappers-devel + Development files for tcp-wrappers + tcp-wrappers için geliştirme dosyaları + system.devel + + tcp-wrappers + + + /usr/include + /usr/share/man/man3 + + + + + 2017-01-28 + 7.6 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 7.6 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 7.6 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + readline + http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + library + system.base + Another cute console display library + Diğer bir şirin konsol gösterim kütüphanesi + La librairie GNU Readline fourni un ensemble de fonctions utilisables par des applications permettant aux utilisateurs d'éditer les lignes de commandes en cours de frappe. Les modes d'éditions Emacs et vi sont disponibles. La librairie Readline inclus des fonctions supplémentaires de mémorisation de la liste de commandes entrées précédemment, afin de le rappeler et éventuellement les rééditer, ainsi que l'expansion d'historiques de commandes précédentes à la mode csh. + The GNU Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in. Both Emacs and vi editing modes are available. The Readline library includes additional functions to maintain a list of previously-entered command lines, to recall and perhaps reedit those lines, and perform csh-like history expansion on previous commands. + GNU Readline kütüphanesi uygulamalara sanki kullanıcılar kendileri yazıyormuş gibi komut satırı girişlerini düzenleme imkanı veren işlev setini sunar. Readline kütüphanesi daha önce girilmiş bir komut satırları listesini düzenleme, tekrar çağırma ve belki de bu satırları tekrar düzenleme ve csh tipi geçmiş bilgisi genişletmelerindeki önceki komutları yürütme imkanı sağlayan ek işlevler sağlar. + mirrors://gnu/readline/readline-7.0.tar.gz + + ncurses-devel + + system/base/readline/pspec.xml + + + readline + + ncurses + + + /usr/lib + /usr/share/doc + /usr/share/man + /usr/share/info + + + + readline-devel + Development files for readline + readline için geliştirme dosyaları + system.devel + + readline + + + /usr/include + /usr/share/man/man3 + + + + readline-32bit + 32-bit shared libraries for readline + readline için 32-bit paylaşımlı kitaplıklar + emul32 + emul32 + + ncurses-32bit + + + readline + ncurses-32bit + + + /usr/lib32 + + + + + 2017-01-07 + 7.0 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 6.3 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-02-29 + 6.3 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + libffi + http://sourceware.org/libffi + + PisiLinux Community + admins@pisilinux.org + + BSD + library + system.base + A portable foreign function interface library + Yabancı işlev arayüzleri için taşınabilir bir kitaplık + The libffi library provides a portable, high level programming interface to various calling conventions. + libffi kitaplığı, çeşitli işlev çağırma konvansiyonları için taşınabilir ve yüksek düzeyli bir programlama arayüzü sunar. + ftp://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz + system/base/libffi/pspec.xml + + + libffi + + /usr/lib/libffi.* + /usr/share/doc + + + + libffi-devel + Development files for libffi + libffi için geliştirme dosyaları + system.devel + + libffi + + + /usr/lib/libffi-* + /usr/lib/pkgconfig + /usr/lib32/pkgconfig + /usr/share/info + /usr/share/man + + + + libffi-32bit + 32-bit shared libraries for libffi + libffi için 32-bit paylaşımlı kitaplıklar + emul32 + emul32 + + libffi + + + /usr/lib32/libffi.* + /usr/lib32/libffi-* + + + + + 2017-01-07 + 3.2.1 + Rebuild with new toolchain. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 3.2.1 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-01 + 3.2.1 + First release + Yusuf Aydemir + yusuf.aydemir@pisilinux.org + + + + + + man-pages + http://www.win.tue.nl/~aeb/linux/man/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + data:doc + system.base + Une collection de pages de manuel Linux compréhensibles d'une certaine manière. + A somewhat comprehensive collection of Linux man pages + Kapsamlı Linux kılavuz dökümanları + A large collection of man pages (documentation) from the Linux Documentation Project (LDP). + https://www.kernel.org/pub/linux/docs/man-pages/man-pages-4.09.tar.xz + http://www.kernel.org/pub/linux/docs/man-pages/man-pages-posix/man-pages-posix-2003-a.tar.xz + system/base/man-pages/pspec.xml + + + man-pages + + man-db + + + /usr/share/doc + /usr/share/man + + + man1/getent.1 + man1/sprof.1 + + + + + 2017-01-24 + 4.09 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 4.04 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-09 + 4.04 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + libunistring + http://www.gnu.org/software/libunistring + + PisiLinux Community + admins@pisilinux.org + + GPLv3 + LGPLv3 + library + system.base + Unicode string library + Unicode karakter dizisi kitaplığı + This library provides functions for manipulating Unicode strings and for manipulating C strings according to the Unicode standard. + Bu kitaplığı unicode standartına göre unicode ve C karakter dizilerinde değişiklik yapmak için kullanılabilecek fonksiyonlar sunar. + mirrors://gnu/libunistring/libunistring-0.9.7.tar.gz + system/base/libunistring/pspec.xml + + + libunistring + + /usr/lib + /usr/share/doc + /usr/share/info + + + + libunistring-devel + Development files for libunistring + libunistring için geliştirme dosyaları + system.devel + + libunistring + + + /usr/include + + + + + 2017-01-08 + 0.9.7 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 0.9.6 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-08 + 0.9.6 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + baselayout + http://www.pisilinux.org + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + library + data + system.base + Filesystem baselayout + Dosya sisteminin temel planı + Ce paquet crée la hiérarchie du système de fichier principal de Pisi Linux. + baselayout creates the Pisi Linux Linux main filesystem hierarchy. + Bu paket, Pisi Linux dosya sisteminin temelini oluşturur. + http://source.pisilinux.org/1.0/baselayout-3.10.0.tar.gz + system/base/baselayout/pspec.xml + + + baselayout + + pypolkit + + + /bin + /sbin + /lib* + /etc + /etc/pisilinux-release + /media + /boot + /proc + /home + /mnt + /opt + /dev + /run + /sys + /srv + /tmp + /usr + /var + /usr/lib/tmpfiles.d/baselayout.conf + + + System.PackageHandler + System.Package + User.Manager + Network.Stack + + + baselayout.conf + services + protocols + sysctl.conf + pisilinux-release + start-stop-daemon.8 + + + + + 2016-04-27 + 3.10.0 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-06 + 3.10.0 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + gperf + http://www.gnu.org/software/gperf/gperf.html + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + system.base + A perfect hash function generator + Mükemmel hash üreticisi + gperf is a perfect hash function generator. For a given list of strings, it produces a hash function and hash table, in form of C or C++ code, for looking up a value depending on the input string. The hash function is perfect, which means that the hash table has no collisions, and the hash table lookup needs a single string comparison only. + gperf mükemmel hash fonksiyonu üretecidir. Verilen bir katar listesi için C ve C++ kodu biçiminde bir hash fonksiyonu ve hash tablosu üretir. + GNU gperf es un generador de perfect hash. Produce una función hash y una tabla hash a base de una lista de cadenas, en forma de código C o C++ , para revisar valores dependiendo de una cadena de entrada. La función de hash es perfecta, lo que quiere decir que no hay colisiones en la tabla de hash, y para la búsqueda en la tabla hash se necesita solamente una comparación. + mirrors://gnu/gperf/gperf-3.1.tar.gz + system/base/gperf/pspec.xml + + + gperf + + libgcc + + + /usr/bin + /usr/share/doc + /usr/share/info + /usr/share/man + + + + + 2017-01-29 + 3.1 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 3.0.4 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-05 + 3.0.4 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + mailcap + http://git.fedorahosted.org/git/mailcap.git + + PisiLinux Community + admins@pisilinux.org + + MIT + public-domain + data + system.base + Helper application and MIME type associations for file types + Dosya türleri için yardımcı uygulama ve MIME türü ilişkilendirmeleri + mailcap file is used by the metamail program. Metamail reads the mailcap file to determine how it should display non-text or multimedia material. + mailcap dosyası metamail ve bazı diğer uygulamalar tarafından, metin olmayan dosyaların ya da çokluortam dosyalarının nasıl açılacağını keşfetmek için kullanılır. + https://fedorahosted.org/released/mailcap/mailcap-2.1.45.tar.xz + + extend-mailcap.patch + + system/base/mailcap/pspec.xml + + + mailcap + + /etc + /usr/share/doc + /usr/share/man + + + + + 2016-04-27 + 2.1.45 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-06 + 2.1.45 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + run-parts + http://packages.qa.debian.org/d/debianutils.html + + PisiLinux Community + osman.erkan@yandex.com + + GPLv2+ + system.base + run scripts or programs in a directory + run scripts or programs in a directory + https://sources.archlinux.org/other/run-parts/debianutils_4.8.1.tar.xz + system/base/run-parts/pspec.xml + + + run-parts + + /usr/share/man + /usr/bin + /usr/sbin + + + + + 2017-01-23 + 4.8.1 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 4.7 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-03 + 4.7 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + attr + http://acl.bestbits.at/ + + Pisi Linux Admins + admins@pisilinux.org + + LGPLv2.1 + app:console + library + system.base + Utilities for managing filesystems extended attributes + Gelişkin öznitelikler araçları + attr offre des utilitaires qui servent à manipuler les attributs étendus des objects de système de fichier. + attr contains a set of tools for manipulating extended attributes on filesystem objects, in particular getfattr and setfattr. + attr dosya sistemi nesnelerinin özniteliklerini değiştirmek için gerekli bir dizi araç sunar. + http://download.savannah.gnu.org/releases-noredirect/attr/attr-2.4.47.src.tar.gz + system/base/attr/pspec.xml + + + attr + + /bin + /lib + /usr/share/locale + /usr/share/doc + /usr/share/man + + + + attr-devel + Development files for attr + attr için geliştirme dosyaları + system.devel + + attr + + + /usr/include + /usr/share/man/man3 + + + + attr-32bit + 32-bit shared libraries for attr + emul32 + emul32 + + attr + + + /lib32 + + + + + 2017-01-02 + 2.4.47 + Rebuild with new toolchain. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 2.4.47 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-01 + 2.4.47 + First release + Serdar Soytetir + kaptan@pisilinux.org + + + + + + which + http://www.xs4all.nl/~carlo17/which/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + system.base + Prints the location of specified executable in your path + Verilen komutun çalıştırma yolundaki önceliğe göre yerini gösterir + which, localise un programme dans le chemin de l'utilisateur. + which , Locates a program file in the user's path. + which, kullanıcı dizinindeki program dosyalarının yarini bulur. + which, findet eine Anwendungsdatei im Benutzerverzeichnis + mirrors://gnu/which/which-2.21.tar.gz + system/base/which/pspec.xml + + + which + + /usr/bin + /usr/share/doc + /usr/share/man + /usr/share/info + + + + + 2017-01-23 + 2.21 + Rebuild. + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 2.21 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-02 + 2.21 + First release + Ayhan Yalçınsoy + ayhanyalcinsoy@pisilinux.org + + + + + + gperftools + http://code.google.com/p/gperftools/ + + PisiLinux Community + admins@pisilinux.org + + BSD + library + app:console + system.base + Google Performance Tools + Google Performans Araçları + Perf Tools is a collection of a high-performance multi-threaded malloc() implementation, plus some pretty nifty performance analysis tools. + gperftools yüksek performanslı ve yararlı performans analizi araçları içerir. + https://github.com/gperftools/gperftools/releases/download/gperftools-2.5/gperftools-2.5.tar.gz + + libunwind-devel + + system/base/gperftools/pspec.xml + + + gperftools + + libunwind + libgcc + + + /usr/bin + /usr/lib + /usr/share/doc/gperftools/COPYING + /usr/share/man + + + + gperftools-devel + Development headers for gperftools + gperftools için geliştirme başlıkları + gperftools-devel provides development headers for gperftools. + gperftools için geliştirme başlıklarını içerir. + library + + gperftools + + + /usr/include + /usr/lib/pkgconfig + + + + gperftools-docs + Documentation files for gperftools + gperftools için belgelendirme dosyaları + gperftools-docs provides documentation files for gperftools. + gperftools için belgelendirme dosyalarını içerir. + data:doc + system.doc + + gperftools + + + /usr/share/doc/gperftools + + + + + 2017-01-21 + 2.5 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 2.4 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-02 + 2.4 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + libcap-ng + http://people.redhat.com/sgrubb/libcap-ng + + PisiLinux Community + admins@pisilinux.org + + LGPLv2+ + library + system.base + An alternate POSIX capabilities library + Alternatif bir POSIX yetenekleri kütüphanesi + libcap-ng is a library that makes using POSIX capabilities easier. + libcap-ng POSIX yeteneklerinin yönetimini kolaylaştıran bir kütüphanedir. + http://people.redhat.com/sgrubb/libcap-ng/libcap-ng-0.7.8.tar.gz + + attr-devel + python-devel + + system/base/libcap-ng/pspec.xml + + + libcap-ng + + /usr/lib + /usr/share/doc + + + + python-libcap-ng + Python bindings for libcap-ng + Python için libcap-ng bağlayıcıları + programming.language.python + + libcap-ng + + + /usr/lib/python* + + + + libcap-ng-utils + Utilities to analyse the POSIX capabilities on running processes + Çalışan süreçlerin sahip olduğu POSIX yeteneklerini incelemeye yarayan araçlar + util.admin + + libcap-ng + + + /usr/bin + /usr/share/man/man8/* + + + + libcap-ng-devel + Development files for libcap-ng + libcap-ng için geliştirme dosyaları + system.devel + + libcap-ng + + + /usr/share/aclocal + /usr/include + /usr/lib/pkgconfig + /usr/share/man/man3 + + + + + 2017-01-25 + 0.7.8 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 0.7.7 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-03 + 0.7.7 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + xz + http://tukaani.org/xz/ + + PisiLinux Community + admins@pisilinux.org + + LGPLv2+ + GPLv2+ + GPLv3 + app:console + library + system.base + XZ compression utilities + XZ sıkıştırma araçları + XZ Utils provide a general purpose data compression library and command line tools. The .xz format supports multiple compression algorithms, which are called "filters" in context of XZ Utils. The primary filter is currently LZMA2. + xz, genel amaçlı bir veri sıkıştırma kütüphanesi ve konut satırı araçları içerir. xz dosya biçimi filtre adı verilen sıkıştırma algoritmalarını destekler, öntanımlı filtre ise LZMA2 algoritmasıdır. + http://tukaani.org/xz/xz-5.2.3.tar.xz + system/base/xz/pspec.xml + + + xz + + /usr/bin + /usr/lib + /usr/share/man + /usr/share/doc + /usr/share/locale + + + + xz-devel + Development files for XZ + XZ için geliştirme dosyaları + system.devel + + xz + + + /usr/include + /usr/lib/pkgconfig + /usr/lib32/pkgconfig + + + + xz-32bit + 32bit shared libraries for xz + XZ için 32-bit paylaşımlı kitaplıklar + emul32 + emul32 + + xz + + + /usr/lib32 + + + + + 2017-01-07 + 5.2.3 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 5.2.2 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-02-28 + 5.2.2 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + nettle + http://www.gnu.org PisiLinux Community admins@pisilinux.org @@ -4994,89 +4591,1087 @@ LGPLv2.1 library system.base - Userspace access to USB devices - Project's main aim is to create a library for use by user level applications to access USB devices regardless of OS. - https://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.20/libusb-1.0.20.tar.bz2 + The Nettle package contains the low-level cryptographic library. + Nettle - biblioteka kryptograficzna. + The Nettle package contains the low-level cryptographic library that is designed to fit easily in many contexts. + ftp://ftp.gnu.org/gnu/nettle/nettle-3.2.tar.gz - eudev-devel + gmp-devel - system/base/libusb/pspec.xml + system/base/nettle/pspec.xml - libusb + nettle - eudev + gmp /usr/bin /usr/lib + /usr/share/info /usr/share/doc - - libusbx - - - libusbx - - libusb-devel - Development files for libusb + nettle-devel + Nettle için geliştirme dosyaları + nettle için geliştirme dosyaları. + Pliki nagłówkowe biblioteki nettle. + + nettle + + + /usr/include + /usr/lib/pkgconfig/nettle.pc + /usr/lib/pkgconfig/hogweed.pc + /usr/lib32/pkgconfig/nettle.pc + /usr/lib32/pkgconfig/hogweed.pc + + + + nettle-32bit + 32-bit shared libraries for nettle + emul32 + emul32 + + gmp-32bit + + + nettle + gmp-32bit + + + /usr/lib32/ + + + + + 2016-04-27 + 3.2 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-09 + 3.2 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + kmod + http://git.kernel.org/?p=utils/kernel/kmod/kmod.git;a=summary + + PisiLinux Community + admins@pisilinux.org + + GPLv2+ + app:console + system.base + Linux kernel module management utilities + Linux kernel modülleri yönetim araçları + Linux kernel module management utilities + Linux kernel modülleri yönetim araçları + https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-23.tar.xz + + chrpath + xz-devel + zlib-devel + kernel-module-headers + + + kmod-15-dynamic-kmod.patch + + system/base/kmod/pspec.xml + + + kmod + + xz + zlib + glibc + libkmod + + + /usr/bin + /bin + /sbin + /usr/share/man + /usr/share/doc + /etc + /usr/share/bash-completion/completions/kmod + + + Boot.Modules + System.PackageHandler + + + blacklist/blacklist.conf + blacklist/blacklist-firewire.conf + blacklist/blacklist-framebuffer.conf + blacklist/blacklist-watchdog.conf + modprobe.conf + depmod.conf + depmod-search.conf + + + + libkmod-devel system.devel - libusb + libkmod + + + /usr/include + /usr/lib/pkgconfig + /usr/lib32/pkgconfig + + + + libkmod + kmod libraries + + xz + zlib + + + /usr/lib + + + + libkmod-32bit + 32bit libraries of libkmod + emul32 + emul32 + + xz-32bit + zlib-32bit + + + xz-32bit + zlib-32bit + + + /usr/lib32 + + + + + 2017-01-25 + 23 + Rebuild. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-08-09 + 23 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 22 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-05 + 22 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + v86d + http://dev.gentoo.org/~spock/projects/uvesafb/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + service + system.base + Userspace helper for uvesafb + uvesafb için kullanıcı uzayı yardımcısı + Program pomocniczy uvesafb uruchamiający kod x86 w emulowanym środowisku + v86d is a userspace helper that runs x86 code in an emulated environment. It is used by the kernel framebuffer driver uvesafb. + v86d, öykünmüş bir ortamda x86 kodu çalıştıran yardımcı bir kullanıcı uzayı yardımcısıdır. Çekirdekteki uvesafb framebuffer sürücüsü tarafından kullanılır. + v86d to działający w przestrzeni użytkownika program pomocniczy uruchamiający kod x86. Jest wykorzystywany przez sterownik jądra Linuksa uvesafb. + http://source.pisilinux.org/1.0/v86d-0.1.10.tar.bz2 + system/base/v86d/pspec.xml + + + v86d + + /sbin + /usr/share/doc + + + + + 2016-04-27 + 0.1.10 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-05 + 0.1.10 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + python + http://www.python.org/ + + PisiLinux Community + admins@pisilinux.org + + PSF-2.2 + app:console + system.base + An interpreted, interactive, object-orientated programming language + Nesneye yönelik bir programlama dili + Python est un langage de programmation dynamique orienté objet pouvant être utilisé pour différents types de développements logiciels. Il offre une intégration renforcée aussi bien avec les autres langages qu'avec des outils. Il est livré avec des librairies standards couvrant un large périmètre et peut être appris en quelques jours. + Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. + Python, yazılım geliştirmenin birçok aşamasında kullanılabilen, dinamik nesne tabanlı bir programlama dilidir. Diğer programlama dilleriyle bütünleşme için sağlam bir destek sunar, kapsamlı standart kütüphanelerle sunulur ve birkaç günde öğrenilebilir. + http://www.python.org/ftp/python/2.7.13/Python-2.7.13.tar.xz + + bzip2 + gdbm-devel + zlib-devel + expat-devel + libffi-devel + sqlite-devel + ncurses-devel + openssl-devel + readline-devel + + + pisilinux_platform.patch + add-pisilinux-to-search-path.patch + default-utf8.patch + disable-egginfo.patch + trfix_emaillib.patch + + system/base/python/pspec.xml + + + python + + noDelta + + + gdbm + zlib + bzip2 + expat + libffi + sqlite + ncurses + openssl + readline + + + /etc + /usr/bin + /usr/include/python2.7/pyconfig.h + /usr/lib + /usr/share/doc + /usr/share/man + + + System.PackageHandler + + + pythonstart + 04python + + + + python-devel + Development files for python + python için geliştirme dosyaları + system.devel + + python + + + /usr/include + /usr/lib/pkgconfig + + + + + 2017-01-08 + 2.7.13 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 2.7.11 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-02 + 2.7.11 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + fuse + http://fuse.sourceforge.net + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + library + system.base + Interface implémentée dans l'environnement utilisateur (userpace) pour les systèmes de fichier. + An interface for filesystems implemented in userspace + Kullanıcı düzeyinde dosya sistemi oluştumaya yarayan kitaplık + Una interfaz para sistemas de archivos implementados en el espacio de usuario + fuse is a backend allowing regular users to (un)mount filesystems for their own use. + FUSE, kullanıcıların kendileri için dosya sistemleri oluşturmasına, bağlamasına ve bağı koparmasına imkân veren bir arkauç kitaplıktır. + https://github.com/libfuse/libfuse/archive/fuse-2.9.7.tar.gz + + gettext-devel + + + skip_umount_test.patch + + system/base/fuse/pspec.xml + + + fuse + + glibc + + + /bin + /sbin + /usr/bin + /lib + /usr/share/doc + /usr/share/man + + + + fuse-devel + Development files for fuse + fuse için geliştirme dosyaları + system.devel + + fuse + + + /usr/include + /usr/lib/pkgconfig + + + + + 2017-01-29 + 2.9.7 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 2.9.5 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2015-08-18 + 2.9.5 + First release + Ayhan Yalçınsoy + ayhanyalcinsoy@pisilinux.org + + + + + + miscfiles + http://freshmeat.net/projects/miscfiles/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + data + system.base + Fichiers divers. + Miscellaneous files + Çeşitli dosyalar + Verschiedene Dateien + miscfiles is a collection of data files for freely available information, like airport, country, currencies, city information, and codes. It also includes the Unicode character database. + miscfiles havalanı, ülke, para birimi, şehir bilgisi ve kodları gibi bir çok ulaşılabilir bilgiyi veri dosyaları halinde tutmaktadır. + http://ftp.gnu.org/gnu/miscfiles/miscfiles-1.5.tar.gz + system/base/miscfiles/pspec.xml + + + miscfiles + + /usr/share/doc + /usr/share/rfc + /usr/share/dict + /usr/share/misc + + + + + 2016-04-27 + 1.5 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-03 + 1.5 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + psmisc + http://psmisc.sourceforge.net/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + system.base + A set of tools that use the proc filesystem + proc dosya sistemi kullanan bir araç takımı + PSmisc est une collection de petits utilitaires utilisant le système de fichier /proc, et assiste l'administrateur système dans ses tâches habituelles. + PSmisc is a collection of small utilities using /proc file system, and providing the system administrator with some help in common tasks. + PSmisc, /proc dosya sistemini kullanan küçük araçlar yardımıyla sistem yöneticisine bazı genel görevlerde yardımcı olmayı amaçlar. + PSmisc ist eine Sammlung von kleinen Anwendungen, die das /proc Dateisystem verwenden und dem System Administrator Hilfe für gängige Aufgaben bieten. + mirrors://sourceforge/psmisc/psmisc-22.21.tar.gz + + ncurses-devel + gettext + + + psmisc-fuser.patch + + system/base/psmisc/pspec.xml + + + psmisc + + ncurses + + + /bin + /usr/bin + /usr/share/man + /usr/share/doc + /usr/share/locale + + + + + 2016-04-27 + 22.21 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-09 + 22.21 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + urlgrabber + http://urlgrabber.baseurl.org/ + + PisiLinux Community + admins@pisilinux.org + + LGPLv2.1 + library + system.base + High level cross-protocol url-grabber library for Python + Python için yüksek seviyeli, platform bağımsız bir url-grabber kütüphanesi + urlgrabber provides a clean library interface to protocol-independant file-access for Python programs + urlgrabber Python uygulamaları için protokol bağımsız dosya erişimi sağlayan temiz bir kütüphanedir. + http://urlgrabber.baseurl.org/download/urlgrabber-3.10.1.tar.gz + + python + + system/base/urlgrabber/pspec.xml + + + urlgrabber + + python + pycurl + + + /usr/lib + /usr/libexec + /usr/share/doc + + + + + 2017-01-22 + 3.10.1 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 3.10.1 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-02 + 3.10.1 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + gettext + http://www.gnu.org/software/gettext/gettext.html + + PisiLinux Community + admins@pisilinux.org + + GPLv3+ + app:console + library + system.base + GNU libraries and utilities for producing multi-lingual messages + Farklı dillerde ileti katalogları üretmek için gerekli GNU araçları ve kütüphaneleri + gettext est une librairie d'internationalisation GNU. + The GNU gettext package provides a set of tools and documentation for producing multi-lingual messages in programs. Tools include a set of conventions about how programs should be written to support message catalogs, a directory and file naming organization for the message catalogs, a runtime library which supports the retrieval of translated messages, and stand-alone programs for handling the translatable and the already translated strings. Gettext provides an easy to use library and tools for creating, using, and modifying natural language catalogs and is a powerful and simple method for internationalizing programs. + gettext, uygulamalarda farklı dillerde iletiler kullanılmasını sağlayan yerelleştirme araçları ve kütüphanelerini içerir. + gettext ist eine GNU Bibliothek für Internationalisierung + http://ftp.gnu.org/pub/gnu/gettext/gettext-0.19.8.1.tar.gz + + acl-devel + glib2-devel + ncurses-devel + libunistring-devel + libxml2-devel + + system/base/gettext/pspec.xml + + + gettext-docs + system.doc + + gettext + + + /usr/share/doc/gettext/html + + + + gettext + + acl + glib2 + ncurses + libgcc + libunistring + libgomp + libxml2 + + + /usr/bin + /usr/lib + /usr/share/gettext + /usr/share/locale + /usr/share/info + /usr/share/man + /usr/share/doc + + + + gettext-devel + Development files for gettext + gettext için geliştirme dosyaları + system.devel + + gettext + + + /usr/share/aclocal + /usr/include + /usr/share/man/man3 + + + + + 2017-01-08 + 0.19.8.1 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 0.19.7 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-02-28 + 0.19.7 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + libidn + http://www.gnu.org/software/libidn + + PisiLinux Community + admins@pisilinux.org + + LGPLv2.1 + GPLv3 + app:console + library + system.base + Internationalized Domain Names (IDN) implementation + Uluslararası Alan Adları (IDN) destek kütüphanesi + GNU Libidn est une implémentation de Stringprep, Punycode et des spécifications IDNA définies par le groupe de travail Internationalized Domain Names (IDN) de l'IETF servant pour les noms de domaines internationalisés. La librairie C est disponible sous la Licence Publique Générale Lesser. + GNU Libidn is an implementation of the Stringprep, Punycode and IDNA specifications defined by the IETF Internationalized Domain Names (IDN) working group, used for internationalized domain names. The C library is available under the GNU Lesser General Public License. + GNU Libidn, IETF Uluslararasılaştırılmış Domain Adları (IDN) çalışma grubu tarafından tanımlanmış Stringgrep, Punycode ve IDNA tariflerinin bir uygulamasıdır, uluslararası domain adlarının kullanımına olanak sağlar. C kütüphanesi GNU Lesser General Public License altında sağlanabilir. + http://ftp.gnu.org/gnu/libidn/libidn-1.33.tar.gz + system/base/libidn/pspec.xml + + + libidn + + /usr/bin + /usr/lib/libidn* + /usr/share/emacs + /usr/share/locale + /usr/share/man/man1 + /usr/share/info + /usr/share/doc + + + + libidn-devel + Development files for libidn + libidn için geliştirme dosyaları + system.devel + + libidn /usr/include /usr/lib/pkgconfig /usr/lib32/pkgconfig + /usr/share/man/man3 - - libusbx-devel - - - libusbx-devel - - libusb-32bit - 32-bit shared libraries for libusb + libidn-32bit + 32-bit shared libraries for libidn + libidn için 32-bit paylaşımlı kitaplıklar emul32 emul32 - - eudev-32bit - - libusb - eudev-32bit + libidn - /usr/lib32 + /usr/lib32/libidn* - - libusbx-32bit - - - libusbx-32bit - + + 2017-01-22 + 1.33 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + 2016-04-27 - 1.0.20 + 1.32 Release Bump PisiLinux Community admin@pisilinux.org 2016-03-08 - 1.0.20 + 1.32 First release Alihan Öztürk alihan@pisilinux.org + + + unzip + ftp://ftp.info-zip.org/pub/infozip/UnZip.html + + Pisi Gnu/Linux Community + cpisimail@yandex.com + + Info-ZIP + app:console + system.base + Unzipper for pkzip-compressed files + pkzip ile sıkıştırılmış dosyalar için açıcı + Unzip nous permet d'extraires des archives compressées aux format .zip (également appelées "fichiers zip"). + UnZip enables us to extract archives compressed in .zip format (also called "zipfiles"). + UnZip, zip formatında sıkıştırılmış dosyaları açmamızı sağlar. + mirrors://sourceforge/infozip/unzip60.zip + + bzip2 + bash + + + overflow-fsize.patch + cve20149636.patch + test_compr_eb.patch + getZip64Data.patch + crc32.patch + empty-input.patch + csiz-underflow.patch + nextbyte-overflow.patch + + system/base/unzip/pspec.xml + + + unzip + + bzip2 + bash + + + /usr/bin + /usr/share/doc + /usr/share/man + + + + + 2017-01-23 + 60 + Rebuild. + Pisi Gnu/Linux Community + cpisimail@yandex.com + + + 2016-12-17 + 60 + Version Bump. + Pisi Gnu/Linux Community + cpisimail@yandex.com + + + 2016-12-17 + 610b + Rebuild. + Pisi Gnu/Linux Community + cpisimail@yandex.com + + + 2016-07-26 + 610b + First Release + Pisi Gnu/Linux Community + cpisimail@yandex.com + + + + + + grep + http://www.gnu.org/software/grep/grep.html + + PisiLinux Community + admins@pisilinux.org + + GPLv3 + app:console + system.base + GNU regular expression matcher + Grep düzenli ifade eşleme aracı + La commande grep recherche dans un ou plusieurs fichiers les lignes correspondant à un motif défini. Par défaut grep affiche les lignes éligibles. + The grep command searches one or more input files for lines containing a match to a specified pattern. By default, grep prints the matching lines. + Grep komutu bir veya daha fazla verilen dosyada aranan parçayı bulmaya yarayan bir programdır. Ön tanımlı olarak grep eşleşen satırları çıktıya verir. + ftp://mirrors.kernel.org/gnu/grep/grep-2.27.tar.xz + + gettext + libpcre-devel + + system/base/grep/pspec.xml + + + grep + + libpcre + + + /bin + /usr/share/doc + /usr/share/man + /usr/share/info + /usr/share/locale + + + + + 2017-01-07 + 2.27 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 2.23 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-02-28 + 2.23 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + biosdevname + http://linux.dell.com/biosdevname/ + + Serdar Soytetir + kaptan@pisilinux.org + + GPLv2 + app:gui + system.base + Biosdevname is a udev helper utility developed + Biosdevname is a udev helper utility developed by Dell and released under the GNU General Public License (GPL). It provides a consistent naming mechanism for network devices based on their physical location as suggested by the system BIOS. + http://linux.dell.com/biosdevname/biosdevname-0.7.2/biosdevname-0.7.2.tar.gz + + pciutils-devel + glibc-devel + zlib-devel + + system/base/biosdevname/pspec.xml + + + biosdevname + + pciutils + + + /sbin + /lib/udev/rules.d + /usr/sbin + /usr/share/doc + /usr/share/man + + + + + 2017-01-29 + 0.7.2 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 0.7.1 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-06 + 0.7.1 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + sed + http://sed.sourceforge.net/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + system.base + GNU Stream Editor + GNU stream düzenleyici + Sed est un éditeur de flux. Un éditeur de flux est utilisé pour réaliser des opérations basiques de modification de texte sur un flux d'entrée (un fichier ou un tuyau unix). + Sed is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline). + Sed bir dosyadan veya standart girdiden (klavyeden) bilgi okur ve standart çıktıya (ekrana) okuduğu bilgileri kullanıcının belirlediği düzene sokarak yazar. + mirrors://gnu/sed/sed-4.3.tar.xz + + gettext + attr-devel + acl-devel + + system/base/sed/pspec.xml + + + sed + + acl + + + /bin + /usr/bin + /usr/share/doc + /usr/share/man + /usr/share/info + /usr/share/locale + + + + + 2017-01-23 + 4.3 + Version Bump. + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 4.2.2 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-02-28 + 4.2.2 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + cpio + http://www.gnu.org/software/cpio/cpio.html + + PisiLinux Community + admins@pisilinux.org + + GPLv3 + app:console + system.base + A file archival tool which can also read and write tar files + Tar ve cpio dosyaları içine yazıp okuyabilen bir dosya arşivleme uygulaması + GNU cpio permet de copier des fichiers du système dans une archive cpio ou tar et vice-versa. L'archive peut être un simple fichier sur le disque, une cassette magnétique, ou un tuyau unix (pipe). GNU cpio gère les formats d'archive suivant : binaire, ASCII ancien, ASCII nouveau, crc, binaire HPUX, ASCII ancien HPUX, tar ancien et tar POSIX.1. + GNU cpio copies files into or out of a cpio or tar archive. The archive can be another file on the disk, a magnetic tape, or a pipe. GNU cpio supports the following archive formats: binary, old ASCII, new ASCII, crc, HPUX binary, HPUX old ASCII, old tar, and POSIX.1 tar. + GNU cpio dosyaları cpio veya tar arşivlerine kopyalamaya veya bu arşivlerden çıkarmak için tasarlanmıştır. Arşiv diskteki başka bir dosya, manyetik bir teyp veya bir boru sistemi olabilir. GNU cpio şu arşiv formatlarını destekler: ikili, eski ASCII, yeni ASCII, crc, HPUX ikili, HPUX eski ASCII, eski tar ve POSIX.1 tar. + mirrors://gnu/cpio/cpio-2.12.tar.bz2 + + cpio-2.9-exitCode.patch + CVE-2010-0624-rpatelib-overflow.patch + + system/base/cpio/pspec.xml + + + cpio + + /bin + /usr/share/doc + /usr/share/man + /usr/share/info + /usr/share/locale + + + + + 2017-01-23 + 2.12 + Reubild. + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 2.12 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-01 + 2.12 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + glibc @@ -6885,67 +7480,77 @@ - lzo - http://www.oberhumer.com/opensource/lzo/ + net-tools + http://sites.inka.de/lina/linux/NetTools/ PisiLinux Community admins@pisilinux.org GPLv2 - library + app:console system.base - An extremely fast compression and decompression library - Çok hızlı bir sıkıştırma/açma kütüphanesi - lzo is a library with very high compression and decompression speeds and very small memory usage. Provides low compression ratios but very high speeds. - lzo hızlı bir sıkıştırma/açma kütüphanesidir. Düşük sıkıştırma oranları verir fakat hem sıkıştırma hem açma işleminde bellek kullanımı çok düşüktür ve işlem hızı yüksektir. - http://www.oberhumer.com/opensource/lzo/download/lzo-2.09.tar.gz - system/base/lzo/pspec.xml + Standard Linux networking tools + Linux ağ araçları + net-tools est une collection de programmes représentant les outils réseau de base du système d'exploitation Linux. S'y trouvent arp, hostname, ifconfig, ipmaddr, iptunnel, mii-tool, nameif, netstat, plipconfig, rarp, route et slattach. + net-tools is a collection of programs that form the base set of the networking tools for the Linux operating system. It includes arp, hostname, ifconfig, ipmaddr, iptunnel, mii-tool, nameif, netstat, plipconfig, rarp, route and slattach. + Net-tools, Linux işletim sisteminde kullanılan ağ ile ilgili temel araçların bir birleşimidir. Arp, hostname, ifconfig, ipmaddr, iptunnel, mii-tool, nameif, netstat, plipconfig, rarp, route ve slattach programlarını içerir. + https://sourceforge.net/projects/net-tools/files/net-tools-1.60.tar.bz2 + + 01_all_net-tools-1.60-2.6-compilefix.patch.bz2 + 02_all_net-tools-1.60-gcc34.patch.bz2 + 03_all_net-tools-1.60-cleanup-list-handling.patch.bz2 + 04_all_net-tools-1.60-get_name.patch.bz2 + 20_all_net-tools-1.54-ipvs.patch.bz2 + 21_all_net-tools-1.57-bug22040.patch.bz2 + 22_all_net-tools-1.60-manydevs.patch.bz2 + 23_all_net-tools-1.60-miiioctl.patch.bz2 + 24_all_net-tools-1.60-virtualname.patch.bz2 + 25_all_net-tools-1.60-cycle.patch.bz2 + 26_all_net-tools-1.60-overflow.patch.bz2 + 27_all_net-tools-1.60-netstat_ulong.patch.bz2 + 50_all_net-tools-1.60-multiline-string.patch.bz2 + 51_all_net-tools-1.60-man.patch.bz2 + 52_all_net-tools-1.60-numeric-ports.patch.bz2 + 53_all_net-tools-1.60-appletalk.patch.bz2 + 54_all_net-tools-1.60-wide.patch.bz2 + 55_all_net-tools-1.60-Makefile.patch.bz2 + 56_all_net-tools-1.60-ipv6-hostname.patch.bz2 + 57_all_net-tools-1.60-ifconfig-infiniband.patch.bz2 + 60_all_net-tools-1.60-headers.patch.bz2 + net-tools-missing.patch + kernel_headers.patch + gcc-4.3.patch + large-buffer.patch + + system/base/net-tools/pspec.xml - lzo - - /usr/lib - /usr/share/doc - - - - lzo-devel - Development files for lzo - lzo için geliştirme dosyaları + net-tools - lzo + comar + comar-api - /usr/include - - - - lzo-32bit - 32-bit shared libraries for lzo - emul32 - emul32 - - /usr/lib32 + /bin + /sbin + /usr/bin + /usr/sbin + /usr/share/doc + /usr/share/man + /usr/share/locale - - 2017-01-21 - 2.09 - Rebuild with new toolchain. - Ertuğrul Erata - ertugrulerata@gmail.com - 2016-04-27 - 2.09 + 1.60 Release Bump PisiLinux Community admin@pisilinux.org 2016-03-09 - 2.09 + 1.60 First release Alihan Öztürk alihan@pisilinux.org @@ -6954,93 +7559,8 @@ - dbus-glib - http://dbus.freedesktop.org/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - AFL-2.1 - library - system.base - Glib bindings for D-Bus - D-Bus için GLib bağlayıcıları - dbus-glib is an add-on library to integrate the standard D-Bus library with the GLib thread abstraction and main loop. - dbus-glib, standart D-Bus kitaplığını GLib ana döngüsüyle bütünleştirmek için kullanılan bir kitaplıktır. - http://dbus.freedesktop.org/releases/dbus-glib/dbus-glib-0.108.tar.gz - - dbus-devel - glib2-devel - libpcre-devel - expat-devel - libxml2 - - system/base/dbus-glib/pspec.xml - - - dbus-glib - - dbus - glib2 - expat - libxml2 - - - /usr/bin - /usr/libexec/dbus-bash-completion-helper - /usr/lib - /usr/share/doc - /usr/share/man/man1 - /etc/bash_completion.d - /usr/share/bash-completion - /usr/libexec - - - - dbus-glib-devel - Development files for dbus-glib - dbus-glib için geliştirme dosyaları - system.devel - - dbus-glib - dbus-devel - glib2-devel - - - /usr/include/dbus-1.0 - /usr/lib/pkgconfig - /usr/share/man/man3 - - - - - 2017-01-26 - 0.108 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 0.104 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-10 - 0.104 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - gperf - http://www.gnu.org/software/gperf/gperf.html + diffutils + http://www.gnu.org/software/diffutils/diffutils.html PisiLinux Community admins@pisilinux.org @@ -7048,462 +7568,23 @@ GPLv2 app:console system.base - A perfect hash function generator - Mükemmel hash üreticisi - gperf is a perfect hash function generator. For a given list of strings, it produces a hash function and hash table, in form of C or C++ code, for looking up a value depending on the input string. The hash function is perfect, which means that the hash table has no collisions, and the hash table lookup needs a single string comparison only. - gperf mükemmel hash fonksiyonu üretecidir. Verilen bir katar listesi için C ve C++ kodu biçiminde bir hash fonksiyonu ve hash tablosu üretir. - GNU gperf es un generador de perfect hash. Produce una función hash y una tabla hash a base de una lista de cadenas, en forma de código C o C++ , para revisar valores dependiendo de una cadena de entrada. La función de hash es perfecta, lo que quiere decir que no hay colisiones en la tabla de hash, y para la búsqueda en la tabla hash se necesita solamente una comparación. - mirrors://gnu/gperf/gperf-3.0.4.tar.gz - system/base/gperf/pspec.xml + Tools to make diffs and compare files + Dosyaları karşılaştırmak ve fark dosyaları oluşturmak için kullanılan araçlar + Vous pouvez utiliser la commande diff pour voir les différences entre deux fichiers en particulier, ou les différences entre deux répertoires fichiers par fichier. Diff peut afficher les différences entre fichiers ligne par ligne dans différents formats pouvant être choisis avec les options de la ligne de commande. + You can use the diff command to show differences between two files, or each corresponding file in two directories. diff outputs differences between files line by line in any of several formats, selectable by command line options. + İki dosya arasındaki ya da iki klasör içindeki dosyaları karşılaştırarak farklılıkları belirleyebileceğiniz araç. Farklılıkları satır satır olarak, komut satırı seçenekleri ile farklı formatta dosyalara yazdırabilirsiniz. + http://ftp.gnu.org/gnu/diffutils/diffutils-3.5.tar.xz + + patch + texinfo + + system/base/diffutils/pspec.xml - gperf - - libgcc - + diffutils /usr/bin /usr/share/doc - /usr/share/info - /usr/share/man - - - - - 2016-04-27 - 3.0.4 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-05 - 3.0.4 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - cpio - http://www.gnu.org/software/cpio/cpio.html - - PisiLinux Community - admins@pisilinux.org - - GPLv3 - app:console - system.base - A file archival tool which can also read and write tar files - Tar ve cpio dosyaları içine yazıp okuyabilen bir dosya arşivleme uygulaması - GNU cpio permet de copier des fichiers du système dans une archive cpio ou tar et vice-versa. L'archive peut être un simple fichier sur le disque, une cassette magnétique, ou un tuyau unix (pipe). GNU cpio gère les formats d'archive suivant : binaire, ASCII ancien, ASCII nouveau, crc, binaire HPUX, ASCII ancien HPUX, tar ancien et tar POSIX.1. - GNU cpio copies files into or out of a cpio or tar archive. The archive can be another file on the disk, a magnetic tape, or a pipe. GNU cpio supports the following archive formats: binary, old ASCII, new ASCII, crc, HPUX binary, HPUX old ASCII, old tar, and POSIX.1 tar. - GNU cpio dosyaları cpio veya tar arşivlerine kopyalamaya veya bu arşivlerden çıkarmak için tasarlanmıştır. Arşiv diskteki başka bir dosya, manyetik bir teyp veya bir boru sistemi olabilir. GNU cpio şu arşiv formatlarını destekler: ikili, eski ASCII, yeni ASCII, crc, HPUX ikili, HPUX eski ASCII, eski tar ve POSIX.1 tar. - mirrors://gnu/cpio/cpio-2.12.tar.bz2 - - cpio-2.9-exitCode.patch - CVE-2010-0624-rpatelib-overflow.patch - - system/base/cpio/pspec.xml - - - cpio - - /bin - /usr/share/doc - /usr/share/man - /usr/share/info - /usr/share/locale - - - - - 2017-01-23 - 2.12 - Reubild. - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 2.12 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-01 - 2.12 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - libee - http://www.libee.org/ - - Marcin Bojara - marcin@pisilinux.org - - LGPLv2.1 - library - system.base - An Event Expression Library inspired by CEE - Libee - An Event Expression Library inspired by CEE - http://www.libee.org/download/files/download/libee-0.4.1.tar.gz - - libestr-devel - - system/base/libee/pspec.xml - - - libee - - libestr - - - /usr/sbin - /usr/lib/libee.so* - /usr/share/doc/libee - - - - libee-devel - Development files for libestr - system.devel - - libee - - - /usr/include/libee - /usr/lib/pkgconfig/libee.pc - - - - - 2016-04-27 - 0.4.1 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-08 - 0.4.1 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - libgcrypt - http://www.gnupg.org/ - - PisiLinux Community - admins@pisilinux.org - - LGPLv2.1 - library - system.base - Librairie générale de cryptographie basée sur le code utilisé dans GnuPG. - General purpose crypto library - Genel amaçlı bir şifreleme kitaplığı - Libgcrypt is a general purpose crypto library based on the code used in GNU Privacy Guard. - Libgcrypt, GNU Privacy Guard kodunu temel alan genel amaçlı bir şifreleme kitaplığıdır. - http://gd.tuwien.ac.at/pub/gnupg/libgcrypt/libgcrypt-1.7.6.tar.bz2 - - libgpg-error-devel - - system/base/libgcrypt/pspec.xml - - - libgcrypt - - libgpg-error - - - /usr/lib - /usr/share/man - /usr/share/doc - /etc/gcrypt - /usr/bin - /usr/share/info - - - - libgcrypt-devel - Development files for libgcrypt - libgcrypt için geliştirme dosyaları - system.devel - - libgcrypt - libgpg-error-devel - - - /usr/include - /usr/lib/pkgconfig - /usr/share/aclocal - /usr/lib32/pkgconfig - /usr/bin/*-config - - - - libgcrypt-32bit - 32-bit shared libraries for libgcrypt - libgcrypt için 32-bit paylaşımlı kitaplıklar - emul32 - emul32 - - libgpg-error-32bit - - - libgpg-error-32bit - libgcrypt - - - /usr/lib32 - - - - - 2017-01-24 - 1.7.6 - Version bump.. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-12-24 - 1.7.5 - Version bump. - Stefan Gronewold - groni@pisilinux.org - - - 2016-04-27 - 1.6.5 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-08 - 1.6.5 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - cracklib - http://www.sourceforge.net/projects/cracklib - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - library - system.base - Librairie de vérification de mot de passe. - Password Checking Library - Parola Kontrol Kütüphanesi - Bibliothek, um Passwörter zu prüfen - CrackLib tests passwords to determine whether they match certain security-oriented characteristics, with the purpose of stopping users from choosing passwords that are easy to guess. - CrackLib, kullanıcıların kolay tahmin edilebilir parolalar seçmelerini engellemek amacıyla parolaların güvenlik odaklı bazı özelliklere sahip olup olmadıklarını denetler. - https://github.com/cracklib/cracklib/releases/download/cracklib-2.9.6/cracklib-2.9.6.tar.gz - - zlib-devel - python-devel - - system/base/cracklib/pspec.xml - - - cracklib - - zlib - python - - - /lib - /usr/lib - /usr/sbin - /usr/share/locale - /usr/share/doc - /usr/share/cracklib - - - - cracklib-devel - Development files for cracklib - cracklib için geliştirme dosyaları - system.devel - - cracklib - - - /usr/include - - - - - 2017-01-24 - 2.9.6 - Rebuild. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 2.9.6 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-03 - 2.9.6 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - busybox - http://www.busybox.net - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - system.base - Statically linked binary providing simplified versions of system commands - Statik bağlanmış sistem komutları bütünü - busybox is a single binary which includes versions of a large number of system commands, including a shell. - busybox, kabuk da dahil olmak üzere çeşitli sistem komutlarını içeren tek bir çalıştırılabilir dosyadır. - http://busybox.net/downloads/busybox-1.24.1.tar.bz2 - - config - - system/base/busybox/pspec.xml - - - busybox - - /bin - - - - - 2016-04-27 - 1.24.1 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-07 - 1.24.1 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - run-parts - http://packages.qa.debian.org/d/debianutils.html - - PisiLinux Community - osman.erkan@yandex.com - - GPLv2+ - system.base - run scripts or programs in a directory - run scripts or programs in a directory - https://sources.archlinux.org/other/run-parts/debianutils_4.8.1.tar.xz - system/base/run-parts/pspec.xml - - - run-parts - - /usr/share/man - /usr/bin - /usr/sbin - - - - - 2017-01-23 - 4.8.1 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 4.7 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-03 - 4.7 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - gawk - http://www.gnu.org/software/gawk/gawk.html - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - system.base - GNU awk pattern-matching language - Metin işleme uygulaması olan awk'ın GNU versiyonu - L'outil awk interprète un langage de programmation spécifique permettant d'effectuer les tâches de modifications simples de données en quelques lignes de code. Il vous permet de faire des changements dans différents fichiers texte lorsqu'un certain patron apparaît ou d'extraire des données de fragments de lignes tout en laissant de côté le reste. Gawk est l'implémentation GNU d'awk. - The awk utility interprets a special-purpose programming language that makes it possible to handle simple data-reformatting jobs with just a few lines of code. It helps you to make changes in various text files wherever certain patterns appear, or extract data from parts of certain lines while discarding the rest. Gawk is the GNU implementation of awk. - awk uygulaması az bir kod ile basit veri formatı düzenleme işlerinizi yapabilmenize olanak sağlayan özel amaçlı bir programlama dilidir. Uygulama birçok farklı metin dosyası içinde aradığınız parçaları bulup değiştirmenize veya diğer satırlardan ayırarak işlemenize yardımcı olur. Gawk programı awk'ın GNU sürümüdür. - ftp://mirrors.kernel.org/gnu/gawk/gawk-4.1.4.tar.xz - - gettext - - system/base/gawk/pspec.xml - - - gawk - - readline - gmp - mpfr - - - /usr/bin - /usr/libexec - /usr/lib/gawk - /usr/include - /usr/share/awk - /usr/share/doc /usr/share/man /usr/share/info /usr/share/locale @@ -7512,21 +7593,21 @@ 2017-01-07 - 4.1.4 + 3.5 Version bump. Ertuğrul Erata ertugrulerata@gmail.com 2016-04-27 - 4.1.3 + 3.3 Release Bump PisiLinux Community admin@pisilinux.org 2016-02-28 - 4.1.3 + 3.3 First release Ertuğrul Erata ertugrulerata@gmail.com @@ -7535,8 +7616,8 @@ - procps - http://gitorious.org/procps + pcmciautils + http://www.kernel.org/pub/linux/utils/kernel/pcmcia/pcmcia.html PisiLinux Community admins@pisilinux.org @@ -7544,52 +7625,43 @@ GPLv2 app:console system.base - Standard informational utilities and process-handling tools - Geleneksel bilgilendirme yardımcı programları ve süreç işleme araçları - procps est un paquet regroupant une multitude de petits utilitaires utiles donnant des informations concernant les process en utilisant le système de fichier /proc. Le paquet inclus les programmes ps, top, vmstat, w, kill, free, slabtop et skill. - procps is the package that has a bunch of small useful utilities that give information about processes using the /proc filesystem. The package includes the programs ps, top, vmstat, w, kill, free, slabtop, and skill. - Procps /proc dosya sistemini kullanarak çalışan süreçler hakkında bilgi vermeye yarayan bazı kullanışlı uygulamaları içeren bir pakettir. Paket ps, top, vmstat, w, kill, free, slabtop ve skill gibi uygulamaları içerir. - http://downloads.sourceforge.net/project/procps-ng/Production/procps-ng-3.3.12.tar.xz + Utilitaires divers concernant le bus PCMCIA. + Various utilities dealing with the PCMCIA bus + PCMCIA veriyolu işlevleri ile ilgili çeşitli araçlar + Verschiedene Werkzeuge, um mit dem PCMCIA Bus umzugehen + pcmciautils contains the initialization tools necessary to allow the PCMCIA subsystem to behave as every other hotpluggable bus system. + pcmciautils PCMCIA altyapısının tak/çıkar veriyolları gibi davranmasını sağlayan araçları içerir. + https://sources.archlinux.org/other/pcmciautils/pcmciautils-018.tar.xz - ncurses-devel + sysfsutils-devel - system/base/procps/pspec.xml + system/base/pcmciautils/pspec.xml - procps + pcmciautils - ncurses + sysfsutils - /bin /sbin - /lib - /usr/lib - /usr/bin + /lib/udev + /etc/pcmcia /usr/share/doc /usr/share/man - /usr/share/locale - /usr/include + /lib/udev/rules.d - - 2017-01-07 - 3.3.12 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - 2016-04-27 - 3.3.11 + 018 Release Bump PisiLinux Community admin@pisilinux.org 2016-03-09 - 3.3.11 + 018 First release Alihan Öztürk alihan@pisilinux.org @@ -7598,483 +7670,62 @@ - psmisc - http://psmisc.sourceforge.net/ + python-pyliblzma + http://pypi.python.org/pypi/pyliblzma PisiLinux Community admins@pisilinux.org - GPLv2 - app:console + LGPLv3 + library system.base - A set of tools that use the proc filesystem - proc dosya sistemi kullanan bir araç takımı - PSmisc est une collection de petits utilitaires utilisant le système de fichier /proc, et assiste l'administrateur système dans ses tâches habituelles. - PSmisc is a collection of small utilities using /proc file system, and providing the system administrator with some help in common tasks. - PSmisc, /proc dosya sistemini kullanan küçük araçlar yardımıyla sistem yöneticisine bazı genel görevlerde yardımcı olmayı amaçlar. - PSmisc ist eine Sammlung von kleinen Anwendungen, die das /proc Dateisystem verwenden und dem System Administrator Hilfe für gängige Aufgaben bieten. - mirrors://sourceforge/psmisc/psmisc-22.21.tar.gz + Python bindings for lzma + Python için lzma bağlayıcıları + pyliblzma provides a python interface for the liblzma library to read/write data that has been compressed/decompressed with lzma utils. + pyliblzma, lzma araçlarıyla sıkıştırılmış verileri açmak ve lzma kitaplığı kullanarak veri sıkıştırmak için python programlama arayüzü sunan bir pakettir. + http://pypi.python.org/packages/source/p/pyliblzma/pyliblzma-0.5.3.tar.bz2 - ncurses-devel - gettext - - - psmisc-fuser.patch - - system/base/psmisc/pspec.xml - - - psmisc - - ncurses - - - /bin - /usr/bin - /usr/share/man - /usr/share/doc - /usr/share/locale - - - - - 2016-04-27 - 22.21 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-09 - 22.21 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - kmod - http://git.kernel.org/?p=utils/kernel/kmod/kmod.git;a=summary - - PisiLinux Community - admins@pisilinux.org - - GPLv2+ - app:console - system.base - Linux kernel module management utilities - Linux kernel modülleri yönetim araçları - Linux kernel module management utilities - Linux kernel modülleri yönetim araçları - https://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-23.tar.xz - - chrpath xz-devel - zlib-devel - kernel-module-headers + python-setuptools + python-devel - - kmod-15-dynamic-kmod.patch - - system/base/kmod/pspec.xml + system/base/python-pyliblzma/pspec.xml - kmod + python-pyliblzma xz - zlib - glibc - libkmod + python - /usr/bin - /bin - /sbin - /usr/share/man + /usr/lib/python2* /usr/share/doc - /etc - /usr/share/bash-completion/completions/kmod - - - Boot.Modules - System.PackageHandler - - - blacklist/blacklist.conf - blacklist/blacklist-firewire.conf - blacklist/blacklist-framebuffer.conf - blacklist/blacklist-watchdog.conf - modprobe.conf - depmod.conf - depmod-search.conf - - - - libkmod-devel - system.devel - - libkmod - - - /usr/include - /usr/lib/pkgconfig - /usr/lib32/pkgconfig - - - - libkmod - kmod libraries - - xz - zlib - - - /usr/lib - - - - libkmod-32bit - 32bit libraries of libkmod - emul32 - emul32 - - xz-32bit - zlib-32bit - - - xz-32bit - zlib-32bit - - - /usr/lib32 - - 2017-01-25 - 23 - Rebuild. - Ertuğrul Erata - ertugrulerata@gmail.com - - 2016-08-09 - 23 + 2017-01-22 + 0.5.3 Version bump. Ertuğrul Erata ertugrulerata@gmail.com 2016-04-27 - 22 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-05 - 22 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - leveldb - https://code.google.com/p/leveldb - - Alihan Öztürk - alihan@pisilinux.org - - BSD - app:console - system.base - A fast and lightweight key/value database library - Hızlı ve hafif bir anahtar/değer veri kütüphanesi - LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values. - LevelDB dize değerleri ile dize anahtarlarını eşleme sağlayan, Google'da yazılmış hızlı bir anahtar-değer depolama kütüphanesidir. - https://github.com/google/leveldb/archive/v1.18.tar.gz - - gperftools-devel - snappy-devel - - system/base/leveldb/pspec.xml - - - leveldb - - libgcc - snappy - gperftools - - - /usr/lib - /usr/share/doc - - - - leveldb-devel - - leveldb - - - /usr/include - - - - - 2017-01-21 - 1.18 - Rebuild with new toolchain. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 1.18 + 0.5.3 Release Bump PisiLinux Community admin@pisilinux.org 2016-03-02 - 1.18 + 0.5.3 First release Ertuğrul Erata ertugrulerata@gmail.com - - - e2fsprogs - http://e2fsprogs.sourceforge.net/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - system.base - Standard ext2/3/4 filesystem utilities - Standart ext2, ext3, ext4 dosya sistemi uygulamaları - e2frprogs fournit les outils de système de fichier à utiliser avec les systèmes de fichier de type ext2. Il prend également en charge les système de fichier de type ext3/4 avec support de la journalisation. - e2fsprogs provides the filesystem utilities for use with the ext2 filesystem. It also supports the ext3/4 filesystem with journaling support. - e2fsprogs ext2 dosya sistemi için standart dosya sistemi uygulamaları sağlar. ext3/4 dosya sistemlerinin günlüğe kaydetme özelliklerini de destekler. - mirrors://sourceforge/e2fsprogs/e2fsprogs-1.42.13.tar.gz - - libutil-linux-devel - gettext-devel - - - ntfs-3g.patch - - system/base/e2fsprogs/pspec.xml - - - e2fsprogs - - libutil-linux - - - /etc - /bin - /usr/bin - /lib - /usr/lib - /sbin - /usr/sbin - /usr/share/et - /usr/share/ss - /usr/share/locale - /usr/share/info - /usr/share/man - /usr/share/doc - - - - e2fsprogs-devel - Development files for e2fsprogs - e2fsprogs için geliştirme dosyaları - system.devel - - e2fsprogs - - - /usr/include - /usr/lib/pkgconfig - /usr/share/man/man3 - - - - - 2016-04-27 - 1.42.13 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-19 - 1.42.13 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - zip - http://www.info-zip.org/Zip.html - - PisiLinux Community - admins@pisilinux.org - - Info-ZIP - app:console - system.base - Info ZIP (encryption support) - ZIP programı (şifreleme desteği ile birlikte) - Zip est un outil de compression et d'archivage/packaging. Zip est utile pour distribuer un ensemble de fichier sous forme de paquets, et pour sauvegarder de l'espace disque en compressant temporairement les fichiers et répertoires inutilisés. - Zip is a compression and file packaging/archive utility. Zip is useful for packaging a set of files for distribution, for archiving files, and for saving disk space by temporarily compressing unused files or directories. - Zip bir sıkıştırma ve dosya paketleme/arşivleme uygulamasıdır. Zip dosyaları dağıtmak, arşivlemek ve kullanılmayan dosyaları ve dizinleri geçici olarak sıkıştırarak disk boşluğundan tasarruf için kullanılabilecek kullanışlı bir uygulamadır. - ftp://ftp.info-zip.org/pub/infozip/src/zip30.tgz - system/base/zip/pspec.xml - - - zip - - bzip2 - - - /usr/bin - /usr/share/doc - /usr/share/man - - - - - 2017-01-23 - 3.0 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 3.0 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-02 - 3.0 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - ncompress - http://ncompress.sourceforge.net - - PisiLinux Community - admins@pisilinux.org - - public-domain - app:console - system.base - Un autre outil de décompression de données pour compatibilité - Another uncompressor for compatibility - Bir başka sıkışmış dosya açma programı - Ein weiterer Nichtkompressor zu Kompatibilitätszwecken - The ncompress package contains the compress and uncompress file compression and decompression utilities, which are compatible with the original UNIX compress utility (.Z file extensions). These utilities can't handle gzipped (.gz file extensions) files, but gzip can handle compressed files. - mirrors://sourceforge/ncompress/ncompress-4.2.4.4.tar.gz - - ncompress-4.2.4-make.patch - ncompress-4.2.4-lfs2.patch - ncompress-2GB.patch - ncompress-4.2.4-endians.patch - - system/base/ncompress/pspec.xml - - - ncompress - - /usr/bin - /usr/share/man - - - - - 2016-04-27 - 4.2.4.4 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-09 - 4.2.4.4 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - time - ftp://prep.ai.mit.edu/pub/gnu/time - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - system.base - A GNU utility for monitoring a program's use of system resources - Bir programın sistem kaynak kullanımını izleyen GNU aracı - time utility runs another program, collects information about the resources used by that program while it is running, and displays the results. - time başka bir programı çalıştırarak o programın sistem kaynaklarını nasıl kullandığını izler ve topladığı bilgileri ekrana basar. - ftp://prep.ai.mit.edu/pub/gnu/time/time-1.7.tar.gz - - time-1.7-destdir.patch - - system/base/time/pspec.xml - - - time - - /usr/bin/ - /usr/share/info - - - - - 2016-04-27 - 1.7 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 1.7 - First release - Alihan Öztürk - alihan@pisilinux.org - - - cryptsetup @@ -8091,7 +7742,7 @@ Userspace setup tool for transparent encryption of block devices using dm-crypt cryptsetup device mapper kullanarak şifrelenmiş dosya sistemleri yaratmak için gerekli bir araçtır. cryptsetup - https://www.kernel.org/pub/linux/utils/cryptsetup/v1.7/cryptsetup-1.7.1.tar.xz + https://www.kernel.org/pub/linux/utils/cryptsetup/v1.7/cryptsetup-1.7.3.tar.xz device-mapper-devel libgpg-error-devel @@ -8107,7 +7758,7 @@ cryptsetup util.crypt - libcryptsetup + libcryptsetup popt @@ -8138,7 +7789,7 @@ libcryptsetup için geliştirme dosyaları programming.devel - libcryptsetup + libcryptsetup /usr/include @@ -8152,13 +7803,20 @@ programming.language.python python - libcryptsetup + libcryptsetup /usr/lib/python2.7/site-packages/pycryptsetup.so + + 2017-01-29 + 1.7.3 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + 2016-04-27 1.7.1 @@ -8177,8 +7835,90 @@ - json-c - http://oss.metaparadigm.com/json-c + kbd + http://freshmeat.net/projects/kbd/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + system.base + Keyboard and console utilities + Klavye ve konsol araçları + Le paquet kbd contient les fichiers de configuration de touches ainsi que divers utilitaires pour claviers compatible avec le noyau 1.1.54 et suivants. + The kbd package contains keytable files and keyboard utilities compatible with kernel version 1.1.54 and later. + Kbd paketi, çekirdek sürüm 1.1.54 ve sonraki sürümlerle uyumlu anahtar tablo dosyaları ve klavye yardımcı uygulamaları içerir. + https://www.kernel.org/pub/linux/utils/kbd/kbd-2.0.3.tar.xz + http://source.pisilinux.org/1.0/kbd-latarcyrheb-16-fixed.tar.bz2 + http://source.pisilinux.org/1.0/kbd-latsun-fonts.tar.bz2 + http://source.pisilinux.org/1.0/ro_maps.tar.bz2 + + gettext + gzip + pam-devel + check-devel + + + mandriva/kbd-1.15-mandriva.patch + mandriva/kbd-1.15-tilde_twosuperior_french_kbd.patch + mandriva/kbd-1.12-data_thai.patch + mandriva/kbd-1.15-remove-unneeded-calls.patch + archlinux/fix-euro2.patch + pisilinux/unicode_start-default-font.patch + pisilinux/tr-keypad-comma.patch + pisilinux/tr-no-meta_space.patch + pisilinux/trq-capslock-fix.patch + pisilinux/currency.patch + pisilinux/trf-keymap-fixes.patch + pisilinux/trf-capslock-fix.patch + + system/base/kbd/pspec.xml + + + kbd + + pam + + + /bin + /usr/bin + /usr/share/doc + /usr/share/man + /usr/share/kbd/keymaps + /usr/share/kbd/locale + /usr/share/kbd/unimaps + /usr/share/kbd/consolefonts + /usr/share/kbd/consoletrans + + + pisilinux/lat5u-12.psf.gz + pisilinux/lat5u-14.psf.gz + pisilinux/lat5u-16.psf.gz + mandriva/mac-fr-ext_new.kmap.gz + + + + + 2016-04-27 + 2.0.3 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-08 + 2.0.3 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + ncurses + http://www.gnu.org/software/ncurses/ncurses.html PisiLinux Community admins@pisilinux.org @@ -8186,454 +7926,78 @@ MIT library system.base - A JSON implementation in C - C dilinde JSON gerçeklemesi - json-c implements a reference counting object model that allows you to easily construct JSON objects in C, output them as JSON formatted strings and parse JSON formatted strings back into the C representation of JSON objects. - json-c, C dilinde kolayca JSON nesneleri yaratılmasını sağlayan bir referans sayma modeli gerçekleyen bir kitaplıktır. - https://github.com/json-c/json-c/archive/json-c-0.12-20140410.tar.gz - - wno-werror.patch - - system/base/json-c/pspec.xml - - - json-c - - /usr/share/doc - /usr/share/man - /usr/lib - - - - json-c-devel - Development files for json-c - json-c için geliştirme dosyaları - system.devel - - json-c - - - /usr/include - /usr/lib/pkgconfig - /usr/lib32/pkgconfig - - - - json-c-32bit - 32-bit shared libraries for json-c - emul32 - emul32 - - /usr/lib32 - - - - - 2016-04-27 - 0.12 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-08 - 0.12 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - openssl - http://www.openssl.org/ - - PisiLinux Community - admins@pisilinux.org - - as-is - app:console - library - system.base - Toolkit for SSL v2/v3 and TLS v1 - SSL v2/v3 ve TLS v1 için araç kiti - OpenSSL est un outil cryptographique implémentant une couche de communication sécurisée (SSL v2/v3) et une couche de transport sécurisée (TLS v1) - OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) network protocols and related cryptography standards required by them. - OpenSSL, Güvenlik Soketleri Katmanı (SSL v2/v3) ve Aktarım Katmanı Güvenliği (TLSv1) ağ protokolleri ile bu protokollerin gerektirdiği şifreleme standartlarını uygulayan bir şifreleme aracıdır. - OpenSSL ist ein Kryptographie Werkzeug, das die Netzwerkprotokolle Secure Sockets Layer (SSL v2/v3) und Transport Layer Security (TLS v1) sowie deren erforderliche zugehörige Kryptographie Standards implementiert. - https://www.openssl.org/source/openssl-1.0.2j.tar.gz - - openssl-1.0.0-beta4-ca-dir.patch - + Console display library + Konsol görsel kütüphanesi + NCurses est une librairie de fonction gérant l'affichage des applications pour terminaux en mode caractères. La libraries NCurses défini de nombreuses fonctionalités telles le mouvement de la souris et du curseur, la disposition du clavier et l'affichage en couleur. + The NCurses is a library of functions that manage an application's display on character-cell terminals. The NCurses library defines many functions such as moving mouse and cursor, keyboard mapping and dispaying in color. + NCurses, bir uygulamanın karakter tabanlı uçbirimlerde görüntüleri üzerinde çalışabilmeyi sağlayan işlevler kütüphanesidir. Uygulama programları için imleci hareket ettirmek, pencereler oluşturmak, renkler üretmek, fare ile oynamak v.b. işlevler sağlamaktadır. + mirrors://gnu/ncurses/ncurses-6.0.tar.gz - zlib-devel - xorg-util - perl - sed + gnuconfig - - openssl-1.0.0a-ldflags-norpath.patch - openssl-1.0.0-beta4-ca-dir.patch - openssl-1.0.0-beta5-enginesdir.patch - openssl-1.0.2-ipv6.patch - openssl_fix_for_x32_2.patch - openssl-ca-certificates.patch - CVE-2014-0198.patch - openssl-1.0.2a-x32-asm.patch - - system/base/openssl/pspec.xml + system/base/ncurses/pspec.xml - openssl - - zlib - ca-certificates - + ncurses /etc + /lib /usr/bin /usr/lib + /usr/share/terminfo + /usr/share/tabset + /usr/share/man /usr/share/doc - - System.Package - - openssl-devel - Development files for openssl - openssl için geliştirme dosyaları + ncurses-devel + Development files for ncurses + ncurses için geliştirme dosyaları system.devel - openssl + ncurses /usr/include - /usr/share/man - /usr/lib/pkgconfig - /usr/lib32/pkgconfig + /usr/lib/pkgconfig + /usr/lib/static + /usr/lib32/static + /usr/share/man/man3 + /usr/share/pkgconfig - openssl-32bit - 32-bit shared libraries for openssl - openssl için 32-bit paylaşımlı kitaplıklar + ncurses-32bit + 32-bit shared libraries for ncurses emul32 _emul32 - - zlib-32bit - - openssl - zlib-32bit + ncurses /usr/lib32 - - - - - 2017-01-08 - 1.0.2j - Rebuild with new toolchain. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2017-01-08 - 1.0.2j - Version bump. - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 1.0.2g - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-02 - 1.0.2g - First release - Ayhan Yalçınsoy - ayhanyalcinsoy@pisilinux.org - - - - - - libssh2 - http://www.libssh2.org/ - - PisiLinux Community - admins@pisilinux.org - - BSD - library - system.base - A library implementing the SSH2 protocol - SSH2 protokolü için kütüphane - libssh2 is a library implementing the SSH2 protocol as defined by Internet Drafts: SECSH-TRANS, SECSH-USERAUTH, SECSH-CONNECTION, SECSH-ARCH, SECSH-FILEXFER, SECSH-DHGEX, SECSH-NUMBERS, and SECSH-PUBLICKEY. - libssh2, SECSH-TRANS, SECSH-USERAUTH, SECSH-CONNECTION, SECSH-ARCH, SECSH-FILEXFER, SECSH-DHGEX, SECSH-NUMBERS ve SECSH-PUBLICKEY gibi Internet Taslakları tarafından belirlenen SSH2 protokolü için geliştirilmiş bir kütüphanedir. - https://www.libssh2.org/download/libssh2-1.8.0.tar.gz - - openssl-devel - zlib-devel - - system/base/libssh2/pspec.xml - - - libssh2 - - openssl - zlib - - - /usr/lib - /usr/share/doc - - - - libssh2-devel - Development files for libssh2 - libssh2 için geliştirme dosyaları - system.devel - - libssh2 - - - /usr/include - /usr/lib/pkgconfig - /usr/share/man - - - - - 2017-01-22 - 1.8.0 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 1.7.0 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-08 - 1.7.0 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - piksemel - http://pisilinux.org - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - library - system.base - Python binding for iksemel - iksemel için python desteği - Un analyseur XML simple, rapide, petit et robuste pour Python basé sur iksemel. - A simple, fast, small and robust XML parser for Python, based on iksemel. - Python için basit, hızlı, ufak ve sağlam bir XML ayrıştırıcısı, iksemel tabanlıdır. - http://source.pisilinux.org/1.0/piksemel-1.3.1.tar.gz - - python-devel - - - symbol-visibility.patch - - system/base/piksemel/pspec.xml - - - piksemel - - python - - - /usr/lib - /usr/share/doc - - - - - 2017-01-22 - 1.3.1 - Rebuild with new toolchain. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 1.3.1 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-11 - 1.3.1 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - libusb-compat - http://libusb.sourceforge.net/ - - PisiLinux Community - admins@pisilinux.org - - LGPLv2.1 - library - system.base - Userspace access to USB devices - Project's main aim is to create a library for use by user level applications to access USB devices regardless of OS. - mirrors://sourceforge/libusb/libusb-compat-0.1.5.tar.bz2 - - libtool - libusb-devel - - system/base/libusb-compat/pspec.xml - - - libusb-compat - - libusb - - - /usr/lib - /usr/share/doc - - - - libusb-compat-devel - Development files for libusb - system.devel - - libusb-devel - libusb-compat - - - /usr/bin - /usr/include - /usr/lib/pkgconfig /usr/lib32/pkgconfig - - libusb-compat-32bit - 32-bit shared libraries for libXt - emul32 - emul32 - - libusb-32bit - - - libusb-32bit - libusb - libusb-compat - - - /usr/lib32 - - - - - 2016-04-27 - 0.1.5 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-08 - 0.1.5 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - texinfo - http://www.gnu.org/software/texinfo/ - - PisiLinux Community - admins@pisilinux.org - - GPLv3 - app:console - system.base - programme et utilitaires GNU info. - The GNU info program and utilities - GNU info (bilgi) programı ve araçları - GNU Info Prgramm und Werkzeuge - Texinfo is a documentation system that can produce both online information and printed output from a single source file. The GNU Project uses the Texinfo file format for most of its documentation. - mirrors://gnu/texinfo/texinfo-6.3.tar.gz - - ncurses - perl - - system/base/texinfo/pspec.xml - - - texinfo - - ncurses - perl - - - /usr/bin - /usr/lib/texinfo - /usr/share/doc - /usr/share/man - /usr/share/info - /usr/share/texinfo - /usr/share/texmf/tex/texinfo - /usr/share/locale - /usr/share/texmf/ - - - System.PackageHandler - - - 2017-01-07 - 6.3 - Version bump. + 2017-01-04 + 6.0 + Rebuild with new toolchain. Ertuğrul Erata ertugrulerata@gmail.com 2016-04-27 - 6.1 + 6.0 Release Bump PisiLinux Community admin@pisilinux.org 2016-02-28 - 6.1 + 6.0 First release Ertuğrul Erata ertugrulerata@gmail.com @@ -8642,8 +8006,8 @@ - mingetty - ftp://ftp.suse.com/pub/projects/init/ + help2man + http://www.gnu.org/software/help2man PisiLinux Community admins@pisilinux.org @@ -8651,330 +8015,48 @@ GPLv2 app:console system.base - A compact getty program for virtual consoles only - Sadece sanal konsollar için yekpare bir getty programı - mingetty, est getty poids plume minimaliste à utiliser exclusivement sur les consoles virtuelles. - mingetty, is a lightweight, minimalist getty for use on virtual consoles only. - mingetty yalnızca sanal konsollar için tasarlanmış basit ve yalın getty uygulamasıdır. - http://sourceforge.net/projects/mingetty/files/mingetty/1.08/mingetty-1.08.tar.gz + GNU utility to convert program --help output to a man page + Geleneksel --help çıktılarını man sayfalarına dönüştüren bir GNU yazılımı + Help2man is a tool which generate man page from help text of programs. + Help2man programların help çıktılarını man sayfalarına dönüştüren bir araçtır. + http://ftp.gnu.org/gnu/help2man/help2man-1.47.3.tar.xz - gettext + perl-Locale-gettext - - tr.patch - mingetty-utf8.patch - - system/base/mingetty/pspec.xml + system/base/help2man/pspec.xml - mingetty + help2man - glibc - - - /sbin - /usr/share/locale - /usr/share/man - /usr/share/doc - - - - - 2016-04-27 - 1.0.8 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-09 - 1.0.8 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - curl - http://curl.haxx.se/ - - PisiLinux Community - admins@pisilinux.org - - MIT - X11 - app:console - library - system.base - Un client qui maîtrise tout ce qui concerne les URLs - A utility for getting files from remote servers - Uzak sunuculardan dosya indirmek için bir araç - Ein Client, der URLs versteht - curl is a command line tool for transferring data with URL syntax, supporting various protocols. - curl çeşitli protokolleri destekleyen, URL söz dizimini kullanarak uzak sunuculardan veri aktarmak için kullanılan bir komut satırı aracıdır. - http://curl.haxx.se/download/curl-7.52.1.tar.bz2 - - glibc-devel - zlib-devel - openssl-devel - libidn-devel - libssh2-devel - ca-certificates - - - curl-ac.patch - - system/base/curl/pspec.xml - - - curl - - zlib - libidn - libssh2 - openssl - ca-certificates + perl-Locale-gettext /usr/bin /usr/lib - /usr/share/doc/ - /usr/share/man/ - /usr/share/curl - /usr/share/zsh - - - - curl-devel - Development files for curl - curl için geliştirme dosyaları - system.devel - - curl - - - /usr/lib/pkgconfig - /usr/bin/curl-config - /usr/include/curl - /usr/share/aclocal - - - - - 2017-01-22 - 7.52.1 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 7.47.1 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-02 - 7.47.1 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - urlgrabber - http://urlgrabber.baseurl.org/ - - PisiLinux Community - admins@pisilinux.org - - LGPLv2.1 - library - system.base - High level cross-protocol url-grabber library for Python - Python için yüksek seviyeli, platform bağımsız bir url-grabber kütüphanesi - urlgrabber provides a clean library interface to protocol-independant file-access for Python programs - urlgrabber Python uygulamaları için protokol bağımsız dosya erişimi sağlayan temiz bir kütüphanedir. - http://urlgrabber.baseurl.org/download/urlgrabber-3.10.1.tar.gz - - python - - system/base/urlgrabber/pspec.xml - - - urlgrabber - - python - pycurl - - - /usr/lib - /usr/libexec /usr/share/doc - - - - - 2017-01-22 - 3.10.1 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 3.10.1 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-02 - 3.10.1 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - mailcap - http://git.fedorahosted.org/git/mailcap.git - - PisiLinux Community - admins@pisilinux.org - - MIT - public-domain - data - system.base - Helper application and MIME type associations for file types - Dosya türleri için yardımcı uygulama ve MIME türü ilişkilendirmeleri - mailcap file is used by the metamail program. Metamail reads the mailcap file to determine how it should display non-text or multimedia material. - mailcap dosyası metamail ve bazı diğer uygulamalar tarafından, metin olmayan dosyaların ya da çokluortam dosyalarının nasıl açılacağını keşfetmek için kullanılır. - https://fedorahosted.org/released/mailcap/mailcap-2.1.45.tar.xz - - extend-mailcap.patch - - system/base/mailcap/pspec.xml - - - mailcap - - /etc - /usr/share/doc - /usr/share/man - - - - - 2016-04-27 - 2.1.45 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-06 - 2.1.45 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - libgpg-error - http://www.gnupg.org/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - LGPLv2.1 - library - system.base - Contient les fonctions de gestion d'erreur utilisées par le logiciel GnuPG. - Library for error values used by GnuPG components - GnuPG bileşenlerinin kullandığı hata değerleri için kitaplık - libgpg-error is a library that defines common error values for all GnuPG components. - libgpg-error, tüm GnuPG bileşenleri için ortak olan hata değerlerini tanımlayan bir kitaplıktır. - http://gd.tuwien.ac.at/pub/gnupg/libgpg-error/libgpg-error-1.26.tar.bz2 - system/base/libgpg-error/pspec.xml - - - libgpg-error - - /usr/bin - /usr/lib - /usr/share/doc - /usr/share/info - /usr/share/man - /usr/share/libgpg-error/ + /usr/share/info /usr/share/locale - - - - libgpg-error-devel - Development files for libgpg-error - libgpg-error için geliştirme dosyaları - system.devel - - libgpg-error - - - /usr/bin/gpg-error-config - /usr/include - /usr/lib/pkgconfig - /usr/lib32/pkgconfig - /usr/share/aclocal - - - - libgpg-error-32bit - 32-bit shared libraries for libgpg-error - libgpg-error için 32-bit paylaşımlı kitaplıklar - emul32 - emul32 - - libgpg-error - - - /usr/lib32 + /usr/share/man - - 2017-01-24 - 1.26 - Rebuild - Ertuğrul Erata - ertugrulerata@gmail.com - - 2016-12-24 - 1.26 - Version bump. - Stefan Gronewold - groni@pisilinux.org + 2017-01-28 + 1.47.3 + Release Bump + PisiLinux Community + admin@pisilinux.org 2016-04-27 - 1.21 + 1.47.3 Release Bump PisiLinux Community admin@pisilinux.org 2016-03-08 - 1.21 + 1.47.3 First release Alihan Öztürk alihan@pisilinux.org @@ -8983,816 +8065,232 @@ - libxml2 - http://www.xmlsoft.org/ + liblogging + http://www.liblogging.org + + Marcin Bojara + marcin@pisilinux.org + + BSD-2 + library + system.base + Easy to use, portable, open source library for system logging + Liblogging offers an enhanced replacement for the syslog() call, but retains its ease of use. + https://sourceforge.net/projects/pisilinux/files/source/liblogging-1.0.5.tar.gz + system/base/liblogging/pspec.xml + + + liblogging + + /usr/lib + /usr/bin + /usr/share/man + /usr/share/doc/liblogging + + + + liblogging-devel + Development files for liblogging + system.devel + + liblogging + + + /usr/include/liblogging/stdlog.h + /usr/lib/pkgconfig/liblogging-stdlog.pc + + + + + 2016-04-27 + 1.0.5 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-08 + 1.0.5 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + bzip2 + http://www.bzip.org/ PisiLinux Community admins@pisilinux.org - MIT - library + BZIP2 + app:console system.base - Version 2 of the library to manipulate XML files - XML türü dosyaları işlemeye aracılık eden kütüphanenin 2. sürümü - Libxml2 est l'analyseur et la boîte à outils XML écrit en C pour le projet Gnome (mais utilisable en dehors de la plateforme Gnome). - Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform). - Libxml2, Gnome projesi için geliştirilmiş C dilinde XML ayrıştırıcısıdır. Gnome platformu olmadan da kullanılabilir. - ftp://xmlsoft.org/libxml2/libxml2-2.9.4.tar.gz - - python-devel - xz-devel - zlib-devel - readline-devel - - system/base/libxml2/pspec.xml + A high-quality data compressor + Yüksek kaliteli bir veri sıkıştırma uygulaması + bzip2 est un compresseur de données de très grand qualité. Il compresse typiquement les fichiers à un ratio entre 10 et 15% des meilleurs techniques disponibles (la famille des compresseurs statistiques de famille PPM) tout en étant environ deux fois plus rapide à la compression et six fois plus rapide à la décompression. + bzip2 is high-quality data compressor. It typically compresses files to within 10% to 15% of the best available techniques (the PPM family of statistical compressors), whilst being around twice as fast at compression and six times faster at decompression. + bzip2 yüksek kaliteli bir veri sıkıştırma programıdır. Program genellikle dosyaları mümkün olan en iyi teknikler ile (PPM istatistiksel sıkıştırıcı ailesi) %10 - %15'e kadar sıkışıtırabilmektedir. Sıkıştırma işleminde iki kata kadar hızlı iken açma hızında yaklaşık altı kat daha hızlıdır. + bzip2 ist ein hochwertiger Daten-Kompressor. Es komprimiert Dateien üblicherweise auf 10% bis 15% der bestmöglichen Techniken (die PPM Familie der statistischen Kompressoren), während es ungefähr doppelt so schnell komprimiert und sechsfach schneller extrahiert + http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz + + bzip2-1.0.2-progress.patch + bzip2-1.0.4-bzip2recover.patch + bzip2-1.0.4-man-links.patch + bzip2-1.0.6-saneso.patch + manpath.patch + + system/base/bzip2/pspec.xml - libxml2-docs - system.doc - - libxml2 - + bzip2 - /usr/share/doc - - - - libxml2 - - xz - zlib - python - readline - - - /usr/bin + /bin + /lib /usr/lib + /usr/share/doc /usr/share/man - - - - libxml2-devel - Development files for libxml2 - libxml2 için geliştirme dosyaları - system.devel - - libxml2 - - - /usr/lib/pkgconfig - /usr/lib32/pkgconfig /usr/include - /usr/share/aclocal - /usr/share/man/man3 - - - - libxml2-32bit - 32-bit shared libraries for libxml2 - libxml2 için 32-bit paylaşımlı kitaplıklar - emul32 - emul32 - - xz-32bit - zlib-32bit - readline-32bit - - - libxml2 - xz-32bit - zlib-32bit - - - /usr/lib32 - - 2017-01-24 - 2.9.4 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - 2017-01-08 - 2.9.3 - Rebuild with new toolchain. + 2017-01-07 + 1.0.6 + Version bump. Ertuğrul Erata ertugrulerata@gmail.com 2016-04-27 - 2.9.3 + 1.0.6 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-02-28 + 1.0.6 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + wireless-tools + http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + system.base + A collection of tools to configure wireless lan cards + Kablosuz ağ kartlarını yapılandırmak için kullanılan bir araç seti + Les outils sans fil (Wireless Tools ou WT) est un ensemble d'outils permettant de manipuler les extensions sans fil, c'est une interface de programmation d'application (API) générique permettant à un pilote d'exposer à l'espace utilisateur la configuration ainsi que des statistiques spécifiques aux LANs sans fil communs. Ils utilisent une interface textuelle assez rugueuse, mais ont pour objectif de couvrir la totalité de l'extension sans fil. + The Wireless Tools (WT) is a set of tools allowing to manipulate the Wireless Extensions, a generic application programming interface allowing a driver to expose to the user space configuration and statistics specific to common Wireless LANs. They use a textual interface and are rather crude, but aim to support the full Wireless Extension. + Wireless Extensions, sürücülerin bilinen kablosuz ağların ayarlarını yapmak ve istatistiklerini görüntülemek amacıyla kullandığı bir yazılım programlama arayüzüdür. Wireless Tools ise Wireless Extensions ayarlarını modifiye etmek için kullanılan araçları içeren bir pakettir. Grafik arayüzü bulunmaz, biraz da kabadır; ancak Wireless Extension'u tam olarak desteklemeyi hedefler. + http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/wireless_tools.30.pre9.tar.gz + + no-ldconfig.patch + wireless_tools.27-wireless-man-upd.patch + wireless-tools-29-makefile.patch + + system/base/wireless-tools/pspec.xml + + + wireless-tools + + comar + + + /sbin + /usr/lib + /usr/share/man + /usr/share/doc + + + + wireless-tools-devel + Development files for wireless-tools + wireless-tools için geliştirme dosyaları + system.devel + + wireless-tools + + + /usr/include + /usr/share/man/man3 + + + + + 2016-04-27 + 30 Release Bump PisiLinux Community admin@pisilinux.org 2016-03-04 - 2.9.3 + 30 First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - popt - http://www.rpm5.org/ - - PisiLinux Community - admins@pisilinux.org - - as-is - app:console - library - system.base - Popt command line option parser - Popt komut satırında çalıştıran bir seçenek ayrıştırıcıdır. - La librairie popt existe essentiellement pour analyser des options de ligne de commande. Elle procure de nombreux avantages tels que l'absence de variables globales, la possibilité d'analyser un tableau arbitraire d'éléments de type argv, d'exécuter des filtres d'options extérieurs, la génération automaituqe des messages d'aide et d'utilisation ainsi qu'un méthode standard pour synonymes d'options. - The popt library exists essentially for parsing command line options with advantages such as there are no global variables, ability to parse an arbitrary array of argv-style elements, to exec external option filters, and automatic generation of help and usage messages, a standard method of option aliasing. - Popt, komut satırında seçenek ayrıştırma için gerekli bir kütüphanedir. Genel değişken olmaması, dağınık dizi bileşenlerini ayrıştırabilmesi, harici uygulama filtreleri kullanabilmesi, otomatik mesaj ve yardım dosyaları üretimi gibi başarılı özellikleri bulunur. - ftp://anduin.linuxfromscratch.org/BLFS/svn/p/popt-1.16.tar.gz - system/base/popt/pspec.xml - - - popt - - gettext - - - /usr/lib - /usr/share/doc - /usr/share/man - /usr/share/locale - - - - popt-devel - Development files for popt - popt için geliştirme dosyaları - system.devel - - popt - - - /usr/include/popt.h - /usr/share/man/man3 - /usr/lib/pkgconfig - - - - - 2017-01-23 - 1.16 - Rebuild. - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 1.16 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-08 - 1.16 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - libidn - http://www.gnu.org/software/libidn - - PisiLinux Community - admins@pisilinux.org - - LGPLv2.1 - GPLv3 - app:console - library - system.base - Internationalized Domain Names (IDN) implementation - Uluslararası Alan Adları (IDN) destek kütüphanesi - GNU Libidn est une implémentation de Stringprep, Punycode et des spécifications IDNA définies par le groupe de travail Internationalized Domain Names (IDN) de l'IETF servant pour les noms de domaines internationalisés. La librairie C est disponible sous la Licence Publique Générale Lesser. - GNU Libidn is an implementation of the Stringprep, Punycode and IDNA specifications defined by the IETF Internationalized Domain Names (IDN) working group, used for internationalized domain names. The C library is available under the GNU Lesser General Public License. - GNU Libidn, IETF Uluslararasılaştırılmış Domain Adları (IDN) çalışma grubu tarafından tanımlanmış Stringgrep, Punycode ve IDNA tariflerinin bir uygulamasıdır, uluslararası domain adlarının kullanımına olanak sağlar. C kütüphanesi GNU Lesser General Public License altında sağlanabilir. - http://ftp.gnu.org/gnu/libidn/libidn-1.33.tar.gz - system/base/libidn/pspec.xml - - - libidn - - /usr/bin - /usr/lib/libidn* - /usr/share/emacs - /usr/share/locale - /usr/share/man/man1 - /usr/share/info - /usr/share/doc - - - - libidn-devel - Development files for libidn - libidn için geliştirme dosyaları - system.devel - - libidn - - - /usr/include - /usr/lib/pkgconfig - /usr/lib32/pkgconfig - /usr/share/man/man3 - - - - libidn-32bit - 32-bit shared libraries for libidn - libidn için 32-bit paylaşımlı kitaplıklar - emul32 - emul32 - - libidn - - - /usr/lib32/libidn* - - - - - 2017-01-22 - 1.33 - Version bump. Ertuğrul Erata ertugrulerata@gmail.com - - 2016-04-27 - 1.32 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-08 - 1.32 - First release - Alihan Öztürk - alihan@pisilinux.org - - sysvinit - http://freshmeat.net/projects/sysvinit/ + coreutils + http://www.gnu.org/software/coreutils/ - PisiLinux Community + Pisi Linux Admins admins@pisilinux.org - GPLv2 + GPLv3+ app:console system.base - Programs which control basic system processes - sysvinit package contains a group of utilities that control the very basic functions of your system. sysvinit contains the init program, the first program started by the Linux kernel when the system boots. - http://download.savannah.gnu.org/releases/sysvinit/sysvinit-2.88dsf.tar.bz2 - - sysvinit-2.86-ctrlc.patch - sysvinit-2.78-man.patch - sysvinit-2.86-loginshell.patch - sysvinit-2.86-single.patch - sysvinit-2.88-quiet.patch - sysvinit-2.88-ipv6.patch - sysvinit-2.88-omit.patch - sysvinit-2.88-wall-maxlines.patch - - system/base/sysvinit/pspec.xml - - - sysvinit - - /bin - /sbin - /usr/bin - /usr/share/man - /usr/include - - - System.Package - - - - sysvinit-tools - Tools used for process and utmp management - Süreç ve utmp yönetim araçları - - /bin/mountpoint - /sbin/pidof - /sbin/killall5 - /sbin/sulogin - /usr/bin/wall - /usr/bin/last - /usr/bin/lastb - /usr/bin/mesg - /usr/bin/utmpdump - /usr/share/man/man1 - /usr/share/man/man8/killall5* - /usr/share/man/man8/pidof* - /usr/share/man/man8/sulogin* - - - - - 2016-04-27 - 2.88 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 2.88 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - gperftools - http://code.google.com/p/gperftools/ - - PisiLinux Community - admins@pisilinux.org - - BSD - library - app:console - system.base - Google Performance Tools - Google Performans Araçları - Perf Tools is a collection of a high-performance multi-threaded malloc() implementation, plus some pretty nifty performance analysis tools. - gperftools yüksek performanslı ve yararlı performans analizi araçları içerir. - https://github.com/gperftools/gperftools/releases/download/gperftools-2.5/gperftools-2.5.tar.gz - - libunwind-devel - - system/base/gperftools/pspec.xml - - - gperftools - - libunwind - libgcc - - - /usr/bin - /usr/lib - /usr/share/doc/gperftools/COPYING - /usr/share/man - - - - gperftools-devel - Development headers for gperftools - gperftools için geliştirme başlıkları - gperftools-devel provides development headers for gperftools. - gperftools için geliştirme başlıklarını içerir. - library - - gperftools - - - /usr/include - /usr/lib/pkgconfig - - - - gperftools-docs - Documentation files for gperftools - gperftools için belgelendirme dosyaları - gperftools-docs provides documentation files for gperftools. - gperftools için belgelendirme dosyalarını içerir. - data:doc - system.doc - - gperftools - - - /usr/share/doc/gperftools - - - - - 2017-01-21 - 2.5 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 2.4 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-02 - 2.4 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - libcap-ng - http://people.redhat.com/sgrubb/libcap-ng - - PisiLinux Community - admins@pisilinux.org - - LGPLv2+ - library - system.base - An alternate POSIX capabilities library - Alternatif bir POSIX yetenekleri kütüphanesi - libcap-ng is a library that makes using POSIX capabilities easier. - libcap-ng POSIX yeteneklerinin yönetimini kolaylaştıran bir kütüphanedir. - http://people.redhat.com/sgrubb/libcap-ng/libcap-ng-0.7.8.tar.gz + A set of basic GNU tools commonly used in shell scripts + Standart dosya, metin ve kabuk uygulamaları + Utilitaires standards GNU pour fichiers (chmod, cp, dd, dir, ls...), utilitaires texte (sort, tr, head, wc...) et utilitaires d'interpréteur de commande (shell) (whoami, who...) + GNU dosya uygulamaları (chmod, cp, dd, dir, ls...), sh uygulamaları (whoami, who,...) ve metin uygulamalarının (sort, tr, head, wc..) birlikteliğinden oluşmaktadır. + http://ftp.gnu.org/gnu/coreutils/coreutils-8.26.tar.xz + acl-devel attr-devel - python-devel - - system/base/libcap-ng/pspec.xml - - - libcap-ng - - /usr/lib - /usr/share/doc - - - - python-libcap-ng - Python bindings for libcap-ng - Python için libcap-ng bağlayıcıları - programming.language.python - - libcap-ng - - - /usr/lib/python* - - - - libcap-ng-utils - Utilities to analyse the POSIX capabilities on running processes - Çalışan süreçlerin sahip olduğu POSIX yeteneklerini incelemeye yarayan araçlar - util.admin - - libcap-ng - - - /usr/bin - /usr/share/man/man8/* - - - - libcap-ng-devel - Development files for libcap-ng - libcap-ng için geliştirme dosyaları - system.devel - - libcap-ng - - - /usr/share/aclocal - /usr/include - /usr/lib/pkgconfig - /usr/share/man/man3 - - - - - 2017-01-25 - 0.7.8 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 0.7.7 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-03 - 0.7.7 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - pam - http://www.kernel.org/pub/linux/libs/pam/ - - PisiLinux Community - admins@pisilinux.org - - PAM - library - system.base - Modules d'Authentification en Greffon (Pluggable Authentication Modules) - Pluggable Authentication Modules - PAM - Eklenebilir Yetkilendirme Modülleri - PAM (Pluggable Authentication Modules) is a system security tool that allows system administrators to set authentication policy without having to recompile programs that handle authentication. - http://www.linux-pam.org/library/Linux-PAM-1.3.0.tar.bz2 - - dlopen.sh - dlopen-test.sh - - perl - gettext - cracklib-devel - libxslt-devel - docbook-xsl - - system/base/pam/pspec.xml - - - pam - - cracklib - - - /etc - /lib - /var/run/console - /usr/lib - /sbin - /usr/sbin - /usr/share/doc - /usr/share/man - /usr/share/locale - - - System.Package - - - 90-nproc.conf - - - - pam-devel - Development files for pam - pam için geliştirme dosyaları - system.devel - - pam - - - /usr/include - /usr/share/man/man3 - - - - - 2017-01-24 - 1.3.0 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 1.2.1 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-05 - 1.2.1 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - comar - http://www.pisilinux.org - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - service - system.base - Manages system configuration - Sistem yapılandırmasını yönetir - Les programmes Pisi Linux sont mis sous forme de paquets à l'aide de petits scripts. Ces derniers les configure afin qu'ils s'intègrent entre eux et avec le système. Çomar est l'outil qui gère et exécute ces scripts. - Pisi Linux programs are packaged with small scripts which configures them to entegrate with system and each other. Çomar is the tool which manages and executes these scripts. - Pisi Linux yazılımları, birbirleri ve sistemle otomatik olarak uyum sağlayabilmek için yanlarında ufak programcıklar ile paketlenmektedir. Bu programcıkların yönetimi ve işletilmesi Çomar aracı tarafından yapılmaktadır. - Pisi Linux Programme werden mit einem kleinen Skript paketiert, welches sie konfiguriert, um die Integrität mit dem System und anderen Programmen sicherzustellen. Comar ist das Werkzeug, das diese Skripte verwaltet und ausführt. - http://source.pisilinux.org/1.0/comar-3.0.3.tar.bz2 - - dbus-devel - python-devel - cmake + shadow + gettext-devel + ncurses-devel + gmp-devel + libcap-devel + texinfo - run_dir.patch - fix-flags.patch - update-system-manager-model.patch + remove_am_silent_rules.patch - system/base/comar/pspec.xml + system/base/coreutils/pspec.xml - comar + coreutils - dbus - python - polkit - dbus-python - - - /usr/bin - /usr/sbin - /etc - /usr/share/dbus-1/system-services - /usr/share/polkit-1/actions - /usr/share/doc/ - /var/db - - - System.Package - - - - - 2016-04-27 - 3.0.3 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-11 - 3.0.3 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - nss-mdns - http://0pointer.de/lennart/projects/nss-mdns/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - library - system.base - Name Service Switch module - İsim servisi değiştirme modülü - Module d'échange de service de nom pour le DNS Multicast. - Name Service Switch module for Multicast DNS. - Çoklu gönderim yapan DNS'ler için isim servisi seçme modülü. - http://0pointer.de/lennart/projects/nss-mdns/nss-mdns-0.10.tar.gz - - nss-mdns-0.8-avahi-socket.patch - - system/base/nss-mdns/pspec.xml - - - nss-mdns - - /etc - /usr/lib - /usr/share/doc - - - mdns.allow - - - - - 2016-04-27 - 0.10 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-09 - 0.10 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - miscfiles - http://freshmeat.net/projects/miscfiles/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - data - system.base - Fichiers divers. - Miscellaneous files - Çeşitli dosyalar - Verschiedene Dateien - miscfiles is a collection of data files for freely available information, like airport, country, currencies, city information, and codes. It also includes the Unicode character database. - miscfiles havalanı, ülke, para birimi, şehir bilgisi ve kodları gibi bir çok ulaşılabilir bilgiyi veri dosyaları halinde tutmaktadır. - http://ftp.gnu.org/gnu/miscfiles/miscfiles-1.5.tar.gz - system/base/miscfiles/pspec.xml - - - miscfiles - - /usr/share/doc - /usr/share/rfc - /usr/share/dict - /usr/share/misc - - - - - 2016-04-27 - 1.5 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-03 - 1.5 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - grep - http://www.gnu.org/software/grep/grep.html - - PisiLinux Community - admins@pisilinux.org - - GPLv3 - app:console - system.base - GNU regular expression matcher - Grep düzenli ifade eşleme aracı - La commande grep recherche dans un ou plusieurs fichiers les lignes correspondant à un motif défini. Par défaut grep affiche les lignes éligibles. - The grep command searches one or more input files for lines containing a match to a specified pattern. By default, grep prints the matching lines. - Grep komutu bir veya daha fazla verilen dosyada aranan parçayı bulmaya yarayan bir programdır. Ön tanımlı olarak grep eşleşen satırları çıktıya verir. - ftp://mirrors.kernel.org/gnu/grep/grep-2.27.tar.xz - - gettext - libpcre-devel - - system/base/grep/pspec.xml - - - grep - - libpcre + acl + attr + gmp + libcap /bin + /etc + /usr/bin + /usr/libexec + /usr/lib /usr/share/doc /usr/share/man /usr/share/info @@ -9801,22 +8299,22 @@ - 2017-01-07 - 2.27 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com + 2016-04-27 + 8.26 + Version Bump. + PisiLinux Community + admin@pisilinux.org 2016-04-27 - 2.23 + 8.25 Release Bump PisiLinux Community admin@pisilinux.org 2016-02-28 - 2.23 + 8.25 First release Ertuğrul Erata ertugrulerata@gmail.com @@ -9825,117 +8323,57 @@ - zlib - http://www.gzip.org/zlib/ + pycurl + http://pycurl.sourceforge.net/ PisiLinux Community admins@pisilinux.org - ZLIB + LGPLv2.1 library system.base - Librairie de compression/extraction standard - Standard (de)compression library - Standart sıkıştırma/açma kütüphanesi - Zlib is a general-purpose, patent-free, lossless data compression library which is used by many different programs. - mirrors://sourceforge/libpng/zlib-1.2.10.tar.xz - - dont-call-ldconfig.patch - - system/base/zlib/pspec.xml + Python cURL Module + Python cURL Modülü + PycURL is a Python interface to libcurl. PycURL can be used to fetch objects identified by a URL from a Python program. + PycURL, python libcurl için python arayüzüdür. PycURL, URL tarafında tanımlanan nesneleri indirmek için bir python programı tarafından kullanılabilir. + https://dl.bintray.com/pycurl/pycurl/pycurl-7.43.0.tar.gz + + curl-devel + python-devel + openssl-devel + + system/base/pycurl/pspec.xml - minizip - Library for manipulating files from a zip archive - zip arşivlerindeki dosyaları yönetmek için kitaplık - util.archive - minizip + pycurl - zlib + curl + python + openssl - /usr/lib/libminizip* - - - - minizip-devel - Development files for minizip - minizip için geliştirme dosyaları - util.archive - minizip - - minizip - zlib-devel - - - /usr/include/minizip - /usr/lib/pkgconfig/minizip.pc - - - - zlib - - /lib/libz.so* - /usr/lib/libz.so* + /usr/lib /usr/share/doc - /usr/share/man - - - - zlib-devel - Development files for zlib - zlib için geliştirme dosyaları - system.devel - - zlib - - - /usr/lib/pkgconfig/zlib.pc - /usr/lib32/pkgconfig - /usr/include/z*.h - /usr/share/man/man3 - /usr/share/doc/zlib/algorithm.txt - /usr/share/doc/zlib/example.c - - - - zlib-32bit - 32-bit shared libraries for zlib - zlib için 32-bit paylaşımlı kitaplıklar - emul32 - emul32 - - zlib - - - /usr/lib32/libz.so* - - 2017-01-21 - 1.2.10 - version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - 2017-01-02 - 1.2.8 + 2017-01-22 + 7.43.0 Rebuild with new toolchain. Ertuğrul Erata ertugrulerata@gmail.com 2016-04-27 - 1.2.8 + 7.43.0 Release Bump PisiLinux Community admin@pisilinux.org - 2016-02-28 - 1.2.8 + 2016-03-02 + 7.43.0 First release Ertuğrul Erata ertugrulerata@gmail.com @@ -9944,107 +8382,79 @@ - python - http://www.python.org/ + dbus-python + http://dbus.freedesktop.org/ PisiLinux Community admins@pisilinux.org - PSF-2.2 - app:console + GPLv2 + AFL-2.1 + library system.base - An interpreted, interactive, object-orientated programming language - Nesneye yönelik bir programlama dili - Python est un langage de programmation dynamique orienté objet pouvant être utilisé pour différents types de développements logiciels. Il offre une intégration renforcée aussi bien avec les autres langages qu'avec des outils. Il est livré avec des librairies standards couvrant un large périmètre et peut être appris en quelques jours. - Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. - Python, yazılım geliştirmenin birçok aşamasında kullanılabilen, dinamik nesne tabanlı bir programlama dilidir. Diğer programlama dilleriyle bütünleşme için sağlam bir destek sunar, kapsamlı standart kütüphanelerle sunulur ve birkaç günde öğrenilebilir. - http://www.python.org/ftp/python/2.7.13/Python-2.7.13.tar.xz + D-Bus Python bindings + D-Bus için Python bağlayıcıları + dbus-python provides a Python module which wraps the D-Bus programming API. + https://dbus.freedesktop.org/releases/dbus-python/dbus-python-1.2.4.tar.gz - bzip2 - gdbm-devel - zlib-devel - expat-devel - libffi-devel - sqlite-devel - ncurses-devel - openssl-devel - readline-devel + python-devel + dbus-devel + dbus-glib-devel + glib2-devel + libpcre-devel - pisilinux_platform.patch - add-pisilinux-to-search-path.patch - default-utf8.patch - disable-egginfo.patch - trfix_emaillib.patch + suppress-warnings.patch - system/base/python/pspec.xml + system/base/dbus-python/pspec.xml - python - - noDelta - - - gdbm - zlib - bzip2 - expat - libffi - sqlite - ncurses - openssl - readline - - - /etc - /usr/bin - /usr/include/python2.7/pyconfig.h - /usr/lib - /usr/share/doc - /usr/share/man - - - System.PackageHandler - - - pythonstart - 04python - - - - python-devel - Development files for python - python için geliştirme dosyaları + dbus-python-common + Common dbus-python files shared between dbus-python and dbus-python3 system.devel - python + dbus-devel + dbus-python /usr/include /usr/lib/pkgconfig + /usr/share/doc + + + + dbus-python + + python + dbus + glib2 + dbus-glib + + + /usr/lib/python2* - 2017-01-08 - 2.7.13 - Version bump. + 2017-01-26 + 1.2.4 + Rebuild. Ertuğrul Erata ertugrulerata@gmail.com 2016-04-27 - 2.7.11 + 1.2.4 Release Bump PisiLinux Community admin@pisilinux.org - 2016-03-02 - 2.7.11 + 2016-03-10 + 1.2.4 First release - Ertuğrul Erata - ertugrulerata@gmail.com + Alihan Öztürk + alihan@pisilinux.org @@ -10199,41 +8609,1141 @@ - attr - http://acl.bestbits.at/ + libusb + http://libusb.org/ + + PisiLinux Community + admins@pisilinux.org + + LGPLv2.1 + library + system.base + Userspace access to USB devices + Project's main aim is to create a library for use by user level applications to access USB devices regardless of OS. + https://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.20/libusb-1.0.20.tar.bz2 + + eudev-devel + + system/base/libusb/pspec.xml + + + libusb + + eudev + + + /usr/bin + /usr/lib + /usr/share/doc + + + libusbx + + + libusbx + + + + libusb-devel + Development files for libusb + system.devel + + libusb + + + /usr/include + /usr/lib/pkgconfig + /usr/lib32/pkgconfig + + + libusbx-devel + + + libusbx-devel + + + + libusb-32bit + 32-bit shared libraries for libusb + emul32 + emul32 + + eudev-32bit + + + libusb + eudev-32bit + + + /usr/lib32 + + + libusbx-32bit + + + libusbx-32bit + + + + + 2016-04-27 + 1.0.20 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-08 + 1.0.20 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + spidermonkey + http://www.mozilla.org/js/spidermonkey/ + + PisiLinux Community + admins@pisilinux.org + + NPL-1.1 + library + system.base + Stand-alone JavaScript C Library + Javascript C Kitaplığı + Spidermonkey est l'Implémentation C de Javascript par Mozilla. + Spidermonkey is Mozilla's C implementation of JavaScript. + Mozilla'nın Javascript'in C implementasyonu. + Spidermonkey es la implementación de JavaScript con C de Mozilla. + http://ftp.mozilla.org/pub/mozilla.org/js/mozjs17.0.0.tar.gz + + zlib-devel + nspr-devel + readline-devel + libffi-devel + + system/base/spidermonkey/pspec.xml + + + spidermonkey + + nspr + zlib + libgcc + readline + + + /usr/bin + /usr/lib + /usr/share/doc + + + + spidermonkey-devel + Development files for spidermonkey + spidermonkey için geliştirme dosyaları + system.devel + + spidermonkey + nspr-devel + + + /usr/include + /usr/lib/pkgconfig + /usr/bin/js17-config + + + + + 2017-01-29 + 17.0.0 + Rebuild. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 17.0.0 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-06 + 17.0.0 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + bash + http://cnswww.cns.cwru.edu/~chet/bash/bashtop.html Pisi Linux Admins admins@pisilinux.org - LGPLv2.1 + GPLv2 app:console - library system.base - Utilities for managing filesystems extended attributes - Gelişkin öznitelikler araçları - attr offre des utilitaires qui servent à manipuler les attributs étendus des objects de système de fichier. - attr contains a set of tools for manipulating extended attributes on filesystem objects, in particular getfattr and setfattr. - attr dosya sistemi nesnelerinin özniteliklerini değiştirmek için gerekli bir dizi araç sunar. - http://download.savannah.gnu.org/releases-noredirect/attr/attr-2.4.47.src.tar.gz - system/base/attr/pspec.xml + The standard GNU Bourne again shell + GNU Bource again kabuğu + Bash est le Bourne Again SHell du projet GNU, une implémentation complête du POSIX IEEE et des spécifications d'interprétation de commande (shell) de l'Open Group, avec édition interactive de ligne de commande et des fonctionnalités à la csh tels que la substitution dans l'historique de commande. + Bash is the GNU Project's Bourne Again SHell, a complete implementation of the IEEE POSIX and Open Group shell specification with interactive command line editing, csh-like features such as history substitution. + Bash, IEEE POSIX ve Open Group'un interaktif komut satırı düzenleme, geçmiş komutları tamamlama gibi csh tipi özellikler gibi kabuk uygulamaları tariflerinin tam olarak uygulayan GNU Projesinin Bourne Again SHell kabuk programıdır. + mirrors://gnu/bash/bash-4.4.tar.gz + + ncurses-devel + + + official/bash-4.4-patch-1.patch + official/bash-4.4-patch-2.patch + official/bash-4.4-patch-3.patch + official/bash-4.4-patch-4.patch + official/bash-4.4-patch-5.patch + official/bash-4.4-patch-6.patch + official/bash-4.4-patch-7.patch + official/bash-4.4-patch-8.patch + official/bash-4.4-patch-9.patch + official/bash-4.4-patch-10.patch + official/bash-4.4-patch-11.patch + fedora/bash-2.02-security.patch + fedora/bash-2.03-paths.patch + fedora/bash-2.03-profile.patch + fedora/bash-2.05a-interpreter.patch + fedora/bash-2.05b-debuginfo.patch + fedora/bash-2.05b-manso.patch + fedora/bash-2.05b-pgrp_sync.patch + fedora/bash-2.05b-xcc.patch + fedora/bash-3.2-audit.patch + fedora/bash-3.2-ssh_source_bash.patch + fedora/bash-setlocale.patch + fedora/bash-tty-tests.patch + fedora/bash-4.0-nobits.patch + fedora/bash-4.1-examples.patch + fedora/bash-4.1-broken_pipe.patch + fedora/bash-4.2-rc2-logout.patch + fedora/bash-4.2-coverity.patch + fedora/bash-4.1-defer-sigchld-trap.patch + fedora/bash-4.2-manpage_trap.patch + fedora/bash-4.2-size_type.patch + fedora/bash-4.3-man-ulimit.patch + fedora/bash-4.3-noecho.patch + fedora/bash-4.3-memleak-lc_all.patch + fedora/bash-4.4-no-loadable-builtins.patch + + system/base/bash/pspec.xml - attr + bash + + ncurses + + + /etc + /bin + /usr/bin + /usr/share/doc + /usr/share/info + /usr/share/man + /usr/share/locale + + + bashrc + command-not-found.sh + + + + + 2017-01-28 + 4.4 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2017-01-06 + 4.3_p48 + Rebuild with new toolchain. + PisiLinux Community + admin@pisilinux.org + + + 2016-11-12 + 4.3_p48 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 4.3_p39 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-02-28 + 4.3_p39 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + piksemel + http://pisilinux.org + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + library + system.base + Python binding for iksemel + iksemel için python desteği + Un analyseur XML simple, rapide, petit et robuste pour Python basé sur iksemel. + A simple, fast, small and robust XML parser for Python, based on iksemel. + Python için basit, hızlı, ufak ve sağlam bir XML ayrıştırıcısı, iksemel tabanlıdır. + http://source.pisilinux.org/1.0/piksemel-1.3.1.tar.gz + + python-devel + + + symbol-visibility.patch + + system/base/piksemel/pspec.xml + + + piksemel + + python + + + /usr/lib + /usr/share/doc + + + + + 2017-01-22 + 1.3.1 + Rebuild with new toolchain. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 1.3.1 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-11 + 1.3.1 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + procps + http://gitorious.org/procps + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + system.base + Standard informational utilities and process-handling tools + Geleneksel bilgilendirme yardımcı programları ve süreç işleme araçları + procps est un paquet regroupant une multitude de petits utilitaires utiles donnant des informations concernant les process en utilisant le système de fichier /proc. Le paquet inclus les programmes ps, top, vmstat, w, kill, free, slabtop et skill. + procps is the package that has a bunch of small useful utilities that give information about processes using the /proc filesystem. The package includes the programs ps, top, vmstat, w, kill, free, slabtop, and skill. + Procps /proc dosya sistemini kullanarak çalışan süreçler hakkında bilgi vermeye yarayan bazı kullanışlı uygulamaları içeren bir pakettir. Paket ps, top, vmstat, w, kill, free, slabtop ve skill gibi uygulamaları içerir. + http://downloads.sourceforge.net/project/procps-ng/Production/procps-ng-3.3.12.tar.xz + + ncurses-devel + + system/base/procps/pspec.xml + + + procps + + ncurses + /bin + /sbin /lib - /usr/share/locale + /usr/lib + /usr/bin /usr/share/doc /usr/share/man + /usr/share/locale + /usr/include + + + + + 2017-01-07 + 3.3.12 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 3.3.11 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-09 + 3.3.11 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + sysvinit + http://freshmeat.net/projects/sysvinit/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + system.base + Programs which control basic system processes + sysvinit package contains a group of utilities that control the very basic functions of your system. sysvinit contains the init program, the first program started by the Linux kernel when the system boots. + http://download.savannah.gnu.org/releases/sysvinit/sysvinit-2.88dsf.tar.bz2 + + sysvinit-2.86-ctrlc.patch + sysvinit-2.78-man.patch + sysvinit-2.86-loginshell.patch + sysvinit-2.86-single.patch + sysvinit-2.88-quiet.patch + sysvinit-2.88-ipv6.patch + sysvinit-2.88-omit.patch + sysvinit-2.88-wall-maxlines.patch + + system/base/sysvinit/pspec.xml + + + sysvinit + + /bin + /sbin + /usr/bin + /usr/share/man + /usr/include + + + System.Package + + + + sysvinit-tools + Tools used for process and utmp management + Süreç ve utmp yönetim araçları + + /bin/mountpoint + /sbin/pidof + /sbin/killall5 + /sbin/sulogin + /usr/bin/wall + /usr/bin/last + /usr/bin/lastb + /usr/bin/mesg + /usr/bin/utmpdump + /usr/share/man/man1 + /usr/share/man/man8/killall5* + /usr/share/man/man8/pidof* + /usr/share/man/man8/sulogin* + + + + + 2016-04-27 + 2.88 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 2.88 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + gzip + http://www.gnu.org/software/gzip + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + LGPLv2.1 + app:console + system.base + Standard GNU compressor + GNU dosya arşiv aracı + gzip (GNU zip) est un programme populaire de compression de donnée écrit pour le projet GNU. + gzip (GNU zip) is a popular data compression program written for the GNU project. + Gzip (GNU zip) GNU projesi için geliştirilmiş popüler bir veri sıkıştırma programıdır. + http://ftp.gnu.org/gnu/gzip/gzip-1.8.tar.xz + system/base/gzip/pspec.xml + + + gzip + + /bin + /usr/share/doc + /usr/share/man + /usr/share/info + + + + + 2017-01-23 + 1.8 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 1.8 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 1.8 + Versiyon bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-02-28 + 1.6 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + dbus-glib + http://dbus.freedesktop.org/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + AFL-2.1 + library + system.base + Glib bindings for D-Bus + D-Bus için GLib bağlayıcıları + dbus-glib is an add-on library to integrate the standard D-Bus library with the GLib thread abstraction and main loop. + dbus-glib, standart D-Bus kitaplığını GLib ana döngüsüyle bütünleştirmek için kullanılan bir kitaplıktır. + http://dbus.freedesktop.org/releases/dbus-glib/dbus-glib-0.108.tar.gz + + dbus-devel + glib2-devel + libpcre-devel + expat-devel + libxml2 + + system/base/dbus-glib/pspec.xml + + + dbus-glib + + dbus + glib2 + expat + libxml2 + + + /usr/bin + /usr/libexec/dbus-bash-completion-helper + /usr/lib + /usr/share/doc + /usr/share/man/man1 + /etc/bash_completion.d + /usr/share/bash-completion + /usr/libexec + + + + dbus-glib-devel + Development files for dbus-glib + dbus-glib için geliştirme dosyaları + system.devel + + dbus-glib + dbus-devel + glib2-devel + + + /usr/include/dbus-1.0 + /usr/lib/pkgconfig + /usr/share/man/man3 + + + + + 2017-01-26 + 0.108 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 0.104 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-10 + 0.104 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + texinfo + http://www.gnu.org/software/texinfo/ + + PisiLinux Community + admins@pisilinux.org + + GPLv3 + app:console + system.base + programme et utilitaires GNU info. + The GNU info program and utilities + GNU info (bilgi) programı ve araçları + GNU Info Prgramm und Werkzeuge + Texinfo is a documentation system that can produce both online information and printed output from a single source file. The GNU Project uses the Texinfo file format for most of its documentation. + mirrors://gnu/texinfo/texinfo-6.3.tar.gz + + ncurses + perl + + system/base/texinfo/pspec.xml + + + texinfo + + ncurses + perl + + + /usr/bin + /usr/lib/texinfo + /usr/share/doc + /usr/share/man + /usr/share/info + /usr/share/texinfo + /usr/share/texmf/tex/texinfo + /usr/share/locale + /usr/share/texmf/ + + + System.PackageHandler + + + + + 2017-01-07 + 6.3 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 6.1 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-02-28 + 6.1 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + sqlite + http://www.sqlite.org/ + + PisiLinux Community + admins@pisilinux.org + + as-is + library + system.base + An SQL Database Engine in a C Library + Bir C kütüphanesi içindeki bir SQL veritabanı motoru + SQLite est une petite librairie C implémentant un moteur de base de données SQL auto-configurée, auto-suffisante, pouvant être embarquée. Gère des bases de données de tailles allant jusqu'à 2 téraOctets. + SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine. Supports databases up to 2 terabytes in size. + SQLite hiçbir ayar gerektirmeyen, başka programların içine gömülebilir bir SQL veritabanı motorudur. 2 terabayta kadar büyüklükteki veritabanlarını tutabilir. + http://sqlite.org/2017/sqlite-autoconf-3160200.tar.gz + http://sqlite.org/2017/sqlite-doc-3160200.zip + + readline-devel + + system/base/sqlite/pspec.xml + + + sqlite + + readline + + + /usr/lib + /usr/share/man + /usr/bin + /usr/share/doc/sqlite/README + + + + sqlite-devel + Development files for sqlite + sqlite için geliştirme dosyaları + system.devel + + sqlite + + + /usr/include + /usr/lib/pkgconfig + /usr/lib32/pkgconfig + + + + sqlite-32bit + 32-bit shared libraries for sqlite + emul32 + emul32 + + sqlite + + + /usr/lib32 + + + + sqlite-doc + sqlite-doc, sqlite için doküman belgeleri + + sqlite + + + /usr/share/doc/sqlite/ + + + + + 2017-01-26 + 3.16.2 + Verison Bump. + PisiLinux Community + admin@pisilinux.org + + + 2017-01-07 + 3.11.1 + Rebuildwith new toolchain. + PisiLinux Community + admin@pisilinux.org + + + 2017-01-05 + 3.11.1 + Version Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-06-15 + 3.11.0.0 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-02 + 3.11.0.0 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + tar + http://www.gnu.org/software/tar/ + + PisiLinux Community + admins@pisilinux.org + + GPLv3+ + app:console + system.base + A GNU file archiving program + GNU dosya arşivleme uygulaması + Le programme tar fournit la possibilité de manipuler des archives de type tar. Vous pouvez l'utiliser pour créer ou extraires des archives. Ajouter des fichiers à des archives existantes, les mettre à jour ou tout simplement lister leur contenu. + The GNU tar program saves many files together in one archive and can restore individual files (or all of the files) from that archive. + GNU tar birden fazla dosyayı tek bir arşiv dosyasında birleştiren ve daha sonra bu arşiv dosyasından geri çıkartabilen bir uygulamadır. + http://mirrors.kernel.org/gnu/tar/tar-1.29.tar.xz + + tar.1 + + + acl-devel + gettext + + system/base/tar/pspec.xml + + + tar + + acl + glibc + + + /bin + /sbin + /usr/share/doc + /usr/share/man + /usr/share/locale + /usr/share/info + + + + + 2017-01-06 + 1.29 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 1.28 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-02-28 + 1.28 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + libxml2 + http://www.xmlsoft.org/ + + PisiLinux Community + admins@pisilinux.org + + MIT + library + system.base + Version 2 of the library to manipulate XML files + XML türü dosyaları işlemeye aracılık eden kütüphanenin 2. sürümü + Libxml2 est l'analyseur et la boîte à outils XML écrit en C pour le projet Gnome (mais utilisable en dehors de la plateforme Gnome). + Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform). + Libxml2, Gnome projesi için geliştirilmiş C dilinde XML ayrıştırıcısıdır. Gnome platformu olmadan da kullanılabilir. + ftp://xmlsoft.org/libxml2/libxml2-2.9.4.tar.gz + + python-devel + xz-devel + zlib-devel + readline-devel + + system/base/libxml2/pspec.xml + + + libxml2-docs + system.doc + + libxml2 + + + /usr/share/doc + + + + libxml2 + + xz + zlib + python + readline + + + /usr/bin + /usr/lib + /usr/share/man - attr-devel - Development files for attr - attr için geliştirme dosyaları + libxml2-devel + Development files for libxml2 + libxml2 için geliştirme dosyaları system.devel - attr + libxml2 + + + /usr/lib/pkgconfig + /usr/lib32/pkgconfig + /usr/include + /usr/share/aclocal + /usr/share/man/man3 + + + + libxml2-32bit + 32-bit shared libraries for libxml2 + libxml2 için 32-bit paylaşımlı kitaplıklar + emul32 + emul32 + + xz-32bit + zlib-32bit + readline-32bit + + + libxml2 + xz-32bit + zlib-32bit + + + /usr/lib32 + + + + + 2017-01-24 + 2.9.4 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2017-01-08 + 2.9.3 + Rebuild with new toolchain. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 2.9.3 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-04 + 2.9.3 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + libpcre + http://www.pcre.org/ + + PisiLinux Community + admins@pisilinux.org + + BSD + library + system.base + Perl-compatible regular expression library + Perl-uyumlu sıradan ifade kütüphanesi + La librairie PCRE (Expressions Régulières Compatible avec Perl) est un ensemble de fonctions implémentant la recherche de motifs de texte à l'aide d'expressions régulières utilisant la même syntaxe et la même sémantique que Perl5. + The PCRE (Perl Compatible Regular Expressions) library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5. + PCRE kütüphanesi, Perl 5 programlama dili sözdizimi ve semantiği ile kalıp eşleştirme (pattern matching) görevini yürüten fonksiyonları barındırır. + http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.bz2 + + readline-devel + + system/base/libpcre/pspec.xml + + + libpcre + + libgcc + readline + + + /usr/lib + /usr/share/man + /usr/share/doc + /usr/bin + + + + libpcre-devel + Development files for libpcre + libpcre için geliştirme dosyaları + system.devel + + libpcre + + + /usr/include + /usr/share/man/man3 + /usr/lib/pkgconfig + /usr/lib32/pkgconfig + /usr/share/doc/libpcre/html + /usr/bin/pcre-config + /usr/share/man/man1/pcre-config.1* + /usr/share/doc/libpcre/pcre-config.txt + + + + libpcre-32bit + 32-bit shared libraries for libpcre + libpcre için 32-bit paylaşımlı kitaplıklar + emul32 + emul32 + + readline-32bit + + + libgcc + libpcre + + + /usr/lib32 + + + + + 2017-01-20 + 8.40 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2017-01-07 + 8.38 + Rebuild with new toolchain. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 8.38 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-02-25 + 8.38 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + libcap + http://www.kernel.org/pub/linux/libs/security/linux-privs/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + BSD + library + system.base + capacités POSIX 1003.1e. + POSIX 1003.1e capabilities library + POSIX 1003.1e desteği + libcap is a library for getting and setting POSIX.1e (formerly POSIX 6) draft 15 capabilities. + https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.25.tar.xz + + attr-devel + pam-devel + + system/base/libcap/pspec.xml + + + libcap + + pam + attr + + + /sbin + /lib + /usr/lib + /usr/share/man + /usr/share/doc + /etc + + + + libcap-devel + Development files for libcap + libcap için geliştirme dosyaları + system.devel + + libcap /usr/include @@ -10241,38 +9751,1171 @@ - attr-32bit - 32-bit shared libraries for attr + libcap-32bit + 32-bit shared libraries for libcap + libcap için 32-bit paylaşımlı kitaplıklar emul32 emul32 + + attr-32bit + - attr + attr-32bit - /lib32 + /usr/lib32 - 2017-01-02 - 2.4.47 + 2017-01-25 + 2.25 + Rebuild. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 2.25 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-02 + 2.25 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + libuser + https://fedorahosted.org/libuser + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + library + system.base + A user and group account administration library + Kullanıcı ve grup hesap yönetim kitaplığı + libuser implements a standardized interface for manipulating and administering user and group accounts. The library uses pluggable back-ends to interface to its data sources. + libuser kullanıcı ve grup hesaplarını yönetmek ve işlemek için standart bir arayüz sunar. Kitaplık, sağladığı arayüzün verilere erişimi için genişletilebilir arkauçlar kullanmaktadır. + https://fedorahosted.org/releases/l/i/libuser/libuser-0.62.tar.xz + + pam-devel + popt-devel + glib2-devel + python-devel + + + libuser-0.56.15-fix_blowfish.patch + libuser-0.56.9-fix-str-fmt.patch + + system/base/libuser/pspec.xml + + + libuser + + pam + popt + glib2 + python + + + /etc + /usr/share/man + /usr/share/doc + /usr/share/locale + /usr/bin + /usr/sbin + /usr/lib + + + + libuser-devel + Development files for libuser + libuser için geliştirme dosyaları + system.devel + + libuser + glib2-devel + + + /usr/include + /usr/lib/pkgconfig + + + + + 2017-01-25 + 0.62 + Rebuild. + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 0.62 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-08 + 0.62 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + plyvel + https://pypi.python.org/pypi/plyvel + + Alihan Öztürk + alihan@pisilinux.org + + BSD + app:console + system.base + Plyvel, a fast and feature-rich Python interface to LevelDB. + Plyvel, LevelDB için, hızlı ve zengin özellikli Python arabirimi. + Plyvel has a rich feature set, high performance, and a friendly Pythonic API. + Plyvel zengin özelliklere sahip bir set, yüksek performanslı, ve kullanıcı dostu bir Pythonic API. + https://pypi.python.org/packages/source/p/plyvel/plyvel-0.9.tar.gz + + cython + python-devel + leveldb-devel + python-setuptools + + system/base/plyvel/pspec.xml + + + plyvel + + libgcc + python + leveldb + + + /usr/lib + /usr/share/doc + + + + + 2017-01-21 + 0.9 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 0.9 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-02 + 0.9 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + libunwind + http://www.nongnu.org/libunwind/ + + PisiLinux Community + admins@pisilinux.org + + MIT + library + system.base + Call chain tracer of a program + Yazılım çağrıları geri izleme aracı + libunwind is a portable and efficient C programming interface (API) to determine the call chain of a program. + libunwind bir yazılımın çağrı sıralamasını takip etmek için kullanılan, hızlı çalışan ve taşınabilir bir C programlama arabirimidir. + http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz + + xz-devel + + system/base/libunwind/pspec.xml + + + libunwind + + xz + + + /usr/lib + /usr/share/doc/libunwind + /usr/share/man + /usr/share/man/man3 + + + + libunwind-devel + Development files for libunwind + libunwind için geliştirme dosyaları + + libunwind + + + /usr/include + /usr/lib/pkgconfig + + + + + 2017-01-21 + 1.1 Rebuild with new toolchain. Ertuğrul Erata ertugrulerata@gmail.com 2016-04-27 - 2.4.47 + 1.1 Release Bump PisiLinux Community admin@pisilinux.org - 2016-03-01 - 2.4.47 + 2016-03-02 + 1.1 First release - Serdar Soytetir - kaptan@pisilinux.org + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + cracklib + http://www.sourceforge.net/projects/cracklib + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + library + system.base + Librairie de vérification de mot de passe. + Password Checking Library + Parola Kontrol Kütüphanesi + Bibliothek, um Passwörter zu prüfen + CrackLib tests passwords to determine whether they match certain security-oriented characteristics, with the purpose of stopping users from choosing passwords that are easy to guess. + CrackLib, kullanıcıların kolay tahmin edilebilir parolalar seçmelerini engellemek amacıyla parolaların güvenlik odaklı bazı özelliklere sahip olup olmadıklarını denetler. + https://github.com/cracklib/cracklib/releases/download/cracklib-2.9.6/cracklib-2.9.6.tar.gz + + zlib-devel + python-devel + + system/base/cracklib/pspec.xml + + + cracklib + + zlib + python + + + /lib + /usr/lib + /usr/sbin + /usr/share/locale + /usr/share/doc + /usr/share/cracklib + + + + cracklib-devel + Development files for cracklib + cracklib için geliştirme dosyaları + system.devel + + cracklib + + + /usr/include + + + + + 2017-01-24 + 2.9.6 + Rebuild. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 2.9.6 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-03 + 2.9.6 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + zlib + http://www.gzip.org/zlib/ + + PisiLinux Community + admins@pisilinux.org + + ZLIB + library + system.base + Librairie de compression/extraction standard + Standard (de)compression library + Standart sıkıştırma/açma kütüphanesi + Zlib is a general-purpose, patent-free, lossless data compression library which is used by many different programs. + mirrors://sourceforge/libpng/zlib-1.2.10.tar.xz + + dont-call-ldconfig.patch + + system/base/zlib/pspec.xml + + + minizip + Library for manipulating files from a zip archive + zip arşivlerindeki dosyaları yönetmek için kitaplık + util.archive + minizip + + zlib + + + /usr/lib/libminizip* + + + + minizip-devel + Development files for minizip + minizip için geliştirme dosyaları + util.archive + minizip + + minizip + zlib-devel + + + /usr/include/minizip + /usr/lib/pkgconfig/minizip.pc + + + + zlib + + /lib/libz.so* + /usr/lib/libz.so* + /usr/share/doc + /usr/share/man + + + + zlib-devel + Development files for zlib + zlib için geliştirme dosyaları + system.devel + + zlib + + + /usr/lib/pkgconfig/zlib.pc + /usr/lib32/pkgconfig + /usr/include/z*.h + /usr/share/man/man3 + /usr/share/doc/zlib/algorithm.txt + /usr/share/doc/zlib/example.c + + + + zlib-32bit + 32-bit shared libraries for zlib + zlib için 32-bit paylaşımlı kitaplıklar + emul32 + emul32 + + zlib + + + /usr/lib32/libz.so* + + + + + 2017-01-21 + 1.2.10 + version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2017-01-02 + 1.2.8 + Rebuild with new toolchain. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 1.2.8 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-02-28 + 1.2.8 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + sysfsutils + http://linux-diag.sourceforge.net/Sysfsutils.html + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + system.base + System Utilities Based on Sysfs + Çeşitli sistem araç ve gereçleri + Ceci est un ensemble d'utilitaires se basant sur sysfsm un nouveau système de fichier virtuel des noyaux Linux 2.5 et + exposant l'arbre des périphériques du système. + These are a set of utilites built upon sysfs, a new virtual filesystem in Linux kernel versions 2.5+ that exposes a system's device tree. + sysfsutils sysfs sanal dosya sistemi üzerine kurulu bir araç setidir. + mirrors://sourceforge/linux-diag/sysfsutils-2.1.0.tar.gz + + sysfsutils-2.0.0-class-dup.patch + sysfsutils-2.1.0-get_link.patch + + system/base/sysfsutils/pspec.xml + + + sysfsutils + + /usr/bin + /lib + /usr/lib + /usr/share/doc + /usr/share/man + + + + sysfsutils-devel + Development files for sysfsutils + sysfsutils için geliştirme dosyaları + system.devel + + sysfsutils + + + /usr/include + /usr/share/man/man3 + + + + + 2016-04-27 + 2.1.0 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-06 + 2.1.0 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + mingetty + ftp://ftp.suse.com/pub/projects/init/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + system.base + A compact getty program for virtual consoles only + Sadece sanal konsollar için yekpare bir getty programı + mingetty, est getty poids plume minimaliste à utiliser exclusivement sur les consoles virtuelles. + mingetty, is a lightweight, minimalist getty for use on virtual consoles only. + mingetty yalnızca sanal konsollar için tasarlanmış basit ve yalın getty uygulamasıdır. + http://sourceforge.net/projects/mingetty/files/mingetty/1.08/mingetty-1.08.tar.gz + + gettext + + + tr.patch + mingetty-utf8.patch + + system/base/mingetty/pspec.xml + + + mingetty + + glibc + + + /sbin + /usr/share/locale + /usr/share/man + /usr/share/doc + + + + + 2016-04-27 + 1.0.8 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-09 + 1.0.8 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + pypolkit + http://www.pisilinux.org + + PisiLinux Community + admins@pisilinux.org + + MIT + library + system.base + Python binding of PolicyKit + PolicyKit için Python bağlayıcısı + pypolkit is a Python binding for the PolicyKit library. + pypolkit PolicyKit için geliştirilmiş bir Python bağlayıcısıdır. + http://source.pisilinux.org/1.0/pypolkit-1.0.2.tar.gz + + glib2-devel + python-devel + polkit-devel + + system/base/pypolkit/pspec.xml + + + pypolkit + + glib2 + polkit + python + + + /usr/lib + /usr/share/doc + + + + + 2016-04-27 + 1.0.2 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-09 + 1.0.2 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + popt + http://www.rpm5.org/ + + PisiLinux Community + admins@pisilinux.org + + as-is + app:console + library + system.base + Popt command line option parser + Popt komut satırında çalıştıran bir seçenek ayrıştırıcıdır. + La librairie popt existe essentiellement pour analyser des options de ligne de commande. Elle procure de nombreux avantages tels que l'absence de variables globales, la possibilité d'analyser un tableau arbitraire d'éléments de type argv, d'exécuter des filtres d'options extérieurs, la génération automaituqe des messages d'aide et d'utilisation ainsi qu'un méthode standard pour synonymes d'options. + The popt library exists essentially for parsing command line options with advantages such as there are no global variables, ability to parse an arbitrary array of argv-style elements, to exec external option filters, and automatic generation of help and usage messages, a standard method of option aliasing. + Popt, komut satırında seçenek ayrıştırma için gerekli bir kütüphanedir. Genel değişken olmaması, dağınık dizi bileşenlerini ayrıştırabilmesi, harici uygulama filtreleri kullanabilmesi, otomatik mesaj ve yardım dosyaları üretimi gibi başarılı özellikleri bulunur. + ftp://anduin.linuxfromscratch.org/BLFS/svn/p/popt-1.16.tar.gz + system/base/popt/pspec.xml + + + popt + + gettext + + + /usr/lib + /usr/share/doc + /usr/share/man + /usr/share/locale + + + + popt-devel + Development files for popt + popt için geliştirme dosyaları + system.devel + + popt + + + /usr/include/popt.h + /usr/share/man/man3 + /usr/lib/pkgconfig + + + + + 2017-01-23 + 1.16 + Rebuild. + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 1.16 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-08 + 1.16 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + pisilinux-python + http://www.pisilinux.org + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + library + system.base + Python modules for Pisi Linux + PiSi Linux için Python modülleri + Python modules for Pisi Linux provides functions for common task, with the aim of easing development. + PiSi Linux için Python modülleri genel işler için fonksiyonlar sunarak geliştirme işini kolaylaştırmayı amaçlamaktadır. + Módulos Python para PiSi Linux facilitan funciones para tareas comunes, para simplificar el desarrollo. + http://source.pisilinux.org/1.0/pisilinux-python-0.4.8.tar.gz + + python-devel + libX11-devel + + system/base/pisilinux-python/pspec.xml + + + pisilinux-python + + python + + + /usr/lib + /usr/share/doc + /usr/share/locale + + + + pisilinux-python-xorg + x11.library + + python + libX11 + + + /usr/lib/python2.7/site-packages/pardus/xorg + + + + + 2017-01-24 + 0.4.8 + Rebuild. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 0.4.8 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-02 + 0.4.8 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + curl + http://curl.haxx.se/ + + PisiLinux Community + admins@pisilinux.org + + MIT + X11 + app:console + library + system.base + Un client qui maîtrise tout ce qui concerne les URLs + A utility for getting files from remote servers + Uzak sunuculardan dosya indirmek için bir araç + Ein Client, der URLs versteht + curl is a command line tool for transferring data with URL syntax, supporting various protocols. + curl çeşitli protokolleri destekleyen, URL söz dizimini kullanarak uzak sunuculardan veri aktarmak için kullanılan bir komut satırı aracıdır. + http://curl.haxx.se/download/curl-7.52.1.tar.bz2 + + glibc-devel + zlib-devel + openssl-devel + libidn-devel + libssh2-devel + ca-certificates + + + curl-ac.patch + + system/base/curl/pspec.xml + + + curl + + zlib + libidn + libssh2 + openssl + ca-certificates + + + /usr/bin + /usr/lib + /usr/share/doc/ + /usr/share/man/ + /usr/share/curl + /usr/share/zsh + + + + curl-devel + Development files for curl + curl için geliştirme dosyaları + system.devel + + curl + + + /usr/lib/pkgconfig + /usr/bin/curl-config + /usr/include/curl + /usr/share/aclocal + + + + + 2017-01-22 + 7.52.1 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 7.47.1 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-02 + 7.47.1 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + mudur + http://www.pisilinux.org + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + system.base + Pisi Linux boot and initialization system + Pisi Linux açılış sistemi + Gère le montage de systèmes de fichier, le chargement de pilotes de périphérique, le démarrage des services système et d'autres tâches pendant les séquences de démarrage et d'arrêt de Pisi Linux. + mudur handles mounting of the filesystems, loading of the device drivers, starting of the system services, and other jobs during the Pisi Linux boot and shutdown sequences. + Pisi Linux açılış ve kapanışı sırasında, dosya sistemlerinin bağlanması, donanım sürücülerinin yüklenmesi, servislerin başlatılması gibi işleri yürütür. + http://source.pisilinux.org/1.0/mudur-4.4.0.tar.xz + + set_file_mode.patch + no_err-no_msg.patch + recreate_dir_if_new_uid_or_gid.patch + boot_option.patch + mount_cgroupfs.patch + + system/base/mudur/pspec.xml + + + mudur + + kbd + bash + dbus + kmod + eudev + comar + procps + python + rsyslog + sysvinit + coreutils + e2fsprogs + net-tools + baselayout + util-linux + wireless-tools + pisilinux-python + + + /etc/conf.d + /etc/mudur/services + /etc/init.d + /sbin + /bin + /usr/share/locale + + + System.PackageHandler + System.Service + System.Package + System.Settings + Disk.Manager + + + + + 2016-04-27 + 4.4.0 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-11 + 4.4.0 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + vixie-cron + http://www.gentoo.org/ + + PisiLinux Community + admins@pisilinux.org + + as-is + service + system.base + Paul Vixie's cron daemon, a fully featured crond implementation + Tam teşekküllü bir crond uyarlaması + Vixie cron (Cron est un daemon qui lance des tâches planifiées) est une implémentation riche basée sur le cron SysV. Chaque utilisateur possède sa propre table de planification (ou crontab - la CRON TABle de Crontab) est un fichier qui contient le planning de cron) et a la possibilité de spécifier des variables d'environnement au sein de la table. + Vixie cron (Cron is a daemon that runs scheduled tasks.) is a full featured cron implementation based on SysV cron. Each user has his own crontab ( Crontab (CRON TABle) is a file which contains the schedule of cron) and is allowed to specify environment variables within that crontab. + Vixie-cron (cron, zamanlanmış görevleri çalıştıran dinleyici programdır.) SysV cron tabanlı tam sürüm cron uygulamasıdır. Her kullanıcı kendi crontab 'ına (crontab cron listesini içeren dosyadır.) sahiptir ve bu crontab içinde ortam değişkenlerini yazmasına müsade edilmiştir. + http://ftp.linux.org.tr/gentoo/distfiles/vixie-cron-4.1.tar.bz2 + + sed + pam-devel + + + vixie-cron-4.1-gentoo-r4.patch.bz2 + crontab.5.diff + vixie-cron-4.1-commandline.patch + vixie-cron-4.1-pam.patch + vixie-cron-4.1-CAN-2005-1038.patch + CVE-2006-2607.patch + CVE-2007-1856.patch + + system/base/vixie-cron/pspec.xml + + + vixie-cron + + pam + comar-api + + + /usr/sbin + /usr/bin + /etc + /var/spool + /usr/share/doc + /usr/share/man + + + System.Package + System.Service + + + run-crons-0.3.1 + crontab + vixie-cron-4.1-cron.deny + cron.pam.d + + + + + 2016-04-27 + 4.1 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-11 + 4.1 + First release + Kamil Atlı + suvari@pisilinux.org + + + + + + openssl + http://www.openssl.org/ + + PisiLinux Community + admins@pisilinux.org + + as-is + app:console + library + system.base + Toolkit for SSL v2/v3 and TLS v1 + SSL v2/v3 ve TLS v1 için araç kiti + OpenSSL est un outil cryptographique implémentant une couche de communication sécurisée (SSL v2/v3) et une couche de transport sécurisée (TLS v1) + OpenSSL is a cryptography toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) network protocols and related cryptography standards required by them. + OpenSSL, Güvenlik Soketleri Katmanı (SSL v2/v3) ve Aktarım Katmanı Güvenliği (TLSv1) ağ protokolleri ile bu protokollerin gerektirdiği şifreleme standartlarını uygulayan bir şifreleme aracıdır. + OpenSSL ist ein Kryptographie Werkzeug, das die Netzwerkprotokolle Secure Sockets Layer (SSL v2/v3) und Transport Layer Security (TLS v1) sowie deren erforderliche zugehörige Kryptographie Standards implementiert. + https://www.openssl.org/source/openssl-1.0.2j.tar.gz + + openssl-1.0.0-beta4-ca-dir.patch + + + zlib-devel + xorg-util + perl + sed + + + openssl-1.0.0a-ldflags-norpath.patch + openssl-1.0.0-beta4-ca-dir.patch + openssl-1.0.0-beta5-enginesdir.patch + openssl-1.0.2-ipv6.patch + openssl_fix_for_x32_2.patch + openssl-ca-certificates.patch + CVE-2014-0198.patch + openssl-1.0.2a-x32-asm.patch + + system/base/openssl/pspec.xml + + + openssl + + zlib + ca-certificates + + + /etc + /usr/bin + /usr/lib + /usr/share/doc + + + System.Package + + + + openssl-devel + Development files for openssl + openssl için geliştirme dosyaları + system.devel + + openssl + + + /usr/include + /usr/share/man + /usr/lib/pkgconfig + /usr/lib32/pkgconfig + + + + openssl-32bit + 32-bit shared libraries for openssl + openssl için 32-bit paylaşımlı kitaplıklar + emul32 + _emul32 + + zlib-32bit + + + openssl + zlib-32bit + + + /usr/lib32 + + + + + 2017-01-08 + 1.0.2j + Rebuild with new toolchain. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2017-01-08 + 1.0.2j + Version bump. + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 1.0.2g + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-02 + 1.0.2g + First release + Ayhan Yalçınsoy + ayhanyalcinsoy@pisilinux.org + + + + + + nss-mdns + http://0pointer.de/lennart/projects/nss-mdns/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + library + system.base + Name Service Switch module + İsim servisi değiştirme modülü + Module d'échange de service de nom pour le DNS Multicast. + Name Service Switch module for Multicast DNS. + Çoklu gönderim yapan DNS'ler için isim servisi seçme modülü. + http://0pointer.de/lennart/projects/nss-mdns/nss-mdns-0.10.tar.gz + + nss-mdns-0.8-avahi-socket.patch + + system/base/nss-mdns/pspec.xml + + + nss-mdns + + /etc + /usr/lib + /usr/share/doc + + + mdns.allow + + + + + 2016-04-27 + 0.10 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-09 + 0.10 + First release + Alihan Öztürk + alihan@pisilinux.org @@ -10292,10 +10935,14 @@ Les utilitaires PCI sont une collection de programmes d'inspection et de manipulation de la configuration des périphériques PCI. The PCI Utilities are a collection of programs for inspecting and manipulating configuration of PCI devices. Pakette bulunan PCI araçları, PCI veriyolunu kullanan donanımlarınızın görüntülenmesi ve ayarlanması işlevini yürütür. - ftp://ftp.kernel.org/pub/software/utils/pciutils/pciutils-3.4.1.tar.xz + ftp://ftp.kernel.org/pub/software/utils/pciutils/pciutils-3.5.2.tar.xz pci.ids + + eudev-devel + libkmod-devel + pciutils-nogz.patch pciutils-remove-update-pciids.patch @@ -10323,7 +10970,7 @@ pciutils için geliştirme dosyaları system.devel - pciutils + pciutils /usr/lib/pkgconfig @@ -10331,6 +10978,13 @@ + + 2017-01-29 + 3.5.2 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + 2016-04-27 3.4.1 @@ -10347,6 +11001,285 @@ + + + libee + http://www.libee.org/ + + Marcin Bojara + marcin@pisilinux.org + + LGPLv2.1 + library + system.base + An Event Expression Library inspired by CEE + Libee - An Event Expression Library inspired by CEE + http://www.libee.org/download/files/download/libee-0.4.1.tar.gz + + libestr-devel + + system/base/libee/pspec.xml + + + libee + + libestr + + + /usr/sbin + /usr/lib/libee.so* + /usr/share/doc/libee + + + + libee-devel + Development files for libestr + system.devel + + libee + + + /usr/include/libee + /usr/lib/pkgconfig/libee.pc + + + + + 2016-04-27 + 0.4.1 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-08 + 0.4.1 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + busybox + http://www.busybox.net + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + system.base + Statically linked binary providing simplified versions of system commands + Statik bağlanmış sistem komutları bütünü + busybox is a single binary which includes versions of a large number of system commands, including a shell. + busybox, kabuk da dahil olmak üzere çeşitli sistem komutlarını içeren tek bir çalıştırılabilir dosyadır. + https://busybox.net/downloads/busybox-1.25.1.tar.bz2 + + config + + system/base/busybox/pspec.xml + + + busybox + + /bin + + + + + 2017-01-28 + 1.25.1 + Release Bump. + Stefan Gronewold(groni) + groni@pisilinux.org + + + 2016-04-27 + 1.24.1 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-07 + 1.24.1 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + gawk + http://www.gnu.org/software/gawk/gawk.html + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + system.base + GNU awk pattern-matching language + Metin işleme uygulaması olan awk'ın GNU versiyonu + L'outil awk interprète un langage de programmation spécifique permettant d'effectuer les tâches de modifications simples de données en quelques lignes de code. Il vous permet de faire des changements dans différents fichiers texte lorsqu'un certain patron apparaît ou d'extraire des données de fragments de lignes tout en laissant de côté le reste. Gawk est l'implémentation GNU d'awk. + The awk utility interprets a special-purpose programming language that makes it possible to handle simple data-reformatting jobs with just a few lines of code. It helps you to make changes in various text files wherever certain patterns appear, or extract data from parts of certain lines while discarding the rest. Gawk is the GNU implementation of awk. + awk uygulaması az bir kod ile basit veri formatı düzenleme işlerinizi yapabilmenize olanak sağlayan özel amaçlı bir programlama dilidir. Uygulama birçok farklı metin dosyası içinde aradığınız parçaları bulup değiştirmenize veya diğer satırlardan ayırarak işlemenize yardımcı olur. Gawk programı awk'ın GNU sürümüdür. + ftp://mirrors.kernel.org/gnu/gawk/gawk-4.1.4.tar.xz + + gettext + + system/base/gawk/pspec.xml + + + gawk + + readline + gmp + mpfr + + + /usr/bin + /usr/libexec + /usr/lib/gawk + /usr/include + /usr/share/awk + /usr/share/doc + /usr/share/man + /usr/share/info + /usr/share/locale + + + + + 2017-01-07 + 4.1.4 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 4.1.3 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-02-28 + 4.1.3 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + polkit + http://www.freedesktop.org/wiki/Software/PolicyKit + + PisiLinux Community + admins@pisilinux.org + + LGPLv2+ + service + library + app:console + system.base + PolicyKit Authorization Framework + Sistem bileşenleri için erişim politikası servisi + polkit est un cadre de développement (framework) pour définir des politiques à appliquer à des composants du système ainsi que fournir à des parties du bureau la possibilité de les configurer. + polkit is a toolkit for defining and handling authorizations. It is used for allowing unprivileged processes to speak to privileged processes. + polkit, sistem genelindeki bileşenlerin ve masaüstü bileşenlerinin ayarlayabileceği şekilde ilkeler tanımlamak için araçlardan oluşur. + http://www.freedesktop.org/software/polkit/releases/polkit-0.113.tar.gz + + dbus-devel + pam-devel + glib2-devel + expat-devel + spidermonkey-devel + gobject-introspection-devel + intltool + + + use-system-locale-in-gobject-api.diff + + system/base/polkit/pspec.xml + + + polkit-devel + Development headers for polkit + polkit geliştirme başlıkları + system.devel + + polkit + glib2-devel + + + /usr/include + /usr/lib/pkgconfig + + + + polkit + + pam + glib2 + expat + spidermonkey + + + /etc + /usr/lib + /usr/libexec + /usr/bin + /usr/sbin + /usr/share/locale + /usr/share/polkit-1 + /usr/share/dbus-1 + /usr/share/gir-1.0 + /var/lib/polkit-1 + /lib/systemd + /usr/share/man + /usr/share/doc + + + man/pklocalauthority.8 + man/polkit.8 + man/polkitd.8 + man/pkaction.1 + man/pkcheck.1 + man/pkexec.1 + 70-desktop-policy.conf + + + + + 2017-01-29 + 0.113 + Rebuild. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 0.113 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-09 + 0.113 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + shadow @@ -10446,8 +11379,8 @@ - pycurl - http://pycurl.sourceforge.net/ + libusb-compat + http://libusb.sourceforge.net/ PisiLinux Community admins@pisilinux.org @@ -10455,267 +11388,74 @@ LGPLv2.1 library system.base - Python cURL Module - Python cURL Modülü - PycURL is a Python interface to libcurl. PycURL can be used to fetch objects identified by a URL from a Python program. - PycURL, python libcurl için python arayüzüdür. PycURL, URL tarafında tanımlanan nesneleri indirmek için bir python programı tarafından kullanılabilir. - https://dl.bintray.com/pycurl/pycurl/pycurl-7.43.0.tar.gz + Userspace access to USB devices + Project's main aim is to create a library for use by user level applications to access USB devices regardless of OS. + mirrors://sourceforge/libusb/libusb-compat-0.1.5.tar.bz2 - curl-devel - python-devel - openssl-devel + libtool + libusb-devel - system/base/pycurl/pspec.xml + system/base/libusb-compat/pspec.xml - pycurl + libusb-compat - curl - python - openssl + libusb /usr/lib /usr/share/doc - - - 2017-01-22 - 7.43.0 - Rebuild with new toolchain. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 7.43.0 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-02 - 7.43.0 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - kbd - http://freshmeat.net/projects/kbd/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - system.base - Keyboard and console utilities - Klavye ve konsol araçları - Le paquet kbd contient les fichiers de configuration de touches ainsi que divers utilitaires pour claviers compatible avec le noyau 1.1.54 et suivants. - The kbd package contains keytable files and keyboard utilities compatible with kernel version 1.1.54 and later. - Kbd paketi, çekirdek sürüm 1.1.54 ve sonraki sürümlerle uyumlu anahtar tablo dosyaları ve klavye yardımcı uygulamaları içerir. - https://www.kernel.org/pub/linux/utils/kbd/kbd-2.0.3.tar.xz - http://source.pisilinux.org/1.0/kbd-latarcyrheb-16-fixed.tar.bz2 - http://source.pisilinux.org/1.0/kbd-latsun-fonts.tar.bz2 - http://source.pisilinux.org/1.0/ro_maps.tar.bz2 - - gettext - gzip - pam-devel - check-devel - - - mandriva/kbd-1.15-mandriva.patch - mandriva/kbd-1.15-tilde_twosuperior_french_kbd.patch - mandriva/kbd-1.12-data_thai.patch - mandriva/kbd-1.15-remove-unneeded-calls.patch - archlinux/fix-euro2.patch - pisilinux/unicode_start-default-font.patch - pisilinux/tr-keypad-comma.patch - pisilinux/tr-no-meta_space.patch - pisilinux/trq-capslock-fix.patch - pisilinux/currency.patch - pisilinux/trf-keymap-fixes.patch - pisilinux/trf-capslock-fix.patch - - system/base/kbd/pspec.xml - - kbd + libusb-compat-devel + Development files for libusb + system.devel - pam + libusb-devel + libusb-compat - /bin /usr/bin - /usr/share/doc - /usr/share/man - /usr/share/kbd/keymaps - /usr/share/kbd/locale - /usr/share/kbd/unimaps - /usr/share/kbd/consolefonts - /usr/share/kbd/consoletrans + /usr/include + /usr/lib/pkgconfig + /usr/lib32/pkgconfig + + + + libusb-compat-32bit + 32-bit shared libraries for libXt + emul32 + emul32 + + libusb-32bit + + + libusb-32bit + libusb + libusb-compat + + + /usr/lib32 - - pisilinux/lat5u-12.psf.gz - pisilinux/lat5u-14.psf.gz - pisilinux/lat5u-16.psf.gz - mandriva/mac-fr-ext_new.kmap.gz - 2016-04-27 - 2.0.3 + 0.1.5 Release Bump PisiLinux Community admin@pisilinux.org 2016-03-08 - 2.0.3 + 0.1.5 First release Alihan Öztürk alihan@pisilinux.org - - - dbus - http://dbus.freedesktop.org/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - AFL-2.1 - service - system.base - A message bus system, a simple way for applications to talk to each other - Uygulamaların birbirleriyle haberleşmesinin basit bir yöntemi - D-Bus fourni à la fois un daemon système (pour les événements els que l'"ajout d'un nouveau périphérique" ou "file d'impression changée") et un daemon propre à chaque session utilisateur (pour les besoins généraux de communication entre processus utilisateurs). De plus, le bus de message est construit en se basant sur un framework (cadre de développement) de passage de message de un-vers-un pouvant être utilisé par n'importe quelles applications pour communiquer directement (sans passer par le daemon de bus de message). Pour l'instant les applications pouvant communiquer doivent être situées sur le même ordinateur, mais l'option TCP/IP est disponible et le support de processus distant est prévu. - D-Bus supplies both a system daemon (for events such as "new hardware device added" or "printer queue changed") and a per-user-login-session daemon (for general IPC needs among user applications). Also, the message bus is built on top of a general one-to-one message passing framework, which can be used by any two apps to communicate directly (without going through the message bus daemon). Currently the communicating applications are on one computer, but TCP/IP option is available and remote support planned. - D-Bus, sistem ve kullanıcılar için olmak üzere iki tane artalan süreci (daemon) sunar. Mesaj yolu, bire bir mesaj geçiş araçları üzerine inşa edilmiştir. Bu sayede iki program birbiriyle bir mesaj yolu artalan süreci kullanmadan, direkt olarak haberleşebilir. Şu an için haberleşme araçları aynı bilgisayar üzerinde çalışabilmektedir, fakat TCP/IP ile uzaktan haberleşme de planlanmaktadır. - https://dbus.freedesktop.org/releases/dbus/dbus-1.11.8.tar.gz - - expat-devel - libX11-devel - libcap-ng-devel - autoconf-archive - - system/base/dbus/pspec.xml - - - dbus - - expat - libcap-ng - - - /etc/dbus-1 - /usr/lib/tmpfiles.d/dbus.conf - /usr/bin - /usr/lib - /usr/libexec - /usr/share/dbus-1 - /usr/share/doc - /usr/share/man - /usr/share/xml - /run/dbus - /var/lib/dbus - /lib/systemd/system - - - System.Package - - - tmpfiles.conf - - - - dbus-x11 - x11.util - - libX11 - dbus - - - /usr/bin/dbus-launch - - - - dbus-devel - Development files for dbus - dbus için geliştirme dosyaları - system.devel - - dbus - - - /usr/include - /usr/lib/pkgconfig - /usr/lib32/pkgconfig - /usr/lib/dbus-1.0/include - /usr/share/man/man3 - - - - dbus-32bit - 32-bit shared libraries for dbus - dbus için 32-bit paylaşımlı kitaplıklar - emul32 - emul32 - - expat-32bit - - - /usr/lib32 - - - - - 2017-01-25 - 1.11.8 - Version Bump - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-09-14 - 1.11.0 - Release Bump - Ergün Salman - poyraz76@pisilinux.org - - - 2016-09-14 - 1.11.0 - Fix Release - Ergün Salman - poyraz76@pisilinux.org - - - 2016-04-27 - 1.11.0 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-04 - 1.11.0 - First release - Hakan Yıldız - hknuldz93@gmail.com - - - eudev @@ -10849,625 +11589,119 @@ - diffutils - http://www.gnu.org/software/diffutils/diffutils.html + perl + http://www.perl.org/ PisiLinux Community admins@pisilinux.org + Artistic GPLv2 app:console system.base - Tools to make diffs and compare files - Dosyaları karşılaştırmak ve fark dosyaları oluşturmak için kullanılan araçlar - Vous pouvez utiliser la commande diff pour voir les différences entre deux fichiers en particulier, ou les différences entre deux répertoires fichiers par fichier. Diff peut afficher les différences entre fichiers ligne par ligne dans différents formats pouvant être choisis avec les options de la ligne de commande. - You can use the diff command to show differences between two files, or each corresponding file in two directories. diff outputs differences between files line by line in any of several formats, selectable by command line options. - İki dosya arasındaki ya da iki klasör içindeki dosyaları karşılaştırarak farklılıkları belirleyebileceğiniz araç. Farklılıkları satır satır olarak, komut satırı seçenekleri ile farklı formatta dosyalara yazdırabilirsiniz. - http://ftp.gnu.org/gnu/diffutils/diffutils-3.5.tar.xz - - patch - texinfo - - system/base/diffutils/pspec.xml - - - diffutils - - /usr/bin - /usr/share/doc - /usr/share/man - /usr/share/info - /usr/share/locale - - - - - 2017-01-07 - 3.5 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 3.3 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-02-28 - 3.3 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - file - http://www.darwinsys.com/file/ - - PisiLinux Community - admins@pisilinux.org - - as-is - app:console - system.base - Program to identify a file's format by scanning binary data for patterns - Dosya tipini belirlemek için kullanılan bir uygulamadır - Programme servant à identifiant le format d'un fichier en analysant les données binaires en cherchant des patrons connus. - Program to identify a file's format by scanning binary data for patterns. - İkili veri taraması kullanarak (dosya uzantısına bakmadan) dosya biçimini tanımlamaya yarayan bir uygulamadır. - ftp://ftp.astron.com/pub/file/file-5.29.tar.gz + Larry Wall's Practical Extraction and Reporting Language + Perl dili + Perl est un langage de programmation multi-plateforme stable. + Perl is a high-level programming language with roots in C, sed, awk and shell scripting. Perl is good at handling processes and files, and is especially good at handling text. Perl's hallmarks are practicality and efficiency. While it is used to do a lot of different things, Perl's most common applications are system administration utilities and web programming. A large proportion of the CGI scripts on the web are written in Perl. You need the perl package installed on your system so that your system can handle Perl scripts. + Perl kararlı, platform bağımsız programlama dilidir. + Perl ist eine stabile, plattformunabhängige Programmiersprache + http://www.cpan.org/src/5.0/perl-5.24.0.tar.bz2 + db-devel + gdbm-devel zlib-devel - python-setuptools - system/base/file/pspec.xml + system/base/perl/pspec.xml - file + perl-docs + Documentation files for perl + programming.language.perl + + /usr/share/doc/html + /usr/share/doc/perl/html + /usr/share/man/ + + + + perl + db + gdbm zlib - python /usr/bin /usr/lib /usr/share/doc - /usr/share/man - /usr/share/misc - /usr/include + + Turkish.pm + - 2017-01-08 - 5.29 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com + 2017-01-21 + 5.24.0 + Vesion Bump + Ayhan Yalçınsoy + ayhanyalcinsoy@pisilinux.org 2016-04-27 - 5.25 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-02-28 - 5.25 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - libcap - http://www.kernel.org/pub/linux/libs/security/linux-privs/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - BSD - library - system.base - capacités POSIX 1003.1e. - POSIX 1003.1e capabilities library - POSIX 1003.1e desteği - libcap is a library for getting and setting POSIX.1e (formerly POSIX 6) draft 15 capabilities. - https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.25.tar.xz - - attr-devel - pam-devel - - system/base/libcap/pspec.xml - - - libcap - - pam - attr - - - /sbin - /lib - /usr/lib - /usr/share/man - /usr/share/doc - /etc - - - - libcap-devel - Development files for libcap - libcap için geliştirme dosyaları - system.devel - - libcap - - - /usr/include - /usr/share/man/man3 - - - - libcap-32bit - 32-bit shared libraries for libcap - libcap için 32-bit paylaşımlı kitaplıklar - emul32 - emul32 - - attr-32bit - - - attr-32bit - - - /usr/lib32 - - - - - 2017-01-25 - 2.25 - Rebuild. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 2.25 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-02 - 2.25 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - sqlite - http://www.sqlite.org/ - - PisiLinux Community - admins@pisilinux.org - - as-is - library - system.base - An SQL Database Engine in a C Library - Bir C kütüphanesi içindeki bir SQL veritabanı motoru - SQLite est une petite librairie C implémentant un moteur de base de données SQL auto-configurée, auto-suffisante, pouvant être embarquée. Gère des bases de données de tailles allant jusqu'à 2 téraOctets. - SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine. Supports databases up to 2 terabytes in size. - SQLite hiçbir ayar gerektirmeyen, başka programların içine gömülebilir bir SQL veritabanı motorudur. 2 terabayta kadar büyüklükteki veritabanlarını tutabilir. - http://sqlite.org/2017/sqlite-autoconf-3160200.tar.gz - http://sqlite.org/2017/sqlite-doc-3160200.zip - - readline-devel - - system/base/sqlite/pspec.xml - - - sqlite - - readline - - - /usr/lib - /usr/share/man - /usr/bin - /usr/share/doc/sqlite/README - - - - sqlite-devel - Development files for sqlite - sqlite için geliştirme dosyaları - system.devel - - sqlite - - - /usr/include - /usr/lib/pkgconfig - /usr/lib32/pkgconfig - - - - sqlite-32bit - 32-bit shared libraries for sqlite - emul32 - emul32 - - sqlite - - - /usr/lib32 - - - - sqlite-doc - sqlite-doc, sqlite için doküman belgeleri - - sqlite - - - /usr/share/doc/sqlite/ - - - - - 2017-01-26 - 3.16.2 - Verison Bump. - PisiLinux Community - admin@pisilinux.org - - - 2017-01-07 - 3.11.1 - Rebuildwith new toolchain. - PisiLinux Community - admin@pisilinux.org - - - 2017-01-05 - 3.11.1 - Version Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-06-15 - 3.11.0.0 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-02 - 3.11.0.0 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - libffi - http://sourceware.org/libffi - - PisiLinux Community - admins@pisilinux.org - - BSD - library - system.base - A portable foreign function interface library - Yabancı işlev arayüzleri için taşınabilir bir kitaplık - The libffi library provides a portable, high level programming interface to various calling conventions. - libffi kitaplığı, çeşitli işlev çağırma konvansiyonları için taşınabilir ve yüksek düzeyli bir programlama arayüzü sunar. - ftp://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz - system/base/libffi/pspec.xml - - - libffi - - /usr/lib/libffi.* - /usr/share/doc - - - - libffi-devel - Development files for libffi - libffi için geliştirme dosyaları - system.devel - - libffi - - - /usr/lib/libffi-* - /usr/lib/pkgconfig - /usr/lib32/pkgconfig - /usr/share/info - /usr/share/man - - - - libffi-32bit - 32-bit shared libraries for libffi - libffi için 32-bit paylaşımlı kitaplıklar - emul32 - emul32 - - libffi - - - /usr/lib32/libffi.* - /usr/lib32/libffi-* - - - - - 2017-01-07 - 3.2.1 - Rebuild with new toolchain. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 3.2.1 + 5.22.1 Release Bump PisiLinux Community admin@pisilinux.org 2016-03-01 - 3.2.1 + 5.22.1 First release - Yusuf Aydemir - yusuf.aydemir@pisilinux.org + Ertuğrul Erata + ertugrulerata@gmail.com - gzip - http://www.gnu.org/software/gzip + time + ftp://prep.ai.mit.edu/pub/gnu/time PisiLinux Community admins@pisilinux.org GPLv2 - LGPLv2.1 app:console system.base - Standard GNU compressor - GNU dosya arşiv aracı - gzip (GNU zip) est un programme populaire de compression de donnée écrit pour le projet GNU. - gzip (GNU zip) is a popular data compression program written for the GNU project. - Gzip (GNU zip) GNU projesi için geliştirilmiş popüler bir veri sıkıştırma programıdır. - http://ftp.gnu.org/gnu/gzip/gzip-1.8.tar.xz - system/base/gzip/pspec.xml + A GNU utility for monitoring a program's use of system resources + Bir programın sistem kaynak kullanımını izleyen GNU aracı + time utility runs another program, collects information about the resources used by that program while it is running, and displays the results. + time başka bir programı çalıştırarak o programın sistem kaynaklarını nasıl kullandığını izler ve topladığı bilgileri ekrana basar. + ftp://prep.ai.mit.edu/pub/gnu/time/time-1.7.tar.gz + + time-1.7-destdir.patch + + system/base/time/pspec.xml - gzip + time - /bin - /usr/share/doc - /usr/share/man + /usr/bin/ /usr/share/info - - 2017-01-23 - 1.8 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 1.8 - Release Bump - PisiLinux Community - admin@pisilinux.org - 2016-04-27 - 1.8 - Versiyon bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-02-28 - 1.6 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - db - http://www.oracle.com/technology/products/berkeley-db/db/index.html - - PisiLinux Community - admins@pisilinux.org - - DB - app:console - system.base - Quatrième version de Berkeley DB - Oracle Berkeley DB - Oracle Berkeley DB - Ein einbettbares Datenbank Engine, dass die Entwickler mit schnellen, zuverlässigen und lokalen Persistenz unterstützt und null Administration erfordert. - The Berkeley Database (Berkeley DB) is a programmatic toolkit that provides embedded database support for both traditional and client/server applications. The Berkeley DB includes B+tree, Extended Linear Hashing, Fixed and Variable-length record access methods, transactions, locking, logging, shared memory caching, and database recovery. The Berkeley DB supports C, C++, Java, and Perl APIs. It is used by many applications, including Python and Perl, so this should be installed on all systems. - Berkeley DB geliştiricilere yerel süreklilik sağlayan ve herhangi bir ayar gerektirmeden (zero administration) kullanılan, hızlı ve gömülebilir bir veritabanı motorudur. - http://download.oracle.com/berkeley-db/db-6.2.23.tar.gz - system/base/db/pspec.xml - - - db - - libgcc - - - /usr/bin - /usr/lib - /usr/sbin - - - db5 - - - - db-devel - Development files for db - - db - - - /usr/include - - - db5-devel - - - - db-docs - Documentation for db - system.doc - - db - - - /usr/share/doc - - - db5-docs - - - - - 2017-01-21 - 6.2.23 - Version Bump - Ayhan Yalçınsoy - ayhanyalcinsoy@pisilinux.org - - - 2016-04-27 - 6.1.26 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-02 - 6.1.26 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - tcp-wrappers - http://ftp.porcupine.org/pub/security/index.html - - PisiLinux Community - admins@pisilinux.org - - BSD - app:console - system.base - TCP Wrappers - TCP Wrappers - Avec ce paquet, vous pouvez surveiller et filtrer les requêtes entrante pour les services réseaux SYSTAT, FINGER, FTP, TELNET, RLOGIN, RSH, EXEC, TFTP, TALK et autres. Il supporte à la fois les canaux de communication (sockets) de type 4.3BSD et TLI de type System V.4. - With this package you can monitor and filter incoming requests for the SYSTAT, FINGER, FTP, TELNET, RLOGIN, RSH, EXEC, TFTP, TALK, and other network services. It supports both 4.3BSD-style sockets and System V.4-style TLI. - Bu paket ile birlikte SYSTAT, FINGER, FTP, TELNET, RLOGIN, RSH, EXEC, TFTP, TALK ve diğer ağ servisleri için gelen istekleri izleyebilir ve süzebilirsiniz. Program 4.3BSD-tipi soketler ve System V.4-tipi TLI'ın ikisini de destekler. - http://ftp.porcupine.org/pub/security/tcp_wrappers_7.6.tar.gz - - sed - - - Makefile-Pisi.patch - tcp-wrappers-7.6-makefile.patch - tcp_wrappers-7.6-ldflags.patch - 01_all_redhat-bug11881.patch - 02_all_redhat-bug17795.patch - 03_all_wildcard.patch - 04_all_fixgethostbyname.patch - 07_all_sig.patch - 08_all_strerror.patch - 09_all_gcc-3.4.patch - 10_all_more-headers.patch - tcp-wrappers-7.6-ipv6-1.14.diff - tcp-wrappers-7.6-shared.patch - host.allow.example.patch - match-port.patch - - system/base/tcp-wrappers/pspec.xml - - - tcp-wrappers - - /usr/sbin - /usr/lib - /lib - /etc - /usr/share/man - /usr/share/doc - - - hosts.allow - hosts.deny - - - - tcp-wrappers-devel - Development files for tcp-wrappers - tcp-wrappers için geliştirme dosyaları - system.devel - - tcp-wrappers - - - /usr/include - /usr/share/man/man3 - - - - - 2016-04-27 - 7.6 + 1.7 Release Bump PisiLinux Community admin@pisilinux.org 2016-03-13 - 7.6 + 1.7 First release Alihan Öztürk alihan@pisilinux.org @@ -11476,77 +11710,60 @@ - net-tools - http://sites.inka.de/lina/linux/NetTools/ + libatomic_ops + https://github.com/ivmai/libatomic_ops/ - PisiLinux Community + Pisi Linux Admins admins@pisilinux.org GPLv2 - app:console - system.base - Standard Linux networking tools - Linux ağ araçları - net-tools est une collection de programmes représentant les outils réseau de base du système d'exploitation Linux. S'y trouvent arp, hostname, ifconfig, ipmaddr, iptunnel, mii-tool, nameif, netstat, plipconfig, rarp, route et slattach. - net-tools is a collection of programs that form the base set of the networking tools for the Linux operating system. It includes arp, hostname, ifconfig, ipmaddr, iptunnel, mii-tool, nameif, netstat, plipconfig, rarp, route and slattach. - Net-tools, Linux işletim sisteminde kullanılan ağ ile ilgili temel araçların bir birleşimidir. Arp, hostname, ifconfig, ipmaddr, iptunnel, mii-tool, nameif, netstat, plipconfig, rarp, route ve slattach programlarını içerir. - https://sourceforge.net/projects/net-tools/files/net-tools-1.60.tar.bz2 - - 01_all_net-tools-1.60-2.6-compilefix.patch.bz2 - 02_all_net-tools-1.60-gcc34.patch.bz2 - 03_all_net-tools-1.60-cleanup-list-handling.patch.bz2 - 04_all_net-tools-1.60-get_name.patch.bz2 - 20_all_net-tools-1.54-ipvs.patch.bz2 - 21_all_net-tools-1.57-bug22040.patch.bz2 - 22_all_net-tools-1.60-manydevs.patch.bz2 - 23_all_net-tools-1.60-miiioctl.patch.bz2 - 24_all_net-tools-1.60-virtualname.patch.bz2 - 25_all_net-tools-1.60-cycle.patch.bz2 - 26_all_net-tools-1.60-overflow.patch.bz2 - 27_all_net-tools-1.60-netstat_ulong.patch.bz2 - 50_all_net-tools-1.60-multiline-string.patch.bz2 - 51_all_net-tools-1.60-man.patch.bz2 - 52_all_net-tools-1.60-numeric-ports.patch.bz2 - 53_all_net-tools-1.60-appletalk.patch.bz2 - 54_all_net-tools-1.60-wide.patch.bz2 - 55_all_net-tools-1.60-Makefile.patch.bz2 - 56_all_net-tools-1.60-ipv6-hostname.patch.bz2 - 57_all_net-tools-1.60-ifconfig-infiniband.patch.bz2 - 60_all_net-tools-1.60-headers.patch.bz2 - net-tools-missing.patch - kernel_headers.patch - gcc-4.3.patch - large-buffer.patch - - system/base/net-tools/pspec.xml + MIT + library + system.devel + Atomic memory update operations library + Atomik bellek işlemleri kütüphanesi + libatomic_ops provides implementations for atomic memory update operations on a number of architectures. This allows direct use of these in reasonably portable code. + libatomic_ops, çeşitli mimarilerde atomik bellek işlemleri yapılmasını sağlayarak taşınabilir kod yazma olanağı veren bir kütüphanedir. + http://www.ivmaisoft.com/_bin/atomic_ops/libatomic_ops-7.4.4.tar.gz + system/devel/libatomic_ops/pspec.xml - net-tools + libatomic_ops + + /usr/lib + /usr/share/doc + + + + libatomic_ops-devel + libatomic_ops için geliştirme dosyaları + libatomic_ops için geliştirme dosyaları - comar - comar-api + libatomic_ops - /bin - /sbin - /usr/bin - /usr/sbin - /usr/share/doc - /usr/share/man - /usr/share/locale + /usr/include + /usr/lib/pkgconfig + + 2017-01-23 + 7.4.4 + Version bump.. + Ertuğrul Erata + ertugrulerata@gmail.com + 2016-04-27 - 1.60 + 7.4.2 Release Bump PisiLinux Community admin@pisilinux.org - 2016-03-09 - 1.60 + 2016-03-13 + 7.4.2 First release Alihan Öztürk alihan@pisilinux.org @@ -11555,210 +11772,124 @@ - snappy - http://code.google.com/p/snappy/ + cmake + http://www.cmake.org - Alihan Öztürk - alihan@pisilinux.org + PisiLinux Community + admins@pisilinux.org BSD - library - system.base - A fast compressor/decompressor librar - Linux için sıkıştırma/ayıklama kütüphanesidir. - Snappy is a compression/decompression library. It does not aim for maximum compression, or compatibility with any other compression library; instead, it aims for very high speeds and reasonable compression. - Linux için sıkıştırma/ayıklama kütüphanesidir. Yüksek hızda sıkıştırma yapmak için yazılmış bir kütüphanedir. - https://github.com/google/snappy/releases/download/1.1.3/snappy-1.1.3.tar.gz + app:console + system.devel + Cross-platform, open-source make system + Cmake, açık kaynak kodlu ve birden fazla platformda çalışan bir 'make' sistemidir. + CMake, système make open-source et multi-plateforme. CMake est utilisé pour contrôler le processus de compilation de logiciel en utilisant une plate-forme de fichiers de configuration simple et indépendante de compilateur. CMake génère des makefiles et un environnement de travail natifs pouvant être utilisés dans l'environnement du compilateur de votre choix. + CMake, the cross-platform, open-source make system. CMake is used to control the software compilation process using simple platform and compiler independent configuration files. CMake generates native makefiles and workspaces that can be used in the compiler environment of your choice. + Cmake, açık kaynak kodlu ve birden fazla platformda çalışan bir 'make' sistemidir. Yazılım derleme sürecini kontrol etmek için kullanılan CMake, derleyici bağımsız yapılandırma dosyalarının oluşturulmasını sağlar. + https://cmake.org/files/v3.7/cmake-3.7.1.tar.gz - lzo-devel + curl-devel + expat-devel + libarchive-devel + ncurses-devel zlib-devel + xz-devel + libuv-devel - - snappy-unittest.patch - - system/base/snappy/pspec.xml + system/devel/cmake/pspec.xml - snappy + cmake + curl + expat + libarchive libgcc + ncurses + zlib + libuv - /usr/lib + /usr/bin + /usr/share/cmake + /usr/share/aclocal/ /usr/share/doc - /usr/share - - - - snappy-devel - snappy için geliştirme dosyaları - - snappy - - - /usr/include + /usr/share/man + + 2016-12-01 + 3.7.1 + Version bump. + Yusuf Aydemir + yusuf.aydemir@pisilnux.org + - 2017-01-21 - 1.1.3 - Rebuild with new toolchain. - Ertuğrul Erata - ertugrulerata@gmail.com + 2016-07-21 + 3.6.0 + Version bump. + Yusuf Aydemir + yusuf.aydemir@pisilinux.org 2016-04-27 - 1.1.3 + 3.4.3 Release Bump PisiLinux Community admin@pisilinux.org - 2016-03-02 - 1.1.3 + 2016-03-13 + 3.4.3 First release - Ertuğrul Erata - ertugrulerata@gmail.com + Alihan Öztürk + alihan@pisilinux.org - readline - http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html + xtrans + http://www.x.org/ PisiLinux Community admins@pisilinux.org - GPLv2 + MIT library - system.base - Another cute console display library - Diğer bir şirin konsol gösterim kütüphanesi - La librairie GNU Readline fourni un ensemble de fonctions utilisables par des applications permettant aux utilisateurs d'éditer les lignes de commandes en cours de frappe. Les modes d'éditions Emacs et vi sont disponibles. La librairie Readline inclus des fonctions supplémentaires de mémorisation de la liste de commandes entrées précédemment, afin de le rappeler et éventuellement les rééditer, ainsi que l'expansion d'historiques de commandes précédentes à la mode csh. - The GNU Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in. Both Emacs and vi editing modes are available. The Readline library includes additional functions to maintain a list of previously-entered command lines, to recall and perhaps reedit those lines, and perform csh-like history expansion on previous commands. - GNU Readline kütüphanesi uygulamalara sanki kullanıcılar kendileri yazıyormuş gibi komut satırı girişlerini düzenleme imkanı veren işlev setini sunar. Readline kütüphanesi daha önce girilmiş bir komut satırları listesini düzenleme, tekrar çağırma ve belki de bu satırları tekrar düzenleme ve csh tipi geçmiş bilgisi genişletmelerindeki önceki komutları yürütme imkanı sağlayan ek işlevler sağlar. - mirrors://gnu/readline/readline-7.0.tar.gz + system.devel + Librairie trans de X.Org. + X.Org trans library + X.Org trans kitaplığı. + X.Org trans Bibliothek + xtrans includes a number of routines to make X implementations transport-independent. + xtrans, X gerçeklemelerini taşıma türünden bağımsız yapmak için kullanılan bazı yordamları içerir. + mirrors://xorg/individual/lib/xtrans-1.3.5.tar.bz2 - ncurses-devel + util-macros - system/base/readline/pspec.xml + system/devel/xtrans/pspec.xml - readline - - ncurses - + xtrans - /usr/lib - /usr/share/doc - /usr/share/man - /usr/share/info - - - - readline-devel - Development files for readline - readline için geliştirme dosyaları - system.devel - - readline - - - /usr/include - /usr/share/man/man3 - - - - readline-32bit - 32-bit shared libraries for readline - readline için 32-bit paylaşımlı kitaplıklar - emul32 - emul32 - - ncurses-32bit - - - readline - ncurses-32bit - - - /usr/lib32 - - - - - 2017-01-07 - 7.0 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 6.3 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-02-29 - 6.3 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - liblogging - http://www.liblogging.org - - Marcin Bojara - marcin@pisilinux.org - - BSD-2 - library - system.base - Easy to use, portable, open source library for system logging - Liblogging offers an enhanced replacement for the syslog() call, but retains its ease of use. - https://sourceforge.net/projects/pisilinux/files/source/liblogging-1.0.5.tar.gz - system/base/liblogging/pspec.xml - - - liblogging - - /usr/lib - /usr/bin - /usr/share/man - /usr/share/doc/liblogging - - - - liblogging-devel - Development files for liblogging - system.devel - - liblogging - - - /usr/include/liblogging/stdlog.h - /usr/lib/pkgconfig/liblogging-stdlog.pc + /usr/include/X11/Xtrans + /usr/share/aclocal + /usr/share/pkgconfig 2016-04-27 - 1.0.5 + 1.3.5 Release Bump PisiLinux Community admin@pisilinux.org 2016-03-08 - 1.0.5 + 1.3.5 First release Alihan Öztürk alihan@pisilinux.org @@ -11767,198 +11898,227 @@ - pisilinux-python - http://www.pisilinux.org + python-setuptools + http://pypi.python.org/pypi/setuptools PisiLinux Community admins@pisilinux.org - GPLv2 + PSF-2.2 library - system.base - Python modules for Pisi Linux - PiSi Linux için Python modülleri - Python modules for Pisi Linux provides functions for common task, with the aim of easing development. - PiSi Linux için Python modülleri genel işler için fonksiyonlar sunarak geliştirme işini kolaylaştırmayı amaçlamaktadır. - Módulos Python para PiSi Linux facilitan funciones para tareas comunes, para simplificar el desarrollo. - http://source.pisilinux.org/1.0/pisilinux-python-0.4.8.tar.gz - - python-devel - libX11-devel - - system/base/pisilinux-python/pspec.xml + system.devel + Python setuptools + Python kurulum araçları + python-setuptools is a collection of enhancements to the Python distutils that allow you to more easily build and distribute Python packages, especially ones that have dependencies on other packages. + python-setuptools, Python distutils'e yapılan, özellikle başka paketlere bağımlılığı olan Python paketlerini daha kolay oluşturmaya ve dağıtmaya yarayan iyileştirmeler koleksiyonudur. + http://pypi.python.org/packages/source/d/distribute/distribute-0.6.49.tar.gz + system/devel/python-setuptools/pspec.xml - pisilinux-python - - python - + python-setuptools - /usr/lib + /usr/bin + /usr/lib/python* /usr/share/doc - /usr/share/locale - - - - pisilinux-python-xorg - x11.library - - python - libX11 - - - /usr/lib/python2.7/site-packages/pardus/xorg - 2017-01-24 - 0.4.8 - Rebuild. + 2017-01-08 + 0.6.49 + Rebuild with new toolchain. Ertuğrul Erata ertugrulerata@gmail.com 2016-04-27 - 0.4.8 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-02 - 0.4.8 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - baselayout - http://www.pisilinux.org - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - library - data - system.base - Filesystem baselayout - Dosya sisteminin temel planı - Ce paquet crée la hiérarchie du système de fichier principal de Pisi Linux. - baselayout creates the Pisi Linux Linux main filesystem hierarchy. - Bu paket, Pisi Linux dosya sisteminin temelini oluşturur. - http://source.pisilinux.org/1.0/baselayout-3.10.0.tar.gz - system/base/baselayout/pspec.xml - - - baselayout - - pypolkit - - - /bin - /sbin - /lib* - /etc - /etc/pisilinux-release - /media - /boot - /proc - /home - /mnt - /opt - /dev - /run - /sys - /srv - /tmp - /usr - /var - /usr/lib/tmpfiles.d/baselayout.conf - - - System.PackageHandler - System.Package - User.Manager - Network.Stack - - - baselayout.conf - services - protocols - sysctl.conf - pisilinux-release - start-stop-daemon.8 - - - - - 2016-04-27 - 3.10.0 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-06 - 3.10.0 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - xcb-proto - http://xcb.freedesktop.org/ - - PisiLinux Community - admins@pisilinux.org - - MIT - data - system.devel - XCB protocol descriptions - XCB protokol tanımlamaları - XCB is a project to enable efficient language bindings to the X11 protocol. This package contains the protocol descriptions themselves. Language bindings use these protocol descriptions to generate code for marshalling the protocol. - http://xcb.freedesktop.org/dist/xcb-proto-1.11.tar.bz2 - - libxml2 - - system/devel/xcb-proto/pspec.xml - - - xcb-proto - - /usr/lib/pkgconfig - /usr/lib/python* - /usr/share/doc - /usr/share/xcb - - - - - 2016-04-27 - 1.11 + 0.6.49 Release Bump PisiLinux Community admin@pisilinux.org 2016-03-13 - 1.11 + 0.6.49 First release Ertuğrul Erata ertugrulerata@gmail.com + + + intltool + https://launchpad.net/intltool + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + system.devel + Utility for internationalizing various kinds of data files + Çeşitli kaynak kod dosyalarından satırları ayıklamak için kullanılan betikler + Scripts d'extraction depuis divers fichiers sources de chaînes traduisibles. + intltool automatically extracts translatable strings from oaf, glade, bonobo ui, nautilus theme, .desktop files, etc. and puts them in the po files. + Çeşitli kaynak kod dosyalarından satırları ayıklamak için kullanılan betikler. + https://launchpad.net/intltool/trunk/0.51.0/+download/intltool-0.51.0.tar.gz + + perl + perl-XML-Parser + + system/devel/intltool/pspec.xml + + + intltool + + perl-XML-Parser + + + /usr/bin + /usr/share/aclocal + /usr/share/intltool + /usr/share/man + /usr/share/doc + + + + + 2017-01-22 + 0.51.0 + Rebuild with new toolchain. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 0.51.0 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 0.51.0 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + binutils + http://www.gnu.org/software/binutils/ + + Serdar Soytetir + kaptan@pisilinux.org + + GPLv2 + app:console + system.devel + Assembler and linker tools + Makine dili derleme ve bağlama araçları + Contient des commandes telles que as, ld, nm, objdump, ar, ranlib pour compiler du code assembleur en langage machine ainsi que pour chaîner (link) et manipuler les fichiers binaires objets. + Contains commands like as, ld, nm, objdump, ar, ranlib for compiling assembly code to the machine language, and for linking and manipulating the binary object files. + Assembly kodlarını makine diline derlemek, oluşan obje dosyalarını bağlamak ve ikili dosyalar üzerinde işlemler yapmak için kullanılan as, ld, nm, objdump, ar, ranlib gibi komutları içermektedir. + http://ftp.gnu.org/gnu/binutils/binutils-2.27.tar.bz2 + system/devel/binutils/pspec.xml + + + binutils + + zlib + + + /usr/bin + /usr/lib + /usr/include + /usr/share/info + /usr/share/man + + + + + 2017-01-02 + 2.27 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-26 + 2.26 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-03 + 2.26 + First release, fix for syslinux build + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + cython + http://www.cython.org + + Pisi Linux Admins + admins@pisilinux.org + + Apache-2.0 + app:console + library + system.devel + C extensions for the Python + Python için C eklentileri + Cython is a language that makes writing C extensions for the Python language as easy as Python itself. + Cython, Python için C eklentileri yazmayı kolaylaştıran bir dildir. + https://pypi.python.org/packages/b7/67/7e2a817f9e9c773ee3995c1e15204f5d01c8da71882016cac10342ef031b/Cython-0.25.2.tar.gz + + python-devel + + system/devel/cython/pspec.xml + + + cython + + python + + + /usr/bin + /usr/lib + /usr/share/doc + + + + + 2017-01-21 + 0.25.2 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 0.23.4 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 0.23.4 + First release + Alihan Öztürk + alihan@pisilinux.org + + + scons @@ -12010,6 +12170,1033 @@ + + + nasm + http://nasm.sourceforge.net/ + + PisiLinux Community + admins@pisilinux.org + + BSD + app:console + system.devel + Groovy little assembler + Assembler derleyicisi + NASM est l'assembleur Netwide, un assembleur libre et portable pour les processeurs des séries Intel 80x86 + NASM is the Netwide Assembler, a free portable assembler for the Intel 80x86 microprocessor series. + Intel 80x86 mikroişlemci serisi için aktarılabilir Assembler derleyicisi. + http://www.nasm.us/pub/nasm/releasebuilds/2.12.02/nasm-2.12.02.tar.xz + + texinfo + + system/devel/nasm/pspec.xml + + + nasm + + /usr/bin + /usr/share/doc + /usr/share/man + + + + + 2017-01-24 + 2.12.02 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 2.12 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 2.12 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + util-macros + http://www.x.org/ + + PisiLinux Community + admins@pisilinux.org + + MIT + library + system.devel + Macros X.Org utilisées pour compiler X.Org + X.Org X11 Autotools macros + X.Org X11 Autotools makroları + X.Org Makros zum Kompilieren von X.Org + X.Org X11 autotools macros are required for building the various packages that comprise the X Window System. + X.Org X11 Autotools makroları, X pencere sistemini oluşturan çeşitli paketleri derlemek için gereklidir. + http://xorg.freedesktop.org/releases/individual/util/util-macros-1.19.0.tar.bz2 + + doc.patch + + system/devel/util-macros/pspec.xml + + + util-macros + + /usr/share/aclocal + /usr/share/pkgconfig + /usr/share/doc + + + + + 2016-04-27 + 1.19.0 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-02 + 1.19.0 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + autogen + http://www.gnu.org/software/autogen + + PisiLinux Community + admins@pisilinux.org + + GPLv3 + app:console + system.devel + The automated text and program generation tool + Otomatik metin ve program üretme aracı + Herramienta para simplificar creación y mantenimiento de programas que contienen muchos textos repetitivos + autogen is a tool designed to simplify the creation and maintenance of programs that contain large amounts of repetitious text. + autogen büyük miktarda tekrarlı metin içeren uygulamaların otomatik üretilmesini sağlayan bir araçtır. + https://ftp.gnu.org/gnu/autogen/rel5.18.10/autogen-5.18.10.tar.gz + + gc-devel + gmp-devel + guile-devel + libxml2-devel + which + + system/devel/autogen/pspec.xml + + + autogen + + guile + libxml2 + + + /usr/lib + /usr/share/doc + /usr/share/man + /usr/bin + /usr/share/info + /usr/share/autogen + + + + autogen-devel + Development files for autogen + autogen için geliştirme dosyaları + + autogen + + + /usr/include + /usr/share/aclocal + /usr/lib/pkgconfig + /usr/share/man/man3 + /usr/bin/autoopts-config + /usr/share/man/man1/autoopts-config.1 + + + + + 2017-01-26 + 5.18.10 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 5.18.7 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 5.18.7 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + libmpc + http://www.multiprecision.org/ + + Serdar Soytetir + kaptan@pisilinux.org + + LGPLv2.1 + library + system.devel + High precision and correct rounding library + Yüksek hassasiyet ve yuvarlama kitaplığı + libmpc is a library for arithmetic of complex numbers with arbitrarily high precision and correct rounding. + libmpc aritmetik kompleks sayılarla yüksek hassasiyette ve doğru yuvarlama ile işlem yapılmasını sağlayan bir kitaplıktır. + ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz + + gmp-devel + mpfr-devel + + system/devel/libmpc/pspec.xml + + + libmpc + + gmp + mpfr + + + /usr/lib + /usr/share/doc/libmpc + /usr/share/info + + + + libmpc-devel + Development files for libmpc + libmpc için geliştirme dosyaları + + libmpc + + + /usr/include + + + + + 2017-01-04 + 1.0.3 + Rebuild with new toolchain. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 1.0.3 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-02-28 + 1.0.3 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + colorgcc + http://www.console-colors.de + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + system.devel + GCC output colorizer + GCC çıktısını renklendiren bir araç. + A tool that colorizes GCC output. + http://source.pisilinux.org/1.0/colorgcc-1.3.2.tar.gz + + colorgcc-1.3.2-handle-translated-output.patch + colorgcc-1.3.2-mdkconf.patch + add-i686-gnu-stuff.patch + + system/devel/colorgcc/pspec.xml + + + colorgcc + + gcc + + + /usr/bin + /usr/share/colorgcc + /etc + /usr/share/doc + + + colorgcc.sh + colorgcc.csh + + + + + 2016-04-27 + 1.3.2 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 1.3.2 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + gnuconfig + http://savannah.gnu.org/projects/config + + Serdar Soytetir + kaptan@pisilinux.org + + GPLv2+ + data + system.devel + Base config files for autofoo + Autofoo için temel config dosyaları + fichiers GNU config.sub et config.guess mis à jour. + gnuconfig contains updated config.sub and config.guess files from GNU. + gnuconfig güncel GNU config.sub ve config.guess dosyaları içerir. + http://source.pisilinux.org/1.0/config-20141105.tar.gz + system/devel/gnuconfig/pspec.xml + + + gnuconfig + + /usr/share/gnuconfig + /usr/share/doc + + + + + 2017-01-26 + 20141105 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 20141105 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 20141105 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + catbox + http://pisilinux.org + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + library + system.devel + Python sandboxing module + Python için sandbox modülü + catbox is a Python sandboxing module commonly used by the package management system of PiSi Linux, PiSi. + https://github.com/baris/catbox/archive/catbox-1.6.1.tar.gz + + python-setuptools + python-devel + + system/devel/catbox/pspec.xml + + + catbox + + python + + + /usr/bin + /usr/lib + /usr/share/doc + + + + + 2016-04-27 + 1.6.1 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 1.6.1 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + perl-XML-Parser + http://search.cpan.org/dist/XML-Parser/ + + PisiLinux Community + admins@pisilinux.org + + Artistic + library + system.devel + A Perl extension interface to James Clark's XML parser, expat + James Clark'ın XML ayırıştırıcısına bir Perl uzantısı arayüzü + Una extensión Perl al parseador XML de James Clark, expat + This module provides an interface to James Clark's XML parser, expat. As in expat, a single instance of the parser can only parse one document. Calls to parsestring after the first for a given instance will die. + Bu modül James Clark'ın XML ayrıştırıcısı expat için bir arayüz sağlar. Expat'ta olduğu gibi ayrıştırıcıdan türetilen her nesne sadece bir dosyayı ayrıştırabilir. + Este módulo facilita una interfaz al parser XML de James Clark, expat. Como en expat, una sola instancia del parser puede analizar solamente un documento. Llamadas a parsestring después del primero de una instancia determinada morirán. + mirrors://cpan/authors/id/T/TO/TODDR/XML-Parser-2.44.tar.gz + + expat-devel + perl + + system/devel/perl-XML-Parser/pspec.xml + + + perl-XML-Parser + + expat + perl + + + /usr/share/doc + /usr/lib + /usr/share/man + + + + + 2017-01-21 + 2.44 + Rebuild for perl-5.24.0 + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 2.44 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-06 + 2.44 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + xorg-util + http://www.x.org/ + + PisiLinux Community + admins@pisilinux.org + + MIT + app:console + system.devel + Utilitaires de X.Org + X.Org utilities + X.Org araçları + X.Org Werkzeuge + xorg-util contains some Xorg X11 command-line utilities, but more importantly, X11 configuration and rule files. + mirrors://xorg/individual/util/gccmakedep-1.0.3.tar.bz2 + mirrors://xorg/individual/util/imake-1.0.7.tar.bz2 + mirrors://xorg/individual/util/lndir-1.0.3.tar.bz2 + mirrors://xorg/individual/util/makedepend-1.0.5.tar.bz2 + mirrors://xorg/individual/util/xorg-cf-files-1.0.6.tar.bz2 + + xorg-proto + util-macros + + + host-defaults.patch + + system/devel/xorg-util/pspec.xml + + + xorg-util + + /usr/bin + /usr/share/X11/config + /usr/share/man + + + + + 2016-04-27 + 7.6 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2017-03-18 + 7.6 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + numactl + ftp://oss.sgi.com/www/projects/libnuma/download + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + LGPLv2 + library + app:console + system.devel + Library for tuning NUMA machines + NUMA makineleri optimize etmek için bir kitaplık + numactl consists of a numactl program to run other programs with a specific NUMA policy and a libnuma to do allocations with NUMA policy in applications. + numactl, uygulamaları farklı NUMA (Tekdüze Olmayan Bellek Erişimi) politikalarıyla çalıştırmak için gerekli bir araç ve kitaplıktır. + ftp://oss.sgi.com/www/projects/libnuma/download/numactl-2.0.11.tar.gz + system/devel/numactl/pspec.xml + + + numactl + + /usr/bin + /usr/lib + /usr/share/doc + /usr/share/man + + + + numactl-devel + Development files for numactl + numactl için geliştirme dosyaları + + numactl + + + /usr/include + /usr/share/man/man3 + + + + + 2016-04-27 + 2.0.11 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-02 + 2.0.11 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + guile + http://www.gnu.org/software/guile/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2+ + LGPLv2+ + app:console + library + system.devel + Interpréteur et librairie GNU Scheme. + GNU Scheme interpreter and library + GNU Scheme yorumlayıcısı ve kitaplığı + Język GNU Extension language. + GUILE (GNU's Ubiquitous Intelligent Language for Extension) is a library implementation of the Scheme programming language, written in C. GUILE provides a machine-independent execution platform that can be linked in as a library during the building of extensible programs. + mirrors://gnu/guile/guile-2.0.13.tar.xz + + gc-devel + gettext-devel + gmp-devel + libunistring-devel + libffi-devel + readline-devel + + system/devel/guile/pspec.xml + + + guile + + gc + gmp + libffi + libtool-ltdl + libunistring + readline + + + /etc + /usr/share/doc + /usr/share/man + /usr/bin + /usr/share/info + /usr/lib/lib* + /usr/share/guile + /usr/share/emacs + /usr/share/gdb/auto-load + /usr/lib/guile/2.0 + + + + guile-devel + Development files for guile + guile için geliştirme dosyaları + Pliki nagłówkowe guile. + + guile + gc-devel + gmp-devel + + + /usr/include + /usr/lib/pkgconfig + /usr/share/aclocal + /usr/bin/guile-snarf + /usr/bin/guile-config + + + + + 2017-01-23 + 2.0.13 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 2.0.11 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2014-11-30 + 2.0.11 + First release + Yusuf Aydemir + yusuf.aydemir@pisilinux.org + + + + + + klibc + http://www.zytor.com/mailman/listinfo/klibc + + PisiLinux Community + admins@pisilinux.org + + LGPLv2.1 + GPLv2 + library + system.devel + A minimal libc subset for use with initramfs + Küçük bir C kütüphanesi (libc) uyarlaması + klibc ou "espace utilisateur tôt", est une librairie résultante de l'effort pour transférer autant de code d'initialisation de Linux que possible hors du noyau. + klibc, or "early userspace", is library part of an effort which tries to move as much initialization code in Linux as possible out of the kernel. + klibc, sistem başlangıcı için gerekli olan kodların mümkün olduğunca çok kısmını Linux çekirdeği dışına atma hedefiyle oluşturulmuş bir kütüphanedir. + https://www.kernel.org/pub/linux/libs/klibc/2.0/klibc-2.0.4.tar.xz + + perl + kernel-module-headers + + system/devel/klibc/pspec.xml + + + klibc + + /lib + /usr/bin + /usr/lib/klibc/bin + /usr/lib/klibc/include + /usr/lib/klibc/lib + /usr/share/aclocal + /usr/share/doc + /usr/share/man/ + + + klibc.m4 + + + + + 2016-04-27 + 2.0.4 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-07 + 2.0.4 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + libuv + http://libuv.org/ + + Yusuf Aydemir + yusuf.aydemir@pisilinux.org + + custom + library + system.devel + Multi-platform support library with a focus on asynchronous I/O + libuv is a multi-platform support library with a focus on asynchronous I/O. It was primarily developed for use by Node.js, but it's also used by Luvit, Julia, pyuv, and others. + https://github.com/libuv/libuv/archive/v1.10.1.tar.gz + + glibc-devel + python-sphinx + + system/devel/libuv/pspec.xml + + + libuv + + /usr/lib + /usr/share/doc/libuv/ + + + + libuv-devel + Development files for libuv + + libuv + + + /usr/include + /usr/lib/pkgconfig + + + + + 2016-12-02 + 1.10.1 + First release + Yusuf Aydemir + yusuf.aydemir@pisilinux.org + + + + + + dietlibc + http://www.fefe.de/dietlibc + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + library + system.devel + A libc optimized for small size + Düşük boyut için optimize edilmiş C kütüphanesi + dietlibc is a libc that is optimized for small size. It can be used to create small statically linked binaries for Linux on various architectures. + dietlibc, düşük boyutlu olması için optimize edilmiş bir C kütüphanesidir. Farklı mimarilerde statik bağlanmış ve düşük boyutlu ikili dosyalar oluşturmak için kullanılabilir. + http://pkgs.fedoraproject.org/repo/pkgs/dietlibc/dietlibc-0.33.20120825.tar.xz/016865b8c40d40a57b2ddb5862f2e338/dietlibc-0.33.20120825.tar.xz + http://pkgs.fedoraproject.org/repo/pkgs/dietlibc/dietlibc-github-c3f1cf67fcc186bb859e64a085bf98aaa6182a82.patch.gz/734e14b59b7f017ae5843ee9b9b6d34e/dietlibc-github-c3f1cf67fcc186bb859e64a085bf98aaa6182a82.patch.gz + + dietlibc-0.33-biarch.patch + + system/devel/dietlibc/pspec.xml + + + dietlibc + + /usr/bin + /usr/lib/dietlibc/include + /usr/lib/dietlibc/lib-i386 + /usr/lib/dietlibc/lib-x86_64 + /usr/share/man + /usr/share/doc + + + + + 2017-01-29 + 0.33.20120825 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 0.33.20120825 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 0.33.20120825 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + check + http://sourceforge.net/projects/check/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + library + system.devel + A unit test framework for C + C için birim test ortamı + check is a unit testing framework for C. It features a simple interface for defining unit tests, putting little in the way of the developer. Tests are run in a separate address space, so Check can catch both assertion failures and code errors that cause segmentation faults or other signals. The output from unit tests can be used within source code editors and IDEs. + check C dili için yazılmış bir birim test ortamıdır. Birim test tanımlamak için bir arayüz sunan check, geliştiriciye test yapabilmesi için kolay bir ortam sağlar. + mirrors://sourceforge/check/0.10/check-0.10.0.tar.gz + system/devel/check/pspec.xml + + + check + + /usr/bin + /usr/lib + /usr/share/info + /usr/share/man/man1/checkmk.1 + /usr/share/doc + + + + check-devel + Development files for check + check için geliştirme dosyaları + + check + + + /usr/include + /usr/lib/pkgconfig + /usr/share/aclocal + + + + check-docs + Documents for check + check için geliştirme belgeleri + + /usr/share/doc/check/example + + + + + 2016-04-27 + 0.10.0 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-02-28 + 0.10.0 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + bison + http://www.gnu.org/software/bison/bison.html + + Serdar Soytetir + kaptan@pisilinux.org + + GPLv2 + app:console + system.devel + A yacc-compatible parser generator + Yacc uyumlu yazım ayrıştırma üreteci + Un générateur d'analyseur syntaxique compatible avec yacc. Une fois que vous maîtrisez Bison, vous pouvez l'utiliser pour développer des analyseur léxicaux pour un grand nombres de langages, de ceux qui sont utilisés dans les simples calculatrices de bureau aux complexes langages de programmation. + A yacc-compatible parser generator. Once you are proficient with Bison, you can use it to develop a wide range of language parsers, from those used in simple desk calculators to complex programming languages + Yacc uyumlu yazım ayrıştırma üreteci. Bison'da ustalık kazandığınızda, basit hesap makinalarından, karmaşık programlama dillerine kadar uzanan geniş yazım ayrıştırıcılar geliştirebilirsiniz. + mirrors://gnu/bison/bison-3.0.4.tar.xz + + m4 + gettext + patch + + system/devel/bison/pspec.xml + + + bison + + m4 + gettext + + + /usr/bin + /usr/lib + /usr/share/doc + /usr/share/man + /usr/share/aclocal + /usr/share/info + /usr/share/bison + /usr/share/locale + + + + + 2017-01-26 + 3.0.4 + Rebuild. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 3.0.4 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 3.0.4 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + libsigsegv + http://libsigsegv.sourceforge.net/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + library + system.devel + Une librairie pour gérer les erreurs de pagination en mode utilisateur. + A library for handling page faults in user mode + Oluşan bellek hatalarının kullanıcı kipinde işlenmesini sağlayan bir kitaplık + This is a library for handling page faults in user mode. A page fault occurs when a program tries to access to a region of memory that is currently not available. + libsigsegv, oluşan bellek hatalarının kullanıcı kipinde işlenmesini sağlayan bir kitaplıktır. + mirrors://gnu/libsigsegv/libsigsegv-2.10.tar.gz + system/devel/libsigsegv/pspec.xml + + + libsigsegv + + /usr/lib + /usr/share/doc + + + + libsigsegv-devel + Development files for libsigsegv + libsigsegv için geliştirme dosyaları + + libsigsegv + + + /usr/include + + + + + 2017-01-24 + 2.10 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 2.10 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 2.10 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + libarchive @@ -12090,117 +13277,158 @@ - gnuconfig - http://savannah.gnu.org/projects/config + glpk + http://www.gnu.org/software/glpk/glpk.html Serdar Soytetir kaptan@pisilinux.org - GPLv2+ - data + GPLv2 + library system.devel - Base config files for autofoo - Autofoo için temel config dosyaları - fichiers GNU config.sub et config.guess mis à jour. - gnuconfig contains updated config.sub and config.guess files from GNU. - gnuconfig güncel GNU config.sub ve config.guess dosyaları içerir. - http://source.pisilinux.org/1.0/config-20141105.tar.gz - system/devel/gnuconfig/pspec.xml + GNU Linear Programming Kit + GNU Doğrusal Programlama Kiti + Le paquet GLPK (GNU Linear Programming Kit - Kit de Programmation Linéaire) a pour objectif de résoudre le problème de programmation linéaire (LP) de grande envergure, la programmation d'entiers mixés (MIP), et autres problèmes de la sorte. Il s'agit d'un ensemble de routines écrites en C ANSI et organisées de manière à former une librairie que l'on peut appeler. + The GLPK (GNU Linear Programming Kit) package is intended for solving large-scale linear programming (LP), mixed integer programming (MIP), and other related problems. It is a set of routines written in ANSI C and organized in the form of a callable library. + mirrors://gnu/glpk/glpk-4.59.tar.gz + + gmp-devel + + system/devel/glpk/pspec.xml - gnuconfig + glpk + + gmp + - /usr/share/gnuconfig + /usr/bin + /usr/lib /usr/share/doc - - - 2017-01-26 - 20141105 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 20141105 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 20141105 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - libmpc - http://www.multiprecision.org/ - - Serdar Soytetir - kaptan@pisilinux.org - - LGPLv2.1 - library - system.devel - High precision and correct rounding library - Yüksek hassasiyet ve yuvarlama kitaplığı - libmpc is a library for arithmetic of complex numbers with arbitrarily high precision and correct rounding. - libmpc aritmetik kompleks sayılarla yüksek hassasiyette ve doğru yuvarlama ile işlem yapılmasını sağlayan bir kitaplıktır. - ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz - - gmp-devel - mpfr-devel - - system/devel/libmpc/pspec.xml - - libmpc + glpk-devel + Development files for glpk + glpk için geliştirme dosyaları - gmp - mpfr - - - /usr/lib - /usr/share/doc/libmpc - /usr/share/info - - - - libmpc-devel - Development files for libmpc - libmpc için geliştirme dosyaları - - libmpc + glpk /usr/include + + + 2016-04-27 + 4.59 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 4.59 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + autoconf-archive + http://www.gnu.org/software/autoconf-archive/ + + Stefan Gronewold + groni@pisilinux.org + + GPL + system.devel + A collection of freely re-usable Autoconf macros + The GNU Autoconf Archive is a collection of more than 500 macros for GNU Autoconf that have been contributed as free software by friendly supporters of the cause from all over the Internet. + ftp://ftp.gnu.org/pub/gnu/autoconf-archive/autoconf-archive-2016.09.16.tar.xz + + autoconf + automake + + system/devel/autoconf-archive/pspec.xml + + + autoconf-archive + A collection of freely re-usable Autoconf macros + + autoconf + automake + + + /usr/share/aclocal + / + + + + + 2017-01-25 + 2016.09.16 + First Release + Stefan Gronewold + groni@pisilinux.org + + + + + + m4 + http://www.gnu.org/software/m4/m4.html + + PisiLinux Community + admins@pisilinux.org + + GPLv3 + app:console + system.devel + GNU macro processor + GNU makro işleyicisi + L'utilitaire m4 est processeur de macro permettant de lire un ou plusieurs fichiers, les traiter en fonction leurs directives macro puis écrire le résultat dans la sortie standard. + The m4 utility is a macro processor that shall read one or more text files, process them according to their included macro statements, and write the results to standard output + m4, bir ya da daha fazla metin dosyasını okuyan; içerdikleri makro kurallarına göre bu dosyaları işleyen ve sonuçlarını standart çıktıya ileten bir makro işlemcisidir. + mirrors://gnu/m4/m4-1.4.18.tar.xz + + gettext + libsigsegv-devel + + system/devel/m4/pspec.xml + + + m4 + + libsigsegv + + + /usr/bin + /usr/share/doc + /usr/share/info + /usr/share/man + + - 2017-01-04 - 1.0.3 - Rebuild with new toolchain. + 2017-01-27 + 1.4.18 + Version bump. Ertuğrul Erata ertugrulerata@gmail.com 2016-04-27 - 1.0.3 + 1.4.17 Release Bump PisiLinux Community admin@pisilinux.org 2016-02-28 - 1.0.3 + 1.4.17 First release Ertuğrul Erata ertugrulerata@gmail.com @@ -12209,113 +13437,361 @@ - xorg-util - http://www.x.org/ + automake + http://www.gnu.org/software/automake/ PisiLinux Community admins@pisilinux.org - MIT + GPLv2+ app:console system.devel - Utilitaires de X.Org - X.Org utilities - X.Org araçları - X.Org Werkzeuge - xorg-util contains some Xorg X11 command-line utilities, but more importantly, X11 configuration and rule files. - mirrors://xorg/individual/util/gccmakedep-1.0.3.tar.bz2 - mirrors://xorg/individual/util/imake-1.0.7.tar.bz2 - mirrors://xorg/individual/util/lndir-1.0.3.tar.bz2 - mirrors://xorg/individual/util/makedepend-1.0.5.tar.bz2 - mirrors://xorg/individual/util/xorg-cf-files-1.0.6.tar.bz2 + A tool for automatically generating Makefile.in files compliant with the GNU Coding Standards + Makefile.am yapılandırma dosyalarından Makefile.in dosyası üreten program + Automake est un outil de génération automatique de Makefiles compatibles avec les standards de Codage GNU. Vous aurez également besoin d'installer le paquet GNU AutoConf + Automake is a tool for automatically generating Makefile.in files compliant with the GNU Coding Standards. + Makefile.am yapılandırma dosyalarından GNU kodlama standartlarına uygun Makefile.in dosyası üreten program. Bununla birlikte Autoconf paketini de yüklemelisiniz. + mirrors://gnu/automake/automake-1.15.tar.xz - xorg-proto - util-macros + perl + autoconf + gnuconfig + patch - - host-defaults.patch - - system/devel/xorg-util/pspec.xml + system/devel/automake/pspec.xml - xorg-util - - /usr/bin - /usr/share/X11/config - /usr/share/man - - - - - 2016-04-27 - 7.6 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2017-03-18 - 7.6 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - perl-XML-Parser - http://search.cpan.org/dist/XML-Parser/ - - PisiLinux Community - admins@pisilinux.org - - Artistic - library - system.devel - A Perl extension interface to James Clark's XML parser, expat - James Clark'ın XML ayırıştırıcısına bir Perl uzantısı arayüzü - Una extensión Perl al parseador XML de James Clark, expat - This module provides an interface to James Clark's XML parser, expat. As in expat, a single instance of the parser can only parse one document. Calls to parsestring after the first for a given instance will die. - Bu modül James Clark'ın XML ayrıştırıcısı expat için bir arayüz sağlar. Expat'ta olduğu gibi ayrıştırıcıdan türetilen her nesne sadece bir dosyayı ayrıştırabilir. - Este módulo facilita una interfaz al parser XML de James Clark, expat. Como en expat, una sola instancia del parser puede analizar solamente un documento. Llamadas a parsestring después del primero de una instancia determinada morirán. - mirrors://cpan/authors/id/T/TO/TODDR/XML-Parser-2.44.tar.gz - - expat-devel - perl - - system/devel/perl-XML-Parser/pspec.xml - - - perl-XML-Parser + automake - expat - perl + perl + autoconf + /usr/bin + /usr/share/automake-* + /usr/share/aclocal-* + /usr/share/aclocal + /usr/share/info /usr/share/doc - /usr/lib /usr/share/man - 2017-01-21 - 2.44 - Rebuild for perl-5.24.0 + 2017-01-25 + 1.15 + Rebuild. PisiLinux Community admin@pisilinux.org 2016-04-27 - 2.44 + 1.15 Release Bump PisiLinux Community admin@pisilinux.org - 2016-03-06 - 2.44 + 2016-03-13 + 1.15 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + chrpath + http://freshmeat.net/projects/chrpath/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + system.devel + Change the dynamic library load path (rpath) of binaries + Dinamik kitaplık yükleme yolunu (rpath) değiştirme aracı + chrpath allows you to modify the dynamic library load path (rpath and runpath) of compiled programs and libraries. + chrpath ile derlenmiş kitaplıkların ve programların dinamik kitaplık yükleme yolunu (rpath ve runpath) değiştirebilirsiniz. + http://source.pisilinux.org/1.0/chrpath-0.16.tar.gz + + docdir.patch + + system/devel/chrpath/pspec.xml + + + chrpath + + /usr/bin + /usr/share/doc + /usr/share/man + + + + + 2017-01-25 + 0.16 + Rebuild. + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 0.16 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-05 + 0.16 + First release + Alihn Öztürk + alihan@pisilinux.org + + + + + + elfutils + http://www.redhat.com/ + + PisiLinux Community + admins@pisilinux.org + + OpenSoftware + app:console + library + system.devel + Libraries/utilities to handle ELF objects + Derlenmiş objeleri işlemek için gereken aletler koleksiyonu + elfutils contains libraries and utilities to handle ELF objects and is a replacement for libelf. + elfutils derlenmiş objeleri işlemek için gereken çeşitli araçlar içerir. + ftp://sourceware.org/pub/elfutils/0.168/elfutils-0.168.tar.bz2 + + bzip2 + xz-devel + zlib-devel + + system/devel/elfutils/pspec.xml + + + elfutils + + xz + zlib + bzip2 + libgcc + + + /usr/bin + /usr/lib + /usr/share/doc + /usr/include + + + + elfutils-32bit + 32-bit shared libraries for elfutils + elfutils için 32-bit paylaşımlı kitaplıklar + emul32 + + xz-32bit + zlib-32bit + + + xz-32bit + zlib-32bit + elfutils + + + /usr/lib32 + + + + + 2017-01-25 + 0.168 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 0.165 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-04-07 + 0.165 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + cloog + http://www.cloog.org/ + + Serdar Soytetir + kaptan@pisilinux.org + + GPLv2+ + app:console + library + system.devel + Chunky Loop Generator + cloog is CLooG is a free software and library to generate code for scanning Z-polyhedra. It is used by the GCC Graphite optimization framework. + http://www.bastoul.net/cloog/pages/download/cloog-0.18.4.tar.gz + + gmp-devel + ppl-devel + isl-devel + + system/devel/cloog/pspec.xml + + + cloog + + gmp + isl + + + /usr/bin + /usr/lib + /usr/share/doc/cloog/ + /usr/share/info + + + + cloog-devel + Development files for cloog + + cloog + + + /usr/include + /usr/lib/pkgconfig/cloog.pc + + + + + 2016-04-27 + 0.18.4 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 0.18.4 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + patch + http://www.gnu.org/software/patch/patch.html + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + system.devel + Applies patch files + Yama dosyalarını uygular + Aplicación de archivos de parches + Permet d'appliquer un patch générer par la commande diff aux fichiers originels, obtenant ainsi les fichiers patchés. + Patch takes a patch file generated by diff command, and applies it to the original files, thus producing patched files. + Özgün dosyaları, diff komutu ile üretilmiş yama dosyasını uygulayarak, yeni biçimlerine çevirir. + Recibe una archivo de parche generado por el comando diff y lo aplica a los archivos originales, así produciendo archivos parcheados. + ftp://ftp.gnu.org/gnu/patch/patch-2.7.5.tar.xz + + attr-devel + + system/devel/patch/pspec.xml + + + patch + + attr + + + /usr/bin + /usr/share/doc + /usr/share/man + + + + + 2017-01-07 + 2.7.5 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 2.7.5 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-20 + 2.7.5 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + unifdef + http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/unifdef/ + + PisiLinux Community + admins@pisilinux.org + + BSD + app:console + system.devel + The unifdef utility selectively processes conditional cpp(1) directives + L'utilitaire unifdef traite sélectivement les directives conditionnelles cpp(1). Il supprime d'un fichier les directives ainsi que le texte additionnel qu'elles indiquent comme à supprimer tout en laissant le reste du fichier intact. + The unifdef utility selectively processes conditional cpp(1) directives. It removes from a file both the directives and any additional text that they specify should be removed, while otherwise leaving the file alone. + http://dotat.at/prog/unifdef/unifdef-2.11.tar.gz + system/devel/unifdef/pspec.xml + + + unifdef + + /usr/bin + /usr/share/man + /usr/share/doc/unifdef + + + + + 2016-04-27 + 2.11 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 2.11 First release Ertuğrul Erata ertugrulerata@gmail.com @@ -12427,553 +13903,69 @@ - python-setuptools - http://pypi.python.org/pypi/setuptools + libseccomp + http://sourceforge.net/projects/libseccomp/ - PisiLinux Community - admins@pisilinux.org + Aydın Demirel + aydin.demirel@pisilinux.org - PSF-2.2 - library + LGPLv2.1 + app:library system.devel - Python setuptools - Python kurulum araçları - python-setuptools is a collection of enhancements to the Python distutils that allow you to more easily build and distribute Python packages, especially ones that have dependencies on other packages. - python-setuptools, Python distutils'e yapılan, özellikle başka paketlere bağımlılığı olan Python paketlerini daha kolay oluşturmaya ve dağıtmaya yarayan iyileştirmeler koleksiyonudur. - http://pypi.python.org/packages/source/d/distribute/distribute-0.6.49.tar.gz - system/devel/python-setuptools/pspec.xml + Enhanced seccomp library + Gelişmiş seccomp kütüphanesi + High level interface to the Linux Kernel's seccomp filter. + Linux Kernel'in seccomp süzgecine yüksek seviyeli arayüz + https://github.com/seccomp/libseccomp/archive/v2.3.1.tar.gz + + glibc-devel + libutil-linux-devel + + system/devel/libseccomp/pspec.xml - python-setuptools + libseccomp /usr/bin - /usr/lib/python* - /usr/share/doc + /usr/share/man + /usr/lib - - - 2017-01-08 - 0.6.49 - Rebuild with new toolchain. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 0.6.49 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 0.6.49 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - flex - http://flex.sourceforge.net/ - - PisiLinux Community - admins@pisilinux.org - - FLEX - app:console - system.devel - GNU lexical analyser generator - GNU sözcüksel analiz üreteci - Flex est un outil de génération d'analyseur (scanner). Un analyseur (également appelé tokenizer en anglais) est un programme qui repère les motifs lexicaux (ou lexème) dans du texte. - Flex is a tool for generating scanners. A scanner, sometimes called a tokenizer, is a program which recognizes lexical patterns in text - Flex, metin içindeki sözcüksel kalıpları tanıyan, analiz aracı üretecidir. - https://github.com/westes/flex/releases/download/v2.6.3/flex-2.6.3.tar.gz - - patch - texinfo - - system/devel/flex/pspec.xml - - flex + libseccomp-devel + Development files for libseccomp + + libseccomp + - /usr/bin - /usr/lib - /usr/share/doc - /usr/share/man - /usr/share/info /usr/include - /usr/share/locale - - - - - 2017-01-24 - 2.6.3 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-10-05 - 2.6.1 - Version bump. - Yusuf Aydemir - yusuf.aydemir@pisilnux.org - - - 2016-04-27 - 2.6.0 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 2.6.0 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - gc - http://www.hpl.hp.com/personal/Hans_Boehm/gc - - PisiLinux Community - admins@pisilinux.org - - BSD - GPLv2 - library - system.devel - A garbage collector for C and C++ - C ve C++ için bir çöp toplama kitaplığı - Ostrożny odśmiecacz dla C i C++ - The Boehm-Demers-Weiser conservative garbage collector can be used as a garbage collecting replacement for C malloc or C++ new. - gc, C malloc veya C++ new yerine kullanılabilecek, Boehm-Demers-Weiser çöp toplayıcısı kitaplığıdır. - Boehm's GC jest odśmiecającym alokatorem pamięci, który został zaprojektowany z zamiarem używania jako zastępcza wtyczka dla funkcji C malloc. - http://hboehm.info/gc/gc_source/gc-7.6.0.tar.gz - - libatomic_ops-devel - - system/devel/gc/pspec.xml - - - gc - - libgcc - - - /usr/lib - /usr/share/doc - - - - gc-devel - Development files for gc - gc için geliştirme dosyaları - Pliki nagłówkowe gc - - gc - - - /usr/include/ - /usr/lib/pkgconfig + /usr/lib/pkgconfig - 2017-01-23 - 7.6.0 - Version bump.. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 7.4.2 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 7.4.2 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - dietlibc - http://www.fefe.de/dietlibc - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - library - system.devel - A libc optimized for small size - Düşük boyut için optimize edilmiş C kütüphanesi - dietlibc is a libc that is optimized for small size. It can be used to create small statically linked binaries for Linux on various architectures. - dietlibc, düşük boyutlu olması için optimize edilmiş bir C kütüphanesidir. Farklı mimarilerde statik bağlanmış ve düşük boyutlu ikili dosyalar oluşturmak için kullanılabilir. - http://pkgs.fedoraproject.org/repo/pkgs/dietlibc/dietlibc-0.33.20120825.tar.xz/016865b8c40d40a57b2ddb5862f2e338/dietlibc-0.33.20120825.tar.xz - http://pkgs.fedoraproject.org/repo/pkgs/dietlibc/dietlibc-github-c3f1cf67fcc186bb859e64a085bf98aaa6182a82.patch.gz/734e14b59b7f017ae5843ee9b9b6d34e/dietlibc-github-c3f1cf67fcc186bb859e64a085bf98aaa6182a82.patch.gz - - dietlibc-0.33-biarch.patch - - system/devel/dietlibc/pspec.xml - - - dietlibc - - /usr/bin - /usr/lib/dietlibc/include - /usr/lib/dietlibc/lib-i386 - /usr/lib/dietlibc/lib-x86_64 - /usr/share/man - /usr/share/doc - - - - - 2016-04-27 - 0.33.20120825 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 0.33.20120825 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - nasm - http://nasm.sourceforge.net/ - - PisiLinux Community - admins@pisilinux.org - - BSD - app:console - system.devel - Groovy little assembler - Assembler derleyicisi - NASM est l'assembleur Netwide, un assembleur libre et portable pour les processeurs des séries Intel 80x86 - NASM is the Netwide Assembler, a free portable assembler for the Intel 80x86 microprocessor series. - Intel 80x86 mikroişlemci serisi için aktarılabilir Assembler derleyicisi. - http://www.nasm.us/pub/nasm/releasebuilds/2.12.02/nasm-2.12.02.tar.xz - - texinfo - - system/devel/nasm/pspec.xml - - - nasm - - /usr/bin - /usr/share/doc - /usr/share/man - - - - - 2017-01-24 - 2.12.02 + 2016-07-19 + 2.3.1 Version bump. Ertuğrul Erata ertugrulerata@gmail.com 2016-04-27 - 2.12 + 2.3.0 Release Bump PisiLinux Community admin@pisilinux.org - 2016-03-13 - 2.12 + 2016-03-19 + 2.3.0 First release Ertuğrul Erata ertugrulerata@gmail.com - - - libatomic_ops - https://github.com/ivmai/libatomic_ops/ - - Pisi Linux Admins - admins@pisilinux.org - - GPLv2 - MIT - library - system.devel - Atomic memory update operations library - Atomik bellek işlemleri kütüphanesi - libatomic_ops provides implementations for atomic memory update operations on a number of architectures. This allows direct use of these in reasonably portable code. - libatomic_ops, çeşitli mimarilerde atomik bellek işlemleri yapılmasını sağlayarak taşınabilir kod yazma olanağı veren bir kütüphanedir. - http://www.ivmaisoft.com/_bin/atomic_ops/libatomic_ops-7.4.4.tar.gz - system/devel/libatomic_ops/pspec.xml - - - libatomic_ops - - /usr/lib - /usr/share/doc - - - - libatomic_ops-devel - libatomic_ops için geliştirme dosyaları - libatomic_ops için geliştirme dosyaları - - libatomic_ops - - - /usr/include - /usr/lib/pkgconfig - - - - - 2017-01-23 - 7.4.4 - Version bump.. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 7.4.2 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 7.4.2 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - gobject-introspection - http://live.gnome.org/GObjectIntrospection - - Pisi Linux Admins - admins@pisilinux.org - - LGPLv2+ - GPLv2+ - library - app:console - system.devel - Introspection system for GObject-based libraries - gobject-introspection can scan C header and source files in order to generate introspection typelib files. It also provides an API to examine typelib files, useful for creating language bindings among other things. - mirrors://gnome/gobject-introspection/1.46/gobject-introspection-1.46.0.tar.xz - - libffi-devel - python-devel - glib2-devel - chrpath - - system/devel/gobject-introspection/pspec.xml - - - gobject-introspection - - libffi - glib2 - - - /usr/lib/lib*.so* - /usr/lib/girepository-1.0/*.typelib - /usr/share/locale - /usr/share/doc - - - - gobject-introspection-devel - Development files for gobject-introspection - - gobject-introspection - libffi - glib2 - libffi-devel - glib2-devel - - - /usr/include - /usr/lib/gobject-introspection - /usr/bin/g-ir-* - /usr/lib/pkgconfig - /usr/share/gir-1.0 - /usr/share/aclocal - /usr/share/gobject-introspection-1.0 - /usr/share/man - - - - - 2016-04-27 - 1.46.0 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 1.46.0 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - check - http://sourceforge.net/projects/check/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - library - system.devel - A unit test framework for C - C için birim test ortamı - check is a unit testing framework for C. It features a simple interface for defining unit tests, putting little in the way of the developer. Tests are run in a separate address space, so Check can catch both assertion failures and code errors that cause segmentation faults or other signals. The output from unit tests can be used within source code editors and IDEs. - check C dili için yazılmış bir birim test ortamıdır. Birim test tanımlamak için bir arayüz sunan check, geliştiriciye test yapabilmesi için kolay bir ortam sağlar. - mirrors://sourceforge/check/0.10/check-0.10.0.tar.gz - system/devel/check/pspec.xml - - - check - - /usr/bin - /usr/lib - /usr/share/info - /usr/share/man/man1/checkmk.1 - /usr/share/doc - - - - check-devel - Development files for check - check için geliştirme dosyaları - - check - - - /usr/include - /usr/lib/pkgconfig - /usr/share/aclocal - - - - check-docs - Documents for check - check için geliştirme belgeleri - - /usr/share/doc/check/example - - - - - 2016-04-27 - 0.10.0 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-02-28 - 0.10.0 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - colorgcc - http://www.console-colors.de - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - system.devel - GCC output colorizer - GCC çıktısını renklendiren bir araç. - A tool that colorizes GCC output. - http://source.pisilinux.org/1.0/colorgcc-1.3.2.tar.gz - - colorgcc-1.3.2-handle-translated-output.patch - colorgcc-1.3.2-mdkconf.patch - add-i686-gnu-stuff.patch - - system/devel/colorgcc/pspec.xml - - - colorgcc - - gcc - - - /usr/bin - /usr/share/colorgcc - /etc - /usr/share/doc - - - colorgcc.sh - colorgcc.csh - - - - - 2016-04-27 - 1.3.2 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 1.3.2 - First release - Alihan Öztürk - alihan@pisilinux.org - - - gmp @@ -13061,1300 +14053,6 @@ - - - libuv - http://libuv.org/ - - Yusuf Aydemir - yusuf.aydemir@pisilinux.org - - custom - library - system.devel - Multi-platform support library with a focus on asynchronous I/O - libuv is a multi-platform support library with a focus on asynchronous I/O. It was primarily developed for use by Node.js, but it's also used by Luvit, Julia, pyuv, and others. - https://github.com/libuv/libuv/archive/v1.10.1.tar.gz - - glibc-devel - python-sphinx - - system/devel/libuv/pspec.xml - - - libuv - - /usr/lib - /usr/share/doc/libuv/ - - - - libuv-devel - Development files for libuv - - libuv - - - /usr/include - /usr/lib/pkgconfig - - - - - 2016-12-02 - 1.10.1 - First release - Yusuf Aydemir - yusuf.aydemir@pisilinux.org - - - - - - mpfr - http://www.mpfr.org - - Serdar Soytetir - kaptan@pisilinux.org - - GPLv2+ - LGPLv2+ - library - system.devel - Multiple precision floating point library - La librairie MPFR est une librairie C pour les calculs à virgules flottantes à précisions multiples à arrondi exact (également appelé arrondi correct). Elle est basée sur la librairie à précision multiple GMP. - The MPFR library is a C library for multiple-precision floating-point computations with exact rounding (also called correct rounding). It is based on the GMP multiple-precision library. - MPFR es una librería en C para computaciones de punto flotante de múltiple precisión con redondeo exacto (también llamado redondeo correcto). Está basada en la librería de múltiple precisión GMP. - http://www.mpfr.org/mpfr-current/mpfr-3.1.5.tar.xz - - gmp-devel - - system/devel/mpfr/pspec.xml - - - mpfr - - gmp - - - /usr/lib - /usr/share/info - /usr/share/doc/mpfr - - - - mpfr-devel - Development files for mpfr - mpfr için geliştirme dosyaları - - mpfr - - - /usr/include - /usr/share/doc/mpfr/examples - /usr/share/doc/mpfr/html - - - - - 2017-01-04 - 3.1.5 - Rebuild with new toolchain. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2017-01-01 - 3.1.5 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 3.1.4 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 3.1.4 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - unifdef - http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.bin/unifdef/ - - PisiLinux Community - admins@pisilinux.org - - BSD - app:console - system.devel - The unifdef utility selectively processes conditional cpp(1) directives - L'utilitaire unifdef traite sélectivement les directives conditionnelles cpp(1). Il supprime d'un fichier les directives ainsi que le texte additionnel qu'elles indiquent comme à supprimer tout en laissant le reste du fichier intact. - The unifdef utility selectively processes conditional cpp(1) directives. It removes from a file both the directives and any additional text that they specify should be removed, while otherwise leaving the file alone. - http://dotat.at/prog/unifdef/unifdef-2.11.tar.gz - system/devel/unifdef/pspec.xml - - - unifdef - - /usr/bin - /usr/share/man - /usr/share/doc/unifdef - - - - - 2016-04-27 - 2.11 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 2.11 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - guile - http://www.gnu.org/software/guile/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2+ - LGPLv2+ - app:console - library - system.devel - Interpréteur et librairie GNU Scheme. - GNU Scheme interpreter and library - GNU Scheme yorumlayıcısı ve kitaplığı - Język GNU Extension language. - GUILE (GNU's Ubiquitous Intelligent Language for Extension) is a library implementation of the Scheme programming language, written in C. GUILE provides a machine-independent execution platform that can be linked in as a library during the building of extensible programs. - mirrors://gnu/guile/guile-2.0.13.tar.xz - - gc-devel - gettext-devel - gmp-devel - libunistring-devel - libffi-devel - readline-devel - - system/devel/guile/pspec.xml - - - guile - - gc - gmp - libffi - libtool-ltdl - libunistring - readline - - - /etc - /usr/share/doc - /usr/share/man - /usr/bin - /usr/share/info - /usr/lib/lib* - /usr/share/guile - /usr/share/emacs - /usr/share/gdb/auto-load - /usr/lib/guile/2.0 - - - - guile-devel - Development files for guile - guile için geliştirme dosyaları - Pliki nagłówkowe guile. - - guile - gc-devel - gmp-devel - - - /usr/include - /usr/lib/pkgconfig - /usr/share/aclocal - /usr/bin/guile-snarf - /usr/bin/guile-config - - - - - 2017-01-23 - 2.0.13 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 2.0.11 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2014-11-30 - 2.0.11 - First release - Yusuf Aydemir - yusuf.aydemir@pisilinux.org - - - - - - binutils - http://www.gnu.org/software/binutils/ - - Serdar Soytetir - kaptan@pisilinux.org - - GPLv2 - app:console - system.devel - Assembler and linker tools - Makine dili derleme ve bağlama araçları - Contient des commandes telles que as, ld, nm, objdump, ar, ranlib pour compiler du code assembleur en langage machine ainsi que pour chaîner (link) et manipuler les fichiers binaires objets. - Contains commands like as, ld, nm, objdump, ar, ranlib for compiling assembly code to the machine language, and for linking and manipulating the binary object files. - Assembly kodlarını makine diline derlemek, oluşan obje dosyalarını bağlamak ve ikili dosyalar üzerinde işlemler yapmak için kullanılan as, ld, nm, objdump, ar, ranlib gibi komutları içermektedir. - http://ftp.gnu.org/gnu/binutils/binutils-2.27.tar.bz2 - system/devel/binutils/pspec.xml - - - binutils - - zlib - - - /usr/bin - /usr/lib - /usr/include - /usr/share/info - /usr/share/man - - - - - 2017-01-02 - 2.27 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-26 - 2.26 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-03 - 2.26 - First release, fix for syslinux build - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - autogen - http://www.gnu.org/software/autogen - - PisiLinux Community - admins@pisilinux.org - - GPLv3 - app:console - system.devel - The automated text and program generation tool - Otomatik metin ve program üretme aracı - Herramienta para simplificar creación y mantenimiento de programas que contienen muchos textos repetitivos - autogen is a tool designed to simplify the creation and maintenance of programs that contain large amounts of repetitious text. - autogen büyük miktarda tekrarlı metin içeren uygulamaların otomatik üretilmesini sağlayan bir araçtır. - https://ftp.gnu.org/gnu/autogen/rel5.18.10/autogen-5.18.10.tar.gz - - gc-devel - gmp-devel - guile-devel - libxml2-devel - which - - system/devel/autogen/pspec.xml - - - autogen - - guile - libxml2 - - - /usr/lib - /usr/share/doc - /usr/share/man - /usr/bin - /usr/share/info - /usr/share/autogen - - - - autogen-devel - Development files for autogen - autogen için geliştirme dosyaları - - autogen - - - /usr/include - /usr/share/aclocal - /usr/lib/pkgconfig - /usr/share/man/man3 - /usr/bin/autoopts-config - /usr/share/man/man1/autoopts-config.1 - - - - - 2017-01-26 - 5.18.10 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 5.18.7 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 5.18.7 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - chrpath - http://freshmeat.net/projects/chrpath/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - system.devel - Change the dynamic library load path (rpath) of binaries - Dinamik kitaplık yükleme yolunu (rpath) değiştirme aracı - chrpath allows you to modify the dynamic library load path (rpath and runpath) of compiled programs and libraries. - chrpath ile derlenmiş kitaplıkların ve programların dinamik kitaplık yükleme yolunu (rpath ve runpath) değiştirebilirsiniz. - http://source.pisilinux.org/1.0/chrpath-0.16.tar.gz - - docdir.patch - - system/devel/chrpath/pspec.xml - - - chrpath - - /usr/bin - /usr/share/doc - /usr/share/man - - - - - 2017-01-25 - 0.16 - Rebuild. - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 0.16 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-05 - 0.16 - First release - Alihn Öztürk - alihan@pisilinux.org - - - - - - intltool - https://launchpad.net/intltool - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - system.devel - Utility for internationalizing various kinds of data files - Çeşitli kaynak kod dosyalarından satırları ayıklamak için kullanılan betikler - Scripts d'extraction depuis divers fichiers sources de chaînes traduisibles. - intltool automatically extracts translatable strings from oaf, glade, bonobo ui, nautilus theme, .desktop files, etc. and puts them in the po files. - Çeşitli kaynak kod dosyalarından satırları ayıklamak için kullanılan betikler. - https://launchpad.net/intltool/trunk/0.51.0/+download/intltool-0.51.0.tar.gz - - perl - perl-XML-Parser - - system/devel/intltool/pspec.xml - - - intltool - - perl-XML-Parser - - - /usr/bin - /usr/share/aclocal - /usr/share/intltool - /usr/share/man - /usr/share/doc - - - - - 2017-01-22 - 0.51.0 - Rebuild with new toolchain. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 0.51.0 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 0.51.0 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - elfutils - http://www.redhat.com/ - - PisiLinux Community - admins@pisilinux.org - - OpenSoftware - app:console - library - system.devel - Libraries/utilities to handle ELF objects - Derlenmiş objeleri işlemek için gereken aletler koleksiyonu - elfutils contains libraries and utilities to handle ELF objects and is a replacement for libelf. - elfutils derlenmiş objeleri işlemek için gereken çeşitli araçlar içerir. - ftp://sourceware.org/pub/elfutils/0.168/elfutils-0.168.tar.bz2 - - bzip2 - xz-devel - zlib-devel - - system/devel/elfutils/pspec.xml - - - elfutils - - xz - zlib - bzip2 - libgcc - - - /usr/bin - /usr/lib - /usr/share/doc - /usr/include - - - - elfutils-32bit - 32-bit shared libraries for elfutils - elfutils için 32-bit paylaşımlı kitaplıklar - emul32 - - xz-32bit - zlib-32bit - - - xz-32bit - zlib-32bit - elfutils - - - /usr/lib32 - - - - - 2017-01-25 - 0.168 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 0.165 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-04-07 - 0.165 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - isl - http://www.kotnet.org/~skimo/isl/ - - Serdar Soytetir - kaptan@pisilinux.org - - LGPLv2.1 - library - system.devel - Integer Set Library - isl is a library for manipulating sets and relations of integer points bounded by linear constraints. - http://isl.gforge.inria.fr/isl-0.16.1.tar.bz2 - - gmp-devel - - system/devel/isl/pspec.xml - - - isl - - gmp - - - /usr/lib - /usr/share/doc - - - - isl-devel - Development files for isl - isl için geliştirme dosyaları - - isl - - - /usr/include - /usr/lib/pkgconfig - - - - - 2016-04-27 - 0.16.1 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 0.16.1 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - libseccomp - http://sourceforge.net/projects/libseccomp/ - - Aydın Demirel - aydin.demirel@pisilinux.org - - LGPLv2.1 - app:library - system.devel - Enhanced seccomp library - Gelişmiş seccomp kütüphanesi - High level interface to the Linux Kernel's seccomp filter. - Linux Kernel'in seccomp süzgecine yüksek seviyeli arayüz - https://github.com/seccomp/libseccomp/archive/v2.3.1.tar.gz - - glibc-devel - libutil-linux-devel - - system/devel/libseccomp/pspec.xml - - - libseccomp - - /usr/bin - /usr/share/man - /usr/lib - - - - libseccomp-devel - Development files for libseccomp - - libseccomp - - - /usr/include - /usr/lib/pkgconfig - - - - - 2016-07-19 - 2.3.1 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 2.3.0 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-19 - 2.3.0 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - autoconf - http://www.gnu.org/software/autoconf/autoconf.html - - PisiLinux Community - admins@pisilinux.org - - GPLv3 - app:console - system.devel - Used to create autoconfiguration files - Used to create autoconfiguration files, Autoconf is an extensible package of m4 macros that produce shell scripts to automatically configure software source code packages. - mirrors://gnu/autoconf/autoconf-2.69.tar.xz - - texinfo - m4 - perl - - system/devel/autoconf/pspec.xml - - - autoconf - - texinfo - m4 - - - /usr/bin - /usr/share/doc - /usr/share/man - /usr/share/info - /usr/share/autoconf - - - - - 2017-01-25 - 2.69 - Rebuild. - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 2.69 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 2.69 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - automake - http://www.gnu.org/software/automake/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2+ - app:console - system.devel - A tool for automatically generating Makefile.in files compliant with the GNU Coding Standards - Makefile.am yapılandırma dosyalarından Makefile.in dosyası üreten program - Automake est un outil de génération automatique de Makefiles compatibles avec les standards de Codage GNU. Vous aurez également besoin d'installer le paquet GNU AutoConf - Automake is a tool for automatically generating Makefile.in files compliant with the GNU Coding Standards. - Makefile.am yapılandırma dosyalarından GNU kodlama standartlarına uygun Makefile.in dosyası üreten program. Bununla birlikte Autoconf paketini de yüklemelisiniz. - mirrors://gnu/automake/automake-1.15.tar.xz - - perl - autoconf - gnuconfig - patch - - system/devel/automake/pspec.xml - - - automake - - perl - autoconf - - - /usr/bin - /usr/share/automake-* - /usr/share/aclocal-* - /usr/share/aclocal - /usr/share/info - /usr/share/doc - /usr/share/man - - - - - 2017-01-25 - 1.15 - Rebuild. - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 1.15 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 1.15 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - cloog - http://www.cloog.org/ - - Serdar Soytetir - kaptan@pisilinux.org - - GPLv2+ - app:console - library - system.devel - Chunky Loop Generator - cloog is CLooG is a free software and library to generate code for scanning Z-polyhedra. It is used by the GCC Graphite optimization framework. - http://www.bastoul.net/cloog/pages/download/cloog-0.18.4.tar.gz - - gmp-devel - ppl-devel - isl-devel - - system/devel/cloog/pspec.xml - - - cloog - - gmp - isl - - - /usr/bin - /usr/lib - /usr/share/doc/cloog/ - /usr/share/info - - - - cloog-devel - Development files for cloog - - cloog - - - /usr/include - /usr/lib/pkgconfig/cloog.pc - - - - - 2016-04-27 - 0.18.4 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 0.18.4 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - xorg-proto - http://x.org/ - - PisiLinux Community - admins@pisilinux.org - - MIT - library - system.devel - Entêtes de protocole de X.Org. - X.Org Protocol Headers - X.Org Protokol Başlıkları - X.Org Protokoll Header - This package includes the protocol headers needed for X11 development. - Bu paket, X11 geliştirme için gerekli protokol başlıklarını içerir. - mirrors://xorg/individual/proto/bigreqsproto-1.1.2.tar.bz2 - mirrors://xorg/individual/proto/presentproto-1.0.tar.bz2 - mirrors://xorg/individual/proto/compositeproto-0.4.2.tar.bz2 - mirrors://xorg/individual/proto/damageproto-1.2.1.tar.bz2 - mirrors://xorg/individual/proto/dmxproto-2.3.1.tar.bz2 - mirrors://xorg/individual/proto/dri2proto-2.8.tar.bz2 - mirrors://xorg/individual/proto/dri3proto-1.0.tar.bz2 - mirrors://xorg/individual/proto/fixesproto-5.0.tar.bz2 - mirrors://xorg/individual/proto/fontsproto-2.1.3.tar.bz2 - mirrors://xorg/individual/proto/glproto-1.4.17.tar.bz2 - mirrors://xorg/individual/proto/inputproto-2.3.2.tar.bz2 - mirrors://xorg/individual/proto/kbproto-1.0.7.tar.gz - mirrors://xorg/individual/proto/printproto-1.0.5.tar.bz2 - mirrors://xorg/individual/proto/randrproto-1.5.0.tar.gz - mirrors://xorg/individual/proto/recordproto-1.14.2.tar.bz2 - mirrors://xorg/individual/proto/renderproto-0.11.1.tar.bz2 - mirrors://xorg/individual/proto/resourceproto-1.2.0.tar.bz2 - mirrors://xorg/individual/proto/scrnsaverproto-1.2.2.tar.bz2 - mirrors://xorg/individual/proto/videoproto-2.3.3.tar.bz2 - mirrors://xorg/individual/proto/xcmiscproto-1.2.2.tar.bz2 - mirrors://xorg/individual/proto/xextproto-7.3.0.tar.bz2 - mirrors://xorg/individual/proto/xf86bigfontproto-1.2.0.tar.bz2 - mirrors://xorg/individual/proto/xf86dgaproto-2.1.tar.bz2 - mirrors://xorg/individual/proto/xf86driproto-2.1.1.tar.bz2 - mirrors://xorg/individual/proto/xf86vidmodeproto-2.3.1.tar.bz2 - mirrors://xorg/individual/proto/xineramaproto-1.2.1.tar.bz2 - mirrors://xorg/individual/proto/xproto-7.0.28.tar.gz - mirrors://xorg/individual/proto/xproxymanagementprotocol-1.0.3.tar.bz2 - https://github.com/bbidulock/vncproto/releases/download/vncproto-1.1/vncproto-1.1.tar.bz2 - - util-macros - libxslt - - - docdir.patch - - system/devel/xorg-proto/pspec.xml - - - xorg-proto - - /usr/include - /usr/lib/pkgconfig - /usr/share/doc - /usr/share/man/man7/Xprint.7 - - - - - 2016-04-27 - 7.6 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 7.6 - A few updates - Alihan Öztürk - alihan@pisilinux.org - - - 2016-03-08 - 7.6 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - patch - http://www.gnu.org/software/patch/patch.html - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - system.devel - Applies patch files - Yama dosyalarını uygular - Aplicación de archivos de parches - Permet d'appliquer un patch générer par la commande diff aux fichiers originels, obtenant ainsi les fichiers patchés. - Patch takes a patch file generated by diff command, and applies it to the original files, thus producing patched files. - Özgün dosyaları, diff komutu ile üretilmiş yama dosyasını uygulayarak, yeni biçimlerine çevirir. - Recibe una archivo de parche generado por el comando diff y lo aplica a los archivos originales, así produciendo archivos parcheados. - ftp://ftp.gnu.org/gnu/patch/patch-2.7.5.tar.xz - - attr-devel - - system/devel/patch/pspec.xml - - - patch - - attr - - - /usr/bin - /usr/share/doc - /usr/share/man - - - - - 2017-01-07 - 2.7.5 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 2.7.5 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-20 - 2.7.5 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - util-macros - http://www.x.org/ - - PisiLinux Community - admins@pisilinux.org - - MIT - library - system.devel - Macros X.Org utilisées pour compiler X.Org - X.Org X11 Autotools macros - X.Org X11 Autotools makroları - X.Org Makros zum Kompilieren von X.Org - X.Org X11 autotools macros are required for building the various packages that comprise the X Window System. - X.Org X11 Autotools makroları, X pencere sistemini oluşturan çeşitli paketleri derlemek için gereklidir. - http://xorg.freedesktop.org/releases/individual/util/util-macros-1.19.0.tar.bz2 - - doc.patch - - system/devel/util-macros/pspec.xml - - - util-macros - - /usr/share/aclocal - /usr/share/pkgconfig - /usr/share/doc - - - - - 2016-04-27 - 1.19.0 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-02 - 1.19.0 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - klibc - http://www.zytor.com/mailman/listinfo/klibc - - PisiLinux Community - admins@pisilinux.org - - LGPLv2.1 - GPLv2 - library - system.devel - A minimal libc subset for use with initramfs - Küçük bir C kütüphanesi (libc) uyarlaması - klibc ou "espace utilisateur tôt", est une librairie résultante de l'effort pour transférer autant de code d'initialisation de Linux que possible hors du noyau. - klibc, or "early userspace", is library part of an effort which tries to move as much initialization code in Linux as possible out of the kernel. - klibc, sistem başlangıcı için gerekli olan kodların mümkün olduğunca çok kısmını Linux çekirdeği dışına atma hedefiyle oluşturulmuş bir kütüphanedir. - https://www.kernel.org/pub/linux/libs/klibc/2.0/klibc-2.0.4.tar.xz - - perl - kernel-module-headers - - system/devel/klibc/pspec.xml - - - klibc - - /lib - /usr/bin - /usr/lib/klibc/bin - /usr/lib/klibc/include - /usr/lib/klibc/lib - /usr/share/aclocal - /usr/share/doc - /usr/share/man/ - - - klibc.m4 - - - - - 2016-04-27 - 2.0.4 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-07 - 2.0.4 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - libtool - http://www.gnu.org/software/libtool/libtool.html - - Serdar Soytetir - kaptan@pisilinux.org - - GPLv2 - library - system.devel - A shared library tool for developers - Program geliştiriciler için ortak kütüphane aracı - Libtool est une librairie utilitaire partagée pour développeurs. - Libtool is a shared library tool for developers. - Libtool, program geliştiriciler için bir paylaşımlı kütüphane aracıdır. - mirrors://gnu/libtool/libtool-2.4.6.tar.xz - - gnuconfig - autoconf - automake - - system/devel/libtool/pspec.xml - - - libtool-ltdl - system.base - - /usr/lib - - - - libtool - - gnuconfig - - - /usr/bin - /lib - /usr/share/doc - /usr/share/info - /usr/share/man - /usr/include - /usr/share/libtool - /usr/share/aclocal - - - - libtool-ltdl-32bit - 32-bit shared libraries for libtool-ltdl - libtool için 32-bit paylaşımlı kitaplıklar - emul32 - emul32 - - libtool-ltdl - - - /usr/lib32 - - - - - 2017-01-26 - 2.4.6 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 2.4.6 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-02-06 - 2.4.6 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - yacc - http://dinosaur.compilertools.net/#yacc - - PisiLinux Community - admins@pisilinux.org - - as-is - app:console - system.devel - Yacc: Yet Another Compiler-Compiler - Yacc: Yet Another Compiler-Compiler - Yacc fourni un outil général de description d'entrée pour un logiciel. L'utilisateur de Yacc spécifie la structure de l'entrée avec le code à invoquer lorsque de tels structures sont reconnues. Yacc transforme ce qui a été spécifié en sous-routine gérant le processus d'entrée. - Yacc provides a general tool for describing the input to a computer program. The Yacc user specifies the structures of his input, together with code to be invoked as each such structure is recognized. Yacc turns such a specification into a subroutine that handles the input process - Yacc, bir uygulamaya girdi açıklamasını yapan bir araçtır. Yacc kullanıcısı, girdinin yapısını ve bu yapının her seferinde tanındığı kodu belirtir. Yacc; bu tür bir belirlemeyi, girdi sürecini işleyen bir alt yordama çevirir. - http://ibiblio.org/pub/linux/devel/compiler-tools/yacc-1.9.1.tar.Z - - mkstemp.patch - skeleton.c.diff - yacc-1.9.1-ia64.patch - - system/devel/yacc/pspec.xml - - - yacc - - /usr/bin - /usr/share/doc - /usr/share/man - - - - - 2017-01-26 - 1.9.1 - Rebuild. - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 1.9.1 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 1.9.1 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - gcc @@ -14520,86 +14218,8 @@ - cmake - http://www.cmake.org - - PisiLinux Community - admins@pisilinux.org - - BSD - app:console - system.devel - Cross-platform, open-source make system - Cmake, açık kaynak kodlu ve birden fazla platformda çalışan bir 'make' sistemidir. - CMake, système make open-source et multi-plateforme. CMake est utilisé pour contrôler le processus de compilation de logiciel en utilisant une plate-forme de fichiers de configuration simple et indépendante de compilateur. CMake génère des makefiles et un environnement de travail natifs pouvant être utilisés dans l'environnement du compilateur de votre choix. - CMake, the cross-platform, open-source make system. CMake is used to control the software compilation process using simple platform and compiler independent configuration files. CMake generates native makefiles and workspaces that can be used in the compiler environment of your choice. - Cmake, açık kaynak kodlu ve birden fazla platformda çalışan bir 'make' sistemidir. Yazılım derleme sürecini kontrol etmek için kullanılan CMake, derleyici bağımsız yapılandırma dosyalarının oluşturulmasını sağlar. - https://cmake.org/files/v3.7/cmake-3.7.1.tar.gz - - curl-devel - expat-devel - libarchive-devel - ncurses-devel - zlib-devel - xz-devel - libuv-devel - - system/devel/cmake/pspec.xml - - - cmake - - curl - expat - libarchive - libgcc - ncurses - zlib - libuv - - - /usr/bin - /usr/share/cmake - /usr/share/aclocal/ - /usr/share/doc - /usr/share/man - - - - - 2016-12-01 - 3.7.1 - Version bump. - Yusuf Aydemir - yusuf.aydemir@pisilnux.org - - - 2016-07-21 - 3.6.0 - Version bump. - Yusuf Aydemir - yusuf.aydemir@pisilinux.org - - - 2016-04-27 - 3.4.3 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 3.4.3 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - make - http://www.gnu.org/software/make/make.html + pkgconfig + http://www.freedesktop.org/software/pkgconfig/ PisiLinux Community admins@pisilinux.org @@ -14607,54 +14227,176 @@ GPLv2 app:console system.devel - Standard tool to compile source trees - Geleneksel kaynak kod ağaçlarını derleme aracı - Herramienta estándar para compilación de arboles de fuentes - Outil standard de compilation de hiérarchie de sources. Make détermine ce qu'il faut faire pour construire votre programme à partir d'un fichier appelé makefile. Une fois votre programme écrit, il suffit d'éditer un makefile pour lui afin de pouvoir utiliser Make pour le compiler et l'installer. - Standard tool to compile source trees. Make gets its knowledge of how to build your program from a file called the makefile. When you write a program, you should write a makefile for it, so that it is possible to use Make to build and install the program - Geleneksel kaynak kod ağaçlarını derleme aracı. Make, programınızı nasıl derleyeceği konusundaki bilgiyi "makefile" dosyasından alır. Bir uygulama yazdığınızda bunun için "makefile" dosyasını da hazırlamalısınız ki uygulamanız derlenebilsin ve yüklenebilsin. - mirrors://gnu/make/make-4.2.1.tar.bz2 + Package Config system that manages compile/link flags for libraries + Kütüphaneler için derleme bayraklarını yöneten bir paket yapılandırma sistemi + Sistema de configuración de paquetes que soporta banderas de compilación/link para librerías + Paquet de configuration système qui gère les fanions (flags) de compilation et chaînage (link) pour les librairies. Il aide à insérer les options adéquates dans la ligne de commande d'appel au compilateur. + Package Config system that manages compile/link flags for libraries. It helps you insert the correct compiler options on the command line. + Kütüphaneler için derleme bayraklarını yöneten, bir paket yapılandırma sistemi. Komut satırından, doğru derleme seçenekleri sunma olanağı sağlar + Sistema de configuración de paquetes que soporta banderas de compilación/link para librerías. Facilita la inserción de las opciones correctos de compilador en línea de comando + http://pkgconfig.freedesktop.org/releases/pkg-config-0.29.1.tar.gz - gettext gnuconfig - patch - gc-devel - guile-devel + glib2-devel - system/devel/make/pspec.xml + system/devel/pkgconfig/pspec.xml - make + pkgconfig - guile + glib2 + + + /usr/bin + /usr/share/doc + /usr/share/man + /usr/share/aclocal + /usr/share/pkgconfig + /usr/lib/pkgconfig + + + + + 2017-01-26 + 0.29.1 + Rebuild. + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 0.29.1 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 0.29.1 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + isl + http://www.kotnet.org/~skimo/isl/ + + Serdar Soytetir + kaptan@pisilinux.org + + LGPLv2.1 + library + system.devel + Integer Set Library + isl is a library for manipulating sets and relations of integer points bounded by linear constraints. + http://isl.gforge.inria.fr/isl-0.18.tar.bz2 + + gmp-devel + + system/devel/isl/pspec.xml + + + isl + + gmp + + + /usr/lib + /usr/share/doc + + + + isl-devel + Development files for isl + isl için geliştirme dosyaları + + isl + + + /usr/include + /usr/lib/pkgconfig + + + + + 2017-01-27 + 0.18 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 0.16.1 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 0.16.1 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + autoconf + http://www.gnu.org/software/autoconf/autoconf.html + + PisiLinux Community + admins@pisilinux.org + + GPLv3 + app:console + system.devel + Used to create autoconfiguration files + Used to create autoconfiguration files, Autoconf is an extensible package of m4 macros that produce shell scripts to automatically configure software source code packages. + mirrors://gnu/autoconf/autoconf-2.69.tar.xz + + texinfo + m4 + perl + + system/devel/autoconf/pspec.xml + + + autoconf + + texinfo + m4 /usr/bin /usr/share/doc /usr/share/man /usr/share/info - /usr/share/locale - /usr/include + /usr/share/autoconf - 2017-01-24 - 4.2.1 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com + 2017-01-25 + 2.69 + Rebuild. + PisiLinux Community + admin@pisilinux.org 2016-04-27 - 4.1 + 2.69 Release Bump PisiLinux Community admin@pisilinux.org - 2016-02-28 - 4.1 + 2016-03-13 + 2.69 First release Ertuğrul Erata ertugrulerata@gmail.com @@ -14663,316 +14405,54 @@ - xtrans - http://www.x.org/ + yacc + http://dinosaur.compilertools.net/#yacc PisiLinux Community admins@pisilinux.org - MIT - library - system.devel - Librairie trans de X.Org. - X.Org trans library - X.Org trans kitaplığı. - X.Org trans Bibliothek - xtrans includes a number of routines to make X implementations transport-independent. - xtrans, X gerçeklemelerini taşıma türünden bağımsız yapmak için kullanılan bazı yordamları içerir. - mirrors://xorg/individual/lib/xtrans-1.3.5.tar.bz2 - - util-macros - - system/devel/xtrans/pspec.xml - - - xtrans - - /usr/include/X11/Xtrans - /usr/share/aclocal - /usr/share/pkgconfig - - - - - 2016-04-27 - 1.3.5 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-08 - 1.3.5 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - yasm - http://www.tortall.net/projects/yasm/ - - PisiLinux Community - admins@pisilinux.org - - BSD - GPLv2 - LGPLv2 - Artistic + as-is app:console system.devel - Assembler that supports many syntaxes and architectures - Bir çok sentaks ve mimari destekleyen Assembler - A complete rewrite of the NASM assembler under the "new" BSD License. Yasm currently supports the x86 and AMD64 instruction sets, accepts NASM and GAS assembler syntaxes, outputs binary, ELF32, ELF64, 32 and 64-bit Mach-O, RDOFF2, COFF, Win32, and Win64 object formats and generates source debugging information in STABS, DWARF 2, and CodeView? 8 formats. - NASM Assembler programının yeni BSD lisansı ile baştan yazılmış bir Assembler. En önemli özellikleri x86 ve AMD64 komutsetlerini, NASM ve GAS sentaksını desteklemesidir. İkilik, ELF32, ELF64, 32 ve 64-bit Mach-O, RDOFF2, COFF, Win32 ve Win64 obje formatlarında çıktı üretebilir, hata ayıklamak için STABS, DWARF 2 ve CodeView? 8 formatlarını desteklemektedir. - https://github.com/yasm/yasm/archive/v1.3.0.tar.gz - system/devel/yasm/pspec.xml + Yacc: Yet Another Compiler-Compiler + Yacc: Yet Another Compiler-Compiler + Yacc fourni un outil général de description d'entrée pour un logiciel. L'utilisateur de Yacc spécifie la structure de l'entrée avec le code à invoquer lorsque de tels structures sont reconnues. Yacc transforme ce qui a été spécifié en sous-routine gérant le processus d'entrée. + Yacc provides a general tool for describing the input to a computer program. The Yacc user specifies the structures of his input, together with code to be invoked as each such structure is recognized. Yacc turns such a specification into a subroutine that handles the input process + Yacc, bir uygulamaya girdi açıklamasını yapan bir araçtır. Yacc kullanıcısı, girdinin yapısını ve bu yapının her seferinde tanındığı kodu belirtir. Yacc; bu tür bir belirlemeyi, girdi sürecini işleyen bir alt yordama çevirir. + http://ibiblio.org/pub/linux/devel/compiler-tools/yacc-1.9.1.tar.Z + + mkstemp.patch + skeleton.c.diff + yacc-1.9.1-ia64.patch + + system/devel/yacc/pspec.xml - yasm + yacc /usr/bin - /usr/lib /usr/share/doc /usr/share/man - - yasm-devel - Development files for yasm - yasm için geliştirme dosyaları - - yasm - - - /usr/include - /usr/lib/libyasm.a - - - - - 2016-04-27 - 1.3.0 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-07 - 1.3.0 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - autoconf-archive - http://www.gnu.org/software/autoconf-archive/ - - Stefan Gronewold - groni@pisilinux.org - - GPL - system.devel - A collection of freely re-usable Autoconf macros - The GNU Autoconf Archive is a collection of more than 500 macros for GNU Autoconf that have been contributed as free software by friendly supporters of the cause from all over the Internet. - ftp://ftp.gnu.org/pub/gnu/autoconf-archive/autoconf-archive-2016.09.16.tar.xz - - autoconf - automake - - system/devel/autoconf-archive/pspec.xml - - - autoconf-archive - A collection of freely re-usable Autoconf macros - - autoconf - automake - - - /usr/share/aclocal - / - - - - - 2017-01-25 - 2016.09.16 - First Release - Stefan Gronewold - groni@pisilinux.org - - - - - - libsigsegv - http://libsigsegv.sourceforge.net/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - library - system.devel - Une librairie pour gérer les erreurs de pagination en mode utilisateur. - A library for handling page faults in user mode - Oluşan bellek hatalarının kullanıcı kipinde işlenmesini sağlayan bir kitaplık - This is a library for handling page faults in user mode. A page fault occurs when a program tries to access to a region of memory that is currently not available. - libsigsegv, oluşan bellek hatalarının kullanıcı kipinde işlenmesini sağlayan bir kitaplıktır. - mirrors://gnu/libsigsegv/libsigsegv-2.10.tar.gz - system/devel/libsigsegv/pspec.xml - - - libsigsegv - - /usr/lib - /usr/share/doc - - - - libsigsegv-devel - Development files for libsigsegv - libsigsegv için geliştirme dosyaları - - libsigsegv - - - /usr/include - - - 2017-01-24 - 2.10 - Version bump. - Ertuğrul Erata - ertugrulerata@gmail.com + 2017-01-26 + 1.9.1 + Rebuild. + PisiLinux Community + admin@pisilinux.org 2016-04-27 - 2.10 + 1.9.1 Release Bump PisiLinux Community admin@pisilinux.org 2016-03-13 - 2.10 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - glpk - http://www.gnu.org/software/glpk/glpk.html - - Serdar Soytetir - kaptan@pisilinux.org - - GPLv2 - library - system.devel - GNU Linear Programming Kit - GNU Doğrusal Programlama Kiti - Le paquet GLPK (GNU Linear Programming Kit - Kit de Programmation Linéaire) a pour objectif de résoudre le problème de programmation linéaire (LP) de grande envergure, la programmation d'entiers mixés (MIP), et autres problèmes de la sorte. Il s'agit d'un ensemble de routines écrites en C ANSI et organisées de manière à former une librairie que l'on peut appeler. - The GLPK (GNU Linear Programming Kit) package is intended for solving large-scale linear programming (LP), mixed integer programming (MIP), and other related problems. It is a set of routines written in ANSI C and organized in the form of a callable library. - mirrors://gnu/glpk/glpk-4.59.tar.gz - - gmp-devel - - system/devel/glpk/pspec.xml - - - glpk - - gmp - - - /usr/bin - /usr/lib - /usr/share/doc - - - - glpk-devel - Development files for glpk - glpk için geliştirme dosyaları - - glpk - - - /usr/include - - - - - 2016-04-27 - 4.59 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 4.59 - First release - Alihan Öztürk - alihan@pisilinux.org - - - - - - catbox - http://pisilinux.org - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - library - system.devel - Python sandboxing module - Python için sandbox modülü - catbox is a Python sandboxing module commonly used by the package management system of PiSi Linux, PiSi. - https://github.com/baris/catbox/archive/catbox-1.6.1.tar.gz - - python-setuptools - python-devel - - system/devel/catbox/pspec.xml - - - catbox - - python - - - /usr/bin - /usr/lib - /usr/share/doc - - - - - 2016-04-27 - 1.6.1 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 1.6.1 + 1.9.1 First release Ertuğrul Erata ertugrulerata@gmail.com @@ -15066,56 +14546,93 @@ - numactl - ftp://oss.sgi.com/www/projects/libnuma/download + xorg-proto + http://x.org/ PisiLinux Community admins@pisilinux.org - GPLv2 - LGPLv2 + MIT library - app:console system.devel - Library for tuning NUMA machines - NUMA makineleri optimize etmek için bir kitaplık - numactl consists of a numactl program to run other programs with a specific NUMA policy and a libnuma to do allocations with NUMA policy in applications. - numactl, uygulamaları farklı NUMA (Tekdüze Olmayan Bellek Erişimi) politikalarıyla çalıştırmak için gerekli bir araç ve kitaplıktır. - ftp://oss.sgi.com/www/projects/libnuma/download/numactl-2.0.11.tar.gz - system/devel/numactl/pspec.xml + Entêtes de protocole de X.Org. + X.Org Protocol Headers + X.Org Protokol Başlıkları + X.Org Protokoll Header + This package includes the protocol headers needed for X11 development. + Bu paket, X11 geliştirme için gerekli protokol başlıklarını içerir. + mirrors://xorg/individual/proto/bigreqsproto-1.1.2.tar.bz2 + mirrors://xorg/individual/proto/presentproto-1.0.tar.bz2 + mirrors://xorg/individual/proto/compositeproto-0.4.2.tar.bz2 + mirrors://xorg/individual/proto/damageproto-1.2.1.tar.bz2 + mirrors://xorg/individual/proto/dmxproto-2.3.1.tar.bz2 + mirrors://xorg/individual/proto/dri2proto-2.8.tar.bz2 + mirrors://xorg/individual/proto/dri3proto-1.0.tar.bz2 + mirrors://xorg/individual/proto/fixesproto-5.0.tar.bz2 + mirrors://xorg/individual/proto/fontsproto-2.1.3.tar.bz2 + mirrors://xorg/individual/proto/glproto-1.4.17.tar.bz2 + mirrors://xorg/individual/proto/inputproto-2.3.2.tar.bz2 + mirrors://xorg/individual/proto/kbproto-1.0.7.tar.gz + mirrors://xorg/individual/proto/printproto-1.0.5.tar.bz2 + mirrors://xorg/individual/proto/randrproto-1.5.0.tar.gz + mirrors://xorg/individual/proto/recordproto-1.14.2.tar.bz2 + mirrors://xorg/individual/proto/renderproto-0.11.1.tar.bz2 + mirrors://xorg/individual/proto/resourceproto-1.2.0.tar.bz2 + mirrors://xorg/individual/proto/scrnsaverproto-1.2.2.tar.bz2 + mirrors://xorg/individual/proto/videoproto-2.3.3.tar.bz2 + mirrors://xorg/individual/proto/xcmiscproto-1.2.2.tar.bz2 + mirrors://xorg/individual/proto/xextproto-7.3.0.tar.bz2 + mirrors://xorg/individual/proto/xf86bigfontproto-1.2.0.tar.bz2 + mirrors://xorg/individual/proto/xf86dgaproto-2.1.tar.bz2 + mirrors://xorg/individual/proto/xf86driproto-2.1.1.tar.bz2 + mirrors://xorg/individual/proto/xf86vidmodeproto-2.3.1.tar.bz2 + mirrors://xorg/individual/proto/xineramaproto-1.2.1.tar.bz2 + mirrors://xorg/individual/proto/xproto-7.0.31.tar.gz + mirrors://xorg/individual/proto/xproxymanagementprotocol-1.0.3.tar.bz2 + https://github.com/bbidulock/vncproto/releases/download/vncproto-1.1/vncproto-1.1.tar.bz2 + + util-macros + libxslt + + + docdir.patch + + system/devel/xorg-proto/pspec.xml - numactl - - /usr/bin - /usr/lib - /usr/share/doc - /usr/share/man - - - - numactl-devel - Development files for numactl - numactl için geliştirme dosyaları - - numactl - + xorg-proto /usr/include - /usr/share/man/man3 + /usr/lib/pkgconfig + /usr/share/doc + /usr/share/man/man7/Xprint.7 - + + 2017-01-27 + 7.6 + xproto updates + PisiLinux Community + admin@pisilinux.org + + 2016-04-27 - 2.0.11 + 7.6 Release Bump PisiLinux Community admin@pisilinux.org + + 2016-04-27 + 7.6 + A few updates + Alihan Öztürk + alihan@pisilinux.org + - 2016-03-02 - 2.0.11 + 2016-03-08 + 7.6 First release Alihan Öztürk alihan@pisilinux.org @@ -15124,235 +14641,464 @@ - bison - http://www.gnu.org/software/bison/bison.html + xcb-proto + http://xcb.freedesktop.org/ + + PisiLinux Community + admins@pisilinux.org + + MIT + data + system.devel + XCB protocol descriptions + XCB protokol tanımlamaları + XCB is a project to enable efficient language bindings to the X11 protocol. This package contains the protocol descriptions themselves. Language bindings use these protocol descriptions to generate code for marshalling the protocol. + https://xcb.freedesktop.org/dist/xcb-proto-1.12.tar.bz2 + + libxml2 + + system/devel/xcb-proto/pspec.xml + + + xcb-proto + + /usr/lib/pkgconfig + /usr/lib/python* + /usr/share/doc + /usr/share/xcb + + + + + 2017-01-27 + 1.12 + Version Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 1.11 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 1.11 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + mpfr + http://www.mpfr.org Serdar Soytetir kaptan@pisilinux.org - GPLv2 - app:console - system.devel - A yacc-compatible parser generator - Yacc uyumlu yazım ayrıştırma üreteci - Un générateur d'analyseur syntaxique compatible avec yacc. Une fois que vous maîtrisez Bison, vous pouvez l'utiliser pour développer des analyseur léxicaux pour un grand nombres de langages, de ceux qui sont utilisés dans les simples calculatrices de bureau aux complexes langages de programmation. - A yacc-compatible parser generator. Once you are proficient with Bison, you can use it to develop a wide range of language parsers, from those used in simple desk calculators to complex programming languages - Yacc uyumlu yazım ayrıştırma üreteci. Bison'da ustalık kazandığınızda, basit hesap makinalarından, karmaşık programlama dillerine kadar uzanan geniş yazım ayrıştırıcılar geliştirebilirsiniz. - mirrors://gnu/bison/bison-3.0.4.tar.xz - - m4 - gettext - patch - - system/devel/bison/pspec.xml - - - bison - - m4 - gettext - - - /usr/bin - /usr/lib - /usr/share/doc - /usr/share/man - /usr/share/aclocal - /usr/share/info - /usr/share/bison - /usr/share/locale - - - - - 2017-01-26 - 3.0.4 - Rebuild. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-04-27 - 3.0.4 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 3.0.4 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - pkgconfig - http://www.freedesktop.org/software/pkgconfig/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - system.devel - Package Config system that manages compile/link flags for libraries - Kütüphaneler için derleme bayraklarını yöneten bir paket yapılandırma sistemi - Sistema de configuración de paquetes que soporta banderas de compilación/link para librerías - Paquet de configuration système qui gère les fanions (flags) de compilation et chaînage (link) pour les librairies. Il aide à insérer les options adéquates dans la ligne de commande d'appel au compilateur. - Package Config system that manages compile/link flags for libraries. It helps you insert the correct compiler options on the command line. - Kütüphaneler için derleme bayraklarını yöneten, bir paket yapılandırma sistemi. Komut satırından, doğru derleme seçenekleri sunma olanağı sağlar - Sistema de configuración de paquetes que soporta banderas de compilación/link para librerías. Facilita la inserción de las opciones correctos de compilador en línea de comando - http://pkgconfig.freedesktop.org/releases/pkg-config-0.29.1.tar.gz - - gnuconfig - glib2-devel - - system/devel/pkgconfig/pspec.xml - - - pkgconfig - - glib2 - - - /usr/bin - /usr/share/doc - /usr/share/man - /usr/share/aclocal - /usr/share/pkgconfig - /usr/lib/pkgconfig - - - - - 2017-01-26 - 0.29.1 - Rebuild. - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 0.29.1 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 0.29.1 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - m4 - http://www.gnu.org/software/m4/m4.html - - PisiLinux Community - admins@pisilinux.org - - GPLv3 - app:console - system.devel - GNU macro processor - GNU makro işleyicisi - L'utilitaire m4 est processeur de macro permettant de lire un ou plusieurs fichiers, les traiter en fonction leurs directives macro puis écrire le résultat dans la sortie standard. - The m4 utility is a macro processor that shall read one or more text files, process them according to their included macro statements, and write the results to standard output - m4, bir ya da daha fazla metin dosyasını okuyan; içerdikleri makro kurallarına göre bu dosyaları işleyen ve sonuçlarını standart çıktıya ileten bir makro işlemcisidir. - mirrors://gnu/m4/m4-1.4.17.tar.gz - - gettext-devel - libsigsegv - - system/devel/m4/pspec.xml - - - m4 - - libsigsegv - - - /usr/bin - /usr/share/doc - /usr/share/info - /usr/share/man - - - - - 2016-04-27 - 1.4.17 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-02-28 - 1.4.17 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - cython - http://www.cython.org - - Pisi Linux Admins - admins@pisilinux.org - - Apache-2.0 - app:console + GPLv2+ + LGPLv2+ library system.devel - C extensions for the Python - Python için C eklentileri - Cython is a language that makes writing C extensions for the Python language as easy as Python itself. - Cython, Python için C eklentileri yazmayı kolaylaştıran bir dildir. - https://pypi.python.org/packages/b7/67/7e2a817f9e9c773ee3995c1e15204f5d01c8da71882016cac10342ef031b/Cython-0.25.2.tar.gz + Multiple precision floating point library + La librairie MPFR est une librairie C pour les calculs à virgules flottantes à précisions multiples à arrondi exact (également appelé arrondi correct). Elle est basée sur la librairie à précision multiple GMP. + The MPFR library is a C library for multiple-precision floating-point computations with exact rounding (also called correct rounding). It is based on the GMP multiple-precision library. + MPFR es una librería en C para computaciones de punto flotante de múltiple precisión con redondeo exacto (también llamado redondeo correcto). Está basada en la librería de múltiple precisión GMP. + http://www.mpfr.org/mpfr-current/mpfr-3.1.5.tar.xz - python-devel + gmp-devel - system/devel/cython/pspec.xml + system/devel/mpfr/pspec.xml - cython + mpfr - python + gmp - /usr/bin /usr/lib - /usr/share/doc + /usr/share/info + /usr/share/doc/mpfr + + + + mpfr-devel + Development files for mpfr + mpfr için geliştirme dosyaları + + mpfr + + + /usr/include + /usr/share/doc/mpfr/examples + /usr/share/doc/mpfr/html + + 2017-01-04 + 3.1.5 + Rebuild with new toolchain. + Ertuğrul Erata + ertugrulerata@gmail.com + - 2017-01-21 - 0.25.2 + 2017-01-01 + 3.1.5 Version bump. Ertuğrul Erata ertugrulerata@gmail.com 2016-04-27 - 0.23.4 + 3.1.4 Release Bump PisiLinux Community admin@pisilinux.org 2016-03-13 - 0.23.4 + 3.1.4 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + gobject-introspection + http://live.gnome.org/GObjectIntrospection + + Pisi Linux Admins + admins@pisilinux.org + + LGPLv2+ + GPLv2+ + library + app:console + system.devel + Introspection system for GObject-based libraries + gobject-introspection can scan C header and source files in order to generate introspection typelib files. It also provides an API to examine typelib files, useful for creating language bindings among other things. + mirrors://gnome/gobject-introspection/1.46/gobject-introspection-1.46.0.tar.xz + + libffi-devel + python-devel + glib2-devel + chrpath + + system/devel/gobject-introspection/pspec.xml + + + gobject-introspection + + libffi + glib2 + + + /usr/lib/lib*.so* + /usr/lib/girepository-1.0/*.typelib + /usr/share/locale + /usr/share/doc + + + + gobject-introspection-devel + Development files for gobject-introspection + + gobject-introspection + libffi + glib2 + libffi-devel + glib2-devel + + + /usr/include + /usr/lib/gobject-introspection + /usr/bin/g-ir-* + /usr/lib/pkgconfig + /usr/share/gir-1.0 + /usr/share/aclocal + /usr/share/gobject-introspection-1.0 + /usr/share/man + + + + + 2016-04-27 + 1.46.0 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 1.46.0 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + make + http://www.gnu.org/software/make/make.html + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + system.devel + Standard tool to compile source trees + Geleneksel kaynak kod ağaçlarını derleme aracı + Herramienta estándar para compilación de arboles de fuentes + Outil standard de compilation de hiérarchie de sources. Make détermine ce qu'il faut faire pour construire votre programme à partir d'un fichier appelé makefile. Une fois votre programme écrit, il suffit d'éditer un makefile pour lui afin de pouvoir utiliser Make pour le compiler et l'installer. + Standard tool to compile source trees. Make gets its knowledge of how to build your program from a file called the makefile. When you write a program, you should write a makefile for it, so that it is possible to use Make to build and install the program + Geleneksel kaynak kod ağaçlarını derleme aracı. Make, programınızı nasıl derleyeceği konusundaki bilgiyi "makefile" dosyasından alır. Bir uygulama yazdığınızda bunun için "makefile" dosyasını da hazırlamalısınız ki uygulamanız derlenebilsin ve yüklenebilsin. + mirrors://gnu/make/make-4.2.1.tar.bz2 + + gettext + gnuconfig + patch + gc-devel + guile-devel + + system/devel/make/pspec.xml + + + make + + guile + + + /usr/bin + /usr/share/doc + /usr/share/man + /usr/share/info + /usr/share/locale + /usr/include + + + + + 2017-01-24 + 4.2.1 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 4.1 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-02-28 + 4.1 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + yasm + http://www.tortall.net/projects/yasm/ + + PisiLinux Community + admins@pisilinux.org + + BSD + GPLv2 + LGPLv2 + Artistic + app:console + system.devel + Assembler that supports many syntaxes and architectures + Bir çok sentaks ve mimari destekleyen Assembler + A complete rewrite of the NASM assembler under the "new" BSD License. Yasm currently supports the x86 and AMD64 instruction sets, accepts NASM and GAS assembler syntaxes, outputs binary, ELF32, ELF64, 32 and 64-bit Mach-O, RDOFF2, COFF, Win32, and Win64 object formats and generates source debugging information in STABS, DWARF 2, and CodeView? 8 formats. + NASM Assembler programının yeni BSD lisansı ile baştan yazılmış bir Assembler. En önemli özellikleri x86 ve AMD64 komutsetlerini, NASM ve GAS sentaksını desteklemesidir. İkilik, ELF32, ELF64, 32 ve 64-bit Mach-O, RDOFF2, COFF, Win32 ve Win64 obje formatlarında çıktı üretebilir, hata ayıklamak için STABS, DWARF 2 ve CodeView? 8 formatlarını desteklemektedir. + https://github.com/yasm/yasm/archive/v1.3.0.tar.gz + system/devel/yasm/pspec.xml + + + yasm + + /usr/bin + /usr/lib + /usr/share/doc + /usr/share/man + + + + yasm-devel + Development files for yasm + yasm için geliştirme dosyaları + + yasm + + + /usr/include + /usr/lib/libyasm.a + + + + + 2016-04-27 + 1.3.0 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-07 + 1.3.0 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + flex + http://flex.sourceforge.net/ + + PisiLinux Community + admins@pisilinux.org + + FLEX + app:console + system.devel + GNU lexical analyser generator + GNU sözcüksel analiz üreteci + Flex est un outil de génération d'analyseur (scanner). Un analyseur (également appelé tokenizer en anglais) est un programme qui repère les motifs lexicaux (ou lexème) dans du texte. + Flex is a tool for generating scanners. A scanner, sometimes called a tokenizer, is a program which recognizes lexical patterns in text + Flex, metin içindeki sözcüksel kalıpları tanıyan, analiz aracı üretecidir. + https://github.com/westes/flex/releases/download/v2.6.3/flex-2.6.3.tar.gz + + patch + texinfo + + system/devel/flex/pspec.xml + + + flex + + /usr/bin + /usr/lib + /usr/share/doc + /usr/share/man + /usr/share/info + /usr/include + /usr/share/locale + + + + + 2017-01-24 + 2.6.3 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-10-05 + 2.6.1 + Version bump. + Yusuf Aydemir + yusuf.aydemir@pisilnux.org + + + 2016-04-27 + 2.6.0 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 2.6.0 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + gc + http://www.hpl.hp.com/personal/Hans_Boehm/gc + + PisiLinux Community + admins@pisilinux.org + + BSD + GPLv2 + library + system.devel + A garbage collector for C and C++ + C ve C++ için bir çöp toplama kitaplığı + Ostrożny odśmiecacz dla C i C++ + The Boehm-Demers-Weiser conservative garbage collector can be used as a garbage collecting replacement for C malloc or C++ new. + gc, C malloc veya C++ new yerine kullanılabilecek, Boehm-Demers-Weiser çöp toplayıcısı kitaplığıdır. + Boehm's GC jest odśmiecającym alokatorem pamięci, który został zaprojektowany z zamiarem używania jako zastępcza wtyczka dla funkcji C malloc. + http://hboehm.info/gc/gc_source/gc-7.6.0.tar.gz + + libatomic_ops-devel + + system/devel/gc/pspec.xml + + + gc + + libgcc + + + /usr/lib + /usr/share/doc + + + + gc-devel + Development files for gc + gc için geliştirme dosyaları + Pliki nagłówkowe gc + + gc + + + /usr/include/ + /usr/lib/pkgconfig + + + + + 2017-01-23 + 7.6.0 + Version bump.. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 7.4.2 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 7.4.2 First release Alihan Öztürk alihan@pisilinux.org @@ -15361,443 +15107,953 @@ - mdadm - http://www.kernel.org/pub/linux/utils/raid/mdadm + libtool + http://www.gnu.org/software/libtool/libtool.html - PisiLinux Community - admins@pisilinux.org + Serdar Soytetir + kaptan@pisilinux.org GPLv2 - app:console - hardware.disk - Utility to control Linux MD devices (software RAID arrays) - MD aygıtlarını (Yazılımsal RAID) denetleme aracı - mdadm is used to create, manage, and monitor Linux MD (software RAID) devices. - mdadm Linux MD (yazılımsal RAID) aygıtları yaratmak, yönetmek ve izlemek için kullanılan bir araçtır. - https://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-3.4.tar.xz - hardware/disk/mdadm/pspec.xml + library + system.devel + A shared library tool for developers + Program geliştiriciler için ortak kütüphane aracı + Libtool est une librairie utilitaire partagée pour développeurs. + Libtool is a shared library tool for developers. + Libtool, program geliştiriciler için bir paylaşımlı kütüphane aracıdır. + mirrors://gnu/libtool/libtool-2.4.6.tar.xz + + gnuconfig + autoconf + automake + + system/devel/libtool/pspec.xml - mdadm - - /sbin/mdadm - /sbin/mdmon - /lib/udev/rules.d - /usr/lib/tmpfiles.d - /usr/share/man - /usr/share/doc - /etc - - - System.Service - - - mdadm.tmpfiles.conf - scripts/raid-check - mdadm.confd - mdadm.rules - - - - mdadm-static - Statik linklemiş Raid denetleme aracı - mdadm Linux MD (yazılımsal RAID) aygıtları yaratmak, yönetmek ve izlemek için kullanılan bir araçtır. + libtool-ltdl system.base - /sbin/mdadm.static - /sbin/mdassemble.static + /usr/lib - - - 2016-04-27 - 3.4 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 3.4 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - lvm2 - http://sources.redhat.com/lvm/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - hardware.disk - Userland logical volume management tools - Mantıksal Hacim Yönetimi aracı - LVM2 includes all of the support for handling read/write operations physical and logical volumes. - LVM fiziksel ve mantıksal hacimler üzerinde gerçekleştirilen bütün okuma/yazma işlemlerini destekleyen araçları içerir. - ftp://sources.redhat.com/pub/lvm2/LVM2.2.02.142.tgz - - libutil-linux-devel - eudev-devel - - hardware/disk/lvm2/pspec.xml - - device-mapper - Light-weight kernel component can support user-space tools for logical volume management - Mantıksal hacim yönetimi için gerekli hafif düzeydeki modülleri ve araçları içerir - Device-mapper includes the driver enables the definition of new block devices composed of ranges of sectors of existing devices to define disk partitions or logical volumes. - device-mapper mevcut aygıtlardan yeni blok aygıtları yada mantıksal hacimler yaratır. + libtool - eudev + gnuconfig - - /usr/sbin/dmsetup - /usr/sbin/dmstats - /usr/lib/libdevmapper.a - /usr/lib/libdevmapper.so* - /lib/udev/rules.d/10-dm.rules - /lib/udev/rules.d/13-dm-disk.rules - /lib/udev/rules.d/95-dm-notify.rules - /usr/share/doc/VERSION_DM - /usr/share/doc/WHATS_NEW_DM - /usr/share/man/man8/dmsetup.8 - /usr/share/man/man8/dmstats.8 - - - - device-mapper-devel - Development libraries and headers for device-mapper - device-mapper için geliştirme dosyaları - Device-mapper-devel contains files needed to develop applications that use the device-mapper libraries. - - device-mapper - eudev-devel - - - /usr/include/libdevmapper.h - /usr/lib/pkgconfig/devmapper.pc - - - - device-mapper-event - Device-mapper event daemon - Device mapper durum servisi - This package contains the dmeventd daemon for monitoring the state of device-mapper devices. - - device-mapper - - - /usr/sbin/dmeventd - /usr/lib/libdevmapper-event.a - /usr/lib/libdevmapper-event.so* - /usr/lib/libdevmapper-event-lvm2thin.so - /usr/lib/device-mapper/libdevmapper-event-lvm2thin.so - /usr/share/man/man8/dmeventd.8 - - - - device-mapper-event-devel - Development libraries and headers for the device-mapper event daemon - device-mapper-event için geliştirme dosyaları - This contains contains files needed to develop applications that use the device-mapper event library. - - device-mapper-event - - - /usr/include/libdevmapper-event.h - /usr/lib/pkgconfig/devmapper-event.pc - - - - lvm2 - Userland logical volume management tools - LVM2 includes all of the support for handling read/write operations on physical volumes,creating volume groups from one or more physical volumes and creating one or more logical volumes in volume groups. - - device-mapper - device-mapper-event - libutil-linux - eudev - - - /sbin/lvmconf - /usr/sbin/blkdeactivate - /usr/sbin/fsadm - /usr/sbin/lv* - /usr/sbin/vg* - /usr/sbin/pv* - /usr/lib/liblvm2app.so* - /usr/lib/liblvm2cmd.so* - /usr/lib/libdevmapper-event-lvm2.so* - /usr/lib/device-mapper/libdevmapper-event-lvm2mirror.so - /usr/lib/device-mapper/libdevmapper-event-lvm2snapshot.so - /usr/lib/libdevmapper-event-lvm2mirror.so - /usr/lib/libdevmapper-event-lvm2snapshot.so - /usr/lib/libdevmapper-event-lvm2raid.so - /usr/lib/device-mapper/libdevmapper-event-lvm2raid.so - /etc/lvm - /etc/lvm/archive - /etc/lvm/backup - /etc/lvm/cache - /var/lock/lvm - /lib/udev/rules.d/11-dm-lvm.rules - /usr/lib/tmpfiles.d/lvm2.conf - /usr/share/doc - /usr/share/man/man5/lvm.conf.5 - /usr/share/man/man7 - /usr/share/man/man8/fsadm.8 - /usr/share/man/man8/blkdeactivate.8 - /usr/share/man/man8/*pv* - /usr/share/man/man8/*lv* - /usr/share/man/man8/*vg* - - - System.Package - - - tmpfiles.conf - - - - lvm2-devel - Development libraries and headers - lvm2 için geliştirme dosyaları - This package contains files needed to develop applications that use the lvm2 libraries. - - libutil-linux-devel - lvm2 - device-mapper-devel - device-mapper-event-devel - - - /usr/include/lvm2cmd.h - /usr/include/lvm2app.h - /usr/lib/pkgconfig/lvm2app.pc - - - - dietlibc-libdevmapper - Static devmapper library built with dietlibc - Statik bağlanmış device-mapper kütüphanesi - device mapper contains ioctl library and utilities for use with logical volume management (LVM2) built with dietlibc - Dietlibc kütüphanesiyle statik derlenmiş device-mapper kütüphanesidir. - - /usr/lib/dietlibc/lib-i386/libdevmapper.a - - - - device-mapper-static - Staticaly linked Device-mapper library and utility - Static bağlanmış device-mapper kütüphanesi ve aracı - device mapper contains statically linked libraries and utility for initramfs. - İnitramfs içinde kullanılan mantıksal hacim yönetimi için gerekli statik bağlanmış araçlardır. - - /sbin/dmsetup.static - - - - lvm2-static - Staticaly linked Logical Volume Management utilities - Statik bağlanmış LVM araçları - Number of utilities for creating, checking, and repairing logical volumes - statically linked for initramfs. - İnitramfs içinde kullanılan statik bağlanmış mantıksal hacim yönetimi aracıdır. - - /sbin/lvm.static - /usr/lib/liblvm2app.a - /usr/lib/liblvm2cmd.a - - - - - 2016-04-27 - 2.02.142 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-13 - 2.02.142 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - disktype - http://disktype.sourceforge.net/ - - PisiLinux Community - admins@pisilinux.org - - BSD - app:console - hardware.disk - Detect the content format of a disk or disk image - Disk veya disk görüntüsünün biçimsel içeriğini saptar - The purpose of disktype is to detect the content format of a disk or disk image. It knows about common file systems, partition tables, and boot codes.The program is written in C and is designed to compile on any modern Unix flavour. - Disktype'ın amacı disk veya disk görüntüsünün içerik yapısını denetlemektir. Yaygın dosya sistemlerini, bölümleme tablolarını ve önyükleme kodlarını bilir. C dilinde yazılmış, herhangi bir modern Unix derleme tadında tasarlanmıştır. - mirrors://sourceforge/disktype/disktype-9.tar.gz - - klibc - colorgcc - - - disktype.patch - vfat.patch - ext4.patch - - hardware/disk/disktype/pspec.xml - - - disktype /usr/bin - /usr/share/doc - /usr/share/man - - - - - 2016-04-27 - 9 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2015-04-01 - 9 - First release - Marcin Bojara - marcin@pisilinux.org - - - - - - mtools - http://mtools.linux.lu/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - hardware.disk - Utilities to access MS-DOS disks without mounting them - MS-DOS (Windows) disketlerinize -mount ile bağlamadan- erişim araçları - Mtools are utilities to access MS-DOS disks without mounting them. - Mtools diskinizdeki MS-DOS (Windows) bölümlerine -mount komutu ile bağlamadan- erişebilmek için gereken araç setidir. - mirrors://gnu/mtools/mtools-4.0.18.tar.gz - hardware/disk/mtools/pspec.xml - - - mtools - - /usr/bin - /etc + /lib /usr/share/doc /usr/share/info /usr/share/man + /usr/include + /usr/share/libtool + /usr/share/aclocal - - - 2016-04-27 - 4.0.18 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2014-02-12 - 4.0.18 - First release - Richard de Bruin - richdb@pisilinux.org - - - - - - linux-firmware - http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/ - - PisiLinux Community - admins@pisilinux.org - - ipw2100-fw - ipw2200-fw - freedist - GPLv2+ - GPLv2 - MIT - data - hardware.firmware - Firmware files used by the Linux kernel - Linux çekirdeği tarafından kullanılan firmware dosyaları - linux-firmware contains different firmware files required for some devices to operate correctly. - linux-firmware, bazı aygıtların düzgün çalışabilmesi için gerekli firmware dosyalarını içerir. - http://sourceforge.net/projects/pisilinux/files/source/linux-firmware-20160624.tar.bz2 - http://source.pisilinux.org/erdinc/common-fw.tar.xz - http://source.pisilinux.org/erdinc/firmware-ipw.tar.xz - http://source.pisilinux.org/erdinc/firmware/firmware-nonfreebox-2-tar.bz2 - http://source.pisilinux.org/erdinc/firmware/ar9170.tar.bz2 - http://source.pisilinux.org/erdinc/firmware/ipw2x00-firmware.tar.bz2 - http://source.pisilinux.org/erdinc/firmware/aic94xx-seq.tar.bz2 - http://source.pisilinux.org/erdinc/firmware/accessrunner-firmware.tar.bz2 - http://source.pisilinux.org/erdinc/firmware/rtl8192se-firmware.tar.bz2 - http://sourceforge.net/projects/pisilinux/files/source/zd12x1.tar.bz2 - http://sourceforge.net/projects/pisilinux/files/source/nouveau-340-32.tar.xz - - iwlwifi-7260-14.ucode - iwlwifi-7260-15.ucode - iwlwifi-7260-17.ucode - - hardware/firmware/linux-firmware/pspec.xml - - linux-firmware - - noDelta - + libtool-ltdl-32bit + 32-bit shared libraries for libtool-ltdl + libtool için 32-bit paylaşımlı kitaplıklar + emul32 + emul32 + + libtool-ltdl + - /lib/firmware - /usr/share/doc + /usr/lib32 - 2016-06-29 - 20160624 + 2017-01-26 + 2.4.6 Release Bump PisiLinux Community admin@pisilinux.org 2016-04-27 - 20160111 + 2.4.6 Release Bump PisiLinux Community admin@pisilinux.org - 2016-01-22 - 20160111 + 2016-02-06 + 2.4.6 First release Ertuğrul Erata ertugrulerata@gmail.com + + + busybox-mkinitcpio + http://www.busybox.net + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + system.boot + Statically linked binary providing simplified versions of system commands + Statik bağlanmış sistem komutları bütünü + busybox is a single binary which includes versions of a large number of system commands, including a shell. + busybox, kabuk da dahil olmak üzere çeşitli sistem komutlarını içeren tek bir çalıştırılabilir dosyadır. + http://busybox.net/downloads/busybox-1.24.1.tar.bz2 + + config + + + fix-include.patch + + system/boot/busybox-mkinitcpio/pspec.xml + + + busybox-mkinitcpio + + /usr/lib/initcpio/busybox + + + + + 2016-04-27 + 1.24.1 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-04-23 + 1.24.1 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + os-prober + http://joey.kitenet.net/code/os-prober/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2+ + app:console + system.boot + Utility to detect other OSes on a set of drives + Narzędzie do wykrywania innych systemów operacyjnych na dyskach + os-probe detects other OSes available on a system and outputs the results in a generic machine-readable format. Support for new OSes and Linux distributions can be added easily. + os-prober wykrywa inne systemy operacyjne dostępne na komputerze i przekazuje rezultaty w standardowym, odczytywalnym maszynowo, formacie. + http://http.debian.net/debian/pool/main/o/os-prober/os-prober_1.71.tar.xz + system/boot/os-prober/pspec.xml + + + os-prober + + /usr/bin + /usr/lib + /var/lib/os-prober + /usr/share/os-prober + /usr/share/doc/os-prober + + + + + 2016-04-27 + 1.71 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 1.71 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + grub2 + http://www.gnu.org/software/grub/ + + Serdar Soytetir + kaptan@pisilinux.org + + GPLv3 + app:gui + system.boot + GNU GRUB is a Multiboot boot loader. + GNU GRUB (short for GNU GRand Unified Bootloader) is a boot loader package from the GNU Project. + ftp://alpha.gnu.org/gnu/grub/grub-2.02~beta2.tar.xz + http://source.pisilinux.org/1.0/grub2_extras_915resolution_r10.tar.xz + http://ftp.gnu.org/gnu/unifont/unifont-6.3.20131217/unifont-6.3.20131217.bdf.gz + https://sourceforge.net/projects/pisilinux/files/source/grub2-theme-pisilinux-0.4.tar.xz + + autogen + binutils + bison + flex + gcc + help2man + texinfo + freetype-devel + zlib-devel + ncurses-devel + xz-devel + fuse-devel + lvm2-devel + device-mapper-devel + gettext-devel + noto-fonts + + + mkconfig-fix.patch + pisi_name_and_initramfs.patch + + system/boot/grub2/pspec.xml + + + grub2 + + freetype + xz + fuse + lvm2 + device-mapper + mtools + os-prober + + + /usr/bin + /usr/sbin + /usr/lib/grub/i386-pc/ + /usr/lib/grub/x86_64-efi + /usr/share/doc + /usr/share/grub + /usr/share/info + /boot/grub2 + /usr/share/locale + /usr/share/man/man1 + /usr/share/man/man8 + /etc/bash_completion.d + /etc/grub.d + /etc/default + + + pisi-grub-bg.png + grub-defaults + 30_uefi-firmware + update-grub + + + + + 2016-08-21 + 2.02_beta2 + New theme + PisiLinux Community + admin@pisilinux.org + + + 2016-07-30 + 2.02_beta2 + Add windows 42_custom remove + PisiLinux Community + admin@pisilinux.org + + + 2016-07-12 + 2.02_beta2 + Add windows 42_custom + PisiLinux Community + admin@pisilinux.org + + + 2016-06-25 + 2.02_beta2 + Add efi + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 2.02_beta2 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-04-20 + 2.02_beta2 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + module-virtualbox + http://www.virtualbox.org + + Ertuğrul Erata + ertugrulerata@gmail.com + + GPLv2 + driver + kernel.drivers + Kernel modules for VirtualBox + VirtualBox için çekirdek modülleri + This package provides the kernel support for VirtualBox. + Bu paket VirtualBox için çekirdek desteği sunar. + https://sourceforge.net/projects/pisilinux/files/source/module-virtualbox-5.1.12.tar.xz + + kernel-module-headers + + kernel/drivers/module-virtualbox/pspec.xml + + + module-virtualbox + + noDelta + + + kernel + module-virtualbox-userspace + + + /lib/modules + + + + module-virtualbox-userspace + Userspace documentation, tools, udev and modprobe rules for the kernel driver virtualbox + virtualbox çekirdek sürücüsü için kullanıcı tarafı belgeler, araçlar, udev ve modprobe kuralları + + noDelta + + + /lib/udev/rules.d + + + 10-vboxdrv.rules + + + + + 2017-01-15 + 5.1.12 + Version bump + Kamil Atlı + suvari@pisilinux.org + + + 2016-12-13 + 5.1.10 + Version bump + Ergün Salman + poyraz76@pisilinux.org + + + 2016-12-10 + 5.1.6 + Rebuild for new kernel. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-11-02 + 5.1.6 + Rebuild for new kernel. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-09-26 + 5.1.6 + Version bump + Ergün Salman + poyraz76@pisilinux.org + + + 2016-08-24 + 5.1.4 + Rebuild for new kernel. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-08-17 + 5.1.4 + Version bump + Ergün Salman + poyraz76@pisilinux.org + + + 2016-08-06 + 5.1.2 + Rebuild for new kernel. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-07-22 + 5.1.2 + Version Bump + Ergün Salman + poyraz76@pisilinux.org + + + 2016-06-17 + 5.1.0 + Version Bump + Ergün Salman + poyraz76@pisilinux.org + + + 2016-06-17 + 5.1.0b + Version Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 5.0.12 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-07 + 5.0.12 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + module-virtualbox-guest + http://www.virtualbox.org + + Ertuğrul Erata + ertugrulerata@gmail.com + + GPLv2 + driver + kernel.drivers + Kernel modules for VirtualBox guest machines + VirtualBox misafir makineleri için çekirdek modülleri + This package provides the kernel modules needed for mouse integration and shared folder support between VirtualBox host and guest systems. + Bu paket VirtualBox sunucu makinesi ile misafir sistemler arası fare entegrasyonu ve paylaşımlı dizin desteği için gerekli çekirdek modüllerini içerir. + https://sourceforge.net/projects/pisilinux/files/source/module-virtualbox-guest-5.1.12.tar.xz + + kernel-module-headers + + kernel/drivers/module-virtualbox-guest/pspec.xml + + + module-virtualbox-guest + + noDelta + + + kernel + baselayout + module-virtualbox-guest-userspace + + + /lib/modules + + + + module-virtualbox-guest-userspace + Userspace documentation, tools, udev and modprobe rules for the kernel driver virtualbox-guest + virtualbox-guest çekirdek sürücüsü için kullanıcı tarafı belgeler, araçlar, udev ve modprobe kuralları + + noDelta + + + /etc/conf.d + /lib/udev/rules.d + /lib/udev/vbox-guest.sh + + + virtualbox-guest.conf + vbox-guest.sh + 48-vbox-guest.rules + + + + + 2017-01-15 + 5.1.12 + Version Bump + Kamil Atlı + suvari@pisilinux.org + + + 2016-12-13 + 5.1.10 + Version Bump + Ergün Salman + poyraz76@pisilinux.org + + + 2016-12-10 + 5.1.6 + Rebuild for new kernel. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-11-02 + 5.1.6 + Rebuild for new kernel. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-09-26 + 5.1.6 + Version Bump + Ergün Salman + poyraz76@pisilinux.org + + + 2016-08-24 + 5.1.4 + Rebuild for new kernel. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-08-17 + 5.1.4 + Version Bump + Ergün Salman + poyraz76@pisilinux.org + + + 2016-08-06 + 5.1.2 + Rebuild for new kernel. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-07-22 + 5.1.2 + Version Bump + Ergün Salman + poyraz76@pisilinux.org + + + 2016-06-17 + 5.1.0 + Version Bump + Ergün Salman + poyraz76@pisilinux.org + + + 2016-06-17 + 5.1.0b + Version Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 5.0.12 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-07 + 5.0.12 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + ndiswrapper + http://ndiswrapper.sourceforge.net/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + driver + kernel.drivers + A network driver wrapper + Bir sürücü ara yazılımı(wrapper) + Capa de abstracción de controladores + ndiswrapper permet d'utiliser les pilotes Windows pour les cartes réseau sans-fil sans pilote adéquat sous Linux. + module-ndiswrapper allows you to use Windows XP drivers for WLAN cards without proper Linux drivers. + ndiswrapper, Linux sürücüsü olmayan kablosuz kartların Windows sürücüleri kullanılarak çalıştırılmasını sağlayan bir yazılımdır. + ndiswrapper permite usar controladores de windows XP para tarjetas WLAN que no tienen controladores propios para Linux. + http://download.sourceforge.net/ndiswrapper/ndiswrapper-1.60.tar.gz + + kernel-module-headers + + + upstream.patch + + kernel/drivers/ndiswrapper/pspec.xml + + + ndiswrapper + + noDelta + + + kernel + + + /lib/modules + /usr/share/man + /etc/ndiswrapper + /usr/sbin + /sbin + /usr/share/doc + + + + + 2016-12-10 + 1.60 + Rebuild for new kernel. + PisiLinux Community + admin@pisilinux.org + + + 2016-11-02 + 1.60 + Rebuild for new kernel. + PisiLinux Community + admin@pisilinux.org + + + 2016-08-24 + 1.60 + Rebuild for new kernel. + PisiLinux Community + admin@pisilinux.org + + + 2016-08-06 + 1.60 + Release Bump, rebuild for new kernel. + PisiLinux Community + admin@pisilinux.org + + + 2016-06-28 + 1.59 + Release Bump, rebuild for new kernel. + PisiLinux Community + admin@pisilinux.org + + + 2016-03-07 + 1.59 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + module-broadcom-wl + http://www.broadcom.com/support/802.11/linux_sta.php + + PisiLinux Community + admin@pisilinux.org + + freedist + driver + kernel.drivers + Broadcom's IEEE 802.11a/b/g/n hybrid Linux device driver for use with Broadcom's BCM4311, BCM4312, BCM4321, and BCM4322 based hardware + Broadcom'un BCM4311, BCM4312, BCM4321 ve BCM4322 tabanlı kablosuz bağdaştırıcıları için IEEE 802.11a/b/g/n aygıt sürücüleri + This package contains Broadcom's IEEE 802.11a/b/g/n hybrid Linux device driver for use with Broadcom's BCM4311, BCM4312, BCM4321, and BCM4322 based hardware. You must read the LICENSE.txt file in the docs directory before using this software. + Bu paket Broadcom'un BCM4311, BCM4312, BCM4321 ve BCM4322 tabanlı kablosuz bağdaştırıcıları ile kullanımı için IEEE 802.11a/b/g/n aygıt sürücülerini içerir. Bu yazılımı kullanmadan önce belgeler dizinindeki LICENSE.txt dosyasında yer alan lisans sözleşmesini okumalısınız. + https://docs.broadcom.com/docs-and-downloads/docs/linux_sta/hybrid-v35-nodebug-pcoem-6_30_223_271.tar.gz + https://docs.broadcom.com/docs-and-downloads/docs/linux_sta/hybrid-v35_64-nodebug-pcoem-6_30_223_271.tar.gz + + kernel-module-headers + + + patch/license.patch + patch/wl_linux.c.patch + patch/linux47.patch + patch/linux48.patch + + kernel/drivers/module-broadcom-wl/pspec.xml + + + module-broadcom-wl + + noDelta + + + kernel + module-broadcom-wl-userspace + + + /lib/modules + + + + module-broadcom-wl-userspace + modprobe rules and documents for broadcom-wl kernel driver + broadcom-wl çekirdek sürücüsü için modprobe kuralları ve belgeler + + noDelta + + + /etc/modprobe.d + /usr/share/doc + + + conf/broadcom-wl + conf/broadcom-wl-alias.conf + conf/broadcom-wl-blacklist.conf + + + + + 2017-01-08 + 6.30.223.271 + Fix url and add patch. + PisiLinux Community + admin@pisilinux.org + + + 2016-12-10 + 6.30.223.271 + Rebuild for new kernel. + PisiLinux Community + admin@pisilinux.org + + + 2016-11-02 + 6.30.223.271 + Rebuild for new kernel. + PisiLinux Community + admin@pisilinux.org + + + 2016-08-24 + 6.30.223.271 + Rebuild for new kernel. + PisiLinux Community + admin@pisilinux.org + + + 2016-08-06 + 6.30.223.271 + Rebuild for new kernel. + PisiLinux Community + admin@pisilinux.org + + + 2016-05-23 + 6.30.223.248 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-07 + 6.30.223.248 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + module-bbswitch + https://github.com/Bumblebee-Project/bbswitch + + Serdar Soytetir + kaptan@pisilinux.org + + GPL + app:gui + kernel.drivers + Kernel module allowing to switch dedicated graphics card on Optimus laptops + Optimus grafik kartlı bir dizüstü bilgisayarda grafik kartını seçmeye yarayan çekirdek modülüdür. + kernel module allowing to switch dedicated graphics card on Optimus laptops + Eski ve yeni optimus teknolojisine sahip dizüstü bilgisyarlarda çalışabilmektedir. + https://github.com/Bumblebee-Project/bbswitch/archive/v0.8.tar.gz + + kernel-module-headers + + kernel/drivers/module-bbswitch/pspec.xml + + + module-bbswitch + + kernel + + + /lib/modules + /etc + /usr/share/doc + + + bbswitch.conf + kmod-bbswitch.conf + + + + + 2016-12-10 + 0.8 + Rebuild for new kernel. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-11-02 + 0.8 + Rebuild for new kernel. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-08-24 + 0.8 + Rebuild for new kernel. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-08-06 + 0.8 + Rebuild for new kernel. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-06-28 + 0.8 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-04-30 + 0.8 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-07 + 0.8 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + mkinitcpio + https://projects.archlinux.org/mkinitcpio.git/ + + Pisi Linux Admins + admin@pisilinux.org + + GPL + kernel.tools + Modular initramfs image creation utility + İnitramfs oluşturmak için araç + mkinitcpio is a generic, modular, cross-distribution initramfs generation tool. + Mkinitcpio çapraz platform initramfs oluşturmak için kullanılan bir araçtır. + https://github.com/bferturk/mkinitcpio/archive/19.1.tar.gz + + libkmod-devel + kmod + asciidoc + libxslt-devel + man-pages + man-db + + kernel/tools/mkinitcpio/pspec.xml + + + mkinitcpio + + xz + bzip2 + libarchive + kmod + libkmod + busybox-mkinitcpio + + + /usr/bin + /usr/lib + /usr/share + /usr/share/doc + /etc + + + mkinitramfs + + + mkinitramfs + + + System.PackageHandler + + + + + 2016-04-27 + 19.1 + Minor Bump.Add plymouth hooks + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 19 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-04-23 + 19 + First release + Stefan Gronewold (groni) + groni@pisilinux.org + + + cpupowertools @@ -16029,659 +16285,6 @@ - - - mkinitcpio - https://projects.archlinux.org/mkinitcpio.git/ - - Pisi Linux Admins - admin@pisilinux.org - - GPL - kernel.tools - Modular initramfs image creation utility - İnitramfs oluşturmak için araç - mkinitcpio is a generic, modular, cross-distribution initramfs generation tool. - Mkinitcpio çapraz platform initramfs oluşturmak için kullanılan bir araçtır. - https://github.com/bferturk/mkinitcpio/archive/19.1.tar.gz - - libkmod-devel - kmod - asciidoc - libxslt-devel - man-pages - man-db - - kernel/tools/mkinitcpio/pspec.xml - - - mkinitcpio - - xz - bzip2 - libarchive - kmod - libkmod - busybox-mkinitcpio - - - /usr/bin - /usr/lib - /usr/share - /usr/share/doc - /etc - - - mkinitramfs - - - mkinitramfs - - - System.PackageHandler - - - - - 2016-04-27 - 19.1 - Minor Bump.Add plymouth hooks - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 19 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-04-23 - 19 - First release - Stefan Gronewold (groni) - groni@pisilinux.org - - - - - - module-broadcom-wl - http://www.broadcom.com/support/802.11/linux_sta.php - - PisiLinux Community - admin@pisilinux.org - - freedist - driver - kernel.drivers - Broadcom's IEEE 802.11a/b/g/n hybrid Linux device driver for use with Broadcom's BCM4311, BCM4312, BCM4321, and BCM4322 based hardware - Broadcom'un BCM4311, BCM4312, BCM4321 ve BCM4322 tabanlı kablosuz bağdaştırıcıları için IEEE 802.11a/b/g/n aygıt sürücüleri - This package contains Broadcom's IEEE 802.11a/b/g/n hybrid Linux device driver for use with Broadcom's BCM4311, BCM4312, BCM4321, and BCM4322 based hardware. You must read the LICENSE.txt file in the docs directory before using this software. - Bu paket Broadcom'un BCM4311, BCM4312, BCM4321 ve BCM4322 tabanlı kablosuz bağdaştırıcıları ile kullanımı için IEEE 802.11a/b/g/n aygıt sürücülerini içerir. Bu yazılımı kullanmadan önce belgeler dizinindeki LICENSE.txt dosyasında yer alan lisans sözleşmesini okumalısınız. - https://docs.broadcom.com/docs-and-downloads/docs/linux_sta/hybrid-v35-nodebug-pcoem-6_30_223_271.tar.gz - https://docs.broadcom.com/docs-and-downloads/docs/linux_sta/hybrid-v35_64-nodebug-pcoem-6_30_223_271.tar.gz - - kernel-module-headers - - - patch/license.patch - patch/wl_linux.c.patch - patch/linux47.patch - patch/linux48.patch - - kernel/drivers/module-broadcom-wl/pspec.xml - - - module-broadcom-wl - - noDelta - - - kernel - module-broadcom-wl-userspace - - - /lib/modules - - - - module-broadcom-wl-userspace - modprobe rules and documents for broadcom-wl kernel driver - broadcom-wl çekirdek sürücüsü için modprobe kuralları ve belgeler - - noDelta - - - /etc/modprobe.d - /usr/share/doc - - - conf/broadcom-wl - conf/broadcom-wl-alias.conf - conf/broadcom-wl-blacklist.conf - - - - - 2017-01-08 - 6.30.223.271 - Fix url and add patch. - PisiLinux Community - admin@pisilinux.org - - - 2016-12-10 - 6.30.223.271 - Rebuild for new kernel. - PisiLinux Community - admin@pisilinux.org - - - 2016-11-02 - 6.30.223.271 - Rebuild for new kernel. - PisiLinux Community - admin@pisilinux.org - - - 2016-08-24 - 6.30.223.271 - Rebuild for new kernel. - PisiLinux Community - admin@pisilinux.org - - - 2016-08-06 - 6.30.223.271 - Rebuild for new kernel. - PisiLinux Community - admin@pisilinux.org - - - 2016-05-23 - 6.30.223.248 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-07 - 6.30.223.248 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - module-virtualbox - http://www.virtualbox.org - - Ertuğrul Erata - ertugrulerata@gmail.com - - GPLv2 - driver - kernel.drivers - Kernel modules for VirtualBox - VirtualBox için çekirdek modülleri - This package provides the kernel support for VirtualBox. - Bu paket VirtualBox için çekirdek desteği sunar. - https://sourceforge.net/projects/pisilinux/files/source/module-virtualbox-5.1.12.tar.xz - - kernel-module-headers - - kernel/drivers/module-virtualbox/pspec.xml - - - module-virtualbox - - noDelta - - - kernel - module-virtualbox-userspace - - - /lib/modules - - - - module-virtualbox-userspace - Userspace documentation, tools, udev and modprobe rules for the kernel driver virtualbox - virtualbox çekirdek sürücüsü için kullanıcı tarafı belgeler, araçlar, udev ve modprobe kuralları - - noDelta - - - /lib/udev/rules.d - - - 10-vboxdrv.rules - - - - - 2017-01-15 - 5.1.12 - Version bump - Kamil Atlı - suvari@pisilinux.org - - - 2016-12-13 - 5.1.10 - Version bump - Ergün Salman - poyraz76@pisilinux.org - - - 2016-12-10 - 5.1.6 - Rebuild for new kernel. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-11-02 - 5.1.6 - Rebuild for new kernel. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-09-26 - 5.1.6 - Version bump - Ergün Salman - poyraz76@pisilinux.org - - - 2016-08-24 - 5.1.4 - Rebuild for new kernel. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-08-17 - 5.1.4 - Version bump - Ergün Salman - poyraz76@pisilinux.org - - - 2016-08-06 - 5.1.2 - Rebuild for new kernel. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-07-22 - 5.1.2 - Version Bump - Ergün Salman - poyraz76@pisilinux.org - - - 2016-06-17 - 5.1.0 - Version Bump - Ergün Salman - poyraz76@pisilinux.org - - - 2016-06-17 - 5.1.0b - Version Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 5.0.12 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-07 - 5.0.12 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - module-bbswitch - https://github.com/Bumblebee-Project/bbswitch - - Serdar Soytetir - kaptan@pisilinux.org - - GPL - app:gui - kernel.drivers - Kernel module allowing to switch dedicated graphics card on Optimus laptops - Optimus grafik kartlı bir dizüstü bilgisayarda grafik kartını seçmeye yarayan çekirdek modülüdür. - kernel module allowing to switch dedicated graphics card on Optimus laptops - Eski ve yeni optimus teknolojisine sahip dizüstü bilgisyarlarda çalışabilmektedir. - https://github.com/Bumblebee-Project/bbswitch/archive/v0.8.tar.gz - - kernel-module-headers - - kernel/drivers/module-bbswitch/pspec.xml - - - module-bbswitch - - kernel - - - /lib/modules - /etc - /usr/share/doc - - - bbswitch.conf - kmod-bbswitch.conf - - - - - 2016-12-10 - 0.8 - Rebuild for new kernel. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-11-02 - 0.8 - Rebuild for new kernel. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-08-24 - 0.8 - Rebuild for new kernel. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-08-06 - 0.8 - Rebuild for new kernel. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-06-28 - 0.8 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-04-30 - 0.8 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-07 - 0.8 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - ndiswrapper - http://ndiswrapper.sourceforge.net/ - - PisiLinux Community - admins@pisilinux.org - - GPLv2 - app:console - driver - kernel.drivers - A network driver wrapper - Bir sürücü ara yazılımı(wrapper) - Capa de abstracción de controladores - ndiswrapper permet d'utiliser les pilotes Windows pour les cartes réseau sans-fil sans pilote adéquat sous Linux. - module-ndiswrapper allows you to use Windows XP drivers for WLAN cards without proper Linux drivers. - ndiswrapper, Linux sürücüsü olmayan kablosuz kartların Windows sürücüleri kullanılarak çalıştırılmasını sağlayan bir yazılımdır. - ndiswrapper permite usar controladores de windows XP para tarjetas WLAN que no tienen controladores propios para Linux. - http://download.sourceforge.net/ndiswrapper/ndiswrapper-1.60.tar.gz - - kernel-module-headers - - - upstream.patch - - kernel/drivers/ndiswrapper/pspec.xml - - - ndiswrapper - - noDelta - - - kernel - - - /lib/modules - /usr/share/man - /etc/ndiswrapper - /usr/sbin - /sbin - /usr/share/doc - - - - - 2016-12-10 - 1.60 - Rebuild for new kernel. - PisiLinux Community - admin@pisilinux.org - - - 2016-11-02 - 1.60 - Rebuild for new kernel. - PisiLinux Community - admin@pisilinux.org - - - 2016-08-24 - 1.60 - Rebuild for new kernel. - PisiLinux Community - admin@pisilinux.org - - - 2016-08-06 - 1.60 - Release Bump, rebuild for new kernel. - PisiLinux Community - admin@pisilinux.org - - - 2016-06-28 - 1.59 - Release Bump, rebuild for new kernel. - PisiLinux Community - admin@pisilinux.org - - - 2016-03-07 - 1.59 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - - - - module-virtualbox-guest - http://www.virtualbox.org - - Ertuğrul Erata - ertugrulerata@gmail.com - - GPLv2 - driver - kernel.drivers - Kernel modules for VirtualBox guest machines - VirtualBox misafir makineleri için çekirdek modülleri - This package provides the kernel modules needed for mouse integration and shared folder support between VirtualBox host and guest systems. - Bu paket VirtualBox sunucu makinesi ile misafir sistemler arası fare entegrasyonu ve paylaşımlı dizin desteği için gerekli çekirdek modüllerini içerir. - https://sourceforge.net/projects/pisilinux/files/source/module-virtualbox-guest-5.1.12.tar.xz - - kernel-module-headers - - kernel/drivers/module-virtualbox-guest/pspec.xml - - - module-virtualbox-guest - - noDelta - - - kernel - baselayout - module-virtualbox-guest-userspace - - - /lib/modules - - - - module-virtualbox-guest-userspace - Userspace documentation, tools, udev and modprobe rules for the kernel driver virtualbox-guest - virtualbox-guest çekirdek sürücüsü için kullanıcı tarafı belgeler, araçlar, udev ve modprobe kuralları - - noDelta - - - /etc/conf.d - /lib/udev/rules.d - /lib/udev/vbox-guest.sh - - - virtualbox-guest.conf - vbox-guest.sh - 48-vbox-guest.rules - - - - - 2017-01-15 - 5.1.12 - Version Bump - Kamil Atlı - suvari@pisilinux.org - - - 2016-12-13 - 5.1.10 - Version Bump - Ergün Salman - poyraz76@pisilinux.org - - - 2016-12-10 - 5.1.6 - Rebuild for new kernel. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-11-02 - 5.1.6 - Rebuild for new kernel. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-09-26 - 5.1.6 - Version Bump - Ergün Salman - poyraz76@pisilinux.org - - - 2016-08-24 - 5.1.4 - Rebuild for new kernel. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-08-17 - 5.1.4 - Version Bump - Ergün Salman - poyraz76@pisilinux.org - - - 2016-08-06 - 5.1.2 - Rebuild for new kernel. - Ertuğrul Erata - ertugrulerata@gmail.com - - - 2016-07-22 - 5.1.2 - Version Bump - Ergün Salman - poyraz76@pisilinux.org - - - 2016-06-17 - 5.1.0 - Version Bump - Ergün Salman - poyraz76@pisilinux.org - - - 2016-06-17 - 5.1.0b - Version Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-04-27 - 5.0.12 - Release Bump - PisiLinux Community - admin@pisilinux.org - - - 2016-03-07 - 5.0.12 - First release - Ertuğrul Erata - ertugrulerata@gmail.com - - - kernel @@ -16698,7 +16301,7 @@ Pisi Linux için Linux çekirdeği El kernel de Linux (el núcleo del sistema operativo Linux) de Pisi Linux kernel contains the Linux kernel, the core of any Linux operating system. The kernel handles the basic functions of the operating system: memory allocation, process allocation, device input and output, etc. - https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.8.tar.gz + https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.9.tar.gz configs/kernel-i686-config configs/kernel-x86_64-config @@ -16713,12 +16316,12 @@ xmlto - patches/linux/patch-4.8.13.xz - patches/mageia/Revert-ipmi-Start-the-timer-and-thread-on-internal-m.patch - patches/mageia/x86-pci-toshiba-equium-a60-assign-busses.patch - patches/mageia/x86-boot-video-80x25-if-break.patch - patches/mageia/x86-default_poweroff_up_machines.patch - patches/mageia/x86-increase-default-minimum-vmalloc-area-by-64MB-to-192MB.patch + patches/linux/patch-4.9.6.xz + patches/mageia/stable-fbdev-color-map-copying-bounds-checking.patch + patches/mageia/stable-tile-ptrace-preserve-previous-registers-for-short-regset-write.patch + patches/mageia/stable-drm-schedule-the-output_poll_work-with-1s-delay-if-we-have-delayed-event.patch + patches/mageia/stable-drm-fix-broken-vt-switch-with-video-1366x768-option.patch + patches/mageia/stable-drm-i915-ignore-bogus-plane-coordinates-on-skl-when-the-plane-is-not-visible.patch patches/mageia/Revert-cpufreq-pcc-Enable-autoload-of-pcc-cpufreq-fo.patch patches/mageia/Revert-x86-mm-mtrr-Remove-kernel-internal-MTRR-inter.patch patches/mageia/base-cacheinfo-silence-DT-warnings.patch @@ -16727,6 +16330,7 @@ patches/mageia/acpi-CLEVO-M360S-disable_acpi_irq.patch patches/mageia/acpi-processor-M720SR-limit-to-C2.patch patches/mageia/ACPI-video-Add-a-quirk-to-force-acpi-video-backlight.patch + patches/mageia/acpi-do-not-warn-if-_BQC-does-not-exist.patch patches/mageia/scsi-megaraid-new-sysfs-name.patch patches/mageia/ide-pci-sis5513-965.patch patches/mageia/mpt-vmware-fix.patch @@ -16734,14 +16338,19 @@ patches/mageia/block-floppy-disable-pnp-modalias.patch patches/mageia/ata-prefer-ata-drivers-over-ide-drivers-when-both-are-built.patch patches/mageia/block-Make-CFQ-default-to-IOPS-mode-on-SSDs.patch - patches/mageia/linux-BFQ-v8r4.patch - patches/mageia/nvmepatch1-V4.patch - patches/mageia/nvmepatch2-V4.patch - patches/mageia/nvmepatch3-V4.patch - patches/mageia/fs-aufs-4.8.patch - patches/mageia/fs-aufs-4.8-modular.patch + patches/mageia/char-tpm-tpm_crb-implement-tpm-crb-idle-state.patch + patches/mageia/char-tmp-tpm_crb-fix-Intel-PTT-hw-bug-during-idle-state.patch + patches/mageia/char-tpm-tpm_crb-open-code-the-crb_init-into-acpi_add.patch + patches/mageia/char-tmp-tpm_crb-implement-runtime-pm-for-tpm_crb.patch + patches/mageia/fs-aufs-4.9.patch + patches/mageia/fs-aufs-4.9-modular.patch + patches/mageia/fs-seq_file-reset-iterator-to-first-record-for-zero-off.patch patches/mageia/firewire-ieee1394-module-aliases.patch patches/mageia/char-agp-intel-new-Q57-id.patch + patches/mageia/gpu-drm-i915-skl-drop-workarounds-for-A0-and-B0-revisions.patch + patches/mageia/gpu-drm-i915-skl-drop-workarounds-for-D0-revision.patch + patches/mageia/gpu-drm-i915-skl-drop-workarounds-for-E0-revision.patch + patches/mageia/gpu-drm-i915-Remove-WaDisableLSQCROPERFforOCL-KBL-workaround.patch patches/mageia/input-i8042-quirks-for-Fujitsu-Lifebook-A544-and-Lif.patch patches/mageia/net-sis190-fix-list-usage.patch patches/mageia/net-netfilter-IFWLOG.patch @@ -16754,7 +16363,10 @@ patches/mageia/net-netfilter-psd.patch patches/mageia/net-netfilter-psd-mdv.patch patches/mageia/net-netfilter-psd-2.6.35-buildfix.patch - patches/mageia/net-wireless-rtlwifi-Fix-regression-caused-by-commit-d86e64768859.patch + patches/mageia/net-netfilter-psd-fix-redefines.patch + patches/mageia/net-wireless-rtlwifi-Use-dev_kfree_skb_irq-instead-of-kfree_skb.patch + patches/mageia/net-wireless-rtlwifi-Fix-kernel-oops-introduced-with-commit-e4965.patch + patches/mageia/net-wireless-brcmfmac-fix-incorrect-event-channel-deduction.patch patches/mageia/platform-x86-add-shuttle-wmi-driver.patch patches/mageia/platform-x86-shuttle-wmi-drop-devinit-exit.patch patches/mageia/platform-x86-shuttle-wmi-4.2-buildfix.patch @@ -16785,9 +16397,10 @@ patches/mageia/3rd-viahss-2.6.35-buildfix.patch patches/mageia/3rd-viahss-3.0-buildfix.patch patches/mageia/3rd-rtl8723bs.patch - patches/mageia/3rd-rtl8723bs-4.7-buildfix.patch - patches/mageia/3rd-rtl8723bs-4.8-buildfix.patch patches/mageia/tools-testing-selftest-Makefile-remove-powerpc-reference.patch + patches/mageia/tools-build-Make-fixdep-parsing-wait-for-last-target.patch + patches/mageia/tools-perf-tools-Force-fixdep-compilation-at-the-start-of-.patch + patches/mageia/tools-perf-tools-Move-perf-build-related-variables-under-n.patch kernel/kernel/pspec.xml @@ -16846,6 +16459,17 @@ + + security + 2017-01-27 + 4.9.6 + Version Bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + systemRestart + + security 2016-12-10 @@ -16936,6 +16560,560 @@ + + + freetype + http://www.freetype.org/ + + PisiLinux Community + admins@pisilinux.org + + FTL + GPLv2 + library + desktop.font + A high-quality and portable font engine + Yüksek kaliteli ve taşınabilir yazıtipi düzeneği + FreeType2 est un moteur logiciel de fontes conçu pour être petit, efficace, très flexible et portable tout en étant capable de produire une sortie de très haute qualité. Il peut être utilisé dans les librairies graphiques, les serveurs d'affichage, les outils de conversion, les outils de génération d'images textuelles, ainsi que beaucoup d'autres produits. + FreeType 2 is a software font engine that is designed to be small, efficient, highly customizable, and portable while capable of producing high-quality output. It can be used in graphics libraries, display servers, font conversion tools, text image generation tools, and many other products as well. + FreeType 2; küçük, verimli, özelleştirilebilir, taşınabilir ve yüksek kaliteli çıktı oluşturan bir yazıtipi düzeneğidir. Grafik kütüphaneleri, görüntü sunucuları ve yazıtipi değiştirme araçları gibi birçok üründe kullanılabilir. + mirrors://sourceforge/freetype/freetype-2.6.3.tar.bz2 + + zlib-devel + bzip2 + libpng-devel + + desktop/font/freetype/pspec.xml + + + freetype + + zlib + bzip2 + libpng + + + /usr/lib + /usr/share/doc + /usr/share/man + + + + freetype-devel + Development files for freetype + freetype için geliştirme dosyaları + + freetype + zlib-devel + libpng-devel + + + /usr/bin + /usr/include + /usr/lib/pkgconfig + /usr/lib32/pkgconfig + /usr/share/aclocal + + + + freetype-32bit + 32-bit shared libraries for freetype + freetype için 32-bit paylaşımlı kitaplıklar + emul32 + emul32 + + zlib-32bit + libpng-32bit + + + zlib-32bit + libpng-32bit + + + /usr/lib32 + + + + + 2016-04-27 + 2.6.3 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 2.6.3 + First release + Alihan Öztürk + alihan@pisilinux.org + + + + + + linux-firmware + http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/ + + PisiLinux Community + admins@pisilinux.org + + ipw2100-fw + ipw2200-fw + freedist + GPLv2+ + GPLv2 + MIT + data + hardware.firmware + Firmware files used by the Linux kernel + Linux çekirdeği tarafından kullanılan firmware dosyaları + linux-firmware contains different firmware files required for some devices to operate correctly. + linux-firmware, bazı aygıtların düzgün çalışabilmesi için gerekli firmware dosyalarını içerir. + http://sourceforge.net/projects/pisilinux/files/source/linux-firmware-20160624.tar.bz2 + http://source.pisilinux.org/erdinc/common-fw.tar.xz + http://source.pisilinux.org/erdinc/firmware-ipw.tar.xz + http://source.pisilinux.org/erdinc/firmware/firmware-nonfreebox-2-tar.bz2 + http://source.pisilinux.org/erdinc/firmware/ar9170.tar.bz2 + http://source.pisilinux.org/erdinc/firmware/ipw2x00-firmware.tar.bz2 + http://source.pisilinux.org/erdinc/firmware/aic94xx-seq.tar.bz2 + http://source.pisilinux.org/erdinc/firmware/accessrunner-firmware.tar.bz2 + http://source.pisilinux.org/erdinc/firmware/rtl8192se-firmware.tar.bz2 + http://sourceforge.net/projects/pisilinux/files/source/zd12x1.tar.bz2 + http://sourceforge.net/projects/pisilinux/files/source/nouveau-340-32.tar.xz + + iwlwifi-7260-14.ucode + iwlwifi-7260-15.ucode + iwlwifi-7260-17.ucode + + hardware/firmware/linux-firmware/pspec.xml + + + linux-firmware + + noDelta + + + /lib/firmware + /usr/share/doc + + + + + 2016-06-29 + 20160624 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 20160111 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-01-22 + 20160111 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + mtools + http://mtools.linux.lu/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + hardware.disk + Utilities to access MS-DOS disks without mounting them + MS-DOS (Windows) disketlerinize -mount ile bağlamadan- erişim araçları + Mtools are utilities to access MS-DOS disks without mounting them. + Mtools diskinizdeki MS-DOS (Windows) bölümlerine -mount komutu ile bağlamadan- erişebilmek için gereken araç setidir. + mirrors://gnu/mtools/mtools-4.0.18.tar.gz + hardware/disk/mtools/pspec.xml + + + mtools + + /usr/bin + /etc + /usr/share/doc + /usr/share/info + /usr/share/man + + + + + 2017-01-29 + 4.0.18 + Rebuild. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 4.0.18 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2014-02-12 + 4.0.18 + First release + Richard de Bruin + richdb@pisilinux.org + + + + + + mdadm + http://www.kernel.org/pub/linux/utils/raid/mdadm + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + hardware.disk + Utility to control Linux MD devices (software RAID arrays) + MD aygıtlarını (Yazılımsal RAID) denetleme aracı + mdadm is used to create, manage, and monitor Linux MD (software RAID) devices. + mdadm Linux MD (yazılımsal RAID) aygıtları yaratmak, yönetmek ve izlemek için kullanılan bir araçtır. + https://www.kernel.org/pub/linux/utils/raid/mdadm/mdadm-3.4.tar.xz + + dietlibc + + hardware/disk/mdadm/pspec.xml + + + mdadm + + /sbin/mdadm + /sbin/mdmon + /lib/udev/rules.d + /usr/lib/tmpfiles.d + /usr/share/man + /usr/share/doc + /etc + + + System.Service + + + mdadm.tmpfiles.conf + scripts/raid-check + mdadm.confd + mdadm.rules + + + + mdadm-static + Statik linklemiş Raid denetleme aracı + mdadm Linux MD (yazılımsal RAID) aygıtları yaratmak, yönetmek ve izlemek için kullanılan bir araçtır. + system.base + + /sbin/mdadm.static + /sbin/mdassemble.static + + + + + 2017-01-29 + 3.4 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-04-27 + 3.4 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 3.4 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + + + + disktype + http://disktype.sourceforge.net/ + + PisiLinux Community + admins@pisilinux.org + + BSD + app:console + hardware.disk + Detect the content format of a disk or disk image + Disk veya disk görüntüsünün biçimsel içeriğini saptar + The purpose of disktype is to detect the content format of a disk or disk image. It knows about common file systems, partition tables, and boot codes.The program is written in C and is designed to compile on any modern Unix flavour. + Disktype'ın amacı disk veya disk görüntüsünün içerik yapısını denetlemektir. Yaygın dosya sistemlerini, bölümleme tablolarını ve önyükleme kodlarını bilir. C dilinde yazılmış, herhangi bir modern Unix derleme tadında tasarlanmıştır. + mirrors://sourceforge/disktype/disktype-9.tar.gz + + klibc + colorgcc + + + disktype.patch + vfat.patch + ext4.patch + + hardware/disk/disktype/pspec.xml + + + disktype + + /usr/bin + /usr/share/doc + /usr/share/man + + + + + 2016-04-27 + 9 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2015-04-01 + 9 + First release + Marcin Bojara + marcin@pisilinux.org + + + + + + lvm2 + http://sources.redhat.com/lvm/ + + PisiLinux Community + admins@pisilinux.org + + GPLv2 + app:console + hardware.disk + Userland logical volume management tools + Mantıksal Hacim Yönetimi aracı + LVM2 includes all of the support for handling read/write operations physical and logical volumes. + LVM fiziksel ve mantıksal hacimler üzerinde gerçekleştirilen bütün okuma/yazma işlemlerini destekleyen araçları içerir. + ftp://sources.redhat.com/pub/lvm2/LVM2.2.02.167.tgz + + libutil-linux-devel + eudev-devel + autoconf-archive + + hardware/disk/lvm2/pspec.xml + + + device-mapper + Light-weight kernel component can support user-space tools for logical volume management + Mantıksal hacim yönetimi için gerekli hafif düzeydeki modülleri ve araçları içerir + Device-mapper includes the driver enables the definition of new block devices composed of ranges of sectors of existing devices to define disk partitions or logical volumes. + device-mapper mevcut aygıtlardan yeni blok aygıtları yada mantıksal hacimler yaratır. + + eudev + + + /usr/sbin/dmsetup + /usr/sbin/dmstats + /usr/lib/libdevmapper.a + /usr/lib/libdevmapper.so* + /lib/udev/rules.d/10-dm.rules + /lib/udev/rules.d/13-dm-disk.rules + /lib/udev/rules.d/95-dm-notify.rules + /usr/share/doc/VERSION_DM + /usr/share/doc/WHATS_NEW_DM + /usr/share/man/man8/dmsetup.8 + /usr/share/man/man8/dmstats.8 + + + + device-mapper-devel + Development libraries and headers for device-mapper + device-mapper için geliştirme dosyaları + Device-mapper-devel contains files needed to develop applications that use the device-mapper libraries. + + device-mapper + eudev-devel + + + /usr/include/libdevmapper.h + /usr/lib/pkgconfig/devmapper.pc + + + + device-mapper-event + Device-mapper event daemon + Device mapper durum servisi + This package contains the dmeventd daemon for monitoring the state of device-mapper devices. + + device-mapper + + + /usr/sbin/dmeventd + /usr/lib/libdevmapper-event.a + /usr/lib/libdevmapper-event.so* + /usr/lib/libdevmapper-event-lvm2thin.so + /usr/lib/device-mapper/libdevmapper-event-lvm2thin.so + /usr/share/man/man8/dmeventd.8 + + + + device-mapper-event-devel + Development libraries and headers for the device-mapper event daemon + device-mapper-event için geliştirme dosyaları + This contains contains files needed to develop applications that use the device-mapper event library. + + device-mapper-event + + + /usr/include/libdevmapper-event.h + /usr/lib/pkgconfig/devmapper-event.pc + + + + lvm2 + Userland logical volume management tools + LVM2 includes all of the support for handling read/write operations on physical volumes,creating volume groups from one or more physical volumes and creating one or more logical volumes in volume groups. + + device-mapper + device-mapper-event + libutil-linux + eudev + + + /sbin/lvmconf + /usr/sbin/blkdeactivate + /usr/sbin/fsadm + /usr/sbin/lv* + /usr/sbin/vg* + /usr/sbin/pv* + /usr/lib/liblvm2app.so* + /usr/lib/liblvm2cmd.so* + /usr/lib/libdevmapper-event-lvm2.so* + /usr/lib/device-mapper/libdevmapper-event-lvm2mirror.so + /usr/lib/device-mapper/libdevmapper-event-lvm2snapshot.so + /usr/lib/libdevmapper-event-lvm2mirror.so + /usr/lib/libdevmapper-event-lvm2snapshot.so + /usr/lib/libdevmapper-event-lvm2raid.so + /usr/lib/device-mapper/libdevmapper-event-lvm2raid.so + /etc/lvm + /etc/lvm/archive + /etc/lvm/backup + /etc/lvm/cache + /var/lock/lvm + /lib/udev/rules.d/11-dm-lvm.rules + /usr/lib/tmpfiles.d/lvm2.conf + /usr/share/doc + /usr/share/man/man5/lvm.conf.5 + /usr/share/man/man7 + /usr/share/man/man8/fsadm.8 + /usr/share/man/man8/blkdeactivate.8 + /usr/share/man/man8/*pv* + /usr/share/man/man8/*lv* + /usr/share/man/man8/*vg* + + + System.Package + + + tmpfiles.conf + + + + lvm2-devel + Development libraries and headers + lvm2 için geliştirme dosyaları + This package contains files needed to develop applications that use the lvm2 libraries. + + libutil-linux-devel + lvm2 + device-mapper-devel + device-mapper-event-devel + + + /usr/include/lvm2cmd.h + /usr/include/lvm2app.h + /usr/lib/pkgconfig/lvm2app.pc + + + + dietlibc-libdevmapper + Static devmapper library built with dietlibc + Statik bağlanmış device-mapper kütüphanesi + device mapper contains ioctl library and utilities for use with logical volume management (LVM2) built with dietlibc + Dietlibc kütüphanesiyle statik derlenmiş device-mapper kütüphanesidir. + + /usr/lib/dietlibc/lib-i386/libdevmapper.a + + + + device-mapper-static + Staticaly linked Device-mapper library and utility + Static bağlanmış device-mapper kütüphanesi ve aracı + device mapper contains statically linked libraries and utility for initramfs. + İnitramfs içinde kullanılan mantıksal hacim yönetimi için gerekli statik bağlanmış araçlardır. + + /sbin/dmsetup.static + + + + lvm2-static + Staticaly linked Logical Volume Management utilities + Statik bağlanmış LVM araçları + Number of utilities for creating, checking, and repairing logical volumes - statically linked for initramfs. + İnitramfs içinde kullanılan statik bağlanmış mantıksal hacim yönetimi aracıdır. + + /sbin/lvm.static + /usr/lib/liblvm2app.a + /usr/lib/liblvm2cmd.a + + + + + 2017-01-29 + 2.02.167 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + + + 2016-04-27 + 2.02.142 + Release Bump + PisiLinux Community + admin@pisilinux.org + + + 2016-03-13 + 2.02.142 + First release + Ertuğrul Erata + ertugrulerata@gmail.com + + + system FIXME diff --git a/pisi-index.xml.sha1sum b/pisi-index.xml.sha1sum index 3fa8ed9b..d5be8746 100644 --- a/pisi-index.xml.sha1sum +++ b/pisi-index.xml.sha1sum @@ -1 +1 @@ -3fdf69a4da88ebe64b94f8f3d7f053efd5020e60 \ No newline at end of file +ae415efc1d21b843ef6f5cd02493b4cc063938b3 \ No newline at end of file diff --git a/pisi-index.xml.xz b/pisi-index.xml.xz index f5d45503..1f954aff 100644 Binary files a/pisi-index.xml.xz and b/pisi-index.xml.xz differ diff --git a/pisi-index.xml.xz.sha1sum b/pisi-index.xml.xz.sha1sum index d6960a60..6e50e311 100644 --- a/pisi-index.xml.xz.sha1sum +++ b/pisi-index.xml.xz.sha1sum @@ -1 +1 @@ -e643f96538f903259a0eb67dba5db7d07354a080 \ No newline at end of file +4532ef03864e2f30a2801067564ee70af78d4497 \ No newline at end of file diff --git a/system/base/bash/files/fedora/bash-2.05a-interpreter.patch b/system/base/bash/files/fedora/bash-2.05a-interpreter.patch index b9f0da2f..ca497c4a 100644 --- a/system/base/bash/files/fedora/bash-2.05a-interpreter.patch +++ b/system/base/bash/files/fedora/bash-2.05a-interpreter.patch @@ -1,9 +1,10 @@ -diff -up bash-4.2-rc2/config.h.in.interpreter bash-4.2-rc2/config.h.in ---- bash-4.2-rc2/config.h.in.interpreter 2011-02-09 07:59:21.000000000 +0100 -+++ bash-4.2-rc2/config.h.in 2011-02-09 07:59:21.000000000 +0100 -@@ -706,6 +706,9 @@ - /* Define if you have the pathconf function. */ - #undef HAVE_PATHCONF +diff --git a/config.h.in b/config.h.in +index a5ad9e7..62a6b32 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -748,6 +748,9 @@ + /* Define if you have the pselect function. */ + #undef HAVE_PSELECT +/* Define if you have the pread function. */ +#undef HAVE_PREAD @@ -11,7 +12,7 @@ diff -up bash-4.2-rc2/config.h.in.interpreter bash-4.2-rc2/config.h.in /* Define if you have the putenv function. */ #undef HAVE_PUTENV -@@ -898,6 +901,9 @@ +@@ -946,6 +949,9 @@ /* Define if you have the header file. */ #undef HAVE_DLFCN_H @@ -21,30 +22,32 @@ diff -up bash-4.2-rc2/config.h.in.interpreter bash-4.2-rc2/config.h.in /* Define if you have the header file. */ #undef HAVE_GRP_H -diff -up bash-4.2-rc2/configure.in.interpreter bash-4.2-rc2/configure.in ---- bash-4.2-rc2/configure.in.interpreter 2011-01-16 21:31:12.000000000 +0100 -+++ bash-4.2-rc2/configure.ac 2011-02-09 08:02:27.000000000 +0100 -@@ -659,7 +659,7 @@ BASH_HEADER_INTTYPES +diff --git a/configure.ac b/configure.ac +index ce4e9b6..eda95d6 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -700,7 +700,7 @@ BASH_HEADER_INTTYPES AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h varargs.h limits.h string.h \ memory.h locale.h termcap.h termio.h termios.h dlfcn.h \ stdbool.h stddef.h stdint.h netdb.h pwd.h grp.h strings.h \ - regex.h syslog.h ulimit.h) + regex.h syslog.h ulimit.h elf.h) - AC_CHECK_HEADERS(sys/pte.h sys/stream.h sys/select.h sys/file.h \ - sys/resource.h sys/param.h sys/socket.h sys/stat.h \ + AC_CHECK_HEADERS(sys/pte.h sys/stream.h sys/select.h sys/file.h sys/ioctl.h \ + sys/param.h sys/socket.h sys/stat.h \ sys/time.h sys/times.h sys/types.h sys/wait.h) -@@ -723,7 +723,7 @@ dnl checks for system calls +@@ -771,7 +771,7 @@ dnl checks for system calls AC_CHECK_FUNCS(dup2 eaccess fcntl getdtablesize getgroups gethostname \ getpagesize getpeername getrlimit getrusage gettimeofday \ - kill killpg lstat readlink sbrk select setdtablesize \ + kill killpg lstat pselect readlink sbrk select setdtablesize \ - setitimer tcgetpgrp uname ulimit waitpid) + setitimer tcgetpgrp uname ulimit waitpid pread) AC_REPLACE_FUNCS(rename) dnl checks for c library functions -diff -up bash-4.2-rc2/execute_cmd.c.interpreter bash-4.2-rc2/execute_cmd.c ---- bash-4.2-rc2/execute_cmd.c.interpreter 2011-01-20 04:24:47.000000000 +0100 -+++ bash-4.2-rc2/execute_cmd.c 2011-02-09 07:59:21.000000000 +0100 +diff --git a/execute_cmd.c b/execute_cmd.c +index 2a3df6d..b5cd405 100644 +--- a/execute_cmd.c ++++ b/execute_cmd.c @@ -41,6 +41,10 @@ # include #endif @@ -56,31 +59,30 @@ diff -up bash-4.2-rc2/execute_cmd.c.interpreter bash-4.2-rc2/execute_cmd.c #include "posixtime.h" #if defined (HAVE_SYS_RESOURCE_H) && !defined (RLIMTYPE) -@@ -4975,14 +4979,22 @@ shell_execve (command, args, env) +@@ -5486,6 +5490,14 @@ shell_execve (command, args, env) { /* The file has the execute bits set, but the kernel refuses to run it for some reason. See why. */ +#if defined (HAVE_HASH_BANG_EXEC) || defined (HAVE_ELF_H) -+ int fd = open (command, O_RDONLY); ++ int fd = open (command, O_RDONLY); + -+ if (fd >= 0) -+ sample_len = read (fd, sample, sizeof (sample)); -+ else -+ sample_len = -1; ++ if (fd >= 0) ++ sample_len = read (fd, sample, sizeof (sample)); ++ else ++ sample_len = -1; +#endif #if defined (HAVE_HASH_BANG_EXEC) -- READ_SAMPLE_BUF (command, sample, sample_len); - sample[sample_len - 1] = '\0'; - if (sample_len > 2 && sample[0] == '#' && sample[1] == '!') - { + READ_SAMPLE_BUF (command, sample, sample_len); + if (sample_len > 0) +@@ -5495,6 +5507,7 @@ shell_execve (command, args, env) char *interp; int ilen; -+ close (fd); ++ close (fd); interp = getinterp (sample, sample_len, (int *)NULL); ilen = strlen (interp); errno = i; -@@ -4997,6 +5009,136 @@ shell_execve (command, args, env) +@@ -5510,6 +5523,136 @@ shell_execve (command, args, env) return (EX_NOEXEC); } #endif @@ -217,3 +219,6 @@ diff -up bash-4.2-rc2/execute_cmd.c.interpreter bash-4.2-rc2/execute_cmd.c errno = i; file_error (command); } +-- +2.9.3 + diff --git a/system/base/bash/files/fedora/bash-4.2-rc2-logout.patch b/system/base/bash/files/fedora/bash-4.2-rc2-logout.patch index 5aff01af..f63c8b63 100644 --- a/system/base/bash/files/fedora/bash-4.2-rc2-logout.patch +++ b/system/base/bash/files/fedora/bash-4.2-rc2-logout.patch @@ -1,7 +1,8 @@ -diff -up bash-3.2/config-top.h.logout bash-3.2/config-top.h ---- bash-3.2/config-top.h.logout 2011-04-14 08:55:55.000000000 +0200 -+++ bash-3.2/config-top.h 2011-04-14 08:55:55.000000000 +0200 -@@ -78,7 +78,7 @@ +diff --git a/config-top.h b/config-top.h +index 026d4a4..cb0e002 100644 +--- a/config-top.h ++++ b/config-top.h +@@ -92,7 +92,7 @@ /* #define SYS_BASHRC "/etc/bash.bashrc" */ /* System-wide .bash_logout for login shells. */ @@ -10,12 +11,13 @@ diff -up bash-3.2/config-top.h.logout bash-3.2/config-top.h /* Define this to make non-interactive shells begun with argv[0][0] == '-' run the startup files when not in posix mode. */ -diff -up bash-3.2/doc/bash.1.logout bash-3.2/doc/bash.1 ---- bash-3.2/doc/bash.1.logout 2011-04-14 09:16:32.000000000 +0200 -+++ bash-3.2/doc/bash.1 2011-04-14 11:59:33.000000000 +0200 -@@ -326,8 +326,8 @@ option may be used when the shell is sta - .PP - When a login shell exits, +diff --git a/doc/bash.1 b/doc/bash.1 +index 04ce845..bfde55e 100644 +--- a/doc/bash.1 ++++ b/doc/bash.1 +@@ -335,8 +335,8 @@ option may be used when the shell is started to inhibit this behavior. + When an interactive login shell exits, + or a non-interactive login shell executes the \fBexit\fP builtin command, .B bash -reads and executes commands from the file \fI~/.bash_logout\fP, if it -exists. @@ -24,7 +26,7 @@ diff -up bash-3.2/doc/bash.1.logout bash-3.2/doc/bash.1 .PP When an interactive shell that is not a login shell is started, .B bash -@@ -8814,6 +8814,9 @@ The \fBbash\fP executable +@@ -10558,6 +10558,9 @@ The \fBbash\fP executable .FN /etc/profile The systemwide initialization file, executed for login shells .TP @@ -34,3 +36,6 @@ diff -up bash-3.2/doc/bash.1.logout bash-3.2/doc/bash.1 .FN ~/.bash_profile The personal initialization file, executed for login shells .TP +-- +2.9.3 + diff --git a/system/base/bash/pspec.xml b/system/base/bash/pspec.xml index 3b712af5..00e5cefa 100644 --- a/system/base/bash/pspec.xml +++ b/system/base/bash/pspec.xml @@ -12,30 +12,23 @@ app:console The standard GNU Bourne again shell Bash is the GNU Project's Bourne Again SHell, a complete implementation of the IEEE POSIX and Open Group shell specification with interactive command line editing, csh-like features such as history substitution. - mirrors://gnu/bash/bash-4.3.30.tar.gz + mirrors://gnu/bash/bash-4.4.tar.gz ncurses-devel - - official/bash43-031.tar.gz - official/bash43-032.tar.gz - official/bash43-033.tar.gz - official/bash43-034.tar.gz - official/bash43-035.tar.gz - official/bash43-036.tar.gz - official/bash43-037.tar.gz - official/bash43-038.tar.gz - official/bash43-039.tar.gz - official/bash43-040.tar.gz - official/bash43-041.tar.gz - official/bash43-042.tar.gz - official/bash43-043.tar.gz - official/bash43-044.tar.gz - official/bash43-045.tar.gz - official/bash43-046.tar.gz - official/bash43-047.tar.gz - official/bash43-048.tar.gz + + official/bash-4.4-patch-1.patch + official/bash-4.4-patch-2.patch + official/bash-4.4-patch-3.patch + official/bash-4.4-patch-4.patch + official/bash-4.4-patch-5.patch + official/bash-4.4-patch-6.patch + official/bash-4.4-patch-7.patch + official/bash-4.4-patch-8.patch + official/bash-4.4-patch-9.patch + official/bash-4.4-patch-10.patch + official/bash-4.4-patch-11.patch fedora/bash-2.02-security.patch @@ -45,24 +38,26 @@ fedora/bash-2.05b-debuginfo.patch fedora/bash-2.05b-manso.patch fedora/bash-2.05b-pgrp_sync.patch - fedora/bash-2.05b-readline-oom.patch fedora/bash-2.05b-xcc.patch fedora/bash-3.2-audit.patch fedora/bash-3.2-ssh_source_bash.patch - fedora/bash-4.0-nobits.patch - fedora/bash-4.1-broken_pipe.patch - fedora/bash-4.1-defer-sigchld-trap.patch - fedora/bash-4.1-examples.patch - fedora/bash-4.2-coverity.patch - fedora/bash-4.2-manpage_trap.patch - fedora/bash-4.2-rc2-logout.patch - fedora/bash-4.2-size_type.patch - fedora/bash-bashbug.patch + fedora/bash-setlocale.patch - fedora/bash-tty-tests.patch - + fedora/bash-tty-tests.patch + fedora/bash-4.0-nobits.patch + fedora/bash-4.1-examples.patch + fedora/bash-4.1-broken_pipe.patch + fedora/bash-4.2-rc2-logout.patch + fedora/bash-4.2-coverity.patch + fedora/bash-4.1-defer-sigchld-trap.patch + fedora/bash-4.2-manpage_trap.patch + fedora/bash-4.2-size_type.patch + fedora/bash-4.3-man-ulimit.patch + fedora/bash-4.3-noecho.patch + fedora/bash-4.3-memleak-lc_all.patch + fedora/bash-4.4-no-loadable-builtins.patch @@ -87,6 +82,13 @@ + + 2017-01-29 + 4.4.11 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + 2017-01-06 4.3_p48 diff --git a/system/base/bc/pspec.xml b/system/base/bc/pspec.xml index e3514491..3a8b8810 100644 --- a/system/base/bc/pspec.xml +++ b/system/base/bc/pspec.xml @@ -22,6 +22,8 @@ fedora/bc-1.06.95-memleak.patch fedora/bc-1.06-dc_ibase.patch fedora/bc-1.06.95-matlib.patch + fedora/bc-1.06.95-sigintmasking.patch + fedora/bc-1.06.95-doc.patch @@ -39,6 +41,13 @@ + + 2017-01-27 + 1.06.95 + Release Bump + PisiLinux Community + admin@pisilinux.org + 2016-04-27 1.06.95 diff --git a/system/base/biosdevname/pspec.xml b/system/base/biosdevname/pspec.xml index 76519fe0..6688fcb4 100644 --- a/system/base/biosdevname/pspec.xml +++ b/system/base/biosdevname/pspec.xml @@ -13,9 +13,9 @@ app:gui Biosdevname is a udev helper utility developed Biosdevname is a udev helper utility developed by Dell and released under the GNU General Public License (GPL). It provides a consistent naming mechanism for network devices based on their physical location as suggested by the system BIOS. - http://linux.dell.com/biosdevname/biosdevname-0.7.1/biosdevname-0.7.1.tar.gz + http://linux.dell.com/biosdevname/biosdevname-0.7.2/biosdevname-0.7.2.tar.gz - pciutils-devel + pciutils-devel glibc-devel zlib-devel @@ -36,6 +36,13 @@ + + 2017-01-29 + 0.7.2 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + 2016-04-27 0.7.1 diff --git a/system/base/busybox/files/config b/system/base/busybox/files/config index 97f598fc..d4bf3bb5 100644 --- a/system/base/busybox/files/config +++ b/system/base/busybox/files/config @@ -1,57 +1,39 @@ # # Automatically generated make config: don't edit -# Busybox version: 1.24.1 -# Fri Jan 29 23:10:26 2016 +# Busybox version: 1.26.1 +# Thu Jan 5 16:44:31 2017 # CONFIG_HAVE_DOT_CONFIG=y # # Busybox Settings # - -# -# General Configuration -# -CONFIG_DESKTOP=y +# CONFIG_DESKTOP is not set # CONFIG_EXTRA_COMPAT is not set -# CONFIG_INCLUDE_SUSv2 is not set +CONFIG_INCLUDE_SUSv2=y # CONFIG_USE_PORTABLE_CODE is not set CONFIG_PLATFORM_LINUX=y -# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set -CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y -# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set CONFIG_SHOW_USAGE=y -# CONFIG_FEATURE_VERBOSE_USAGE is not set +CONFIG_FEATURE_VERBOSE_USAGE=y CONFIG_FEATURE_COMPRESS_USAGE=y -# CONFIG_FEATURE_INSTALLER is not set +CONFIG_BUSYBOX=y +CONFIG_FEATURE_INSTALLER=y # CONFIG_INSTALL_NO_USR is not set -# CONFIG_LOCALE_SUPPORT is not set -CONFIG_UNICODE_SUPPORT=y -# CONFIG_UNICODE_USING_LOCALE is not set -# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set -CONFIG_SUBST_WCHAR=63 -CONFIG_LAST_SUPPORTED_WCHAR=767 -# CONFIG_UNICODE_COMBINING_WCHARS is not set -# CONFIG_UNICODE_WIDE_WCHARS is not set -# CONFIG_UNICODE_BIDI_SUPPORT is not set -# CONFIG_UNICODE_NEUTRAL_TABLE is not set -# CONFIG_UNICODE_PRESERVE_BROKEN is not set # CONFIG_PAM is not set -CONFIG_FEATURE_USE_SENDFILE=y CONFIG_LONG_OPTS=y -# CONFIG_FEATURE_DEVPTS is not set +CONFIG_FEATURE_DEVPTS=y # CONFIG_FEATURE_CLEAN_UP is not set # CONFIG_FEATURE_UTMP is not set # CONFIG_FEATURE_WTMP is not set -# CONFIG_FEATURE_PIDFILE is not set -CONFIG_PID_FILE_PATH="" +CONFIG_FEATURE_PIDFILE=y +CONFIG_PID_FILE_PATH="/run" CONFIG_FEATURE_SUID=y -# CONFIG_FEATURE_SUID_CONFIG is not set -# CONFIG_FEATURE_SUID_CONFIG_QUIET is not set +CONFIG_FEATURE_SUID_CONFIG=y +CONFIG_FEATURE_SUID_CONFIG_QUIET=y # CONFIG_SELINUX is not set -# CONFIG_FEATURE_PREFER_APPLETS is not set +CONFIG_FEATURE_PREFER_APPLETS=y CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe" -# CONFIG_FEATURE_SYSLOG is not set +CONFIG_FEATURE_SYSLOG=y # CONFIG_FEATURE_HAVE_RPC is not set # @@ -70,17 +52,6 @@ CONFIG_EXTRA_CFLAGS="" CONFIG_EXTRA_LDFLAGS="" CONFIG_EXTRA_LDLIBS="" -# -# Debugging Options -# -# CONFIG_DEBUG is not set -# CONFIG_DEBUG_PESSIMIZE is not set -# CONFIG_UNIT_TEST is not set -# CONFIG_WERROR is not set -CONFIG_NO_DEBUG_LIB=y -# CONFIG_DMALLOC is not set -# CONFIG_EFENCE is not set - # # Installation Options ("make install" behavior) # @@ -93,33 +64,60 @@ CONFIG_INSTALL_APPLET_SYMLINKS=y # CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set CONFIG_PREFIX="./_install" +# +# Debugging Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_PESSIMIZE is not set +# CONFIG_DEBUG_SANITIZE is not set +# CONFIG_UNIT_TEST is not set +# CONFIG_WERROR is not set +CONFIG_NO_DEBUG_LIB=y +# CONFIG_DMALLOC is not set +# CONFIG_EFENCE is not set + # # Busybox Library Tuning # -CONFIG_FEATURE_SYSTEMD=y +# CONFIG_FEATURE_USE_BSS_TAIL is not set CONFIG_FEATURE_RTMINMAX=y +CONFIG_FEATURE_BUFFERS_USE_MALLOC=y +# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set +# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set CONFIG_PASSWORD_MINLEN=6 CONFIG_MD5_SMALL=1 CONFIG_SHA3_SMALL=1 -# CONFIG_FEATURE_FAST_TOP is not set +CONFIG_FEATURE_FAST_TOP=y # CONFIG_FEATURE_ETC_NETWORKS is not set CONFIG_FEATURE_USE_TERMIOS=y CONFIG_FEATURE_EDITING=y CONFIG_FEATURE_EDITING_MAX_LEN=1024 # CONFIG_FEATURE_EDITING_VI is not set CONFIG_FEATURE_EDITING_HISTORY=15 -# CONFIG_FEATURE_EDITING_SAVEHISTORY is not set -# CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is not set -# CONFIG_FEATURE_REVERSE_SEARCH is not set +CONFIG_FEATURE_EDITING_SAVEHISTORY=y +CONFIG_FEATURE_EDITING_SAVE_ON_EXIT=y +CONFIG_FEATURE_REVERSE_SEARCH=y CONFIG_FEATURE_TAB_COMPLETION=y -# CONFIG_FEATURE_USERNAME_COMPLETION is not set +CONFIG_FEATURE_USERNAME_COMPLETION=y CONFIG_FEATURE_EDITING_FANCY_PROMPT=y # CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set +CONFIG_LOCALE_SUPPORT=y +CONFIG_UNICODE_SUPPORT=y +CONFIG_UNICODE_USING_LOCALE=y +# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set +CONFIG_SUBST_WCHAR=63 +CONFIG_LAST_SUPPORTED_WCHAR=767 +# CONFIG_UNICODE_COMBINING_WCHARS is not set +# CONFIG_UNICODE_WIDE_WCHARS is not set +# CONFIG_UNICODE_BIDI_SUPPORT is not set +# CONFIG_UNICODE_NEUTRAL_TABLE is not set +# CONFIG_UNICODE_PRESERVE_BROKEN is not set CONFIG_FEATURE_NON_POSIX_CP=y # CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set +CONFIG_FEATURE_USE_SENDFILE=y CONFIG_FEATURE_COPYBUF_KB=4 CONFIG_FEATURE_SKIP_ROOTFS=y -CONFIG_MONOTONIC_SYSCALL=y +# CONFIG_MONOTONIC_SYSCALL is not set CONFIG_IOCTL_HEX2STR_ERROR=y CONFIG_FEATURE_HWIB=y @@ -131,20 +129,25 @@ CONFIG_FEATURE_HWIB=y # Archival Utilities # CONFIG_FEATURE_SEAMLESS_XZ=y -# CONFIG_FEATURE_SEAMLESS_LZMA is not set -# CONFIG_FEATURE_SEAMLESS_BZ2 is not set -# CONFIG_FEATURE_SEAMLESS_GZ is not set -# CONFIG_FEATURE_SEAMLESS_Z is not set -# CONFIG_AR is not set -# CONFIG_FEATURE_AR_LONG_FILENAMES is not set -# CONFIG_FEATURE_AR_CREATE is not set -# CONFIG_UNCOMPRESS is not set +CONFIG_FEATURE_SEAMLESS_LZMA=y +CONFIG_FEATURE_SEAMLESS_BZ2=y +CONFIG_FEATURE_SEAMLESS_GZ=y +CONFIG_FEATURE_SEAMLESS_Z=y +CONFIG_AR=y +CONFIG_FEATURE_AR_LONG_FILENAMES=y +CONFIG_FEATURE_AR_CREATE=y +CONFIG_UNCOMPRESS=y CONFIG_GUNZIP=y +CONFIG_ZCAT=y +CONFIG_FEATURE_GUNZIP_LONG_OPTIONS=y CONFIG_BUNZIP2=y -# CONFIG_UNLZMA is not set -# CONFIG_FEATURE_LZMA_FAST is not set -# CONFIG_LZMA is not set +CONFIG_BZCAT=y +CONFIG_UNLZMA=y +CONFIG_LZCAT=y +CONFIG_LZMA=y +CONFIG_FEATURE_LZMA_FAST=y CONFIG_UNXZ=y +CONFIG_XZCAT=y CONFIG_XZ=y CONFIG_BZIP2=y CONFIG_CPIO=y @@ -152,25 +155,26 @@ CONFIG_FEATURE_CPIO_O=y # CONFIG_FEATURE_CPIO_P is not set # CONFIG_DPKG is not set # CONFIG_DPKG_DEB is not set -# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set CONFIG_GZIP=y # CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set CONFIG_GZIP_FAST=0 -# CONFIG_FEATURE_GZIP_LEVELS is not set +CONFIG_FEATURE_GZIP_LEVELS=y # CONFIG_LZOP is not set +CONFIG_UNLZOP=y +CONFIG_LZOPCAT=y # CONFIG_LZOP_COMPR_HIGH is not set +CONFIG_RPM2CPIO=y # CONFIG_RPM is not set -# CONFIG_RPM2CPIO is not set CONFIG_TAR=y CONFIG_FEATURE_TAR_CREATE=y -# CONFIG_FEATURE_TAR_AUTODETECT is not set -# CONFIG_FEATURE_TAR_FROM is not set -# CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY is not set -# CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set +CONFIG_FEATURE_TAR_AUTODETECT=y +CONFIG_FEATURE_TAR_FROM=y +CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y +CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY=y CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y CONFIG_FEATURE_TAR_LONG_OPTIONS=y -# CONFIG_FEATURE_TAR_TO_COMMAND is not set -# CONFIG_FEATURE_TAR_UNAME_GNAME is not set +CONFIG_FEATURE_TAR_TO_COMMAND=y +CONFIG_FEATURE_TAR_UNAME_GNAME=y # CONFIG_FEATURE_TAR_NOPRESERVE_TIME is not set # CONFIG_FEATURE_TAR_SELINUX is not set CONFIG_UNZIP=y @@ -179,71 +183,57 @@ CONFIG_UNZIP=y # Coreutils # CONFIG_BASENAME=y +CONFIG_CAL=y CONFIG_CAT=y +CONFIG_CATV=y +CONFIG_CHGRP=y +CONFIG_CHMOD=y +CONFIG_CHOWN=y +CONFIG_FEATURE_CHOWN_LONG_OPTIONS=y +CONFIG_CHROOT=y +CONFIG_CKSUM=y +CONFIG_COMM=y +CONFIG_CP=y +CONFIG_FEATURE_CP_LONG_OPTIONS=y +CONFIG_CUT=y CONFIG_DATE=y CONFIG_FEATURE_DATE_ISOFMT=y # CONFIG_FEATURE_DATE_NANO is not set CONFIG_FEATURE_DATE_COMPAT=y CONFIG_DD=y CONFIG_FEATURE_DD_SIGNAL_HANDLING=y -# CONFIG_FEATURE_DD_THIRD_STATUS_LINE is not set -# CONFIG_FEATURE_DD_IBS_OBS is not set +CONFIG_FEATURE_DD_THIRD_STATUS_LINE=y +CONFIG_FEATURE_DD_IBS_OBS=y CONFIG_FEATURE_DD_STATUS=y -# CONFIG_HOSTID is not set -# CONFIG_ID is not set -CONFIG_GROUPS=y -CONFIG_SHUF=y -CONFIG_SYNC=y -CONFIG_FEATURE_SYNC_FANCY=y -CONFIG_TEST=y -# CONFIG_FEATURE_TEST_64 is not set -CONFIG_TOUCH=y -CONFIG_FEATURE_TOUCH_NODEREF=y -CONFIG_FEATURE_TOUCH_SUSV3=y -CONFIG_TR=y -CONFIG_FEATURE_TR_CLASSES=y -CONFIG_FEATURE_TR_EQUIV=y -CONFIG_TRUNCATE=y -CONFIG_UNLINK=y -CONFIG_BASE64=y -# CONFIG_WHO is not set -# CONFIG_USERS is not set -# CONFIG_CAL is not set -# CONFIG_CATV is not set -CONFIG_CHGRP=y -CONFIG_CHMOD=y -CONFIG_CHOWN=y -# CONFIG_FEATURE_CHOWN_LONG_OPTIONS is not set -CONFIG_CHROOT=y -# CONFIG_CKSUM is not set -# CONFIG_COMM is not set -CONFIG_CP=y -# CONFIG_FEATURE_CP_LONG_OPTIONS is not set -CONFIG_CUT=y CONFIG_DF=y -# CONFIG_FEATURE_DF_FANCY is not set +CONFIG_FEATURE_DF_FANCY=y CONFIG_DIRNAME=y -# CONFIG_DOS2UNIX is not set -# CONFIG_UNIX2DOS is not set +CONFIG_DOS2UNIX=y +CONFIG_UNIX2DOS=y CONFIG_DU=y CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y CONFIG_ECHO=y CONFIG_FEATURE_FANCY_ECHO=y -# CONFIG_ENV is not set -# CONFIG_FEATURE_ENV_LONG_OPTIONS is not set -# CONFIG_EXPAND is not set -# CONFIG_FEATURE_EXPAND_LONG_OPTIONS is not set -# CONFIG_EXPR is not set -# CONFIG_EXPR_MATH_SUPPORT_64 is not set +CONFIG_ENV=y +CONFIG_FEATURE_ENV_LONG_OPTIONS=y +CONFIG_EXPAND=y +CONFIG_FEATURE_EXPAND_LONG_OPTIONS=y +CONFIG_UNEXPAND=y +CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS=y +CONFIG_EXPR=y +CONFIG_EXPR_MATH_SUPPORT_64=y CONFIG_FALSE=y -# CONFIG_FOLD is not set -# CONFIG_FSYNC is not set +CONFIG_FOLD=y +CONFIG_FSYNC=y CONFIG_HEAD=y CONFIG_FEATURE_FANCY_HEAD=y -# CONFIG_INSTALL is not set -# CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set +CONFIG_HOSTID=y +CONFIG_ID=y +CONFIG_GROUPS=y +CONFIG_INSTALL=y +CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y CONFIG_LN=y -# CONFIG_LOGNAME is not set +CONFIG_LOGNAME=y CONFIG_LS=y CONFIG_FEATURE_LS_FILETYPES=y CONFIG_FEATURE_LS_FOLLOWLINKS=y @@ -252,61 +242,83 @@ CONFIG_FEATURE_LS_SORTFILES=y CONFIG_FEATURE_LS_TIMESTAMPS=y CONFIG_FEATURE_LS_USERNAME=y CONFIG_FEATURE_LS_COLOR=y -# CONFIG_FEATURE_LS_COLOR_IS_DEFAULT is not set -# CONFIG_MD5SUM is not set +CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y +CONFIG_MD5SUM=y +CONFIG_SHA1SUM=y +CONFIG_SHA256SUM=y +CONFIG_SHA512SUM=y +CONFIG_SHA3SUM=y + +# +# Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum +# +CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y CONFIG_MKDIR=y -# CONFIG_FEATURE_MKDIR_LONG_OPTIONS is not set -# CONFIG_MKFIFO is not set +CONFIG_FEATURE_MKDIR_LONG_OPTIONS=y +CONFIG_MKFIFO=y CONFIG_MKNOD=y CONFIG_MV=y -# CONFIG_FEATURE_MV_LONG_OPTIONS is not set -# CONFIG_NICE is not set -# CONFIG_NOHUP is not set -# CONFIG_OD is not set -# CONFIG_PRINTENV is not set +CONFIG_FEATURE_MV_LONG_OPTIONS=y +CONFIG_NICE=y +CONFIG_NOHUP=y +CONFIG_OD=y +CONFIG_PRINTENV=y CONFIG_PRINTF=y CONFIG_PWD=y CONFIG_READLINK=y -# CONFIG_FEATURE_READLINK_FOLLOW is not set -# CONFIG_REALPATH is not set +CONFIG_FEATURE_READLINK_FOLLOW=y +CONFIG_REALPATH=y CONFIG_RM=y CONFIG_RMDIR=y -# CONFIG_FEATURE_RMDIR_LONG_OPTIONS is not set +CONFIG_FEATURE_RMDIR_LONG_OPTIONS=y CONFIG_SEQ=y -CONFIG_SHA1SUM=y -# CONFIG_SHA256SUM is not set -# CONFIG_SHA512SUM is not set -# CONFIG_SHA3SUM is not set +CONFIG_SHUF=y CONFIG_SLEEP=y -# CONFIG_FEATURE_FANCY_SLEEP is not set -# CONFIG_FEATURE_FLOAT_SLEEP is not set +CONFIG_FEATURE_FANCY_SLEEP=y +CONFIG_FEATURE_FLOAT_SLEEP=y CONFIG_SORT=y CONFIG_FEATURE_SORT_BIG=y -# CONFIG_SPLIT is not set -# CONFIG_FEATURE_SPLIT_FANCY is not set +CONFIG_SPLIT=y +CONFIG_FEATURE_SPLIT_FANCY=y CONFIG_STAT=y CONFIG_FEATURE_STAT_FORMAT=y -# CONFIG_STTY is not set -# CONFIG_SUM is not set -# CONFIG_TAC is not set +CONFIG_FEATURE_STAT_FILESYSTEM=y +CONFIG_STTY=y +CONFIG_SUM=y +CONFIG_SYNC=y +CONFIG_FEATURE_SYNC_FANCY=y +CONFIG_TAC=y CONFIG_TAIL=y CONFIG_FEATURE_FANCY_TAIL=y CONFIG_TEE=y -# CONFIG_FEATURE_TEE_USE_BLOCK_IO is not set +CONFIG_FEATURE_TEE_USE_BLOCK_IO=y +CONFIG_TEST=y +CONFIG_TEST1=y +CONFIG_TEST2=y +CONFIG_FEATURE_TEST_64=y +CONFIG_TOUCH=y +CONFIG_FEATURE_TOUCH_NODEREF=y +CONFIG_FEATURE_TOUCH_SUSV3=y +CONFIG_TR=y +CONFIG_FEATURE_TR_CLASSES=y +CONFIG_FEATURE_TR_EQUIV=y CONFIG_TRUE=y -# CONFIG_TTY is not set +CONFIG_TRUNCATE=y +CONFIG_TTY=y CONFIG_UNAME=y -CONFIG_UNAME_OSNAME="Pisi GNU/Linux" -# CONFIG_UNEXPAND is not set -# CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS is not set +CONFIG_UNAME_OSNAME="GNU/Linux" CONFIG_UNIQ=y +CONFIG_UNLINK=y CONFIG_USLEEP=y -# CONFIG_UUDECODE is not set -# CONFIG_UUENCODE is not set +CONFIG_UUDECODE=y +CONFIG_BASE64=y +CONFIG_UUENCODE=y CONFIG_WC=y -# CONFIG_FEATURE_WC_LARGE is not set -# CONFIG_WHOAMI is not set -# CONFIG_YES is not set +CONFIG_FEATURE_WC_LARGE=y +CONFIG_WHOAMI=y +# CONFIG_WHO is not set +# CONFIG_USERS is not set +CONFIG_YES=y # # Common options @@ -328,70 +340,65 @@ CONFIG_FEATURE_AUTOWIDTH=y # CONFIG_FEATURE_HUMAN_READABLE=y -# -# Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum -# -CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y - # # Console Utilities # -# CONFIG_CHVT is not set -# CONFIG_FGCONSOLE is not set +CONFIG_CHVT=y CONFIG_CLEAR=y -# CONFIG_DEALLOCVT is not set -# CONFIG_DUMPKMAP is not set -# CONFIG_KBD_MODE is not set +CONFIG_DEALLOCVT=y +CONFIG_DUMPKMAP=y +CONFIG_FGCONSOLE=y +CONFIG_KBD_MODE=y CONFIG_LOADFONT=y -CONFIG_LOADKMAP=y -# CONFIG_OPENVT is not set -CONFIG_RESET=y -# CONFIG_RESIZE is not set -# CONFIG_FEATURE_RESIZE_PRINT is not set -# CONFIG_SETCONSOLE is not set -# CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set -# CONFIG_SETFONT is not set +CONFIG_SETFONT=y # CONFIG_FEATURE_SETFONT_TEXTUAL_MAP is not set CONFIG_DEFAULT_SETFONT_DIR="" -CONFIG_SETKEYCODES=y -# CONFIG_SETLOGCONS is not set -# CONFIG_SHOWKEY is not set # # Common options for loadfont and setfont # CONFIG_FEATURE_LOADFONT_PSF2=y CONFIG_FEATURE_LOADFONT_RAW=y +CONFIG_LOADKMAP=y +CONFIG_OPENVT=y +CONFIG_RESET=y +CONFIG_RESIZE=y +CONFIG_FEATURE_RESIZE_PRINT=y +CONFIG_SETCONSOLE=y +CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS=y +CONFIG_SETKEYCODES=y +CONFIG_SETLOGCONS=y +CONFIG_SHOWKEY=y # # Debian Utilities # CONFIG_MKTEMP=y -# CONFIG_PIPE_PROGRESS is not set -# CONFIG_RUN_PARTS is not set -# CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS is not set -# CONFIG_FEATURE_RUN_PARTS_FANCY is not set -# CONFIG_START_STOP_DAEMON is not set -# CONFIG_FEATURE_START_STOP_DAEMON_FANCY is not set -# CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS is not set +CONFIG_PIPE_PROGRESS=y +CONFIG_RUN_PARTS=y +CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y +CONFIG_FEATURE_RUN_PARTS_FANCY=y +CONFIG_START_STOP_DAEMON=y +CONFIG_FEATURE_START_STOP_DAEMON_FANCY=y +CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS=y CONFIG_WHICH=y # # Editors # CONFIG_AWK=y -# CONFIG_FEATURE_AWK_LIBM is not set +CONFIG_FEATURE_AWK_LIBM=y CONFIG_FEATURE_AWK_GNU_EXTENSIONS=y -# CONFIG_CMP is not set -# CONFIG_DIFF is not set -# CONFIG_FEATURE_DIFF_LONG_OPTIONS is not set -# CONFIG_FEATURE_DIFF_DIR is not set -# CONFIG_ED is not set -# CONFIG_PATCH is not set +CONFIG_CMP=y +CONFIG_DIFF=y +CONFIG_FEATURE_DIFF_LONG_OPTIONS=y +CONFIG_FEATURE_DIFF_DIR=y +CONFIG_ED=y +CONFIG_PATCH=y CONFIG_SED=y CONFIG_VI=y CONFIG_FEATURE_VI_MAX_LEN=4096 -CONFIG_FEATURE_VI_8BIT=y +# CONFIG_FEATURE_VI_8BIT is not set CONFIG_FEATURE_VI_COLON=y CONFIG_FEATURE_VI_YANKMARK=y CONFIG_FEATURE_VI_SEARCH=y @@ -402,7 +409,7 @@ CONFIG_FEATURE_VI_READONLY=y CONFIG_FEATURE_VI_SETOPTS=y CONFIG_FEATURE_VI_SET=y CONFIG_FEATURE_VI_WIN_RESIZE=y -# CONFIG_FEATURE_VI_ASK_TERMINAL is not set +CONFIG_FEATURE_VI_ASK_TERMINAL=y CONFIG_FEATURE_VI_UNDO=y CONFIG_FEATURE_VI_UNDO_QUEUE=y CONFIG_FEATURE_VI_UNDO_QUEUE_MAX=256 @@ -430,14 +437,14 @@ CONFIG_FEATURE_FIND_DEPTH=y CONFIG_FEATURE_FIND_PAREN=y CONFIG_FEATURE_FIND_SIZE=y CONFIG_FEATURE_FIND_PRUNE=y -# CONFIG_FEATURE_FIND_DELETE is not set +CONFIG_FEATURE_FIND_DELETE=y CONFIG_FEATURE_FIND_PATH=y CONFIG_FEATURE_FIND_REGEX=y # CONFIG_FEATURE_FIND_CONTEXT is not set -# CONFIG_FEATURE_FIND_LINKS is not set +CONFIG_FEATURE_FIND_LINKS=y CONFIG_GREP=y -CONFIG_FEATURE_GREP_EGREP_ALIAS=y -CONFIG_FEATURE_GREP_FGREP_ALIAS=y +CONFIG_EGREP=y +CONFIG_FGREP=y CONFIG_FEATURE_GREP_CONTEXT=y CONFIG_XARGS=y CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION=y @@ -449,86 +456,90 @@ CONFIG_FEATURE_XARGS_SUPPORT_REPL_STR=y # # Init Utilities # -# CONFIG_BOOTCHARTD is not set -# CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set -# CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set +CONFIG_BOOTCHARTD=y +CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER=y +CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE=y CONFIG_HALT=y +CONFIG_POWEROFF=y +CONFIG_REBOOT=y # CONFIG_FEATURE_CALL_TELINIT is not set CONFIG_TELINIT_PATH="" -# CONFIG_INIT is not set -# CONFIG_FEATURE_USE_INITTAB is not set +CONFIG_INIT=y +CONFIG_LINUXRC=y +CONFIG_FEATURE_USE_INITTAB=y # CONFIG_FEATURE_KILL_REMOVED is not set CONFIG_FEATURE_KILL_DELAY=0 -# CONFIG_FEATURE_INIT_SCTTY is not set +CONFIG_FEATURE_INIT_SCTTY=y # CONFIG_FEATURE_INIT_SYSLOG is not set -# CONFIG_FEATURE_EXTRA_QUIET is not set -# CONFIG_FEATURE_INIT_COREDUMPS is not set -# CONFIG_FEATURE_INITRD is not set -CONFIG_INIT_TERMINAL_TYPE="" -# CONFIG_MESG is not set -# CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set +CONFIG_FEATURE_EXTRA_QUIET=y +CONFIG_FEATURE_INIT_COREDUMPS=y +CONFIG_INIT_TERMINAL_TYPE="linux" +CONFIG_FEATURE_INIT_MODIFY_CMDLINE=y +CONFIG_MESG=y +CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP=y # # Login/Password Management Utilities # -CONFIG_ADD_SHELL=y -CONFIG_REMOVE_SHELL=y -# CONFIG_FEATURE_SHADOWPASSWDS is not set -# CONFIG_USE_BB_PWD_GRP is not set -# CONFIG_USE_BB_SHADOW is not set +CONFIG_FEATURE_SHADOWPASSWDS=y +CONFIG_USE_BB_PWD_GRP=y +CONFIG_USE_BB_SHADOW=y CONFIG_USE_BB_CRYPT=y -# CONFIG_USE_BB_CRYPT_SHA is not set -# CONFIG_ADDUSER is not set -# CONFIG_FEATURE_ADDUSER_LONG_OPTIONS is not set -# CONFIG_FEATURE_CHECK_NAMES is not set -CONFIG_LAST_ID=0 -CONFIG_FIRST_SYSTEM_ID=0 -CONFIG_LAST_SYSTEM_ID=0 -# CONFIG_ADDGROUP is not set -# CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS is not set -# CONFIG_FEATURE_ADDUSER_TO_GROUP is not set -# CONFIG_DELUSER is not set -# CONFIG_DELGROUP is not set -# CONFIG_FEATURE_DEL_USER_FROM_GROUP is not set -# CONFIG_GETTY is not set -# CONFIG_LOGIN is not set +CONFIG_USE_BB_CRYPT_SHA=y +CONFIG_ADDGROUP=y +CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS=y +CONFIG_FEATURE_ADDUSER_TO_GROUP=y +# CONFIG_ADD_SHELL is not set +# CONFIG_REMOVE_SHELL is not set +CONFIG_ADDUSER=y +CONFIG_FEATURE_ADDUSER_LONG_OPTIONS=y +CONFIG_FEATURE_CHECK_NAMES=y +CONFIG_LAST_ID=60000 +CONFIG_FIRST_SYSTEM_ID=100 +CONFIG_LAST_SYSTEM_ID=999 +CONFIG_CHPASSWD=y +CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="des" +CONFIG_CRYPTPW=y +CONFIG_MKPASSWD=y +CONFIG_DELUSER=y +CONFIG_DELGROUP=y +CONFIG_FEATURE_DEL_USER_FROM_GROUP=y +CONFIG_GETTY=y +CONFIG_LOGIN=y # CONFIG_LOGIN_SESSION_AS_CHILD is not set -# CONFIG_LOGIN_SCRIPTS is not set -# CONFIG_FEATURE_NOLOGIN is not set -# CONFIG_FEATURE_SECURETTY is not set -# CONFIG_PASSWD is not set -# CONFIG_FEATURE_PASSWD_WEAK_CHECK is not set -# CONFIG_CRYPTPW is not set -# CONFIG_CHPASSWD is not set -CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="" -# CONFIG_SU is not set -# CONFIG_FEATURE_SU_SYSLOG is not set -# CONFIG_FEATURE_SU_CHECKS_SHELLS is not set -# CONFIG_SULOGIN is not set -# CONFIG_VLOCK is not set +CONFIG_LOGIN_SCRIPTS=y +CONFIG_FEATURE_NOLOGIN=y +CONFIG_FEATURE_SECURETTY=y +CONFIG_PASSWD=y +CONFIG_FEATURE_PASSWD_WEAK_CHECK=y +CONFIG_SU=y +CONFIG_FEATURE_SU_SYSLOG=y +CONFIG_FEATURE_SU_CHECKS_SHELLS=y +CONFIG_SULOGIN=y +CONFIG_VLOCK=y # # Linux Ext2 FS Progs # -# CONFIG_CHATTR is not set +CONFIG_CHATTR=y CONFIG_FSCK=y -# CONFIG_LSATTR is not set -# CONFIG_TUNE2FS is not set +CONFIG_LSATTR=y +CONFIG_TUNE2FS=y # # Linux Module Utilities # -CONFIG_MODINFO=y -# CONFIG_MODPROBE_SMALL is not set -# CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE is not set -# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set -CONFIG_INSMOD=y -CONFIG_RMMOD=y -CONFIG_LSMOD=y -# CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set -CONFIG_MODPROBE=y -CONFIG_FEATURE_MODPROBE_BLACKLIST=y +CONFIG_MODPROBE_SMALL=y # CONFIG_DEPMOD is not set +# CONFIG_INSMOD is not set +# CONFIG_LSMOD is not set +# CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set +CONFIG_MODINFO=y +# CONFIG_MODPROBE is not set +# CONFIG_FEATURE_MODPROBE_BLACKLIST is not set +CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE=y +CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED=y +# CONFIG_RMMOD is not set # # Options common to multiple modutils @@ -541,46 +552,27 @@ CONFIG_FEATURE_MODPROBE_BLACKLIST=y # CONFIG_FEATURE_INSMOD_LOAD_MAP is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set # CONFIG_FEATURE_CHECK_TAINTED_MODULE is not set -CONFIG_FEATURE_MODUTILS_ALIAS=y -CONFIG_FEATURE_MODUTILS_SYMBOLS=y +# CONFIG_FEATURE_MODUTILS_ALIAS is not set +# CONFIG_FEATURE_MODUTILS_SYMBOLS is not set CONFIG_DEFAULT_MODULES_DIR="/lib/modules" CONFIG_DEFAULT_DEPMOD_FILE="modules.dep" # # Linux System Utilities # -CONFIG_BLOCKDEV=y -CONFIG_FATATTR=y -CONFIG_FSTRIM=y -CONFIG_MDEV=y -CONFIG_FEATURE_MDEV_CONF=y -CONFIG_FEATURE_MDEV_RENAME=y -CONFIG_FEATURE_MDEV_RENAME_REGEXP=y -CONFIG_FEATURE_MDEV_EXEC=y -CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y -CONFIG_MOUNT=y -# CONFIG_FEATURE_MOUNT_FAKE is not set -CONFIG_FEATURE_MOUNT_VERBOSE=y -# CONFIG_FEATURE_MOUNT_HELPERS is not set -CONFIG_FEATURE_MOUNT_LABEL=y -# CONFIG_FEATURE_MOUNT_NFS is not set -CONFIG_FEATURE_MOUNT_CIFS=y -CONFIG_FEATURE_MOUNT_FLAGS=y -CONFIG_FEATURE_MOUNT_FSTAB=y -CONFIG_FEATURE_MOUNT_OTHERTAB=y -# CONFIG_REV is not set -CONFIG_UEVENT=y -# CONFIG_ACPID is not set -# CONFIG_FEATURE_ACPID_COMPAT is not set +CONFIG_ACPID=y +CONFIG_FEATURE_ACPID_COMPAT=y +CONFIG_BLKDISCARD=y CONFIG_BLKID=y -# CONFIG_FEATURE_BLKID_TYPE is not set +CONFIG_FEATURE_BLKID_TYPE=y +CONFIG_BLOCKDEV=y CONFIG_DMESG=y CONFIG_FEATURE_DMESG_PRETTY=y -# CONFIG_FBSET is not set -# CONFIG_FEATURE_FBSET_FANCY is not set -# CONFIG_FEATURE_FBSET_READMODE is not set -# CONFIG_FDFLUSH is not set -# CONFIG_FDFORMAT is not set +CONFIG_FATATTR=y +CONFIG_FBSET=y +CONFIG_FEATURE_FBSET_FANCY=y +CONFIG_FEATURE_FBSET_READMODE=y +CONFIG_FDFORMAT=y CONFIG_FDISK=y # CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set CONFIG_FEATURE_FDISK_WRITABLE=y @@ -588,47 +580,75 @@ CONFIG_FEATURE_FDISK_WRITABLE=y # CONFIG_FEATURE_SGI_LABEL is not set # CONFIG_FEATURE_SUN_LABEL is not set # CONFIG_FEATURE_OSF_LABEL is not set -# CONFIG_FEATURE_GPT_LABEL is not set -# CONFIG_FEATURE_FDISK_ADVANCED is not set +CONFIG_FEATURE_GPT_LABEL=y +CONFIG_FEATURE_FDISK_ADVANCED=y CONFIG_FINDFS=y -# CONFIG_FLOCK is not set -# CONFIG_FREERAMDISK is not set -# CONFIG_FSCK_MINIX is not set -# CONFIG_MKFS_EXT2 is not set -# CONFIG_MKFS_MINIX is not set -# CONFIG_FEATURE_MINIX2 is not set -# CONFIG_MKFS_REISER is not set -# CONFIG_MKFS_VFAT is not set -# CONFIG_GETOPT is not set -# CONFIG_FEATURE_GETOPT_LONG is not set -# CONFIG_HEXDUMP is not set -# CONFIG_FEATURE_HEXDUMP_REVERSE is not set -# CONFIG_HD is not set +CONFIG_FLOCK=y +CONFIG_FDFLUSH=y +CONFIG_FREERAMDISK=y +CONFIG_FSCK_MINIX=y +CONFIG_FSTRIM=y +CONFIG_GETOPT=y +CONFIG_FEATURE_GETOPT_LONG=y +CONFIG_HEXDUMP=y +CONFIG_FEATURE_HEXDUMP_REVERSE=y +CONFIG_HD=y CONFIG_HWCLOCK=y -# CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS is not set +CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS=y CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS=y -# CONFIG_IPCRM is not set -# CONFIG_IPCS is not set +CONFIG_IPCRM=y +CONFIG_IPCS=y CONFIG_LOSETUP=y -# CONFIG_LSPCI is not set -# CONFIG_LSUSB is not set -# CONFIG_MKSWAP is not set -# CONFIG_FEATURE_MKSWAP_UUID is not set +CONFIG_LSPCI=y +CONFIG_LSUSB=y +CONFIG_MDEV=y +CONFIG_FEATURE_MDEV_CONF=y +CONFIG_FEATURE_MDEV_RENAME=y +CONFIG_FEATURE_MDEV_RENAME_REGEXP=y +CONFIG_FEATURE_MDEV_EXEC=y +CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y +CONFIG_MKE2FS=y +CONFIG_MKFS_EXT2=y +CONFIG_MKFS_MINIX=y +CONFIG_FEATURE_MINIX2=y +# CONFIG_MKFS_REISER is not set +CONFIG_MKDOSFS=y +CONFIG_MKFS_VFAT=y +CONFIG_MKSWAP=y +CONFIG_FEATURE_MKSWAP_UUID=y CONFIG_MORE=y -# CONFIG_PIVOT_ROOT is not set -# CONFIG_RDATE is not set -# CONFIG_RDEV is not set -# CONFIG_READPROFILE is not set -# CONFIG_RTCWAKE is not set -# CONFIG_SCRIPT is not set -# CONFIG_SCRIPTREPLAY is not set -# CONFIG_SETARCH is not set -# CONFIG_SWAPONOFF is not set -# CONFIG_FEATURE_SWAPON_DISCARD is not set -# CONFIG_FEATURE_SWAPON_PRI is not set +CONFIG_MOUNT=y +CONFIG_FEATURE_MOUNT_FAKE=y +CONFIG_FEATURE_MOUNT_VERBOSE=y +CONFIG_FEATURE_MOUNT_HELPERS=y +CONFIG_FEATURE_MOUNT_LABEL=y +# CONFIG_FEATURE_MOUNT_NFS is not set +CONFIG_FEATURE_MOUNT_CIFS=y +CONFIG_FEATURE_MOUNT_FLAGS=y +CONFIG_FEATURE_MOUNT_FSTAB=y +CONFIG_FEATURE_MOUNT_OTHERTAB=y +CONFIG_NSENTER=y +CONFIG_FEATURE_NSENTER_LONG_OPTS=y +CONFIG_PIVOT_ROOT=y +CONFIG_RDATE=y +CONFIG_RDEV=y +CONFIG_READPROFILE=y +CONFIG_REV=y +CONFIG_RTCWAKE=y +CONFIG_SCRIPT=y +CONFIG_SCRIPTREPLAY=y +CONFIG_SETARCH=y +CONFIG_LINUX32=y +CONFIG_LINUX64=y +CONFIG_SWAPON=y +CONFIG_FEATURE_SWAPON_DISCARD=y +CONFIG_FEATURE_SWAPON_PRI=y +CONFIG_SWAPOFF=y CONFIG_SWITCH_ROOT=y +CONFIG_UEVENT=y CONFIG_UMOUNT=y CONFIG_FEATURE_UMOUNT_ALL=y +CONFIG_UNSHARE=y # # Common options for mount/umount @@ -641,6 +661,7 @@ CONFIG_VOLUMEID=y # # Filesystem/Volume identification # +CONFIG_FEATURE_VOLUMEID_BCACHE=y CONFIG_FEATURE_VOLUMEID_BTRFS=y CONFIG_FEATURE_VOLUMEID_CRAMFS=y CONFIG_FEATURE_VOLUMEID_EXFAT=y @@ -655,367 +676,380 @@ CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y CONFIG_FEATURE_VOLUMEID_LUKS=y CONFIG_FEATURE_VOLUMEID_NILFS=y CONFIG_FEATURE_VOLUMEID_NTFS=y -# CONFIG_FEATURE_VOLUMEID_OCFS2 is not set +CONFIG_FEATURE_VOLUMEID_OCFS2=y CONFIG_FEATURE_VOLUMEID_REISERFS=y CONFIG_FEATURE_VOLUMEID_ROMFS=y -# CONFIG_FEATURE_VOLUMEID_SQUASHFS is not set -# CONFIG_FEATURE_VOLUMEID_SYSV is not set +CONFIG_FEATURE_VOLUMEID_SQUASHFS=y +CONFIG_FEATURE_VOLUMEID_SYSV=y +CONFIG_FEATURE_VOLUMEID_UBIFS=y CONFIG_FEATURE_VOLUMEID_UDF=y CONFIG_FEATURE_VOLUMEID_XFS=y # # Miscellaneous Utilities # -# CONFIG_CONSPY is not set -# CONFIG_CROND is not set -# CONFIG_FEATURE_CROND_D is not set -# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set -CONFIG_FEATURE_CROND_DIR="" -CONFIG_I2CGET=y -CONFIG_I2CSET=y -CONFIG_I2CDUMP=y -CONFIG_I2CDETECT=y -CONFIG_LESS=y -CONFIG_FEATURE_LESS_MAXLINES=9999999 -CONFIG_FEATURE_LESS_BRACKETS=y -CONFIG_FEATURE_LESS_FLAGS=y -CONFIG_FEATURE_LESS_TRUNCATE=y -# CONFIG_FEATURE_LESS_MARKS is not set -# CONFIG_FEATURE_LESS_REGEXP is not set -# CONFIG_FEATURE_LESS_WINCH is not set -# CONFIG_FEATURE_LESS_ASK_TERMINAL is not set -# CONFIG_FEATURE_LESS_DASHCMD is not set -# CONFIG_FEATURE_LESS_LINENUMS is not set -CONFIG_NANDWRITE=y -CONFIG_NANDDUMP=y -# CONFIG_RFKILL is not set -CONFIG_SETSERIAL=y -# CONFIG_TASKSET is not set -# CONFIG_FEATURE_TASKSET_FANCY is not set -# CONFIG_UBIATTACH is not set -# CONFIG_UBIDETACH is not set -CONFIG_UBIMKVOL=y -CONFIG_UBIRMVOL=y -CONFIG_UBIRSVOL=y -CONFIG_UBIUPDATEVOL=y -# CONFIG_WALL is not set -# CONFIG_ADJTIMEX is not set -# CONFIG_BBCONFIG is not set -# CONFIG_FEATURE_COMPRESS_BBCONFIG is not set -# CONFIG_BEEP is not set -CONFIG_FEATURE_BEEP_FREQ=0 -CONFIG_FEATURE_BEEP_LENGTH_MS=0 -# CONFIG_CHAT is not set -# CONFIG_FEATURE_CHAT_NOFAIL is not set +CONFIG_ADJTIMEX=y +CONFIG_BBCONFIG=y +CONFIG_FEATURE_COMPRESS_BBCONFIG=y +CONFIG_BEEP=y +CONFIG_FEATURE_BEEP_FREQ=4000 +CONFIG_FEATURE_BEEP_LENGTH_MS=30 +CONFIG_CHAT=y +CONFIG_FEATURE_CHAT_NOFAIL=y # CONFIG_FEATURE_CHAT_TTY_HIFI is not set -# CONFIG_FEATURE_CHAT_IMPLICIT_CR is not set +CONFIG_FEATURE_CHAT_IMPLICIT_CR=y # CONFIG_FEATURE_CHAT_SWALLOW_OPTS is not set # CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set # CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set # CONFIG_FEATURE_CHAT_CLR_ABORT is not set -# CONFIG_CHRT is not set -# CONFIG_CRONTAB is not set -# CONFIG_DC is not set -# CONFIG_FEATURE_DC_LIBM is not set +CONFIG_CHRT=y +# CONFIG_CONSPY is not set +CONFIG_CROND=y +CONFIG_FEATURE_CROND_D=y +CONFIG_FEATURE_CROND_CALL_SENDMAIL=y +CONFIG_FEATURE_CROND_DIR="/var/spool/cron" +CONFIG_CRONTAB=y +CONFIG_DC=y +CONFIG_FEATURE_DC_LIBM=y # CONFIG_DEVFSD is not set # CONFIG_DEVFSD_MODLOAD is not set # CONFIG_DEVFSD_FG_NP is not set # CONFIG_DEVFSD_VERBOSE is not set # CONFIG_FEATURE_DEVFS is not set # CONFIG_DEVMEM is not set -# CONFIG_EJECT is not set -# CONFIG_FEATURE_EJECT_SCSI is not set -# CONFIG_FBSPLASH is not set +CONFIG_EJECT=y +CONFIG_FEATURE_EJECT_SCSI=y +CONFIG_FBSPLASH=y # CONFIG_FLASHCP is not set +# CONFIG_FLASH_ERASEALL is not set # CONFIG_FLASH_LOCK is not set # CONFIG_FLASH_UNLOCK is not set -# CONFIG_FLASH_ERASEALL is not set -# CONFIG_IONICE is not set -# CONFIG_INOTIFYD is not set +CONFIG_HDPARM=y +CONFIG_FEATURE_HDPARM_GET_IDENTITY=y +CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF=y +CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF=y +CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET=y +CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF=y +CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA=y +CONFIG_I2CGET=y +CONFIG_I2CSET=y +CONFIG_I2CDUMP=y +CONFIG_I2CDETECT=y +CONFIG_INOTIFYD=y +CONFIG_IONICE=y # CONFIG_LAST is not set -# CONFIG_FEATURE_LAST_SMALL is not set # CONFIG_FEATURE_LAST_FANCY is not set -# CONFIG_HDPARM is not set -# CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set -# CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set -# CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF is not set -# CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set -# CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set -# CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set -# CONFIG_MAKEDEVS is not set +CONFIG_LESS=y +CONFIG_FEATURE_LESS_MAXLINES=9999999 +CONFIG_FEATURE_LESS_BRACKETS=y +CONFIG_FEATURE_LESS_FLAGS=y +CONFIG_FEATURE_LESS_TRUNCATE=y +CONFIG_FEATURE_LESS_MARKS=y +CONFIG_FEATURE_LESS_REGEXP=y +CONFIG_FEATURE_LESS_WINCH=y +CONFIG_FEATURE_LESS_ASK_TERMINAL=y +# CONFIG_FEATURE_LESS_DASHCMD is not set +# CONFIG_FEATURE_LESS_LINENUMS is not set +CONFIG_MAKEDEVS=y # CONFIG_FEATURE_MAKEDEVS_LEAF is not set -# CONFIG_FEATURE_MAKEDEVS_TABLE is not set -# CONFIG_MAN is not set -# CONFIG_MICROCOM is not set -# CONFIG_MOUNTPOINT is not set -# CONFIG_MT is not set -# CONFIG_RAIDAUTORUN is not set -# CONFIG_READAHEAD is not set +CONFIG_FEATURE_MAKEDEVS_TABLE=y +CONFIG_MAN=y +CONFIG_MICROCOM=y +CONFIG_MOUNTPOINT=y +CONFIG_MT=y +# CONFIG_NANDWRITE is not set +# CONFIG_NANDDUMP is not set +CONFIG_RAIDAUTORUN=y +CONFIG_READAHEAD=y +CONFIG_RFKILL=y # CONFIG_RUNLEVEL is not set -# CONFIG_RX is not set -# CONFIG_SETSID is not set +CONFIG_RX=y +CONFIG_SETSERIAL=y +CONFIG_SETSID=y CONFIG_STRINGS=y +CONFIG_TASKSET=y +CONFIG_FEATURE_TASKSET_FANCY=y CONFIG_TIME=y -# CONFIG_TIMEOUT is not set -# CONFIG_TTYSIZE is not set -# CONFIG_VOLNAME is not set -# CONFIG_WATCHDOG is not set +CONFIG_TIMEOUT=y +CONFIG_TTYSIZE=y +CONFIG_UBIRENAME=y +CONFIG_UBIATTACH=y +CONFIG_UBIDETACH=y +CONFIG_UBIMKVOL=y +CONFIG_UBIRMVOL=y +CONFIG_UBIRSVOL=y +CONFIG_UBIUPDATEVOL=y +CONFIG_VOLNAME=y +# CONFIG_WALL is not set +CONFIG_WATCHDOG=y # # Networking Utilities # -# CONFIG_NAMEIF is not set -# CONFIG_FEATURE_NAMEIF_EXTENDED is not set -CONFIG_NBDCLIENT=y -# CONFIG_NC is not set -# CONFIG_NC_SERVER is not set -# CONFIG_NC_EXTRA is not set -# CONFIG_NC_110_COMPAT is not set -CONFIG_PING=y -# CONFIG_PING6 is not set -CONFIG_FEATURE_FANCY_PING=y -# CONFIG_WGET is not set -# CONFIG_FEATURE_WGET_STATUSBAR is not set -# CONFIG_FEATURE_WGET_AUTHENTICATION is not set -# CONFIG_FEATURE_WGET_LONG_OPTIONS is not set -# CONFIG_FEATURE_WGET_TIMEOUT is not set -# CONFIG_FEATURE_WGET_OPENSSL is not set -# CONFIG_FEATURE_WGET_SSL_HELPER is not set -CONFIG_WHOIS=y -# CONFIG_FEATURE_IPV6 is not set -# CONFIG_FEATURE_UNIX_LOCAL is not set -# CONFIG_FEATURE_PREFER_IPV4_ADDRESS is not set +CONFIG_FEATURE_IPV6=y +CONFIG_FEATURE_UNIX_LOCAL=y +CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y # CONFIG_VERBOSE_RESOLUTION_ERRORS is not set -# CONFIG_ARP is not set -# CONFIG_ARPING is not set -# CONFIG_BRCTL is not set -# CONFIG_FEATURE_BRCTL_FANCY is not set -# CONFIG_FEATURE_BRCTL_SHOW is not set -# CONFIG_DNSD is not set -# CONFIG_ETHER_WAKE is not set -# CONFIG_FAKEIDENTD is not set -# CONFIG_FTPD is not set -# CONFIG_FEATURE_FTP_WRITE is not set -# CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST is not set -# CONFIG_FEATURE_FTP_AUTHENTICATION is not set -# CONFIG_FTPGET is not set -# CONFIG_FTPPUT is not set -# CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set +CONFIG_ARP=y +CONFIG_ARPING=y +CONFIG_BRCTL=y +CONFIG_FEATURE_BRCTL_FANCY=y +CONFIG_FEATURE_BRCTL_SHOW=y +CONFIG_DNSD=y +CONFIG_ETHER_WAKE=y +CONFIG_FTPD=y +CONFIG_FEATURE_FTPD_WRITE=y +CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST=y +CONFIG_FEATURE_FTPD_AUTHENTICATION=y +CONFIG_FTPGET=y +CONFIG_FTPPUT=y +CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS=y CONFIG_HOSTNAME=y -# CONFIG_HTTPD is not set -# CONFIG_FEATURE_HTTPD_RANGES is not set -# CONFIG_FEATURE_HTTPD_SETUID is not set -# CONFIG_FEATURE_HTTPD_BASIC_AUTH is not set -# CONFIG_FEATURE_HTTPD_AUTH_MD5 is not set -# CONFIG_FEATURE_HTTPD_CGI is not set -# CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR is not set -# CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV is not set -# CONFIG_FEATURE_HTTPD_ENCODE_URL_STR is not set -# CONFIG_FEATURE_HTTPD_ERROR_PAGES is not set -# CONFIG_FEATURE_HTTPD_PROXY is not set -# CONFIG_FEATURE_HTTPD_GZIP is not set +CONFIG_DNSDOMAINNAME=y +CONFIG_HTTPD=y +CONFIG_FEATURE_HTTPD_RANGES=y +CONFIG_FEATURE_HTTPD_SETUID=y +CONFIG_FEATURE_HTTPD_BASIC_AUTH=y +CONFIG_FEATURE_HTTPD_AUTH_MD5=y +CONFIG_FEATURE_HTTPD_CGI=y +CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR=y +CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV=y +CONFIG_FEATURE_HTTPD_ENCODE_URL_STR=y +CONFIG_FEATURE_HTTPD_ERROR_PAGES=y +CONFIG_FEATURE_HTTPD_PROXY=y +CONFIG_FEATURE_HTTPD_GZIP=y CONFIG_IFCONFIG=y CONFIG_FEATURE_IFCONFIG_STATUS=y CONFIG_FEATURE_IFCONFIG_SLIP=y CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y CONFIG_FEATURE_IFCONFIG_HW=y CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y -# CONFIG_IFENSLAVE is not set -# CONFIG_IFPLUGD is not set -# CONFIG_IFUPDOWN is not set -CONFIG_IFUPDOWN_IFSTATE_PATH="" -# CONFIG_FEATURE_IFUPDOWN_IP is not set -# CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN is not set -# CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN is not set -# CONFIG_FEATURE_IFUPDOWN_IPV4 is not set -# CONFIG_FEATURE_IFUPDOWN_IPV6 is not set -# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set +CONFIG_IFENSLAVE=y +CONFIG_IFPLUGD=y +CONFIG_IFUP=y +CONFIG_IFDOWN=y +CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate" +CONFIG_FEATURE_IFUPDOWN_IP=y +CONFIG_FEATURE_IFUPDOWN_IPV4=y +CONFIG_FEATURE_IFUPDOWN_IPV6=y +CONFIG_FEATURE_IFUPDOWN_MAPPING=y # CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set -# CONFIG_INETD is not set -# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set -# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set -# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set -# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set -# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set +CONFIG_INETD=y +CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO=y +CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD=y +CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME=y +CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME=y +CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN=y # CONFIG_FEATURE_INETD_RPC is not set -# CONFIG_IP is not set -# CONFIG_FEATURE_IP_ADDRESS is not set -# CONFIG_FEATURE_IP_LINK is not set -# CONFIG_FEATURE_IP_ROUTE is not set -CONFIG_FEATURE_IP_ROUTE_DIR="" -# CONFIG_FEATURE_IP_TUNNEL is not set -# CONFIG_FEATURE_IP_RULE is not set -# CONFIG_FEATURE_IP_SHORT_FORMS is not set +CONFIG_IP=y +CONFIG_IPADDR=y +CONFIG_IPLINK=y +CONFIG_IPROUTE=y +CONFIG_IPTUNNEL=y +CONFIG_IPRULE=y +CONFIG_IPNEIGH=y +CONFIG_FEATURE_IP_ADDRESS=y +CONFIG_FEATURE_IP_LINK=y +CONFIG_FEATURE_IP_ROUTE=y +CONFIG_FEATURE_IP_ROUTE_DIR="y" +CONFIG_FEATURE_IP_TUNNEL=y +CONFIG_FEATURE_IP_RULE=y +CONFIG_FEATURE_IP_NEIGH=y # CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set -# CONFIG_IPADDR is not set -# CONFIG_IPLINK is not set -# CONFIG_IPROUTE is not set -# CONFIG_IPTUNNEL is not set -# CONFIG_IPRULE is not set -# CONFIG_IPCALC is not set -# CONFIG_FEATURE_IPCALC_FANCY is not set -# CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set -# CONFIG_NETSTAT is not set -# CONFIG_FEATURE_NETSTAT_WIDE is not set -# CONFIG_FEATURE_NETSTAT_PRG is not set -# CONFIG_NSLOOKUP is not set -# CONFIG_NTPD is not set -# CONFIG_FEATURE_NTPD_SERVER is not set -# CONFIG_FEATURE_NTPD_CONF is not set -# CONFIG_PSCAN is not set +CONFIG_IPCALC=y +CONFIG_FEATURE_IPCALC_FANCY=y +CONFIG_FEATURE_IPCALC_LONG_OPTIONS=y +CONFIG_FAKEIDENTD=y +CONFIG_NAMEIF=y +# CONFIG_FEATURE_NAMEIF_EXTENDED is not set +CONFIG_NBDCLIENT=y +CONFIG_NC=y +CONFIG_NC_SERVER=y +CONFIG_NC_EXTRA=y +CONFIG_NC_110_COMPAT=y +CONFIG_NETSTAT=y +CONFIG_FEATURE_NETSTAT_WIDE=y +CONFIG_FEATURE_NETSTAT_PRG=y +CONFIG_NSLOOKUP=y +CONFIG_NTPD=y +CONFIG_FEATURE_NTPD_SERVER=y +CONFIG_FEATURE_NTPD_CONF=y +CONFIG_PING=y +CONFIG_PING6=y +CONFIG_FEATURE_FANCY_PING=y +CONFIG_PSCAN=y CONFIG_ROUTE=y -# CONFIG_SLATTACH is not set -# CONFIG_TCPSVD is not set -# CONFIG_TELNET is not set -# CONFIG_FEATURE_TELNET_TTYPE is not set -# CONFIG_FEATURE_TELNET_AUTOLOGIN is not set -# CONFIG_TELNETD is not set -# CONFIG_FEATURE_TELNETD_STANDALONE is not set +CONFIG_SLATTACH=y +CONFIG_TCPSVD=y +CONFIG_UDPSVD=y +CONFIG_TELNET=y +CONFIG_FEATURE_TELNET_TTYPE=y +CONFIG_FEATURE_TELNET_AUTOLOGIN=y +CONFIG_TELNETD=y +CONFIG_FEATURE_TELNETD_STANDALONE=y # CONFIG_FEATURE_TELNETD_INETD_WAIT is not set -# CONFIG_TFTP is not set -# CONFIG_TFTPD is not set -# CONFIG_FEATURE_TFTP_GET is not set -# CONFIG_FEATURE_TFTP_PUT is not set -# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set +CONFIG_TFTP=y +CONFIG_TFTPD=y + +# +# Common options for tftp/tftpd +# +CONFIG_FEATURE_TFTP_GET=y +CONFIG_FEATURE_TFTP_PUT=y +CONFIG_FEATURE_TFTP_BLOCKSIZE=y # CONFIG_FEATURE_TFTP_PROGRESS_BAR is not set # CONFIG_TFTP_DEBUG is not set -# CONFIG_TRACEROUTE is not set -# CONFIG_TRACEROUTE6 is not set +CONFIG_TRACEROUTE=y +CONFIG_TRACEROUTE6=y # CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set -# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set # CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set -# CONFIG_TUNCTL is not set -# CONFIG_FEATURE_TUNCTL_UG is not set -# CONFIG_UDHCPC6 is not set -# CONFIG_UDHCPD is not set -# CONFIG_DHCPRELAY is not set -# CONFIG_DUMPLEASES is not set -# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set -# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set -CONFIG_DHCPD_LEASES_FILE="" +CONFIG_TUNCTL=y +CONFIG_FEATURE_TUNCTL_UG=y +CONFIG_VCONFIG=y +CONFIG_WGET=y +CONFIG_FEATURE_WGET_STATUSBAR=y +CONFIG_FEATURE_WGET_AUTHENTICATION=y +CONFIG_FEATURE_WGET_LONG_OPTIONS=y +CONFIG_FEATURE_WGET_TIMEOUT=y +CONFIG_FEATURE_WGET_OPENSSL=y +CONFIG_FEATURE_WGET_SSL_HELPER=y +CONFIG_WHOIS=y +CONFIG_ZCIP=y +CONFIG_UDHCPC6=y +CONFIG_UDHCPD=y +CONFIG_DHCPRELAY=y +CONFIG_DUMPLEASES=y +CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY=y +CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC=y +CONFIG_DHCPD_LEASES_FILE="/var/lib/misc/udhcpd.leases" CONFIG_UDHCPC=y CONFIG_FEATURE_UDHCPC_ARPING=y CONFIG_FEATURE_UDHCPC_SANITIZEOPT=y -# CONFIG_FEATURE_UDHCP_PORT is not set -CONFIG_UDHCP_DEBUG=0 +CONFIG_FEATURE_UDHCP_PORT=y +CONFIG_UDHCP_DEBUG=9 CONFIG_FEATURE_UDHCP_RFC3397=y CONFIG_FEATURE_UDHCP_8021Q=y CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script" CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80 CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="" -# CONFIG_UDPSVD is not set -# CONFIG_VCONFIG is not set -# CONFIG_ZCIP is not set # # Print Utilities # -# CONFIG_LPD is not set -# CONFIG_LPR is not set -# CONFIG_LPQ is not set +CONFIG_LPD=y +CONFIG_LPR=y +CONFIG_LPQ=y # # Mail Utilities # -# CONFIG_MAKEMIME is not set -CONFIG_FEATURE_MIME_CHARSET="" -# CONFIG_POPMAILDIR is not set -# CONFIG_FEATURE_POPMAILDIR_DELIVERY is not set -# CONFIG_REFORMIME is not set -# CONFIG_FEATURE_REFORMIME_COMPAT is not set -# CONFIG_SENDMAIL is not set +CONFIG_MAKEMIME=y +CONFIG_POPMAILDIR=y +CONFIG_FEATURE_POPMAILDIR_DELIVERY=y +CONFIG_REFORMIME=y +CONFIG_FEATURE_REFORMIME_COMPAT=y +CONFIG_SENDMAIL=y +CONFIG_FEATURE_MIME_CHARSET="us-ascii" # # Process Utilities # -CONFIG_IOSTAT=y -CONFIG_LSOF=y -CONFIG_MPSTAT=y -# CONFIG_NMETER is not set -CONFIG_PMAP=y -CONFIG_POWERTOP=y -CONFIG_PSTREE=y -CONFIG_PWDX=y -# CONFIG_SMEMCAP is not set -# CONFIG_TOP is not set -# CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE is not set -# CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS is not set -# CONFIG_FEATURE_TOP_SMP_CPU is not set -# CONFIG_FEATURE_TOP_DECIMALS is not set -# CONFIG_FEATURE_TOP_SMP_PROCESS is not set -# CONFIG_FEATURE_TOPMEM is not set -# CONFIG_UPTIME is not set -# CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set CONFIG_FREE=y CONFIG_FUSER=y +CONFIG_IOSTAT=y CONFIG_KILL=y CONFIG_KILLALL=y -# CONFIG_KILLALL5 is not set -# CONFIG_PGREP is not set +CONFIG_KILLALL5=y +CONFIG_LSOF=y +CONFIG_MPSTAT=y +CONFIG_NMETER=y +CONFIG_PGREP=y +CONFIG_PKILL=y CONFIG_PIDOF=y -# CONFIG_FEATURE_PIDOF_SINGLE is not set -# CONFIG_FEATURE_PIDOF_OMIT is not set -# CONFIG_PKILL is not set +CONFIG_FEATURE_PIDOF_SINGLE=y +CONFIG_FEATURE_PIDOF_OMIT=y +CONFIG_PMAP=y +CONFIG_POWERTOP=y CONFIG_PS=y -# CONFIG_FEATURE_PS_WIDE is not set -# CONFIG_FEATURE_PS_LONG is not set +CONFIG_FEATURE_PS_WIDE=y +CONFIG_FEATURE_PS_LONG=y # CONFIG_FEATURE_PS_TIME is not set # CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS is not set # CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set -# CONFIG_RENICE is not set -# CONFIG_BB_SYSCTL is not set -# CONFIG_FEATURE_SHOW_THREADS is not set -# CONFIG_WATCH is not set +CONFIG_PSTREE=y +CONFIG_PWDX=y +CONFIG_RENICE=y +CONFIG_SMEMCAP=y +CONFIG_BB_SYSCTL=y +CONFIG_TOP=y +CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y +CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y +CONFIG_FEATURE_TOP_SMP_CPU=y +CONFIG_FEATURE_TOP_DECIMALS=y +CONFIG_FEATURE_TOP_SMP_PROCESS=y +CONFIG_FEATURE_TOPMEM=y +CONFIG_UPTIME=y +# CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set +CONFIG_WATCH=y +CONFIG_FEATURE_SHOW_THREADS=y # # Runit Utilities # -# CONFIG_RUNSV is not set -# CONFIG_RUNSVDIR is not set +CONFIG_CHPST=y +CONFIG_SETUIDGID=y +CONFIG_ENVUIDGID=y +CONFIG_ENVDIR=y +CONFIG_SOFTLIMIT=y +CONFIG_RUNSV=y +CONFIG_RUNSVDIR=y # CONFIG_FEATURE_RUNSVDIR_LOG is not set -# CONFIG_SV is not set -CONFIG_SV_DEFAULT_SERVICE_DIR="" -# CONFIG_SVLOGD is not set -# CONFIG_CHPST is not set -# CONFIG_SETUIDGID is not set -# CONFIG_ENVUIDGID is not set -# CONFIG_ENVDIR is not set -# CONFIG_SOFTLIMIT is not set +CONFIG_SV=y +CONFIG_SV_DEFAULT_SERVICE_DIR="/var/service" +CONFIG_SVC=y +CONFIG_SVLOGD=y # CONFIG_CHCON is not set # CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set # CONFIG_GETENFORCE is not set # CONFIG_GETSEBOOL is not set # CONFIG_LOAD_POLICY is not set # CONFIG_MATCHPATHCON is not set -# CONFIG_RESTORECON is not set # CONFIG_RUNCON is not set # CONFIG_FEATURE_RUNCON_LONG_OPTIONS is not set # CONFIG_SELINUXENABLED is not set +# CONFIG_SESTATUS is not set # CONFIG_SETENFORCE is not set # CONFIG_SETFILES is not set # CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set +# CONFIG_RESTORECON is not set # CONFIG_SETSEBOOL is not set -# CONFIG_SESTATUS is not set # # Shells # +CONFIG_SH_IS_ASH=y +# CONFIG_SH_IS_HUSH is not set +# CONFIG_SH_IS_NONE is not set +# CONFIG_BASH_IS_ASH is not set +# CONFIG_BASH_IS_HUSH is not set +CONFIG_BASH_IS_NONE=y CONFIG_ASH=y +CONFIG_ASH_OPTIMIZE_FOR_SIZE=y +CONFIG_ASH_INTERNAL_GLOB=y +CONFIG_ASH_RANDOM_SUPPORT=y +CONFIG_ASH_EXPAND_PRMT=y CONFIG_ASH_BASH_COMPAT=y -# CONFIG_ASH_IDLE_TIMEOUT is not set +CONFIG_ASH_IDLE_TIMEOUT=y CONFIG_ASH_JOB_CONTROL=y CONFIG_ASH_ALIAS=y CONFIG_ASH_GETOPTS=y -# CONFIG_ASH_BUILTIN_ECHO is not set +CONFIG_ASH_BUILTIN_ECHO=y CONFIG_ASH_BUILTIN_PRINTF=y CONFIG_ASH_BUILTIN_TEST=y CONFIG_ASH_HELP=y CONFIG_ASH_CMDCMD=y CONFIG_ASH_MAIL=y -# CONFIG_ASH_OPTIMIZE_FOR_SIZE is not set -CONFIG_ASH_RANDOM_SUPPORT=y -# CONFIG_ASH_EXPAND_PRMT is not set -# CONFIG_CTTYHACK is not set +CONFIG_CTTYHACK=y # CONFIG_HUSH is not set # CONFIG_HUSH_BASH_COMPAT is not set # CONFIG_HUSH_BRACE_EXPANSION is not set @@ -1033,33 +1067,31 @@ CONFIG_ASH_RANDOM_SUPPORT=y # CONFIG_HUSH_EXPORT_N is not set # CONFIG_HUSH_MODE_X is not set # CONFIG_MSH is not set -CONFIG_FEATURE_SH_IS_ASH=y -# CONFIG_FEATURE_SH_IS_HUSH is not set -# CONFIG_FEATURE_SH_IS_NONE is not set -# CONFIG_FEATURE_BASH_IS_ASH is not set -# CONFIG_FEATURE_BASH_IS_HUSH is not set -CONFIG_FEATURE_BASH_IS_NONE=y -CONFIG_SH_MATH_SUPPORT=y -# CONFIG_SH_MATH_SUPPORT_64 is not set +CONFIG_FEATURE_SH_MATH=y +CONFIG_FEATURE_SH_MATH_64=y CONFIG_FEATURE_SH_EXTRA_QUIET=y -# CONFIG_FEATURE_SH_STANDALONE is not set +CONFIG_FEATURE_SH_STANDALONE=y # CONFIG_FEATURE_SH_NOFORK is not set CONFIG_FEATURE_SH_HISTFILESIZE=y # # System Logging Utilities # -# CONFIG_SYSLOGD is not set -# CONFIG_FEATURE_ROTATE_LOGFILE is not set -# CONFIG_FEATURE_REMOTE_LOG is not set -# CONFIG_FEATURE_SYSLOGD_DUP is not set -# CONFIG_FEATURE_SYSLOGD_CFG is not set -CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=0 -# CONFIG_FEATURE_IPC_SYSLOG is not set -CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=0 -# CONFIG_LOGREAD is not set -# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set -# CONFIG_FEATURE_KMSG_SYSLOG is not set -# CONFIG_KLOGD is not set -# CONFIG_FEATURE_KLOGD_KLOGCTL is not set -# CONFIG_LOGGER is not set +CONFIG_KLOGD=y + +# +# klogd should not be used together with syslog to kernel printk buffer +# +CONFIG_FEATURE_KLOGD_KLOGCTL=y +CONFIG_LOGGER=y +CONFIG_LOGREAD=y +CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING=y +CONFIG_SYSLOGD=y +CONFIG_FEATURE_ROTATE_LOGFILE=y +CONFIG_FEATURE_REMOTE_LOG=y +CONFIG_FEATURE_SYSLOGD_DUP=y +CONFIG_FEATURE_SYSLOGD_CFG=y +CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256 +CONFIG_FEATURE_IPC_SYSLOG=y +CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16 +CONFIG_FEATURE_KMSG_SYSLOG=y diff --git a/system/base/busybox/pspec.xml b/system/base/busybox/pspec.xml index c6c71c63..d685eca5 100644 --- a/system/base/busybox/pspec.xml +++ b/system/base/busybox/pspec.xml @@ -12,14 +12,14 @@ app:console Statically linked binary providing simplified versions of system commands busybox is a single binary which includes versions of a large number of system commands, including a shell. - http://busybox.net/downloads/busybox-1.24.1.tar.bz2 + https://busybox.net/downloads/busybox-1.25.1.tar.bz2 config - + @@ -33,6 +33,13 @@ + + 2017-01-28 + 1.25.1 + Release Bump. + Stefan Gronewold(groni) + groni@pisilinux.org + 2016-04-27 1.24.1 diff --git a/system/base/cryptsetup/pspec.xml b/system/base/cryptsetup/pspec.xml index 936d6a23..a109d805 100644 --- a/system/base/cryptsetup/pspec.xml +++ b/system/base/cryptsetup/pspec.xml @@ -13,7 +13,7 @@ app:cli Userspace setup tool for transparent encryption of block devices using dm-crypt Userspace setup tool for transparent encryption of block devices using dm-crypt - https://www.kernel.org/pub/linux/utils/cryptsetup/v1.7/cryptsetup-1.7.1.tar.xz + https://www.kernel.org/pub/linux/utils/cryptsetup/v1.7/cryptsetup-1.7.3.tar.xz device-mapper-devel libgpg-error-devel @@ -82,6 +82,13 @@ + + 2017-01-29 + 1.7.3 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + 2016-04-27 1.7.1 diff --git a/system/base/dhcpcd/pspec.xml b/system/base/dhcpcd/pspec.xml index 529e43ca..42d04a52 100644 --- a/system/base/dhcpcd/pspec.xml +++ b/system/base/dhcpcd/pspec.xml @@ -12,7 +12,7 @@ app:console A dhcp client only An RFC2131 and RFC1541 compliant DHCP client daemon. dhcpcd gets an IP address and other information from a corresponding DHCP server, configures the network interface automatically, and tries to renew the lease time according to RFC2131 or RFC1541 depending on the command line option. - http://ftp.osuosl.org/pub/blfs/conglomeration/dhcpcd/dhcpcd-6.10.1.tar.xz + http://ftp.osuosl.org/pub/blfs/conglomeration/dhcpcd/dhcpcd-6.11.5.tar.xz @@ -30,6 +30,13 @@ + + 2017-01-29 + 6.11.5 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + 2016-04-27 6.10.1 diff --git a/system/base/e2fsprogs/actions.py b/system/base/e2fsprogs/actions.py index 7e629d89..231a83fc 100644 --- a/system/base/e2fsprogs/actions.py +++ b/system/base/e2fsprogs/actions.py @@ -38,4 +38,4 @@ def install(): # Unneeded stuff pisitools.remove("/usr/lib/*.a") - pisitools.dodoc("COPYING", "README", "RELEASE-NOTES") + pisitools.dodoc("README", "RELEASE-NOTES") diff --git a/system/base/e2fsprogs/pspec.xml b/system/base/e2fsprogs/pspec.xml index 935d9e4a..920fd436 100644 --- a/system/base/e2fsprogs/pspec.xml +++ b/system/base/e2fsprogs/pspec.xml @@ -12,12 +12,12 @@ app:console Standard ext2/3/4 filesystem utilities e2fsprogs provides the filesystem utilities for use with the ext2 filesystem. It also supports the ext3/4 filesystem with journaling support. - mirrors://sourceforge/e2fsprogs/e2fsprogs-1.42.13.tar.gz + mirrors://sourceforge/e2fsprogs/e2fsprogs-1.43.3.tar.gz libutil-linux-devel - gettext-devel + gettext @@ -66,6 +66,13 @@ + + 2017-01-29 + 1.43.3 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + 2016-04-27 1.42.13 diff --git a/system/base/fuse/actions.py b/system/base/fuse/actions.py index 048cee20..6f5f928c 100644 --- a/system/base/fuse/actions.py +++ b/system/base/fuse/actions.py @@ -6,13 +6,15 @@ from pisi.actionsapi import get from pisi.actionsapi import autotools from pisi.actionsapi import pisitools +from pisi.actionsapi import shelltools def setup(): - autotools.autoreconf("-vif") - + shelltools.system("sh makeconf.sh") + # Disable device node creation during build/install pisitools.dosed("util/Makefile.in", "mknod", "echo Disabled: mknod ") + autotools.configure("--disable-static \ --disable-rpath \ --enable-lib \ diff --git a/system/base/fuse/pspec.xml b/system/base/fuse/pspec.xml index 37bd2fe7..310f74f3 100644 --- a/system/base/fuse/pspec.xml +++ b/system/base/fuse/pspec.xml @@ -12,7 +12,7 @@ library An interface for filesystems implemented in userspace fuse is a backend allowing regular users to (un)mount filesystems for their own use. - https://github.com/libfuse/libfuse/releases/download/fuse_2_9_5/fuse-2.9.5.tar.gz + https://github.com/libfuse/libfuse/archive/fuse-2.9.7.tar.gz gettext-devel @@ -50,6 +50,13 @@ + + 2017-01-29 + 2.9.7 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + 2016-04-27 2.9.5 diff --git a/system/base/gperf/pspec.xml b/system/base/gperf/pspec.xml index e7449f57..2fbc6f6a 100644 --- a/system/base/gperf/pspec.xml +++ b/system/base/gperf/pspec.xml @@ -12,7 +12,7 @@ app:console A perfect hash function generator gperf is a perfect hash function generator. For a given list of strings, it produces a hash function and hash table, in form of C or C++ code, for looking up a value depending on the input string. The hash function is perfect, which means that the hash table has no collisions, and the hash table lookup needs a single string comparison only. - mirrors://gnu/gperf/gperf-3.0.4.tar.gz + mirrors://gnu/gperf/gperf-3.1.tar.gz @@ -29,6 +29,13 @@ + + 2017-01-29 + 3.1 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + 2016-04-27 3.0.4 diff --git a/system/base/help2man/pspec.xml b/system/base/help2man/pspec.xml index 6d549100..37fdec57 100644 --- a/system/base/help2man/pspec.xml +++ b/system/base/help2man/pspec.xml @@ -37,6 +37,13 @@ + + 2017-01-28 + 1.47.3 + Release Bump + PisiLinux Community + admin@pisilinux.org + 2016-04-27 1.47.3 @@ -52,4 +59,4 @@ alihan@pisilinux.org - + \ No newline at end of file diff --git a/system/base/json-c/pspec.xml b/system/base/json-c/pspec.xml index ca346a40..51a94b56 100644 --- a/system/base/json-c/pspec.xml +++ b/system/base/json-c/pspec.xml @@ -12,7 +12,7 @@ library A JSON implementation in C json-c implements a reference counting object model that allows you to easily construct JSON objects in C, output them as JSON formatted strings and parse JSON formatted strings back into the C representation of JSON objects. - https://github.com/json-c/json-c/archive/json-c-0.12-20140410.tar.gz + https://s3.amazonaws.com/json-c_releases/releases/json-c-0.12.1.tar.gz wno-werror.patch @@ -55,6 +55,13 @@ + + 2017-01-29 + 0.12.1 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + 2016-04-27 0.12 diff --git a/system/base/kbd/pspec.xml b/system/base/kbd/pspec.xml index 1a067520..8bf8f608 100644 --- a/system/base/kbd/pspec.xml +++ b/system/base/kbd/pspec.xml @@ -12,10 +12,10 @@ app:console Keyboard and console utilities The kbd package contains keytable files and keyboard utilities compatible with kernel version 1.1.54 and later. - https://www.kernel.org/pub/linux/utils/kbd/kbd-2.0.3.tar.xz - http://source.pisilinux.org/1.0/kbd-latarcyrheb-16-fixed.tar.bz2 - http://source.pisilinux.org/1.0/kbd-latsun-fonts.tar.bz2 - http://source.pisilinux.org/1.0/ro_maps.tar.bz2 + https://www.kernel.org/pub/linux/utils/kbd/kbd-2.0.4.tar.xz + http://source.pisilinux.org/1.0/kbd-latarcyrheb-16-fixed.tar.bz2 + http://source.pisilinux.org/1.0/kbd-latsun-fonts.tar.bz2 + http://source.pisilinux.org/1.0/ro_maps.tar.bz2 gettext gzip @@ -72,6 +72,13 @@ + + 2017-01-29 + 2.0.4 + Release Bump + PisiLinux Community + admin@pisilinux.org + 2016-04-27 2.0.3 diff --git a/system/base/pciutils/pspec.xml b/system/base/pciutils/pspec.xml index 265b4cbf..dab03e22 100644 --- a/system/base/pciutils/pspec.xml +++ b/system/base/pciutils/pspec.xml @@ -12,13 +12,17 @@ app:console Various utilities dealing with the PCI bus The PCI Utilities are a collection of programs for inspecting and manipulating configuration of PCI devices. - ftp://ftp.kernel.org/pub/software/utils/pciutils/pciutils-3.4.1.tar.xz + ftp://ftp.kernel.org/pub/software/utils/pciutils/pciutils-3.5.2.tar.xz pci.ids + + eudev-devel + libkmod-devel + pciutils-nogz.patch @@ -58,6 +62,13 @@ + + 2017-01-29 + 3.5.2 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + 2016-04-27 3.4.1 diff --git a/system/base/polkit/pspec.xml b/system/base/polkit/pspec.xml index ad6a768b..50703acb 100644 --- a/system/base/polkit/pspec.xml +++ b/system/base/polkit/pspec.xml @@ -83,6 +83,13 @@ + + 2017-01-29 + 0.113 + Rebuild. + Ertuğrul Erata + ertugrulerata@gmail.com + 2016-04-27 0.113 diff --git a/system/base/spidermonkey/pspec.xml b/system/base/spidermonkey/pspec.xml index b7664018..e7a2a244 100644 --- a/system/base/spidermonkey/pspec.xml +++ b/system/base/spidermonkey/pspec.xml @@ -54,6 +54,13 @@ + + 2017-01-29 + 17.0.0 + Rebuild. + Ertuğrul Erata + ertugrulerata@gmail.com + 2016-04-27 17.0.0 diff --git a/system/base/tcp-wrappers/pspec.xml b/system/base/tcp-wrappers/pspec.xml index e8b68aa9..9866bc82 100644 --- a/system/base/tcp-wrappers/pspec.xml +++ b/system/base/tcp-wrappers/pspec.xml @@ -65,6 +65,13 @@ + + 2017-01-28 + 7.6 + Release Bump + PisiLinux Community + admin@pisilinux.org + 2016-04-27 7.6 @@ -80,4 +87,4 @@ alihan@pisilinux.org - + \ No newline at end of file diff --git a/system/devel/check/pspec.xml b/system/devel/check/pspec.xml index 74760065..ddae7e8c 100644 --- a/system/devel/check/pspec.xml +++ b/system/devel/check/pspec.xml @@ -48,6 +48,13 @@ + + 2017-01-29 + 0.10.0 + Rebuild. + Ertuğrul Erata + ertugrulerata@gmail.com + 2016-04-27 0.10.0 diff --git a/system/devel/dietlibc/pspec.xml b/system/devel/dietlibc/pspec.xml index 4933f06d..c63b5739 100644 --- a/system/devel/dietlibc/pspec.xml +++ b/system/devel/dietlibc/pspec.xml @@ -34,6 +34,13 @@ + + 2017-01-29 + 0.33.20120825 + Release Bump + PisiLinux Community + admin@pisilinux.org + 2016-04-27 0.33.20120825 diff --git a/system/devel/isl/pspec.xml b/system/devel/isl/pspec.xml index e2d681a0..1b5dbcfe 100644 --- a/system/devel/isl/pspec.xml +++ b/system/devel/isl/pspec.xml @@ -12,7 +12,7 @@ library Integer Set Library isl is a library for manipulating sets and relations of integer points bounded by linear constraints. - http://isl.gforge.inria.fr/isl-0.16.1.tar.bz2 + http://isl.gforge.inria.fr/isl-0.18.tar.bz2 gmp-devel @@ -42,6 +42,13 @@ + + 2017-01-27 + 0.18 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + 2016-04-27 0.16.1 diff --git a/system/devel/m4/pspec.xml b/system/devel/m4/pspec.xml index b3e4d1e0..fe6a77ee 100644 --- a/system/devel/m4/pspec.xml +++ b/system/devel/m4/pspec.xml @@ -12,10 +12,10 @@ app:console GNU macro processor The m4 utility is a macro processor that shall read one or more text files, process them according to their included macro statements, and write the results to standard output - mirrors://gnu/m4/m4-1.4.17.tar.gz + mirrors://gnu/m4/m4-1.4.18.tar.xz - gettext-devel - libsigsegv + gettext + libsigsegv-devel @@ -33,6 +33,13 @@ + + 2017-01-27 + 1.4.18 + Version bump. + Ertuğrul Erata + ertugrulerata@gmail.com + 2016-04-27 1.4.17 diff --git a/system/devel/xcb-proto/pspec.xml b/system/devel/xcb-proto/pspec.xml index 9d56dec2..bfa81ff2 100644 --- a/system/devel/xcb-proto/pspec.xml +++ b/system/devel/xcb-proto/pspec.xml @@ -12,7 +12,7 @@ data XCB protocol descriptions XCB is a project to enable efficient language bindings to the X11 protocol. This package contains the protocol descriptions themselves. Language bindings use these protocol descriptions to generate code for marshalling the protocol. - http://xcb.freedesktop.org/dist/xcb-proto-1.11.tar.bz2 + https://xcb.freedesktop.org/dist/xcb-proto-1.12.tar.bz2 libxml2 @@ -29,6 +29,13 @@ + + 2017-01-27 + 1.12 + Version Bump + PisiLinux Community + admin@pisilinux.org + 2016-04-27 1.11 diff --git a/system/devel/xorg-proto/pspec.xml b/system/devel/xorg-proto/pspec.xml index 794c8261..0af7d97d 100644 --- a/system/devel/xorg-proto/pspec.xml +++ b/system/devel/xorg-proto/pspec.xml @@ -38,7 +38,7 @@ mirrors://xorg/individual/proto/xf86driproto-2.1.1.tar.bz2 mirrors://xorg/individual/proto/xf86vidmodeproto-2.3.1.tar.bz2 mirrors://xorg/individual/proto/xineramaproto-1.2.1.tar.bz2 - mirrors://xorg/individual/proto/xproto-7.0.28.tar.gz + mirrors://xorg/individual/proto/xproto-7.0.31.tar.gz mirrors://xorg/individual/proto/xproxymanagementprotocol-1.0.3.tar.bz2 https://github.com/bbidulock/vncproto/releases/download/vncproto-1.1/vncproto-1.1.tar.bz2 @@ -65,6 +65,13 @@ + + 2017-01-27 + 7.6 + xproto updates + PisiLinux Community + admin@pisilinux.org + 2016-04-27 7.6