1 /* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. 2 3 This program is free software; you can redistribute it and/or modify 4 it under the terms of the GNU General Public License, version 2.0, 5 as published by the Free Software Foundation. 6 7 This program is also distributed with certain software (including 8 but not limited to OpenSSL) that is licensed under separate terms, 9 as designated in a particular file or component or in included license 10 documentation. The authors of MySQL hereby grant you an additional 11 permission to link the program and your derivative works with the 12 separately licensed software that they have included with MySQL. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License, version 2.0, for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program; if not, write to the Free Software 21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 22 23 #ifndef NDB_LS_IMPL_HPP 24 #define NDB_LS_IMPL_HPP 25 26 #include "LongSignal.hpp" 27 28 #ifdef NDBD_MULTITHREADED 29 #include "mt.hpp" 30 #define SPC_ARG SectionSegmentPool::Cache& cache, 31 #define SPC_SEIZE_ARG f_section_lock, cache, 32 #define SPC_CACHE_ARG cache, 33 static 34 SectionSegmentPool::LockFun 35 f_section_lock = 36 { 37 mt_section_lock, 38 mt_section_unlock 39 }; 40 #else 41 #define SPC_ARG 42 #define SPC_SEIZE_ARG 43 #define SPC_CACHE_ARG 44 #endif 45 46 47 #define JAM_FILE_ID 228 48 49 /* Calculate number of segments to release based on section size 50 * Always release one segment, even if size is zero 51 */ 52 #define relSz(x) ((x == 0)? 1 : ((x + SectionSegment::DataLength - 1) / SectionSegment::DataLength)) 53 54 bool import(SPC_ARG Ptr<SectionSegment> & first, const Uint32 * src, Uint32 len); 55 56 /* appendToSection : If firstSegmentIVal == RNIL, import */ 57 bool appendToSection(SPC_ARG Uint32& firstSegmentIVal, const Uint32* src, Uint32 len); 58 /* dupSection : Create new section as copy of src section */ 59 bool dupSection(SPC_ARG Uint32& copyFirstIVal, Uint32 srcFirstIVal); 60 /* writeToSection : Overwrite section from offset with data. */ 61 bool writeToSection(Uint32 firstSegmentIVal, Uint32 offset, const Uint32* src, Uint32 len); 62 63 void release(SPC_ARG SegmentedSectionPtr & ptr); 64 void releaseSection(SPC_ARG Uint32 firstSegmentIVal); 65 66 67 #undef JAM_FILE_ID 68 69 #endif 70