mirror of
https://github.com/ceph/ceph
synced 2025-01-01 08:32:24 +00:00
d447a80815
RADOS classes can now be statically compiled and added to the embedded cephd library. The RADOS ClassHandler now has an option to skip calling dlclose just like PluginRegistry. All RADOS classes where changed to use a CLS_INIT macro that will either use __cls_init or classname_cls_init. this enables the static compiling of all RADOS classes in a single library. Also global method definitions where moved to inside cls_init. Also added a few aconfig defines including WITH_EMBEDDED, WITH_CEPHFS, WITH_RBD, and WITH_KVS. Note that WITH_RBD was not defined before and the ceph-dencoder was broken when it was turned on. Signed-off-by: Bassam Tabbara <bassam.tabbara@quantum.com>
60 lines
1.1 KiB
C++
60 lines
1.1 KiB
C++
|
|
|
|
|
|
#include <iostream>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <errno.h>
|
|
|
|
#include <openssl/md5.h>
|
|
#include <openssl/sha.h>
|
|
|
|
#include "include/types.h"
|
|
#include "objclass/objclass.h"
|
|
|
|
|
|
CLS_VER(1,0)
|
|
CLS_NAME(acl)
|
|
|
|
int get_method(cls_method_context_t ctx, char *indata, int datalen,
|
|
char **outdata, int *outdatalen)
|
|
{
|
|
MD5_CTX c;
|
|
|
|
cls_log("acl test method");
|
|
cls_log("indata=%.*s data_len=%d", datalen, indata, datalen);
|
|
|
|
cls_getxattr(ctx, "acls", outdata, outdatalen);
|
|
|
|
return 0;
|
|
}
|
|
|
|
int set_method(cls_method_context_t ctx, char *indata, int datalen,
|
|
char **outdata, int *outdatalen)
|
|
{
|
|
MD5_CTX c;
|
|
|
|
cls_log("acl test method");
|
|
cls_log("indata=%.*s data_len=%d", datalen, indata, datalen);
|
|
|
|
cls_setxattr(ctx, "acls", indata, datalen);
|
|
|
|
return 0;
|
|
}
|
|
|
|
CLS_INIT(acl)
|
|
{
|
|
cls_log("Loaded acl class!");
|
|
|
|
cls_handle_t h_class;
|
|
cls_method_handle_t h_get;
|
|
cls_method_handle_t h_set;
|
|
|
|
cls_register("acl", &h_class);
|
|
cls_register_method(h_class, "get", CLS_METHOD_RD, get_method, &h_get);
|
|
cls_register_method(h_class, "set", CLS_METHOD_WR, set_method, &h_set);
|
|
|
|
return;
|
|
}
|
|
|