1 /* Copyright (c) 2008, 2011, 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 Street, 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 /* Calculate number of segments to release based on section size 47 * Always release one segment, even if size is zero 48 */ 49 #define relSz(x) ((x == 0)? 1 : ((x + SectionSegment::DataLength - 1) / SectionSegment::DataLength)) 50 51 bool import(SPC_ARG Ptr<SectionSegment> & first, const Uint32 * src, Uint32 len); 52 53 /* appendToSection : If firstSegmentIVal == RNIL, import */ 54 bool appendToSection(SPC_ARG Uint32& firstSegmentIVal, const Uint32* src, Uint32 len); 55 /* dupSection : Create new section as copy of src section */ 56 bool dupSection(SPC_ARG Uint32& copyFirstIVal, Uint32 srcFirstIVal); 57 /* writeToSection : Overwrite section from offset with data. */ 58 bool writeToSection(Uint32 firstSegmentIVal, Uint32 offset, const Uint32* src, Uint32 len); 59 60 void release(SPC_ARG SegmentedSectionPtr & ptr); 61 void releaseSection(SPC_ARG Uint32 firstSegmentIVal); 62 63 #endif 64