1 /* Copyright 2002, 2003 by Hans Reiser, licensing governed by reiser4/README */
3 /* plugin header. Data structures required by all plugin types. */
5 #if !defined(__PLUGIN_HEADER_H__)
6 #define __PLUGIN_HEADER_H__
8 /* plugin data-types and constants */
11 #include "../dformat.h"
13 /* The list of Reiser4 interfaces */
15 REISER4_FILE_PLUGIN_TYPE
, /* manage VFS objects */
16 REISER4_DIR_PLUGIN_TYPE
, /* manage directories */
17 REISER4_ITEM_PLUGIN_TYPE
, /* manage items */
18 REISER4_NODE_PLUGIN_TYPE
, /* manage formatted nodes */
19 REISER4_HASH_PLUGIN_TYPE
, /* hash methods */
20 REISER4_FIBRATION_PLUGIN_TYPE
, /* directory fibrations */
21 REISER4_FORMATTING_PLUGIN_TYPE
, /* dispatching policy */
22 REISER4_PERM_PLUGIN_TYPE
, /* stub (vacancy) */
23 REISER4_SD_EXT_PLUGIN_TYPE
, /* manage stat-data extensions */
24 REISER4_FORMAT_PLUGIN_TYPE
, /* disk format specifications */
25 REISER4_JNODE_PLUGIN_TYPE
, /* manage in-memory headers */
26 REISER4_CIPHER_PLUGIN_TYPE
, /* cipher transform methods */
27 REISER4_DIGEST_PLUGIN_TYPE
, /* digest transform methods */
28 REISER4_COMPRESSION_PLUGIN_TYPE
, /* compression methods */
29 REISER4_COMPRESSION_MODE_PLUGIN_TYPE
, /* dispatching policies */
30 REISER4_CLUSTER_PLUGIN_TYPE
, /* manage logical clusters */
32 } reiser4_plugin_type
;
34 /* Supported plugin groups */
36 REISER4_DIRECTORY_FILE
,
42 struct reiser4_plugin_ops
;
43 /* generic plugin operations, supported by each
45 typedef struct reiser4_plugin_ops reiser4_plugin_ops
;
47 /* the common part of all plugin instances. */
48 typedef struct plugin_header
{
50 reiser4_plugin_type type_id
;
51 /* id of this plugin */
53 /* bitmask of groups the plugin belongs to. */
54 reiser4_plugin_groups groups
;
55 /* plugin operations */
56 reiser4_plugin_ops
*pops
;
57 /* NIKITA-FIXME-HANS: usage of and access to label and desc is not commented and
59 /* short label of this plugin */
61 /* descriptive string.. */
64 struct list_head linkage
;
67 #define plugin_of_group(plug, group) (plug->h.groups & (1 << group))
69 /* PRIVATE INTERFACES */
70 /* NIKITA-FIXME-HANS: what is this for and why does it duplicate what is in
72 /* plugin type representation. */
73 struct reiser4_plugin_type_data
{
74 /* internal plugin type identifier. Should coincide with
75 index of this item in plugins[] array. */
76 reiser4_plugin_type type_id
;
77 /* short symbolic label of this plugin type. Should be no longer
78 than MAX_PLUGIN_TYPE_LABEL_LEN characters including '\0'. */
80 /* plugin type description longer than .label */
83 /* NIKITA-FIXME-HANS: define built-in */
84 /* number of built-in plugin instances of this type */
86 /* array of built-in plugins */
88 struct list_head plugins_list
;
92 extern struct reiser4_plugin_type_data plugins
[REISER4_PLUGIN_TYPES
];
94 int is_plugin_type_valid(reiser4_plugin_type type
);
95 int is_plugin_id_valid(reiser4_plugin_type type
, reiser4_plugin_id id
);
97 static inline reiser4_plugin
*plugin_at(struct reiser4_plugin_type_data
*ptype
,
102 builtin
= ptype
->builtin
;
103 return (reiser4_plugin
*) (builtin
+ i
* ptype
->size
);
106 /* return plugin by its @type_id and @id */
107 static inline reiser4_plugin
*plugin_by_id(reiser4_plugin_type type
,
108 reiser4_plugin_id id
)
110 assert("nikita-1651", is_plugin_type_valid(type
));
111 assert("nikita-1652", is_plugin_id_valid(type
, id
));
112 return plugin_at(&plugins
[type
], id
);
115 extern reiser4_plugin
*plugin_by_unsafe_id(reiser4_plugin_type type_id
,
116 reiser4_plugin_id id
);
119 * plugin_by_disk_id - get reiser4_plugin
120 * @type_id: plugin type id
121 * @did: plugin id in disk format
123 * Returns reiser4_plugin by plugin type id an dplugin_id.
125 static inline reiser4_plugin
*plugin_by_disk_id(reiser4_tree
* tree UNUSED_ARG
,
126 reiser4_plugin_type type_id
,
130 * what we should do properly is to maintain within each file-system a
131 * dictionary that maps on-disk plugin ids to "universal" ids. This
132 * dictionary will be resolved on mount time, so that this function
133 * will perform just one additional array lookup.
135 return plugin_by_unsafe_id(type_id
, le16_to_cpu(*plugin_id
));
138 /* __PLUGIN_HEADER_H__ */
143 * c-indentation-style: "K&R"