[sheepdog] [PATCH 2/4] sheep: add a operation to get cluster info
Liu Yuan
namei.unix at gmail.com
Fri Mar 14 13:04:38 CET 2014
This is a preparation patch.
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
include/internal_proto.h | 1 +
sheep/ops.c | 15 +++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/include/internal_proto.h b/include/internal_proto.h
index ace4ac5..0eb7227 100644
--- a/include/internal_proto.h
+++ b/include/internal_proto.h
@@ -100,6 +100,7 @@
#define SD_OP_NFS_CREATE 0xBB
#define SD_OP_NFS_DELETE 0xBC
#define SD_OP_EXIST 0xBD
+#define SD_OP_CLUSTER_INFO 0xBE
/* internal flags for hdr.flags, must be above 0x80 */
#define SD_FLAG_CMD_RECOVERY 0x0080
diff --git a/sheep/ops.c b/sheep/ops.c
index ca00a18..6db5c57 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -1028,6 +1028,14 @@ static int local_oid_exist(struct request *req)
return SD_RES_NO_OBJ;
}
+static int local_cluster_info(const struct sd_req *req, struct sd_rsp *rsp,
+ void *data)
+{
+ memcpy(data, &sys->cinfo, sizeof(sys->cinfo));
+ rsp->data_length = sizeof(sys->cinfo);
+ return SD_RES_SUCCESS;
+}
+
#ifdef HAVE_NFS
static int local_nfs_create(struct request *req)
@@ -1356,6 +1364,13 @@ static struct sd_op_template sd_ops[] = {
.process_work = local_oid_exist,
},
+ [SD_OP_CLUSTER_INFO] = {
+ .name = "CLUSTER INFO",
+ .type = SD_OP_TYPE_LOCAL,
+ .force = true,
+ .process_main = local_cluster_info,
+ },
+
#ifdef HAVE_NFS
[SD_OP_NFS_CREATE] = {
.name = "NFS_CREATE",
--
1.8.1.2
More information about the sheepdog
mailing list