Motr  M0
file.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2013-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #pragma once
24 
25 #ifndef __MOTR_FILE_H__
26 #define __MOTR_FILE_H__
27 
28 #include "lib/errno.h"
29 #include "lib/misc.h"
30 #include "lib/memory.h"
31 #include "fid/fid.h"
32 #include "rm/rm.h"
33 #include "rm/rm_internal.h"
34 #include "file/di.h"
35 
81 struct m0_file {
88  const struct m0_fid *fi_fid;
91  /* Data-integrity operations supported by this file. */
92  const struct m0_di_ops *fi_di_ops;
93 };
94 
103 M0_INTERNAL void m0_file_init(struct m0_file *file,
104  const struct m0_fid *fid,
105  struct m0_rm_domain *dom,
106  enum m0_di_types di_type);
107 
111 M0_INTERNAL void m0_file_fini(struct m0_file *file);
112 
120 M0_INTERNAL void m0_file_owner_init(struct m0_rm_owner *owner,
121  const struct m0_uint128 *grp_id,
122  struct m0_file *file,
123  struct m0_rm_remote *creditor);
124 
128 M0_INTERNAL void m0_file_owner_fini(struct m0_rm_owner *owner);
129 
134 M0_INTERNAL void m0_file_lock(struct m0_rm_owner *owner,
135  struct m0_rm_incoming *req);
136 
140 M0_INTERNAL void m0_file_unlock(struct m0_rm_incoming *req);
141 
145 M0_INTERNAL
147  struct m0_rm_resource_type *flock_rt);
148 
152 M0_INTERNAL
154 
155 extern const struct m0_fid_type m0_file_fid_type;
156 
160 M0_INTERNAL int m0_file_mod_init(void);
161 
165 M0_INTERNAL void m0_file_mod_fini(void);
166 
169 #endif /* __MOTR_FILE_H__ */
170 
171 /*
172  * Local variables:
173  * c-indentation-style: "K&R"
174  * c-basic-offset: 8
175  * tab-width: 8
176  * fill-column: 79
177  * scroll-step: 1
178  * End:
179  */
static struct m0_rm_remote creditor
Definition: file.c:95
static struct io_request req
Definition: file.c:100
struct m0_file file
Definition: di.c:36
const struct m0_fid * fi_fid
Definition: file.h:88
const struct m0_fid_type m0_file_fid_type
Definition: file.c:569
M0_INTERNAL void m0_file_lock(struct m0_rm_owner *owner, struct m0_rm_incoming *req)
Definition: file.c:522
M0_INTERNAL void m0_file_mod_fini(void)
Definition: file.c:580
Definition: di.h:92
struct m0_fid fid
Definition: di.c:46
M0_INTERNAL void m0_file_lock_type_deregister(struct m0_rm_resource_type *flock_rt)
Definition: file.c:561
M0_INTERNAL int m0_file_lock_type_register(struct m0_rm_domain *dom, struct m0_rm_resource_type *flock_rt)
Definition: file.c:549
m0_di_types
Definition: di.h:72
static struct m0_stob_domain * dom
Definition: storage.c:38
M0_INTERNAL void m0_file_owner_init(struct m0_rm_owner *owner, const struct m0_uint128 *grp_id, struct m0_file *file, struct m0_rm_remote *creditor)
Definition: file.c:507
M0_INTERNAL int m0_file_mod_init(void)
Definition: file.c:574
M0_INTERNAL void m0_file_unlock(struct m0_rm_incoming *req)
Definition: file.c:540
Definition: fid.h:38
struct m0_rm_resource fi_res
Definition: file.h:90
M0_INTERNAL void m0_file_fini(struct m0_file *file)
Definition: file.c:498
Definition: file.h:81
M0_INTERNAL void m0_file_owner_fini(struct m0_rm_owner *owner)
Definition: file.c:516
const struct m0_di_ops * fi_di_ops
Definition: file.h:92
M0_INTERNAL void m0_file_init(struct m0_file *file, const struct m0_fid *fid, struct m0_rm_domain *dom, enum m0_di_types di_type)
Definition: file.c:477