├── NEWS ├── ChangeLog ├── src ├── test │ ├── cli │ │ ├── .gitignore │ │ ├── crushtool │ │ │ ├── simple.template │ │ │ ├── five-devices.crushmap │ │ │ ├── one-hundered-devices.crushmap │ │ │ ├── test-map-tries-vs-retries.crushmap │ │ │ ├── one-hundered-devices-new-tunables.crushmap │ │ │ ├── reweight_multiple.t │ │ │ ├── reweight.t │ │ │ ├── compile-decompile-recompile.t │ │ │ ├── add-item.t │ │ │ ├── simple.template.four │ │ │ ├── simple.template.one │ │ │ ├── simple.template.two │ │ │ ├── simple.template.three │ │ │ ├── simple.template.five │ │ │ ├── need_tree_order.crush │ │ │ └── simple.template.multitree │ │ ├── ceph-authtool │ │ │ ├── list-empty.t │ │ │ ├── list-empty-bin.t │ │ │ ├── add-key-segv.t │ │ │ ├── cap-bin.t │ │ │ ├── list-nonexistent.t │ │ │ ├── list-nonexistent-bin.t │ │ │ ├── cap.t │ │ │ ├── cap-invalid.t │ │ │ ├── cap-overwrite.t │ │ │ ├── create-gen-list-bin.t │ │ │ ├── create-gen-list.t │ │ │ └── add-key.t │ │ ├── ceph-conf │ │ │ ├── simple.t │ │ │ ├── show-config-value.t │ │ │ ├── sections.t │ │ │ ├── env-vs-args.t │ │ │ ├── invalid-args.t │ │ │ └── manpage.t │ │ ├── monmaptool │ │ │ ├── print-empty.t │ │ │ ├── print-nonexistent.t │ │ │ ├── help.t │ │ │ ├── simple.t │ │ │ ├── create-with-add.t │ │ │ ├── create-print.t │ │ │ ├── rm.t │ │ │ ├── rm-nonexistent.t │ │ │ ├── add-exists.t │ │ │ └── add-many.t │ │ ├── osdmaptool │ │ │ ├── print-empty.t │ │ │ ├── print-nonexistent.t │ │ │ ├── create-racks.t │ │ │ ├── help.t │ │ │ ├── simple.t │ │ │ └── create-print.t │ │ └── rbd │ │ │ └── not-enough-args.t │ ├── downloads │ │ └── cram-0.5.0ceph.2011-01-14.tar.gz │ ├── librados │ │ ├── librados.cc │ │ └── cls.cc │ ├── test_libcommon_build.cc │ ├── run-cli-tests-maybe-unset-ccache │ ├── bench │ │ ├── backend.h │ │ ├── stat_collector.h │ │ ├── rados_backend.h │ │ ├── rbd_backend.h │ │ └── filestore_backend.h │ ├── run_cmd.cc │ ├── simple_spin.cc │ ├── system │ │ ├── systest_settings.h │ │ ├── cross_process_sem.h │ │ └── st_rados_delete_pool.h │ ├── test_str_list.cc │ ├── osd │ │ └── RadosModel.cc │ ├── common │ │ └── test_util.cc │ ├── test_cfuse_cache_invalidate.cc │ └── heartbeat_map.cc ├── libs3 │ ├── debian │ │ ├── postinst │ │ ├── changelog │ │ ├── changelog.Debian │ │ ├── control │ │ └── control.dev │ ├── TODO │ ├── README │ ├── mswin │ │ ├── rmrf.bat │ │ └── libs3.def │ ├── test │ │ └── goodxml_01.xml │ ├── ChangeLog │ ├── archlinux │ │ └── PKGBUILD │ └── LICENSE ├── TODO ├── .git_version ├── ceph-disk-activate ├── ceph-disk-prepare ├── README ├── rbdmap ├── upstart │ ├── ceph-all.conf │ ├── ceph-mds-all.conf │ ├── ceph-osd-all.conf │ ├── ceph-mon-all.conf │ ├── radosgw-all.conf │ ├── ceph-create-keys.conf │ ├── radosgw-all-starter.conf │ ├── ceph-mds-all-starter.conf │ ├── ceph-mon-all-starter.conf │ ├── ceph-mds.conf │ ├── radosgw.conf │ ├── ceph-osd-all-starter.conf │ └── ceph-mon.conf ├── common │ ├── blkdev.h │ ├── errno.h │ ├── ceph_crypto_cms.h │ ├── dout.cc │ ├── arch.h │ ├── errno.cc │ ├── page.cc │ ├── armor.h │ ├── fd.h │ ├── SimpleRNG.h │ ├── environment.h │ ├── secret.h │ ├── likely.h │ ├── BackTrace.h │ ├── RefCountedObj.cc │ ├── hex.h │ ├── Clock.h │ ├── static_assert.h │ ├── strtol.h │ ├── pipe.h │ ├── version.h │ ├── debug.h │ ├── compiler_extensions.h │ ├── TrackedOp.h │ ├── run_cmd.h │ ├── blkdev.cc │ ├── lockdep.h │ ├── config_obs.h │ ├── Clock.cc │ ├── Semaphore.h │ ├── version.cc │ ├── admin_socket_client.h │ ├── environment.cc │ ├── pipe.c │ ├── simple_spin.cc │ ├── hex.cc │ ├── io_priority.h │ ├── code_environment.h │ └── PrebufferedStreambuf.h ├── verify-mds-journal.sh ├── ceph_ver.c ├── json_spirit │ ├── json_spirit_value.cpp │ └── json_spirit.h ├── rgw │ ├── rgw_rest_admin.h │ ├── rgw_fcgi.h │ ├── rgw_resolve.h │ ├── rgw_fcgi.cc │ ├── rgw_auth_s3.h │ ├── rgw_usage.h │ ├── rgw_rest_usage.h │ ├── rgw_rest_user.h │ ├── rgw_acl_swift.h │ ├── rgw_rest_bucket.h │ ├── rgw_tools.h │ ├── rgw_multiparser.cc │ ├── rgw_client_io.h │ ├── logrotate.conf │ ├── rgw_multi.h │ ├── rgw_client_io.cc │ ├── rgw_multi_del.h │ ├── rgw_rest_conn.h │ └── rgw_http_client.h ├── gtest │ ├── xcode │ │ ├── Config │ │ │ ├── TestTarget.xcconfig │ │ │ ├── FrameworkTarget.xcconfig │ │ │ ├── StaticLibraryTarget.xcconfig │ │ │ ├── DebugProject.xcconfig │ │ │ └── ReleaseProject.xcconfig │ │ ├── Samples │ │ │ └── FrameworkSample │ │ │ │ └── Info.plist │ │ └── Resources │ │ │ └── Info.plist │ └── m4 │ │ └── ltversion.m4 ├── include │ ├── stringify.h │ ├── rados │ │ ├── rados_types.h │ │ ├── page.h │ │ ├── rados_types.hpp │ │ ├── crc32c.h │ │ └── librgw.h │ ├── rbd │ │ └── features.h │ ├── color.h │ ├── page.h │ ├── ceph_frag.cc │ ├── ceph_hash.h │ ├── ipaddr.h │ ├── err.h │ ├── addr_parsing.h │ ├── compat.h │ ├── util.h │ ├── inttypes.h │ ├── crc32c.h │ ├── triple.h │ ├── intarith.h │ ├── error.h │ ├── str_list.h │ ├── blobhash.h │ └── bitmapper.h ├── crush │ ├── types.h │ ├── mapper.h │ ├── hash.h │ ├── sample.txt │ └── CrushWrapper.i ├── msg │ ├── Messenger.cc │ └── Accepter.h ├── make_version ├── ceph-rbdnamer ├── ceph-run ├── check_version ├── cls │ ├── version │ │ ├── cls_version_types.cc │ │ └── cls_version_client.h │ └── statelog │ │ └── cls_statelog_types.h ├── client │ ├── Dir.h │ ├── fuse_ll.h │ ├── Fh.h │ ├── Dentry.cc │ ├── ClientSnapRealm.cc │ └── MetaSession.cc ├── fetch_config ├── ceph-coverage.in ├── librados │ └── snap_set_diff.h ├── ocf │ └── Makefile.am ├── global │ ├── global_context.cc │ ├── global_context.h │ └── pidfile.h ├── perfglue │ ├── cpu_profiler.h │ ├── disabled_stubs.cc │ ├── disabled_heap_profiler.cc │ └── cpu_profiler.cc ├── unittest_bufferlist.sh ├── log │ └── SubsystemMap.cc ├── objclass │ └── class_debug.cc ├── librbd │ ├── SnapInfo.h │ ├── WatchCtx.h │ └── WatchCtx.cc ├── messages │ ├── MPing.h │ ├── MMonGetMap.h │ ├── MGenericMessage.h │ ├── MPGStatsAck.h │ ├── MMDSFindIno.h │ ├── MMonGlobalID.h │ └── MLogAck.h ├── logrotate.conf ├── mount.fuse.ceph ├── auth │ ├── none │ │ ├── AuthNoneProtocol.h │ │ └── AuthNoneAuthorizeHandler.h │ ├── AuthServiceHandler.cc │ ├── unknown │ │ ├── AuthUnknownProtocol.h │ │ ├── AuthUnknownAuthorizeHandler.h │ │ └── AuthUnknownAuthorizeHandler.cc │ ├── cephx │ │ └── CephxAuthorizeHandler.h │ ├── AuthClientHandler.cc │ └── AuthMethodList.h ├── osd │ ├── ObjectVersioner.h │ └── Ager.h ├── mds │ └── events │ │ ├── EResetJournal.h │ │ └── ECommitted.h └── stop.sh ├── udev ├── 50-rbd.rules └── 95-ceph-osd-alt.rules ├── share ├── known_hosts_drop.ceph.com ├── id_dsa_drop.ceph.com.pub └── id_dsa_drop.ceph.com ├── AUTHORS ├── autogen.sh ├── INSTALL ├── man └── Makefile.am └── m4 ├── ltversion.m4 ├── ac_check_classpath.m4 ├── ac_prog_javah.m4 └── ac_prog_javac_works.m4 /NEWS: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/test/cli/.gitignore: -------------------------------------------------------------------------------- 1 | *.t.err 2 | -------------------------------------------------------------------------------- /src/libs3/debian/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ldconfig 4 | -------------------------------------------------------------------------------- /src/TODO: -------------------------------------------------------------------------------- 1 | 2 | See http://tracker.newdream.net/projects/ceph/roadmap -------------------------------------------------------------------------------- /src/.git_version: -------------------------------------------------------------------------------- 1 | bc8b67bef6309a32361be76cd11fb56b057ea9d2 2 | v0.67.11 3 | -------------------------------------------------------------------------------- /src/ceph-disk-activate: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | dir=`dirname $0` 3 | $dir/ceph-disk activate $* 4 | -------------------------------------------------------------------------------- /src/ceph-disk-prepare: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | dir=`dirname $0` 3 | $dir/ceph-disk prepare $* 4 | -------------------------------------------------------------------------------- /src/README: -------------------------------------------------------------------------------- 1 | Sage Weil 2 | Ceph - scalable distributed storage system 3 | -------------------------------------------------------------------------------- /src/libs3/TODO: -------------------------------------------------------------------------------- 1 | * Implement functions for generating form stuff for posting to s3 2 | 3 | * Write s3 man page 4 | -------------------------------------------------------------------------------- /src/rbdmap: -------------------------------------------------------------------------------- 1 | # RbdDevice Parameters 2 | #poolname/imagename id=client,keyring=/etc/ceph/ceph.client.keyring 3 | -------------------------------------------------------------------------------- /src/upstart/ceph-all.conf: -------------------------------------------------------------------------------- 1 | description "Ceph" 2 | 3 | start on runlevel [2345] 4 | stop on runlevel [!2345] 5 | -------------------------------------------------------------------------------- /src/test/cli/crushtool/simple.template: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wikia/ceph-0.67.11/master/src/test/cli/crushtool/simple.template -------------------------------------------------------------------------------- /src/test/cli/ceph-authtool/list-empty.t: -------------------------------------------------------------------------------- 1 | $ touch empty 2 | 3 | $ ceph-authtool --list empty 4 | 5 | $ ceph-authtool -l empty 6 | -------------------------------------------------------------------------------- /src/upstart/ceph-mds-all.conf: -------------------------------------------------------------------------------- 1 | description "Ceph MDS (all instances)" 2 | 3 | start on starting ceph-all 4 | stop on stopping ceph-all 5 | -------------------------------------------------------------------------------- /src/test/cli/ceph-authtool/list-empty-bin.t: -------------------------------------------------------------------------------- 1 | $ touch empty 2 | 3 | $ ceph-authtool --list empty 4 | 5 | $ ceph-authtool -l empty 6 | -------------------------------------------------------------------------------- /src/test/cli/crushtool/five-devices.crushmap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wikia/ceph-0.67.11/master/src/test/cli/crushtool/five-devices.crushmap -------------------------------------------------------------------------------- /src/libs3/README: -------------------------------------------------------------------------------- 1 | This directory contains the libs3 library. 2 | 3 | The libs3 library is free software. See the file LICENSE for copying 4 | permission. 5 | -------------------------------------------------------------------------------- /src/libs3/mswin/rmrf.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | if exist "%1". ( 4 | rmdir /S /Q "%1" 5 | ) 6 | 7 | if exist "%1". ( 8 | del /Q "%1" 9 | ) 10 | -------------------------------------------------------------------------------- /src/test/downloads/cram-0.5.0ceph.2011-01-14.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wikia/ceph-0.67.11/master/src/test/downloads/cram-0.5.0ceph.2011-01-14.tar.gz -------------------------------------------------------------------------------- /src/upstart/ceph-osd-all.conf: -------------------------------------------------------------------------------- 1 | description "Ceph OSD (all instances)" 2 | 3 | start on starting ceph-all 4 | stop on runlevel [!2345] or stopping ceph-all 5 | -------------------------------------------------------------------------------- /src/test/cli/crushtool/one-hundered-devices.crushmap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wikia/ceph-0.67.11/master/src/test/cli/crushtool/one-hundered-devices.crushmap -------------------------------------------------------------------------------- /src/upstart/ceph-mon-all.conf: -------------------------------------------------------------------------------- 1 | description "Ceph monitor (all instances)" 2 | 3 | start on starting ceph-all 4 | stop on runlevel [!2345] or stopping ceph-all 5 | -------------------------------------------------------------------------------- /src/upstart/radosgw-all.conf: -------------------------------------------------------------------------------- 1 | description "Ceph radosgw (all instances)" 2 | 3 | start on starting ceph-all 4 | stop on runlevel [!2345] or stopping ceph-all 5 | -------------------------------------------------------------------------------- /src/test/cli/ceph-conf/simple.t: -------------------------------------------------------------------------------- 1 | $ ceph-conf 2 | You must give an action, such as --lookup or --list-all-sections. 3 | Pass --help for more help. 4 | [1] 5 | -------------------------------------------------------------------------------- /src/common/blkdev.h: -------------------------------------------------------------------------------- 1 | #ifndef __CEPH_COMMON_BLKDEV_H 2 | #define __CEPH_COMMON_BLKDEV_H 3 | 4 | extern int get_block_device_size(int fd, int64_t *psize); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /src/test/cli/crushtool/test-map-tries-vs-retries.crushmap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wikia/ceph-0.67.11/master/src/test/cli/crushtool/test-map-tries-vs-retries.crushmap -------------------------------------------------------------------------------- /src/test/cli/monmaptool/print-empty.t: -------------------------------------------------------------------------------- 1 | $ touch empty 2 | $ monmaptool --print empty 3 | monmaptool: monmap file empty 4 | monmaptool: unable to read monmap file 5 | [255] 6 | -------------------------------------------------------------------------------- /src/test/cli/crushtool/one-hundered-devices-new-tunables.crushmap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Wikia/ceph-0.67.11/master/src/test/cli/crushtool/one-hundered-devices-new-tunables.crushmap -------------------------------------------------------------------------------- /src/test/cli/osdmaptool/print-empty.t: -------------------------------------------------------------------------------- 1 | $ touch empty 2 | $ osdmaptool --print empty 3 | osdmaptool: osdmap file 'empty' 4 | osdmaptool: error decoding osdmap 'empty' 5 | [255] 6 | -------------------------------------------------------------------------------- /src/test/cli/ceph-conf/show-config-value.t: -------------------------------------------------------------------------------- 1 | 2 | # should reflect daemon defaults 3 | 4 | $ ceph-conf -n osd.0 --show-config-value log_file -c /dev/null 5 | /var/log/ceph/ceph-osd.0.log 6 | -------------------------------------------------------------------------------- /src/verify-mds-journal.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | while [ 1 ] 4 | do 5 | ./ceph-mds -f --debug_mds 20 --debug_ms 1 --standby_replay_for 0 || exit 1 6 | echo replay ok, sleeping 7 | sleep 30 8 | done -------------------------------------------------------------------------------- /src/test/cli/monmaptool/print-nonexistent.t: -------------------------------------------------------------------------------- 1 | $ monmaptool --print nonexistent 2 | monmaptool: monmap file nonexistent 3 | monmaptool: couldn't open nonexistent: No such file or directory 4 | [255] 5 | -------------------------------------------------------------------------------- /src/common/errno.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_ERRNO_H 2 | #define CEPH_ERRNO_H 3 | 4 | #include 5 | 6 | /* Return a given error code as a string */ 7 | std::string cpp_strerror(int err); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/test/cli/ceph-authtool/add-key-segv.t: -------------------------------------------------------------------------------- 1 | $ ceph-authtool kring --create-keyring 2 | creating kring 3 | 4 | $ ceph-authtool kring --add-key 'FAKEBASE64 foo' 5 | can't decode key 'FAKEBASE64 foo' 6 | [1] 7 | -------------------------------------------------------------------------------- /src/test/cli/monmaptool/help.t: -------------------------------------------------------------------------------- 1 | $ monmaptool --help 2 | usage: [--print] [--create [--clobber][--fsid uuid]] [--generate] [--set-initial-members] [--add name 1.2.3.4:567] [--rm name] 3 | [1] 4 | -------------------------------------------------------------------------------- /src/libs3/debian/changelog: -------------------------------------------------------------------------------- 1 | libs3 (all) unstable; urgency=low 2 | 3 | * This file is not maintained. See project source code for changes. 4 | 5 | -- Bryan Ischo Wed, 06 Aug 2008 09:36:43 -0400 6 | -------------------------------------------------------------------------------- /src/test/cli/osdmaptool/print-nonexistent.t: -------------------------------------------------------------------------------- 1 | $ osdmaptool --print nonexistent 2 | osdmaptool: osdmap file 'nonexistent' 3 | osdmaptool: couldn't open nonexistent: can't open nonexistent: (2) No such file or directory 4 | [255] 5 | -------------------------------------------------------------------------------- /udev/50-rbd.rules: -------------------------------------------------------------------------------- 1 | KERNEL=="rbd[0-9]*", ENV{DEVTYPE}=="disk", PROGRAM="/usr/bin/ceph-rbdnamer %k", SYMLINK+="rbd/%c{1}/%c{2}" 2 | KERNEL=="rbd[0-9]*", ENV{DEVTYPE}=="partition", PROGRAM="/usr/bin/ceph-rbdnamer %k", SYMLINK+="rbd/%c{1}/%c{2}-part%n" 3 | -------------------------------------------------------------------------------- /src/ceph_ver.c: -------------------------------------------------------------------------------- 1 | 2 | #include "acconfig.h" 3 | #include "ceph_ver.h" 4 | 5 | #define CONCAT_VER_SYMBOL(x) ceph_ver__##x 6 | 7 | #define DEFINE_VER_SYMBOL(x) int CONCAT_VER_SYMBOL(x) 8 | 9 | DEFINE_VER_SYMBOL(CEPH_GIT_VER); 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/test/cli/monmaptool/simple.t: -------------------------------------------------------------------------------- 1 | $ monmaptool 2 | monmaptool: must specify monmap filename 3 | usage: [--print] [--create [--clobber][--fsid uuid]] [--generate] [--set-initial-members] [--add name 1.2.3.4:567] [--rm name] 4 | [1] 5 | -------------------------------------------------------------------------------- /src/test/cli/osdmaptool/create-racks.t: -------------------------------------------------------------------------------- 1 | $ osdmaptool --create-from-conf om -c $TESTDIR/ceph.conf.withracks > /dev/null 2 | $ osdmaptool --test-map-pg 0.0 om 3 | osdmaptool: osdmap file 'om' 4 | parsed '0.0' -> 0.0 5 | 0.0 raw [] up [] acting [] 6 | -------------------------------------------------------------------------------- /udev/95-ceph-osd-alt.rules: -------------------------------------------------------------------------------- 1 | # Check gpt partion for ceph tags and activate 2 | ACTION=="add", SUBSYSTEM=="block", \ 3 | ENV{DEVTYPE}=="partition", \ 4 | ENV{ID_PART_TABLE_TYPE}=="gpt", \ 5 | RUN+="/usr/sbin/ceph-disk-udev $number $name $parent" 6 | -------------------------------------------------------------------------------- /src/json_spirit/json_spirit_value.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007 John W Wilkinson 2 | 3 | This source code can be used for any purpose as long as 4 | this comment is retained. */ 5 | 6 | // json spirit version 2.00 7 | 8 | #include "json_spirit_value.h" 9 | -------------------------------------------------------------------------------- /src/upstart/ceph-create-keys.conf: -------------------------------------------------------------------------------- 1 | description "Create Ceph client.admin key when possible" 2 | 3 | start on started ceph-mon 4 | stop on stopping ceph-mon 5 | 6 | task 7 | 8 | exec /usr/sbin/ceph-create-keys --cluster="${cluster:-ceph}" -i "${id:-$(hostname)}" 9 | -------------------------------------------------------------------------------- /src/common/ceph_crypto_cms.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_CRYPTO_CMS_H 2 | #define CEPH_CRYPTO_CMS_H 3 | 4 | #include "include/buffer.h" 5 | 6 | class CephContext; 7 | 8 | int ceph_decode_cms(CephContext *cct, bufferlist& cms_bl, bufferlist& decoded_bl); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/rgw/rgw_rest_admin.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_RGW_REST_ADMIN_H 2 | #define CEPH_RGW_REST_ADMIN_H 3 | 4 | 5 | class RGWRESTMgr_Admin : public RGWRESTMgr { 6 | public: 7 | RGWRESTMgr_Admin() {} 8 | virtual ~RGWRESTMgr_Admin() {} 9 | }; 10 | 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /src/test/cli/ceph-authtool/cap-bin.t: -------------------------------------------------------------------------------- 1 | $ ceph-authtool kring --create-keyring --gen-key 2 | creating kring 3 | 4 | $ ceph-authtool --cap osd 'allow rx pool=swimming' kring 5 | $ ceph-authtool kring --list|grep -P '^\tcaps ' 6 | \tcaps osd = "allow rx pool=swimming" (esc) 7 | -------------------------------------------------------------------------------- /src/common/dout.cc: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | void dout_emergency(const char * const str) 5 | { 6 | std::cerr << str; 7 | std::cerr.flush(); 8 | } 9 | 10 | void dout_emergency(const std::string &str) 11 | { 12 | std::cerr << str; 13 | std::cerr.flush(); 14 | } 15 | -------------------------------------------------------------------------------- /src/libs3/debian/changelog.Debian: -------------------------------------------------------------------------------- 1 | libs3 (all) unstable; urgency=low 2 | 3 | * libs3 Debian maintainer and upstream author are identical. 4 | Therefore see normal changelog file for Debian changes. 5 | 6 | -- Bryan Ischo Wed, 06 Aug 2008 09:36:43 -0400 7 | -------------------------------------------------------------------------------- /src/common/arch.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_ARCH_H 2 | #define CEPH_ARCH_H 3 | 4 | static const char *get_arch() 5 | { 6 | #if defined(__i386__) 7 | return "i386"; 8 | #elif defined(__x86_64__) 9 | return "x86-64"; 10 | #else 11 | return "unknown"; 12 | #endif 13 | } 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /src/test/cli/crushtool/reweight_multiple.t: -------------------------------------------------------------------------------- 1 | $ crushtool -c "$TESTDIR/simple.template.multitree" -o mt 2 | $ crushtool -i mt --reweight-item osd1 2.5 -o mt 3 | crushtool reweighting item osd1 to 2.5 4 | $ crushtool -d mt -o mt.txt 5 | $ diff mt.txt "$TESTDIR/simple.template.multitree.reweighted" 6 | -------------------------------------------------------------------------------- /src/gtest/xcode/Config/TestTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // TestTarget.xcconfig 3 | // 4 | // These are Test target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | 7 | PRODUCT_NAME = $(TARGET_NAME) 8 | HEADER_SEARCH_PATHS = ../include 9 | -------------------------------------------------------------------------------- /src/include/stringify.h: -------------------------------------------------------------------------------- 1 | #ifndef __CEPH_STRINGIFY_H 2 | #define __CEPH_STRINGIFY_H 3 | 4 | #include 5 | #include 6 | 7 | template 8 | inline std::string stringify(const T& a) { 9 | std::stringstream ss; 10 | ss << a; 11 | return ss.str(); 12 | } 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /src/test/cli/ceph-authtool/list-nonexistent.t: -------------------------------------------------------------------------------- 1 | $ ceph-authtool --list nonexistent 2 | can't open nonexistent: can't open nonexistent: (2) No such file or directory 3 | [1] 4 | 5 | $ ceph-authtool -l nonexistent 6 | can't open nonexistent: can't open nonexistent: (2) No such file or directory 7 | [1] 8 | -------------------------------------------------------------------------------- /src/test/cli/ceph-authtool/list-nonexistent-bin.t: -------------------------------------------------------------------------------- 1 | $ ceph-authtool --list nonexistent 2 | can't open nonexistent: can't open nonexistent: (2) No such file or directory 3 | [1] 4 | 5 | $ ceph-authtool -l nonexistent 6 | can't open nonexistent: can't open nonexistent: (2) No such file or directory 7 | [1] 8 | -------------------------------------------------------------------------------- /src/libs3/test/goodxml_01.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | NoSuchKey 4 | The resource & then]]> you requested does not exist & so there 5 | /mybucket/myfoto.jpg 6 | 4442587FB7D0A2F9 7 | 8 | -------------------------------------------------------------------------------- /src/test/librados/librados.cc: -------------------------------------------------------------------------------- 1 | //#include "common/config.h" 2 | #include "include/rados/librados.h" 3 | 4 | #include "gtest/gtest.h" 5 | 6 | TEST(Librados, CreateShutdown) { 7 | rados_t cluster; 8 | int err; 9 | err = rados_create(&cluster, "someid"); 10 | EXPECT_EQ(err, 0); 11 | 12 | rados_shutdown(cluster); 13 | } 14 | -------------------------------------------------------------------------------- /src/crush/types.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_CRUSH_TYPES_H 2 | #define CEPH_CRUSH_TYPES_H 3 | 4 | #ifdef KERNEL 5 | # define free(x) kfree(x) 6 | #else 7 | # include 8 | #endif 9 | 10 | 11 | #include /* just for int types */ 12 | 13 | #ifndef BUG_ON 14 | # define BUG_ON(x) assert(!(x)) 15 | #endif 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/msg/Messenger.cc: -------------------------------------------------------------------------------- 1 | 2 | #include "include/types.h" 3 | #include "Messenger.h" 4 | 5 | #include "SimpleMessenger.h" 6 | 7 | Messenger *Messenger::create(CephContext *cct, 8 | entity_name_t name, 9 | string lname, 10 | uint64_t nonce) 11 | { 12 | return new SimpleMessenger(cct, name, lname, nonce); 13 | } 14 | -------------------------------------------------------------------------------- /src/make_version: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cur=`head -1 $1` 4 | v=`tail -1 $1 | cut -c 2-` 5 | 6 | print_all() { 7 | echo "#ifndef CEPH_VERSION_H" 8 | echo "#define CEPH_VERSION_H" 9 | echo 10 | echo "#define CEPH_GIT_VER $cur" 11 | echo "#define CEPH_GIT_NICE_VER \"$v\"" 12 | echo 13 | echo "#endif" 14 | } 15 | 16 | print_all > $2 17 | -------------------------------------------------------------------------------- /src/test/cli/ceph-conf/sections.t: -------------------------------------------------------------------------------- 1 | $ cat >test.conf < [bar] 3 | > bar = green 4 | > [foo] 5 | > bar = blue 6 | > [baz] 7 | > bar = yellow 8 | > [thud] 9 | > bar = yellow 10 | > EOF 11 | 12 | $ ceph-conf -c test.conf -l bar 13 | bar 14 | 15 | $ ceph-conf -c test.conf -l b 16 | bar 17 | baz 18 | 19 | -------------------------------------------------------------------------------- /src/ceph-rbdnamer: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DEV=$1 4 | NUM=`echo $DEV | sed 's#p.*##g' | tr -d 'a-z'` 5 | POOL=`cat /sys/devices/rbd/$NUM/pool` 6 | IMAGE=`cat /sys/devices/rbd/$NUM/name` 7 | SNAP=`cat /sys/devices/rbd/$NUM/current_snap` 8 | if [ "$SNAP" = "-" ]; then 9 | echo -n "$POOL $IMAGE" 10 | else 11 | echo -n "$POOL $IMAGE@$SNAP" 12 | fi 13 | -------------------------------------------------------------------------------- /src/include/rados/rados_types.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_RADOS_TYPES_H 2 | #define CEPH_RADOS_TYPES_H 3 | 4 | #include 5 | 6 | /** 7 | * @struct obj_watch_t 8 | * One item from list_watchers 9 | */ 10 | struct obj_watch_t { 11 | char addr[256]; 12 | int64_t watcher_id; 13 | uint64_t cookie; 14 | uint32_t timeout_seconds; 15 | }; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/include/rbd/features.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_RBD_FEATURES_H 2 | #define CEPH_RBD_FEATURES_H 3 | 4 | #define RBD_FEATURE_LAYERING (1<<0) 5 | #define RBD_FEATURE_STRIPINGV2 (1<<1) 6 | 7 | #define RBD_FEATURES_INCOMPATIBLE (RBD_FEATURE_LAYERING|RBD_FEATURE_STRIPINGV2) 8 | #define RBD_FEATURES_ALL (RBD_FEATURE_LAYERING|RBD_FEATURE_STRIPINGV2) 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/common/errno.cc: -------------------------------------------------------------------------------- 1 | #include "common/errno.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | std::string cpp_strerror(int err) 8 | { 9 | char buf[128]; 10 | 11 | if (err < 0) 12 | err = -err; 13 | std::ostringstream oss; 14 | oss << "(" << err << ") " << strerror_r(err, buf, sizeof(buf)); 15 | 16 | return oss.str(); 17 | } 18 | -------------------------------------------------------------------------------- /src/include/color.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_COLOR_H 2 | #define CEPH_COLOR_H 3 | 4 | #define TEXT_NORMAL "\033[0m" 5 | /*#define TEXT_HAZARD "\033[5;31m"*/ 6 | #define TEXT_RED "\033[0;31m" 7 | #define TEXT_GREEN "\033[0;32m" 8 | #define TEXT_YELLOW "\033[0;33m" 9 | #define TEXT_BLUE "\033[0;34m" 10 | #define TEXT_MAGENTA "\033[0;35m" 11 | #define TEXT_CYAN "\033[0;36m" 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /src/ceph-run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | sleep=5 4 | 5 | while [ true ]; do 6 | "$@" 7 | exit_code=$? 8 | 9 | if [ $exit_code -gt 128 ]; then 10 | case $(($exit_code-128)) in 11 | 3 | 4 | 5 | 6 | 8 | 11) 12 | ;; 13 | *) 14 | exit; 15 | esac 16 | echo ceph-run: $1 dumped core, restarting in $sleep seconds... 17 | sleep $sleep 18 | else 19 | exit 20 | fi 21 | done 22 | -------------------------------------------------------------------------------- /share/known_hosts_drop.ceph.com: -------------------------------------------------------------------------------- 1 | drop.ceph.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCjl2XzIpS92snr4SymcBVQx7y6d/ZjzCKJAlGZYkgknWWf+JBEpXp+cOoMk2Td5pIPkOdn72pGAuuPzL9HSJpN/o75tzbv0mAd//3t9D5/Kpnd+tWIDDgj+RIz8ZKRxSR8lnVjsUHlTrwQwaUkZ3KDiVgtQXDp0+1rU1+02cEkeBStoMLQt/6xw1hmPGSIAMH2HRkyge+/I8RwK7jbTwwcxh61Vxe0qMGkDO6vUVXw+K6hoXV4uGaqZ9/B2GirXJPz6ulvLC/mtEdgtfKS3eiMTaJS5Cpne6rJw2Wm7kHfQPstJaUq06BJiRe6R+JHC897NVZd0yc1bZe+BI0PmQJL 2 | -------------------------------------------------------------------------------- /src/include/page.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_PAGE_H 2 | #define CEPH_PAGE_H 3 | 4 | namespace ceph { 5 | // these are in common/page.cc 6 | extern unsigned _page_size; 7 | extern unsigned long _page_mask; 8 | extern unsigned _page_shift; 9 | } 10 | 11 | #endif 12 | 13 | 14 | #define CEPH_PAGE_SIZE ceph::_page_size 15 | #define CEPH_PAGE_MASK ceph::_page_mask 16 | #define CEPH_PAGE_SHIFT ceph::_page_shift 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/test/cli/ceph-authtool/cap.t: -------------------------------------------------------------------------------- 1 | $ ceph-authtool kring --create-keyring --gen-key 2 | creating kring 3 | 4 | $ ceph-authtool --cap osd 'allow rx pool=swimming' kring 5 | $ ceph-authtool kring --list|grep -P '^\tcaps ' 6 | \tcaps osd = "allow rx pool=swimming" (esc) 7 | 8 | $ cat kring 9 | [client.admin] 10 | \\tkey = [a-zA-Z0-9+/]+=* \(esc\) (re) 11 | \tcaps osd = "allow rx pool=swimming" (esc) 12 | -------------------------------------------------------------------------------- /src/include/rados/page.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_PAGE_H 2 | #define CEPH_PAGE_H 3 | 4 | namespace ceph { 5 | // these are in common/page.cc 6 | extern unsigned _page_size; 7 | extern unsigned long _page_mask; 8 | extern unsigned _page_shift; 9 | } 10 | 11 | #endif 12 | 13 | 14 | #define CEPH_PAGE_SIZE ceph::_page_size 15 | #define CEPH_PAGE_MASK ceph::_page_mask 16 | #define CEPH_PAGE_SHIFT ceph::_page_shift 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/include/ceph_frag.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * Ceph 'frag' type 3 | */ 4 | #include "types.h" 5 | 6 | int ceph_frag_compare(__u32 a, __u32 b) 7 | { 8 | unsigned va = ceph_frag_value(a); 9 | unsigned vb = ceph_frag_value(b); 10 | if (va < vb) 11 | return -1; 12 | if (va > vb) 13 | return 1; 14 | va = ceph_frag_bits(a); 15 | vb = ceph_frag_bits(b); 16 | if (va < vb) 17 | return -1; 18 | if (va > vb) 19 | return 1; 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /src/test/cli/ceph-conf/env-vs-args.t: -------------------------------------------------------------------------------- 1 | # we can use CEPH_CONF to override the normal configuration file location. 2 | $ env CEPH_CONF=from-env ceph-conf -s foo bar 3 | .* \-1 did not load config file, using default settings. (re) 4 | [1] 5 | 6 | # command-line arguments should override environment 7 | $ env -u CEPH_CONF ceph-conf -c from-args 8 | global_init: unable to open config file from search list from-args 9 | [1] 10 | 11 | -------------------------------------------------------------------------------- /src/test/test_libcommon_build.cc: -------------------------------------------------------------------------------- 1 | #include "common/common_init.h" 2 | 3 | /* This program exists to test that we can build libcommon without 4 | * referencing g_ceph_context 5 | * 6 | * This program will go away as soon as we actually don't use g_ceph_context in 7 | * more programs. Obviously, at that point, those programs will provide an 8 | * equivalent test. 9 | */ 10 | int main(int argc, char **argv) 11 | { 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /src/common/page.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace ceph { 4 | 5 | // page size crap, see page.h 6 | int _get_bits_of(int v) { 7 | int n = 0; 8 | while (v) { 9 | n++; 10 | v = v >> 1; 11 | } 12 | return n; 13 | } 14 | 15 | unsigned _page_size = sysconf(_SC_PAGESIZE); 16 | unsigned long _page_mask = ~(unsigned long)(_page_size - 1); 17 | unsigned _page_shift = _get_bits_of(_page_size); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/test/cli/ceph-authtool/cap-invalid.t: -------------------------------------------------------------------------------- 1 | $ ceph-authtool kring --create-keyring --gen-key 2 | creating kring 3 | 4 | # TODO is this nice? 5 | $ ceph-authtool --cap osd 'broken' kring 6 | $ ceph-authtool kring --list|grep -P '^\tcaps ' 7 | \tcaps osd = "broken" (esc) 8 | 9 | # TODO is this nice? 10 | $ ceph-authtool --cap xyzzy 'broken' kring 11 | $ ceph-authtool kring --list|grep -P '^\tcaps ' 12 | \tcaps xyzzy = "broken" (esc) 13 | -------------------------------------------------------------------------------- /src/test/cli/crushtool/reweight.t: -------------------------------------------------------------------------------- 1 | $ crushtool -c "$TESTDIR/multitype.before" -o mt > /dev/null 2 | $ crushtool -i mt --reweight-item osd0 2.0 -o mt > /dev/null 3 | $ crushtool -i mt --reweight-item osd3 2.0 -o mt > /dev/null 4 | $ crushtool -i mt --reweight-item osd6 2.0 -o mt > /dev/null 5 | $ crushtool -i mt --reweight-item osd7 .5 -o mt > /dev/null 6 | $ crushtool -d mt -o final 7 | $ diff final "$TESTDIR/multitype.after" 8 | $ rm mt final 9 | -------------------------------------------------------------------------------- /src/test/cli/osdmaptool/help.t: -------------------------------------------------------------------------------- 1 | # TODO be user-friendly 2 | $ osdmaptool --help 3 | usage: [--print] [--createsimple [--clobber] [--pg_bits ]] 4 | --export-crush write osdmap's crush map to 5 | --import-crush replace osdmap's crush map with 6 | --test-map-pg map a pgid to osds 7 | --test-map-object [--pool ] map an object to osds 8 | [1] 9 | -------------------------------------------------------------------------------- /src/test/run-cli-tests-maybe-unset-ccache: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # ccache breaks if it sees CCACHE_DIR="", yet due to clumsiness of 5 | # /usr/bin/env, it's hard to avoid setting env vars for the parent; 6 | # unset them if they're empty 7 | 8 | if [ -z "$CCACHE_DIR" ]; then 9 | unset CCACHE_DIR 10 | fi 11 | 12 | if [ -z "$CC" ]; then 13 | unset CC 14 | fi 15 | 16 | if [ -z "$CXX" ]; then 17 | unset CXX 18 | fi 19 | 20 | exec "$@" 21 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Ceph core 2 | --------- 3 | 4 | Sage Weil 5 | Yehuda Sadeh-Weinraub 6 | Greg Farnum 7 | 8 | Kernel client 9 | ------------- 10 | 11 | Sage Weil 12 | Patience Warnick 13 | Yehuda Sadeh-Weinraub 14 | Greg Farnum 15 | 16 | Contributors 17 | ------------ 18 | 19 | Loic Dachary 20 | -------------------------------------------------------------------------------- /src/check_version: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | dname=`dirname $0` 4 | 5 | if [ ! -d $dname/../.git ]; then 6 | echo "not updating .git_version (no $dname/../.git)" 7 | exit 0 8 | fi 9 | 10 | cur=`cd $dname && git rev-parse HEAD 2>/dev/null; git describe 2>/dev/null` 11 | [ -e $1 ] && old=`cat $1` 12 | 13 | if [ "$cur" != "$old" ]; then 14 | echo regenerating $1 with $cur 15 | echo "$cur" > $1 16 | else 17 | echo $1 is up to date. 18 | fi 19 | 20 | -------------------------------------------------------------------------------- /src/cls/version/cls_version_types.cc: -------------------------------------------------------------------------------- 1 | 2 | #include "cls/version/cls_version_types.h" 3 | #include "common/Formatter.h" 4 | #include "common/ceph_json.h" 5 | 6 | 7 | void obj_version::dump(Formatter *f) const 8 | { 9 | f->dump_int("ver", ver); 10 | f->dump_string("tag", tag); 11 | } 12 | 13 | void obj_version::decode_json(JSONObj *obj) 14 | { 15 | JSONDecoder::decode_json("ver", ver, obj); 16 | JSONDecoder::decode_json("tag", tag, obj); 17 | } 18 | 19 | -------------------------------------------------------------------------------- /src/test/cli/osdmaptool/simple.t: -------------------------------------------------------------------------------- 1 | $ osdmaptool 2 | osdmaptool: must specify osdmap filename 3 | usage: [--print] [--createsimple [--clobber] [--pg_bits ]] 4 | --export-crush write osdmap's crush map to 5 | --import-crush replace osdmap's crush map with 6 | --test-map-pg map a pgid to osds 7 | --test-map-object [--pool ] map an object to osds 8 | [1] 9 | -------------------------------------------------------------------------------- /src/client/Dir.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_CLIENT_DIR_H 2 | #define CEPH_CLIENT_DIR_H 3 | 4 | class Inode; 5 | 6 | class Dir { 7 | public: 8 | Inode *parent_inode; // my inode 9 | hash_map dentries; 10 | map dentry_map; 11 | uint64_t release_count; 12 | uint64_t max_offset; 13 | 14 | Dir(Inode* in) : release_count(0), max_offset(2) { parent_inode = in; } 15 | 16 | bool is_empty() { return dentries.empty(); } 17 | }; 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/fetch_config: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | conf="$1" 3 | 4 | ## fetch ceph.conf from some remote location and save it to $conf. 5 | ## 6 | ## make sure this script is executable (chmod +x fetch_config) 7 | 8 | ## 9 | ## examples: 10 | ## 11 | 12 | ## from a locally accessible file 13 | # cp /path/to/ceph.conf $conf 14 | 15 | ## from a URL: 16 | # wget -q -O $conf http://somewhere.com/some/ceph.conf 17 | 18 | ## via scp 19 | # scp -i /path/to/id_dsa user@host:/path/to/ceph.conf $conf 20 | 21 | -------------------------------------------------------------------------------- /src/rgw/rgw_fcgi.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_RGW_FCGI_H 2 | #define CEPH_RGW_FCGI_H 3 | 4 | #include "rgw_client_io.h" 5 | 6 | 7 | struct FCGX_Request; 8 | 9 | 10 | class RGWFCGX : public RGWClientIO 11 | { 12 | FCGX_Request *fcgx; 13 | protected: 14 | int write_data(const char *buf, int len); 15 | int read_data(char *buf, int len); 16 | 17 | public: 18 | RGWFCGX(FCGX_Request *_fcgx) : fcgx(_fcgx) {} 19 | void flush(); 20 | const char **envp(); 21 | }; 22 | 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/test/cli/ceph-authtool/cap-overwrite.t: -------------------------------------------------------------------------------- 1 | $ ceph-authtool kring --create-keyring --gen-key 2 | creating kring 3 | 4 | $ ceph-authtool --cap osd 'allow rx pool=swimming' kring 5 | $ ceph-authtool kring --list|grep -P '^\tcaps ' 6 | \tcaps osd = "allow rx pool=swimming" (esc) 7 | 8 | # TODO it seems --cap overwrites all previous caps; is this wanted? 9 | $ ceph-authtool --cap mds 'allow' kring 10 | $ ceph-authtool kring --list|grep -P '^\tcaps ' 11 | \tcaps mds = "allow" (esc) 12 | -------------------------------------------------------------------------------- /src/json_spirit/json_spirit.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_SPIRIT 2 | #define JSON_SPIRIT 3 | 4 | // Copyright John W. Wilkinson 2007 - 2011 5 | // Distributed under the MIT License, see accompanying file LICENSE.txt 6 | 7 | // json spirit version 4.05 8 | 9 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) 10 | # pragma once 11 | #endif 12 | 13 | #include "json_spirit_value.h" 14 | #include "json_spirit_reader.h" 15 | #include "json_spirit_writer.h" 16 | #include "json_spirit_utils.h" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/test/cli/ceph-authtool/create-gen-list-bin.t: -------------------------------------------------------------------------------- 1 | $ ceph-authtool kring --create-keyring 2 | creating kring 3 | 4 | $ ceph-authtool kring --list 5 | 6 | $ ceph-authtool kring --gen-key 7 | 8 | # cram makes matching escape-containing lines with regexps a bit ugly 9 | $ ceph-authtool kring --list 10 | [client.admin] 11 | \\tkey = [a-zA-Z0-9+/]+=* \(esc\) (re) 12 | 13 | # synonym 14 | $ ceph-authtool kring -l 15 | [client.admin] 16 | \\tkey = [a-zA-Z0-9+/]+=* \(esc\) (re) 17 | 18 | -------------------------------------------------------------------------------- /src/include/ceph_hash.h: -------------------------------------------------------------------------------- 1 | #ifndef FS_CEPH_HASH_H 2 | #define FS_CEPH_HASH_H 3 | 4 | #define CEPH_STR_HASH_LINUX 0x1 /* linux dcache hash */ 5 | #define CEPH_STR_HASH_RJENKINS 0x2 /* robert jenkins' */ 6 | 7 | extern unsigned ceph_str_hash_linux(const char *s, unsigned len); 8 | extern unsigned ceph_str_hash_rjenkins(const char *s, unsigned len); 9 | 10 | extern unsigned ceph_str_hash(int type, const char *s, unsigned len); 11 | extern const char *ceph_str_hash_name(int type); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | check_for_pkg_config() { 4 | which pkg-config >/dev/null && return 5 | 6 | echo 7 | echo "Error: could not find pkg-config" 8 | echo 9 | echo "Please make sure you have pkg-config installed." 10 | echo 11 | exit 1 12 | } 13 | 14 | rm -f config.cache 15 | aclocal -I m4 --install 16 | check_for_pkg_config 17 | libtoolize --force --copy 18 | autoconf 19 | autoheader 20 | automake -a --add-missing -Wall 21 | ( cd src/gtest && autoreconf -fvi; ) 22 | exit 23 | -------------------------------------------------------------------------------- /src/rgw/rgw_resolve.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_RGW_RESOLVE_H 2 | #define CEPH_RGW_RESOLVE_H 3 | 4 | #include "rgw_common.h" 5 | 6 | class RGWDNSResolver; 7 | 8 | class RGWResolver { 9 | RGWDNSResolver *resolver; 10 | 11 | public: 12 | ~RGWResolver(); 13 | RGWResolver(); 14 | int resolve_cname(const string& hostname, string& cname, bool *found); 15 | }; 16 | 17 | 18 | extern void rgw_init_resolver(void); 19 | extern void rgw_shutdown_resolver(void); 20 | extern RGWResolver *rgw_resolver; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Installation Instructions 2 | ************************* 3 | 4 | If pulling from git, you first need to build the configure script with 5 | 6 | $ ./autogen.sh 7 | 8 | Then, 9 | 10 | $ ./configure 11 | $ make 12 | 13 | Note that if the FUSE library is not found, the user-space fuse client 14 | will not be built. 15 | 16 | If you are doing development, you may want to do 17 | 18 | $ CXXFLAGS="-g -pg" ./configure 19 | 20 | or similar to avoid the default (-g -O2), which includes optimizations 21 | (-O2). 22 | -------------------------------------------------------------------------------- /src/ceph-coverage.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | export GCOV_PREFIX_STRIP=@@GCOV_PREFIX_STRIP@@ 5 | 6 | usage () { 7 | printf '%s: usage: %s OUTPUTDIR COMMAND [ARGS..]\n' "$(basename "$0")" "$(basename "$0")" 1>&2 8 | exit 1 9 | } 10 | 11 | export GCOV_PREFIX="$1" 12 | [ -n "$GCOV_PREFIX" ] || usage 13 | shift 14 | 15 | case "$GCOV_PREFIX" in 16 | /*) 17 | # absolute path -> ok 18 | ;; 19 | *) 20 | # make it absolute 21 | GCOV_PREFIX="$PWD/$GCOV_PREFIX" 22 | ;; 23 | esac 24 | 25 | exec "$@" 26 | -------------------------------------------------------------------------------- /src/common/armor.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_ARMOR_H 2 | #define CEPH_ARMOR_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | int ceph_armor(char *dst, const char *dst_end, 9 | const char *src, const char *end); 10 | 11 | int ceph_armor_linebreak(char *dst, const char *dst_end, 12 | const char *src, const char *end, 13 | int line_width); 14 | int ceph_unarmor(char *dst, const char *dst_end, 15 | const char *src, const char *end); 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/crush/mapper.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_CRUSH_MAPPER_H 2 | #define CEPH_CRUSH_MAPPER_H 3 | 4 | /* 5 | * CRUSH functions for find rules and then mapping an input to an 6 | * output set. 7 | * 8 | * LGPL2 9 | */ 10 | 11 | #include "crush.h" 12 | 13 | extern int crush_find_rule(const struct crush_map *map, int ruleset, int type, int size); 14 | extern int crush_do_rule(const struct crush_map *map, 15 | int ruleno, 16 | int x, int *result, int result_max, 17 | const __u32 *weights, int weight_max); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/test/cli/ceph-conf/invalid-args.t: -------------------------------------------------------------------------------- 1 | $ cat >test.conf < [bar] 3 | > bar = green 4 | > EOF 5 | 6 | # TODO output an error 7 | $ ceph-conf -c test.conf broken 8 | [1] 9 | 10 | $ ceph-conf -c test.conf --name total.garbage 11 | error parsing 'total.garbage': expected string of the form TYPE.ID, valid types are: auth, mon, osd, mds, client 12 | [1] 13 | 14 | $ ceph-conf -c test.conf -s bar 15 | You must give an action, such as --lookup or --list-all-sections. 16 | Pass --help for more help. 17 | [1] 18 | -------------------------------------------------------------------------------- /src/libs3/debian/control: -------------------------------------------------------------------------------- 1 | Package: libs3 2 | Source: THIS LINE WILL BE REMOVED, dpkg-shlibdepends NEEDS IT 3 | Version: LIBS3_VERSION 4 | Architecture: DEBIAN_ARCHITECTURE 5 | Section: net 6 | Priority: extra 7 | Maintainer: Bryan Ischo 8 | Homepage: http://libs3.ischo.com/index.html 9 | Description: C Library and Tools for Amazon S3 Access 10 | This package includes the libs3 shared object library, needed to run 11 | applications compiled against libs3, and additionally contains the s3 12 | utility for accessing Amazon S3. 13 | -------------------------------------------------------------------------------- /src/librados/snap_set_diff.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | 4 | #ifndef __CEPH_OSDC_SNAP_SET_DIFF_H 5 | #define __CEPH_OSDC_SNAP_SET_DIFF_H 6 | 7 | class CephContext; 8 | #include "include/rados/rados_types.hpp" 9 | #include "include/interval_set.h" 10 | 11 | void calc_snap_set_diff(CephContext *cct, 12 | const librados::snap_set_t& snap_set, 13 | librados::snap_t start, librados::snap_t end, 14 | interval_set *diff, 15 | bool *end_exists); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/test/cli/crushtool/compile-decompile-recompile.t: -------------------------------------------------------------------------------- 1 | $ cp "$TESTDIR/need_tree_order.crush" . 2 | $ crushtool -c need_tree_order.crush -o nto.compiled 3 | $ crushtool -d nto.compiled -o nto.conf 4 | $ crushtool -c nto.conf -o nto.recompiled 5 | 6 | # as the input file is actually exactly what decompilation will spit 7 | # back out, comments and all, and the compiled format is completely 8 | # deterministic, we can compare the files to make sure everything 9 | # worked 10 | $ cmp need_tree_order.crush nto.conf 11 | $ cmp nto.compiled nto.recompiled 12 | -------------------------------------------------------------------------------- /src/test/cli/ceph-authtool/create-gen-list.t: -------------------------------------------------------------------------------- 1 | $ ceph-authtool kring --create-keyring 2 | creating kring 3 | 4 | $ ceph-authtool kring --list 5 | 6 | $ ceph-authtool kring --gen-key 7 | 8 | # cram makes matching escape-containing lines with regexps a bit ugly 9 | $ ceph-authtool kring --list 10 | [client.admin] 11 | \\tkey = [a-zA-Z0-9+/]+=* \(esc\) (re) 12 | 13 | # synonym 14 | $ ceph-authtool kring -l 15 | [client.admin] 16 | \\tkey = [a-zA-Z0-9+/]+=* \(esc\) (re) 17 | 18 | $ cat kring 19 | [client.admin] 20 | \\tkey = [a-zA-Z0-9+/]+=* \(esc\) (re) 21 | -------------------------------------------------------------------------------- /man/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = gnu 2 | 3 | dist_man_MANS = \ 4 | ceph-osd.8 \ 5 | ceph-mds.8 \ 6 | ceph-mon.8 \ 7 | mkcephfs.8 \ 8 | ceph-fuse.8 \ 9 | ceph-syn.8 \ 10 | crushtool.8 \ 11 | osdmaptool.8 \ 12 | monmaptool.8 \ 13 | ceph-conf.8 \ 14 | ceph-run.8 \ 15 | ceph.8 \ 16 | mount.ceph.8 \ 17 | radosgw.8 \ 18 | radosgw-admin.8 \ 19 | ceph-authtool.8 \ 20 | rados.8 \ 21 | librados-config.8 \ 22 | rbd.8 \ 23 | ceph-clsinfo.8 \ 24 | ceph-debugpack.8 \ 25 | cephfs.8 \ 26 | ceph-dencoder.8 \ 27 | ceph-rest-api.8 \ 28 | ceph-rbdnamer.8 \ 29 | ceph-post-file.8 \ 30 | rbd-fuse.8 31 | -------------------------------------------------------------------------------- /src/crush/hash.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_CRUSH_HASH_H 2 | #define CEPH_CRUSH_HASH_H 3 | 4 | #define CRUSH_HASH_RJENKINS1 0 5 | 6 | #define CRUSH_HASH_DEFAULT CRUSH_HASH_RJENKINS1 7 | 8 | extern const char *crush_hash_name(int type); 9 | 10 | extern __u32 crush_hash32(int type, __u32 a); 11 | extern __u32 crush_hash32_2(int type, __u32 a, __u32 b); 12 | extern __u32 crush_hash32_3(int type, __u32 a, __u32 b, __u32 c); 13 | extern __u32 crush_hash32_4(int type, __u32 a, __u32 b, __u32 c, __u32 d); 14 | extern __u32 crush_hash32_5(int type, __u32 a, __u32 b, __u32 c, __u32 d, 15 | __u32 e); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/rgw/rgw_fcgi.cc: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "rgw_fcgi.h" 4 | 5 | #include "acconfig.h" 6 | #ifdef FASTCGI_INCLUDE_DIR 7 | # include "fastcgi/fcgiapp.h" 8 | #else 9 | # include "fcgiapp.h" 10 | #endif 11 | 12 | 13 | int RGWFCGX::write_data(const char *buf, int len) 14 | { 15 | return FCGX_PutStr(buf, len, fcgx->out); 16 | } 17 | 18 | int RGWFCGX::read_data(char *buf, int len) 19 | { 20 | return FCGX_GetStr(buf, len, fcgx->in); 21 | } 22 | 23 | void RGWFCGX::flush() 24 | { 25 | FCGX_FFlush(fcgx->out); 26 | } 27 | 28 | const char **RGWFCGX::envp() 29 | { 30 | return (const char **)fcgx->envp; 31 | } 32 | -------------------------------------------------------------------------------- /src/test/bench/backend.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | 3 | #ifndef BACKENDH 4 | #define BACKENDH 5 | 6 | #include "include/Context.h" 7 | 8 | class Backend { 9 | public: 10 | virtual void write( 11 | const string &oid, 12 | uint64_t offset, 13 | const bufferlist &bl, 14 | Context *on_applied, 15 | Context *on_commit) = 0; 16 | 17 | virtual void read( 18 | const string &oid, 19 | uint64_t offset, 20 | uint64_t length, 21 | bufferlist *bl, 22 | Context *on_complete) = 0; 23 | virtual ~Backend() {} 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/test/bench/stat_collector.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | 3 | #ifndef STATCOLLECTORH 4 | #define STATCOLLECTORH 5 | 6 | #include 7 | 8 | class StatCollector { 9 | public: 10 | virtual uint64_t next_seq() = 0; 11 | virtual void start_write(uint64_t seq, uint64_t size) = 0; 12 | virtual void start_read(uint64_t seq, uint64_t size) = 0; 13 | virtual void write_applied(uint64_t seq) = 0; 14 | virtual void write_committed(uint64_t seq) = 0; 15 | virtual void read_complete(uint64_t seq) = 0; 16 | virtual ~StatCollector() {} 17 | }; 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/test/cli/monmaptool/create-with-add.t: -------------------------------------------------------------------------------- 1 | $ monmaptool --create --add foo 2.3.4.5:6789 mymonmap 2 | monmaptool: monmap file mymonmap 3 | monmaptool: generated fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re) 4 | monmaptool: writing epoch 0 to mymonmap (1 monitors) 5 | 6 | $ monmaptool --print mymonmap 7 | monmaptool: monmap file mymonmap 8 | epoch 0 9 | fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re) 10 | last_changed \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re) 11 | created \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re) 12 | 0: 2.3.4.5:6789/0 mon.foo 13 | -------------------------------------------------------------------------------- /src/common/fd.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2012 Inktank 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_COMMON_FD_H 16 | #define CEPH_COMMON_FD_H 17 | 18 | class CephContext; 19 | 20 | void dump_open_fds(CephContext *cct); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/upstart/radosgw-all-starter.conf: -------------------------------------------------------------------------------- 1 | description "Ceph radosgw (task to start all instances)" 2 | 3 | start on starting radosgw-all 4 | 5 | task 6 | 7 | script 8 | set -e 9 | # TODO what's the valid charset for cluster names and daemon ids? 10 | find -L /var/lib/ceph/radosgw/ -mindepth 1 -maxdepth 1 -regextype posix-egrep -regex '.*/[A-Za-z0-9]+-[A-Za-z0-9._-]+' -printf '%P\n' \ 11 | | while read f; do 12 | if [ -e "/var/lib/ceph/radosgw/$f/done" ]; then 13 | cluster="${f%%-*}" 14 | id="${f#*-}" 15 | initctl emit radosgw cluster="$cluster" id="$id" 16 | fi 17 | done 18 | end script 19 | -------------------------------------------------------------------------------- /src/test/cli/ceph-authtool/add-key.t: -------------------------------------------------------------------------------- 1 | $ ceph-authtool kring --create-keyring 2 | creating kring 3 | 4 | $ ceph-authtool kring --add-key 'AQAK7yxNeF+nHBAA0SgSdbs8IkJrxroDeJ6SwQ== 18446744073709551615' 5 | added entity client.admin auth auth(auid = 18446744073709551615 key=AQAK7yxNeF+nHBAA0SgSdbs8IkJrxroDeJ6SwQ== with 0 caps) 6 | 7 | # cram makes matching escape-containing lines with regexps a bit ugly 8 | $ ceph-authtool kring --list 9 | [client.admin] 10 | \tkey = AQAK7yxNeF+nHBAA0SgSdbs8IkJrxroDeJ6SwQ== (esc) 11 | 12 | $ cat kring 13 | [client.admin] 14 | \tkey = AQAK7yxNeF+nHBAA0SgSdbs8IkJrxroDeJ6SwQ== (esc) 15 | -------------------------------------------------------------------------------- /share/id_dsa_drop.ceph.com.pub: -------------------------------------------------------------------------------- 1 | ssh-dss AAAAB3NzaC1kc3MAAACBAO/wX9ZOhQM5zYdFZQ6q2rmKU5ET7k/nfJlSju6CvxcPfAzQftAgiX0X1+LPBS0vaCHefUGcHGY+GRVTpViyIOmfU/d1a9GZ/6PKo+6T5vXzkvQStvxCwTEAO/q/fdjJ372LmhMj3zxGbVVZjpCE/ud5brIw+3aeiLVPCV4ubrPbAAAAFQChy3Ik9ktMP3W0xUAxR0hDggIn9wAAAIAfA5h3xgQietwGtc8Um48VtAqvxx47f8i1jSv9b8v3addQlt2XUkS3Yp+R3BrGQGGVhPsTUlHkxGhM0FMQwIWMfF6ZkJ0f7Tf4nOr5EBDbynvumvNuo4Voy5m5CgaWozLeBiuGc9EYQkaOH6mSEx4+pQ8IIoW1Ge03OUeUOHi44AAAAIBLGpqu3Pthhd4fnawv8Md16gc/p1Vg/5vyAzi9Gshhgf1hXvFHdeJvAN/5mgE/Ekg7fqeNUhui9LYkuuOMgP267naGkAAgxV3bbiy439Vj8SzXdOQk4agAYgebWkmJrdMtUSzeBYBkqBZTZODvQwCmYdR6INuNuZtA+rHgKwiAHQ== public_ceph_post_key_2013-08-16 2 | -------------------------------------------------------------------------------- /src/include/ipaddr.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_IPADDR_H 2 | #define CEPH_IPADDR_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | /* 9 | Find an IP address that is in the wanted subnet. 10 | 11 | If there are multiple matches, the first one is returned; this order 12 | is system-dependent and should not be relied on. 13 | */ 14 | const struct sockaddr *find_ip_in_subnet(const struct ifaddrs *addrs, 15 | const struct sockaddr *net, 16 | unsigned int prefix_len); 17 | 18 | 19 | bool parse_network(const char *s, struct sockaddr *network, unsigned int *prefix_len); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/rgw/rgw_auth_s3.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_RGW_AUTH_S3_H 2 | #define CEPH_RGW_AUTH_S3_H 3 | 4 | 5 | #include "rgw_common.h" 6 | 7 | void rgw_create_s3_canonical_header(const char *method, const char *content_md5, const char *content_type, const char *date, 8 | map& meta_map, const char *request_uri, map& sub_resources, 9 | string& dest_str); 10 | bool rgw_create_s3_canonical_header(req_info& info, utime_t *header_time, string& dest, bool qsr); 11 | int rgw_get_s3_header_digest(const string& auth_hdr, const string& key, string& dest); 12 | 13 | 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /src/include/err.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_ERR_H 2 | #define CEPH_ERR_H 3 | 4 | /* 5 | * adapted from linux 2.6.24 include/linux/err.h 6 | */ 7 | #define MAX_ERRNO 4095 8 | #define IS_ERR_VALUE(x) ((x) >= (unsigned long)-MAX_ERRNO) 9 | 10 | #include 11 | 12 | /* this generates a warning in c++; caller can do the cast manually 13 | static inline void *ERR_PTR(long error) 14 | { 15 | return (void *) error; 16 | } 17 | */ 18 | 19 | static inline long PTR_ERR(const void *ptr) 20 | { 21 | return (long) ptr; 22 | } 23 | 24 | static inline long IS_ERR(const void *ptr) 25 | { 26 | return IS_ERR_VALUE((unsigned long)ptr); 27 | } 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/common/SimpleRNG.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | 4 | #ifndef __CEPH_COMMON_SIMPLERNG_H_ 5 | #define __CEPH_COMMON_SIMPLERNG_H_ 6 | 7 | /* 8 | * rand() is not thread-safe. random_r family segfaults. 9 | * boost::random::* have build issues. 10 | */ 11 | class SimpleRNG { 12 | unsigned m_z, m_w; 13 | 14 | public: 15 | SimpleRNG(int seed) : m_z(seed), m_w(123) {} 16 | 17 | unsigned operator()() { 18 | m_z = 36969 * (m_z & 65535) + (m_z >> 16); 19 | m_w = 18000 * (m_w & 65535) + (m_w >> 16); 20 | return (m_z << 16) + m_w; 21 | } 22 | }; 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/ocf/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = ceph.in Makefile.in 2 | 3 | if WITH_OCF 4 | # The root of the OCF resource agent hierarchy 5 | # Per the OCF standard, it's always "lib", 6 | # not "lib64" (even on 64-bit platforms). 7 | ocfdir = $(prefix)/lib/ocf 8 | 9 | # The ceph provider directory 10 | radir = $(ocfdir)/resource.d/$(PACKAGE_NAME) 11 | 12 | ra_SCRIPTS = ceph rbd 13 | 14 | install-data-hook: 15 | $(LN_S) ceph $(DESTDIR)$(radir)/osd 16 | $(LN_S) ceph $(DESTDIR)$(radir)/mds 17 | $(LN_S) ceph $(DESTDIR)$(radir)/mon 18 | 19 | uninstall-hook: 20 | rm -f $(DESTDIR)$(radir)/osd 21 | rm -f $(DESTDIR)$(radir)/mds 22 | rm -f $(DESTDIR)$(radir)/mon 23 | endif 24 | -------------------------------------------------------------------------------- /src/gtest/xcode/Config/FrameworkTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // FrameworkTarget.xcconfig 3 | // 4 | // These are Framework target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Dynamic libs need to be position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Dynamic libs should not have their external symbols stripped. 14 | STRIP_STYLE = non-global 15 | 16 | // Let the user install by specifying the $DSTROOT with xcodebuild 17 | SKIP_INSTALL = NO 18 | -------------------------------------------------------------------------------- /src/libs3/mswin/libs3.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | S3_convert_acl 3 | S3_copy_object 4 | S3_create_bucket 5 | S3_create_request_context 6 | S3_deinitialize 7 | S3_delete_bucket 8 | S3_delete_object 9 | S3_destroy_request_context 10 | S3_generate_authenticated_query_string 11 | S3_get_acl 12 | S3_get_object 13 | S3_get_request_context_fdsets 14 | S3_get_server_access_logging 15 | S3_get_status_name 16 | S3_head_object 17 | S3_initialize 18 | S3_list_bucket 19 | S3_list_service 20 | S3_put_object 21 | S3_runall_request_context 22 | S3_runonce_request_context 23 | S3_set_acl 24 | S3_set_server_access_logging 25 | S3_status_is_retryable 26 | S3_test_bucket 27 | S3_validate_bucket_name 28 | -------------------------------------------------------------------------------- /src/rgw/rgw_usage.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_RGW_USAGE_H 2 | #define CEPH_RGW_USAGE_H 3 | 4 | #include 5 | #include 6 | 7 | #include "common/Formatter.h" 8 | #include "rgw_formats.h" 9 | 10 | class RGWRados; 11 | 12 | 13 | class RGWUsage 14 | { 15 | public: 16 | static int show(RGWRados *store, std::string& uid, uint64_t start_epoch, 17 | uint64_t end_epoch, bool show_log_entries, bool show_log_sum, 18 | std::map *categories, 19 | RGWFormatterFlusher& flusher); 20 | 21 | static int trim(RGWRados *store, std::string& uid, uint64_t start_epoch, 22 | uint64_t end_epoch); 23 | }; 24 | 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/common/environment.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_COMMON_ENVIRONMENT_H 16 | #define CEPH_COMMON_ENVIRONMENT_H 17 | 18 | extern bool get_env_bool(const char *key); 19 | extern int get_env_int(const char *key); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/common/secret.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_SECRET_H 2 | #define CEPH_SECRET_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | int read_secret_from_file(const char *filename, char *secret, size_t max_len); 9 | 10 | /* 11 | * Attempts to add the secret to the kernel, but falls back to 12 | * the old secret= option if the kernel is too old. 13 | */ 14 | int get_secret_option(const char *secret, const char *key_name, 15 | char *secret_option, size_t secret_option_len); 16 | 17 | int set_kernel_secret(const char *secret, const char *key_name); 18 | 19 | int is_kernel_secret(const char *key_name); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/include/addr_parsing.h: -------------------------------------------------------------------------------- 1 | /* 2 | * addr_parsing.h 3 | * 4 | * Created on: Sep 14, 2010 5 | * Author: gregf 6 | * contains functions used by Ceph to convert named addresses 7 | * (eg ceph.newdream.net) into IP addresses (ie 127.0.0.1). 8 | */ 9 | 10 | #ifndef ADDR_PARSING_H_ 11 | #define ADDR_PARSING_H_ 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | int safe_cat(char **pstr, int *plen, int pos, const char *str2); 18 | 19 | /* 20 | * returns a string allocated by malloc; caller must free 21 | */ 22 | char *resolve_addrs(const char *orig_str); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | 28 | #endif /* ADDR_PARSING_H_ */ 29 | -------------------------------------------------------------------------------- /src/test/run_cmd.cc: -------------------------------------------------------------------------------- 1 | #include "common/config.h" 2 | #include "common/run_cmd.h" 3 | 4 | #include "gtest/gtest.h" 5 | 6 | #include 7 | #include 8 | 9 | TEST(RunCommand, StringSimple) 10 | { 11 | char temp_file_name[] = "run_cmd_temp_file_XXXXXX"; 12 | 13 | int fd = ::mkstemp(temp_file_name); 14 | ASSERT_GE(fd, 0); 15 | ::close(fd); 16 | 17 | std::string ret = run_cmd("touch", temp_file_name, (char*)NULL); 18 | ASSERT_EQ(ret, ""); 19 | 20 | ASSERT_EQ(access(temp_file_name, R_OK), 0); 21 | 22 | ret = run_cmd("rm", "-f", temp_file_name, (char*)NULL); 23 | ASSERT_EQ(ret, ""); 24 | 25 | ASSERT_NE(access(temp_file_name, R_OK), 0); 26 | } 27 | -------------------------------------------------------------------------------- /src/include/compat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Ceph - scalable distributed file system 3 | * 4 | * Copyright (C) 2011 Stanislav Sedov 5 | * 6 | * This is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License version 2.1, as published by the Free Software 9 | * Foundation. See file COPYING. 10 | */ 11 | 12 | #ifndef CEPH_COMPAT_H 13 | #define CEPH_COMPAT_H 14 | 15 | #if defined(__FreeBSD__) 16 | #define lseek64(fd, offset, whence) lseek(fd, offset, whence) 17 | #define ENODATA 61 18 | #define TEMP_FAILURE_RETRY 19 | #define MSG_MORE 0 20 | #endif /* !__FreeBSD__ */ 21 | 22 | #endif /* !CEPH_COMPAT_H */ 23 | -------------------------------------------------------------------------------- /src/include/util.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2012 Inktank Storage, Inc. 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | */ 13 | 14 | // is buf~len completely zero (in 8-byte chunks) 15 | 16 | #include "include/types.h" 17 | 18 | bool buf_is_zero(const char *buf, size_t len); 19 | 20 | int64_t unit_to_bytesize(string val, ostream *pss); 21 | -------------------------------------------------------------------------------- /src/upstart/ceph-mds-all-starter.conf: -------------------------------------------------------------------------------- 1 | description "Ceph MDS (start all instances)" 2 | 3 | start on starting ceph-mds-all 4 | 5 | task 6 | 7 | script 8 | set -e 9 | # TODO what's the valid charset for cluster names and mds ids? 10 | find -L /var/lib/ceph/mds/ -mindepth 1 -maxdepth 1 -regextype posix-egrep -regex '.*/[A-Za-z0-9]+-[A-Za-z0-9._-]+' -printf '%P\n' \ 11 | | while read f; do 12 | if [ -e "/var/lib/ceph/mds/$f/done" ] && [ -e "/var/lib/ceph/mds/$f/upstart" ] && [ ! -e "/var/lib/ceph/mds/$f/sysvinit" ]; then 13 | cluster="${f%%-*}" 14 | id="${f#*-}" 15 | initctl emit ceph-mds cluster="$cluster" id="$id" 16 | fi 17 | done 18 | end script 19 | -------------------------------------------------------------------------------- /src/upstart/ceph-mon-all-starter.conf: -------------------------------------------------------------------------------- 1 | description "Ceph MON (start all instances)" 2 | 3 | start on starting ceph-mon-all 4 | 5 | task 6 | 7 | script 8 | set -e 9 | # TODO what's the valid charset for cluster names and mon ids? 10 | find -L /var/lib/ceph/mon/ -mindepth 1 -maxdepth 1 -regextype posix-egrep -regex '.*/[A-Za-z0-9]+-[A-Za-z0-9._-]+' -printf '%P\n' \ 11 | | while read f; do 12 | if [ -e "/var/lib/ceph/mon/$f/done" ] && [ -e "/var/lib/ceph/mon/$f/upstart" ] && [ ! -e "/var/lib/ceph/mon/$f/sysvinit" ]; then 13 | cluster="${f%%-*}" 14 | id="${f#*-}" 15 | 16 | initctl emit ceph-mon cluster="$cluster" id="$id" 17 | fi 18 | done 19 | end script 20 | -------------------------------------------------------------------------------- /src/upstart/ceph-mds.conf: -------------------------------------------------------------------------------- 1 | description "Ceph MDS" 2 | 3 | start on ceph-mds 4 | stop on runlevel [!2345] or stopping ceph-mds-all 5 | 6 | respawn 7 | respawn limit 5 30 8 | 9 | limit nofile 16384 16384 10 | 11 | pre-start script 12 | set -e 13 | test -x /usr/bin/ceph-mds || { stop; exit 0; } 14 | test -d "/var/lib/ceph/mds/${cluster:-ceph}-$id" || { stop; exit 0; } 15 | 16 | install -d -m0755 /var/run/ceph 17 | end script 18 | 19 | instance ${cluster:-ceph}/$id 20 | export cluster 21 | export id 22 | 23 | # this breaks oneiric 24 | #usage "cluster = name of cluster (defaults to 'ceph'); id = mds instance id" 25 | 26 | exec /usr/bin/ceph-mds --cluster="${cluster:-ceph}" -i "$id" -f 27 | -------------------------------------------------------------------------------- /src/common/likely.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2010 Dreamhost 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_LIKELY_DOT_H 16 | #define CEPH_LIKELY_DOT_H 17 | 18 | /* 19 | * Likely / Unlikely macros 20 | */ 21 | #define likely(x) __builtin_expect((x),1) 22 | #define unlikely(x) __builtin_expect((x),0) 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/gtest/xcode/Config/StaticLibraryTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // StaticLibraryTarget.xcconfig 3 | // 4 | // These are static library target settings for libgtest.a. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Static libs can be included in bundles so make them position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Static libs should not have their internal globals or external symbols 14 | // stripped. 15 | STRIP_STYLE = debugging 16 | 17 | // Let the user install by specifying the $DSTROOT with xcodebuild 18 | SKIP_INSTALL = NO 19 | -------------------------------------------------------------------------------- /src/rgw/rgw_rest_usage.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_RGW_REST_USAGE_H 2 | #define CEPH_RGW_REST_USAGE_H 3 | 4 | #include "rgw_rest.h" 5 | #include "rgw_rest_s3.h" 6 | 7 | 8 | class RGWHandler_Usage : public RGWHandler_Auth_S3 { 9 | protected: 10 | RGWOp *op_get(); 11 | RGWOp *op_delete(); 12 | public: 13 | RGWHandler_Usage() {} 14 | virtual ~RGWHandler_Usage() {} 15 | 16 | int read_permissions(RGWOp*) { 17 | return 0; 18 | } 19 | }; 20 | 21 | class RGWRESTMgr_Usage : public RGWRESTMgr { 22 | public: 23 | RGWRESTMgr_Usage() {} 24 | virtual ~RGWRESTMgr_Usage() {} 25 | 26 | RGWHandler *get_handler(struct req_state *s) { 27 | return new RGWHandler_Usage; 28 | } 29 | }; 30 | 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/upstart/radosgw.conf: -------------------------------------------------------------------------------- 1 | description "Ceph radosgw" 2 | 3 | start on radosgw 4 | stop on runlevel [!2345] or stopping radosgw-all 5 | 6 | respawn 7 | respawn limit 5 30 8 | 9 | limit nofile 8096 65536 10 | 11 | pre-start script 12 | set -e 13 | test -x /usr/bin/radosgw || { stop; exit 0; } 14 | test -d "/var/lib/ceph/radosgw/${cluster:-ceph}-$id" || { stop; exit 0; } 15 | 16 | install -d -m0755 /var/run/ceph 17 | end script 18 | 19 | instance ${cluster:-ceph}/$id 20 | export cluster 21 | export id 22 | 23 | # this breaks oneiric 24 | #usage "cluster = name of cluster (defaults to 'ceph'); id = mds instance id" 25 | 26 | exec /usr/bin/radosgw --cluster="${cluster:-ceph}" --id "$id" -f 27 | -------------------------------------------------------------------------------- /src/common/BackTrace.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_BACKTRACE_H 2 | #define CEPH_BACKTRACE_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace ceph { 9 | 10 | struct BackTrace { 11 | const static int max = 100; 12 | 13 | int skip; 14 | void *array[max]; 15 | size_t size; 16 | char **strings; 17 | 18 | BackTrace(int s) : skip(s) { 19 | size = backtrace(array, max); 20 | strings = backtrace_symbols(array, size); 21 | } 22 | ~BackTrace() { 23 | free(strings); 24 | } 25 | 26 | BackTrace(const BackTrace& other); 27 | const BackTrace& operator=(const BackTrace& other); 28 | 29 | void print(std::ostream& out); 30 | }; 31 | 32 | } 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/common/RefCountedObj.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2006 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #include "common/RefCountedObj.h" 16 | 17 | void intrusive_ptr_add_ref(RefCountedObject *p) { 18 | p->get(); 19 | } 20 | void intrusive_ptr_release(RefCountedObject *p) { 21 | p->put(); 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/global/global_context.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #include "common/ceph_context.h" 16 | #include "global/global_context.h" 17 | 18 | /* 19 | * Global variables for use from process context. 20 | */ 21 | CephContext *g_ceph_context = NULL; 22 | md_config_t *g_conf = NULL; 23 | -------------------------------------------------------------------------------- /src/include/rados/rados_types.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_RADOS_TYPES_HPP 2 | #define CEPH_RADOS_TYPES_HPP 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace librados { 9 | 10 | typedef uint64_t snap_t; 11 | 12 | enum { 13 | SNAP_HEAD = (uint64_t)(-2), 14 | SNAP_DIR = (uint64_t)(-1) 15 | }; 16 | 17 | struct clone_info_t { 18 | snap_t cloneid; 19 | std::vector snaps; // ascending 20 | std::vector< std::pair > overlap; // with next newest 21 | uint64_t size; 22 | }; 23 | 24 | struct snap_set_t { 25 | std::vector clones; // ascending 26 | snap_t seq; // newest snapid seen by the object 27 | }; 28 | 29 | } 30 | #endif 31 | -------------------------------------------------------------------------------- /src/libs3/ChangeLog: -------------------------------------------------------------------------------- 1 | Thu Sep 18 10:03:02 NZST 2008 bryan@ischo.com 2 | * This file is no longer maintained, sorry 3 | 4 | Sat Aug 9 13:44:21 NZST 2008 bryan@ischo.com 5 | * Fixed bug wherein keys with non-URI-safe characters did not work 6 | correctly because they were not being URI-encoded in the request UR 7 | * Split RPM and DEB packages into normal and devel packages 8 | 9 | Fri Aug 8 22:40:19 NZST 2008 bryan@ischo.com 10 | * Branched 0.4 11 | * Created RPM and Debian packaging 12 | 13 | Tue Aug 5 08:52:33 NZST 2008 bryan@ischo.com 14 | * Bumped version number to 0.3 15 | * Moved Makefile to GNUmakefile, added shared library build 16 | * Added a bunch of GNU standard files (README, INSTALL, ChangeLog, etc) 17 | -------------------------------------------------------------------------------- /share/id_dsa_drop.ceph.com: -------------------------------------------------------------------------------- 1 | -----BEGIN DSA PRIVATE KEY----- 2 | MIIBugIBAAKBgQDv8F/WToUDOc2HRWUOqtq5ilORE+5P53yZUo7ugr8XD3wM0H7Q 3 | IIl9F9fizwUtL2gh3n1BnBxmPhkVU6VYsiDpn1P3dWvRmf+jyqPuk+b185L0Erb8 4 | QsExADv6v33Yyd+9i5oTI988Rm1VWY6QhP7neW6yMPt2noi1TwleLm6z2wIVAKHL 5 | ciT2S0w/dbTFQDFHSEOCAif3AoGAHwOYd8YEInrcBrXPFJuPFbQKr8ceO3/ItY0r 6 | /W/L92nXUJbdl1JEt2KfkdwaxkBhlYT7E1JR5MRoTNBTEMCFjHxemZCdH+03+Jzq 7 | +RAQ28p77przbqOFaMuZuQoGlqMy3gYrhnPRGEJGjh+pkhMePqUPCCKFtRntNzlH 8 | lDh4uOACgYBLGpqu3Pthhd4fnawv8Md16gc/p1Vg/5vyAzi9Gshhgf1hXvFHdeJv 9 | AN/5mgE/Ekg7fqeNUhui9LYkuuOMgP267naGkAAgxV3bbiy439Vj8SzXdOQk4agA 10 | YgebWkmJrdMtUSzeBYBkqBZTZODvQwCmYdR6INuNuZtA+rHgKwiAHQIUZak7aJD8 11 | y4kap9GmduDYmp6/JxU= 12 | -----END DSA PRIVATE KEY----- 13 | -------------------------------------------------------------------------------- /src/include/inttypes.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_INTTYPES_H 2 | #define CEPH_INTTYPES_H 3 | 4 | #include 5 | #if defined(__linux__) 6 | #include 7 | #elif defined(__FreeBSD__) 8 | #include 9 | typedef int8_t __s8; 10 | typedef uint8_t __u8; 11 | typedef int16_t __s16; 12 | typedef uint16_t __u16; 13 | typedef int32_t __s32; 14 | typedef uint32_t __u32; 15 | typedef int64_t __s64; 16 | typedef uint64_t __u64; 17 | 18 | #define __bitwise__ 19 | 20 | typedef __u16 __bitwise__ __le16; 21 | typedef __u16 __bitwise__ __be16; 22 | typedef __u32 __bitwise__ __le32; 23 | typedef __u32 __bitwise__ __be32; 24 | typedef __u64 __bitwise__ __le64; 25 | typedef __u64 __bitwise__ __be64; 26 | 27 | #endif 28 | #endif 29 | -------------------------------------------------------------------------------- /src/rgw/rgw_rest_user.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_RGW_REST_USER_H 2 | #define CEPH_RGW_REST_USER_H 3 | 4 | #include "rgw_rest.h" 5 | #include "rgw_rest_s3.h" 6 | 7 | 8 | class RGWHandler_User : public RGWHandler_Auth_S3 { 9 | protected: 10 | RGWOp *op_get(); 11 | RGWOp *op_put(); 12 | RGWOp *op_post(); 13 | RGWOp *op_delete(); 14 | public: 15 | RGWHandler_User() {} 16 | virtual ~RGWHandler_User() {} 17 | 18 | int read_permissions(RGWOp*) { 19 | return 0; 20 | } 21 | }; 22 | 23 | class RGWRESTMgr_User : public RGWRESTMgr { 24 | public: 25 | RGWRESTMgr_User() {} 26 | virtual ~RGWRESTMgr_User() {} 27 | 28 | RGWHandler *get_handler(struct req_state *s) { 29 | return new RGWHandler_User; 30 | } 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/common/hex.h: -------------------------------------------------------------------------------- 1 | 2 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 3 | // vim: ts=8 sw=2 smarttab 4 | /* 5 | * Ceph - scalable distributed file system 6 | * 7 | * Copyright (C) 2011 New Dream Network 8 | * 9 | * This is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License version 2.1, as published by the Free Software 12 | * Foundation. See file COPYING. 13 | * 14 | */ 15 | 16 | #ifndef CEPH_COMMON_HEX_H 17 | #define CEPH_COMMON_HEX_H 18 | 19 | #include 20 | 21 | extern void hex2str(const char *s, int len, char *buf, int dest_len); 22 | 23 | extern std::string hexdump(std::string msg, const char *s, int len); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/rgw/rgw_acl_swift.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_RGW_ACL_SWIFT_H 2 | #define CEPH_RGW_ACL_SWIFT3_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "rgw_acl.h" 11 | 12 | using namespace std; 13 | 14 | class RGWAccessControlPolicy_SWIFT : public RGWAccessControlPolicy 15 | { 16 | public: 17 | RGWAccessControlPolicy_SWIFT(CephContext *_cct) : RGWAccessControlPolicy(_cct) {} 18 | ~RGWAccessControlPolicy_SWIFT() {} 19 | 20 | void add_grants(RGWRados *store, vector& uids, int perm); 21 | bool create(RGWRados *store, string& id, string& name, string& read_list, string& write_list); 22 | void to_str(string& read, string& write); 23 | }; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/client/fuse_ll.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2006 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | class CephFuse { 16 | public: 17 | CephFuse(Client *c, int fd); 18 | ~CephFuse(); 19 | int init(int argc, const char *argv[]); 20 | int loop(); 21 | void finalize(); 22 | class Handle; 23 | private: 24 | CephFuse::Handle *_handle; 25 | }; 26 | -------------------------------------------------------------------------------- /src/libs3/archlinux/PKGBUILD: -------------------------------------------------------------------------------- 1 | # Contributor: Bryan Ischo 2 | pkgname=libs3 3 | pkgver=trunk 4 | pkgrel=1 5 | pkgdesc="C Library and Tools for Amazon S3 Access" 6 | arch=('i686' 'x86_64') 7 | url="http://libs3.ischo.com/index.html" 8 | license=('GPL') 9 | groups=() 10 | depends=('libxml2' 'openssl' 'curl') 11 | makedepends=('make' 'libxml2' 'openssl' 'curl') 12 | provides=() 13 | conflicts=() 14 | replaces=() 15 | backup=() 16 | options=() 17 | install= 18 | source=(http://libs3.ischo.com/$pkgname-$pkgver.tar.gz) 19 | noextract=() 20 | md5sums=('source md5') #generate with 'makepkg -g' 21 | 22 | build() { 23 | cd "$srcdir/$pkgname-$pkgver" 24 | 25 | DESTDIR=$pkgdir/usr make install || return 1 26 | } 27 | 28 | # vim:set ts=2 sw=2 et: 29 | -------------------------------------------------------------------------------- /src/rgw/rgw_rest_bucket.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_RGW_REST_BUCKET_H 2 | #define CEPH_RGW_REST_BUCKET_H 3 | 4 | #include "rgw_rest.h" 5 | #include "rgw_rest_s3.h" 6 | 7 | 8 | class RGWHandler_Bucket : public RGWHandler_Auth_S3 { 9 | protected: 10 | RGWOp *op_get(); 11 | RGWOp *op_put(); 12 | RGWOp *op_post(); 13 | RGWOp *op_delete(); 14 | public: 15 | RGWHandler_Bucket() {} 16 | virtual ~RGWHandler_Bucket() {} 17 | 18 | int read_permissions(RGWOp*) { 19 | return 0; 20 | } 21 | }; 22 | 23 | class RGWRESTMgr_Bucket : public RGWRESTMgr { 24 | public: 25 | RGWRESTMgr_Bucket() {} 26 | virtual ~RGWRESTMgr_Bucket() {} 27 | 28 | RGWHandler *get_handler(struct req_state *s) { 29 | return new RGWHandler_Bucket; 30 | } 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/upstart/ceph-osd-all-starter.conf: -------------------------------------------------------------------------------- 1 | description "Ceph OSD (start all instances)" 2 | 3 | start on starting ceph-osd-all 4 | 5 | task 6 | 7 | script 8 | set -e 9 | 10 | # first activate any partitions 11 | ceph-disk activate-all 12 | 13 | # TODO what's the valid charset for cluster names and osd ids? 14 | find -L /var/lib/ceph/osd/ -mindepth 1 -maxdepth 1 -regextype posix-egrep -regex '.*/[A-Za-z0-9]+-[A-Za-z0-9._-]+' -printf '%P\n' \ 15 | | while read f; do 16 | if [ -e "/var/lib/ceph/osd/$f/ready" ] && [ -e "/var/lib/ceph/osd/$f/upstart" ] && [ ! -e "/var/lib/ceph/osd/$f/sysvinit" ]; then 17 | cluster="${f%%-*}" 18 | id="${f#*-}" 19 | initctl emit ceph-osd cluster="$cluster" id="$id" 20 | fi 21 | done 22 | end script 23 | -------------------------------------------------------------------------------- /src/perfglue/cpu_profiler.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | #ifndef CEPH_PERFGLUE_CPU_PROFILER 15 | 16 | /* 17 | * Ceph glue for the Google Perftools CPU profiler 18 | */ 19 | #include 20 | #include 21 | 22 | void cpu_profiler_handle_command(const std::vector &cmd, 23 | ostream& out); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/common/Clock.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2006 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_CLOCK_H 16 | #define CEPH_CLOCK_H 17 | 18 | #include "include/utime.h" 19 | 20 | #include 21 | 22 | class CephContext; 23 | 24 | extern utime_t ceph_clock_now(CephContext *cct); 25 | extern time_t ceph_clock_gettime(CephContext *cct); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/include/crc32c.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_CRC32C_H 2 | #define CEPH_CRC32C_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | 10 | extern int ceph_have_crc32c_intel(void); 11 | extern uint32_t ceph_crc32c_le_generic(uint32_t crc, unsigned char const *data, unsigned length); 12 | extern uint32_t ceph_crc32c_le_intel(uint32_t crc, unsigned char const *data, unsigned length); 13 | 14 | static inline uint32_t ceph_crc32c_le(uint32_t crc, unsigned char const *data, unsigned length) { 15 | if (ceph_have_crc32c_intel()) //__builtin_cpu_supports("sse4.2")) 16 | return ceph_crc32c_le_intel(crc, data, length); 17 | else 18 | return ceph_crc32c_le_generic(crc, data, length); 19 | } 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/test/bench/rados_backend.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | 3 | #ifndef RADOSBACKENDH 4 | #define RADOSBACKENDH 5 | 6 | #include "backend.h" 7 | #include "include/Context.h" 8 | #include "include/rados/librados.hpp" 9 | 10 | class RadosBackend : public Backend { 11 | librados::IoCtx *ioctx; 12 | public: 13 | RadosBackend( 14 | librados::IoCtx *ioctx) 15 | : ioctx(ioctx) {} 16 | void write( 17 | const string &oid, 18 | uint64_t offset, 19 | const bufferlist &bl, 20 | Context *on_applied, 21 | Context *on_commit); 22 | 23 | void read( 24 | const string &oid, 25 | uint64_t offset, 26 | uint64_t length, 27 | bufferlist *bl, 28 | Context *on_complete); 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/global/global_context.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_GLOBAL_CONTEXT_H 16 | #define CEPH_GLOBAL_CONTEXT_H 17 | 18 | #include "common/ceph_context.h" 19 | 20 | #include 21 | #include 22 | 23 | struct md_config_t; 24 | 25 | extern CephContext *g_ceph_context; 26 | extern md_config_t *g_conf; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/include/rados/crc32c.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_CRC32C_H 2 | #define CEPH_CRC32C_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | 10 | extern int ceph_have_crc32c_intel(void); 11 | extern uint32_t ceph_crc32c_le_generic(uint32_t crc, unsigned char const *data, unsigned length); 12 | extern uint32_t ceph_crc32c_le_intel(uint32_t crc, unsigned char const *data, unsigned length); 13 | 14 | static inline uint32_t ceph_crc32c_le(uint32_t crc, unsigned char const *data, unsigned length) { 15 | if (ceph_have_crc32c_intel()) //__builtin_cpu_supports("sse4.2")) 16 | return ceph_crc32c_le_intel(crc, data, length); 17 | else 18 | return ceph_crc32c_le_generic(crc, data, length); 19 | } 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/perfglue/disabled_stubs.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #include "common/LogClient.h" 16 | #include "perfglue/cpu_profiler.h" 17 | 18 | #include 19 | #include 20 | 21 | void cpu_profiler_handle_command(const std::vector &cmd, 22 | ostream& out) 23 | { 24 | out << "cpu_profiler support not linked in"; 25 | } 26 | -------------------------------------------------------------------------------- /src/unittest_bufferlist.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Ceph - scalable distributed file system 4 | # 5 | # Copyright (C) 2013 Cloudwatt 6 | # 7 | # Author: Loic Dachary 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU Library Public License as published by 11 | # the Free Software Foundation; either version 2, or (at your option) 12 | # any later version. 13 | # 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU Library Public License for more details. 18 | # 19 | CEPH_BUFFER_TRACK=true ./unittest_bufferlist 20 | -------------------------------------------------------------------------------- /m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /src/include/triple.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2006 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_TRIPLE_H 16 | #define CEPH_TRIPLE_H 17 | 18 | template 19 | class triple { 20 | public: 21 | A first; 22 | B second; 23 | C third; 24 | 25 | triple() {} 26 | triple(A f, B s, C t) : first(f), second(s), third(t) {} 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/gtest/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /src/client/Fh.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_CLIENT_FH_H 2 | #define CEPH_CLIENT_FH_H 3 | 4 | #include "include/types.h" 5 | 6 | class Inode; 7 | class Cond; 8 | 9 | // file handle for any open file state 10 | 11 | struct Fh { 12 | Inode *inode; 13 | loff_t pos; 14 | int mds; // have to talk to mds we opened with (for now) 15 | int mode; // the mode i opened the file with 16 | 17 | int flags; 18 | bool pos_locked; // pos is currently in use 19 | list pos_waiters; // waiters for pos 20 | 21 | // readahead state 22 | loff_t last_pos; 23 | loff_t consec_read_bytes; 24 | int nr_consec_read; 25 | 26 | Fh() : inode(0), pos(0), mds(0), mode(0), flags(0), pos_locked(false), 27 | last_pos(0), consec_read_bytes(0), nr_consec_read(0) {} 28 | }; 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/log/SubsystemMap.cc: -------------------------------------------------------------------------------- 1 | 2 | #include "SubsystemMap.h" 3 | 4 | namespace ceph { 5 | namespace log { 6 | 7 | void SubsystemMap::add(unsigned subsys, std::string name, int log, int gather) 8 | { 9 | if (subsys >= m_subsys.size()) 10 | m_subsys.resize(subsys + 1); 11 | m_subsys[subsys].name = name; 12 | m_subsys[subsys].log_level = log; 13 | m_subsys[subsys].gather_level = gather; 14 | if (name.length() > m_max_name_len) 15 | m_max_name_len = name.length(); 16 | } 17 | 18 | void SubsystemMap::set_log_level(unsigned subsys, int log) 19 | { 20 | assert(subsys < m_subsys.size()); 21 | m_subsys[subsys].log_level = log; 22 | } 23 | 24 | void SubsystemMap::set_gather_level(unsigned subsys, int gather) 25 | { 26 | assert(subsys < m_subsys.size()); 27 | m_subsys[subsys].gather_level = gather; 28 | } 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/objclass/class_debug.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | 4 | #include "common/config.h" 5 | 6 | #include "common/debug.h" 7 | #include "objclass/objclass.h" 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | #define dout_subsys ceph_subsys_objclass 16 | 17 | int cls_log(int level, const char *format, ...) 18 | { 19 | int size = 256; 20 | va_list ap; 21 | while (1) { 22 | char buf[size]; 23 | va_start(ap, format); 24 | int n = vsnprintf(buf, size, format, ap); 25 | va_end(ap); 26 | #define MAX_SIZE 8196 27 | if ((n > -1 && n < size) || size > MAX_SIZE) { 28 | dout(level) << buf << dendl; 29 | return n; 30 | } 31 | size *= 2; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/common/static_assert.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_COMMON_STATIC_ASSERT 16 | #define CEPH_COMMON_STATIC_ASSERT 17 | 18 | /* Create a compiler error if condition is false. 19 | * Also produce a result of value 0 and type size_t. 20 | * This expression can be used anywhere, even in structure initializers. 21 | */ 22 | #define STATIC_ASSERT(x) (sizeof(int[((x)==0) ? -1 : 0])) 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/librbd/SnapInfo.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | #ifndef CEPH_LIBRBD_SNAPINFO_H 4 | #define CEPH_LIBRBD_SNAPINFO_H 5 | 6 | #include 7 | 8 | #include "include/rados/librados.hpp" 9 | 10 | #include "cls/rbd/cls_rbd_client.h" 11 | #include "librbd/parent_types.h" 12 | 13 | namespace librbd { 14 | 15 | struct SnapInfo { 16 | librados::snap_t id; 17 | uint64_t size; 18 | uint64_t features; 19 | parent_info parent; 20 | uint8_t protection_status; 21 | SnapInfo(librados::snap_t _id, uint64_t _size, uint64_t _features, 22 | parent_info _parent, uint8_t _protection_status) : 23 | id(_id), size(_size), features(_features), parent(_parent), 24 | protection_status(_protection_status) {} 25 | }; 26 | } 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/upstart/ceph-mon.conf: -------------------------------------------------------------------------------- 1 | description "Ceph MON" 2 | 3 | start on ceph-mon 4 | stop on runlevel [!2345] or stopping ceph-mon-all 5 | 6 | respawn 7 | respawn limit 5 30 8 | 9 | limit nofile 16384 16384 10 | 11 | pre-start script 12 | set -e 13 | test -x /usr/bin/ceph-mon || { stop; exit 0; } 14 | test -d "/var/lib/ceph/mon/${cluster:-ceph}-$id" || { stop; exit 0; } 15 | 16 | install -d -m0755 /var/run/ceph 17 | end script 18 | 19 | instance ${cluster:-ceph}/$id 20 | export cluster 21 | export id 22 | 23 | # this breaks oneiric 24 | #usage "cluster = name of cluster (defaults to 'ceph'); id = monitor instance id" 25 | 26 | exec /usr/bin/ceph-mon --cluster="${cluster:-ceph}" -i "$id" -f 27 | 28 | post-stop script 29 | # Cleanup socket in case of segfault 30 | rm -f "/var/run/ceph/ceph-mon.$id.asok" 31 | end script 32 | -------------------------------------------------------------------------------- /src/librbd/WatchCtx.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | #ifndef CEPH_LIBRBD_WATCHCTX_H 4 | #define CEPH_LIBRBD_WATCHCTX_H 5 | 6 | #include 7 | 8 | #include "common/Mutex.h" 9 | #include "include/buffer.h" 10 | #include "include/rados/librados.hpp" 11 | 12 | class ImageCtx; 13 | 14 | namespace librbd { 15 | 16 | class WatchCtx : public librados::WatchCtx { 17 | ImageCtx *ictx; 18 | bool valid; 19 | Mutex lock; 20 | public: 21 | uint64_t cookie; 22 | WatchCtx(ImageCtx *ctx) : ictx(ctx), 23 | valid(true), 24 | lock("librbd::WatchCtx"), 25 | cookie(0) {} 26 | virtual ~WatchCtx() {} 27 | void invalidate(); 28 | virtual void notify(uint8_t opcode, uint64_t ver, ceph::bufferlist& bl); 29 | }; 30 | } 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/test/cli/monmaptool/create-print.t: -------------------------------------------------------------------------------- 1 | $ monmaptool --create mymonmap 2 | monmaptool: monmap file mymonmap 3 | monmaptool: generated fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re) 4 | monmaptool: writing epoch 0 to mymonmap (0 monitors) 5 | 6 | $ monmaptool --print mymonmap 7 | monmaptool: monmap file mymonmap 8 | epoch 0 9 | fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re) 10 | last_changed \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re) 11 | created \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re) 12 | 13 | $ monmaptool --print -- mymonmap 14 | monmaptool: monmap file mymonmap 15 | epoch 0 16 | fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re) 17 | last_changed \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re) 18 | created \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re) 19 | -------------------------------------------------------------------------------- /src/client/Dentry.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | 4 | #include "include/types.h" 5 | #include "include/utime.h" 6 | 7 | #include "Dentry.h" 8 | #include "Dir.h" 9 | #include "Inode.h" 10 | 11 | #include "common/Formatter.h" 12 | 13 | void Dentry::dump(Formatter *f) const 14 | { 15 | f->dump_string("name", name); 16 | f->dump_stream("dir") << dir->parent_inode->ino; 17 | if (inode) 18 | f->dump_stream("ino") << inode->ino; 19 | f->dump_int("ref", ref); 20 | f->dump_unsigned("offset", offset); 21 | if (lease_mds >= 0) { 22 | f->dump_int("lease_mds", lease_mds); 23 | f->dump_stream("lease_ttl") << lease_ttl; 24 | f->dump_int("lease_gen", lease_gen); 25 | f->dump_int("lease_seq", lease_seq); 26 | } 27 | f->dump_int("cap_shared_gen", cap_shared_gen); 28 | } 29 | -------------------------------------------------------------------------------- /src/cls/version/cls_version_client.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_CLS_VERSION_CLIENT_H 2 | #define CEPH_CLS_VERSION_CLIENT_H 3 | 4 | #include "include/types.h" 5 | #include "include/rados/librados.hpp" 6 | 7 | /* 8 | * version objclass 9 | */ 10 | 11 | void cls_version_set(librados::ObjectWriteOperation& op, obj_version& ver); 12 | 13 | /* increase anyway */ 14 | void cls_version_inc(librados::ObjectWriteOperation& op); 15 | 16 | /* conditional increase, return -EAGAIN if condition fails */ 17 | void cls_version_inc(librados::ObjectWriteOperation& op, obj_version& ver, VersionCond cond); 18 | 19 | void cls_version_read(librados::ObjectReadOperation& op, obj_version *objv); 20 | 21 | int cls_version_read(librados::IoCtx& io_ctx, string& oid, obj_version *ver); 22 | 23 | void cls_version_check(librados::ObjectOperation& op, obj_version& ver, VersionCond cond); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/test/bench/rbd_backend.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | 3 | #ifndef CEPH_TEST_SMALLIOBENCH_RBD_BACKEND_H 4 | #define CEPH_TEST_SMALLIOBENCH_RBD_BACKEND_H 5 | 6 | #include "backend.h" 7 | #include "include/Context.h" 8 | #include "include/rbd/librbd.hpp" 9 | 10 | class RBDBackend : public Backend { 11 | map > *m_images; 12 | public: 13 | RBDBackend(map > *images) 14 | : m_images(images) {} 15 | void write( 16 | const string &oid, 17 | uint64_t offset, 18 | const bufferlist &bl, 19 | Context *on_applied, 20 | Context *on_commit); 21 | 22 | void read( 23 | const string &oid, 24 | uint64_t offset, 25 | uint64_t length, 26 | bufferlist *bl, 27 | Context *on_complete); 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/common/strtol.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_COMMON_STRTOL_H 16 | #define CEPH_COMMON_STRTOL_H 17 | 18 | #include 19 | 20 | long long strict_strtoll(const char *str, int base, std::string *err); 21 | 22 | int strict_strtol(const char *str, int base, std::string *err); 23 | 24 | double strict_strtod(const char *str, std::string *err); 25 | 26 | float strict_strtof(const char *str, std::string *err); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/common/pipe.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_COMMON_PIPE_H 16 | #define CEPH_COMMON_PIPE_H 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | /** Create a pipe and set both ends to have F_CLOEXEC 23 | * 24 | * @param pipefd pipe array, just as in pipe(2) 25 | * @return 0 on success, errno otherwise 26 | */ 27 | int pipe_cloexec(int pipefd[2]); 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/rgw/rgw_tools.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_RGW_TOOLS_H 2 | #define CEPH_RGW_TOOLS_H 3 | 4 | #include 5 | 6 | #include "include/types.h" 7 | #include "rgw_common.h" 8 | 9 | class RGWRados; 10 | class RGWObjVersionTracker; 11 | 12 | struct obj_version; 13 | 14 | int rgw_put_system_obj(RGWRados *rgwstore, rgw_bucket& bucket, string& oid, const char *data, size_t size, bool exclusive, 15 | RGWObjVersionTracker *objv_tracker, time_t set_mtime, map *pattrs = NULL); 16 | int rgw_get_system_obj(RGWRados *rgwstore, void *ctx, rgw_bucket& bucket, const string& key, bufferlist& bl, 17 | RGWObjVersionTracker *objv_tracker, time_t *pmtime, map *pattrs = NULL); 18 | 19 | int rgw_tools_init(CephContext *cct); 20 | void rgw_tools_cleanup(); 21 | const char *rgw_find_mime_by_ext(string& ext); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/rgw/rgw_multiparser.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | #include "include/types.h" 7 | 8 | #include "rgw_multi.h" 9 | 10 | #define dout_subsys ceph_subsys_rgw 11 | 12 | using namespace std; 13 | 14 | int main(int argc, char **argv) { 15 | RGWMultiXMLParser parser; 16 | 17 | if (!parser.init()) 18 | exit(1); 19 | 20 | char buf[1024]; 21 | 22 | for (;;) { 23 | int done; 24 | int len; 25 | 26 | len = fread(buf, 1, sizeof(buf), stdin); 27 | if (ferror(stdin)) { 28 | fprintf(stderr, "Read error\n"); 29 | exit(-1); 30 | } 31 | done = feof(stdin); 32 | 33 | bool result = parser.parse(buf, len, done); 34 | if (!result) { 35 | cerr << "failed to parse!" << std::endl; 36 | } 37 | 38 | if (done) 39 | break; 40 | } 41 | 42 | exit(0); 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/test/cli/ceph-conf/manpage.t: -------------------------------------------------------------------------------- 1 | # setup 2 | $ cat >foo.conf <<'EOF' 3 | > ; --------------------- 4 | > [group cephnet] 5 | > addr = 10.3.14.0/24 6 | > 7 | > [global] 8 | > pid file = /home/sage/ceph/src/out/$name.pid 9 | > 10 | > [osd] 11 | > osd data = /mnt/osd$id 12 | > [osd.3] 13 | > host = cosd3 14 | > EOF 15 | 16 | To extract the value of the "osd data" option for the osd0 daemon, 17 | 18 | $ ceph-conf -c foo.conf "osd data" --name osd.0 19 | /mnt/osd0 20 | 21 | This is equivalent to doing specifying sections [osd0], [osd.0], 22 | [osd], or [global], in that order of preference: 23 | 24 | # TODO the "admin" here seems like an actual bug 25 | 26 | $ ceph-conf -c foo.conf "osd data" -s osd0 -s osd.0 -s osd -s global 27 | /mnt/osdadmin 28 | 29 | To list all sections that begin with osd: 30 | 31 | $ ceph-conf -c foo.conf -l osd 32 | osd 33 | osd.3 34 | -------------------------------------------------------------------------------- /src/test/cli/osdmaptool/create-print.t: -------------------------------------------------------------------------------- 1 | $ osdmaptool --createsimple 3 myosdmap 2 | osdmaptool: osdmap file 'myosdmap' 3 | osdmaptool: writing epoch 1 to myosdmap 4 | 5 | $ osdmaptool --print myosdmap 6 | osdmaptool: osdmap file 'myosdmap' 7 | epoch 1 8 | fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re) 9 | created \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re) 10 | modified \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re) 11 | flags 12 | 13 | pool 0 'data' rep size 2 min_size 1 crush_ruleset 0 object_hash rjenkins pg_num 192 pgp_num 192 last_change 0 owner 0 crash_replay_interval 45 14 | pool 1 'metadata' rep size 2 min_size 1 crush_ruleset 1 object_hash rjenkins pg_num 192 pgp_num 192 last_change 0 owner 0 15 | pool 2 'rbd' rep size 2 min_size 1 crush_ruleset 2 object_hash rjenkins pg_num 192 pgp_num 192 last_change 0 owner 0 16 | 17 | max_osd 3 18 | 19 | -------------------------------------------------------------------------------- /src/common/version.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_COMMON_VERSION_H 16 | #define CEPH_COMMON_VERSION_H 17 | 18 | #include 19 | 20 | // Return a string describing the Ceph version 21 | const char *ceph_version_to_str(void); 22 | 23 | // Return a string describing the git version 24 | const char *git_version_to_str(void); 25 | 26 | // Return a formatted string describing the ceph and git versions 27 | std::string const pretty_version_to_str(void); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/test/cli/monmaptool/rm.t: -------------------------------------------------------------------------------- 1 | $ monmaptool --create --add foo 2.3.4.5:6789 mymonmap 2 | monmaptool: monmap file mymonmap 3 | monmaptool: generated fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re) 4 | monmaptool: writing epoch 0 to mymonmap (1 monitors) 5 | 6 | $ ORIG_FSID="$(monmaptool --print mymonmap|grep ^fsid)" 7 | 8 | $ monmaptool --rm foo mymonmap 9 | monmaptool: monmap file mymonmap 10 | monmaptool: removing foo 11 | monmaptool: writing epoch 0 to mymonmap (0 monitors) 12 | 13 | $ monmaptool --print mymonmap 14 | monmaptool: monmap file mymonmap 15 | epoch 0 16 | fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re) 17 | last_changed \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re) 18 | created \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re) 19 | 20 | $ NEW_FSID="$(monmaptool --print mymonmap|grep ^fsid)" 21 | $ [ "$ORIG_FSID" = "$NEW_FSID" ] 22 | -------------------------------------------------------------------------------- /src/test/cli/rbd/not-enough-args.t: -------------------------------------------------------------------------------- 1 | $ rbd map 2 | rbd: image name was not specified 3 | [1] 4 | $ rbd unmap 5 | rbd: device path was not specified 6 | [1] 7 | $ rbd clone foo@snap bar@snap 8 | rbd: cannot clone to a snapshot 9 | [1] 10 | $ rbd cp foo 11 | rbd: destination image name was not specified 12 | [1] 13 | $ rbd cp foo@bar 14 | rbd: destination image name was not specified 15 | [1] 16 | $ rbd copy foo 17 | rbd: destination image name was not specified 18 | [1] 19 | $ rbd copy foo@bar 20 | rbd: destination image name was not specified 21 | [1] 22 | $ rbd mv foo 23 | rbd: destination image name was not specified 24 | [1] 25 | $ rbd rename foo 26 | rbd: destination image name was not specified 27 | [1] 28 | $ rbd clone foo@bar 29 | rbd: destination image name was not specified 30 | [1] 31 | $ rbd clone foo 32 | rbd: snap name was not specified 33 | [1] 34 | -------------------------------------------------------------------------------- /src/global/pidfile.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_COMMON_PIDFILE_H 16 | #define CEPH_COMMON_PIDFILE_H 17 | 18 | struct md_config_t; 19 | 20 | // Write a pidfile with the current pid, using the configuration in the 21 | // provided conf structure. 22 | int pidfile_write(const md_config_t *conf); 23 | 24 | // Remove the pid file that was previously written by pidfile_write. 25 | // This is safe to call in a signal handler context. 26 | int pidfile_remove(void); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/libs3/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008 Bryan Ischo 2 | 3 | libs3 is free software: you can redistribute it and/or modify it under the 4 | terms of the GNU General Public License as published by the Free Software 5 | Foundation, version 3 of the License. 6 | 7 | In addition, as a special exception, the copyright holders give 8 | permission to link the code of this library and its programs with the 9 | OpenSSL library, and distribute linked combinations including the two. 10 | 11 | libs3 is distributed in the hope that it will be useful, but WITHOUT ANY 12 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 13 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 14 | details. 15 | 16 | You should have received a copy of the GNU General Public License version 3 17 | along with libs3, in a file named COPYING. If not, see 18 | . 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/common/debug.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_DEBUG_H 16 | #define CEPH_DEBUG_H 17 | 18 | #include "common/dout.h" 19 | 20 | /* Global version of the stuff in common/dout.h 21 | */ 22 | 23 | #define dout(v) ldout((g_ceph_context), v) 24 | 25 | #define pdout(v, p) lpdout((g_ceph_context), v, p) 26 | 27 | #define generic_dout(v) lgeneric_dout((g_ceph_context), v) 28 | 29 | #define derr lderr((g_ceph_context)) 30 | 31 | #define generic_derr lgeneric_derr((g_ceph_context)) 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/messages/MPing.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2006 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | 16 | 17 | #ifndef CEPH_MPING_H 18 | #define CEPH_MPING_H 19 | 20 | #include "msg/Message.h" 21 | #include "include/encoding.h" 22 | 23 | class MPing : public Message { 24 | public: 25 | MPing() : Message(CEPH_MSG_PING) {} 26 | private: 27 | ~MPing() {} 28 | 29 | public: 30 | void decode_payload() { } 31 | void encode_payload(uint64_t features) { } 32 | const char *get_type_name() const { return "ping"; } 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/common/compiler_extensions.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_COMPILER_EXTENSIONS_H 16 | #define CEPH_COMPILER_EXTENSIONS_H 17 | 18 | /* We should be able to take advantage of nice nonstandard features of gcc 19 | * and other compilers, but still maintain portability. 20 | */ 21 | 22 | #ifdef __GNUC__ 23 | // GCC 24 | #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) 25 | #else 26 | // some other compiler - just make it a no-op 27 | #define WARN_UNUSED_RESULT 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/test/bench/filestore_backend.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | 3 | #ifndef FILESTOREBACKENDH 4 | #define FILESTOREBACKENDH 5 | 6 | #include "common/Finisher.h" 7 | #include "backend.h" 8 | #include "include/Context.h" 9 | #include "os/ObjectStore.h" 10 | 11 | class FileStoreBackend : public Backend { 12 | ObjectStore *os; 13 | Finisher finisher; 14 | map osrs; 15 | const bool write_infos; 16 | 17 | public: 18 | FileStoreBackend(ObjectStore *os, bool write_infos); 19 | ~FileStoreBackend() { 20 | finisher.stop(); 21 | } 22 | void write( 23 | const string &oid, 24 | uint64_t offset, 25 | const bufferlist &bl, 26 | Context *on_applied, 27 | Context *on_commit); 28 | 29 | void read( 30 | const string &oid, 31 | uint64_t offset, 32 | uint64_t length, 33 | bufferlist *bl, 34 | Context *on_complete); 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/rgw/rgw_client_io.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_RGW_CLIENT_IO_H 2 | #define CEPH_RGW_CLIENT_IO_H 3 | 4 | #include 5 | 6 | #include "include/types.h" 7 | 8 | class RGWClientIO { 9 | bool account; 10 | 11 | size_t bytes_sent; 12 | size_t bytes_received; 13 | 14 | protected: 15 | virtual int write_data(const char *buf, int len) = 0; 16 | virtual int read_data(char *buf, int max) = 0; 17 | 18 | public: 19 | virtual ~RGWClientIO() {} 20 | RGWClientIO() : account(false), bytes_sent(0), bytes_received(0) {} 21 | 22 | int print(const char *format, ...); 23 | int write(const char *buf, int len); 24 | virtual void flush() = 0; 25 | int read(char *buf, int max, int *actual); 26 | 27 | virtual const char **envp() = 0; 28 | 29 | void set_account(bool _account) { 30 | account = _account; 31 | } 32 | 33 | uint64_t get_bytes_sent() { return bytes_sent; } 34 | uint64_t get_bytes_received() { return bytes_received; } 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/common/TrackedOp.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2012 New Dream Network/Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | */ 13 | 14 | #ifndef TRACKEDREQUEST_H_ 15 | #define TRACKEDREQUEST_H_ 16 | #include 17 | #include 18 | #include 19 | #include "common/Mutex.h" 20 | #include "include/xlist.h" 21 | #include "msg/Message.h" 22 | #include 23 | 24 | class TrackedOp { 25 | public: 26 | virtual void mark_event(const string &event) = 0; 27 | virtual ~TrackedOp() {} 28 | }; 29 | typedef std::tr1::shared_ptr TrackedOpRef; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /m4/ac_check_classpath.m4: -------------------------------------------------------------------------------- 1 | dnl @synopsis AC_CHECK_CLASSPATH 2 | dnl 3 | dnl AC_CHECK_CLASSPATH just displays the CLASSPATH, for the edification 4 | dnl of the user. 5 | dnl 6 | dnl Note: This is part of the set of autoconf M4 macros for Java 7 | dnl programs. It is VERY IMPORTANT that you download the whole set, 8 | dnl some macros depend on other. Unfortunately, the autoconf archive 9 | dnl does not support the concept of set of macros, so I had to break it 10 | dnl for submission. The general documentation, as well as the sample 11 | dnl configure.in, is included in the AC_PROG_JAVA macro. 12 | dnl 13 | dnl @category Java 14 | dnl @author Stephane Bortzmeyer 15 | dnl @version 2000-07-19 16 | dnl @license GPLWithACException 17 | 18 | AC_DEFUN([AC_CHECK_CLASSPATH],[ 19 | if test "x$CLASSPATH" = x; then 20 | echo "You have no CLASSPATH, I hope it is good" 21 | else 22 | echo "You have CLASSPATH $CLASSPATH, hope it is correct" 23 | fi 24 | ]) 25 | -------------------------------------------------------------------------------- /src/messages/MMonGetMap.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2006 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_MMONGETMAP_H 16 | #define CEPH_MMONGETMAP_H 17 | 18 | #include "msg/Message.h" 19 | 20 | #include "include/types.h" 21 | 22 | class MMonGetMap : public Message { 23 | public: 24 | MMonGetMap() : Message(CEPH_MSG_MON_GET_MAP) { } 25 | private: 26 | ~MMonGetMap() {} 27 | 28 | public: 29 | const char *get_type_name() const { return "mon_getmap"; } 30 | 31 | void encode_payload(uint64_t features) { } 32 | void decode_payload() { } 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/logrotate.conf: -------------------------------------------------------------------------------- 1 | /var/log/ceph/*.log { 2 | rotate 7 3 | daily 4 | compress 5 | sharedscripts 6 | postrotate 7 | if which invoke-rc.d > /dev/null 2>&1 && [ -x `which invoke-rc.d` ]; then 8 | invoke-rc.d ceph reload >/dev/null 9 | elif which service > /dev/null 2>&1 && [ -x `which service` ]; then 10 | service ceph reload >/dev/null 11 | fi 12 | # Possibly reload twice, but depending on ceph.conf the reload above may be a no-op 13 | if which initctl > /dev/null 2>&1 && [ -x `which initctl` ]; then 14 | # upstart reload isn't very helpful here: 15 | # https://bugs.launchpad.net/upstart/+bug/1012938 16 | initctl list \ 17 | | sed -n 's/^\(ceph-\(mon\|osd\|mds\)\+\)[ \t]\+(\([^ \/]\+\)\/\([^ \/]\+\))[ \t]\+start\/.*$/\1 cluster=\3 id=\4/p' \ 18 | | while read l; do 19 | initctl reload -- $l 2>/dev/null || : 20 | done 21 | fi 22 | endscript 23 | missingok 24 | } 25 | -------------------------------------------------------------------------------- /src/rgw/logrotate.conf: -------------------------------------------------------------------------------- 1 | /var/log/radosgw/*.log { 2 | rotate 7 3 | daily 4 | compress 5 | sharedscripts 6 | postrotate 7 | if which invoke-rc.d > /dev/null 2>&1 && [ -x `which invoke-rc.d` ]; then 8 | invoke-rc.d radosgw reload >/dev/null 9 | elif which service > /dev/null 2>&1 && [ -x `which service` ]; then 10 | service radosgw reload >/dev/null 11 | fi 12 | # Possibly reload twice, but depending on ceph.conf the reload above may be a no-op 13 | if which initctl > /dev/null 2>&1 && [ -x `which initctl` ]; then 14 | # upstart reload isn't very helpful here: 15 | # https://bugs.launchpad.net/upstart/+bug/1012938 16 | initctl list \ 17 | | sed -n 's/^\(radosgw\+\)[ \t]\+(\([^ \/]\+\)\/\([^ \/]\+\))[ \t]\+start\/.*$/\1 cluster=\2 id=\3/p' \ 18 | | while read l; do 19 | initctl reload -- $l 2>/dev/null || : 20 | done 21 | fi 22 | endscript 23 | missingok 24 | } 25 | -------------------------------------------------------------------------------- /src/gtest/xcode/Samples/FrameworkSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.gtest.${PRODUCT_NAME:identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | CSResourcesFileMapped 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/common/run_cmd.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_COMMON_RUN_CMD_H 16 | #define CEPH_COMMON_RUN_CMD_H 17 | 18 | #include 19 | 20 | // 21 | // Fork a command and run it. The shell will not be invoked and shell 22 | // expansions will not be done. 23 | // This function takes a variable number of arguments. The last argument must 24 | // be NULL. 25 | // 26 | // Example: 27 | // run_cmd("rm", "-rf", "foo", NULL) 28 | // 29 | // Returns an empty string on success, and an error string otherwise. 30 | // 31 | std::string run_cmd(const char *cmd, ...); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/test/cli/crushtool/add-item.t: -------------------------------------------------------------------------------- 1 | $ crushtool -i "$TESTDIR/simple.template" --add-item 0 1.0 device0 --loc host host0 --loc cluster cluster0 -o one > /dev/null 2 | $ crushtool -i one --add-item 1 1.0 device1 --loc host host0 --loc cluster cluster0 -o two > /dev/null 3 | $ crushtool -d two -o final 4 | $ cmp final "$TESTDIR/simple.template.two" 5 | $ crushtool -i two --add-item 1 1.0 device1 --loc host host0 --loc cluster cluster0 -o three 2>/dev/null >/dev/null || echo FAIL 6 | FAIL 7 | $ crushtool -i two --remove-item device1 -o four > /dev/null 8 | $ crushtool -d four -o final 9 | $ cmp final "$TESTDIR/simple.template.four" 10 | $ crushtool -i two --update-item 1 2.0 osd1 --loc host host1 --loc cluster cluster0 -o five > /dev/null 11 | $ crushtool -d five -o final 12 | $ cmp final "$TESTDIR/simple.template.five" 13 | $ crushtool -i five --update-item 1 2.0 osd1 --loc host host1 --loc cluster cluster0 -o six > /dev/null 14 | $ crushtool -d six -o final 15 | $ cmp final "$TESTDIR/simple.template.five" 16 | -------------------------------------------------------------------------------- /src/include/intarith.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2006 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_INTARITH_H 16 | #define CEPH_INTARITH_H 17 | 18 | #ifndef MIN 19 | # define MIN(a,b) ((a) < (b) ? (a):(b)) 20 | #endif 21 | 22 | #ifndef MAX 23 | # define MAX(a,b) ((a) > (b) ? (a):(b)) 24 | #endif 25 | 26 | #ifndef DIV_ROUND_UP 27 | # define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) 28 | #endif 29 | 30 | #ifndef ROUND_UP_TO 31 | # define ROUND_UP_TO(n, d) (((n)+(d)-1) & ~((d)-1)) 32 | #endif 33 | 34 | #ifndef SHIFT_ROUND_UP 35 | # define SHIFT_ROUND_UP(x,y) (((x)+(1<<(y))-1) >> (y)) 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/test/simple_spin.cc: -------------------------------------------------------------------------------- 1 | #include "gtest/gtest.h" 2 | 3 | #include "common/simple_spin.h" 4 | 5 | TEST(SimpleSpin, Test0) 6 | { 7 | simple_spinlock_t lock0 = SIMPLE_SPINLOCK_INITIALIZER; 8 | simple_spin_lock(&lock0); 9 | simple_spin_unlock(&lock0); 10 | } 11 | 12 | static simple_spinlock_t lock = SIMPLE_SPINLOCK_INITIALIZER; 13 | static uint32_t counter = 0; 14 | 15 | static void* mythread(void *v) 16 | { 17 | for (int j = 0; j < 1000000; ++j) { 18 | simple_spin_lock(&lock); 19 | counter++; 20 | simple_spin_unlock(&lock); 21 | } 22 | return NULL; 23 | } 24 | 25 | TEST(SimpleSpin, Test1) 26 | { 27 | int ret; 28 | pthread_t thread1; 29 | pthread_t thread2; 30 | ret = pthread_create(&thread1, NULL, mythread, NULL); 31 | ASSERT_EQ(ret, 0); 32 | ret = pthread_create(&thread2, NULL, mythread, NULL); 33 | ASSERT_EQ(ret, 0); 34 | ret = pthread_join(thread1, NULL); 35 | ASSERT_EQ(ret, 0); 36 | ret = pthread_join(thread2, NULL); 37 | ASSERT_EQ(ret, 0); 38 | ASSERT_EQ(counter, 2000000U); 39 | } 40 | -------------------------------------------------------------------------------- /src/common/blkdev.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "acconfig.h" 12 | #include "include/compat.h" 13 | 14 | #if defined(__FreeBSD__) 15 | #include 16 | #endif 17 | 18 | int get_block_device_size(int fd, int64_t *psize) 19 | { 20 | int ret = 0; 21 | 22 | #if defined(__FreeBSD__) 23 | ret = ::ioctl(fd, DIOCGMEDIASIZE, psize); 24 | #elif defined(__linux__) 25 | #ifdef BLKGETSIZE64 26 | // ioctl block device 27 | ret = ::ioctl(fd, BLKGETSIZE64, psize); 28 | #elif BLKGETSIZE 29 | // hrm, try the 32 bit ioctl? 30 | unsigned long sectors = 0; 31 | ret = ::ioctl(fd, BLKGETSIZE, §ors); 32 | *psize = sectors * 512ULL; 33 | #endif 34 | #else 35 | #error "Compile error: we don't know how to get the size of a raw block device." 36 | #endif /* !__FreeBSD__ */ 37 | if (ret < 0) 38 | ret = -errno; 39 | return ret; 40 | } 41 | -------------------------------------------------------------------------------- /src/common/lockdep.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2008-2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_LOCKDEP_H 16 | #define CEPH_LOCKDEP_H 17 | 18 | class CephContext; 19 | 20 | extern int g_lockdep; 21 | 22 | extern void lockdep_register_ceph_context(CephContext *cct); 23 | extern void lockdep_unregister_ceph_context(CephContext *cct); 24 | extern int lockdep_register(const char *n); 25 | extern int lockdep_will_lock(const char *n, int id); 26 | extern int lockdep_locked(const char *n, int id, bool force_backtrace=false); 27 | extern int lockdep_will_unlock(const char *n, int id); 28 | extern int lockdep_dump_locks(); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/librbd/WatchCtx.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | 4 | #include "common/ceph_context.h" 5 | #include "common/dout.h" 6 | #include "common/perf_counters.h" 7 | 8 | #include "librbd/ImageCtx.h" 9 | #include "librbd/internal.h" 10 | 11 | #include "librbd/WatchCtx.h" 12 | 13 | #define dout_subsys ceph_subsys_rbd 14 | #undef dout_prefix 15 | #define dout_prefix *_dout << "librbd::WatchCtx: " 16 | 17 | namespace librbd { 18 | 19 | void WatchCtx::invalidate() 20 | { 21 | Mutex::Locker l(lock); 22 | valid = false; 23 | } 24 | 25 | void WatchCtx::notify(uint8_t opcode, uint64_t ver, bufferlist& bl) 26 | { 27 | Mutex::Locker l(lock); 28 | ldout(ictx->cct, 1) << " got notification opcode=" << (int)opcode 29 | << " ver=" << ver << " cookie=" << cookie << dendl; 30 | if (valid) { 31 | Mutex::Locker lictx(ictx->refresh_lock); 32 | ++ictx->refresh_seq; 33 | ictx->perfcounter->inc(l_librbd_notify); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/common/config_obs.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2006 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_CONFIG_OBS_H 16 | #define CEPH_CONFIG_OBS_H 17 | 18 | #include 19 | #include 20 | 21 | struct md_config_t; 22 | 23 | class md_config_obs_t { 24 | public: 25 | virtual ~md_config_obs_t(); 26 | virtual const char** get_tracked_conf_keys() const = 0; 27 | virtual void handle_conf_change(const struct md_config_t *conf, 28 | const std::set &changed) = 0; 29 | virtual void handle_subsys_change(const struct md_config_t *conf, 30 | const std::set& changed) { } 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/mount.fuse.ceph: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Helper to mount ceph-fuse from /etc/fstab. To use, add an entry 4 | # like: 5 | # 6 | # # DEVICE PATH TYPE OPTIONS 7 | # id=admin /mnt/ceph fuse.ceph defaults 0 0 8 | # id=myuser,conf=/etc/ceph/foo.conf /mnt/ceph2 fuse.ceph defaults 0 0 9 | # 10 | # where the device field is a comma-separated list of options to pass on 11 | # the command line. The examples above, for example, specify that 12 | # ceph-fuse will authenticated as client.admin and client.myuser 13 | # (respectively), and the second example also sets the 'conf' option to 14 | # '/etc/ceph/foo.conf' via the ceph-fuse command line. Any valid 15 | # ceph-fuse can be passed in this way. 16 | 17 | set -e 18 | 19 | # convert device string to options 20 | cephargs='--'`echo $1 | sed 's/,/ --/g'` 21 | 22 | # strip out 'noauto' option; libfuse doesn't like it 23 | opts=`echo $4 | sed 's/,noauto//' | sed 's/noauto,//'` 24 | 25 | # go 26 | exec ceph-fuse $cephargs $2 $3 $opts 27 | -------------------------------------------------------------------------------- /src/test/system/systest_settings.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_SYSTEM_TEST_SETTINGS_H 16 | #define CEPH_SYSTEM_TEST_SETTINGS_H 17 | 18 | #include 19 | 20 | /* Singleton with settings grabbed from environment variables */ 21 | class SysTestSettings 22 | { 23 | public: 24 | static SysTestSettings& inst(); 25 | bool use_threads() const; 26 | std::string get_log_name(const std::string &suffix) const; 27 | private: 28 | static SysTestSettings* m_inst; 29 | SysTestSettings(); 30 | ~SysTestSettings(); 31 | 32 | bool m_use_threads; 33 | std::string m_log_file_base; 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/auth/none/AuthNoneProtocol.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2009 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_AUTHNONEPROTOCOL_H 16 | #define CEPH_AUTHNONEPROTOCOL_H 17 | 18 | #include "../Auth.h" 19 | 20 | struct AuthNoneAuthorizer : public AuthAuthorizer { 21 | AuthNoneAuthorizer() : AuthAuthorizer(CEPH_AUTH_NONE) { } 22 | bool build_authorizer(const EntityName &ename, uint64_t global_id) { 23 | __u8 struct_v = 1; 24 | ::encode(struct_v, bl); 25 | ::encode(ename, bl); 26 | ::encode(global_id, bl); 27 | return 0; 28 | } 29 | bool verify_reply(bufferlist::iterator& reply) { return true; } 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/test/test_str_list.cc: -------------------------------------------------------------------------------- 1 | 2 | #include "include/types.h" 3 | #include "include/str_list.h" 4 | 5 | #include 6 | #include 7 | 8 | #include "gtest/gtest.h" 9 | 10 | 11 | const char *tests[][10] = { 12 | { "foo,bar", "foo", "bar", 0 }, 13 | { "foo", "foo", 0 }, 14 | { "foo;bar", "foo", "bar", 0 }, 15 | { "foo bar", "foo", "bar", 0 }, 16 | { " foo bar", "foo", "bar", 0 }, 17 | { " foo bar ", "foo", "bar", 0 }, 18 | { "a,b,c", "a", "b", "c", 0 }, 19 | { " a\tb\tc\t", "a", "b", "c", 0 }, 20 | { "a, b, c", "a", "b", "c", 0 }, 21 | { "a b c", "a", "b", "c", 0 }, 22 | { 0 }, 23 | }; 24 | 25 | TEST(StrList, All) 26 | { 27 | for (unsigned i=0; tests[i][0]; ++i) { 28 | std::string src = tests[i][0]; 29 | std::list expected; 30 | for (unsigned j=1; tests[i][j]; ++j) 31 | expected.push_back(tests[i][j]); 32 | std::list actual; 33 | get_str_list(src, actual); 34 | std::cout << "'" << src << "' -> " << actual << std::endl; 35 | ASSERT_EQ(actual, expected); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/auth/AuthServiceHandler.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2009 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #include "AuthServiceHandler.h" 16 | #include "cephx/CephxServiceHandler.h" 17 | #include "none/AuthNoneServiceHandler.h" 18 | #include "AuthMethodList.h" 19 | #include "common/config.h" 20 | 21 | #define dout_subsys ceph_subsys_auth 22 | 23 | 24 | AuthServiceHandler *get_auth_service_handler(int type, CephContext *cct, KeyServer *ks) 25 | { 26 | switch (type) { 27 | case CEPH_AUTH_CEPHX: 28 | return new CephxServiceHandler(cct, ks); 29 | case CEPH_AUTH_NONE: 30 | return new AuthNoneServiceHandler(cct); 31 | } 32 | return NULL; 33 | } 34 | -------------------------------------------------------------------------------- /src/common/Clock.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2006 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | 16 | #include "common/Clock.h" 17 | #include "common/ceph_context.h" 18 | #include "common/config.h" 19 | #include "include/utime.h" 20 | 21 | #include 22 | 23 | utime_t ceph_clock_now(CephContext *cct) 24 | { 25 | struct timeval tv; 26 | gettimeofday(&tv, NULL); 27 | utime_t n(&tv); 28 | if (cct) 29 | n += cct->_conf->clock_offset; 30 | return n; 31 | } 32 | 33 | time_t ceph_clock_gettime(CephContext *cct) 34 | { 35 | time_t ret = time(NULL); 36 | if (cct) 37 | ret += ((time_t)cct->_conf->clock_offset); 38 | return ret; 39 | } 40 | -------------------------------------------------------------------------------- /src/test/osd/RadosModel.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | #include "include/interval_set.h" 3 | #include "include/buffer.h" 4 | #include 5 | #include 6 | #include 7 | #include "include/rados/librados.h" 8 | #include "RadosModel.h" 9 | #include "TestOpStat.h" 10 | 11 | 12 | void TestOp::begin() 13 | { 14 | //if (stat) stat->begin(this); 15 | _begin(); 16 | } 17 | 18 | void TestOp::finish(TestOp::CallbackInfo *info) 19 | { 20 | _finish(info); 21 | //if (stat && finished()) stat->end(this); 22 | } 23 | 24 | void read_callback(librados::completion_t comp, void *arg) { 25 | TestOp* op = static_cast(arg); 26 | op->finish(NULL); 27 | } 28 | 29 | void write_callback(librados::completion_t comp, void *arg) { 30 | std::pair *args = 31 | static_cast *>(arg); 32 | TestOp* op = args->first; 33 | TestOp::CallbackInfo *info = args->second; 34 | op->finish(info); 35 | delete args; 36 | delete info; 37 | } 38 | -------------------------------------------------------------------------------- /src/common/Semaphore.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2006 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | 16 | #ifndef CEPH_Sem_Posix__H 17 | #define CEPH_Sem_Posix__H 18 | 19 | class Semaphore 20 | { 21 | Mutex m; 22 | Cond c; 23 | int count; 24 | 25 | public: 26 | 27 | Semaphore() : m("Semaphore::m") 28 | { 29 | count = 0; 30 | } 31 | 32 | void Put() 33 | { 34 | m.Lock(); 35 | count++; 36 | c.Signal(); 37 | m.Unlock(); 38 | } 39 | 40 | void Get() 41 | { 42 | m.Lock(); 43 | while(count <= 0) { 44 | c.Wait(m); 45 | } 46 | count--; 47 | m.Unlock(); 48 | } 49 | }; 50 | 51 | #endif // !_Mutex_Posix_ 52 | -------------------------------------------------------------------------------- /src/auth/unknown/AuthUnknownProtocol.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2009 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_AUTHUNKNOWNPROTOCOL_H 16 | #define CEPH_AUTHUNKNOWNPROTOCOL_H 17 | 18 | #include "../Auth.h" 19 | 20 | struct AuthUnknownAuthorizer : public AuthAuthorizer { 21 | AuthUnknownAuthorizer() : AuthAuthorizer(CEPH_AUTH_UNKNOWN) { } 22 | bool build_authorizer(const EntityName &ename, uint64_t global_id) { 23 | __u8 struct_v = 1; 24 | ::encode(struct_v, bl); 25 | ::encode(ename, bl); 26 | ::encode(global_id, bl); 27 | return 0; 28 | } 29 | bool verify_reply(bufferlist::iterator& reply) { return true; } 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/osd/ObjectVersioner.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2006 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_OSD_OBJECTVERSIONER_H 16 | #define CEPH_OSD_OBJECTVERSIONER_H 17 | 18 | class ObjectVersioner { 19 | public: 20 | pobject_t oid; 21 | 22 | void get_versions(list& ls); 23 | version_t head(); // newest 24 | version_t committed(); // last committed 25 | version_t tail(); // oldest 26 | 27 | /* 28 | * prepare a new version, starting wit "raw" transaction t. 29 | */ 30 | void prepare(ObjectStore::Transaction& t, version_t v); 31 | void rollback_to(version_t v); 32 | void commit_to(version_t v); 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/test/cli/crushtool/simple.template.four: -------------------------------------------------------------------------------- 1 | # begin crush map 2 | 3 | # devices 4 | device 0 device0 5 | 6 | # types 7 | type 0 device 8 | type 1 host 9 | type 2 cluster 10 | 11 | # buckets 12 | host host0 { 13 | id -2 # do not change unnecessarily 14 | # weight 1.000 15 | alg straw 16 | hash 0 # rjenkins1 17 | item device0 weight 1.000 18 | } 19 | cluster cluster0 { 20 | id -1 # do not change unnecessarily 21 | # weight 1.000 22 | alg straw 23 | hash 0 # rjenkins1 24 | item host0 weight 1.000 25 | } 26 | 27 | # rules 28 | rule data { 29 | ruleset 0 30 | type replicated 31 | min_size 1 32 | max_size 10 33 | step take cluster0 34 | step chooseleaf firstn 0 type host 35 | step emit 36 | } 37 | rule metadata { 38 | ruleset 1 39 | type replicated 40 | min_size 1 41 | max_size 10 42 | step take cluster0 43 | step chooseleaf firstn 0 type host 44 | step emit 45 | } 46 | rule rbd { 47 | ruleset 2 48 | type replicated 49 | min_size 1 50 | max_size 10 51 | step take cluster0 52 | step chooseleaf firstn 0 type host 53 | step emit 54 | } 55 | 56 | # end crush map 57 | -------------------------------------------------------------------------------- /src/include/rados/librgw.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_LIBRGW_H 16 | #define CEPH_LIBRGW_H 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | class CephContext; 23 | typedef CephContext* librgw_t; 24 | int librgw_create(librgw_t *rgw, const char * const id); 25 | int librgw_acl_bin2xml(librgw_t rgw, const char *bin, int bin_len, char **xml); 26 | void librgw_free_xml(librgw_t rgw, char *xml); 27 | int librgw_acl_xml2bin(librgw_t rgw, const char *xml, char **bin, int *bin_len); 28 | void librgw_free_bin(librgw_t rgw, char *bin); 29 | void librgw_shutdown(librgw_t rgw); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/rgw/rgw_multi.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_RGW_MULTI_H 2 | #define CEPH_RGW_MULTI_H 3 | 4 | #include 5 | #include "rgw_xml.h" 6 | 7 | class RGWMultiCompleteUpload : public XMLObj 8 | { 9 | public: 10 | RGWMultiCompleteUpload() {} 11 | ~RGWMultiCompleteUpload() {} 12 | bool xml_end(const char *el); 13 | 14 | std::map parts; 15 | }; 16 | 17 | class RGWMultiPart : public XMLObj 18 | { 19 | string etag; 20 | int num; 21 | public: 22 | RGWMultiPart() : num(0) {} 23 | ~RGWMultiPart() {} 24 | bool xml_end(const char *el); 25 | 26 | string& get_etag() { return etag; } 27 | int get_num() { return num; } 28 | }; 29 | 30 | class RGWMultiPartNumber : public XMLObj 31 | { 32 | public: 33 | RGWMultiPartNumber() {} 34 | ~RGWMultiPartNumber() {} 35 | }; 36 | 37 | class RGWMultiETag : public XMLObj 38 | { 39 | public: 40 | RGWMultiETag() {} 41 | ~RGWMultiETag() {} 42 | }; 43 | 44 | class RGWMultiXMLParser : public RGWXMLParser 45 | { 46 | XMLObj *alloc_obj(const char *el); 47 | public: 48 | RGWMultiXMLParser() {} 49 | ~RGWMultiXMLParser() {} 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/common/version.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #include "acconfig.h" 16 | #include "ceph_ver.h" 17 | #include "common/version.h" 18 | 19 | #include 20 | #include 21 | 22 | #define _STR(x) #x 23 | #define STRINGIFY(x) _STR(x) 24 | 25 | const char *ceph_version_to_str(void) 26 | { 27 | return CEPH_GIT_NICE_VER; 28 | } 29 | 30 | const char *git_version_to_str(void) 31 | { 32 | return STRINGIFY(CEPH_GIT_VER); 33 | } 34 | 35 | std::string const pretty_version_to_str(void) 36 | { 37 | std::ostringstream oss; 38 | oss << "ceph version " << CEPH_GIT_NICE_VER << " (" 39 | << STRINGIFY(CEPH_GIT_VER) << ")"; 40 | return oss.str(); 41 | } 42 | -------------------------------------------------------------------------------- /src/auth/cephx/CephxAuthorizeHandler.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2009 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_CEPHXAUTHORIZEHANDLER_H 16 | #define CEPH_CEPHXAUTHORIZEHANDLER_H 17 | 18 | #include "../AuthAuthorizeHandler.h" 19 | 20 | class CephContext; 21 | 22 | struct CephxAuthorizeHandler : public AuthAuthorizeHandler { 23 | bool verify_authorizer(CephContext *cct, KeyStore *keys, 24 | bufferlist& authorizer_data, bufferlist& authorizer_reply, 25 | EntityName& entity_name, uint64_t& global_id, 26 | AuthCapsInfo& caps_info, CryptoKey& session_key, uint64_t *auid = NULL); 27 | int authorizer_session_crypto(); 28 | }; 29 | 30 | 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/common/admin_socket_client.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_COMMON_ADMIN_SOCKET_CLIENT_H 16 | #define CEPH_COMMON_ADMIN_SOCKET_CLIENT_H 17 | 18 | #include 19 | #include 20 | 21 | /* This is a simple client that talks to an AdminSocket using blocking I/O. 22 | * We put a 5-second timeout on send and recv operations. 23 | */ 24 | class AdminSocketClient 25 | { 26 | public: 27 | AdminSocketClient(const std::string &path); 28 | std::string do_request(std::string request, std::string *result); 29 | std::string ping(bool *ok); 30 | private: 31 | std::string m_path; 32 | }; 33 | 34 | const char* get_rand_socket_path(); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/auth/none/AuthNoneAuthorizeHandler.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2009 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_AUTHNONEAUTHORIZEHANDLER_H 16 | #define CEPH_AUTHNONEAUTHORIZEHANDLER_H 17 | 18 | #include "../AuthAuthorizeHandler.h" 19 | 20 | class CephContext; 21 | 22 | struct AuthNoneAuthorizeHandler : public AuthAuthorizeHandler { 23 | bool verify_authorizer(CephContext *cct, KeyStore *keys, 24 | bufferlist& authorizer_data, bufferlist& authorizer_reply, 25 | EntityName& entity_name, uint64_t& global_id, 26 | AuthCapsInfo& caps_info, CryptoKey& session_key, uint64_t *auid=NULL); 27 | int authorizer_session_crypto(); 28 | }; 29 | 30 | 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/test/common/test_util.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU General Public 10 | * License version 2, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #include "include/util.h" 16 | #include "gtest/gtest.h" 17 | 18 | #include 19 | 20 | TEST(util, unit_to_bytesize) 21 | { 22 | ASSERT_EQ(1234ll, unit_to_bytesize("1234", &cerr)); 23 | ASSERT_EQ(1024ll, unit_to_bytesize("1K", &cerr)); 24 | ASSERT_EQ(1048576ll, unit_to_bytesize("1M", &cerr)); 25 | ASSERT_EQ(1073741824ll, unit_to_bytesize("1G", &cerr)); 26 | ASSERT_EQ(1099511627776ll, unit_to_bytesize("1T", &cerr)); 27 | ASSERT_EQ(1125899906842624ll, unit_to_bytesize("1P", &cerr)); 28 | ASSERT_EQ(1152921504606846976ll, unit_to_bytesize("1E", &cerr)); 29 | 30 | ASSERT_EQ(65536ll, unit_to_bytesize(" 64K", &cerr)); 31 | } 32 | -------------------------------------------------------------------------------- /src/test/cli/monmaptool/rm-nonexistent.t: -------------------------------------------------------------------------------- 1 | $ monmaptool --create --add foo 2.3.4.5:6789 mymonmap 2 | monmaptool: monmap file mymonmap 3 | monmaptool: generated fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re) 4 | monmaptool: writing epoch 0 to mymonmap (1 monitors) 5 | 6 | $ ORIG_FSID="$(monmaptool --print mymonmap|grep ^fsid)" 7 | 8 | $ monmaptool --rm doesnotexist mymonmap 9 | monmaptool: monmap file mymonmap 10 | monmaptool: removing doesnotexist 11 | monmaptool: map does not contain doesnotexist 12 | usage: [--print] [--create [--clobber][--fsid uuid]] [--generate] [--set-initial-members] [--add name 1.2.3.4:567] [--rm name] 13 | [1] 14 | 15 | $ monmaptool --print mymonmap 16 | monmaptool: monmap file mymonmap 17 | epoch 0 18 | fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re) 19 | last_changed \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re) 20 | created \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re) 21 | 0: 2.3.4.5:6789/0 mon.foo 22 | 23 | $ NEW_FSID="$(monmaptool --print mymonmap|grep ^fsid)" 24 | $ [ "$ORIG_FSID" = "$NEW_FSID" ] 25 | -------------------------------------------------------------------------------- /src/auth/unknown/AuthUnknownAuthorizeHandler.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2009 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_AUTHUNKNOWNAUTHORIZEHANDLER_H 16 | #define CEPH_AUTHUNKNOWNAUTHORIZEHANDLER_H 17 | 18 | #include "../AuthAuthorizeHandler.h" 19 | 20 | class CephContext; 21 | 22 | struct AuthUnknownAuthorizeHandler : public AuthAuthorizeHandler { 23 | bool verify_authorizer(CephContext *cct, KeyStore *keys, 24 | bufferlist& authorizer_data, bufferlist& authorizer_reply, 25 | EntityName& entity_name, uint64_t& global_id, 26 | AuthCapsInfo& caps_info, CryptoKey& session_key, uint64_t *auid=NULL); 27 | int authorizer_session_crypto(); 28 | }; 29 | 30 | 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/crush/sample.txt: -------------------------------------------------------------------------------- 1 | 2 | # devices 3 | device 1 osd001 4 | device 2 osd002 5 | device 3 osd003 down # same as offload 1.0 6 | device 4 osd004 offload 0 # 0.0 -> normal, 1.0 -> failed 7 | device 5 osd005 offload 0.1 8 | device 6 osd006 offload 0.1 9 | 10 | # hierarchy 11 | type 0 osd # 'device' is actually the default for 0 12 | type 2 cab 13 | type 3 row 14 | type 10 pool 15 | 16 | cab root { 17 | id -1 # optional 18 | alg tree # required 19 | item osd001 20 | item osd002 weight 600 pos 1 21 | item osd003 weight 600 pos 0 22 | item osd004 weight 600 pos 3 23 | item osd005 weight 600 pos 4 24 | } 25 | 26 | # rules 27 | rule normal { 28 | # these are required. 29 | pool 0 30 | type replicated 31 | min_size 1 32 | max_size 4 33 | # need 1 or more of these. 34 | step take root 35 | step choose firstn 0 type osd 36 | step emit 37 | } 38 | 39 | rule { 40 | pool 1 41 | type raid4 42 | min_size 3 43 | max_size 6 44 | step take root 45 | step choose indep 0 type osd 46 | step emit 47 | } 48 | -------------------------------------------------------------------------------- /src/messages/MGenericMessage.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2006 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | 16 | #ifndef CEPH_MGENERICMESSAGE_H 17 | #define CEPH_MGENERICMESSAGE_H 18 | 19 | #include "msg/Message.h" 20 | 21 | class MGenericMessage : public Message { 22 | char tname[20]; 23 | //long pcid; 24 | 25 | public: 26 | MGenericMessage(int t=0) : Message(t) { 27 | snprintf(tname, sizeof(tname), "generic%d", get_type()); 28 | } 29 | 30 | //void set_pcid(long pcid) { this->pcid = pcid; } 31 | //long get_pcid() { return pcid; } 32 | 33 | const char *get_type_name() const { return tname; } 34 | 35 | void decode_payload() { } 36 | void encode_payload(uint64_t features) { } 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/test/librados/cls.cc: -------------------------------------------------------------------------------- 1 | #include "include/rados/librados.h" 2 | #include "include/rados/librados.hpp" 3 | #include "test/librados/test.h" 4 | 5 | #include "gtest/gtest.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | using namespace librados; 12 | using ceph::buffer; 13 | using std::map; 14 | using std::ostringstream; 15 | using std::string; 16 | 17 | TEST(LibRadosCls, DNE) { 18 | Rados cluster; 19 | std::string pool_name = get_temp_pool_name(); 20 | ASSERT_EQ("", create_one_pool_pp(pool_name, cluster)); 21 | IoCtx ioctx; 22 | cluster.ioctx_create(pool_name.c_str(), ioctx); 23 | 24 | // create an object 25 | string oid = "foo"; 26 | bufferlist bl; 27 | ASSERT_EQ(0, ioctx.write(oid, bl, bl.length(), 0)); 28 | 29 | // call a bogus class 30 | ASSERT_EQ(-EOPNOTSUPP, ioctx.exec(oid, "doesnotexistasdfasdf", "method", bl, bl)); 31 | 32 | // call a bogus method on existent class 33 | ASSERT_EQ(-EOPNOTSUPP, ioctx.exec(oid, "lock", "doesnotexistasdfasdfasdf", bl, bl)); 34 | 35 | ioctx.close(); 36 | ASSERT_EQ(0, destroy_one_pool_pp(pool_name, cluster)); 37 | } 38 | -------------------------------------------------------------------------------- /src/auth/AuthClientHandler.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2009 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | 16 | #include 17 | 18 | #include "AuthClientHandler.h" 19 | #include "KeyRing.h" 20 | 21 | #include "messages/MAuth.h" 22 | #include "messages/MAuthReply.h" 23 | 24 | #include "cephx/CephxClientHandler.h" 25 | #include "none/AuthNoneClientHandler.h" 26 | 27 | AuthClientHandler *get_auth_client_handler(CephContext *cct, int proto, 28 | RotatingKeyRing *rkeys) 29 | { 30 | switch (proto) { 31 | case CEPH_AUTH_CEPHX: 32 | return new CephxClientHandler(cct, rkeys); 33 | case CEPH_AUTH_NONE: 34 | return new AuthNoneClientHandler(cct, rkeys); 35 | default: 36 | return NULL; 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/auth/AuthMethodList.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2009 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_AUTHMETHODLIST_H 16 | #define CEPH_AUTHMETHODLIST_H 17 | 18 | #include "include/inttypes.h" 19 | #include 20 | #include 21 | #include 22 | 23 | class CephContext; 24 | 25 | class AuthMethodList { 26 | std::list<__u32> auth_supported; 27 | public: 28 | AuthMethodList(CephContext *cct, std::string str); 29 | 30 | bool is_supported_auth(int auth_type); 31 | int pick(const std::set<__u32>& supported); 32 | 33 | const std::list<__u32>& get_supported_set() const { 34 | return auth_supported; 35 | } 36 | 37 | void remove_supported_auth(int auth_type); 38 | }; 39 | 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/mds/events/EResetJournal.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2006 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | 16 | #ifndef CEPH_MDS_ERESETJOURNAL_H 17 | #define CEPH_MDS_ERESETJOURNAL_H 18 | 19 | #include "../LogEvent.h" 20 | 21 | // generic log event 22 | class EResetJournal : public LogEvent { 23 | public: 24 | EResetJournal() : LogEvent(EVENT_RESETJOURNAL) { } 25 | ~EResetJournal() {} 26 | 27 | void encode(bufferlist& bl) const; 28 | void decode(bufferlist::iterator& bl); 29 | void dump(Formatter *f) const; 30 | static void generate_test_instances(list& ls); 31 | void print(ostream& out) const { 32 | out << "EResetJournal"; 33 | } 34 | 35 | void replay(MDS *mds); 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/test/cli/crushtool/simple.template.one: -------------------------------------------------------------------------------- 1 | # begin crush map 2 | 3 | # devices 4 | device 0 device0 5 | device 1 device1 6 | 7 | # types 8 | type 0 device 9 | type 1 host 10 | type 2 cluster 11 | 12 | # buckets 13 | host host0 { 14 | id -2 # do not change unnecessarily 15 | # weight 2.000 16 | alg straw 17 | hash 0 # rjenkins1 18 | item device0 weight 1.000 19 | item device1 weight 1.000 20 | } 21 | cluster cluster0 { 22 | id -1 # do not change unnecessarily 23 | # weight 2.000 24 | alg straw 25 | hash 0 # rjenkins1 26 | item host0 weight 2.000 27 | } 28 | 29 | # rules 30 | rule data { 31 | ruleset 0 32 | type replicated 33 | min_size 1 34 | max_size 10 35 | step take cluster0 36 | step chooseleaf firstn 0 type host 37 | step emit 38 | } 39 | rule metadata { 40 | ruleset 1 41 | type replicated 42 | min_size 1 43 | max_size 10 44 | step take cluster0 45 | step chooseleaf firstn 0 type host 46 | step emit 47 | } 48 | rule rbd { 49 | ruleset 2 50 | type replicated 51 | min_size 1 52 | max_size 10 53 | step take cluster0 54 | step chooseleaf firstn 0 type host 55 | step emit 56 | } 57 | 58 | # end crush map 59 | -------------------------------------------------------------------------------- /src/test/cli/crushtool/simple.template.two: -------------------------------------------------------------------------------- 1 | # begin crush map 2 | 3 | # devices 4 | device 0 device0 5 | device 1 device1 6 | 7 | # types 8 | type 0 device 9 | type 1 host 10 | type 2 cluster 11 | 12 | # buckets 13 | host host0 { 14 | id -2 # do not change unnecessarily 15 | # weight 2.000 16 | alg straw 17 | hash 0 # rjenkins1 18 | item device0 weight 1.000 19 | item device1 weight 1.000 20 | } 21 | cluster cluster0 { 22 | id -1 # do not change unnecessarily 23 | # weight 2.000 24 | alg straw 25 | hash 0 # rjenkins1 26 | item host0 weight 2.000 27 | } 28 | 29 | # rules 30 | rule data { 31 | ruleset 0 32 | type replicated 33 | min_size 1 34 | max_size 10 35 | step take cluster0 36 | step chooseleaf firstn 0 type host 37 | step emit 38 | } 39 | rule metadata { 40 | ruleset 1 41 | type replicated 42 | min_size 1 43 | max_size 10 44 | step take cluster0 45 | step chooseleaf firstn 0 type host 46 | step emit 47 | } 48 | rule rbd { 49 | ruleset 2 50 | type replicated 51 | min_size 1 52 | max_size 10 53 | step take cluster0 54 | step chooseleaf firstn 0 type host 55 | step emit 56 | } 57 | 58 | # end crush map 59 | -------------------------------------------------------------------------------- /src/gtest/xcode/Config/DebugProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // DebugProject.xcconfig 3 | // 4 | // These are Debug Configuration project settings for the gtest framework and 5 | // examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // No optimization 14 | GCC_OPTIMIZATION_LEVEL = 0 15 | 16 | // Deployment postprocessing is what triggers Xcode to strip, turn it off 17 | DEPLOYMENT_POSTPROCESSING = NO 18 | 19 | // Dead code stripping off 20 | DEAD_CODE_STRIPPING = NO 21 | 22 | // Debug symbols should be on obviously 23 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES 24 | 25 | // Define the DEBUG macro in all debug builds 26 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DDEBUG=1 27 | 28 | // These are turned off to avoid STL incompatibilities with client code 29 | // // Turns on special C++ STL checks to "encourage" good STL use 30 | // GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) _GLIBCXX_DEBUG_PEDANTIC _GLIBCXX_DEBUG _GLIBCPP_CONCEPT_CHECKS 31 | -------------------------------------------------------------------------------- /src/libs3/debian/control.dev: -------------------------------------------------------------------------------- 1 | Package: libs3-dev 2 | Version: LIBS3_VERSION 3 | Architecture: DEBIAN_ARCHITECTURE 4 | Section: libdevel 5 | Priority: extra 6 | Depends: libs3 (>= LIBS3_VERSION) 7 | Maintainer: Bryan Ischo 8 | Homepage: http://libs3.ischo.com/index.html 9 | Description: C Development Library for Amazon S3 Access 10 | This library provides an API for using Amazon's S3 service (see 11 | http://s3.amazonaws.com). Its design goals are: 12 | . 13 | - To provide a simple and straightforward API for accessing all of S3's 14 | functionality 15 | - To not require the developer using libs3 to need to know anything about: 16 | - HTTP 17 | - XML 18 | - SSL 19 | In other words, this API is meant to stand on its own, without requiring 20 | any implicit knowledge of how S3 services are accessed using HTTP 21 | protocols. 22 | - To be usable from multithreaded code 23 | - To be usable by code which wants to process multiple S3 requests 24 | simultaneously from a single thread 25 | - To be usable in the simple, straightforward way using sequentialized 26 | blocking requests 27 | -------------------------------------------------------------------------------- /src/rgw/rgw_client_io.cc: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | 6 | #include "rgw_client_io.h" 7 | 8 | 9 | int RGWClientIO::print(const char *format, ...) 10 | { 11 | #define LARGE_ENOUGH 128 12 | int size = LARGE_ENOUGH; 13 | 14 | va_list ap; 15 | 16 | while(1) { 17 | char buf[size]; 18 | va_start(ap, format); 19 | int ret = vsnprintf(buf, size, format, ap); 20 | va_end(ap); 21 | 22 | if (ret >= 0 && ret < size) { 23 | return write(buf, ret); 24 | } 25 | 26 | if (ret >= 0) 27 | size = ret + 1; 28 | else 29 | size *= 2; 30 | } 31 | 32 | /* not reachable */ 33 | } 34 | 35 | int RGWClientIO::write(const char *buf, int len) 36 | { 37 | int ret = write_data(buf, len); 38 | if (ret < 0) 39 | return ret; 40 | 41 | if (account) 42 | bytes_sent += len; 43 | 44 | return 0; 45 | } 46 | 47 | 48 | int RGWClientIO::read(char *buf, int max, int *actual) 49 | { 50 | int ret = read_data(buf, max); 51 | if (ret < 0) 52 | return ret; 53 | 54 | *actual = ret; 55 | 56 | bytes_received += *actual; 57 | 58 | return 0; 59 | } 60 | -------------------------------------------------------------------------------- /src/test/cli/crushtool/simple.template.three: -------------------------------------------------------------------------------- 1 | # begin crush map 2 | 3 | # devices 4 | device 0 device0 5 | device 1 device1 6 | 7 | # types 8 | type 0 device 9 | type 1 host 10 | type 2 cluster 11 | 12 | # buckets 13 | host host0 { 14 | id -2 # do not change unnecessarily 15 | # weight 2.000 16 | alg straw 17 | hash 0 # rjenkins1 18 | item device0 weight 1.000 19 | item device1 weight 1.000 20 | } 21 | cluster cluster0 { 22 | id -1 # do not change unnecessarily 23 | # weight 2.000 24 | alg straw 25 | hash 0 # rjenkins1 26 | item host0 weight 2.000 27 | } 28 | 29 | # rules 30 | rule data { 31 | ruleset 0 32 | type replicated 33 | min_size 1 34 | max_size 10 35 | step take cluster0 36 | step chooseleaf firstn 0 type host 37 | step emit 38 | } 39 | rule metadata { 40 | ruleset 1 41 | type replicated 42 | min_size 1 43 | max_size 10 44 | step take cluster0 45 | step chooseleaf firstn 0 type host 46 | step emit 47 | } 48 | rule rbd { 49 | ruleset 2 50 | type replicated 51 | min_size 1 52 | max_size 10 53 | step take cluster0 54 | step chooseleaf firstn 0 type host 55 | step emit 56 | } 57 | 58 | # end crush map 59 | -------------------------------------------------------------------------------- /src/common/environment.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #include "common/environment.h" 16 | 17 | #include 18 | #include 19 | 20 | bool get_env_bool(const char *key) 21 | { 22 | const char *val = getenv(key); 23 | if (!val) 24 | return false; 25 | if (strcasecmp(val, "off") == 0) 26 | return false; 27 | if (strcasecmp(val, "no") == 0) 28 | return false; 29 | if (strcasecmp(val, "false") == 0) 30 | return false; 31 | if (strcasecmp(val, "0") == 0) 32 | return false; 33 | return true; 34 | } 35 | 36 | int get_env_int(const char *key) 37 | { 38 | const char *val = getenv(key); 39 | if (!val) 40 | return 0; 41 | int v = atoi(val); 42 | return v; 43 | } 44 | -------------------------------------------------------------------------------- /src/client/ClientSnapRealm.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | 4 | #include "ClientSnapRealm.h" 5 | #include "common/Formatter.h" 6 | 7 | void SnapRealm::dump(Formatter *f) const 8 | { 9 | f->dump_stream("ino") << ino; 10 | f->dump_int("nref", nref); 11 | f->dump_stream("created") << created; 12 | f->dump_stream("seq") << seq; 13 | f->dump_stream("parent_ino") << parent; 14 | f->dump_stream("parent_since") << parent_since; 15 | 16 | f->open_array_section("prior_parent_snaps"); 17 | for (vector::const_iterator p = prior_parent_snaps.begin(); p != prior_parent_snaps.end(); ++p) 18 | f->dump_stream("snapid") << *p; 19 | f->close_section(); 20 | f->open_array_section("my_snaps"); 21 | for (vector::const_iterator p = my_snaps.begin(); p != my_snaps.end(); ++p) 22 | f->dump_stream("snapid") << *p; 23 | f->close_section(); 24 | 25 | f->open_array_section("children"); 26 | for (set::const_iterator p = pchildren.begin(); p != pchildren.end(); ++p) 27 | f->dump_stream("child") << (*p)->ino; 28 | f->close_section(); 29 | } 30 | -------------------------------------------------------------------------------- /src/common/pipe.c: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #include "common/pipe.h" 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | int pipe_cloexec(int pipefd[2]) 22 | { 23 | #if defined(O_CLOEXEC) && !defined(__FreeBSD__) 24 | int ret; 25 | ret = pipe2(pipefd, O_CLOEXEC); 26 | if (ret) { 27 | ret = -errno; 28 | return ret; 29 | } 30 | return 0; 31 | #else 32 | /* The old-fashioned, race-condition prone way that we have to fall back on if 33 | * O_CLOEXEC does not exist. */ 34 | int ret = pipe(pipefd); 35 | if (ret) { 36 | ret = -errno; 37 | return ret; 38 | } 39 | fcntl(pipefd[0], F_SETFD, FD_CLOEXEC); 40 | fcntl(pipefd[1], F_SETFD, FD_CLOEXEC); 41 | return 0; 42 | #endif 43 | } 44 | -------------------------------------------------------------------------------- /src/gtest/xcode/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.${PRODUCT_NAME} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | GTEST_VERSIONINFO_LONG 21 | CFBundleShortVersionString 22 | GTEST_VERSIONINFO_SHORT 23 | CFBundleGetInfoString 24 | ${PRODUCT_NAME} GTEST_VERSIONINFO_LONG, ${GTEST_VERSIONINFO_ABOUT} 25 | NSHumanReadableCopyright 26 | ${GTEST_VERSIONINFO_ABOUT} 27 | CSResourcesFileMapped 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/rgw/rgw_multi_del.h: -------------------------------------------------------------------------------- 1 | #ifndef RGW_MULTI_DELETE_H_ 2 | #define RGW_MULTI_DELETE_H_ 3 | 4 | #include 5 | #include "rgw_xml.h" 6 | 7 | class RGWMultiDelDelete : public XMLObj 8 | { 9 | public: 10 | RGWMultiDelDelete() :quiet(false) {} 11 | ~RGWMultiDelDelete() {} 12 | bool xml_end(const char *el); 13 | 14 | std::vector objects; 15 | bool quiet; 16 | bool is_quiet() { return quiet; }; 17 | }; 18 | 19 | class RGWMultiDelQuiet : public XMLObj 20 | { 21 | public: 22 | RGWMultiDelQuiet() {} 23 | ~RGWMultiDelQuiet() {} 24 | }; 25 | 26 | class RGWMultiDelObject : public XMLObj 27 | { 28 | string key; 29 | string versionID; 30 | public: 31 | RGWMultiDelObject() {} 32 | ~RGWMultiDelObject() {} 33 | bool xml_end(const char *el); 34 | 35 | string get_key() { return key; } 36 | }; 37 | 38 | class RGWMultiDelKey : public XMLObj 39 | { 40 | public: 41 | RGWMultiDelKey() {} 42 | ~RGWMultiDelKey() {} 43 | }; 44 | 45 | class RGWMultiDelXMLParser : public RGWXMLParser 46 | { 47 | XMLObj *alloc_obj(const char *el); 48 | public: 49 | RGWMultiDelXMLParser() {} 50 | ~RGWMultiDelXMLParser() {} 51 | }; 52 | 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/test/system/cross_process_sem.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | struct cross_process_sem_data_t; 16 | 17 | class CrossProcessSem 18 | { 19 | public: 20 | static int create(int initial_val, CrossProcessSem** ret); 21 | ~CrossProcessSem(); 22 | 23 | /* Initialize the semaphore. Must be called before any operations */ 24 | int init(); 25 | 26 | /* Semaphore wait */ 27 | void wait(); 28 | 29 | /* Semaphore post */ 30 | void post(); 31 | 32 | /* Reinitialize the semaphore to the desired value. 33 | * NOT thread-safe if it is in use at the time! 34 | */ 35 | int reinit(int dval); 36 | 37 | private: 38 | CrossProcessSem(struct cross_process_sem_data_t *data); 39 | struct cross_process_sem_data_t *m_data; 40 | }; 41 | -------------------------------------------------------------------------------- /m4/ac_prog_javah.m4: -------------------------------------------------------------------------------- 1 | dnl @synopsis AC_PROG_JAVAH 2 | dnl 3 | dnl AC_PROG_JAVAH tests the availability of the javah header generator 4 | dnl and looks for the jni.h header file. If available, JAVAH is set to 5 | dnl the full path of javah and CPPFLAGS is updated accordingly. 6 | dnl 7 | dnl @category Java 8 | dnl @author Luc Maisonobe 9 | dnl @version 2002-03-25 10 | dnl @license AllPermissive 11 | 12 | AC_DEFUN([AC_PROG_JAVAH],[ 13 | AC_REQUIRE([AC_CANONICAL_TARGET])dnl 14 | AC_REQUIRE([AC_PROG_CPP])dnl 15 | AC_PATH_PROG(JAVAH,javah) 16 | if test x"`eval 'echo $ac_cv_path_JAVAH'`" != x ; then 17 | AC_TRY_CPP([#include ],,[ 18 | ac_save_CPPFLAGS="$CPPFLAGS" 19 | changequote(, )dnl 20 | ac_dir=`echo $ac_cv_path_JAVAH | sed 's,\(.*\)/[^/]*/[^/]*$,\1/include,'` 21 | ac_machdep=`echo $build_os | sed 's,[-0-9].*,,' | sed 's,cygwin,win32,'` 22 | changequote([, ])dnl 23 | CPPFLAGS="$ac_save_CPPFLAGS -I$ac_dir -I$ac_dir/$ac_machdep" 24 | AC_TRY_CPP([#include ], 25 | ac_save_CPPFLAGS="$CPPFLAGS", 26 | AC_MSG_WARN([unable to include ])) 27 | CPPFLAGS="$ac_save_CPPFLAGS"]) 28 | fi]) 29 | -------------------------------------------------------------------------------- /src/common/simple_spin.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #include "common/simple_spin.h" 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | static uint32_t bar = 13; 22 | static uint32_t *foo = &bar; 23 | 24 | void simple_spin_lock(simple_spinlock_t *lock) 25 | { 26 | while(1) { 27 | __sync_synchronize(); 28 | uint32_t oldval = *lock; 29 | if (oldval == 0) { 30 | if (__sync_bool_compare_and_swap(lock, 0, 1)) 31 | return; 32 | } 33 | // delay 34 | for (int i = 0; i < 100000; i++) { 35 | *foo = (*foo * 33) + 17; 36 | } 37 | } 38 | } 39 | 40 | void simple_spin_unlock(simple_spinlock_t *lock) 41 | { 42 | __sync_bool_compare_and_swap(lock, 1, 0); 43 | } 44 | -------------------------------------------------------------------------------- /src/gtest/xcode/Config/ReleaseProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // ReleaseProject.xcconfig 3 | // 4 | // These are Release Configuration project settings for the gtest framework 5 | // and examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // subconfig/Release.xcconfig 14 | 15 | // Optimize for space and size (Apple recommendation) 16 | GCC_OPTIMIZATION_LEVEL = s 17 | 18 | // Deploment postprocessing is what triggers Xcode to strip 19 | DEPLOYMENT_POSTPROCESSING = YES 20 | 21 | // No symbols 22 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO 23 | 24 | // Dead code strip does not affect ObjC code but can help for C 25 | DEAD_CODE_STRIPPING = YES 26 | 27 | // NDEBUG is used by things like assert.h, so define it for general compat. 28 | // ASSERT going away in release tends to create unused vars. 29 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DNDEBUG=1 -Wno-unused-variable 30 | 31 | // When we strip we want to strip all symbols in release, but save externals. 32 | STRIP_STYLE = all 33 | -------------------------------------------------------------------------------- /src/crush/CrushWrapper.i: -------------------------------------------------------------------------------- 1 | /* File : CrushWrapper.i */ 2 | %module CrushWrapper 3 | %{ 4 | #include "CrushWrapper.h" 5 | %} 6 | 7 | %include typemaps.i 8 | 9 | // This tells SWIG to treat 'int *data' as a special case 10 | %typemap(in) int *items { 11 | AV *tempav; 12 | I32 len; 13 | int i; 14 | SV **tv; 15 | // int view; 16 | 17 | 18 | //printf("typemap\n"); 19 | 20 | if (!SvROK($input)) 21 | croak("$input is not a reference."); 22 | if (SvTYPE(SvRV($input)) != SVt_PVAV) 23 | croak("$input is not an array."); 24 | 25 | tempav = (AV*)SvRV($input); 26 | len = av_len(tempav); 27 | //printf("typemap len: %i\n",len); 28 | $1 = (int *) malloc((len+1)*sizeof(int)); 29 | for (i = 0; i <= len; i++) { 30 | tv = av_fetch(tempav, i, 0); 31 | $1[i] = (int) SvIV(*tv); 32 | 33 | /* 34 | view = SvIV(*tv); 35 | printf("view: %d",view); 36 | printf("\n"); 37 | */ 38 | } 39 | } 40 | 41 | %apply int *items { int *weights }; 42 | %apply double *OUTPUT { double *min, double *max, double *avg }; 43 | 44 | /* Let's just grab the original header file here */ 45 | %include "CrushWrapper.h" 46 | 47 | %clear double *min, double *max, double *avg; 48 | -------------------------------------------------------------------------------- /src/perfglue/disabled_heap_profiler.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network/Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | #include "heap_profiler.h" 15 | 16 | bool ceph_using_tcmalloc() { return false; } 17 | 18 | void ceph_heap_profiler_init() { return; } 19 | 20 | void ceph_heap_profiler_stats(char *buf, int length) { return; } 21 | 22 | void ceph_heap_release_free_memory() { return; } 23 | 24 | bool ceph_heap_profiler_running() { return false; } 25 | 26 | void ceph_heap_profiler_start() { return; } 27 | 28 | void ceph_heap_profiler_stop() { return; } 29 | 30 | void ceph_heap_profiler_dump(const char *reason) { return; } 31 | 32 | void ceph_heap_profiler_handle_command(const std::vector& cmd, 33 | ostream& out) { return; } 34 | -------------------------------------------------------------------------------- /src/client/MetaSession.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | 4 | #include "include/types.h" 5 | 6 | #include "MetaSession.h" 7 | 8 | #include "common/Formatter.h" 9 | 10 | const char *MetaSession::get_state_name() const 11 | { 12 | switch (state) { 13 | case STATE_NEW: return "new"; 14 | case STATE_OPENING: return "opening"; 15 | case STATE_OPEN: return "open"; 16 | case STATE_CLOSING: return "closing"; 17 | case STATE_CLOSED: return "closed"; 18 | case STATE_STALE: return "stale"; 19 | default: return "unknown"; 20 | } 21 | } 22 | 23 | void MetaSession::dump(Formatter *f) const 24 | { 25 | f->dump_int("mds", mds_num); 26 | f->dump_stream("addr") << inst.addr; 27 | f->dump_unsigned("seq", seq); 28 | f->dump_unsigned("cap_gen", cap_gen); 29 | f->dump_stream("cap_ttl") << cap_ttl; 30 | f->dump_stream("last_cap_renew_request") << last_cap_renew_request; 31 | f->dump_unsigned("cap_renew_seq", cap_renew_seq); 32 | f->dump_int("num_caps", num_caps); 33 | f->dump_string("state", get_state_name()); 34 | } 35 | 36 | MetaSession::~MetaSession() 37 | { 38 | if (release) 39 | release->put(); 40 | } 41 | -------------------------------------------------------------------------------- /src/common/hex.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2008-2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #include "common/debug.h" 16 | #include "common/hex.h" 17 | 18 | #include 19 | #include 20 | 21 | void hex2str(const char *s, int len, char *buf, int dest_len) 22 | { 23 | int pos = 0; 24 | for (int i=0; i 15 | [1] 16 | 17 | $ monmaptool --print mymonmap 18 | monmaptool: monmap file mymonmap 19 | epoch 0 20 | fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re) 21 | last_changed \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re) 22 | created \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re) 23 | 0: 2.3.4.5:6789/0 mon.foo 24 | 25 | $ NEW_FSID="$(monmaptool --print mymonmap|grep ^fsid)" 26 | $ [ "$ORIG_FSID" = "$NEW_FSID" ] 27 | -------------------------------------------------------------------------------- /src/osd/Ager.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | #ifndef CEPH_AGER_H 4 | #define CEPH_AGER_H 5 | 6 | #include "include/types.h" 7 | #include "include/Distribution.h" 8 | #include "os/ObjectStore.h" 9 | #include "common/Clock.h" 10 | 11 | #include 12 | #include 13 | using namespace std; 14 | 15 | class Ager { 16 | ObjectStore *store; 17 | 18 | private: 19 | list age_free_oids; 20 | file_object_t age_cur_oid; 21 | vector< list > age_objects; 22 | Distribution file_size_distn; //kb 23 | bool did_distn; 24 | 25 | void age_empty(float pc); 26 | uint64_t age_fill(float pc, utime_t until); 27 | ssize_t age_pick_size(); 28 | file_object_t age_get_oid(); 29 | 30 | public: 31 | Ager(ObjectStore *s) : store(s), did_distn(false) {} 32 | 33 | void age(int time, 34 | float high_water, // fill to this % 35 | float low_water, // then empty to this % 36 | int count, // this many times 37 | float final_water, // and end here ( <= low_water) 38 | int fake_size_mb=0); 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/include/error.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2006 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | 16 | #include 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | #define SYSERROR() syserror("At %s:%d", __FILE__, __LINE__) 23 | 24 | #define ASSERT(c) \ 25 | ((c) || (exiterror("Assertion failed at %s:%d", __FILE__, __LINE__), 1)) 26 | 27 | /* print usage error message and exit */ 28 | extern void userror(const char *use, const char *fmt, ...); 29 | 30 | /* print system error message and exit */ 31 | extern void syserror(const char *fmt, ...); 32 | 33 | /* print error message and exit */ 34 | extern void exiterror(const char *fmt, ...); 35 | 36 | /* print error message */ 37 | extern void error(const char *fmt, ...); 38 | 39 | #ifdef __cplusplus 40 | } // extern "C" 41 | #endif 42 | -------------------------------------------------------------------------------- /src/rgw/rgw_rest_conn.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_RGW_REST_CONN_H 2 | #define CEPH_RGW_REST_CONN_H 3 | 4 | #include "rgw_rest_client.h" 5 | 6 | class CephContext; 7 | class RGWRados; 8 | class RGWGetObjData; 9 | 10 | class RGWRESTConn 11 | { 12 | CephContext *cct; 13 | map endpoints; 14 | RGWAccessKey key; 15 | string region; 16 | atomic_t counter; 17 | public: 18 | 19 | RGWRESTConn(CephContext *_cct, RGWRados *store, list& endpoints); 20 | int get_url(string& endpoint); 21 | 22 | /* sync request */ 23 | int forward(const string& uid, req_info& info, obj_version *objv, size_t max_response, bufferlist *inbl, bufferlist *outbl); 24 | 25 | /* async request */ 26 | int put_obj_init(const string& uid, rgw_obj& obj, uint64_t obj_size, 27 | map& attrs, RGWRESTStreamWriteRequest **req); 28 | int complete_request(RGWRESTStreamWriteRequest *req, string& etag, time_t *mtime); 29 | 30 | int get_obj(const string& uid, req_info *info /* optional */, rgw_obj& obj, bool prepend_metadata, RGWGetDataCB *cb, RGWRESTStreamReadRequest **req); 31 | int complete_request(RGWRESTStreamReadRequest *req, string& etag, time_t *mtime, map& attrs); 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/cls/statelog/cls_statelog_types.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_CLS_STATELOG_TYPES_H 2 | #define CEPH_CLS_STATELOG_TYPES_H 3 | 4 | #include "include/encoding.h" 5 | #include "include/types.h" 6 | 7 | #include "include/utime.h" 8 | 9 | class JSONObj; 10 | 11 | struct cls_statelog_entry { 12 | string client_id; 13 | string op_id; 14 | string object; 15 | utime_t timestamp; 16 | bufferlist data; 17 | uint32_t state; /* user defined state */ 18 | 19 | cls_statelog_entry() {} 20 | 21 | void encode(bufferlist& bl) const { 22 | ENCODE_START(1, 1, bl); 23 | ::encode(client_id, bl); 24 | ::encode(op_id, bl); 25 | ::encode(object, bl); 26 | ::encode(timestamp, bl); 27 | ::encode(data, bl); 28 | ::encode(state, bl); 29 | ENCODE_FINISH(bl); 30 | } 31 | 32 | void decode(bufferlist::iterator& bl) { 33 | DECODE_START(1, bl); 34 | ::decode(client_id, bl); 35 | ::decode(op_id, bl); 36 | ::decode(object, bl); 37 | ::decode(timestamp, bl); 38 | ::decode(data, bl); 39 | ::decode(state, bl); 40 | DECODE_FINISH(bl); 41 | } 42 | 43 | void dump(Formatter *f) const; 44 | void decode_json(JSONObj *obj); 45 | }; 46 | WRITE_CLASS_ENCODER(cls_statelog_entry) 47 | 48 | 49 | #endif 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/mds/events/ECommitted.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2006 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_MDS_ECOMMITTED_H 16 | #define CEPH_MDS_ECOMMITTED_H 17 | 18 | #include "../LogEvent.h" 19 | #include "EMetaBlob.h" 20 | 21 | class ECommitted : public LogEvent { 22 | public: 23 | metareqid_t reqid; 24 | 25 | ECommitted() : LogEvent(EVENT_COMMITTED) { } 26 | ECommitted(metareqid_t r) : 27 | LogEvent(EVENT_COMMITTED), reqid(r) { } 28 | 29 | void print(ostream& out) const { 30 | out << "ECommitted " << reqid; 31 | } 32 | 33 | void encode(bufferlist &bl) const; 34 | void decode(bufferlist::iterator &bl); 35 | void dump(Formatter *f) const; 36 | static void generate_test_instances(list& ls); 37 | 38 | void update_segment() {} 39 | void replay(MDS *mds); 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/test/test_cfuse_cache_invalidate.cc: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define REGION 1048576 13 | int main(int argc, char *argv[]) { 14 | 15 | pid_t p = fork(); 16 | char buf[REGION]; 17 | memset(buf, 0, sizeof(buf)); 18 | 19 | if (p != 0) { 20 | int done = 0; 21 | int fd = open(argv[1], O_RDWR|O_CREAT, 0644); 22 | if (fd < 0) { 23 | perror(argv[1]); 24 | return 1; 25 | } 26 | 27 | int i = 0; 28 | while(!done) { 29 | printf("writing %d\n", i++); 30 | assert(pwrite(fd, buf, REGION, 0) == REGION); 31 | int status; 32 | int ret = waitpid(p, &status, WNOHANG); 33 | assert(ret >= 0); 34 | if (ret > 0) { 35 | done = 1; 36 | } 37 | } 38 | close(fd); 39 | } else { 40 | sleep(1); 41 | int fd = open(argv[2], O_RDONLY, 0644); 42 | if (fd < 0) { 43 | perror(argv[2]); 44 | return 1; 45 | } 46 | 47 | printf("reading\n"); 48 | assert(pread(fd, buf, REGION, 0) == REGION); 49 | close(fd); 50 | } 51 | 52 | return 0; 53 | } 54 | -------------------------------------------------------------------------------- /src/common/io_priority.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2012 Red Hat 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_COMMON_IO_PRIORITY_H 16 | #define CEPH_COMMON_IO_PRIORITY_H 17 | 18 | #include 19 | 20 | extern pid_t ceph_gettid(); 21 | 22 | #ifndef IOPRIO_WHO_PROCESS 23 | # define IOPRIO_WHO_PROCESS 1 24 | #endif 25 | #ifndef IOPRIO_PRIO_VALUE 26 | # define IOPRIO_CLASS_SHIFT 13 27 | # define IOPRIO_PRIO_VALUE(class, data) \ 28 | (((class) << IOPRIO_CLASS_SHIFT) | (data)) 29 | #endif 30 | #ifndef IOPRIO_CLASS_RT 31 | # define IOPRIO_CLASS_RT 1 32 | #endif 33 | #ifndef IOPRIO_CLASS_BE 34 | # define IOPRIO_CLASS_BE 2 35 | #endif 36 | #ifndef IOPRIO_CLASS_IDLE 37 | # define IOPRIO_CLASS_IDLE 3 38 | #endif 39 | 40 | extern int ceph_ioprio_set(int whence, int who, int ioprio); 41 | 42 | extern int ceph_ioprio_string_to_class(const std::string& s); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/perfglue/cpu_profiler.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #include "common/LogClient.h" 16 | #include "perfglue/cpu_profiler.h" 17 | 18 | #include 19 | 20 | void cpu_profiler_handle_command(const std::vector &cmd, 21 | ostream& out) 22 | { 23 | if (cmd[1] == "status") { 24 | ProfilerState st; 25 | ProfilerGetCurrentState(&st); 26 | out << "cpu_profiler " << (st.enabled ? "enabled":"not enabled") 27 | << " start_time " << st.start_time 28 | << " profile_name " << st.profile_name 29 | << " samples " << st.samples_gathered; 30 | } 31 | else if (cmd[1] == "flush") { 32 | ProfilerFlush(); 33 | out << "cpu_profiler: flushed"; 34 | } 35 | else { 36 | out << "cpu_profiler: unrecognized command " << cmd 37 | << "; expected one of status, flush."; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/include/str_list.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_STRLIST_H 2 | #define CEPH_STRLIST_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | extern void get_str_list(const std::string& str, 11 | std::list& str_list); 12 | extern void get_str_list(const std::string& str, 13 | const char *delims, 14 | std::list& str_list); 15 | extern void get_str_vec(const std::string& str, 16 | std::vector& str_vec); 17 | extern void get_str_vec(const std::string& str, 18 | const char *delims, 19 | std::vector& str_vec); 20 | extern void get_str_set(const std::string& str, 21 | std::set& str_list); 22 | extern void get_str_set(const std::string& str, 23 | const char *delims, 24 | std::set& str_list); 25 | 26 | inline std::string str_join(const std::vector& v, std::string sep) 27 | { 28 | if (v.empty()) 29 | return std::string(); 30 | std::vector::const_iterator i = v.begin(); 31 | std::string r = *i; 32 | for (++i; i != v.end(); ++i) { 33 | r += sep; 34 | r += *i; 35 | } 36 | return r; 37 | } 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/test/heartbeat_map.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #include "common/Mutex.h" 16 | #include "common/HeartbeatMap.h" 17 | #include "common/ceph_context.h" 18 | #include "test/unit.h" 19 | #include "common/config.h" 20 | 21 | using namespace ceph; 22 | 23 | TEST(HeartbeatMap, Healthy) { 24 | HeartbeatMap hm(g_ceph_context); 25 | heartbeat_handle_d *h = hm.add_worker("one"); 26 | 27 | hm.reset_timeout(h, 9, 18); 28 | bool healthy = hm.is_healthy(); 29 | ASSERT_EQ(healthy, true); 30 | 31 | hm.remove_worker(h); 32 | } 33 | 34 | TEST(HeartbeatMap, Unhealth) { 35 | HeartbeatMap hm(g_ceph_context); 36 | heartbeat_handle_d *h = hm.add_worker("one"); 37 | 38 | hm.reset_timeout(h, 1, 3); 39 | sleep(2); 40 | bool healthy = hm.is_healthy(); 41 | ASSERT_EQ(healthy, false); 42 | 43 | hm.remove_worker(h); 44 | } 45 | -------------------------------------------------------------------------------- /src/auth/unknown/AuthUnknownAuthorizeHandler.cc: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2009-2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #include "AuthUnknownAuthorizeHandler.h" 16 | #include "common/debug.h" 17 | 18 | #define dout_subsys ceph_subsys_auth 19 | 20 | bool AuthUnknownAuthorizeHandler::verify_authorizer(CephContext *cct, KeyStore *keys, 21 | bufferlist& authorizer_data, bufferlist& authorizer_reply, 22 | EntityName& entity_name, uint64_t& global_id, AuthCapsInfo& caps_info, CryptoKey& session_key, 23 | uint64_t *auid) 24 | { 25 | // For unknown authorizers, there's nothing to verify. They're "OK" by definition. PLR 26 | 27 | return true; 28 | } 29 | 30 | // Return type of crypto used for this session's data; for unknown, no crypt used 31 | 32 | int AuthUnknownAuthorizeHandler::authorizer_session_crypto() 33 | { 34 | return SESSION_CRYPTO_NONE; 35 | } 36 | -------------------------------------------------------------------------------- /src/messages/MPGStatsAck.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2006 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_MPGSTATSACK_H 16 | #define CEPH_MPGSTATSACK_H 17 | 18 | #include "osd/osd_types.h" 19 | 20 | class MPGStatsAck : public Message { 21 | public: 22 | map > pg_stat; 23 | 24 | MPGStatsAck() : Message(MSG_PGSTATSACK) {} 25 | 26 | private: 27 | ~MPGStatsAck() {} 28 | 29 | public: 30 | const char *get_type_name() const { return "pg_stats_ack"; } 31 | void print(ostream& out) const { 32 | out << "pg_stats_ack(" << pg_stat.size() << " pgs tid " << get_tid() << ")"; 33 | } 34 | 35 | void encode_payload(uint64_t features) { 36 | ::encode(pg_stat, payload); 37 | } 38 | void decode_payload() { 39 | bufferlist::iterator p = payload.begin(); 40 | ::decode(pg_stat, p); 41 | } 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/rgw/rgw_http_client.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_RGW_HTTP_CLIENT_H 2 | #define CEPH_RGW_HTTP_CLIENT_H 3 | 4 | #include "rgw_common.h" 5 | 6 | class RGWHTTPClient 7 | { 8 | bufferlist send_bl; 9 | bufferlist::iterator send_iter; 10 | size_t send_len; 11 | bool has_send_len; 12 | protected: 13 | CephContext *cct; 14 | 15 | list > headers; 16 | public: 17 | virtual ~RGWHTTPClient() {} 18 | RGWHTTPClient(CephContext *_cct): send_len (0), has_send_len(false), cct(_cct) {} 19 | 20 | void append_header(const string& name, const string& val) { 21 | headers.push_back(pair(name, val)); 22 | } 23 | 24 | virtual int receive_header(void *ptr, size_t len) = 0; 25 | virtual int receive_data(void *ptr, size_t len) = 0; 26 | virtual int send_data(void *ptr, size_t len) = 0; 27 | 28 | void set_send_length(size_t len) { 29 | send_len = len; 30 | has_send_len = true; 31 | } 32 | 33 | int process(const char *method, const char *url); 34 | int process(const char *url) { return process("GET", url); } 35 | 36 | int init_async(const char *method, const char *url, void **handle); 37 | int process_request(void *handle, bool wait_for_data, bool *done); 38 | int complete_request(void *handle); 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/test/system/st_rados_delete_pool.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef TEST_SYSTEM_ST_RADOS_DELETE_POOL_H 16 | #define TEST_SYSTEM_ST_RADOS_DELETE_POOL_H 17 | 18 | #include "systest_runnable.h" 19 | 20 | class CrossProcessSem; 21 | 22 | /* 23 | * st_rados_delete_pool 24 | * 25 | * Waits on pool_setup_sem, posts to it, 26 | * deletes a pool, and posts to delete_pool_sem. 27 | */ 28 | class StRadosDeletePool : public SysTestRunnable 29 | { 30 | public: 31 | StRadosDeletePool(int argc, const char **argv, 32 | CrossProcessSem *pool_setup_sem, 33 | CrossProcessSem *delete_pool_sem, 34 | const std::string &pool_name); 35 | ~StRadosDeletePool(); 36 | virtual int run(); 37 | private: 38 | CrossProcessSem *m_pool_setup_sem; 39 | CrossProcessSem *m_delete_pool_sem; 40 | std::string m_pool_name; 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/msg/Accepter.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2006 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_MSG_ACCEPTER_H 16 | #define CEPH_MSG_ACCEPTER_H 17 | 18 | #include "msg/msg_types.h" 19 | #include "common/Thread.h" 20 | 21 | class SimpleMessenger; 22 | 23 | /** 24 | * If the SimpleMessenger binds to a specific address, the Accepter runs 25 | * and listens for incoming connections. 26 | */ 27 | class Accepter : public Thread { 28 | SimpleMessenger *msgr; 29 | bool done; 30 | int listen_sd; 31 | uint64_t nonce; 32 | 33 | public: 34 | Accepter(SimpleMessenger *r, uint64_t n) : msgr(r), done(false), listen_sd(-1), nonce(n) {} 35 | 36 | void *entry(); 37 | void stop(); 38 | int bind(const entity_addr_t &bind_addr, const set& avoid_ports); 39 | int rebind(const set& avoid_port); 40 | int start(); 41 | }; 42 | 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/test/cli/monmaptool/add-many.t: -------------------------------------------------------------------------------- 1 | $ monmaptool --create mymonmap 2 | monmaptool: monmap file mymonmap 3 | monmaptool: generated fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re) 4 | monmaptool: writing epoch 0 to mymonmap (0 monitors) 5 | 6 | $ ORIG_FSID="$(monmaptool --print mymonmap|grep ^fsid)" 7 | 8 | $ monmaptool --add foo 2.3.4.5:6789 mymonmap 9 | monmaptool: monmap file mymonmap 10 | monmaptool: writing epoch 0 to mymonmap (1 monitors) 11 | $ monmaptool --add bar 3.4.5.6:7890 mymonmap 12 | monmaptool: monmap file mymonmap 13 | monmaptool: writing epoch 0 to mymonmap (2 monitors) 14 | $ monmaptool --add baz 4.5.6.7:8901 mymonmap 15 | monmaptool: monmap file mymonmap 16 | monmaptool: writing epoch 0 to mymonmap (3 monitors) 17 | 18 | $ monmaptool --print mymonmap 19 | monmaptool: monmap file mymonmap 20 | epoch 0 21 | fsid [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (re) 22 | last_changed \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re) 23 | created \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+ (re) 24 | 0: 2.3.4.5:6789/0 mon.foo 25 | 1: 3.4.5.6:7890/0 mon.bar 26 | 2: 4.5.6.7:8901/0 mon.baz 27 | 28 | $ NEW_FSID="$(monmaptool --print mymonmap|grep ^fsid)" 29 | $ [ "$ORIG_FSID" = "$NEW_FSID" ] 30 | -------------------------------------------------------------------------------- /src/include/blobhash.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | /* 3 | * Ceph - scalable distributed file system 4 | * 5 | * Copyright (C) 2004-2006 Sage Weil 6 | * 7 | * This is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License version 2.1, as published by the Free Software 10 | * Foundation. See file COPYING. 11 | * 12 | */ 13 | 14 | #ifndef CEPH_BLOBHASH_H 15 | #define CEPH_BLOBHASH_H 16 | 17 | #include "hash.h" 18 | 19 | /* 20 | - this is to make some of the STL types work with 64 bit values, string hash keys, etc. 21 | - added when i was using an old STL.. maybe try taking these out and see if things 22 | compile now? 23 | */ 24 | 25 | class blobhash { 26 | public: 27 | uint32_t operator()(const char *p, unsigned len) { 28 | static rjhash H; 29 | uint32_t acc = 0; 30 | while (len >= sizeof(acc)) { 31 | acc ^= *(uint32_t*)p; 32 | p += sizeof(uint32_t); 33 | len -= sizeof(uint32_t); 34 | } 35 | int sh = 0; 36 | while (len) { 37 | acc ^= (uint32_t)*p << sh; 38 | sh += 8; 39 | len--; 40 | p++; 41 | } 42 | return H(acc); 43 | } 44 | }; 45 | 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/test/cli/crushtool/simple.template.five: -------------------------------------------------------------------------------- 1 | # begin crush map 2 | 3 | # devices 4 | device 0 device0 5 | device 1 osd1 6 | 7 | # types 8 | type 0 device 9 | type 1 host 10 | type 2 cluster 11 | 12 | # buckets 13 | host host0 { 14 | id -2 # do not change unnecessarily 15 | # weight 1.000 16 | alg straw 17 | hash 0 # rjenkins1 18 | item device0 weight 1.000 19 | } 20 | host host1 { 21 | id -3 # do not change unnecessarily 22 | # weight 2.000 23 | alg straw 24 | hash 0 # rjenkins1 25 | item osd1 weight 2.000 26 | } 27 | cluster cluster0 { 28 | id -1 # do not change unnecessarily 29 | # weight 3.000 30 | alg straw 31 | hash 0 # rjenkins1 32 | item host0 weight 1.000 33 | item host1 weight 2.000 34 | } 35 | 36 | # rules 37 | rule data { 38 | ruleset 0 39 | type replicated 40 | min_size 1 41 | max_size 10 42 | step take cluster0 43 | step chooseleaf firstn 0 type host 44 | step emit 45 | } 46 | rule metadata { 47 | ruleset 1 48 | type replicated 49 | min_size 1 50 | max_size 10 51 | step take cluster0 52 | step chooseleaf firstn 0 type host 53 | step emit 54 | } 55 | rule rbd { 56 | ruleset 2 57 | type replicated 58 | min_size 1 59 | max_size 10 60 | step take cluster0 61 | step chooseleaf firstn 0 type host 62 | step emit 63 | } 64 | 65 | # end crush map 66 | -------------------------------------------------------------------------------- /src/messages/MMDSFindIno.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_MDSFINDINO_H 16 | #define CEPH_MDSFINDINO_H 17 | 18 | #include "msg/Message.h" 19 | #include "include/filepath.h" 20 | 21 | struct MMDSFindIno : public Message { 22 | tid_t tid; 23 | inodeno_t ino; 24 | 25 | MMDSFindIno() : Message(MSG_MDS_FINDINO) {} 26 | MMDSFindIno(tid_t t, inodeno_t i) : Message(MSG_MDS_FINDINO), tid(t), ino(i) {} 27 | 28 | const char *get_type_name() const { return "findino"; } 29 | void print(ostream &out) const { 30 | out << "findino(" << tid << " " << ino << ")"; 31 | } 32 | 33 | void encode_payload(uint64_t features) { 34 | ::encode(tid, payload); 35 | ::encode(ino, payload); 36 | } 37 | void decode_payload() { 38 | bufferlist::iterator p = payload.begin(); 39 | ::decode(tid, p); 40 | ::decode(ino, p); 41 | } 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/messages/MMonGlobalID.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2006 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_MMONGLOBALID_H 16 | #define CEPH_MMONGLOBALID_H 17 | 18 | #include "messages/PaxosServiceMessage.h" 19 | 20 | struct MMonGlobalID : public PaxosServiceMessage { 21 | uint64_t old_max_id; 22 | MMonGlobalID() : PaxosServiceMessage(MSG_MON_GLOBAL_ID, 0), old_max_id(0) { } 23 | private: 24 | ~MMonGlobalID() {} 25 | 26 | public: 27 | const char *get_type_name() const { return "global_id"; } 28 | void print(ostream& out) const { 29 | out << "global_id (" << old_max_id << ")"; 30 | } 31 | 32 | void decode_payload() { 33 | bufferlist::iterator p = payload.begin(); 34 | paxos_decode(p); 35 | ::decode(old_max_id, p); 36 | } 37 | void encode_payload(uint64_t features) { 38 | paxos_encode(); 39 | ::encode(old_max_id, payload); 40 | } 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/test/cli/crushtool/need_tree_order.crush: -------------------------------------------------------------------------------- 1 | # begin crush map 2 | 3 | # devices 4 | device 0 device0 5 | device 1 device1 6 | device 2 device2 7 | 8 | # types 9 | type 0 device 10 | type 1 host 11 | type 2 rack 12 | type 3 root 13 | 14 | # buckets 15 | host host0 { 16 | id -1 # do not change unnecessarily 17 | # weight 1.000 18 | alg straw 19 | hash 0 # rjenkins1 20 | item device0 weight 1.000 21 | } 22 | host host1 { 23 | id -2 # do not change unnecessarily 24 | # weight 1.000 25 | alg straw 26 | hash 0 # rjenkins1 27 | item device1 weight 1.000 28 | } 29 | host host2 { 30 | id -5 # do not change unnecessarily 31 | # weight 1.000 32 | alg straw 33 | hash 0 # rjenkins1 34 | item device2 weight 1.000 35 | } 36 | rack rack0 { 37 | id -3 # do not change unnecessarily 38 | # weight 3.000 39 | alg straw 40 | hash 0 # rjenkins1 41 | item host0 weight 1.000 42 | item host1 weight 1.000 43 | item host2 weight 1.000 44 | } 45 | root root { 46 | id -4 # do not change unnecessarily 47 | # weight 4.000 48 | alg straw 49 | hash 0 # rjenkins1 50 | item rack0 weight 4.000 51 | } 52 | 53 | # rules 54 | rule data { 55 | ruleset 1 56 | type replicated 57 | min_size 2 58 | max_size 2 59 | step take root 60 | step chooseleaf firstn 0 type rack 61 | step emit 62 | } 63 | 64 | # end crush map 65 | -------------------------------------------------------------------------------- /src/messages/MLogAck.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2006 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_MLOGACK_H 16 | #define CEPH_MLOGACK_H 17 | 18 | #include 19 | 20 | class MLogAck : public Message { 21 | public: 22 | uuid_d fsid; 23 | version_t last; 24 | 25 | MLogAck() : Message(MSG_LOGACK) {} 26 | MLogAck(uuid_d& f, version_t l) : Message(MSG_LOGACK), fsid(f), last(l) {} 27 | private: 28 | ~MLogAck() {} 29 | 30 | public: 31 | const char *get_type_name() const { return "log_ack"; } 32 | void print(ostream& out) const { 33 | out << "log(last " << last << ")"; 34 | } 35 | 36 | void encode_payload(uint64_t features) { 37 | ::encode(fsid, payload); 38 | ::encode(last, payload); 39 | } 40 | void decode_payload() { 41 | bufferlist::iterator p = payload.begin(); 42 | ::decode(fsid, p); 43 | ::decode(last, p); 44 | } 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /m4/ac_prog_javac_works.m4: -------------------------------------------------------------------------------- 1 | dnl @synopsis AC_PROG_JAVAC_WORKS 2 | dnl 3 | dnl Internal use ONLY. 4 | dnl 5 | dnl Note: This is part of the set of autoconf M4 macros for Java 6 | dnl programs. It is VERY IMPORTANT that you download the whole set, 7 | dnl some macros depend on other. Unfortunately, the autoconf archive 8 | dnl does not support the concept of set of macros, so I had to break it 9 | dnl for submission. The general documentation, as well as the sample 10 | dnl configure.in, is included in the AC_PROG_JAVA macro. 11 | dnl 12 | dnl @category Java 13 | dnl @author Stephane Bortzmeyer 14 | dnl @version 2000-07-19 15 | dnl @license GPLWithACException 16 | 17 | AC_DEFUN([AC_PROG_JAVAC_WORKS],[ 18 | AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [ 19 | JAVA_TEST=Test.java 20 | CLASS_TEST=Test.class 21 | cat << \EOF > $JAVA_TEST 22 | /* [#]line __oline__ "configure" */ 23 | public class Test { 24 | } 25 | EOF 26 | if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) >/dev/null 2>&1; then 27 | ac_cv_prog_javac_works=yes 28 | else 29 | AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)]) 30 | echo "configure: failed program was:" >&AC_FD_CC 31 | cat $JAVA_TEST >&AC_FD_CC 32 | fi 33 | rm -f $JAVA_TEST $CLASS_TEST 34 | ]) 35 | AC_PROVIDE([$0])dnl 36 | ]) 37 | -------------------------------------------------------------------------------- /src/common/code_environment.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2011 New Dream Network 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_COMMON_CODE_ENVIRONMENT_H 16 | #define CEPH_COMMON_CODE_ENVIRONMENT_H 17 | 18 | enum code_environment_t { 19 | CODE_ENVIRONMENT_UTILITY = 0, 20 | CODE_ENVIRONMENT_DAEMON = 1, 21 | CODE_ENVIRONMENT_LIBRARY = 2, 22 | }; 23 | 24 | #ifdef __cplusplus 25 | #include 26 | #include 27 | 28 | extern "C" code_environment_t g_code_env; 29 | extern "C" const char *code_environment_to_str(enum code_environment_t e); 30 | std::ostream &operator<<(std::ostream &oss, enum code_environment_t e); 31 | extern "C" int get_process_name(char *buf, int len); 32 | std::string get_process_name_cpp(); 33 | 34 | #else 35 | 36 | extern code_environment_t g_code_env; 37 | const char *code_environment_to_str(enum code_environment_t e); 38 | extern int get_process_name(char *buf, int len); 39 | 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/include/bitmapper.h: -------------------------------------------------------------------------------- 1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 2 | // vim: ts=8 sw=2 smarttab 3 | /* 4 | * Ceph - scalable distributed file system 5 | * 6 | * Copyright (C) 2004-2006 Sage Weil 7 | * 8 | * This is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU Lesser General Public 10 | * License version 2.1, as published by the Free Software 11 | * Foundation. See file COPYING. 12 | * 13 | */ 14 | 15 | #ifndef CEPH_BITMAPPER_H 16 | #define CEPH_BITMAPPER_H 17 | 18 | class bitmapper { 19 | char *_data; 20 | int _len; 21 | 22 | public: 23 | bitmapper() : _data(0), _len(0) { } 24 | bitmapper(char *data, int len) : _data(data), _len(len) { } 25 | 26 | void set_data(char *data, int len) { _data = data; _len = len; } 27 | 28 | int bytes() const { return _len; } 29 | int bits() const { return _len * 8; } 30 | 31 | bool operator[](int b) const { 32 | return get(b); 33 | } 34 | bool get(int b) const { 35 | return _data[b >> 3] & (1 << (b&7)); 36 | } 37 | void set(int b) { 38 | _data[b >> 3] |= 1 << (b&7); 39 | } 40 | void clear(int b) { 41 | _data[b >> 3] &= ~(1 << (b&7)); 42 | } 43 | void toggle(int b) { 44 | _data[b >> 3] ^= 1 << (b&7); 45 | } 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/test/cli/crushtool/simple.template.multitree: -------------------------------------------------------------------------------- 1 | # begin crush map 2 | 3 | # devices 4 | device 0 device0 5 | device 1 osd1 6 | 7 | # types 8 | type 0 device 9 | type 1 host 10 | type 2 cluster 11 | 12 | # buckets 13 | host host0 { 14 | # weight 1.000 15 | alg straw 16 | hash 0 # rjenkins1 17 | item device0 weight 1.000 18 | } 19 | host host1 { 20 | # weight 2.000 21 | alg straw 22 | hash 0 # rjenkins1 23 | item osd1 weight 2.000 24 | } 25 | cluster cluster0 { 26 | # weight 3.000 27 | alg straw 28 | hash 0 # rjenkins1 29 | item host0 weight 1.000 30 | item host1 weight 2.000 31 | } 32 | 33 | cluster cluster1 { 34 | # weight 3.000 35 | alg straw 36 | hash 0 # rjenkins1 37 | item host0 weight 1.000 38 | item host1 weight 2.000 39 | } 40 | 41 | # rules 42 | rule data { 43 | ruleset 0 44 | type replicated 45 | min_size 1 46 | max_size 10 47 | step take cluster0 48 | step chooseleaf firstn 0 type host 49 | step emit 50 | } 51 | rule metadata { 52 | ruleset 1 53 | type replicated 54 | min_size 1 55 | max_size 10 56 | step take cluster0 57 | step chooseleaf firstn 0 type host 58 | step emit 59 | } 60 | rule rbd { 61 | ruleset 2 62 | type replicated 63 | min_size 1 64 | max_size 10 65 | step take cluster1 66 | step chooseleaf firstn 0 type host 67 | step emit 68 | } 69 | 70 | # end crush map 71 | -------------------------------------------------------------------------------- /src/common/PrebufferedStreambuf.h: -------------------------------------------------------------------------------- 1 | #ifndef CEPH_COMMON_PREBUFFEREDSTREAMBUF_H 2 | #define CEPH_COMMON_PREBUFFEREDSTREAMBUF_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | /** 9 | * streambuf using existing buffer, overflowing into a std::string 10 | * 11 | * A simple streambuf that uses a preallocated buffer for small 12 | * strings, and overflows into a std::string when necessary. If the 13 | * preallocated buffer size is chosen well, we can optimize for the 14 | * common case and overflow to a slower heap-allocated buffer when 15 | * necessary. 16 | */ 17 | class PrebufferedStreambuf 18 | : public std::basic_streambuf::traits_type> 19 | { 20 | char *m_buf; 21 | size_t m_buf_len; 22 | std::string m_overflow; 23 | 24 | typedef std::char_traits traits_ty; 25 | typedef traits_ty::int_type int_type; 26 | typedef traits_ty::pos_type pos_type; 27 | typedef traits_ty::off_type off_type; 28 | 29 | public: 30 | PrebufferedStreambuf(char *buf, size_t len); 31 | 32 | // called when the buffer fills up 33 | int_type overflow(int_type c); 34 | 35 | // called when we read and need more data 36 | int_type underflow(); 37 | 38 | /// return a string copy (inefficiently) 39 | std::string get_str() const; 40 | }; 41 | 42 | #endif 43 | --------------------------------------------------------------------------------