diff options
author | shishir <shishirng@gluster.com> | 2011-07-19 16:02:12 +0530 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-08-10 22:51:56 -0700 |
commit | 86999525240983dcbd3fe66eb40a0947730c695c (patch) | |
tree | 47ca5e1e42634de69280525f7032848cdcf6661f /libglusterfs | |
parent | 5ce1b5c357d490f68ae89bfd3ce31326a81a1183 (diff) |
WORM: Write Once Read Many times xlator support
This xlator will allow files to be opened for write in append mode
only. Mount with --worm(glusterfs) or -o worm (mount) option to
enable worm xlator
Change-Id: I1be02fcf2aee2182ea2c66b514357918136fabeb
BUG: 3166
Reviewed-on: http://review.gluster.com/23
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@gluster.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/glusterfs.h | 1 | ||||
-rw-r--r-- | libglusterfs/src/graph.c | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h index d4302028225..049bb8fc01f 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -276,6 +276,7 @@ struct _cmd_args { int debug_mode; int read_only; int acl; + int worm; int mac_compat; struct list_head xlator_options; /* list of xlator_option_t */ diff --git a/libglusterfs/src/graph.c b/libglusterfs/src/graph.c index 725425d3994..acad239544b 100644 --- a/libglusterfs/src/graph.c +++ b/libglusterfs/src/graph.c @@ -247,6 +247,21 @@ glusterfs_graph_acl (glusterfs_graph_t *graph, glusterfs_ctx_t *ctx) return ret; } +int +glusterfs_graph_worm (glusterfs_graph_t *graph, glusterfs_ctx_t *ctx) +{ + int ret = 0; + cmd_args_t *cmd_args = NULL; + + cmd_args = &ctx->cmd_args; + + if (!cmd_args->worm) + return 0; + + ret = glusterfs_graph_insert (graph, ctx, "features/worm", + "worm-autoload"); + return ret; +} int glusterfs_graph_mac_compat (glusterfs_graph_t *graph, glusterfs_ctx_t *ctx) @@ -475,6 +490,12 @@ glusterfs_graph_prepare (glusterfs_graph_t *graph, glusterfs_ctx_t *ctx) return -1; } + /* XXX: WORM VOLUME */ + ret = glusterfs_graph_worm (graph, ctx); + if (ret) { + gf_log ("graph", GF_LOG_ERROR, "glusterfs graph worm failed"); + return -1; + } ret = glusterfs_graph_acl (graph, ctx); if (ret) { gf_log ("graph", GF_LOG_ERROR, "glusterfs graph ACL failed"); |