"Fossies" - the Fresh Open Source Software Archive

Member "glusterfs-8.2/xlators/meta/src/xlator-dir.c" (16 Sep 2020, 2239 Bytes) of package /linux/misc/glusterfs-8.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "xlator-dir.c" see the Fossies "Dox" file reference documentation.

    1 /*
    2    Copyright (c) 2014 Red Hat, Inc. <http://www.redhat.com>
    3    This file is part of GlusterFS.
    4 
    5    This file is licensed to you under your choice of the GNU Lesser
    6    General Public License, version 3 or any later version (LGPLv3 or
    7    later), or the GNU General Public License, version 2 (GPLv2), in all
    8    cases as published by the Free Software Foundation.
    9 */
   10 
   11 #include <glusterfs/xlator.h>
   12 #include <glusterfs/defaults.h>
   13 
   14 #include "meta-mem-types.h"
   15 #include "meta.h"
   16 #include "meta-hooks.h"
   17 
   18 static struct meta_dirent xlator_dir_dirents[] = {
   19     DOT_DOTDOT,
   20 
   21     {
   22         .name = "view",
   23         .type = IA_IFDIR,
   24         .hook = meta_view_dir_hook,
   25     },
   26     {
   27         .name = "type",
   28         .type = IA_IFREG,
   29         .hook = meta_type_file_hook,
   30     },
   31     {
   32         .name = "name",
   33         .type = IA_IFREG,
   34         .hook = meta_name_file_hook,
   35     },
   36     {
   37         .name = "subvolumes",
   38         .type = IA_IFDIR,
   39         .hook = meta_subvolumes_dir_hook,
   40     },
   41     {
   42         .name = "options",
   43         .type = IA_IFDIR,
   44         .hook = meta_options_dir_hook,
   45     },
   46     {
   47         .name = "private",
   48         .type = IA_IFREG,
   49         .hook = meta_private_file_hook,
   50     },
   51     {
   52         .name = "history",
   53         .type = IA_IFREG,
   54         .hook = meta_history_file_hook,
   55     },
   56     {
   57         .name = "meminfo",
   58         .type = IA_IFREG,
   59         .hook = meta_meminfo_file_hook,
   60     },
   61     {
   62         .name = "profile",
   63         .type = IA_IFREG,
   64         .hook = meta_profile_file_hook,
   65     },
   66     {.name = NULL}};
   67 
   68 static struct meta_ops xlator_dir_ops = {.fixed_dirents = xlator_dir_dirents};
   69 
   70 int
   71 meta_xlator_dir_hook(call_frame_t *frame, xlator_t *this, loc_t *loc,
   72                      dict_t *xdata)
   73 {
   74     glusterfs_graph_t *graph = NULL;
   75     xlator_t *xl = NULL;
   76 
   77     graph = meta_ctx_get(loc->parent, this);
   78 
   79     xl = xlator_search_by_name(graph->first, loc->name);
   80 
   81     meta_ctx_set(loc->inode, this, xl);
   82 
   83     meta_ops_set(loc->inode, this, &xlator_dir_ops);
   84 
   85     return 0;
   86 }
   87 
   88 int
   89 meta_master_dir_hook(call_frame_t *frame, xlator_t *this, loc_t *loc,
   90                      dict_t *xdata)
   91 {
   92     meta_ctx_set(loc->inode, this, this->ctx->master);
   93 
   94     meta_ops_set(loc->inode, this, &xlator_dir_ops);
   95 
   96     return 0;
   97 }