├── .gitignore ├── CMakeLists.txt ├── LGPLv21_license.txt ├── README.md ├── agent ├── 00_README.txt ├── CMakeLists.txt ├── agent_common.h ├── agent_config.h ├── agent_helper.c ├── agent_helper.h ├── agent_sm.c ├── agent_wrapper.sh ├── fdf_agent.c └── fdf_agent.h ├── api ├── CMakeLists.txt ├── Makefile.sdk ├── async_commands.c ├── cmap.c ├── cmap.h ├── cmap_hash.c ├── cmap_hash.h ├── cmap_internal.h ├── core.gdb ├── enumerate.c ├── fdf.c ├── fdf_cmap.c ├── fdf_hash.c ├── fdf_hash.h ├── fdf_internal.h ├── fdf_internal_cb.h ├── fdf_tlmap.c ├── fdf_tlmap.h ├── fdf_tlmap_internal.h ├── lc.c ├── lc.h ├── licensed.c ├── main.c ├── nvr_svc.c ├── nvr_svc.h ├── sdf.h ├── sdf_internal.h ├── stats.c ├── tests │ ├── CMakeLists.txt │ ├── FDF_AsyncDeletion.c │ ├── FDF_Async_Deletion2.c │ ├── FDF_CloseContainer.c │ ├── FDF_DeleteContainer.c │ ├── FDF_DeleteObject.c │ ├── FDF_EnumerateContainerObjects.c │ ├── FDF_FinishEnumeration.c │ ├── FDF_FlushCache.c │ ├── FDF_FlushContainer.c │ ├── FDF_FlushObject.c │ ├── FDF_GetContainerProps.c │ ├── FDF_GetContainerStats.c │ ├── FDF_GetContainers.c │ ├── FDF_GetStats.c │ ├── FDF_Init.c │ ├── FDF_LoadProperties.c │ ├── FDF_OpenContainer.c │ ├── FDF_Pstats.c │ ├── FDF_RangeQuery.c │ ├── FDF_ReadObject.c │ ├── FDF_RenameContainer.c │ ├── FDF_SetContainerProps.c │ ├── FDF_ShutdownCont.c │ ├── FDF_ShutdownIO.c │ ├── FDF_Stats.c │ ├── FDF_WriteObject.c │ ├── FDF_WritebackStoreMode1.c │ ├── FDF_WritebackStoreMode2.c │ ├── FDF_WritebackStoreMode3.c │ ├── FDF_WritebackStoreMode4.c │ ├── FDF_WritebackStoreMode5.c │ ├── FDF_WritebackStoreMode6.c │ ├── FDF_compress.c │ ├── Makefile.sample │ ├── Makefile.sdk │ ├── backup │ │ ├── fdf_prop_test.c │ │ ├── fdf_static_test.c │ │ └── sdf_stress_test.c │ ├── btree │ │ ├── CMakeLists.txt │ │ ├── FDF_Write_mthreads.c │ │ ├── conf │ │ │ ├── fdf.prop │ │ │ └── fdf_sample.prop │ │ ├── fdf_big_writes.c │ │ ├── fdf_err_handle.c │ │ ├── fdf_mput.c │ │ ├── fdf_mput_pstats.c │ │ ├── fdf_rangeupdate.c │ │ ├── fdf_scavenger.c │ │ ├── fdf_snapshot.c │ │ ├── mput_perf_time.c │ │ ├── rangeupdate_perf.c │ │ └── split_test.c │ ├── conf │ │ ├── fdf.prop │ │ ├── fdf_sample.prop │ │ ├── zs.prop │ │ └── zs_sample.prop │ ├── core │ │ ├── CMakeLists.txt │ │ ├── fdf_slab_gc.c │ │ └── zs_group_commit.c │ ├── disabled │ │ ├── FDF_MissAlways.c │ │ ├── FDF_NextEnumeratedObject.c │ │ ├── FDF_ReadObjectExpiry.c │ │ ├── FDF_SetProperty.c │ │ └── fdf_mini_trx_api.c │ ├── fdf_multi_test.c │ ├── misc │ │ ├── CMakeLists.txt │ │ ├── FDF_Listen.c │ │ ├── ZS_Listen.c │ │ └── gc_admin.sh │ ├── sample_program.c │ ├── test.c │ ├── test.h │ ├── zs_mt_rename_test.c │ └── zs_rename_test.c └── zs.h ├── applib ├── README ├── XLock.c ├── XLock.h ├── XLockTest.c ├── XMbox.c ├── XMbox.h ├── fthFlashAccess.c ├── fthFlashAccess.h ├── ftopMboxTest.c ├── ptofMboxTest.c ├── simpleWait.c ├── simpleWait.h └── simpleWaitTest.c ├── btree ├── CMakeLists.txt ├── btree.c ├── btree.gdb ├── btree.h ├── btree_hash.c ├── btree_hash.h ├── btree_internal.h ├── btree_malloc.c ├── btree_malloc.h ├── btree_map.c ├── btree_map.h ├── btree_map_internal.h ├── btree_mem.c ├── btree_pmap.c ├── btree_pmap.h ├── btree_range.c ├── btree_range.h ├── btree_raw.c ├── btree_raw.h ├── btree_raw_internal.h ├── btree_raw_range.c ├── btree_recovery.c ├── btree_scavenger.c ├── btree_scavenger.h ├── btree_snapshot.c ├── btree_sync_mbox.c ├── btree_sync_mbox.h ├── btree_sync_th.c ├── btree_sync_th.h ├── btree_var_leaf.c ├── btree_var_leaf.h ├── fdf_wrapper.c ├── packet.c ├── packet.h ├── range.txt ├── tests │ ├── CMakeLists.txt │ ├── btest_common.c │ ├── btest_common.h │ ├── btest_life_cycle.c │ ├── btest_range.c │ └── query_perf_comp.c ├── trx.c ├── trx.h └── trxcmd.h ├── build_zs_sdk.sh ├── cmake_old ├── CMakeLists.txt ├── api │ └── tests │ │ ├── CMakeLists.txt │ │ └── btree │ │ └── CMakeLists.txt ├── btree │ ├── CMakeLists.txt │ └── tests │ │ └── CMakeLists.txt └── dll │ └── CMakeLists.txt ├── cmds ├── CMakeLists.txt └── fdflicense.c ├── common ├── fdfstats.h ├── fdftypes.h ├── sdf_properties.h ├── sdfstats.h ├── sdftypes.h ├── str_sdftypes.h └── zstypes.h ├── dll ├── CMakeLists.txt ├── README ├── bin │ └── mkfdfdll ├── test │ ├── CMakeLists.txt │ ├── fdf_easy.c │ ├── fdf_easy.h │ ├── fdf_easy_int.h │ ├── fdf_errs.c │ ├── t2.prop │ ├── test.c │ ├── test.h │ ├── test.prop │ ├── test_enum1.c │ ├── test_hello.c │ ├── test_t1.c │ ├── test_t2.c │ ├── test_t3.c │ ├── test_t4.c │ ├── test_t5.c │ ├── tlib.c │ ├── tlib.h │ ├── xstr.c │ └── xstr.h └── zs_dll.c ├── doc ├── FDF1.2_DesignDocument.docx ├── FDF_programming_guide.docx └── ZS_QuickStart_guide.docx ├── ecc ├── CMakeLists.txt ├── discrete_math.c ├── discrete_math.h ├── ecc_recover.c ├── ecc_recover.h ├── ecc_size.pl ├── ecc_test.c ├── lfsr.c ├── lfsr.h └── read_eccpage.pl ├── flash └── flash.h ├── flip ├── flip.c ├── flip.h ├── flip_cmd.c └── zs.flip ├── fth ├── AIOTrace │ ├── README │ ├── aiotrace.h │ ├── hash.c │ ├── hash.h │ ├── main.c │ ├── tlmap.c │ ├── tlmap.h │ ├── xtlmap.c │ └── xtlmap.h ├── CMakeLists.txt ├── LockTrace │ ├── README │ ├── Sample_Run_Script │ ├── hash.c │ ├── hash.h │ ├── locktite.h │ ├── main.c │ ├── tlmap.c │ ├── tlmap.h │ ├── xtlmap.c │ └── xtlmap.h ├── README ├── archive │ ├── fth.c │ ├── fthDispatchQ.c │ ├── fthDispatchQ.h │ ├── fthIdleTest.c │ ├── fthLockSpeed.c │ ├── fthMPTest.c │ ├── fthRcuListTest.c │ ├── fthSignalTest.c │ ├── fthSparseTest.c │ ├── fthSpeed.c │ ├── fthTest.c │ ├── fth_c_1_test.c │ ├── fth_c_2_test.c │ ├── fth_c_3_test.c │ ├── fth_float.c │ ├── fth_lll_test.c │ ├── fth_lock_test.c │ ├── fth_mbox_test.c │ ├── fth_mem_test.c │ ├── fth_mutex_test.c │ ├── fth_printf_test.c │ ├── fth_std.c │ ├── fth_xlock_1_test.c │ ├── fth_xlock_2_test.c │ ├── fth_xlock_3_test.c │ ├── fth_xlock_4_test.c │ ├── fth_xlock_5_test.c │ ├── fth_xmbox_1_test.c │ ├── fth_xmbox_2_test.c │ ├── fth_xmbox_3_test.c │ ├── fth_xmbox_4_test.c │ ├── lock_test.c │ ├── lock_test.pl │ ├── pthreadLockSpeed.c │ └── pthreadSpeed.c ├── fth.c ├── fth.gdb ├── fth.h ├── fthCv.c ├── fthCv.h ├── fthCvTest.c ├── fthDispatch.h ├── fthGetTimeSpeed.c ├── fthIdleControl.c ├── fthIdleControl.h ├── fthIdleControl_c.h ├── fthIdleTest.c ├── fthLock.c ├── fthLock.h ├── fthMPTest.c ├── fthMbox.c ├── fthMbox.h ├── fthMem.c ├── fthMem.h ├── fthMonotonicTest.c ├── fthMutex.c ├── fthMutex.h ├── fthOpt.c ├── fthOpt.h ├── fthRcu.c ├── fthSched.h ├── fthSchedType.h ├── fthSem.c ├── fthSem.h ├── fthSignal.c ├── fthSignal.h ├── fthSignalTest.c ├── fthSocket.c ├── fthSocket.h ├── fthSparseLock.c ├── fthSparseLock.h ├── fthSparseTest.c ├── fthSpeed.c ├── fthSpinLock.h ├── fthStructQ.c ├── fthStructQ.h ├── fthTest.c ├── fthThread.S ├── fthThread.h ├── fthThreadQ.c ├── fthThreadQ.h ├── fthThreadQDefines.h ├── fthTrace.c ├── fthTrace.h ├── fthWaitEl.h ├── fthWaitQ.c ├── fthXLock.c ├── fthXLock.h ├── fthXMbox.c ├── fthXMbox.h ├── fthlll.h ├── fthlllUndef.h └── fthlll_c.h ├── license ├── CMakeLists.txt ├── interface.c ├── interface.h ├── utils.cpp ├── utils.h ├── version_1_0 │ ├── interface.c │ ├── interface.h │ ├── license.cpp │ └── license.h ├── version_2_0 │ ├── interface.c │ ├── interface.h │ ├── license │ ├── license.cpp │ └── license.h ├── versions.c └── versions.h ├── misc ├── CMakeLists.txt ├── Makefile.inc ├── misc.h ├── parse_int.c ├── parse_int32.c ├── parse_reseed.c ├── parse_size.c ├── parse_string.c ├── parse_string_alloc.c ├── parse_time.c ├── parse_uint.c ├── parse_uint64.c ├── seed.c ├── stop.c └── timeout.c ├── physmem ├── 60-schooner.rules ├── memcat.c ├── physmem.h ├── physmem_driver.c ├── physmem_ioctl.c ├── test.sh └── verify_od.pl ├── platform ├── 00_README.txt ├── CMakeLists.txt ├── aio_api.c ├── aio_api.h ├── aio_api_internal.h ├── aio_error_bdb.c ├── aio_error_bdb.h ├── aio_error_control.c ├── aio_error_control.h ├── aio_error_control_internal.h ├── aio_libaio.c ├── aio_libaio.h ├── aio_wc.c ├── aio_wc.h ├── alloc.c ├── alloc.h ├── alloc_stack.c ├── alloc_stack.h ├── aoset.c ├── aoset.h ├── assert.c ├── assert.h ├── atomic_debug.h ├── attr.c ├── attr.h ├── closure.h ├── coredump_filter.c ├── cpu_peers.c ├── defs.h ├── epoll.c ├── epoll.h ├── errno.h ├── event.c ├── event.h ├── fcntl.c ├── fcntl.h ├── fd.c ├── fd_dispatcher.c ├── fd_dispatcher.h ├── ffdc_log.mc ├── ffdc_parser.pl ├── file.c ├── fork.c ├── fth_scheduler.c ├── fth_scheduler.h ├── get_exe.c ├── gvptr.h ├── logging.c ├── logging.h ├── malloccheck.c ├── mbox_scheduler.c ├── mbox_scheduler.h ├── mem_debug.cc ├── mem_debug.h ├── memory_fault.c ├── memory_size.c ├── mman.c ├── mman.h ├── mprobe.c ├── msg.c ├── msg.h ├── mutex.c ├── mutex.h ├── once.h ├── opts.h ├── opts_c.h ├── opts_enum.h ├── platexits.h ├── platform.h ├── printf.c ├── private │ ├── process.h │ ├── sa_arena_list_global.h │ ├── sa_arena_list_local.h │ ├── shmem_internal.h │ └── shmem_msgs.h ├── prng.c ├── prng.h ├── process.c ├── random.c ├── rwlock.c ├── rwlock.h ├── select.h ├── shm.h ├── shmem.c ├── shmem.gdb ├── shmem.h ├── shmem_alloc.c ├── shmem_alloc.gdb ├── shmem_arena.h ├── shmem_c.h ├── shmem_client.c ├── shmem_debug.c ├── shmem_debug.h ├── shmem_global.c ├── shmem_global.h ├── shmem_ptrs.c ├── shmem_ptrs.h ├── shmem_test.c ├── shmemd │ ├── shmemd.c │ └── shmemd.c+ ├── signal.h ├── socket.c ├── socket.h ├── spin.h ├── spin_rw.h ├── stat.h ├── stats.c ├── stats.h ├── stdio.h ├── stdlib.h ├── strarray_alloc.c ├── string.c ├── string.h ├── sysvipc.c ├── tests │ ├── aio_test.c │ ├── alloc_arenatest.c │ ├── alloc_stacktest.c │ ├── asserttest.c │ ├── closuretest.c │ ├── cpu_peertest.c │ ├── fast_logtest.c │ ├── invert_no_core.sh │ ├── logtest.c │ ├── mbox_schedulertest.c │ ├── mem_debug │ │ ├── mem_debug_stress_test.cc │ │ ├── mem_debug_test.c │ │ ├── test_mem_debug_one.c │ │ ├── test_mem_debug_one.h │ │ ├── testall.c │ │ └── testall.h │ ├── oncetest.c │ ├── opttest.c │ ├── shmemtest_aoset.c │ ├── shmemtest_multi.c │ ├── shmemtest_one.c │ ├── shmemtest_phys.c │ ├── shmemtest_phys.gdb │ ├── shmemtest_plat_alloc.c │ ├── shmemtest_sbt.c │ ├── spin_rwtest.c │ └── timer_dispatchertest.c ├── thread.c ├── thread.h ├── time.c ├── time.h ├── timer_dispatcher.c ├── timer_dispatcher.gdb ├── timer_dispatcher.h ├── tmp_path.c ├── tool │ ├── hotkey │ │ ├── CMakeLists.txt │ │ ├── Hotkey_Manual │ │ ├── README │ │ ├── ht_alloc.c │ │ ├── ht_alloc.h │ │ ├── ht_report.c │ │ ├── ht_report.h │ │ ├── ht_snapshot.c │ │ ├── ht_snapshot.h │ │ ├── ht_types.h │ │ ├── perf │ │ │ ├── cmd_modified │ │ │ ├── hotkey.config │ │ │ ├── hotkey_perf.pl │ │ │ ├── perf_parse.sh │ │ │ ├── runhotkey.sh │ │ │ └── runms.sh │ │ ├── snapshot │ │ │ ├── hotkey │ │ │ ├── hotkey.pl │ │ │ └── hotkey_logrotate │ │ ├── tests │ │ │ ├── CMakeLists.txt │ │ │ ├── README │ │ │ ├── auto_file_cmp │ │ │ ├── file_cmp_util.pl │ │ │ ├── hotkey_image_test │ │ │ ├── hotkey_rps_test │ │ │ ├── hotkey_stable_test │ │ │ ├── hotkey_test_ports │ │ │ ├── ht_all_rpts.c │ │ │ ├── ht_candidate_win.c │ │ │ ├── ht_compete_winners.c │ │ │ ├── ht_rpt_test.c │ │ │ ├── ht_unit_test │ │ │ ├── ht_winner_lose.c │ │ │ ├── ht_winner_lose_win.c │ │ │ ├── test_main.c │ │ │ ├── test_main.h │ │ │ └── unit_test.sh │ │ └── viewer │ │ │ └── hotkey_viewer │ ├── util_trace_collector.c │ ├── util_trace_viewer.c │ ├── util_trace_viewer.h │ └── util_txt2bin_replace.pl ├── types.h ├── unistd.h ├── util_trace.c ├── util_trace.h ├── wait.h ├── wrap.h └── wrap.h.laptop ├── protocol ├── CMakeLists.txt ├── Tools │ └── stopleak │ │ ├── do1 │ │ ├── dogdb │ │ ├── hash.c │ │ ├── hash.h │ │ ├── main.c │ │ ├── stopleak.h │ │ ├── tlmap.c │ │ ├── tlmap.h │ │ ├── xtlmap.c │ │ └── xtlmap.h ├── action │ ├── CMakeLists.txt │ ├── action_internal_ctxt.h │ ├── action_new.c │ ├── action_new.h │ ├── action_thread.h │ ├── appbuf_pool.c │ ├── appbuf_pool.h │ ├── appbuf_pool_internal.h │ ├── async_puts.c │ ├── async_puts.h │ ├── fastcc_new.c │ ├── fastcc_new.h │ ├── nslabs.c │ ├── object_pool_internal.h │ ├── recovery.h │ ├── response_tbl.c │ ├── response_tbl.h │ ├── simple_replication.c │ ├── simple_replication.h │ ├── tlmap.c │ ├── tlmap.h │ ├── tlmap4.c │ └── tlmap4.h ├── home │ ├── CMakeLists.txt │ ├── home_flash.c │ ├── home_flash.h │ ├── home_util.c │ ├── home_util.h │ ├── tests │ │ ├── homedir_concurrency_test1.c │ │ ├── homedir_perf_test1.c │ │ ├── homedir_perf_test2.c │ │ └── testhomedir.c │ ├── tlmap2.c │ └── tlmap2.h ├── init_protocol.c ├── init_protocol.h ├── protocol_alloc.h ├── protocol_common.c ├── protocol_common.h ├── protocol_utils.c ├── protocol_utils.h ├── replication │ ├── CMakeLists.txt │ ├── copy_replicator.c │ ├── copy_replicator.gdb │ ├── copy_replicator.h │ ├── copy_replicator_internal.h │ ├── copy_replicator_meta.c │ ├── copy_replicator_misc.c │ ├── key_lock.c │ ├── key_lock.gdb │ ├── key_lock.h │ ├── meta.c │ ├── meta.h │ ├── meta_storage.c │ ├── meta_storage.h │ ├── meta_types.h │ ├── replicator.c │ ├── replicator.h │ ├── replicator_adapter.c │ ├── replicator_adapter.h │ ├── rpc.c │ ├── rpc.h │ ├── sdf_vips.c │ ├── sdf_vips.h │ └── tests │ │ ├── Rep_test_plan.txt │ │ ├── fcnl_framework_async_get_put_stress.c │ │ ├── fcnl_framework_async_shard.c │ │ ├── fcnl_framework_async_test.c │ │ ├── fcnl_framework_cursor_test.c │ │ ├── fcnl_framework_home_node_test.c │ │ ├── fcnl_framework_msg_timeout_test.c │ │ ├── fcnl_framework_recover_test.c │ │ ├── fcnl_framework_replica_node_test.c │ │ ├── fcnl_framework_seqno_test.c │ │ ├── fcnl_framework_state_machine_test.c │ │ ├── fcnl_framework_sync_test.c │ │ ├── fcnl_msg_timeout_test.c │ │ ├── fcnl_rms_crash_switch_over_test.c │ │ ├── fcnl_rms_fault_in_test.c │ │ ├── fcnl_rms_get_lease_test.c │ │ ├── fcnl_rms_get_put_del_test.c │ │ ├── fcnl_rms_get_put_test.c │ │ ├── fcnl_rms_multi_put_test.c │ │ ├── fcnl_rms_put_crash_expire_put_test.c │ │ ├── fcnl_rms_put_crash_get_test.c │ │ ├── fcnl_rms_simple_test.c │ │ ├── fcnl_rtf_stress_test.c │ │ ├── fcnl_sn_all_crash_test.c │ │ ├── fcnl_sn_get_put_test.c │ │ ├── fcnl_sn_lock_test1.c │ │ ├── fcnl_sn_lock_test2.c │ │ ├── fcnl_sn_multi_crash_test.c │ │ ├── fcnl_sn_multi_shard_test.c │ │ ├── fcnl_sn_multi_shard_test2.c │ │ ├── fcnl_sn_null_test.c │ │ ├── fcnl_sn_ss_mc_test.c │ │ ├── key_lock_test.c │ │ ├── rtfw_notes.txt │ │ ├── sdf_fth_mbox_test.c │ │ ├── setenv.sh │ │ ├── t │ │ ├── fcnl_rtg_test.c │ │ ├── fcnl_rtm_case.c │ │ ├── fcnl_rtm_test.c │ │ ├── fcnl_rtm_test2.c │ │ ├── fcnl_rtm_test_lzwei.c │ │ ├── rtm_case │ │ │ ├── empty_read │ │ │ ├── empty_read2 │ │ │ ├── lot_of_read │ │ │ ├── read_no_overlap │ │ │ ├── read_no_overlap_2 │ │ │ ├── read_on_different_node │ │ │ ├── read_overlap │ │ │ ├── sample │ │ │ ├── uncompleted_read │ │ │ ├── write_change │ │ │ ├── write_read │ │ │ ├── zhenwei │ │ │ └── zhenwei_2 │ │ └── static_test_rtm │ │ ├── test.h │ │ ├── test_api.h │ │ ├── test_common.c │ │ ├── test_common.h │ │ ├── test_config.h │ │ ├── test_flash.c │ │ ├── test_flash.h │ │ ├── test_framework.c │ │ ├── test_framework.h │ │ ├── test_generator.c │ │ ├── test_generator.h │ │ ├── test_meta.h │ │ ├── test_model.c │ │ ├── test_model.h │ │ ├── test_node.c │ │ ├── test_node.h │ │ ├── tlmap3.c │ │ └── tlmap3.h └── sdf_lex_buf.h ├── sdfappcommon ├── README ├── XList.h ├── XListShmemTest.c ├── XListTest.c ├── XLock.h ├── XMbox.c ├── XMbox.h ├── XResume.c ├── XResume.h ├── sdf_err.h ├── threadPool.c ├── threadPool.h └── threadPoolTest.c ├── sdfmsg ├── CMakeLists.txt ├── README ├── newtests │ ├── agent.c │ ├── agent.h │ ├── conf.c │ ├── conf.h │ ├── multi_comm.c │ ├── sdf_bounce.c │ ├── sdf_bw.c │ ├── sdf_lat.c │ ├── sdf_live.c │ ├── sdf_lock.c │ ├── testrun │ └── tm_orig.c ├── old │ ├── sdf_msg.h │ ├── sdf_msg_engine.c │ ├── sdf_msg_hash.c │ ├── sdf_msg_hash.h │ ├── sdf_msg_hmap.c │ ├── sdf_msg_hmap.h │ ├── sdf_msg_mgmnt.c │ ├── sdf_msg_mpi.c │ ├── sdf_msg_mpi.h │ ├── sdf_msg_queue.c │ ├── sdf_msg_tester.c │ └── sdf_msg_types.h ├── oldtests │ ├── Makefile.tst │ ├── Utilfuncs.c │ ├── Utilfuncs.h │ ├── bigsize_fth_test.c │ ├── bigsize_test.c │ ├── consistency_test.c │ ├── fcnl_bigsize_fth_lib1.c │ ├── fcnl_bigsize_fth_test1.c │ ├── fcnl_bigsize_lib1.c │ ├── fcnl_bigsize_test1.c │ ├── fcnl_consistency_lib1.c │ ├── fcnl_consistency_lib2.c │ ├── fcnl_consistency_test1.c │ ├── fcnl_consistency_test2.c │ ├── fcnl_flush_lib1.c │ ├── fcnl_flush_test1.c │ ├── fcnl_fth_mbx_lib1.c │ ├── fcnl_fth_mbx_test1.c │ ├── fcnl_membership_lib1.c │ ├── fcnl_membership_test1.c │ ├── fcnl_metadata_lib1.c │ ├── fcnl_metadata_test1.c │ ├── fcnl_mgnt_lib1.c │ ├── fcnl_mgnt_test1.c │ ├── fcnl_mixed_thread_lib1.c │ ├── fcnl_mixed_thread_lib2.c │ ├── fcnl_mixed_thread_test1.c │ ├── fcnl_mixed_thread_test2.c │ ├── fcnl_msg_pfm_lib1.c │ ├── fcnl_msg_pfm_test1.c │ ├── fcnl_multi_protocol_lib1.c │ ├── fcnl_multi_protocol_test1.c │ ├── fcnl_multinode_doubleside_lib1.c │ ├── fcnl_multinode_doubleside_lib2.c │ ├── fcnl_multinode_doubleside_lib3.c │ ├── fcnl_multinode_doubleside_lib4.c │ ├── fcnl_multinode_doubleside_test1.c │ ├── fcnl_multinode_doubleside_test2.c │ ├── fcnl_multinode_doubleside_test3.c │ ├── fcnl_multinode_doubleside_test4.c │ ├── fcnl_multinode_lib1.c │ ├── fcnl_multinode_lib2.c │ ├── fcnl_multinode_lib3.c │ ├── fcnl_multinode_lib4.c │ ├── fcnl_multinode_multiptl_lib1.c │ ├── fcnl_multinode_multiptl_lib2.c │ ├── fcnl_multinode_multiptl_test1.c │ ├── fcnl_multinode_multiptl_test2.c │ ├── fcnl_multinode_test1.c │ ├── fcnl_multinode_test2.c │ ├── fcnl_multinode_test3.c │ ├── fcnl_multinode_test4.c │ ├── fcnl_multiptl_quantity_lib1.c │ ├── fcnl_multiptl_quantity_test1.c │ ├── fcnl_multiptl_sequential_lib1.c │ ├── fcnl_multiptl_sequential_lib2.c │ ├── fcnl_multiptl_sequential_lib3.c │ ├── fcnl_multiptl_sequential_lib4.c │ ├── fcnl_multiptl_sequential_test1.c │ ├── fcnl_multiptl_sequential_test2.c │ ├── fcnl_multiptl_sequential_test3.c │ ├── fcnl_multiptl_sequential_test4.c │ ├── fcnl_presstest_lib1.c │ ├── fcnl_presstest_test1.c │ ├── fcnl_queue_order_fth_lib1.c │ ├── fcnl_queue_order_fth_lib2.c │ ├── fcnl_queue_order_fth_test1.c │ ├── fcnl_queue_order_fth_test2.c │ ├── fcnl_queue_order_pth_lib1.c │ ├── fcnl_queue_order_pth_lib2.c │ ├── fcnl_queue_order_pth_test1.c │ ├── fcnl_queue_order_pth_test2.c │ ├── fcnl_receive_queue_lib1.c │ ├── fcnl_receive_queue_test1.c │ ├── fcnl_replication_lib1.c │ ├── fcnl_replication_test1.c │ ├── fcnl_send_queue_lib1.c │ ├── fcnl_send_queue_test1.c │ ├── fcnl_simplexsr_lib1.c │ ├── fcnl_simplexsr_test1.c │ ├── fcnl_single_protocol_lib1.c │ ├── fcnl_single_protocol_test1.c │ ├── fcnl_singleptl_chkmsg_lib1.c │ ├── fcnl_singleptl_chkmsg_test1.c │ ├── fcnl_singleptl_chksize_lib1.c │ ├── fcnl_singleptl_chksize_test1.c │ ├── fcnl_singleptl_sequential_lib1.c │ ├── fcnl_singleptl_sequential_lib2.c │ ├── fcnl_singleptl_sequential_lib3.c │ ├── fcnl_singleptl_sequential_test1.c │ ├── fcnl_singleptl_sequential_test2.c │ ├── fcnl_singleptl_sequential_test3.c │ ├── fcnl_system_lib1.c │ ├── fcnl_system_test1.c │ ├── fcnl_test.h │ ├── fcnl_wrapper_fth_lib1.c │ ├── fcnl_wrapper_fth_test1.c │ ├── fcnl_wrapper_lib1.c │ ├── fcnl_wrapper_test1.c │ ├── flush_test.c │ ├── log.c │ ├── log.h │ ├── management_test.c │ ├── membership_test.c │ ├── metadata_test.c │ ├── msg_test.h │ ├── msg_test_main.c │ ├── perf_timecal_lib1.c │ ├── perf_timecal_test1.c │ ├── pfm_test.h │ ├── pfm_throughput_lib1.c │ ├── pfm_throughput_test1.c │ ├── queue_order_test_fth.c │ ├── queue_order_test_pthread.c │ ├── receive_queue_test.c │ ├── replication_test.c │ ├── sdf_msg_motor.c │ ├── sdf_msg_oob.h │ ├── sdf_msg_oob_mgmnt.c │ ├── sdf_msg_protocol.c │ ├── sdf_msg_pthread_example.c │ ├── send_queue_test.c │ ├── simplexsr_test.c │ ├── slinkedlist.c │ ├── slinkedlist.h │ ├── system_test.c │ └── testscript.sh ├── sdf_fth_mbx.c ├── sdf_fth_mbx.h ├── sdf_msg.h ├── sdf_msg_action.c ├── sdf_msg_action.h ├── sdf_msg_binding.c ├── sdf_msg_new.c ├── sdf_msg_shmem.c ├── sdf_msg_sync.c ├── sdf_msg_sync.h ├── sdf_msg_types.c ├── sdf_msg_types.h ├── sdf_msg_wrapper.c └── sdf_msg_wrapper.h ├── sdftcp ├── CMakeLists.txt ├── README ├── gnusource.h ├── locks.c ├── locks.h ├── msg_cat.h ├── msg_cip.h ├── msg_fthfake.h ├── msg_hello.h ├── msg_int.c ├── msg_int.h ├── msg_map.c ├── msg_map.h ├── msg_msg.c ├── msg_msg.h ├── msg_sdffake.h ├── msg_sdfincl.h ├── newtests │ ├── bw.c │ ├── lat.c │ └── mbw.c ├── notes ├── old │ ├── gs_libtcp.c │ ├── gs_tcp.h │ ├── gs_tcp_impl.h │ ├── msg_sdf.c │ ├── msg_sdf.h │ └── tests │ │ ├── gs_sdftcp_pthread_test1.c │ │ ├── gs_sdftcp_single_test1.c │ │ ├── gs_tcp_test.c │ │ ├── gs_tcp_test_v1.c │ │ └── gs_test1.conf ├── stats.c ├── stats.h ├── tests │ ├── msgtest_common.c │ ├── msgtest_common.h │ ├── msgtest_hello.c │ ├── msgtest_im.c │ ├── msgtest_pplat.c │ ├── msgtest_remote.c │ └── test_tcp.sh ├── tools.c ├── tools.h ├── trace.c └── trace.h ├── shared ├── 00_README.txt ├── CMakeLists.txt ├── block_container.h ├── cmc.c ├── cmc.h ├── container.c ├── container.h ├── container_meta.c ├── container_meta.h ├── container_props.c ├── container_props.h ├── getput_sim.c ├── getput_sim.h ├── init_sdf.c ├── init_sdf.h ├── internal_blk_obj_api.c ├── internal_blk_obj_api.h ├── name_service.c ├── name_service.h ├── object.c ├── object.h ├── object_container.h ├── open_container_map.c ├── open_container_map.h ├── open_container_mgr.c ├── open_container_mgr.h ├── private.h ├── sdf_sm_msg.h ├── shard_compute.c ├── shard_compute.h ├── shard_meta.h ├── strings.c └── tests │ ├── sdfclienttest.c │ └── stockTradingApp.c ├── ssd ├── CMakeLists.txt ├── Makefile.defs ├── clipper │ ├── CMakeLists.txt │ ├── clipper.c │ ├── clipper.h │ ├── clipper_aio.c │ └── clipper_aio.h ├── fifo │ ├── CMakeLists.txt │ ├── container_meta_blob.h │ ├── fifo.c │ ├── fifo.h │ ├── hash.c │ ├── hash.h │ ├── mcd_aio.c │ ├── mcd_aio.h │ ├── mcd_aio_internal.h │ ├── mcd_bak.c │ ├── mcd_bak.h │ ├── mcd_check.c │ ├── mcd_check.h │ ├── mcd_hash.c │ ├── mcd_hash.h │ ├── mcd_ipf.c │ ├── mcd_ipf.h │ ├── mcd_osd.c │ ├── mcd_osd.h │ ├── mcd_osd_internal.h │ ├── mcd_pfx.c │ ├── mcd_pfx.h │ ├── mcd_rec.c │ ├── mcd_rec.h │ ├── mcd_rec2.c │ ├── mcd_rec2.h │ ├── mcd_rep.c │ ├── mcd_rep.h │ ├── mcd_sgio.h │ ├── mcd_sync.c │ ├── mcd_trx.h │ ├── nvram.c │ ├── nvram.h │ ├── read_backup_histo.c │ ├── read_backup_split.c │ ├── read_backup_stream.c │ ├── recovery.c │ ├── scavenger.c │ ├── scavenger.h │ ├── slab_gc.c │ └── slab_gc.h ├── htf │ ├── htf.c │ └── htf.h ├── ssd.c ├── ssd.h ├── ssd_aio.c ├── ssd_aio.h ├── ssd_aio_local.h ├── ssd_defaults.c ├── ssd_defaults.h └── ssd_local.h ├── sys ├── queue.h └── tree.h ├── utils ├── CMakeLists.txt ├── caller.c ├── caller.h ├── checklog.c ├── crc32.s ├── example.c ├── hash.c ├── hash.h ├── hashmap.c ├── hashmap.h ├── linkedlist.c ├── linkedlist.h ├── platform_check.c ├── platform_check.h ├── properties.c ├── properties.h ├── rico.h ├── rtlog.c ├── rtlog.h ├── sdfkey.c ├── sdfkey.h ├── stats.c ├── stats.h ├── stats2.c ├── stats2.h ├── tests │ ├── CMakeLists.txt │ ├── hashmaptest.c │ ├── propertiestest.c │ ├── schooner.properties │ └── stats_test.c └── wsdequeue.c └── zsck ├── CMakeLists.txt ├── zsck.c ├── zsck.sh ├── zsformat.c └── zsmetafault.c /.gitignore: -------------------------------------------------------------------------------- 1 | cscope.* 2 | CMakeFiles 3 | CMakeCache.txt 4 | *.cmake 5 | Makefile 6 | platform/ffdc_log.*c 7 | platform/ffdc_log.dbg 8 | platform/ffdc_log.h 9 | platform/ffdc_reader.c 10 | fdf_sdk-*.tar.gz 11 | output/ 12 | 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ZetaScale 2 | 3 | ZetaScale provides an object API with configurable attributes, and leverages flash storage for high performance and high availability. 4 | 5 | ZetaScale was developed because many applications realize limited benefits from flash storage without extensive system level optimization. ZetaScale incorporates many of the system level optimizations that are required to exploit flash. Applications can be flash-optimized with much less effort by using ZetaScale as their storage layer. 6 | 7 | The system level optimizations in ZetaScale include: 8 | 9 | - Intelligent DRAM caching. 10 | - Heavily optimized access paths for high performance. 11 | - Optimized threading to maximize concurrency and minimize response time. 12 | - Configurable flash management algorithms to optimize different workloads. 13 | 14 | ## Build ZetaScale 15 | 16 | ### CentOS 17 | ```sh 18 | #yum groupinstall 'Development Tools' 19 | #yum install libaio-devel libevent-devel snappy-devel 20 | ``` 21 | ### Ubuntu 22 | ```sh 23 | #apt-get install build-essential libaio-dev libevent-dev libsnappy-dev 24 | ``` 25 | 26 | ### Install lz4 27 | ```sh 28 | #apt-get install liblz4-* 29 | ``` 30 | ### debug build 31 | ```sh 32 | #./build_zs_sdk.sh 33 | ``` 34 | ### optimized build 35 | ```sh 36 | #./build_zs_sdk.sh --optimize 37 | ``` 38 | ## Basic test 39 | ```sh 40 | #export ZS_LIB=/path/to/zetascale/library/libzs.so 41 | #export ZS_PROPERTY_FILE=/path/to/zetascale/config/zs.prop 42 | #cd ./api/tests/ 43 | #make test 44 | ``` 45 | ## Documetation 46 | 47 | >doc/FDF_programming_guide.docx 48 | 49 | License 50 | ---- 51 | 52 | LGPL 53 | -------------------------------------------------------------------------------- /agent/00_README.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * File: sdf/agent/00_README.txt 3 | * Author: Darpan Dinker 4 | * 5 | * Created on February 28, 2008, 3:48 PM 6 | * 7 | * (c) Copyright 2008, Schooner Information Technology, Inc. 8 | * http://www.schoonerinfotech.com/ 9 | * 10 | * $Id: 00_README.txt 400 2008-02-28 23:52:53Z darpan $ 11 | */ 12 | 13 | The agent directory should be used in SDF-Agent (aka SDF Daemon). 14 | The main interface to incoming interprocess communication for request-response is the scoreboard. 15 | @see sdf/shared/scoreboard.h 16 | 17 | On receiving a request from the application (SDF client), a "thread" should call 18 | void processMessageFromApp(struct SDFSBEntry *sbentry) as defined in agent/protocol_handler.h 19 | 20 | 21 | -------------------------------------------------------------------------------- /agent/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-DMPI_BUILD) 2 | add_library(agent OBJECT agent_helper.c agent_sm.c fdf_agent.c) 3 | add_dependencies(agent ffdc) 4 | -------------------------------------------------------------------------------- /agent/fdf_agent.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | extern SDF_boolean_t zs_agent_engine_pre_init(struct sdf_agent_state *state); 21 | -------------------------------------------------------------------------------- /api/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-Wno-switch -std=gnu99 -fgnu89-inline -Wno-unused-variable -Wno-parentheses) 2 | add_library(api OBJECT fdf.c enumerate.c stats.c async_commands.c 3 | licensed.c fdf_hash.c fdf_tlmap.c cmap_hash.c cmap.c 4 | fdf_cmap.c lc.c nvr_svc.c) 5 | add_dependencies(api ffdc) 6 | #add_executable(sdftest main.c) 7 | #target_link_libraries(sdftest ecc sdftest sdf sdfagent sdfshared sdfaction sdfhome 8 | #sdfreplication sdfprotocol sdfssd clipper fifo sdfssd utils sdfmsgqueue 9 | #sdfmtp hotkey misc fth platform pthread rt nsl util m aio event) 10 | -------------------------------------------------------------------------------- /api/Makefile.sdk: -------------------------------------------------------------------------------- 1 | # $Id: Makefile 9983 2009-11-02 18:25:23Z gxu $ 2 | 3 | TOP = .. 4 | PROG = zs_multi_test 5 | SRCS = zs_multi_test.c test.c 6 | #CFLAGS = -O3 -D_GNU_SOURCE -DMPI_BUILD -DFLASH_SIM_TYPE=5 \ 7 | -DPLAT_LOG_COMPILE_LEVEL=DEVEL -DENABLE_MULTIPLE_FLASH_SUBSYSTEMS \ 8 | -DBLD_VERSION=857 -DSDFAPI -DSDFAPIREFORMAT -DSIMPLE_REPLICATION \ 9 | -DVIPGROUP_SUPPORT -DENABLE_MULTIPLE_FLASH_SUBSYSTEMS 10 | 11 | CFLAGS = -D_GNU_SOURCE -DMPI_BUILD -DFLASH_SIM_TYPE=5 \ 12 | -DPLAT_LOG_COMPILE_LEVEL=DEVEL -DENABLE_MULTIPLE_FLASH_SUBSYSTEMS \ 13 | -DBLD_VERSION=857 -DSDFAPI -DSDFAPIONLY -DSDFAPIREFORMAT \ 14 | -DENABLE_MULTIPLE_FLASH_SUBSYSTEMS \ 15 | -O3 -pipe -Wall -fstack-protector-all -fno-strict-aliasing \ 16 | -fno-omit-frame-pointer -Werror -std=gnu99 -fgnu89-inline 17 | 18 | LIBS = $(TOP)/lib/libzsdll.a \ 19 | -lpthread -lrt -lnsl -lutil -lm -laio -levent -ldl 20 | all: 21 | $(CC) $(CFLAGS) $(SRCS) $(LIBS) -I$(TOP)/include -o $(PROG) 22 | 23 | -------------------------------------------------------------------------------- /api/cmap_hash.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: utils/hash.h 22 | * Author: Jim 23 | * 24 | * Created on March 3, 2008, 1:38 PM 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: hash.c 399 2008-02-28 23:46:15Z darpan $ 30 | */ 31 | 32 | #ifndef __CMAP_HASH_H 33 | #define __CMAP_HASH_H 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | // 41 | // Header file for Bob Tuttles lookup8 hash algorithm 42 | // 43 | // This is fast on 64-bit machines. Just mask off the bits you need for shorter keys. 44 | // 45 | 46 | // Level is an arbitrary salt for the hash. 47 | uint64_t cmap_hash(const unsigned char *key, uint64_t keyLength, uint64_t level); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /api/core.gdb: -------------------------------------------------------------------------------- 1 | # Macros needs for core ZS. 2 | # Author: Ramesh Chander 3 | 4 | 5 | define find_container 6 | set $map = cmap_cguid_hash 7 | if ($argc < 1) 8 | printf "usage: ./find_container cguid\n" 9 | end 10 | set $cguid = $arg0 11 | set $nbuckets = $map->nbuckets 12 | set $buckets = $map->buckets 13 | set $found = 0 14 | printf "Searching in %d buckets.\n", $nbuckets 15 | while ($nbuckets > 0) 16 | set $bucket = &$buckets[$nbuckets - 1] 17 | printf "Searching in %d bucket.\r", $nbuckets 18 | if ($bucket != 0) 19 | set $entry = $buckets[$nbuckets - 1]->entry 20 | while ($entry != 0) 21 | set $cont = (cntr_map_t *) $entry->contents 22 | if ($cont->cguid == $cguid) 23 | printf "Found entry\n" 24 | p $cont 25 | p *$cont 26 | set $found = 1 27 | loop_break; 28 | end 29 | set $entry = $entry->next 30 | end 31 | end 32 | 33 | if($found == 1) 34 | loop_break 35 | end 36 | 37 | set $nbuckets-- 38 | end 39 | if ($found != 1) 40 | printf "Sorry, did not find your cguid %d in the container map.\n", $cguid 41 | end 42 | -------------------------------------------------------------------------------- /api/fdf_hash.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: utils/hash.h 22 | * Author: Jim 23 | * 24 | * Created on March 3, 2008, 1:38 PM 25 | * 26 | * SanDisk Proprietary Material, © Copyright 2012 SanDisk, all rights reserved. 27 | * http://www.sandisk.com 28 | * 29 | * $Id: hash.c 399 2008-02-28 23:46:15Z darpan $ 30 | */ 31 | 32 | #ifndef __HASH_H 33 | #define __HASH_H 34 | 35 | #include 36 | #include 37 | 38 | // 39 | // Header file for Bob Tuttles lookup8 hash algorithm 40 | // 41 | // This is fast on 64-bit machines. Just mask off the bits you need for shorter keys. 42 | // 43 | 44 | // Level is an arbitrary salt for the hash. 45 | uint64_t zs_hash(const unsigned char *key, uint64_t keyLength, uint64_t level); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /api/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-std=gnu99 -fgnu89-inline) 2 | #add parameter here as SET(testname_param arg1 arg2 ...) 3 | SET(default_param 1 8 10000) 4 | SET(zs_multi_test_param -s 1 -t 8 -i 1000) 5 | SET(zs_mput_param 1000 100 10) 6 | SET(zs_rename_test_param -c foo -n bar -t 8) 7 | SET(zs_mt_rename_test_param -c foo -n bar) 8 | 9 | file( GLOB TEST_SOURCES *.c ) 10 | foreach( test_src_file ${TEST_SOURCES} ) 11 | IF(NOT ${test_src_file} MATCHES "/test.c") 12 | get_filename_component(testname ${test_src_file} NAME_WE) 13 | add_executable(${testname} ${test_src_file} test.c) 14 | add_executable(${testname}_btree ${test_src_file} test.c) 15 | add_dependencies(${testname} zs) 16 | 17 | #add_executable(${testname}_btree ${test_src_file} test.c) 18 | #set_property(TARGET ${testname}_btree PROPERTY COMPILE_DEFINITIONS BTREE_MODE) 19 | #add_dependencies(${testname}_btree zs) 20 | 21 | IF(NOT ${testname}_param) 22 | #MESSAGE(param is ${default_param}) 23 | add_test(${testname} ${CMAKE_CURRENT_BINARY_DIR}/${testname} ${default_param}) 24 | add_test(${testname}_btree ${CMAKE_CURRENT_BINARY_DIR}/${testname}_btree ${default_param}) 25 | ELSE(NOT ${testname}_param) 26 | #MESSAGE(param is ${${testname}_param}) 27 | add_test(${testname} ${CMAKE_CURRENT_BINARY_DIR}/${testname} ${${testname}_param}) 28 | add_test(${testname}_btree ${CMAKE_CURRENT_BINARY_DIR}/${testname}_btree ${${testname}_param}) 29 | ENDIF(NOT ${testname}_param) 30 | target_link_libraries( ${testname} zsdll dl pthread aio event snappy 31 | lz4) 32 | #target_link_libraries( ${testname}_btree zsdll dl pthread aio event snappy) 33 | target_link_libraries( ${testname}_btree zsdll dl pthread aio event 34 | snappy lz4) 35 | ENDIF(NOT ${test_src_file} MATCHES "/test.c") 36 | endforeach(test_src_file ${TEST_SOURCES}) 37 | -------------------------------------------------------------------------------- /api/tests/Makefile.sample: -------------------------------------------------------------------------------- 1 | TOP = .. 2 | 3 | PROG = sample_program 4 | 5 | TESTS = $(PROG) 6 | 7 | LIBS_SDF = $(TOP)/lib/libzsdll.a \ 8 | -lpthread -ldl -laio -levent -lsnappy 9 | 10 | LIBS = $(LIBS_FTH) $(LIBS_SDF) $(LIBS_SDF) 11 | 12 | all: 13 | cc -Wall sample_program.c $(LIBS_SDF) -I$(TOP)/include -o $(PROG) 14 | -------------------------------------------------------------------------------- /api/tests/Makefile.sdk: -------------------------------------------------------------------------------- 1 | TOP = .. 2 | 3 | PROG = zs_static_test 4 | 5 | TESTS = $(PROG) 6 | 7 | LIBS_SDF = $(TOP)/lib/*.a \ 8 | -lpthread -lrt -lnsl -lutil -lm -laio -levent 9 | 10 | LIBS = $(LIBS_FTH) $(LIBS_SDF) $(LIBS_SDF) 11 | 12 | zs_static_test.run: TESTARGS = . 13 | all: 14 | cc -Wall zs_static_test.c $(LIBS_SDF) -I$(TOP)/include -o $(PROG) 15 | -------------------------------------------------------------------------------- /api/tests/btree/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-std=gnu99 -fgnu89-inline) 2 | #SET(testname_param 1 8 10000) 3 | SET(zs_mput_param 1 1000 100 10) 4 | SET(zs_mput_pstats_param 1 1000 100 10) 5 | SET(zs_rangeupdate_param 1000 10) 6 | SET(zs_snapshot_param 1000 10 15) 7 | SET(fdf_snapshot_param 1000 10 15) 8 | SET(zs_big_writes_param 100 1000 1 1048576) 9 | SET(FDF_Write_mthreads_param 1000 1 1450 1024 1 1) 10 | 11 | file( GLOB TEST_SOURCES *.c ) 12 | foreach( test_src_file ${TEST_SOURCES} ) 13 | IF(NOT ${test_src_file} MATCHES "/test.c") 14 | get_filename_component(testname ${test_src_file} NAME_WE) 15 | add_executable(${testname} ${test_src_file} ../test.c) 16 | # set_property(TARGET ${testname} PROPERTY COMPILE_DEFINITIONS BTREE_MODE) 17 | #add_dependencies(${testname} zsdll) 18 | add_dependencies(${testname} zs) 19 | SET(param ${testname}_param) 20 | add_test(${testname} ${CMAKE_CURRENT_BINARY_DIR}/${testname} ${${testname}_param}) 21 | # Message(${${testname}_param}) 22 | target_link_libraries( ${testname} zsdll dl pthread aio event snappy) 23 | endif (NOT ${test_src_file} MATCHES "/test.c") 24 | endforeach(test_src_file ${TEST_SOURCES}) 25 | 26 | add_test(FDF_Write_mthreads2k ${CMAKE_CURRENT_BINARY_DIR}/FDF_Write_mthreads 1000 1 1960 1024 1 1) 27 | 28 | -------------------------------------------------------------------------------- /api/tests/btree/conf/fdf.prop: -------------------------------------------------------------------------------- 1 | ZS_LOG_LEVEL =info 2 | ZS_FLASH_SIZE=16 3 | #ZS_FLASH_FILENAME=/schooner/data/schooner%d 4 | ZS_FLASH_FILENAME=/dev/shm/schooner%d 5 | ZS_LOG_FLUSH_DIR=/dev/shm 6 | ZS_O_DIRECT=0 7 | ZS_REFORMAT=1 8 | ZS_TEST_MODE=1 9 | #The followind reduces amount of junk in the stacktraces 10 | ZS_FLASH_PROTOCOL_THREADS=1 11 | ZS_ASYNC_PUT_THREADS=3 12 | ASYNC_DELETE_CONTAINERS_THREADS=1 13 | ZS_LICENSE_PATH=/root/DEMO 14 | 15 | # To enable data checksum, default is disabled 16 | #SDF_OBJECT_DATA_CHECKSUM=1 17 | -------------------------------------------------------------------------------- /api/tests/btree/conf/fdf_sample.prop: -------------------------------------------------------------------------------- 1 | ZS_FLASH_SIZE=8 2 | ZS_FLASH_FILENAME=/schooner/data/schooner%d 3 | ZS_CACHE_SIZE=1073741824 4 | ZS_REFORMAT=1 5 | -------------------------------------------------------------------------------- /api/tests/conf/fdf.prop: -------------------------------------------------------------------------------- 1 | FDF_LOG_LEVEL =info 2 | FDF_FLASH_SIZE=100 3 | FDF_FLASH_FILENAME=/schooner/data/schooner0 4 | #FDF_FLASH_FILENAME=/dev/shm/schooner0 5 | #FDF_LOG_FLUSH_DIR=/dev/shm 6 | FDF_O_DIRECT=0 7 | FDF_REFORMAT=1 8 | #FDF_TEST_MODE=1 9 | FDF_STORM_MODE=0 10 | ASYNC_DELETE_CONTAINERS=0 11 | #The followind reduces amount of junk in the stacktraces 12 | FDF_FLASH_PROTOCOL_THREADS=1 13 | FDF_ASYNC_PUT_THREADS=3 14 | ASYNC_DELETE_CONTAINERS_THREADS=1 15 | 16 | # Async stats 17 | FDF_ASYNC_STATS_ENABLE=1 18 | FDF_ASYNC_STATS_THREADS=4 19 | ASYNC_STATS_SUSPEND_NODE_COUNT=20 20 | # Unit of time is milli secs 21 | ASYNC_STATS_SUSPEND_DURATION=5 22 | 23 | #Stats related 24 | FDF_STATS_FILE = /tmp/fdfstats.log 25 | FDF_STATS_DUMP_INTERVAL = 5 26 | FDF_BLOCK_SIZE =8192 27 | FDF_FLUSH_PSTATS_FREQUENCY = 100000 28 | # To enable data checksum, default is disabled 29 | #SDF_OBJECT_DATA_CHECKSUM=1 30 | 31 | FDF_SCAVENGER_ENABLE=1 32 | FDF_SCAVENGER_THREADS=10 33 | #FDF_SCAVENGER_THROTTLE_VALUE in milli seconds 34 | FDF_SCAVENGER_THROTTLE_VALUE=1 35 | 36 | #FDF_SCAVENGE_PER_OBJECTS is used to start scavenger for every FDF_SCAVENGE_PER_OBJECTS deletes 37 | FDF_SCAVENGE_PER_OBJECTS=10000 38 | 39 | #FDF_SIGNAL_HANDLERS default is 1 40 | #FDF_SIGNAL_HANDLERS=0 41 | #FDF_CACHE_SIZE=800000000 42 | 43 | # FDF_CORE_DUMP default is 1 44 | #FDF_CORE_DUMP 1 45 | FDF_TRX=1 46 | ZS_CHECK_MODE=0 47 | 48 | -------------------------------------------------------------------------------- /api/tests/conf/fdf_sample.prop: -------------------------------------------------------------------------------- 1 | FDF_FLASH_SIZE=8 2 | FDF_FLASH_FILENAME=/tmp/schooner0 3 | FDF_CACHE_SIZE=1073741824 4 | FDF_REFORMAT=1 5 | -------------------------------------------------------------------------------- /api/tests/conf/zs.prop: -------------------------------------------------------------------------------- 1 | ZS_LOG_LEVEL=info 2 | ZS_FLASH_SIZE=44 3 | ZS_FLASH_FILENAME=/tmp/schooner0 4 | #ZS_FLASH_FILENAME=/dev/shm/schooner0 5 | #ZS_LOG_FLUSH_DIR=/dev/shm 6 | #ZS_O_DIRECT=1 7 | ZS_REFORMAT=1 8 | ZS_CHECK_MODE=0 9 | #ZS_TEST_MODE=1 10 | ZS_STORM_MODE=1 11 | ZS_TRX_COMMIT_SW=0 12 | ASYNC_DELETE_CONTAINERS=1 13 | #The followind reduces amount of junk in the stacktraces 14 | ZS_FLASH_PROTOCOL_THREADS=1 15 | ZS_ASYNC_PUT_THREADS=3 16 | ASYNC_DELETE_CONTAINERS_THREADS=1 17 | ZS_NVR_FILENAME=/tmp/nvram 18 | ZS_NVR_OFFSET=0 19 | ZS_NVR_LENGTH=33554432 20 | ZS_NVR_PARTITIONS=2 21 | ZS_NVR_ODIRECT=1 22 | 23 | # Async stats 24 | ZS_ASYNC_STATS_ENABLE=1 25 | ZS_ASYNC_STATS_THREADS=4 26 | ASYNC_STATS_SUSPEND_NODE_COUNT=20 27 | # Unit of time is milli secs 28 | ASYNC_STATS_SUSPEND_DURATION=5 29 | 30 | #Stats related 31 | ZS_STATS_FILE = /tmp/fdfstats.log 32 | ZS_STATS_DUMP_INTERVAL = 0 33 | ZS_FLUSH_PSTATS_FREQUENCY = 0 34 | # To enable data checksum, default is disabled 35 | #SDF_OBJECT_DATA_CHECKSUM=1 36 | 37 | ZS_SCAVENGER_ENABLE=1 38 | ZS_SCAVENGER_THREADS=10 39 | #ZS_SCAVENGER_THROTTLE_VALUE in milli seconds 40 | ZS_SCAVENGER_THROTTLE_VALUE=1 41 | 42 | #ZS_SCAVENGE_PER_OBJECTS is used to start scavenger for every ZS_SCAVENGE_PER_OBJECTS deletes 43 | ZS_SCAVENGE_PER_OBJECTS=10000 44 | ZS_FLOG_MODE=ZS_FLOG_FILE_MODE 45 | #ZS_FLOG_MODE=ZS_FLOG_NVRAM_MODE 46 | #ZS_FLOG_NVRAM_FILE=/tmp/nvram_file 47 | #ZS_FLOG_NVRAM_FILE_OFFSET=0x1000 48 | 49 | #ZS_SIGNAL_HANDLERS default is 1 50 | #ZS_SIGNAL_HANDLERS=0 51 | #ZS_CACHE_SIZE=800000000 52 | 53 | # ZS_CORE_DUMP default is 1 54 | #ZS_CORE_DUMP 1 55 | -------------------------------------------------------------------------------- /api/tests/conf/zs_sample.prop: -------------------------------------------------------------------------------- 1 | ZS_FLASH_SIZE=8 2 | ZS_FLASH_FILENAME=/tmp/schooner0 3 | ZS_CACHE_SIZE=1073741824 4 | ZS_REFORMAT=1 5 | -------------------------------------------------------------------------------- /api/tests/core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-std=gnu99 -fgnu89-inline) 2 | 3 | file( GLOB TEST_SOURCES *.c ) 4 | foreach( test_src_file ${TEST_SOURCES} ) 5 | IF(NOT ${test_src_file} MATCHES "/test.c") 6 | get_filename_component(testname ${test_src_file} NAME_WE) 7 | add_executable(${testname} ${test_src_file} ../test.c) 8 | add_dependencies(${testname} zs) 9 | SET(param ${testname}_param) 10 | add_test(${testname} ${CMAKE_CURRENT_BINARY_DIR}/${testname} ${${testname}_param}) 11 | # Message(${${testname}_param}) 12 | #target_link_libraries( ${testname} zsdll dl pthread aio event) 13 | target_link_libraries( ${testname} zsdll dl pthread aio event snappy) 14 | endif (NOT ${test_src_file} MATCHES "/test.c") 15 | endforeach(test_src_file ${TEST_SOURCES}) 16 | 17 | add_test(zs_group_commit_hw ${CMAKE_CURRENT_BINARY_DIR}/zs_group_commit 1) 18 | -------------------------------------------------------------------------------- /api/tests/misc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-std=gnu99 -fgnu89-inline) 2 | 3 | SET(test_src_file ZS_Listen.c) 4 | get_filename_component(testname ${test_src_file} NAME_WE) 5 | add_executable(${testname} ${test_src_file}) 6 | add_dependencies(${testname} zs) 7 | add_test(gc_admin /bin/bash gc_admin.sh) 8 | target_link_libraries( ${testname} zsdll dl pthread aio event snappy) 9 | -------------------------------------------------------------------------------- /api/tests/misc/FDF_Listen.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | #include 21 | #include 22 | #include 23 | #include "zs.h" 24 | 25 | int main() 26 | { 27 | char fname[1024]; 28 | struct ZS_state* zs_state; 29 | ZS_status_t ret = ZSInit(&zs_state); 30 | assert(ret); 31 | sprintf(fname, "/tmp/zs_listen_pid.%d", getpid()); 32 | int r = open(fname, O_CREAT, 0660); 33 | assert(r > 0); 34 | sleep(60); 35 | (void)ZSShutdown(zs_state); 36 | } 37 | 38 | -------------------------------------------------------------------------------- /api/tests/misc/ZS_Listen.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | #include 21 | #include 22 | #include 23 | #include "zs.h" 24 | 25 | int main() 26 | { 27 | char fname[1024]; 28 | struct ZS_state* zs_state; 29 | // Trx are incompatible with GC, so switching them off 30 | ZSSetProperty("ZS_TRX", "0"); 31 | 32 | ZS_status_t ret = ZSInit(&zs_state); 33 | assert(ret); 34 | sprintf(fname, "/tmp/zs_listen_pid.%d", getpid()); 35 | int r = open(fname, O_CREAT, 0660); 36 | assert(r > 0); 37 | sleep(60); 38 | (void)ZSShutdown(zs_state); 39 | } 40 | 41 | -------------------------------------------------------------------------------- /api/tests/misc/gc_admin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ex 4 | 5 | # /* 6 | # * GC is disabled on Btree since trx is always enabled. Till we find a way to 7 | # * disable trx in new fused libraries setup, this test is disabled. 8 | # */ 9 | 10 | 11 | at_exit() { kill $CHLD; rm $PF; rm /tmp/zs_listen_pid.$CHLD; } 12 | trap at_exit EXIT 13 | 14 | WD=$(readlink -f $(dirname $0)) 15 | PORT=55555 16 | 17 | [ -n "$ZS_PROPERTY_FILE" ] || ZS_PROPERTY_FILE=$WD/../conf/zs.prop 18 | 19 | PF=/tmp/zs.prop.$$ 20 | sed -e '/ZS_ADMIN_PORT/d' \ 21 | -e '/ZS_SLAB_GC/d' \ 22 | -e '/ZS_SLAB_GC_THRESHOLD/d' \ 23 | $ZS_PROPERTY_FILE >$PF 24 | echo "ZS_ADMIN_PORT=$PORT" >>$PF 25 | 26 | export ZS_PROPERTY_FILE=$PF 27 | $WD/ZS_Listen& 28 | 29 | CHLD=$! 30 | 31 | while ! [ -f /tmp/zs_listen_pid.$CHLD ] && [ $((i++ < 120)) ]; do 32 | sleep 1 33 | done 34 | 35 | admin_cmd() { OK=$(echo $1|nc localhost $PORT); [[ $OK == *$2* ]] || exit 1;} 36 | 37 | admin_cmd "gc enable" "OK" 38 | admin_cmd "gc disable" "OK" 39 | 40 | admin_cmd "gc enable" "OK" 41 | admin_cmd "gc enable" "OK" 42 | admin_cmd "gc disable" "OK" 43 | 44 | admin_cmd "gc threshold 44" "OK" 45 | admin_cmd "gc enable" "OK" 46 | admin_cmd "gc disable" "OK" 47 | 48 | admin_cmd "gc enable" "OK" 49 | admin_cmd "gc threshold 55" "OK" 50 | admin_cmd "gc disable" "OK" 51 | 52 | admin_cmd "gc threshold asdf" "Invalid slab GC threshold: asdf" 53 | admin_cmd "gc threshold -100" "Invalid slab GC threshold: -100" 54 | admin_cmd "gc threshold 0" "OK" 55 | admin_cmd "gc threshold" "Invalid arguments. Slab GC threshold." 56 | admin_cmd "gc" "Invalid argument!" 57 | admin_cmd "gc1" "Invalid command:(gc1)" 58 | admin_cmd "gc asdf" "Invalid arguments." 59 | -------------------------------------------------------------------------------- /applib/README: -------------------------------------------------------------------------------- 1 | This directory contains files that get built into a library that the 2 | SDF application (i.e. mySQL, memcached) need to link against. 3 | -------------------------------------------------------------------------------- /applib/XLock.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: XLock.h 22 | * Author: Jim 23 | * 24 | * Created on February 29, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: XLock.h 396 2008-02-29 22:55:43Z jim $ 30 | */ 31 | 32 | // 33 | // Cross-thread locking. This is the PTHREAD-callable version 34 | // 35 | 36 | 37 | #ifndef _APPLIB_XLOCK_H 38 | #define _APPLIB_XLOCK_H 39 | 40 | #include "sdfappcommon/XLock.h" 41 | 42 | void XLock(XLock_t *cross, int write); 43 | int XTryLock(XLock_t *cross, int write); 44 | void XUnlock(XLock_t *cross); 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /applib/XMbox.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: XMbox.h 22 | * Author: Jim 23 | * 24 | * Created on February 29, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http: //www.schoonerinfotech.com/ 28 | * 29 | * $Id: XMbox.h 396 2008-02-29 22:55:43Z jim $ 30 | */ 31 | 32 | /** 33 | * @brief Cross-thread mailbox. This is the FTH-callable version. 34 | */ 35 | 36 | #include 37 | 38 | #include "platform/shmem.h" 39 | #include "sdfappcommon/XMbox.h" 40 | 41 | shmem_void_t ftopMboxWait(ftopMbox_t *xmbox); 42 | shmem_void_t ftopMboxTry(ftopMbox_t *xmbox); 43 | void ptofMboxPost(ptofMbox_sp_t xmboxShmem, shmem_void_t mailShmem); 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /applib/simpleWait.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | #include 21 | 22 | #include "simpleWait.h" 23 | 24 | void 25 | ftopSimpleWait(ftopSimpleSignal_t * sig) 26 | { 27 | int ret; 28 | 29 | do { 30 | ret = sem_wait(&sig->sem); 31 | } while (ret && (errno == EINTR || errno == EAGAIN)); 32 | 33 | plat_assert(ret==0); 34 | } 35 | 36 | void 37 | ftopSimplePost(ftopSimpleSignal_t * sig) 38 | { 39 | sem_post(&sig->sem); 40 | } 41 | 42 | void 43 | ftopSimpleSignalInit(ftopSimpleSignal_t * sig) 44 | { 45 | plat_assert(sig); 46 | /* pshared =1 => good for IPC, value = 0 =>locked state) */ 47 | int ret = sem_init(&sig->sem, 1, 0); 48 | plat_assert(ret==0); 49 | } 50 | 51 | void 52 | ftopSimpleSignalDestroy(ftopSimpleSignal_t * sig) 53 | { 54 | plat_assert(sig); 55 | int ret = sem_destroy(&sig->sem); 56 | plat_assert(ret==0); 57 | } 58 | -------------------------------------------------------------------------------- /applib/simpleWait.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | #ifndef _SDF_APPLIB_SIMPLEWAIT_H 21 | #define _SDF_APPLIB_SIMPLEWAIT_H 22 | 23 | #include 24 | #include "platform/assert.h" 25 | 26 | #ifdef __cplusplus 27 | "C" { 28 | #endif 29 | 30 | typedef struct ftopSimpleSignal { 31 | sem_t sem; 32 | } ftopSimpleSignal_t; 33 | 34 | void ftopSimpleWait(ftopSimpleSignal_t * sig); 35 | void ftopSimplePost(ftopSimpleSignal_t * sig); 36 | void ftopSimpleSignalInit(ftopSimpleSignal_t * sig); 37 | void ftopSimpleSignalDestroy(ftopSimpleSignal_t * sig); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif /* _SDF_APPLIB_SIMPLEWAIT_H */ 44 | -------------------------------------------------------------------------------- /btree/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(btree OBJECT btree_hash.c btree_map.c btree_raw.c btree.c btree_scavenger.c 2 | btree_range.c btree_pmap.c btree_var_leaf.c btree_malloc.c btree_recovery.c packet.c btree_sync_th.c 3 | fdf_wrapper.c trx.c 4 | #../platform/rwlock.c 5 | ../flip/flip.c ../flip/flip_cmd.c 6 | btree_snapshot.c btree_sync_th.c btree_sync_mbox.c btree_mem.c) 7 | #target_link_libraries(btree zsdll) 8 | add_definitions(-Wno-parentheses -Wno-unused) 9 | -------------------------------------------------------------------------------- /btree/btree_hash.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: utils/hash.h 22 | * Author: Jim 23 | * 24 | * Created on March 3, 2008, 1:38 PM 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: hash.c 399 2008-02-28 23:46:15Z darpan $ 30 | */ 31 | 32 | #ifndef __BTREE_HASH_H 33 | #define __BTREE_HASH_H 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | // 41 | // Header file for Bob Tuttles lookup8 hash algorithm 42 | // 43 | // This is fast on 64-bit machines. Just mask off the bits you need for shorter keys. 44 | // 45 | 46 | // Level is an arbitrary salt for the hash. 47 | uint64_t btree_hash_int(const unsigned char *key, uint64_t keyLength, uint64_t level); 48 | uint64_t btree_hash(const unsigned char *key, uint64_t keyLength, uint64_t level, uint64_t cguid); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /btree/btree_malloc.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | 21 | #ifndef _BTREE_MALOC_H_ 22 | 23 | #define _BTREE_MALOC_H_ 24 | #include 25 | #include 26 | 27 | uint64_t 28 | get_tod_usecs(void); 29 | 30 | void 31 | btree_memcpy(void *dst, const void *src, size_t length, bool dry_run); 32 | 33 | void * 34 | btree_malloc( size_t n); 35 | 36 | 37 | void 38 | btree_free( void *v); 39 | 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /btree/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-std=gnu99 -fgnu89-inline) 2 | 3 | add_executable(btest_life_cycle ${test_src_file} 4 | btest_life_cycle.c btest_common.c) 5 | #set_property(TARGET btest_life_cycle PROPERTY COMPILE_DEFINITIONS BTREE_MODE) 6 | 7 | add_executable(btest_range ${test_src_file} 8 | btest_range.c btest_common.c) 9 | #set_property(TARGET btest_range PROPERTY COMPILE_DEFINITIONS BTREE_MODE) 10 | 11 | add_executable(query_perf_comp ${test_src_file} 12 | query_perf_comp.c) 13 | #set_property(TARGET query_perf_comp PROPERTY COMPILE_DEFINITIONS BTREE_MODE) 14 | 15 | target_link_libraries( btest_life_cycle zs zsdll dl pthread aio event snappy 16 | lz4) 17 | target_link_libraries( btest_range zs zsdll dl pthread aio event snappy lz4) 18 | target_link_libraries( query_perf_comp zs zsdll dl pthread aio event snappy 19 | lz4) 20 | 21 | add_test(btree_self_test btest_life_cycle) 22 | add_test(btree_self_test2K btest_life_cycle -k 1960) 23 | -------------------------------------------------------------------------------- /btree/tests/btest_life_cycle.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /************************************************************************ 21 | * 22 | * btest_life_cycle.c Jan. 21, 2013 Harihara Kadayam 23 | * 24 | * Built-in self-Test program for btree package. 25 | * 26 | * NOTES: xxxzzz 27 | * 28 | ************************************************************************/ 29 | 30 | #include 31 | #include 32 | #include "btest_common.h" 33 | 34 | int main(int argc, char *argv[]) 35 | { 36 | btest_cfg_t *cfg; 37 | 38 | cfg = btest_init(argc, argv, "btest_lifecycle_test", NULL); 39 | if (cfg == NULL) { 40 | return 0; 41 | } 42 | 43 | btest_rand_data_gen(cfg); 44 | btest_life_cycle(cfg); 45 | 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /cmake_old/api/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-std=gnu99 -fgnu89-inline) 2 | #add parameter here as SET(testname_param arg1 arg2 ...) 3 | SET(default_param 1 8 10000) 4 | SET(fdf_multi_test_param 1 8 1000) 5 | SET(fdf_mput_param 1000 100 10) 6 | 7 | file( GLOB TEST_SOURCES *.c ) 8 | foreach( test_src_file ${TEST_SOURCES} ) 9 | IF(NOT ${test_src_file} MATCHES "/test.c") 10 | get_filename_component(testname ${test_src_file} NAME_WE) 11 | add_executable(${testname} ${test_src_file} test.c) 12 | add_executable(${testname}_btree ${test_src_file} test.c) 13 | add_dependencies(${testname} fdf) 14 | 15 | #add_executable(${testname}_btree ${test_src_file} test.c) 16 | #set_property(TARGET ${testname}_btree PROPERTY COMPILE_DEFINITIONS BTREE_MODE) 17 | #add_dependencies(${testname}_btree fdf) 18 | 19 | IF(NOT ${testname}_param) 20 | #MESSAGE(param is ${default_param}) 21 | add_test(${testname} ${CMAKE_CURRENT_BINARY_DIR}/${testname} ${default_param}) 22 | add_test(${testname}_btree ${CMAKE_CURRENT_BINARY_DIR}/${testname}_btree ${default_param}) 23 | ELSE(NOT ${testname}_param) 24 | #MESSAGE(param is ${${testname}_param}) 25 | add_test(${testname} ${CMAKE_CURRENT_BINARY_DIR}/${testname} ${${testname}_param}) 26 | add_test(${testname}_btree ${CMAKE_CURRENT_BINARY_DIR}/${testname}_btree ${${testname}_param}) 27 | ENDIF(NOT ${testname}_param) 28 | target_link_libraries( ${testname} fdfdll dl pthread aio event snappy) 29 | #target_link_libraries( ${testname}_btree fdfdll dl pthread aio event snappy) 30 | target_link_libraries( ${testname}_btree btreedll dl pthread aio event snappy) 31 | ENDIF(NOT ${test_src_file} MATCHES "/test.c") 32 | endforeach(test_src_file ${TEST_SOURCES}) 33 | -------------------------------------------------------------------------------- /cmake_old/api/tests/btree/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-std=gnu99 -fgnu89-inline) 2 | #SET(testname_param 1 8 10000) 3 | SET(fdf_mput_param 1 1000 100 10) 4 | SET(fdf_mput_pstats_param 1 1000 100 10) 5 | SET(fdf_rangeupdate_param 1000 10) 6 | SET(fdf_snapshot_param 1000 10 15) 7 | SET(fdf_big_writes_param 100 1000 1 1048576) 8 | SET(FDF_Write_mthreads_param 1000 1 1450 1024 1 1) 9 | 10 | file( GLOB TEST_SOURCES *.c ) 11 | foreach( test_src_file ${TEST_SOURCES} ) 12 | IF(NOT ${test_src_file} MATCHES "/test.c") 13 | get_filename_component(testname ${test_src_file} NAME_WE) 14 | add_executable(${testname} ${test_src_file} ../test.c) 15 | # set_property(TARGET ${testname} PROPERTY COMPILE_DEFINITIONS BTREE_MODE) 16 | #add_dependencies(${testname} fdfdll) 17 | add_dependencies(${testname} fdf) 18 | SET(param ${testname}_param) 19 | add_test(${testname} ${CMAKE_CURRENT_BINARY_DIR}/${testname} ${${testname}_param}) 20 | # Message(${${testname}_param}) 21 | target_link_libraries( ${testname} btreedll dl pthread aio event snappy) 22 | endif (NOT ${test_src_file} MATCHES "/test.c") 23 | endforeach(test_src_file ${TEST_SOURCES}) 24 | 25 | add_test(FDF_Write_mthreads2k ${CMAKE_CURRENT_BINARY_DIR}/FDF_Write_mthreads 1000 1 1960 1024 1 1) 26 | 27 | -------------------------------------------------------------------------------- /cmake_old/btree/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(btree SHARED btree_hash.c btree_map.c btree_raw.c btree.c btree_scavenger.c 2 | btree_range.c btree_pmap.c btree_var_leaf.c btree_malloc.c btree_recovery.c packet.c btree_sync_th.c 3 | fdf_wrapper.c trx.c ../platform/rwlock.c ../flip/flip.c ../flip/flip_cmd.c 4 | btree_snapshot.c btree_sync_th.c btree_sync_mbox.c btree_mem.c) 5 | target_link_libraries(btree fdfdll) 6 | add_definitions(-Wno-parentheses -Wno-unused) 7 | -------------------------------------------------------------------------------- /cmake_old/btree/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-std=gnu99 -fgnu89-inline) 2 | 3 | add_executable(btest_life_cycle ${test_src_file} 4 | btest_life_cycle.c btest_common.c) 5 | #set_property(TARGET btest_life_cycle PROPERTY COMPILE_DEFINITIONS BTREE_MODE) 6 | 7 | add_executable(btest_range ${test_src_file} 8 | btest_range.c btest_common.c) 9 | #set_property(TARGET btest_range PROPERTY COMPILE_DEFINITIONS BTREE_MODE) 10 | 11 | add_executable(query_perf_comp ${test_src_file} 12 | query_perf_comp.c) 13 | #set_property(TARGET query_perf_comp PROPERTY COMPILE_DEFINITIONS BTREE_MODE) 14 | 15 | target_link_libraries( btest_life_cycle btree fdfdll dl pthread aio event snappy) 16 | target_link_libraries( btest_range btree fdfdll dl pthread aio event snappy) 17 | target_link_libraries( query_perf_comp btree fdfdll dl pthread aio event snappy) 18 | 19 | add_test(btree_self_test btest_life_cycle) 20 | add_test(btree_self_test2K btest_life_cycle -k 1960) 21 | -------------------------------------------------------------------------------- /cmake_old/dll/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #IF(NOT DEBUG) 2 | add_library(fdfdll STATIC fdf_dll.c) 3 | add_library(btreedll STATIC btree_dll.c) 4 | #ENDIF(NOT DEBUG) 5 | -------------------------------------------------------------------------------- /cmds/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB_RECURSE LIC_FILE RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../license/*.c ${CMAKE_CURRENT_SOURCE_DIR}/../license/*.cpp) 2 | file( GLOB TEST_SOURCES *.c ) 3 | foreach( test_src_file ${TEST_SOURCES} ) 4 | get_filename_component(testname ${test_src_file} NAME_WE) 5 | add_executable(${testname} ${test_src_file} ${LIC_FILE}) 6 | endforeach(test_src_file ${TEST_SOURCES}) 7 | 8 | -------------------------------------------------------------------------------- /dll/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #IF(NOT DEBUG) 2 | add_library(zsdll STATIC zs_dll.c) 3 | #add_library(btreedll STATIC btree_dll.c) 4 | #ENDIF(NOT DEBUG) 5 | -------------------------------------------------------------------------------- /dll/README: -------------------------------------------------------------------------------- 1 | Running ZS As A DLL 2 | ==================== 3 | 4 | 5 | Building libzsdll.a 6 | -------------------- 7 | After checking out membrain-4.3 (or whatever this branch currently is), cd to 8 | the appropriate directory and type make: 9 | 10 | cd membrain-4.3/membrain/server/sdf/api/dll 11 | make 12 | 13 | 14 | Compiling 15 | --------- 16 | When compiling, instead of specifying libzs.a as the ZS library, instead use 17 | libzsdll.a. 18 | 19 | gcc -o test test.c libzsdll.a 20 | 21 | 22 | Running 23 | ------- 24 | Once loaded, the executable will look for the library in several fixed 25 | locations; in the following order: 26 | 27 | /usr/lib64/zs/libzs.so 28 | /usr/lib/zs/libzs.so 29 | /lib64/libzs.so 30 | /lib/libzs.so 31 | /usr/local/lib64/libzs.so 32 | /usr/local/lib/libzs.so 33 | 34 | So if it is placed in one of these locations, one can run the executable as 35 | expected and the library will automatically be found: 36 | 37 | ./test hello 38 | 39 | If it is not in one of the above locations, LD_LIBRARY_PATH is searched to find 40 | libzs.so. So you could place libzs.so in /usr/local/zs/libzs.so and then 41 | run it as follows: 42 | 43 | export LD_LIBRARY_PATH=/usr/local/zs 44 | ./test hello 45 | 46 | Finally, if you set the environment variable ZS_LIB, it will only look for the 47 | library there. If you want to use /tmp/libzsdbg.so as your library, you can 48 | run it as follows: 49 | 50 | export ZS_LIB=/tmp/libzsdbg.so 51 | ./test hello 52 | -------------------------------------------------------------------------------- /dll/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(test) 2 | cmake_minimum_required(VERSION 2.8.8) 3 | file(GLOB SOURCES *.c ../fdf_dll.c) 4 | add_executable(test ${SOURCES}) 5 | add_definitions(-g -Wall -Werror) 6 | include_directories(../../api ../..) 7 | target_link_libraries(test dl pthread aio rt event m) 8 | -------------------------------------------------------------------------------- /dll/test/fdf_easy_int.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * An easier interface to ZS. 22 | * Author: Johann George 23 | * 24 | * Copyright (c) 2012-2013, Sandisk Corporation. All rights reserved. 25 | */ 26 | #include "zs.h" 27 | #include "zs_easy.h" 28 | 29 | 30 | /* 31 | * Property. 32 | */ 33 | typedef struct zs_prop { 34 | struct zs_prop *next; 35 | const char *name; 36 | const char *value; 37 | } zs_prop_t; 38 | 39 | 40 | /* 41 | * Function prototypes. 42 | */ 43 | void zs_link_(void); 44 | void fdf.conf_done_(zs_t *zs); 45 | void zs_aperr_(char **errp, const char *func, 46 | ZS_status_t zs_err, int sys_err, const char *fmt, ...); 47 | char *zs_errmsg_(ZS_status_t ferr); 48 | -------------------------------------------------------------------------------- /dll/test/t2.prop: -------------------------------------------------------------------------------- 1 | ZS_FLASH_SIZE = 4G 2 | ZS_FLASH_FILENAME = /tmp/zs_disk%d 3 | -------------------------------------------------------------------------------- /dll/test/test.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * Author: Johann George 22 | * Copyright (c) 2012-2013, Sandisk Corporation. All rights reserved. 23 | */ 24 | #ifndef TEST_H 25 | #define TEST_H 26 | 27 | 28 | /* 29 | * Command line interpreter information. 30 | */ 31 | typedef struct clint { 32 | void (*do_arg)(char *arg, char **args, struct clint **clint); 33 | void *user; 34 | struct clopt { 35 | char *str; 36 | int req; 37 | } opts[]; 38 | } clint_t; 39 | 40 | 41 | /* 42 | * Function prototypes. 43 | */ 44 | void test_info(char *name, char *desc, char *help, 45 | clint_t *clint, void (*func)()); 46 | 47 | 48 | /* 49 | * Global variables. 50 | */ 51 | int Verbose; 52 | 53 | #endif /* TEST_H */ 54 | -------------------------------------------------------------------------------- /dll/test/test.prop: -------------------------------------------------------------------------------- 1 | #ZS_LOG_LEVEL = warning 2 | #ASYNC_DELETE_CONTAINERS = 0 3 | #SDF_REFORMAT = 1 4 | #ZS_FLASH_SIZE = 4G 5 | #ZS_FLASH_FILENAME = /tmp/zs_disk%d 6 | #ZS_STATS_THREAD = 1 7 | #ZS_STATS_DUMP_INTERVAL = 1 8 | #ZS_STATS_FILE = /tmp/zs.stats 9 | 10 | #ZS_LOG_FLUSH_DIR = /dev/shm 11 | #ZS_FLASH_FILENAME = /dev/shm/zs_disk%d 12 | #ZS_O_DIRECT = 0 13 | #ZS_TEST_MODE = 1 14 | #HUSH_FASTCC = 1 15 | 16 | #C0_SIZE = 1G 17 | #C0_FIFO_MODE = 0 18 | #C0_PERSISTENT = 1 19 | #C0_EVICTING = 0 20 | C0_WRITETHRU = 1 21 | #C0_CID = 0 22 | #C0_NUM_SHARDS = 1 23 | #C0_DURABILITY_LEVEL = PERIODIC 24 | 25 | #C1_SIZE = 1024 26 | -------------------------------------------------------------------------------- /dll/test/xstr.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * Author: Johann George. 22 | */ 23 | #ifndef XSTR_H 24 | #define XSTR_H 25 | 26 | /* 27 | * Expandable structures. 28 | * 29 | * c - Set if we want new space cleared. 30 | * i - Amount used (only for strings). 31 | * n - Number allocated. 32 | * p - Pointer to data. 33 | * s - Size. 34 | */ 35 | typedef struct xstr { 36 | void *p; 37 | int s; 38 | int c; 39 | int i; 40 | int n; 41 | } xstr_t; 42 | 43 | 44 | int xsvprint(xstr_t *xp, char *fmt, va_list alist); 45 | void xsfree(xstr_t *xp); 46 | void xsinit(xstr_t *xp); 47 | void xsprint(xstr_t *xp, char *fmt, ...); 48 | void xafree(xstr_t *xp); 49 | void *xasubs(xstr_t *xp, int i); 50 | void *xainit(xstr_t *xp, int esize, int asize, int clear); 51 | 52 | #endif /* XSTR_H */ 53 | -------------------------------------------------------------------------------- /doc/FDF1.2_DesignDocument.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SanDisk-Open-Source/zetascale/1ab8ae28947169a25fa934824af56c23c7a3e920/doc/FDF1.2_DesignDocument.docx -------------------------------------------------------------------------------- /doc/FDF_programming_guide.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SanDisk-Open-Source/zetascale/1ab8ae28947169a25fa934824af56c23c7a3e920/doc/FDF_programming_guide.docx -------------------------------------------------------------------------------- /doc/ZS_QuickStart_guide.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SanDisk-Open-Source/zetascale/1ab8ae28947169a25fa934824af56c23c7a3e920/doc/ZS_QuickStart_guide.docx -------------------------------------------------------------------------------- /ecc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(ECC_SRC ecc_recover.c lfsr.c discrete_math.c) 2 | ADD_LIBRARY(ecc OBJECT ${ECC_SRC}) 3 | -------------------------------------------------------------------------------- /ecc/discrete_math.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: ecc_test.c 22 | * Author: gshaw 23 | * 24 | * Created on August 29, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: ecc_test.c,v 1.1 2008/08/27 17:33:09 gshaw Exp gshaw $ 30 | */ 31 | 32 | #include "discrete_math.h" 33 | 34 | /* 35 | * p2_ceiling() and log2_ceiling() have been converted to a macros 36 | * so that they can support multiple integral types. 37 | * 38 | * That means for now discrete_math.c is empty. But, more functions 39 | * will be added. 40 | */ 41 | -------------------------------------------------------------------------------- /ecc/ecc_size.pl: -------------------------------------------------------------------------------- 1 | #! /usr/bin/perl 2 | 3 | =pod 4 | 5 | =begin description 6 | 7 | Print table of data sizes and the size in bits required for 8 | the ECC data for that size. 9 | 10 | =end description 11 | 12 | =cut 13 | 14 | require 5.0; 15 | use strict; 16 | use warnings; 17 | use Carp; 18 | 19 | my $debug; 20 | my $verbose; 21 | 22 | sub eprint { 23 | print {*STDERR} @_; 24 | } 25 | 26 | sub eprintf { 27 | printf {*STDERR} @_; 28 | } 29 | 30 | # Ceiling of log base 2 of n. 31 | # 32 | sub log2_ceiling($) { 33 | my ($n) = @_; 34 | my $i; 35 | my $p; 36 | 37 | $p = 1; 38 | for ($i = 0; $p < $n; ++$i) { 39 | $p *= 2; 40 | } 41 | return $i; 42 | } 43 | 44 | 45 | $debug = 0; 46 | $verbose = 0; 47 | while (defined($ARGV[0]) && $ARGV[0] =~ /^-/) { 48 | $_ = $ARGV[0]; 49 | if ($_ eq '-d') { 50 | $debug = 1; 51 | } 52 | elsif (m/^-d(\d+)$/) { 53 | $debug = $1; 54 | } 55 | elsif ($_ eq '-v') { 56 | $verbose = 1; 57 | } 58 | elsif ($_ eq '-') { 59 | last; 60 | } 61 | elsif ($_ eq '--') { 62 | shift; 63 | last; 64 | } 65 | else { 66 | die "Unknown option, '$_'\n "; 67 | } 68 | shift; 69 | } 70 | shift if (scalar(@ARGV) > 0 && !defined($ARGV[0])); 71 | 72 | my $szc; 73 | my $sz; 74 | 75 | print ' ECC', "\n"; 76 | print 'p2 data-size bits', "\n"; 77 | print '-- ---------- ----', "\n"; 78 | for ($szc = 0; $szc <= 32; ++$szc) { 79 | $sz = 1 << $szc; 80 | printf "%2u %10u %4u\n", $szc, $sz, 2 * log2_ceiling($sz * 8); 81 | } 82 | 83 | exit 0; 84 | -------------------------------------------------------------------------------- /fth/AIOTrace/README: -------------------------------------------------------------------------------- 1 | 1/4/2010 2 | 3 | This directory contains the source to a utility 4 | for post-processing an aio trace collected by 5 | memcached. 6 | 7 | To collect an AIO trace do the following: 8 | 9 | - recompile the trunk with AIO_TRACE defined 10 | in the topmost Makefile.defs.local file. 11 | - Before you do a run, create a directory called 12 | "AT" in the directory where you invoke memcached. 13 | This is the directory where the aio trace files are 14 | collected. 15 | - Make your run. 16 | - Rename the AT directory so it isn't clobbered the next 17 | time you do a run. 18 | 19 | To analyze an aio trace use the "aa" utility that is compiled 20 | in trunk/sdf/fth/AIOTrace. Type "aa" by itself to get the usage. 21 | -------------------------------------------------------------------------------- /fth/AIOTrace/hash.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: hash.h 22 | * Author: Jim 23 | * 24 | * Created on March 3, 2008, 1:38 PM 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: hash.c 399 2008-02-28 23:46:15Z darpan $ 30 | */ 31 | 32 | #ifndef __HASH_H 33 | #define __HASH_H 34 | 35 | // 36 | // Header file for Bob Tuttles lookup8 hash algorithm 37 | // 38 | // This is fast on 64-bit machines. Just mask off the bits you need for shorter keys. 39 | // 40 | 41 | // Level is an arbitrary salt for the hash. 42 | uint64_t hash(const unsigned char *key, uint64_t keyLength, uint64_t level); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /fth/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-fno-builtin-printf) 2 | add_library(fth OBJECT fth.c 3 | fthLock.c 4 | fthMbox.c 5 | fthSem.c 6 | fthOpt.c 7 | fthSignal.c) 8 | add_dependencies(fth ffdc) 9 | -------------------------------------------------------------------------------- /fth/LockTrace/Sample_Run_Script: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | # usage: la [] > 4 | # 5 | # : directory containing lock trace files 6 | # : executable that generated the lock trace files 7 | # : number of trace records to dump [optional] 8 | # 9 | # 10 | 11 | la /home/okrafka/src/trunk/src/trunk/apps/memcached/server/memcached-1.2.5-schooner/LT /home/okrafka/src/trunk/src/trunk/apps/memcached/server/memcached-1.2.5-schooner/build/memcached-fthread-sdf/memcached-fthread-sdf-lt_o 1000 12 | -------------------------------------------------------------------------------- /fth/LockTrace/hash.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: hash.h 22 | * Author: Jim 23 | * 24 | * Created on March 3, 2008, 1:38 PM 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: hash.c 399 2008-02-28 23:46:15Z darpan $ 30 | */ 31 | 32 | #ifndef __HASH_H 33 | #define __HASH_H 34 | 35 | // 36 | // Header file for Bob Tuttles lookup8 hash algorithm 37 | // 38 | // This is fast on 64-bit machines. Just mask off the bits you need for shorter keys. 39 | // 40 | 41 | // Level is an arbitrary salt for the hash. 42 | uint64_t hash(const unsigned char *key, uint64_t keyLength, uint64_t level); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /fth/archive/fth.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * By default, the fth scheduler is now always multi-queue with a floating 22 | * thread. To go back to the old scheduler and compile-time options, set 23 | * "-Duse_old_scheduler" in Makefile.defs.local: 24 | * 25 | * LOCAL_CFLAGS += -Duse_old_scheduler 26 | */ 27 | 28 | #ifdef use_old_scheduler 29 | #include "fth_std.c" 30 | #else 31 | #include "fth_float.c" 32 | #endif 33 | -------------------------------------------------------------------------------- /fth/archive/fthDispatchQ.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: fthDispatchQ.c 22 | * Author: Jim 23 | * 24 | * Created on February 29, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http: //www.schoonerinfotech.com/ 28 | * 29 | * $Id: fthDispatchQ.c 396 2008-02-29 22:55:43Z jim $ 30 | */ 31 | 32 | #define FTH_DISPATCHQ_C 33 | 34 | #include "fthDispatchQ.h" 35 | 36 | -------------------------------------------------------------------------------- /fth/archive/pthreadSpeed.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | #include 21 | #include 22 | 23 | int iterations; 24 | 25 | void *threadRoutine1(void *arg) { 26 | int i; 27 | 28 | for (i = 0; i < iterations; i++) { 29 | sched_yield(); 30 | // printf("In %i/%i\n", (int) arg, i); 31 | } 32 | 33 | pthread_exit(NULL); 34 | } 35 | 36 | int main(int argc, char **argv) { 37 | 38 | iterations = atoi(argv[1]); 39 | 40 | pthread_t thread1, thread2; 41 | 42 | int t1 = pthread_create(&thread1, NULL, &threadRoutine1, (int *) 1); 43 | int t2 = pthread_create(&thread2, NULL, &threadRoutine1, (int *) 2); 44 | 45 | pthread_join(thread1, NULL); 46 | pthread_join(thread2, NULL); 47 | } 48 | -------------------------------------------------------------------------------- /fth/fthMem.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: fthMem.h 22 | * Author: Jim 23 | * 24 | * Created on February 29, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http: //www.schoonerinfotech.com/ 28 | * 29 | * $Id: fthMem.h 396 2008-02-29 22:55:43Z jim $ 30 | */ 31 | 32 | #ifndef __FTH_MEM_H 33 | #define __FTH_MEM_H 34 | 35 | #include "platform/types.h" 36 | 37 | #define FTH_MEMQ_MAX 10 // Up to 10 memQs can be active 38 | 39 | uint32_t fthMemQAlloc(void); 40 | uint64_t fthMemWait(uint64_t *mem, int queueNum); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /fth/fthMutex.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: fthMutex.h 22 | * Author: Jim 23 | * 24 | * Created on February 29, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http: //www.schoonerinfotech.com/ 28 | * 29 | * $Id: fthMutex.h 396 2008-02-29 22:55:43Z jim $ 30 | */ 31 | 32 | #ifndef __FTH_MUTEX_H 33 | #define __FTH_MUTEX_H 34 | 35 | #include "platform/types.h" 36 | #include 37 | 38 | void fthMutexLock(pthread_mutex_t *mutex); 39 | void fthMutexUnlock(pthread_mutex_t *mutex); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /fth/fthSchedType.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: fthSchedType.h 22 | * Author: Jim 23 | * 24 | * Created on February 29, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http: //www.schoonerinfotech.com/ 28 | * 29 | * $Id: fthSchedType.h 396 2008-02-29 22:55:43Z jim $ 30 | */ 31 | #ifndef _FTH_SCHED_TYPE_H 32 | #define _FTH_SCHED_TYPE_H 33 | 34 | // Defines the type of stack control used by the scheduler. Pick one. 35 | #define fthAsmDispatch 1 36 | //#define fthSetjmpLongjmp 1 37 | 38 | #ifndef FTH_MAX_SCHEDS 39 | // #define FTH_MAX_SCHEDS 16 40 | #define FTH_MAX_SCHEDS 1 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /fth/fthSem.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: fthSem.h 22 | * Author: drew 23 | * 24 | * Created on April 22, 2009 25 | * 26 | * (c) Copyright 2009, Schooner Information Technology, Inc. 27 | * http: //www.schoonerinfotech.com/ 28 | * 29 | * $Id: fthSem.h 6914 2009-04-23 06:05:29Z drew $ 30 | */ 31 | 32 | // Semaphore 33 | 34 | #ifndef _FTH_SEM_H 35 | #define _FTH_SEM_H 36 | 37 | #include "fthMbox.h" 38 | 39 | typedef struct fthSem { 40 | fthMbox_t mbox; 41 | } fthSem_t; 42 | 43 | /** @brief Initialize sem with initial count */ 44 | void fthSemInit(struct fthSem *sem, int count); 45 | 46 | /** @brief Add count to sem */ 47 | void fthSemUp(struct fthSem *sem, int count); 48 | 49 | /** @brief Block until count are decremented from sem */ 50 | void fthSemDown(struct fthSem *sem, int count); 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /fth/fthSocket.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: fthSocket.h 22 | * Author: Jim 23 | * 24 | * Created on February 29, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http: //www.schoonerinfotech.com/ 28 | * 29 | * $Id: fthSocket.h 396 2008-02-29 22:55:43Z jim $ 30 | */ 31 | 32 | // 33 | // Test program for many fth functions 34 | // 35 | 36 | 37 | #ifndef _FTH_SOCKET_H 38 | #define _FTH_SOCKET_H 39 | 40 | #include 41 | 42 | // We wait a long time between checks of the socket since a socket op is 43 | // both unusual and not time critical 44 | #define FTH_SOCKET_YIELD_COUNT 100 45 | 46 | int fthSockWait(int count, ...); 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /fth/fthThreadQ.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: fthThreadQ.c 22 | * Author: Jim 23 | * 24 | * Created on February 29, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http: //www.schoonerinfotech.com/ 28 | * 29 | * $Id: fthThreadQ.c 396 2008-02-29 22:55:43Z jim $ 30 | */ 31 | 32 | #define FTH_THREADQ_C 33 | 34 | #include "fthSpinLock.h" 35 | #include "fth.h" 36 | 37 | #include "fthThreadQ.h" 38 | 39 | -------------------------------------------------------------------------------- /fth/fthThreadQDefines.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: fthThreadQDefines.h 22 | * Author: drew 23 | * 24 | * Created on August 11, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http: //www.schoonerinfotech.com/ 28 | * 29 | * $Id: fthThreadQDefines.h 2791 2008-08-11 23:30:33Z drew $ 30 | */ 31 | 32 | /* 33 | * The way the intrusive lists work, we need to 34 | * - Define the list types 35 | * - Define the structure which inturn has list entry elements 36 | * - Define the inlines 37 | * 38 | * This mess is easiest when an idempotent #define part of the lll 39 | * goo exists. 40 | */ 41 | 42 | // Linked list definitions for threads 43 | #undef LLL_NAME 44 | #undef LLL_EL_TYPE 45 | #undef LLL_EL_FIELD 46 | #undef LLL_INLINE 47 | 48 | #define LLL_NAME(suffix) fthThreadQ ## suffix 49 | #define LLL_EL_TYPE struct fthThread 50 | #define LLL_EL_FIELD threadQ 51 | 52 | 53 | -------------------------------------------------------------------------------- /fth/fthWaitQ.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: fthWaitQ.c 22 | * Author: Jim 23 | * 24 | * Created on February 29, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http: //www.schoonerinfotech.com/ 28 | * 29 | * $Id: fthWaitQ.h 396 2008-02-29 22:55:43Z jim $ 30 | */ 31 | 32 | #define FTH_WAITQ_C 33 | 34 | #include "fthSpinLock.h" 35 | #include "fth.h" 36 | 37 | #include "fthWaitEl.h" 38 | -------------------------------------------------------------------------------- /fth/fthXLock.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: fthXLock.h 22 | * Author: Jim 23 | * 24 | * Created on February 29, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http: //www.schoonerinfotech.com/ 28 | * 29 | * $Id: fthXLock.h 396 2008-02-29 22:55:43Z jim $ 30 | */ 31 | 32 | // 33 | // X-threading (pthread/fth) lock 34 | // 35 | 36 | #ifndef _FTH_XLOCK_H 37 | #define _FTH_XLOCK_H 38 | 39 | #include "sdfappcommon/XLock.h" 40 | 41 | // There are two definitions of this routine - one for pthread and one for fth. Be sure to 42 | // include the right one or all bets are off. 43 | void fthXLockInit(XLock_t *cross); 44 | void fthXLock(XLock_t *cross, int write); 45 | int fthXTryLock(XLock_t *cross, int write); 46 | void fthXUnlock(XLock_t *cross); 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /fth/fthXMbox.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: fthXMbox.h 22 | * Author: Jim 23 | * 24 | * Created on February 29, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http: //www.schoonerinfotech.com/ 28 | * 29 | * $Id: fthXMbox.h 396 2008-02-29 22:55:43Z jim $ 30 | */ 31 | 32 | /** 33 | * @brief Cross-thread mailbox. This is the FTH-callable version. 34 | */ 35 | 36 | // Include the common portion 37 | #include "sdfappcommon/XMbox.h" 38 | 39 | // Routine definitions 40 | void ftopMboxPost(ftopMbox_t *xmbox, shmem_void_t mailShmem); 41 | shmem_void_t ptofMboxWait(ptofMbox_t *mb); 42 | shmem_void_t ptofMboxTry(ptofMbox_t *mb); 43 | -------------------------------------------------------------------------------- /fth/fthlllUndef.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: fthlll_undef.h 22 | * Author: drew 23 | * 24 | * Created on March 26, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http: //www.schoonerinfotech.com/ 28 | * 29 | * $Id: fthlll_undef.h 941 2008-04-09 21:24:02Z jim $ 30 | */ 31 | 32 | /** 33 | * Undef whatever macros the current version of fthlll.h and fthlll_c.h are 34 | * using. 35 | */ 36 | #undef LLL_SHMEM 37 | #undef LLL_NAME 38 | #undef LLL_EL_TYPE 39 | #undef LLL_SP_NAME 40 | #undef LLL_INLINE 41 | #undef LLL_EL_FIELD 42 | -------------------------------------------------------------------------------- /license/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB_RECURSE LIC2_FILE RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} 2 | ${CMAKE_CURRENT_SOURCE_DIR}/../license/*/*.c 3 | ${CMAKE_CURRENT_SOURCE_DIR}/../license/*/*.cpp) 4 | add_library(license OBJECT interface.c versions.c utils.cpp ${LIC2_FILE}) 5 | 6 | -------------------------------------------------------------------------------- /license/version_2_0/license: -------------------------------------------------------------------------------- 1 | @@LICENSE@@ 2 | NOTE: Machine-generated content. 3 | © Copyright SanDisk Inc. 2013. All rights reserved. 4 | http://www.sandisk.com 5 | 6 | DO NOT EDIT THIS FILE. 7 | @@FORMAT@@ 8 | v2.0 9 | @@CONTACT@@ 10 | Contact:ZS Engineering 11 | Company:SanDisk 12 | Email:schooner.support@sandisk.com 13 | @@PARTICULARS@@ 14 | Product:ZetaScale 15 | Version:all 16 | Scope:Multiple 17 | Type:Permanent 18 | License ID:Internal license (For ZS engineering team only) 19 | @@CIPHERTEXT@@ 20 | 73052B37DC785F1D0D7CDD52B96C36999088915322496A5E9FF7686DE086A2A3FAF1018C22B99C7D444F5230D465547AB16843A98E492BDA709AC399F6F51566E98A62D2D66561865618C31F9E5B131608B13A7F214B7F3DC43838D0096C06C373EA264D3667D0DC2D8FEA183960E93FBEE7012750A02C12 21 | @@END@@ 22 | -------------------------------------------------------------------------------- /misc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(misc OBJECT parse_int.c 2 | parse_reseed.c 3 | parse_string.c 4 | parse_string_alloc.c 5 | parse_size.c 6 | parse_time.c 7 | parse_uint.c 8 | parse_int32.c 9 | parse_uint64.c 10 | seed.c 11 | stop.c 12 | timeout.c 13 | ) 14 | add_dependencies(misc ffdc) 15 | -------------------------------------------------------------------------------- /misc/Makefile.inc: -------------------------------------------------------------------------------- 1 | # $Id: Makefile.inc 9059 2009-09-04 00:50:42Z johann $ 2 | 3 | # While the plethora of subdirectories have been useful for keeping things 4 | # grouped, link order (especially circular dependencies amongst 5 | # platform, misc, etc) have become a headache. 6 | 7 | # The miscellaneous files are listed here; the grand unified library 8 | # just includes this, tacks it on the appropriate LIB SRCS, and vpaths 9 | 10 | MISC_SRCS = \ 11 | parse_int.c \ 12 | parse_reseed.c \ 13 | parse_string.c \ 14 | parse_string_alloc.c \ 15 | parse_size.c \ 16 | parse_time.c \ 17 | parse_uint.c \ 18 | parse_int32.c \ 19 | parse_uint64.c \ 20 | seed.c \ 21 | stop.c \ 22 | timeout.c 23 | -------------------------------------------------------------------------------- /misc/parse_int32.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: sdf/misc/parse_int32.c 22 | * Author: Johann George 23 | * (c) Copyright 2009, Schooner Information Technology, Inc. 24 | */ 25 | 26 | #include 27 | #include 28 | #include 29 | #include "misc.h" 30 | 31 | int 32 | parse_int32(int32_t *ptr, const char *str) 33 | { 34 | char *end; 35 | 36 | if (str[0] == '@') 37 | str++; 38 | *ptr = strtol((char *)str, &end, 0); 39 | if (*end) 40 | return -EINVAL; 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /misc/parse_reseed.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: sdf/misc/parse_uint.c 22 | * Author: drew 23 | * 24 | * Created on February 15, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: parse_reseed.c 281 2008-02-17 00:58:00Z drew $ 30 | */ 31 | 32 | #include 33 | 34 | #include "platform/stdlib.h" 35 | 36 | #include "misc.h" 37 | 38 | /** 39 | * Parse reseed command line argument to seed program random number generator. 40 | */ 41 | int 42 | parse_reseed(const char *string) { 43 | int ret; 44 | unsigned int seed; 45 | 46 | ret = parse_uint(&seed, string, NULL); 47 | if (!ret) { 48 | plat_srandom(seed); 49 | } 50 | 51 | return (ret); 52 | } 53 | -------------------------------------------------------------------------------- /misc/parse_string.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: parse_string_alloc.c 22 | * Author: drew 23 | * 24 | * Created on April 3, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: parse_string_alloc.c 182 2008-02-06 20:00:51Z drew $ 30 | */ 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | #include "platform/stdlib.h" 37 | 38 | int 39 | parse_string_helper(char *out, const char *in, int max_len) { 40 | int ret; 41 | size_t in_len = strlen(in) + 1; 42 | 43 | if (in_len <= max_len) { 44 | memcpy(out, in, in_len); 45 | ret = 0; 46 | } else { 47 | ret = -ENAMETOOLONG; 48 | } 49 | 50 | return (ret); 51 | } 52 | -------------------------------------------------------------------------------- /misc/seed.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: sdf/misc/parse_seed.c 22 | * Author: drew 23 | * 24 | * Created on February 15, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: seed.c 281 2008-02-17 00:58:00Z drew $ 30 | */ 31 | 32 | #include 33 | 34 | #include "platform/stdlib.h" 35 | #include "platform/time.h" 36 | 37 | #include "misc.h" 38 | 39 | /* Include seed in all core dumps */ 40 | static unsigned int seed_value; 41 | 42 | int 43 | seed_arg() { 44 | struct timeval now; 45 | 46 | plat_gettimeofday(&now, NULL); 47 | seed_value = (unsigned int) now.tv_sec; 48 | 49 | fprintf(stderr, "seed: %u\n", seed_value); 50 | plat_srandom(seed_value); 51 | 52 | return (0); 53 | } 54 | 55 | unsigned int 56 | get_seed_arg() { 57 | return (seed_value); 58 | } 59 | -------------------------------------------------------------------------------- /misc/stop.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: sdf/misc/stop.c 22 | * Author: drew 23 | * 24 | * Created on February 27, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: stop.c 590 2008-03-14 01:05:03Z drew $ 30 | */ 31 | 32 | #include "platform/signal.h" 33 | #include "platform/platform.h" 34 | #include "platform/stdio.h" 35 | #include "platform/unistd.h" 36 | 37 | /* 38 | * Allow --stop to stop the process on startup and allow a debugger 39 | * to attach. 40 | */ 41 | int 42 | stop_arg() { 43 | pid_t pid = plat_getpid(); 44 | 45 | fprintf(stderr, "%s %d stopping\n", plat_get_exe_name(), (int) pid); 46 | plat_kill(pid, SIGSTOP); 47 | 48 | return (0); 49 | } 50 | -------------------------------------------------------------------------------- /misc/timeout.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: sdf/misc/timeout.c 22 | * Author: drew 23 | * 24 | * Created on December 23, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: timeout.c 5287 2008-12-24 04:38:05Z drew $ 30 | */ 31 | 32 | #include 33 | 34 | #include "platform/unistd.h" 35 | 36 | #include "misc/misc.h" 37 | 38 | /* Include seed in all core dumps */ 39 | static int timeout; 40 | 41 | int 42 | parse_timeout(const char *string) { 43 | int ret; 44 | 45 | ret = parse_int(&timeout, string, NULL); 46 | if (!ret) { 47 | alarm(timeout); 48 | } 49 | 50 | return (ret); 51 | } 52 | -------------------------------------------------------------------------------- /physmem/60-schooner.rules: -------------------------------------------------------------------------------- 1 | # $Id: 60-schooner.rules 2476 2008-07-29 16:11:45Z drew $ 2 | 3 | # /etc/udev/rules.d entry. Requires the GPL hooks for the kernel side of 4 | # udev. 5 | ma 6 | 7 | KERNEL=="physmem", NAME="%k", OWNER="root", GROUP="kmem", MODE="0660" 8 | #KERNEL=="physmem[0-9]*", NAME="%k", OWNER="root", GROUP="kmem", MODE="0660" 9 | -------------------------------------------------------------------------------- /physmem/verify_od.pl: -------------------------------------------------------------------------------- 1 | # $Id: verify_od.pl 2473 2008-07-29 11:37:55Z drew $ 2 | # 3 | # Sanity check od -i output with physmem_driver compiled with PHYSMEM_DEBUG_FILL 4 | # 5 | # dd if=/dev/physmem | od -i | perl verify_od.pl 6 | 7 | my $debug; 8 | 9 | my $expected = 0; 10 | my $address; 11 | my $number; 12 | my $rest; 13 | 14 | 15 | while (<>) { 16 | chop; 17 | if (/^([0-9a-f]+)\s+(.*)/) { 18 | $address = $1; 19 | $rest = $2; 20 | print STDERR "address $address rest $rest\n" if ($debug); 21 | 22 | while ($rest ne "") { 23 | if ($rest =~ /(^\d+)\s+(.*)/) { 24 | $number = $1; 25 | $rest = $2; 26 | } else { 27 | $number = $rest; 28 | $rest = ""; 29 | } 30 | 31 | die "got $number not $expected" if ($number != $expected); 32 | $expected = $number + 1; 33 | } 34 | } elsif (! /^[0-9a-f]+$/) { 35 | die "unexpected line: $_"; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /platform/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(n 0) 2 | while(n LESS ${NCPU}) 3 | MATH( EXPR n "${n} + 1" ) 4 | set(ffdc_log_files ${ffdc_log_files} ${CMAKE_CURRENT_SOURCE_DIR}/ffdc_log.${n}.c) 5 | endwhile(n LESS ${NCPU}) 6 | 7 | add_custom_command( 8 | OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/ffdc_log.c ${ffdc_log_files} ${CMAKE_CURRENT_SOURCE_DIR}/ffdc_log.h ${CMAKE_CURRENT_SOURCE_DIR}/ffdc_log.dbg ${CMAKE_CURRENT_SOURCE_DIR}/ffdc_reader.c 9 | COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && /usr/bin/perl ffdc_parser.pl ${NCPU} $(CMAKE_SOURCE_DIR) 10 | DEPENDS ffdc_log.mc 11 | ) 12 | 13 | ADD_LIBRARY(platform OBJECT aio_api.c 14 | aio_libaio.c 15 | aio_error_bdb.c 16 | aio_error_control.c 17 | aio_wc.c 18 | alloc_stack.c 19 | aoset.c 20 | attr.c 21 | coredump_filter.c 22 | cpu_peers.c 23 | event.c 24 | fd_dispatcher.c 25 | ffdc_log.c 26 | fth_scheduler.c 27 | get_exe.c 28 | logging.c 29 | mbox_scheduler.c 30 | mem_debug.cc 31 | memory_fault.c 32 | memory_size.c 33 | mprobe.c 34 | msg.c 35 | prng.c 36 | alloc.c 37 | shmem_alloc.c 38 | shmem.c 39 | shmem_debug.c 40 | shmem_global.c 41 | shmem_ptrs.c 42 | shmem_test.c 43 | stats.c 44 | strarray_alloc.c 45 | string.c 46 | timer_dispatcher.c 47 | tmp_path.c 48 | util_trace.c 49 | assert.c 50 | epoll.c 51 | fcntl.c 52 | fd.c 53 | file.c 54 | fork.c 55 | mman.c 56 | mutex.c 57 | printf.c 58 | process.c 59 | random.c 60 | rwlock.c 61 | socket.c 62 | sysvipc.c 63 | thread.c 64 | time.c 65 | ${ffdc_log_files} 66 | ) 67 | add_subdirectory(tool/hotkey) 68 | add_custom_target(ffdc DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ffdc_log.c 69 | ${ffdc_log_files} ${CMAKE_CURRENT_SOURCE_DIR}/ffdc_log.h 70 | ${CMAKE_CURRENT_SOURCE_DIR}/ffdc_log.dbg ${CMAKE_CURRENT_SOURCE_DIR}/ffdc_reader.c) 71 | add_dependencies(platform ffdc) 72 | -------------------------------------------------------------------------------- /platform/atomic_debug.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | #ifndef ATOMIC_DEBUG_H 21 | #define ATOMIC_DEBUG_H 1 22 | 23 | /* 24 | * File: sdf/platform/atomic_debug.h 25 | * Author: Guy Shaw 26 | * 27 | * Created on July 28, 2008 28 | * 29 | * (c) Copyright 2008, Schooner Information Technology, Inc. 30 | * http://www.schoonerinfotech.com/ 31 | * 32 | * $Id: $ 33 | */ 34 | 35 | /* 36 | * This file intensionally left empty. 37 | * 38 | * This is just to try to get automatic build working again. 39 | * I will get a turorial on the build system, and perhaps 40 | * come up with a real solution, later. 41 | * 42 | * Sorry for the inconvenience. 43 | * 44 | * -- Guy Shaw 2008-Aug-26 45 | */ 46 | 47 | #endif /* ndef ATOMIC_DEBUG_H */ 48 | -------------------------------------------------------------------------------- /platform/epoll.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: epoll.c 22 | * Author: drew 23 | * 24 | * Created on April 14, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: epoll.c 992 2008-04-18 17:11:06Z drew $ 30 | */ 31 | 32 | /* 33 | * Thin wrappers for unix functions to accomodate interception for 34 | * 1) Blocking behavior in user-scheduled threads 35 | * 2) The simulated cluster environment 36 | */ 37 | 38 | #define PLATFORM_INTERNAL 1 39 | 40 | #include "platform/epoll.h" 41 | 42 | #define item(ret, sym, declare, call, cppthrow, attributes) \ 43 | PLAT_WRAP_IMPL(ret, sym, declare, call, cppthrow, attributes) 44 | PLAT_EPOLL_WRAP_ITEMS() 45 | #undef item 46 | -------------------------------------------------------------------------------- /platform/fd.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: fd.c 22 | * Author: drew 23 | * 24 | * Created on January 25, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: fd.c 992 2008-04-18 17:11:06Z drew $ 30 | */ 31 | 32 | /* 33 | * Thin wrappers for unix functions to accomodate interception for 34 | * 1) Blocking behavior in user-scheduled threads 35 | * 2) The simulated cluster environment 36 | */ 37 | 38 | #define PLATFORM_INTERNAL 1 39 | 40 | #include "platform/select.h" 41 | #include "platform/unistd.h" 42 | 43 | #define item(ret, sym, declare, call, cppthrow, attributes) \ 44 | PLAT_WRAP_IMPL(ret, sym, declare, call, cppthrow, attributes) 45 | PLAT_UNISTD_WRAP_FD_ITEMS() 46 | PLAT_SELECT_WRAP_ITEMS() 47 | #undef item 48 | -------------------------------------------------------------------------------- /platform/mman.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: $HeadURL: svn://svn.schoonerinfotech.net/schooner-trunk/trunk/sdf/platform/mman.c $ 22 | * Author: drew 23 | * 24 | * Created on January 25, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: mman.c 587 2008-03-14 00:13:21Z drew $ 30 | */ 31 | 32 | /* 33 | * Thin wrappers for unix functions to accomodate interception for 34 | * 1) Blocking behavior in user-scheduled threads 35 | * 2) The simulated cluster environment 36 | */ 37 | 38 | #define PLATFORM_INTERNAL 1 39 | 40 | #include "platform/mman.h" 41 | 42 | #define item(ret, sym, declare, call, cppthrow, attributes) \ 43 | PLAT_WRAP_IMPL(ret, sym, declare, call, cppthrow, attributes) 44 | PLAT_MMAN_WRAP_MMAN_ITEMS() 45 | #undef item 46 | -------------------------------------------------------------------------------- /platform/private/sa_arena_list_global.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * Defines to make make linked list in shmem of all arenas attached to the 22 | * shared space 23 | * 24 | * Included before fth/fthlll.h and fthlll_c.h 25 | */ 26 | 27 | #include "fth/fthlllUndef.h" 28 | 29 | #define LLL_NAME(suffix) sa_arena_global ## suffix 30 | #define LLL_SP_NAME(suffix) sa_arena_sp ## suffix 31 | #define LLL_EL_TYPE struct sa_arena 32 | #define LLL_EL_FIELD global_list_entry 33 | 34 | #define LLL_SHMEM 1 35 | #define LLL_INLINE static __attribute__((unused)) 36 | -------------------------------------------------------------------------------- /platform/private/sa_arena_list_local.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /** 21 | * Defines to make make linked list in shmem of all arenas associated 22 | * with this process. 23 | * 24 | * Included before fth/fthlll.h and fthlll_c.h 25 | */ 26 | 27 | #include "fth/fthlllUndef.h" 28 | 29 | #define LLL_NAME(suffix) sa_arena_local ## suffix 30 | #define LLL_SP_NAME(suffix) sa_arena_sp ## suffix 31 | #define LLL_EL_TYPE struct sa_arena 32 | #define LLL_EL_FIELD local_list_entry 33 | 34 | #define LLL_SHMEM 1 35 | #define LLL_INLINE static __attribute__((unused)) 36 | -------------------------------------------------------------------------------- /platform/random.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: platform/random.h 22 | * Author: drew 23 | * 24 | * Created on January 25, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: random.c 708 2008-03-24 23:28:34Z drew $ 30 | */ 31 | 32 | /* 33 | * Random number generator. Should probably have a simple Knuth 34 | * implementation. 35 | */ 36 | 37 | #define PLATFORM_INTERNAL 1 38 | 39 | #include "platform/stdlib.h" 40 | 41 | #define item(ret, sym, declare, call, cppthrow, attributes) \ 42 | PLAT_WRAP_IMPL(ret, sym, declare, call, cppthrow, attributes) 43 | PLAT_STDLIB_WRAP_RANDOM_ITEMS() 44 | #undef item 45 | -------------------------------------------------------------------------------- /platform/shm.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | #ifndef PLATFORM_SHM_H 21 | #define PLATFORM_SHM_H 1 22 | 23 | /* 24 | * File: platform/mman.h 25 | * Author: drew 26 | * 27 | * Created on January 25, 2008 28 | * 29 | * (c) Copyright 2008, Schooner Information Technology, Inc. 30 | * http://www.schoonerinfotech.com/ 31 | * 32 | * $Id: shm.h 168 2008-02-04 19:17:14Z drew $ 33 | */ 34 | 35 | /* 36 | * Thin wrappers for unix functions to accomodate interception for 37 | * 1) Blocking behavior in user-scheduled threads 38 | * 2) The simulated cluster environment 39 | */ 40 | 41 | #include 42 | #include 43 | 44 | __BEGIN_DECLS 45 | void *plat_shmat(int shmid, const void *shmaddr, int shmflg); 46 | int plat_shmdt(const void *shmaddr); 47 | __END_DECLS 48 | 49 | #endif /* ndef PLATFORM_SHM_H */ 50 | -------------------------------------------------------------------------------- /platform/shmem.gdb: -------------------------------------------------------------------------------- 1 | # $Id: shmem.gdb 2553 2008-08-01 05:39:14Z drew $ 2 | 3 | # Functions to help debug shmem programs 4 | 5 | define get_phys 6 | set $ptr = $arg0 7 | 8 | set $size = sizeof *$ptr 9 | set $ret = plat_memdup_alloc($ptr, $size) 10 | print $ret 11 | end 12 | 13 | document get_phys 14 | get_phys 15 | 16 | Copy the memory from a physical pointer to accessable memory. The size 17 | of *ptr must be known. Release with release_phys. 18 | end 19 | 20 | define get_phys_var 21 | set $ptr = $arg0 22 | set $size = $arg1 23 | 24 | set $ret = plat_memdup_alloc($ptr, $size) 25 | print $ret 26 | end 27 | 28 | document get_phys_var 29 | get_phys_var 30 | 31 | Copy the memory from physical pointer ptr ot accessable memory. 32 | Release with release_phys. 33 | end 34 | 35 | define release_phys 36 | set $ptr = $arg0 37 | call plat_memdup_free($ptr) 38 | end 39 | 40 | document release_phys 41 | release_phys 42 | 43 | Release memory returned by get_phys 44 | end 45 | -------------------------------------------------------------------------------- /platform/shmem_ptrs.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: sdf/platform/shmem_ptrs.c $ 22 | * Author: drew 23 | * 24 | * Created on January 25, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: shmem_ptrs.c 382 2008-02-28 18:40:49Z drew $ 30 | */ 31 | 32 | /** 33 | * Generate code for all shared memory pointers used in the platform 34 | * library. 35 | */ 36 | 37 | #define SHMEM_PTRS_C 1 38 | #define PLATFORM_INTERNAL 1 39 | #include "platform/shmem_ptrs.h" 40 | -------------------------------------------------------------------------------- /platform/spin.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | #ifndef PLATFORM_SPIN_H 21 | #define PLATFORM_SPIN_H 1 22 | 23 | #include 24 | 25 | /* 26 | * Spin lock 27 | * 28 | * 64 bits are used instead of 32 because this makes it inexpensive to 29 | * associate a unique value with each lightweight process to facilitate 30 | * lock release on abnormal termination. 31 | * 32 | * This should normally map to the PLAT_SP(struct plat_user_thread_t) 33 | * referring to the thread. 34 | */ 35 | typedef uint64_t plat_spin_t; 36 | 37 | /* Tries count times. Returns 0 on success, -1 on failure */ 38 | int plat_spin_lock_count(spin_t *lock, int count); 39 | 40 | /* 41 | * Tries a reasonable number of times and periodically calls plat_yield. 42 | */ 43 | void plat_spin_lock(plat_spin_t *lock); 44 | 45 | void plat_spin_ulock(plat_spin_t *lock); 46 | 47 | #endif /* ndef PLATFORM_SPIN_H */ 48 | -------------------------------------------------------------------------------- /platform/sysvipc.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: $HeadURL: svn://svn.schoonerinfotech.net/schooner-trunk/trunk/sdf/platform/sysvipc.c $ 22 | * Author: drew 23 | * 24 | * Created on January 25, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: sysvipc.c 631 2008-03-17 22:58:28Z tomr $ 30 | */ 31 | 32 | /* 33 | * Thin wrappers for unix functions to accomodate interception for 34 | * 1) Blocking behavior in user-scheduled threads 35 | * 2) The simulated cluster environment 36 | */ 37 | 38 | #include "platform/shm.h" 39 | 40 | void * 41 | plat_shmat(int shmid, const void *shmaddr, int shmflg) { 42 | return (shmat(shmid, shmaddr, shmflg)); 43 | } 44 | 45 | int 46 | plat_shmdt(const void *shmaddr) { 47 | return (shmdt(shmaddr)); 48 | } 49 | -------------------------------------------------------------------------------- /platform/tests/asserttest.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | #include "platform/assert.h" 21 | 22 | int 23 | main(int argc, char **argv) { 24 | plat_assert_always(0); 25 | } 26 | -------------------------------------------------------------------------------- /platform/tests/cpu_peertest.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: cpu_peertest.c 22 | * Author: drew 23 | * 24 | * Created on January 26, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: cpu_peertest.c 6197 2009-03-11 21:06:54Z drew $ 30 | */ 31 | 32 | /* 33 | * Smoke test cpu peer extraction 34 | */ 35 | 36 | #include "platform/assert.h" 37 | #include "platform/platform.h" 38 | 39 | int 40 | main() { 41 | uint32_t peers; 42 | int ret; 43 | 44 | ret = plat_get_cpu_cache_peers(&peers, 0); 45 | plat_assert_always(!ret); 46 | plat_assert_always(peers); 47 | plat_assert_always(peers & 1); 48 | 49 | return (0); 50 | } 51 | -------------------------------------------------------------------------------- /platform/tests/invert_no_core.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | ulimit -c 0 3 | $@ 4 | if [ $? -eq 0 ]; then 5 | exit 1 6 | else 7 | exit 0 8 | fi 9 | -------------------------------------------------------------------------------- /platform/tests/mem_debug/testall.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: testall.h 22 | * Author: Mingqiang Zhuang 23 | * 24 | * Created on March 8, 2008, 9:20 AM 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | */ 29 | 30 | #ifndef TESTALL_H 31 | #define TESTALL_H 32 | 33 | /** include files **/ 34 | #include "test_mem_debug_one.h" 35 | 36 | /** public functions **/ 37 | void add_tests(void); 38 | 39 | #endif /* TESTALL_H */ 40 | -------------------------------------------------------------------------------- /platform/tests/oncetest.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | #include "platform/assert.h" 21 | #include "platform/once.h" 22 | 23 | static int count = 0; 24 | 25 | PLAT_ONCE(static, foo); 26 | 27 | PLAT_ONCE_IMPL(static, foo, ++count); 28 | 29 | int 30 | main() { 31 | foo_once(); 32 | plat_assert_always(count == 1); 33 | foo_once(); 34 | plat_assert_always(count == 1); 35 | return (0); 36 | } 37 | -------------------------------------------------------------------------------- /platform/tests/shmemtest_phys.gdb: -------------------------------------------------------------------------------- 1 | # $Id: shmemtest_phys.gdb 2554 2008-08-01 05:54:18Z drew $ 2 | # 3 | # An example on how to print structures in physical memory 4 | define print_text 5 | set $text = $arg0 6 | 7 | get_phys $text 8 | set $good_header = (struct text *) $ 9 | 10 | set $size = $good_header->data_len + sizeof(struct text) 11 | release_phys $good_header 12 | 13 | get_phys_var $text $size 14 | set $good_text = (struct text *) $ 15 | print *$good_text 16 | 17 | release_phys $good_text 18 | end 19 | 20 | document print_text 21 | print_text 22 | 23 | Print text where the structure may be in physical memory. 24 | end 25 | -------------------------------------------------------------------------------- /platform/timer_dispatcher.gdb: -------------------------------------------------------------------------------- 1 | define print_dispatcher_heap 2 | set $heap = $arg0.heap 3 | 4 | set variable $i = 0 5 | print $heap.count 6 | while ($i < $heap.count) 7 | print *($heap.data[$i]) 8 | set $i = $i + 1 9 | end 10 | end 11 | 12 | document print_dispatcher_heap 13 | print_dispatcher_heap 14 | end 15 | -------------------------------------------------------------------------------- /platform/tool/hotkey/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(hotkey OBJECT ht_report.c ht_snapshot.c ht_alloc.c) 2 | add_dependencies(hotkey ffdc) 3 | -------------------------------------------------------------------------------- /platform/tool/hotkey/ht_alloc.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: ht_alloc.h 22 | * Description: hotkey memory alloc/free management 23 | * Author: Norman Xu Hickey Liu 24 | */ 25 | #ifndef HT_ALLOC_H 26 | #define HT_ALLOC_H 27 | 28 | /* 29 | * Alloc memory for hotkey related data structures from reporter 30 | * controlled memory buffer. 31 | */ 32 | void* hot_key_alloc(void *mm_ptr, int mm_size, int mm_used, int size); 33 | 34 | /* 35 | * Free memory for hotkey allocated buffers, and recycled by reporter. 36 | */ 37 | void hot_key_free(void *reporter, void *item); 38 | 39 | #endif 40 | 41 | 42 | -------------------------------------------------------------------------------- /platform/tool/hotkey/perf/cmd_modified: -------------------------------------------------------------------------------- 1 | #comments should start with '#' 2 | 3 | #key start_len end_len percent operation_times 4 | # 5 | # key length range from start_len to end_len 6 | # the memslap will generate keys according to the key range 7 | # percent: indicates keys generated from one range accounts for the total generated keys 8 | # 9 | #ex1: key range 16~100 accounts for 80% 10 | # key range 101~200 accounts for 10% 11 | # key range 201~250 accounts for 10% 12 | # total should be 1(0.8+0.1+0.1 = 1) 13 | # 14 | #16 100 0.8 15 | #101 200 0.1 16 | #201 249 0.1 17 | # 18 | #ex2. 19 | # all keys length are 128 bytes 20 | #128 128 1 21 | # 22 | key 23 | 16 16 1 24 | #30 30 0.2 25 | #67 67 0.2 26 | #128 128 0.2 27 | #250 250 0.2 28 | #16 16 1 29 | #128 128 1 30 | 31 | #value start_len end_len percent 32 | value 33 | #128 128 1 34 | #2048 2048 1 35 | 300 500 1 36 | #501 1000 0.1 37 | #1000 2048 0.1 38 | 39 | #cmd_type cmd_proportion cache_mist flash_miss 40 | #cmd_type 41 | #set 0 42 | #get 1 43 | #mget 2 44 | #add 3 45 | #replace 4 46 | #append 5 47 | #prepend 6 48 | #cas 7 49 | #delete 8 50 | #incr 9 51 | #decr 10 52 | 53 | cmd 54 | 0 0.3 1.0 0.0 55 | 1 0.1 0.0 0.0 56 | 2 0.0 0.0 0.0 57 | 3 0.2 1.0 0.0 58 | 4 0.0 0.0 0.0 59 | 5 0.0 0.0 0.0 60 | 6 0.0 0.0 0.0 61 | 7 0.0 0.0 0.0 62 | 8 0.2 0.0 0.0 63 | 9 0.1 0.0 0.0 64 | 10 0.1 0.0 0.0 65 | 66 | #cache size K M G 67 | cache 68 | 4G 69 | #ssd size K M G 70 | ssd 71 | 8G 72 | -------------------------------------------------------------------------------- /platform/tool/hotkey/perf/hotkey.config: -------------------------------------------------------------------------------- 1 | N_BUCKET_PER_SLAB 16 2 | MIN_WINNERS_PER_LIST 16 3 | MIN_CANDIDATES_PER_LIST 4 4 | CANDIDATE_RATIO 25 5 | THRESHOLD 100 6 | -------------------------------------------------------------------------------- /platform/tool/hotkey/perf/hotkey_perf.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | # performance evaluation for hotkey configures. 4 | 5 | 6 | $ip = "127.0.0.1"; 7 | $port = "11211"; 8 | 9 | # define configures for hotkey 10 | @items= ( "N_BUCKET_PER_SLAB", "MIN_WINNERS_PER_LIST", "MIN_CANDIDATES_PER_LIST", "CANDIDATE_RATIO", "THRESHOLD"); 11 | 12 | @configures = ([16, 16, 4, 25, 1], # default 13 | [16, 16, 4, 25, 100], 14 | [16, 16, 16, 25, 1], 15 | [16, 16, 16, 25, 100], # just have a look 16 | [16, 16, 32, 25, 1], 17 | [16, 32, 4, 25, 1], # larger winners 18 | [16, 32, 16, 25, 1], # this one? 19 | [16, 32, 32, 25, 1], 20 | [32, 16, 4, 25, 1], # less slabs 21 | [32, 16, 8, 25, 1], 22 | [32, 16, 16, 25, 1], 23 | [32, 16, 32, 25, 1], # just have a look 24 | [64, 16, 8, 25, 1], # less slabs 25 | [64, 64, 32, 25, 1], # this one? 26 | [64, 64, 8, 12, 1], # less slabs 27 | ); 28 | 29 | # generate configure file 30 | sub gen_config() { 31 | print "loop = $count\n"; 32 | open FILE, ">hotkey.config" or die "create configure file failed"; 33 | $configure = $configures[$count]; 34 | printf "item=@items\n config=[@{$configures[$count]}]\n"; 35 | for $i (0..$#items) { 36 | print FILE "$items[$i] $configure->[$i]\n"; 37 | } 38 | close FILE; 39 | `cp hotkey.config config.$count`; 40 | } 41 | 42 | 43 | # start mcd 44 | sub startmcd() { 45 | `sh runperf.sh > server_$count.log 2>&1 &`; 46 | `sleep 5`; 47 | } 48 | 49 | # shutdown mcd 50 | sub shutdownmcd() { 51 | `echo "shutdown" | nc $ip $port`; 52 | `sleep 5`; 53 | } 54 | 55 | # enable hotkey 56 | sub enablehotkey() { 57 | `echo "schooner hotkey on" | nc $ip $port`; 58 | } 59 | 60 | # start ms 61 | sub startms() { 62 | `sh runms.sh > perf_$count`; 63 | } 64 | 65 | # run all loops 66 | sub runall() { 67 | $count = 0; 68 | for $count (0..$#configures) { 69 | &gen_config(); 70 | &startmcd(); 71 | &enablehotkey(); 72 | &startms(); 73 | &shutdownmcd(); 74 | } 75 | } 76 | 77 | &runall(); 78 | -------------------------------------------------------------------------------- /platform/tool/hotkey/perf/perf_parse.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | parse_perf () { 4 | echo 'tps:'| tee >>perf.txt 5 | for fd in `ls perf_*` 6 | do 7 | cat $fd | grep "^run time:" | awk '{print $7}' | tee >> perf.txt 8 | done 9 | } 10 | 11 | parse_mem () { 12 | echo 'memory:' | tee >> perf.txt 13 | for fd in `ls hotkey.memory.*` 14 | do 15 | cat $fd | grep "^mem" | awk '{print $2}' | tee >> perf.txt 16 | done 17 | } 18 | parse_perf 19 | parse_mem 20 | -------------------------------------------------------------------------------- /platform/tool/hotkey/perf/runhotkey.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #./memcached-fthread-sdf_old -p11211 -L4 -N4 -T4 -u root -Y -R --log sdf/client=trace --plat/shmem/prefault --plat/shmem/debug/replace_malloc --plat/shmem/file /hugepages/perf:8g --property_file=/opt/schooner/config/sdf.cache.test.prop --no_sync 4 | ./memcached-fthread-sdf -p11211 -L4 -N4 -T4 -u root -Y -R --log sdf/client=trace --plat/shmem/debug/local_alloc --property_file=/opt/schooner/config/sdf.cache.test.prop --no_sync --no_aio_check --reformat --hot_key_stats=10000 5 | -------------------------------------------------------------------------------- /platform/tool/hotkey/perf/runms.sh: -------------------------------------------------------------------------------- 1 | #/bin/sh 2 | 3 | ./asyn_memslap --servers=localhost:11211 -F cmd_modified -c 64 -T 4 -x 80000000 -r 5s -t 300s #-r 5s #-v 0.01 4 | -------------------------------------------------------------------------------- /platform/tool/hotkey/snapshot/hotkey_logrotate: -------------------------------------------------------------------------------- 1 | /var/log/schooner/hotkey.log { 2 | missingok 3 | daily 4 | rotate 5 5 | size 5M 6 | notifempty 7 | } 8 | 9 | -------------------------------------------------------------------------------- /platform/tool/hotkey/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library() 2 | add_executable() -------------------------------------------------------------------------------- /platform/tool/hotkey/tests/ht_unit_test: -------------------------------------------------------------------------------- 1 | ../../../../../build/sdf/platform/tool/hotkey/tests/ht_all_rpts -------------------------------------------------------------------------------- /platform/tool/hotkey/tests/unit_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rm -rf ht_unit_test 4 | #ln -s ../../../../../build/sdf/platform/tool/hotkey/tests/ht_candidate_win ht_unit_test 5 | #ln -s ../../../../../build/sdf/platform/tool/hotkey/tests/ht_winner_lose ht_unit_test 6 | #ln -s ../../../../../build/sdf/platform/tool/hotkey/tests/ht_winner_lose_win ht_unit_test 7 | #ln -s ../../../../../build/sdf/platform/tool/hotkey/tests/ht_compete_winners ht_unit_test 8 | ln -s ../../../../../build/sdf/platform/tool/hotkey/tests/ht_all_rpts ht_unit_test 9 | 10 | gdb --args ht_unit_test 11 | 12 | 13 | -------------------------------------------------------------------------------- /protocol/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(action) 2 | add_subdirectory(home) 3 | add_subdirectory(replication) 4 | add_definitions(-fno-builtin) 5 | add_library(protocol OBJECT init_protocol.c protocol_common.c protocol_utils.c) 6 | add_dependencies(protocol ffdc) 7 | -------------------------------------------------------------------------------- /protocol/Tools/stopleak/do1: -------------------------------------------------------------------------------- 1 | run UTMALLOC_DUMP.txt 2 | -------------------------------------------------------------------------------- /protocol/Tools/stopleak/dogdb: -------------------------------------------------------------------------------- 1 | #!/bin/bash -x 2 | gdb stopleak 3 | -------------------------------------------------------------------------------- /protocol/Tools/stopleak/hash.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: hash.h 22 | * Author: Jim 23 | * 24 | * Created on March 3, 2008, 1:38 PM 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: hash.c 399 2008-02-28 23:46:15Z darpan $ 30 | */ 31 | 32 | #ifndef __HASH_H 33 | #define __HASH_H 34 | 35 | // 36 | // Header file for Bob Tuttles lookup8 hash algorithm 37 | // 38 | // This is fast on 64-bit machines. Just mask off the bits you need for shorter keys. 39 | // 40 | 41 | // Level is an arbitrary salt for the hash. 42 | uint64_t hash(const unsigned char *key, uint64_t keyLength, uint64_t level); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /protocol/action/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-DYY_NO_INPUT -std=gnu99 -fgnu89-inline) 2 | add_library(action OBJECT tlmap.c fastcc_new.c action_new.c tlmap4.c simple_replication.c async_puts.c appbuf_pool.c response_tbl.c) 3 | add_dependencies(action ffdc) 4 | -------------------------------------------------------------------------------- /protocol/action/appbuf_pool_internal.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: appbuf_pool_internal.h 22 | * Author: Brian O'Krafka 23 | * 24 | * Created on March 3, 2009 25 | * 26 | * (c) Copyright 2009, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: appbuf_pool_internal.h 802 2008-03-29 00:44:48Z darpan $ 30 | */ 31 | 32 | #ifndef _APPBUF_POOL_INTERNAL_H 33 | #define _APPBUF_POOL_INTERNAL_H 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | typedef struct SDF_appBufState { 40 | SDF_appBufProps_t props; 41 | uint64_t nget; 42 | uint64_t nfree; 43 | } SDF_appBufState_t; 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif /* _APPBUF_POOL_INTERNAL_H */ 50 | -------------------------------------------------------------------------------- /protocol/action/object_pool_internal.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: object_pool_internal.h 22 | * Author: Brian O'Krafka 23 | * 24 | * Created on March 3, 2009 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: object_pool_internal.h 308 2008-02-20 22:34:58Z tomr $ 30 | */ 31 | 32 | #ifndef _OBJECT_POOL_INTERNAL_H 33 | #define _OBJECT_POOL_INTERNAL_H 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | struct SDF_bufpool { 40 | int dummy; 41 | SDF_bufpool_props_t props; 42 | }; 43 | typedef struct SDF_bufpool SDF_bufpool_t; 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif /* _OBJECT_POOL_INTERNAL_H */ 50 | -------------------------------------------------------------------------------- /protocol/home/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(home OBJECT home_flash.c home_util.c tlmap2.c) 2 | add_dependencies(home ffdc) 3 | -------------------------------------------------------------------------------- /protocol/replication/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(replication OBJECT copy_replicator.c copy_replicator_meta.c copy_replicator_misc.c key_lock.c meta.c meta_storage.c replicator.c replicator_adapter.c sdf_vips.c rpc.c) 2 | add_dependencies(replication ffdc) 3 | -------------------------------------------------------------------------------- /protocol/replication/copy_replicator.gdb: -------------------------------------------------------------------------------- 1 | # $URL: svn://svn.schoonerinfotech.net/schooner-trunk/trunk/sdf/protocol/replication/copy_replicator.gdb $ 2 | # $Id: copy_replicator.gdb 8126 2009-06-24 12:10:30Z drew $ 3 | 4 | define print_replica_meta 5 | print *$arg0 6 | 7 | set $i = 0 8 | while $i < $arg0->persistent.nrange 9 | print $arg0->ranges[$i] 10 | set $i = $i + 1 11 | end 12 | end 13 | 14 | document print_replica_meta 15 | print cr_shard_replica_meta 16 | end 17 | 18 | define print_shard 19 | print /x $arg0->sguid 20 | print $arg0->state 21 | end 22 | 23 | document print_shard 24 | print cr_shard 25 | end 26 | 27 | define print_cr 28 | set $shard = $arg0->shard_list.lh_first 29 | while $shard 30 | print $shard 31 | print_shard $shard 32 | set $shard = $shard->shard_list_entry.le_next 33 | end 34 | end 35 | 36 | document print_cr 37 | print copy_replicator 38 | end 39 | -------------------------------------------------------------------------------- /protocol/replication/copy_replicator_misc.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: sdf/protocol/replication/copy_replicator_misc.c 22 | * 23 | * Author: drew 24 | * 25 | * Created on February 6, 2008 26 | * 27 | * (c) Copyright 2008, Schooner Information Technology, Inc. 28 | * http://www.schoonerinfotech.com/ 29 | * 30 | * $Id: copy_replicator_misc.c 6028 2009-02-24 21:22:32Z drew $ 31 | */ 32 | 33 | /* 34 | * Miscellaneous support functions common to the different 35 | * meta_storage implementations, etc. 36 | */ 37 | -------------------------------------------------------------------------------- /protocol/replication/meta.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: sdf/protocol/replication/meta.c 22 | * 23 | * Author: drew 24 | * 25 | * Created on October 23, 2008 26 | * 27 | * (c) Copyright 2008, Schooner Information Technology, Inc. 28 | * http://www.schoonerinfotech.com/ 29 | * 30 | * $Id: meta.c 4001 2008-10-23 23:12:09Z drew $ 31 | */ 32 | 33 | /** 34 | * Encapsulate the replication layer meta-data 35 | */ 36 | 37 | #include "meta.h" 38 | 39 | int 40 | replication_meta_need_meta_shard(const SDF_container_props_t *props) { 41 | return ((props->replication.enabled && 42 | props->replication.type != SDF_REPLICATION_SIMPLE && 43 | props->replication.type != SDF_REPLICATION_NONE) ? 1 : 0); 44 | } 45 | -------------------------------------------------------------------------------- /protocol/replication/tests/setenv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #. setenv.sh 4 | export REP_NODE_NUM="12" 5 | export REP_REPLICA_NUM="4" 6 | export REP_SHARD_NUM="2" 7 | 8 | export REP_RANDOM_SEED="10" 9 | 10 | export MAX_OBJECTS_NUM="200" 11 | export REP_STRESS_WORKERS="1" 12 | 13 | export IS_DIFF_KEYS="1" 14 | export RANDOM_OBJ_SIZE="1" 15 | export RANDOM_KEY_LEN="1" 16 | 17 | export MIN_OBJECT_SIZE="1024" 18 | export MAX_OBJECT_SIZE="4096" 19 | export MIN_KEY_LEN="10" 20 | export MAX_KEY_LEN="20" 21 | 22 | export MISS_RATE="100" 23 | 24 | export FIRST_RUN="1" 25 | export FIRST_HOME_NODE="1" 26 | export BT_EVENT_FREQ="10" 27 | 28 | # put:0 set:1 delete:2 get:3 random:4 none:5(just do crash/restart node) 29 | export OP_TYPE="0" 30 | export DATA_TABLE_FILE_NAME="df_name" 31 | export KEY_SET_FILE_NAME="kf_name" 32 | 33 | -------------------------------------------------------------------------------- /protocol/replication/tests/t/rtm_case/empty_read: -------------------------------------------------------------------------------- 1 | 0 0 shard create start 1 2 | 0 0 shard create complete 3 | 0 1 read start 1 0 test 4 | 0 1 read complete data 5 | check failed 6 | -------------------------------------------------------------------------------- /protocol/replication/tests/t/rtm_case/empty_read2: -------------------------------------------------------------------------------- 1 | 0 0 shard create start 1 2 | 0 0 shard create complete 3 | 0 1 read start 1 0 test 4 | 0 1 read complete NOT_FOUND 5 | check succeed 6 | -------------------------------------------------------------------------------- /protocol/replication/tests/t/rtm_case/lot_of_read: -------------------------------------------------------------------------------- 1 | 0 0 shard create start 1 2 | 0 0 shard create complete 3 | 0 1 write start 1 0 test data 4 | 0 2 read start 1 0 test 5 | 0 1 write complete 6 | 0 2 read complete NOT_FOUND 7 | 0 3 read start 1 0 test 8 | 0 4 read start 1 0 test 9 | 0 5 read start 1 0 test 10 | 0 6 read start 1 0 test 11 | 0 7 read start 1 0 test 12 | 0 8 read start 1 0 test 13 | 0 9 read start 1 0 test 14 | 0 10 read start 1 0 test 15 | 0 11 read start 1 0 test 16 | 0 3 read complete data 17 | 0 4 read complete data 18 | 0 5 read complete data 19 | 0 6 read complete data 20 | 0 7 read complete data 21 | 0 8 read complete data 22 | 0 9 read complete data 23 | 0 10 read complete data 24 | 0 11 read complete data 25 | check succeed 26 | -------------------------------------------------------------------------------- /protocol/replication/tests/t/rtm_case/read_no_overlap: -------------------------------------------------------------------------------- 1 | 0 0 shard create start 1 2 | 0 0 shard create complete 3 | 0 1 write start 1 0 test data 4 | 0 2 read start 1 0 test 5 | 0 2 read complete data 6 | 0 3 read start 1 0 test 7 | 0 3 read complete NOT_FOUND 8 | 0 1 write complete 9 | check failed 10 | -------------------------------------------------------------------------------- /protocol/replication/tests/t/rtm_case/read_no_overlap_2: -------------------------------------------------------------------------------- 1 | 0 0 shard create start 1 2 | 0 0 shard create complete 3 | 0 1 write start 1 0 test ncv 4 | 0 1 write complete 5 | 0 2 write start 1 0 test data 6 | 0 3 read start 1 0 test 7 | 0 3 read complete data 8 | 0 4 read start 1 0 test 9 | 0 4 read complete ncv 10 | 0 2 write complete 11 | check failed 12 | -------------------------------------------------------------------------------- /protocol/replication/tests/t/rtm_case/read_on_different_node: -------------------------------------------------------------------------------- 1 | 0 0 shard create start 1 2 | 0 0 shard create complete 3 | 0 1 write start 1 0 test data 4 | 0 2 read start 1 0 test 5 | 0 2 read complete data 6 | 0 3 read start 1 2 test 7 | 0 3 read complete NOT_FOUND 8 | 0 1 write complete 9 | check succeed 10 | -------------------------------------------------------------------------------- /protocol/replication/tests/t/rtm_case/read_overlap: -------------------------------------------------------------------------------- 1 | 0 0 shard create start 1 2 | 0 0 shard create complete 3 | 0 1 write start 1 0 test data 4 | 0 2 read start 1 0 test 5 | 0 3 read start 1 0 test 6 | 0 2 read complete data 7 | 0 3 read complete NOT_FOUND 8 | 0 1 write complete 9 | check succeed 10 | -------------------------------------------------------------------------------- /protocol/replication/tests/t/rtm_case/sample: -------------------------------------------------------------------------------- 1 | # [ltime] [op_id] shard create start [shard_id] 2 | 0 0 shard create start 1 3 | 4 | # [ltime] [op_id] shard create complete 5 | 0 0 shard create complete 6 | 7 | # [ltime] [op_id] write start [shard_id] [vnode] [key] [data] 8 | 0 1 write start 1 0 test test_data 9 | 10 | # [ltime] [op_id] write complete 11 | 0 1 write complete 12 | 13 | # [ltime] [op_id] read start [shard_id] [vnode] [key] 14 | 0 2 read start 1 0 test 15 | 16 | # [ltime] [op_id] read complete [data]/NOT_FOUND 17 | 0 2 read complete test_data 18 | 19 | # [ltime] [op_id] delete start [shard_id] [vnode] [key] 20 | 0 3 delete start 1 0 test 21 | 22 | # [ltime] [op_id] delete complete 23 | 0 3 delete complete 24 | 25 | # [ltime] [op_id] shard delete start [shard_id] 26 | 0 4 shard delete start 1 27 | 28 | # [ltime] [op_id] shard delete complete 29 | 0 4 shard delete complete 30 | 31 | # check succeed/failed 32 | check succeed 33 | 34 | -------------------------------------------------------------------------------- /protocol/replication/tests/t/rtm_case/uncompleted_read: -------------------------------------------------------------------------------- 1 | 0 0 shard create start 1 2 | 0 0 shard create complete 3 | 0 1 write start 1 0 test test_data 4 | 0 2 read start 1 0 test 5 | 0 1 write complete 6 | 0 3 read start 1 0 test 7 | 0 4 read start 1 0 test 8 | 0 4 read complete test_data 9 | check succeed 10 | -------------------------------------------------------------------------------- /protocol/replication/tests/t/rtm_case/write_change: -------------------------------------------------------------------------------- 1 | 0 0 shard create start 1 2 | 0 0 shard create complete 3 | 0 1 write start 1 0 test data 4 | 0 2 read start 1 0 test 5 | 0 3 read start 1 0 test 6 | 0 2 read complete data 7 | 0 3 read complete NOT_FOUND 8 | 0 1 write complete 9 | check succeed 10 | -------------------------------------------------------------------------------- /protocol/replication/tests/t/rtm_case/write_read: -------------------------------------------------------------------------------- 1 | 0 0 shard create start 1 2 | 0 0 shard create complete 3 | # 0 1 4 | 0 1 write start 1 0 test data 5 | 0 1 write complete 6 | 0 2 read start 1 0 test 7 | 0 2 read complete NOT_FOUND 8 | check failed 9 | -------------------------------------------------------------------------------- /protocol/replication/tests/t/rtm_case/zhenwei: -------------------------------------------------------------------------------- 1 | 0 0 shard create start 1 2 | 0 0 shard create complete 3 | 0 1 write start 1 0 test data 4 | 0 2 read start 1 0 test 5 | 0 2 read complete data 6 | check succeed 7 | -------------------------------------------------------------------------------- /protocol/replication/tests/t/rtm_case/zhenwei_2: -------------------------------------------------------------------------------- 1 | 0 0 shard create start 1 2 | 0 0 shard create complete 3 | 0 1 write start 1 0 test data 4 | 0 2 read start 1 0 test 5 | 0 2 read complete NOT_FOUND 6 | check succeed 7 | -------------------------------------------------------------------------------- /protocol/replication/tests/t/static_test_rtm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | my $bin = "../../../../../build/sdf/protocol/replication/tests/t/fcnl_rtm_case"; 4 | 5 | if (! -e $bin) { 6 | system "cd ..; make; cd -; make"; 7 | } 8 | 9 | if (! -e $bin) { 10 | die "Make binary fcnl_rtm_case failed"; 11 | } 12 | 13 | my @cases = `ls rtm_case`; 14 | 15 | my $failed = 0; 16 | foreach my $case (@cases) { 17 | $failed += system "$bin rtm_case/$case"; 18 | } 19 | 20 | if ($failed) { 21 | die "Totally $failed cases have failed"; 22 | } else { 23 | print "Passed.\n"; 24 | } 25 | -------------------------------------------------------------------------------- /protocol/replication/tests/test_api.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | #ifndef REPLICATION_TEST_API_H 21 | #define REPLICATION_TEST_API_H 1 22 | 23 | /* 24 | * File: sdr/protocol/replication/tests/test_api.h 25 | * 26 | * Author: drew 27 | * 28 | * Created on October 31, 2008 29 | * 30 | * (c) Copyright 2008, Schooner Information Technology, Inc. 31 | * http://www.schoonerinfotech.com/ 32 | * 33 | * $Id: test_api.h 5283 2008-12-24 02:45:30Z xwang $ 34 | */ 35 | 36 | /** 37 | * Test infrastructure api 38 | */ 39 | #include "protocol/replication/replicator.h" 40 | 41 | /** 42 | * @brief Callback interface for async flash API. 43 | * 44 | * send_msg, timer_dispatcher, and gettime() may be used for scheduling. 45 | * 46 | * XXX: This is expedient 47 | */ 48 | typedef struct replicator_api replication_test_flash_api_t; 49 | 50 | #endif /* ndef REPLICATION_TEST_API_H */ 51 | -------------------------------------------------------------------------------- /protocol/sdf_lex_buf.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: sdf_lex_buf.h 22 | * Author: Brian O'Krafka 23 | * 24 | * Created on April 2, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: sdf_lex_buf.h 802 2008-03-29 00:44:48Z darpan $ 30 | */ 31 | 32 | #ifndef _SDF_LEX_BUF_H 33 | #define _SDF_LEX_BUF_H 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | #ifndef YY_TYPEDEF_YY_SCANNER_T 40 | #define YY_TYPEDEF_YY_SCANNER_T 41 | typedef void* yyscan_t; 42 | #endif 43 | 44 | typedef struct { 45 | char *myinput; /* character buffer */ 46 | char *myinputptr; /* current position in myinput */ 47 | char *myinputlim; /* end of data */ 48 | } sdf_lex_buf; 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif /* _SDF_LEX_BUF_H */ 55 | -------------------------------------------------------------------------------- /sdfappcommon/README: -------------------------------------------------------------------------------- 1 | This directory builds a library of routines that are used both by the 2 | SDF applications (mySQL, memcached) and the SDF internal threads 3 | (shememd, fth, ...). 4 | 5 | Be careful that nothing creeps into this libary that cannot be safely 6 | called from BOTH thread types. 7 | ft 8 | -------------------------------------------------------------------------------- /sdfappcommon/XLock.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: XLock.h 22 | * Author: Jim 23 | * 24 | * Created on February 29, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http: //www.schoonerinfotech.com/ 28 | * 29 | * $Id: XLock.h 396 2008-02-29 22:55:43Z jim $ 30 | */ 31 | 32 | // 33 | // Cross-threading (pthread/fth) lock 34 | // 35 | 36 | #ifndef _SDFAPP_COMMON_XLOCK_H 37 | #define _SDFAPP_COMMON_XLOCK_H 38 | 39 | #include 40 | 41 | #include "fth/fthLock.h" 42 | 43 | typedef struct XLock { 44 | int fthLock; // Integer count 45 | pthread_rwlock_t qLock; // For queueing control 46 | pthread_rwlock_t lock; // Main lock 47 | int write; // Set for write lock 48 | } XLock_t; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /sdfappcommon/sdf_err.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | 21 | #ifndef SDF_ERR_H 22 | #define SDF_ERR_H 23 | 24 | 25 | 26 | /* Define the error base at some convenient number outside 27 | of unix errors range. Currently arbitrarily setup at 1<<16. 28 | Salt to taste later. 29 | */ 30 | #define SDF_ERR_BASE 1<<16 31 | #define ERR_MAX (SDF_ERR_BASE + 1000) 32 | /* This can be made more useful as need arises */ 33 | #define ERR_DEF(err_name, err_num) \ 34 | int err_name = (err_num); 35 | 36 | ERR_DEF(SDF_ERR_FAILED_AGENT_RENDEZVOUS, (SDF_ERR_BASE)+2) 37 | 38 | #endif /* SDF_ERR_H */ 39 | -------------------------------------------------------------------------------- /sdfmsg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(sdfmsg OBJECT sdf_fth_mbx.c 2 | sdf_msg_new.c 3 | sdf_msg_sync.c 4 | sdf_msg_shmem.c 5 | sdf_msg_types.c 6 | sdf_msg_action.c 7 | sdf_msg_wrapper.c 8 | sdf_msg_binding.c) 9 | add_dependencies(sdfmsg ffdc) 10 | -------------------------------------------------------------------------------- /sdfmsg/newtests/agent.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: agent.h 22 | * Author: Johann George. 23 | * (c) Copyright 2009, Schooner Information Technology, Inc. 24 | */ 25 | 26 | #ifndef AGENT_H 27 | #define AGENT_H 1 28 | 29 | void agent_exit(void); 30 | void agent_init(int argc, char *argv[]); 31 | 32 | #endif /* AGENT_H */ 33 | -------------------------------------------------------------------------------- /sdfmsg/newtests/conf.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * Configuration structure for messaging. 22 | * Author: Johann George. 23 | * (c) Copyright 2009, Schooner Information Technology, Inc. 24 | */ 25 | 26 | #ifndef CONF_H 27 | #define CONF_H 1 28 | 29 | typedef struct plat_opts_config_msg { 30 | char property_file[PATH_MAX]; /* Property file */ 31 | struct plat_shmem_config shmem; /* Used for shmem parameters */ 32 | } msg_config_t; 33 | 34 | int plat_opts_parse_msg(msg_config_t *config, int argc, char **argv); 35 | 36 | #endif /* CONF_H */ 37 | -------------------------------------------------------------------------------- /sdfmsg/newtests/testrun: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Run a test. 3 | 4 | S=/opt/schooner 5 | 6 | Z=$S/openmpi-1.3/lib 7 | Z=$Z:$S/CUnit-2.1-0/lib 8 | Z=$Z:$S/dmalloc-5.5.2/lib 9 | Z=$Z:$S/fuse/lib 10 | Z=$Z:$S/gcc-4.3.1/lib64 11 | export LD_LIBRARY_PATH=$Z 12 | 13 | Z=$S/valgrind-3.3.1/bin 14 | Z=$Z:$S/openmpi-1.3/bin 15 | Z=$Z:$S/dmalloc-5.5.2/bin 16 | Z=$Z:$S/gcc-4.3.1/bin 17 | Z=$Z:/bin 18 | Z=$Z:/usr/bin 19 | export PATH=$Z 20 | 21 | export PROPERTIES_FILE=../../../config/schooner-med.properties 22 | 23 | mpirun -np 2 "$@" -d -y 24 | -------------------------------------------------------------------------------- /sdfmsg/old/sdf_msg_hash.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: sdfmsg/sdf_msg_hash.h 22 | * Author: Jim 23 | * 24 | * Created on March 3, 2008, 1:38 PM 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: hash.c 399 2008-02-28 23:46:15Z darpan $ 30 | */ 31 | 32 | #ifndef SDF_MSG_HASH_H 33 | #define SDF_MSG_HASH_H 34 | 35 | #include 36 | #include 37 | 38 | // 39 | // Header file for Bob Tuttles lookup8 hash algorithm 40 | // 41 | // This is fast on 64-bit machines. Just mask off the bits you need for shorter keys. 42 | // 43 | 44 | // Level is an arbitrary salt for the hash. 45 | uint64_t hash(const unsigned char *key, uint64_t keyLength, uint64_t level); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /sdfmsg/oldtests/pfm_test.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | #ifndef PFM_TEST_H_ 21 | #define PFM_TEST_H_ 22 | #include "sdfmsg/sdf_msg_types.h" 23 | #include "sdfmsg/fcnl_test.h" 24 | void * ThroughputThreadRoutine(void *arg); 25 | 26 | #endif /*PFM_TEST_H_*/ 27 | -------------------------------------------------------------------------------- /sdfmsg/sdf_msg_shmem.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: sdf/platform/shmem.h 22 | * Author: drew 23 | * 24 | * Created on May 24, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: sdf_msg_shmem.c 1196 2008-05-09 03:17:10Z drew $ 30 | */ 31 | 32 | /** 33 | * Instantiate sdfmsg shared memory code 34 | */ 35 | 36 | #include "sdfmsg/sdf_msg.h" 37 | 38 | PLAT_SP_VAR_OPAQUE_IMPL(sdf_msg_sp, struct sdf_msg) 39 | -------------------------------------------------------------------------------- /sdfmsg/sdf_msg_sync.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: sdf_msg_sync.h 22 | * Author: Johann George. 23 | * (c) Copyright 2009, Schooner Information Technology, Inc. 24 | */ 25 | 26 | 27 | /* 28 | * Function prototypes. 29 | */ 30 | void sdf_msg_sync(void); 31 | void sdf_msg_sync_exit(void); 32 | void sdf_msg_sync_init(void); 33 | -------------------------------------------------------------------------------- /sdftcp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(sdftcp OBJECT msg_int.c 2 | msg_map.c 3 | msg_msg.c 4 | locks.c 5 | stats.c 6 | tools.c 7 | trace.c) 8 | add_dependencies(sdftcp ffdc) 9 | -------------------------------------------------------------------------------- /sdftcp/gnusource.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: gnusource.h 22 | * Author: Johann George. 23 | * (c) Copyright 2009, Schooner Information Technology, Inc. 24 | * 25 | * Define _GNU_SOURCE 26 | */ 27 | 28 | #ifndef _GNU_SOURCE 29 | #define _GNU_SOURCE 30 | #endif 31 | -------------------------------------------------------------------------------- /sdftcp/msg_cat.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: msg_cat.h 22 | * Author: Johann George. 23 | * (c) Copyright 2009, Schooner Information Technology, Inc. 24 | * 25 | * Define message category. 26 | */ 27 | #ifndef LOG_CAT 28 | #define LOG_CAT PLAT_LOG_CAT_SDF_SDFMSG 29 | #endif 30 | -------------------------------------------------------------------------------- /sdftcp/msg_cip.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: msg_cip.h 22 | * Author: Johann George 23 | * Copyright (c) 2009, Schooner Information Technology, Inc. 24 | */ 25 | #ifndef MSG_CIP_H 26 | #define MSG_CIP_H 27 | 28 | #include 29 | 30 | /* 31 | * An IP address that combines both IPv4 and IPv6 addresses. Note that most of 32 | * the code assumes that the address is IPv4 but we should be able to extend it 33 | * in the future. The elements v4[a-d] are purely so gdb prints this out 34 | * nicely as it does not seem to understand that uint8_t is not char. 35 | */ 36 | typedef struct cip { 37 | union { 38 | uint8_t v4[4]; 39 | uint32_t v4_d; 40 | struct { 41 | uint8_t v4a; 42 | uint8_t v4b; 43 | uint8_t v4c; 44 | uint8_t v4d; 45 | }; 46 | }; 47 | uint16_t v6[8]; 48 | } cip_t; 49 | 50 | #endif /* MSG_CIP_H */ 51 | -------------------------------------------------------------------------------- /sdftcp/msg_fthfake.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * Author: Johann George. 22 | * (c) Copyright 2009, Schooner Information Technology, Inc. 23 | * 24 | * Attempt to run without FTH. 25 | */ 26 | 27 | #ifndef MSG_FTHFAKE_H 28 | #define MSG_FTHFAKE_H 29 | 30 | #define FTH_SPIN_INIT(a) msgt_fake(a) 31 | #define FTH_SPIN_LOCK(a) msgt_fake(a) 32 | #define FTH_SPIN_UNLOCK(a) msgt_fake(a) 33 | #define fthSelf() 0 34 | 35 | typedef int fthThread_t; 36 | typedef int fthSpinLock_t; 37 | 38 | #endif /* MSG_FTHFAKE_H */ 39 | -------------------------------------------------------------------------------- /sdftcp/old/tests/gs_test1.conf: -------------------------------------------------------------------------------- 1 | # Test 2 | 3 | lab02.schoonerinfotech.net 4 | 5 | lab02.schoonerinfotech.net 6 | -------------------------------------------------------------------------------- /sdftcp/tests/test_tcp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | -------------------------------------------------------------------------------- /shared/00_README.txt: -------------------------------------------------------------------------------- 1 | $Id: 00_README.txt 5099 2008-12-16 04:19:34Z drew $ 2 | 3 | sdf/shared consists of those functions that operate between the SDF 4 | client and the SDF protocol/flash layers. So, naming, CMC, open 5 | container mangement are all in here 6 | -------------------------------------------------------------------------------- /shared/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-std=gnu99 -fgnu89-inline) 2 | set(srcs cmc.c container.c container_meta.c container_props.c init_sdf.c internal_blk_obj_api.c name_service.c open_container_map.c open_container_mgr.c shard_compute.c) 3 | add_library(shared OBJECT ${srcs}) 4 | add_dependencies(shared ffdc) 5 | -------------------------------------------------------------------------------- /shared/object.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: shared/object.c 22 | * Author: DO 23 | * 24 | * Created on February 12, 2008, 10:04 AM 25 | * 26 | * Copyright Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: object.c 9970 2009-10-30 23:51:23Z briano $ 30 | * 31 | */ 32 | 33 | #include "object.h" 34 | 35 | #include "internal_blk_obj_api.c" 36 | -------------------------------------------------------------------------------- /shared/object.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: shared/object.h 22 | * Author: DO 23 | * 24 | * Created on February 15, 2008, 2:46 PM 25 | * 26 | * Copyright Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: object.h 9970 2009-10-30 23:51:23Z briano $ 30 | * 31 | */ 32 | 33 | #ifndef _OBJECT_H 34 | #define _OBJECT_H 35 | 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | #include "container.h" 42 | 43 | #include "block_container.h" 44 | #include "object_container.h" 45 | 46 | #ifndef TABLES_SKIP_INTERNAL_BLK_OBJ_API_H 47 | #include "internal_blk_obj_api.h" 48 | #endif 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif /* _OBJECT_H */ 55 | -------------------------------------------------------------------------------- /shared/private.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: shared/private.h 22 | * Author: drew 23 | * 24 | * Created on June 16, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: private.h 8141 2009-06-25 00:23:53Z jbertoni $ 30 | */ 31 | 32 | /** 33 | * Internal state of shared (container, name services, etc) subsystem. 34 | */ 35 | #ifndef _SHARED_PRIVATE_H 36 | #define _SHARED_PRIVATE_H 37 | 38 | #include "platform/defs.h" 39 | #include "fth/fth.h" 40 | 41 | #include "init_sdf.h" 42 | 43 | /** @brief Subsystem local state */ 44 | struct SDF_shared_state { 45 | struct SDF_config config; 46 | }; 47 | 48 | __BEGIN_DECLS 49 | 50 | extern struct SDF_shared_state sdf_shared_state; 51 | extern int (*sdf_agent_start_cb)(struct sdf_replicator *); 52 | 53 | __END_DECLS 54 | 55 | #endif /* _SHARED_H */ 56 | -------------------------------------------------------------------------------- /shared/strings.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: shared/strings.c 22 | * Author: 23 | * 24 | * Created on Oct 28, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: strings.c 4058 2008-10-28 12:38:25Z drew $ 30 | */ 31 | 32 | /** 33 | * Instantiate string arrays for pretty-printing 34 | */ 35 | 36 | /* 37 | * XXX: This belongs in common to go with sdftypes, but there is no library 38 | * there. 39 | */ 40 | #define _INSTANTIATE_SDF_STATUS_STRINGS 1 41 | 42 | #include "common/sdftypes.h" 43 | -------------------------------------------------------------------------------- /ssd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_DEFINITIONS(-std=gnu99 -fgnu89-inline) 2 | add_library(ssd OBJECT ssd.c ssd_aio.c ssd_defaults.c) 3 | add_subdirectory(clipper) 4 | add_subdirectory(fifo) 5 | add_dependencies(ssd ffdc) 6 | -------------------------------------------------------------------------------- /ssd/Makefile.defs: -------------------------------------------------------------------------------- 1 | CPPFLAGS += -UENABLE_MULTIPLE_FLASH_SUBSYSTEMS 2 | -------------------------------------------------------------------------------- /ssd/clipper/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(clipper OBJECT clipper_aio.c clipper.c) 2 | add_dependencies(clipper ffdc) 3 | -------------------------------------------------------------------------------- /ssd/fifo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(fifo OBJECT fifo.c 2 | mcd_aio.c 3 | mcd_bak.c 4 | mcd_pfx.c 5 | mcd_rec.c 6 | mcd_rec2.c 7 | mcd_rep.c 8 | mcd_sync.c 9 | mcd_hash.c 10 | mcd_osd.c 11 | # mcd_ipf.c 12 | recovery.c 13 | slab_gc.c 14 | hash.c 15 | mcd_check.c 16 | nvram.c 17 | scavenger.c ) 18 | add_dependencies(fifo ffdc) 19 | add_definitions(-Wno-switch -Wno-parentheses) 20 | -------------------------------------------------------------------------------- /ssd/fifo/mcd_aio_internal.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: ssd/fifo/mcd_aio_internal.h 22 | * Author: Xiaonan Ma 23 | * 24 | * Created on Mar 11, 2010 25 | * 26 | * (c) Copyright 2010, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: mcd_aio_internal.c 11778 2010-02-23 00:09:13Z briano $ 30 | */ 31 | 32 | #ifndef __MCD_AIO_INTERNAL_H__ 33 | #define __MCD_AIO_INTERNAL_H__ 34 | 35 | /* From fifo.c */ 36 | extern flash_settings_t flash_settings; 37 | 38 | #endif /* __MCD_AIO_INTERNAL_H__ */ 39 | -------------------------------------------------------------------------------- /ssd/fifo/mcd_hash.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: ssd/fifo/mcd_hash.h 22 | * Author: Bob Jenkins/Xiaonan Ma/Brian O'Krafka 23 | * 24 | * Created on Sept 1, 2010 25 | * 26 | * (c) Copyright 2010, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: mcd_hash.h 13657 2010-05-16 03:01:47Z briano $ 30 | */ 31 | 32 | #ifndef __MCD_HASH_H__ 33 | #define __MCD_HASH_H__ 34 | 35 | extern uint32_t mcd_hash( const void *key, /* the key to hash */ 36 | size_t length, /* length of the key */ 37 | const uint32_t initval); /* initval */ 38 | #endif /* __MCD_HASH_H__ */ 39 | -------------------------------------------------------------------------------- /ssd/fifo/mcd_trx.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | 21 | 22 | typedef enum { 23 | MCD_TRX_OKAY, 24 | MCD_TRX_TOO_MANY, 25 | MCD_TRX_TRANS_ACTIVE, 26 | MCD_TRX_NO_TRANS, 27 | MCD_TRX_NO_MEM, 28 | MCD_TRX_TOO_BIG, 29 | MCD_TRX_BAD_SHARD, 30 | MCD_TRX_HASHTABLE_FULL, 31 | MCD_TRX_BAD_CMD 32 | } mcd_trx_t; 33 | 34 | typedef struct { 35 | uint64_t transactions, 36 | operations, 37 | failures; 38 | } mcd_trx_stats_t; 39 | 40 | uint64_t mcd_trx_id( void); 41 | mcd_trx_t mcd_trx_start( void), 42 | mcd_trx_commit( void *), 43 | mcd_trx_rollback( void *), 44 | mcd_trx_detach( ), 45 | mcd_trx_attach( uint64_t), 46 | mcd_trx_commit_id( void *, uint64_t), 47 | mcd_trx_service( void *, int, void *); 48 | mcd_trx_stats_t mcd_trx_get_stats( void); 49 | void mcd_trx_print_stats( FILE *); 50 | -------------------------------------------------------------------------------- /ssd/fifo/scavenger.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /** @file scavenger.h 21 | * @brief ZS scavenger declarations. 22 | * 23 | * This contains declaration of exported functions for ZS to 24 | * scavenge expired objects from ZS 25 | * 26 | * @author Tomy Cheru (tcheru) 27 | * SanDisk Proprietary Material, © Copyright 2014 SanDisk, all rights reserved. 28 | * http://www.sandisk.com 29 | */ 30 | 31 | ZS_status_t zs_start_scavenger_thread(struct ZS_state *zs_state ); 32 | ZS_status_t zs_stop_scavenger_thread(); 33 | 34 | -------------------------------------------------------------------------------- /ssd/fifo/slab_gc.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | #ifndef __ZS_SLAB_GC_H__ 21 | #define __ZS_SLAB_GC_H__ 22 | 23 | #include "mcd_osd.h" 24 | 25 | bool slab_gc_init(mcd_osd_shard_t* shard, int threshold); 26 | 27 | void slab_gc_signal(mcd_osd_shard_t* shard, mcd_osd_slab_class_t* class); 28 | 29 | void slab_gc_end(mcd_osd_shard_t* shard); 30 | 31 | bool slab_gc_update_threshold(mcd_osd_shard_t *shard, int threshold); 32 | 33 | void slab_gc_get_stats(mcd_osd_shard_t* shard, ZS_stats_t* stats, FILE* log); 34 | 35 | #define STAT(A) \ 36 | ZS_FLASH_STATS_SLAB_GC_ ## A 37 | 38 | #endif /* __ZS_SLAB_GC_H__ */ 39 | -------------------------------------------------------------------------------- /utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | enable_language(ASM) 2 | add_library(utils OBJECT linkedlist.c 3 | crc32.s 4 | hash.c 5 | hashmap.c 6 | properties.c 7 | rtlog.c 8 | stats.c 9 | stats2.c 10 | caller.c 11 | sdfkey.c 12 | checklog.c 13 | platform_check.c) 14 | add_dependencies(utils ffdc) 15 | -------------------------------------------------------------------------------- /utils/caller.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: caller.c 22 | * Author: Jim 23 | * 24 | * Created on December 31, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http: //www.schoonerinfotech.com/ 28 | * 29 | * $Id: caller.c 396 2008-02-29 22:55:43Z jim $ 30 | */ 31 | 32 | 33 | /** 34 | * @brief Get a pointer to the calling location for debug purposes (spin locks) 35 | * 36 | * @return Pointer to caller 37 | */ 38 | void *caller() { 39 | return (__builtin_return_address(0)); 40 | } 41 | 42 | 43 | -------------------------------------------------------------------------------- /utils/caller.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: caller.h 22 | * Author: Jim 23 | * 24 | * Created on December 31, 2008 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http: //www.schoonerinfotech.com/ 28 | * 29 | * $Id: caller.h 396 2008-02-29 22:55:43Z jim $ 30 | */ 31 | 32 | #ifndef _CALLER_H 33 | #define _CALLER_H 34 | void *caller(void); 35 | #endif 36 | 37 | 38 | -------------------------------------------------------------------------------- /utils/hash.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * (c) Copyright 2008-2013, SanDisk Corporation. All rights reserved. 22 | */ 23 | #ifndef __HASH_H 24 | #define __HASH_H 25 | 26 | uint64_t hashb(const unsigned char *key, uint64_t keyLength, uint64_t level); 27 | uint64_t fastcrc32(const unsigned char *key, uint64_t keyLength, uint64_t level); 28 | uint32_t checksum(char* buf, uint64_t length, uint64_t seed); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /utils/platform_check.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: platform_check.h 22 | * Author: darryl 23 | * 24 | * Created on February 17, 2010, 10:35 AM 25 | * 26 | * Copyright (c) 2010 Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | */ 29 | 30 | 31 | /* 32 | * Check for a valid hardware platform. 33 | * Intended for use by applications that must only run on 34 | * authorized hardware. 35 | * 36 | * Returns 1 if ok to run, 0 if not ok. 37 | */ 38 | #include 39 | 40 | int is_valid_schooner_platform(); 41 | int test_schooner_platform_check(); 42 | -------------------------------------------------------------------------------- /utils/rtlog.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * Light-Weight Logging 22 | */ 23 | 24 | #include 25 | 26 | #ifdef rt_enable_logging 27 | 28 | extern void rtlog(const char *, uint64_t); 29 | extern void rt_dump(void); 30 | extern void rt_init(void); 31 | extern void rt_set_size(int); 32 | 33 | #else /* ! rt_enable_logging */ 34 | 35 | #define rtlog(...) 36 | #define rt_dump(...) 37 | #define rt_init(...) 38 | #define rt_set_size(...) 39 | 40 | #endif 41 | 42 | #define rt_log(f, v) rtlog(f, (uint64_t) v) 43 | -------------------------------------------------------------------------------- /utils/sdfkey.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // ZetaScale 3 | // Copyright (c) 2016, SanDisk Corp. and/or all its affiliates. 4 | // 5 | // This program is free software; you can redistribute it and/or modify it under 6 | // the terms of the GNU Lesser General Public License version 2.1 as published by the Free 7 | // Software Foundation; 8 | // 9 | // This program is distributed in the hope that it will be useful, but WITHOUT 10 | // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License v2.1 for more details. 12 | // 13 | // A copy of the GNU Lesser General Public License v2.1 is provided with this package and 14 | // can also be found at: http://opensource.org/licenses/LGPL-2.1 15 | // You should have received a copy of the GNU Lesser General Public License along with 16 | // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 17 | // Place, Suite 330, Boston, MA 02111-1307 USA. 18 | //---------------------------------------------------------------------------- 19 | 20 | /* 21 | * File: utils/sdfkey.c 22 | * Author: Darryl Ouye 23 | * 24 | * Created on August 22, 2008, 1:07 PM 25 | * 26 | * (c) Copyright 2008, Schooner Information Technology, Inc. 27 | * http://www.schoonerinfotech.com/ 28 | * 29 | * $Id: sdfkey.c $ 30 | */ 31 | 32 | // All functions are inline and defined in sdfkey.h 33 | 34 | #include "sdfkey.h" 35 | 36 | PLAT_SP_VAR_OPAQUE_IMPL(char_sp, char); 37 | 38 | #ifndef SDFCC_SHMEM_FAKE 39 | // PLAT_SP_IMPL(SDF_object_key_sp, struct _SDF_object_key); 40 | PLAT_SP_IMPL(SDF_key_sp, struct _SDF_key); 41 | #else 42 | // typedef struct _SDF_key SDF_key_sp; 43 | // typedef struct _SDF_key * SDF_key_sp_t; 44 | #endif 45 | -------------------------------------------------------------------------------- /utils/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS} -fno-builtin-printf) 2 | add_executable(propertiestest propertiestest.c) 3 | add_executable(hashmaptest hashmaptest.c) 4 | #target_link_libraries() -------------------------------------------------------------------------------- /utils/tests/schooner.properties: -------------------------------------------------------------------------------- 1 | # 2 | # LARGE CONFIGURATION 3 | # 4 | # 5 | 6 | 1SDF_CC_MAXSIZE=1024 7 | 2SDF_CC_MAXSIZE=1024 8 | 3SDF_CC_MAXSIZE= 1024 9 | 4SDF_CC_MAXSIZE =1024 10 | 5SDF_CC_MAXSIZE=1024 11 | 6SDF_CC_MAXSIZE = 1024 12 | 7SDF_CC_MAXSIZE = 1024 13 | 8SDF_CC_MAXSIZE = 1024 14 | 9SDF_CC_MAXSIZE = 1024 15 | 10SDF_CC_MAXSIZE = 16 | # 17 | -------------------------------------------------------------------------------- /zsck/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-std=gnu99 -fgnu89-inline) 2 | 3 | add_executable(zsck zsck.c) 4 | add_dependencies(zsck zs) 5 | target_link_libraries( zsck zsdll dl pthread aio event snappy lz4) 6 | 7 | add_executable(zsformat zsformat.c) 8 | add_dependencies(zsformat zs) 9 | target_link_libraries( zsformat zsdll dl pthread aio event snappy lz4) 10 | 11 | add_executable(zsmetafault zsmetafault.c) 12 | add_dependencies(zsmetafault zs) 13 | target_link_libraries( zsmetafault zsdll dl pthread aio event snappy lz4) 14 | -------------------------------------------------------------------------------- /zsck/zsck.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | check_btree=true 4 | logfile="" 5 | 6 | usage() 7 | { 8 | echo "$0 -a -m -h" 9 | echo " -a Run META, LOGS and BTREE checks (default)" 10 | echo " -m Run only META and LOGS checks" 11 | echo " -h Print help" 12 | exit 1 13 | } 14 | 15 | while getopts "ahl:m" opt; do 16 | 17 | case $opt in 18 | 19 | a) 20 | check_btree=true 21 | ;; 22 | 23 | l) 24 | logfile=${OPTARG} 25 | ;; 26 | m) 27 | check_btree=false 28 | ;; 29 | 30 | h) 31 | usage 32 | ;; 33 | 34 | *) 35 | usage 36 | ;; 37 | 38 | esac 39 | done 40 | 41 | if [ -n "$logfile" ] 42 | then 43 | zsck -l $logfile 44 | else 45 | zsck 46 | fi 47 | 48 | if [ "$?" -ne "0" ] 49 | then 50 | if [ "$check_btree" = true ] 51 | then 52 | echo "META/LOGS check failed. Cannot continue." 53 | fi 54 | exit 1 55 | fi 56 | 57 | if [ "$check_btree" = true ] 58 | then 59 | if [ -n "$logfile" ] 60 | then 61 | zsck -b -l $logfile 62 | else 63 | zsck -b 64 | fi 65 | fi 66 | 67 | --------------------------------------------------------------------------------