Samsung Internal API reference  2.0
fops.h
1 /*
2  * Copyright (C) 2012-2019, Samsung Electronics Co., Ltd.
3  *
4  * UDF fops declarations
5  */
6 
7 #pragma once
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 #include <compiler.h>
14 #include <core/dirent.h>
15 #include <core/driver.h>
16 #include <core/stat.h>
17 #include <core/tbt.h>
18 #include <fcntl.h>
19 #include <sys/mman.h>
20 
21 typedef int (*fops_open)(struct drv_info *filp, const char *subpath, ...);
23 typedef int (*fops_close)(struct drv_info *filp);
25 typedef int (*fops_truncate)(struct drv_info *filp, unsigned int size);
27 typedef ssize_t (*fops_read)(struct drv_info *filp, void *buf, size_t len);
29 typedef ssize_t (*fops_write)(struct drv_info *filp, void *buf, size_t len);
31 typedef int (*fops_ioctl)(struct drv_info *filp, int cmd, unsigned long data);
33 typedef int (*fops_stat)(struct drv_info *filp, struct stat *buf);
35 typedef void *(
36  *fops_mmap)(struct drv_info *filp, void *addr, size_t len, int prot, int flags, off_t offset);
38 typedef int (*fops_unlink)(struct drv_info *filp, const char *subpath);
40 typedef int (*fops_lseek)(struct drv_info *filp, int offset, int whence);
42 typedef int (*fops_fsync)(struct drv_info *filp);
45 typedef int (*fops_rename)(struct drv_info *filp, const char *subpath, const char *newpath);
47 typedef int (*fops_rmdir)(struct drv_info *filp, const char *subpath);
49 typedef int (*fops_mkdir)(struct drv_info *filp, const char *subpath, mode_t mode);
51 typedef int (*fops_readdir)(struct drv_info *filp, struct dirent *dirent);
53 typedef int (*fops_lookup)(struct drv_info *filp, const char *subpath);
55 typedef int (*fops_probe)(struct drv_info *filp, mode_t mode);
64 struct fops {
65  /* callbacks common for both UDF and legacy driver */
66  fops_open open;
67  fops_close close;
68  fops_truncate truncate;
69  fops_read read;
70  fops_write write;
71  fops_ioctl ioctl;
72  fops_stat stat;
73  fops_mmap mmap;
74  fops_lseek lseek;
75  fops_fsync fsync;
76  /* UDF-only callbacks */
77  fops_unlink unlink;
78  fops_rename rename;
79  fops_rmdir rmdir;
80  fops_mkdir mkdir;
81  fops_readdir readdir;
82  fops_lookup lookup;
83  /* callbacks used only by legacy driver */
84  fops_probe probe;
85 };
86 
90 struct usr_drv_info {
91  const struct fops *fops;
92  int handle;
93  void *priv;
94 };
95 
96 #ifdef __cplusplus
97 }
98 #endif
fops_rename rename
Definition: fops.h:78
const struct fops * fops
Definition: fops.h:91
fops_rmdir rmdir
Definition: fops.h:79
int64_t off_t
Definition: types.h:37
fops_ioctl ioctl
Definition: fops.h:71
fops_fsync fsync
Definition: fops.h:75
fops_stat stat
Definition: fops.h:72
fops_truncate truncate
Definition: fops.h:68
int handle
Definition: fops.h:92
Structure that contains file operations callbacks supported by the driver. If user wants the driver t...
Definition: fops.h:64
unsigned int mode_t
Definition: types.h:41
Fcntl declarations.
Structure that contains information describing the driver.
Definition: fops.h:90
fops_open open
Definition: fops.h:66
fops_probe probe
Definition: fops.h:84
fops_unlink unlink
Definition: fops.h:77
Definition: stat.h:48
void * priv
Definition: fops.h:93
fops_write write
Definition: fops.h:70
fops_lookup lookup
Definition: fops.h:82
fops_lseek lseek
Definition: fops.h:74
fops_mkdir mkdir
Definition: fops.h:80
fops_mmap mmap
Definition: fops.h:73
fops_close close
Definition: fops.h:67
fops_readdir readdir
Definition: fops.h:81
intptr_t ssize_t
Definition: types.h:17
fops_read read
Definition: fops.h:69
Memory mapping declarations.