Exemple #1
0
#endif

#include "xlator.h"
#include "defaults.h"

#include "meta-mem-types.h"
#include "meta.h"
#include "meta-hooks.h"


static int
option_file_fill (xlator_t *this, inode_t *inode, strfd_t *strfd)
{
	data_t *data = NULL;

	data = meta_ctx_get (inode, this);

	strprintf (strfd, "%s\n", data_to_str (data));

	return strfd->size;
}


static struct meta_ops option_file_ops = {
	.file_fill = option_file_fill
};


int
meta_option_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc,
		       dict_t *xdata)
#include "meta-mem-types.h"
#include "meta.h"
#include "meta-hooks.h"


static int
subvolumes_dir_fill (xlator_t *this, inode_t *dir, struct meta_dirent **dp)
{
	struct meta_dirent *dirents = NULL;
	xlator_t *xl = NULL;
	xlator_list_t *subv = NULL;
	int i = 0;
	int count = 0;

	xl = meta_ctx_get (dir, this);

	for (subv = xl->children; subv; subv = subv->next)
		count++;

	dirents = GF_CALLOC (sizeof (*dirents), count, gf_meta_mt_dirents_t);
	if (!dirents)
		return -1;

	for (subv = xl->children; subv; subv = subv->next) {
		char num[16] = { };
		snprintf (num, 16, "%d", i);

		dirents[i].name = gf_strdup (num);
		dirents[i].type = IA_IFLNK;
		dirents[i].hook = meta_subvolume_link_hook;
Exemple #3
0
        .name = "volfile",
        .type = IA_IFREG,
        .hook = meta_volfile_file_hook,
    },
    {.name = NULL}};

static int
graph_dir_fill(xlator_t *this, inode_t *inode, struct meta_dirent **dp)
{
    struct meta_dirent *dirents = NULL;
    glusterfs_graph_t *graph = NULL;
    int i = 0;
    int count = 0;
    xlator_t *xl = NULL;

    graph = meta_ctx_get(inode, this);

    for (xl = graph->first; xl; xl = xl->next)
        count++;

    dirents = GF_MALLOC(sizeof(*dirents) * count, gf_meta_mt_dirents_t);
    if (!dirents)
        return -1;

    i = 0;
    for (xl = graph->first; xl; xl = xl->next) {
        dirents[i].name = gf_strdup(xl->name);
        dirents[i].type = IA_IFDIR;
        dirents[i].hook = meta_xlator_dir_hook;
        i++;
    }
#include "xlator.h"
#include "defaults.h"

#include "meta-mem-types.h"
#include "meta.h"
#include "strfd.h"
#include "statedump.h"


static int
profile_file_fill (xlator_t *this, inode_t *file, strfd_t *strfd)
{
	xlator_t *xl = NULL;

	xl = meta_ctx_get (file, this);

	gf_proc_dump_xlator_profile (xl, strfd);

	return strfd->size;
}


static struct meta_ops profile_file_ops = {
	.file_fill = profile_file_fill,
};


int
meta_profile_file_hook (call_frame_t *frame, xlator_t *this, loc_t *loc,
			dict_t *xdata)