Motr  M0
ioctl.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2014-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 #include <linux/fs.h> /* struct file, struct inode */
24 #include <linux/version.h> /* LINUX_VERSION_CODE */
25 
26 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_M0T1FS
27 #include "lib/trace.h"
28 
29 #include "lib/assert.h"
34 
35 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
36 M0_INTERNAL long m0t1fs_ioctl(struct file *filp, unsigned int cmd,
37  unsigned long arg)
38 #else
39 M0_INTERNAL int m0t1fs_ioctl(struct inode *inode,
40  __attribute__((unused)) struct file *filp,
41  unsigned int cmd,
42  __attribute__((unused)) unsigned long arg)
43 #endif
44 {
45 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
46  struct inode *inode;
47 #endif
48  struct m0t1fs_inode *m0inode;
49  int rc;
50 
52  M0_ENTRY();
53 
54 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
55  inode = file_inode(filp);
56  M0_ASSERT(inode != NULL);
57 #else
58  M0_PRE(inode != NULL);
59 #endif
60 
63 
64  switch(cmd) {
65  case M0_M0T1FS_FWAIT:
67  break;
68  default:
69  return M0_ERR_INFO(-ENOTTY, "Unknown IOCTL: %d", cmd);
70  }
71 
72  return M0_RC(rc);
73 }
M0_INTERNAL long m0t1fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
Definition: ioctl.c:36
#define M0_PRE(cond)
#define NULL
Definition: misc.h:38
struct m0_file file
Definition: di.c:36
enum m0_md_lustre_logrec_type __attribute__
Definition: balloc.c:2745
struct inode * inode
Definition: dir.c:624
return M0_RC(rc)
#define M0_ENTRY(...)
Definition: trace.h:170
static struct m0t1fs_inode m0inode
Definition: fsync.c:87
#define M0_ERR_INFO(rc, fmt,...)
Definition: trace.h:215
M0_INTERNAL struct m0t1fs_inode * m0t1fs_inode_to_m0inode(const struct inode *inode)
Definition: file.c:462
#define M0_ASSERT(cond)
M0_THREAD_ENTER
Definition: dir.c:336
#define M0_M0T1FS_FWAIT
Definition: m0t1fs_ioctl.h:33
int32_t rc
Definition: trigger_fop.h:47
int m0t1fs_fsync_core(struct m0t1fs_inode *inode, enum m0_fsync_mode mode)
Definition: fsync.c:281