file.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. /**
  2. * eCryptfs: Linux filesystem encryption layer
  3. *
  4. * Copyright (C) 1997-2004 Erez Zadok
  5. * Copyright (C) 2001-2004 Stony Brook University
  6. * Copyright (C) 2004-2007 International Business Machines Corp.
  7. * Author(s): Michael A. Halcrow <mhalcrow@us.ibm.com>
  8. * Michael C. Thompson <mcthomps@us.ibm.com>
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of the
  13. * License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  23. * 02111-1307, USA.
  24. */
  25. #include <linux/file.h>
  26. #include <linux/poll.h>
  27. #include <linux/slab.h>
  28. #include <linux/mount.h>
  29. #include <linux/pagemap.h>
  30. #include <linux/security.h>
  31. #include <linux/compat.h>
  32. #include <linux/fs_stack.h>
  33. #include "ecryptfs_kernel.h"
  34. #ifdef CONFIG_WTL_ENCRYPTION_FILTER
  35. #include <linux/ctype.h>
  36. #define ECRYPTFS_IOCTL_GET_ATTRIBUTES _IOR('l', 0x10, __u32)
  37. #define ECRYPTFS_WAS_ENCRYPTED 0x0080
  38. #define ECRYPTFS_WAS_ENCRYPTED_OTHER_DEVICE 0x0100
  39. #endif
  40. /**
  41. * ecryptfs_read_update_atime
  42. *
  43. * generic_file_read updates the atime of upper layer inode. But, it
  44. * doesn't give us a chance to update the atime of the lower layer
  45. * inode. This function is a wrapper to generic_file_read. It
  46. * updates the atime of the lower level inode if generic_file_read
  47. * returns without any errors. This is to be used only for file reads.
  48. * The function to be used for directory reads is ecryptfs_read.
  49. */
  50. static ssize_t ecryptfs_read_update_atime(struct kiocb *iocb,
  51. const struct iovec *iov,
  52. unsigned long nr_segs, loff_t pos)
  53. {
  54. ssize_t rc;
  55. struct path lower;
  56. struct file *file = iocb->ki_filp;
  57. rc = generic_file_aio_read(iocb, iov, nr_segs, pos);
  58. /*
  59. * Even though this is a async interface, we need to wait
  60. * for IO to finish to update atime
  61. */
  62. if (-EIOCBQUEUED == rc)
  63. rc = wait_on_sync_kiocb(iocb);
  64. if (rc >= 0) {
  65. lower.dentry = ecryptfs_dentry_to_lower(file->f_path.dentry);
  66. lower.mnt = ecryptfs_dentry_to_lower_mnt(file->f_path.dentry);
  67. touch_atime(&lower);
  68. }
  69. return rc;
  70. }
  71. struct ecryptfs_getdents_callback {
  72. struct dir_context ctx;
  73. struct dir_context *caller;
  74. struct dentry *dentry;
  75. int filldir_called;
  76. int entries_written;
  77. };
  78. /* Inspired by generic filldir in fs/readdir.c */
  79. static int
  80. ecryptfs_filldir(void *dirent, const char *lower_name, int lower_namelen,
  81. loff_t offset, u64 ino, unsigned int d_type)
  82. {
  83. struct ecryptfs_getdents_callback *buf =
  84. (struct ecryptfs_getdents_callback *)dirent;
  85. size_t name_size;
  86. char *name;
  87. int rc;
  88. buf->filldir_called++;
  89. rc = ecryptfs_decode_and_decrypt_filename(&name, &name_size,
  90. buf->dentry, lower_name,
  91. lower_namelen);
  92. if (rc) {
  93. printk(KERN_ERR "%s: Error attempting to decode and decrypt "
  94. "filename [%s]; rc = [%d]\n", __func__, lower_name,
  95. rc);
  96. goto out;
  97. }
  98. buf->caller->pos = buf->ctx.pos;
  99. rc = !dir_emit(buf->caller, name, name_size, ino, d_type);
  100. kfree(name);
  101. if (!rc)
  102. buf->entries_written++;
  103. out:
  104. return rc;
  105. }
  106. /**
  107. * ecryptfs_readdir
  108. * @file: The eCryptfs directory file
  109. * @ctx: The actor to feed the entries to
  110. */
  111. static int ecryptfs_readdir(struct file *file, struct dir_context *ctx)
  112. {
  113. int rc;
  114. struct file *lower_file;
  115. struct inode *inode;
  116. struct ecryptfs_getdents_callback buf = {
  117. .ctx.actor = ecryptfs_filldir,
  118. .caller = ctx,
  119. .dentry = file->f_path.dentry
  120. };
  121. lower_file = ecryptfs_file_to_lower(file);
  122. lower_file->f_pos = ctx->pos;
  123. inode = file->f_path.dentry->d_inode;
  124. rc = iterate_dir(lower_file, &buf.ctx);
  125. ctx->pos = buf.ctx.pos;
  126. if (rc < 0)
  127. goto out;
  128. if (buf.filldir_called && !buf.entries_written)
  129. goto out;
  130. if (rc >= 0)
  131. fsstack_copy_attr_atime(inode,
  132. lower_file->f_path.dentry->d_inode);
  133. out:
  134. return rc;
  135. }
  136. struct kmem_cache *ecryptfs_file_info_cache;
  137. static int read_or_initialize_metadata(struct dentry *dentry)
  138. {
  139. struct inode *inode = dentry->d_inode;
  140. struct ecryptfs_mount_crypt_stat *mount_crypt_stat;
  141. struct ecryptfs_crypt_stat *crypt_stat;
  142. int rc;
  143. crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat;
  144. mount_crypt_stat = &ecryptfs_superblock_to_private(
  145. inode->i_sb)->mount_crypt_stat;
  146. #ifdef CONFIG_WTL_ENCRYPTION_FILTER
  147. if (crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED
  148. && crypt_stat->flags & ECRYPTFS_POLICY_APPLIED
  149. && crypt_stat->flags & ECRYPTFS_ENCRYPTED
  150. && !(crypt_stat->flags & ECRYPTFS_KEY_VALID)
  151. && !(crypt_stat->flags & ECRYPTFS_KEY_SET)
  152. && crypt_stat->flags & ECRYPTFS_I_SIZE_INITIALIZED) {
  153. crypt_stat->flags |= ECRYPTFS_ENCRYPTED_OTHER_DEVICE;
  154. }
  155. mutex_lock(&crypt_stat->cs_mutex);
  156. if ((mount_crypt_stat->flags & ECRYPTFS_ENABLE_NEW_PASSTHROUGH)
  157. && (crypt_stat->flags & ECRYPTFS_ENCRYPTED)) {
  158. if (ecryptfs_read_metadata(dentry)) {
  159. crypt_stat->flags &= ~(ECRYPTFS_I_SIZE_INITIALIZED
  160. | ECRYPTFS_ENCRYPTED);
  161. rc = 0;
  162. goto out;
  163. }
  164. } else if ((mount_crypt_stat->flags & ECRYPTFS_ENABLE_FILTERING)
  165. && (crypt_stat->flags & ECRYPTFS_ENCRYPTED)) {
  166. struct dentry *fp_dentry =
  167. ecryptfs_inode_to_private(inode)->lower_file->f_dentry;
  168. char filename[NAME_MAX+1] = {0};
  169. if (fp_dentry->d_name.len <= NAME_MAX)
  170. memcpy(filename, fp_dentry->d_name.name,
  171. fp_dentry->d_name.len + 1);
  172. if (is_file_name_match(mount_crypt_stat, fp_dentry)
  173. || is_file_ext_match(mount_crypt_stat, filename)) {
  174. if (ecryptfs_read_metadata(dentry))
  175. crypt_stat->flags &=
  176. ~(ECRYPTFS_I_SIZE_INITIALIZED
  177. | ECRYPTFS_ENCRYPTED);
  178. rc = 0;
  179. goto out;
  180. }
  181. }
  182. mutex_unlock(&crypt_stat->cs_mutex);
  183. #endif
  184. mutex_lock(&crypt_stat->cs_mutex);
  185. if (crypt_stat->flags & ECRYPTFS_POLICY_APPLIED &&
  186. crypt_stat->flags & ECRYPTFS_KEY_VALID) {
  187. rc = 0;
  188. goto out;
  189. }
  190. rc = ecryptfs_read_metadata(dentry);
  191. if (!rc)
  192. goto out;
  193. if (mount_crypt_stat->flags & ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED) {
  194. crypt_stat->flags &= ~(ECRYPTFS_I_SIZE_INITIALIZED
  195. | ECRYPTFS_ENCRYPTED);
  196. rc = 0;
  197. goto out;
  198. }
  199. if (!(mount_crypt_stat->flags & ECRYPTFS_XATTR_METADATA_ENABLED) &&
  200. !i_size_read(ecryptfs_inode_to_lower(inode))) {
  201. rc = ecryptfs_initialize_file(dentry, inode);
  202. if (!rc)
  203. goto out;
  204. }
  205. rc = -EIO;
  206. out:
  207. mutex_unlock(&crypt_stat->cs_mutex);
  208. return rc;
  209. }
  210. static int ecryptfs_mmap(struct file *file, struct vm_area_struct *vma)
  211. {
  212. struct file *lower_file = ecryptfs_file_to_lower(file);
  213. /*
  214. * Don't allow mmap on top of file systems that don't support it
  215. * natively. If FILESYSTEM_MAX_STACK_DEPTH > 2 or ecryptfs
  216. * allows recursive mounting, this will need to be extended.
  217. */
  218. if (!lower_file->f_op->mmap)
  219. return -ENODEV;
  220. return generic_file_mmap(file, vma);
  221. }
  222. /**
  223. * ecryptfs_open
  224. * @inode: inode speciying file to open
  225. * @file: Structure to return filled in
  226. *
  227. * Opens the file specified by inode.
  228. *
  229. * Returns zero on success; non-zero otherwise
  230. */
  231. static int ecryptfs_open(struct inode *inode, struct file *file)
  232. {
  233. int rc = 0;
  234. struct ecryptfs_crypt_stat *crypt_stat = NULL;
  235. struct dentry *ecryptfs_dentry = file->f_path.dentry;
  236. /* Private value of ecryptfs_dentry allocated in
  237. * ecryptfs_lookup() */
  238. struct dentry *lower_dentry;
  239. struct ecryptfs_file_info *file_info;
  240. /* Released in ecryptfs_release or end of function if failure */
  241. file_info = kmem_cache_zalloc(ecryptfs_file_info_cache, GFP_KERNEL);
  242. ecryptfs_set_file_private(file, file_info);
  243. if (!file_info) {
  244. ecryptfs_printk(KERN_ERR,
  245. "Error attempting to allocate memory\n");
  246. rc = -ENOMEM;
  247. goto out;
  248. }
  249. lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry);
  250. crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat;
  251. mutex_lock(&crypt_stat->cs_mutex);
  252. if (!(crypt_stat->flags & ECRYPTFS_POLICY_APPLIED)) {
  253. ecryptfs_printk(KERN_DEBUG, "Setting flags for stat...\n");
  254. /* Policy code enabled in future release */
  255. crypt_stat->flags |= (ECRYPTFS_POLICY_APPLIED
  256. | ECRYPTFS_ENCRYPTED);
  257. }
  258. mutex_unlock(&crypt_stat->cs_mutex);
  259. rc = ecryptfs_get_lower_file(ecryptfs_dentry, inode);
  260. if (rc) {
  261. printk(KERN_ERR "%s: Error attempting to initialize "
  262. "the lower file for the dentry with name "
  263. "[%s]; rc = [%d]\n", __func__,
  264. ecryptfs_dentry->d_name.name, rc);
  265. goto out_free;
  266. }
  267. if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_ACCMODE)
  268. == O_RDONLY && (file->f_flags & O_ACCMODE) != O_RDONLY) {
  269. rc = -EPERM;
  270. printk(KERN_WARNING "%s: Lower file is RO; eCryptfs "
  271. "file must hence be opened RO\n", __func__);
  272. goto out_put;
  273. }
  274. ecryptfs_set_file_lower(
  275. file, ecryptfs_inode_to_private(inode)->lower_file);
  276. if (S_ISDIR(ecryptfs_dentry->d_inode->i_mode)) {
  277. ecryptfs_printk(KERN_DEBUG, "This is a directory\n");
  278. mutex_lock(&crypt_stat->cs_mutex);
  279. crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED);
  280. mutex_unlock(&crypt_stat->cs_mutex);
  281. rc = 0;
  282. goto out;
  283. }
  284. rc = read_or_initialize_metadata(ecryptfs_dentry);
  285. if (rc) {
  286. goto out_put;
  287. }
  288. ecryptfs_printk(KERN_DEBUG, "inode w/ addr = [0x%p], i_ino = "
  289. "[0x%.16lx] size: [0x%.16llx]\n", inode, inode->i_ino,
  290. (unsigned long long)i_size_read(inode));
  291. goto out;
  292. out_put:
  293. ecryptfs_put_lower_file(inode);
  294. out_free:
  295. kmem_cache_free(ecryptfs_file_info_cache,
  296. ecryptfs_file_to_private(file));
  297. out:
  298. return rc;
  299. }
  300. static int ecryptfs_flush(struct file *file, fl_owner_t td)
  301. {
  302. struct file *lower_file = ecryptfs_file_to_lower(file);
  303. if (lower_file->f_op && lower_file->f_op->flush) {
  304. filemap_write_and_wait(file->f_mapping);
  305. return lower_file->f_op->flush(lower_file, td);
  306. }
  307. return 0;
  308. }
  309. static int ecryptfs_release(struct inode *inode, struct file *file)
  310. {
  311. struct ecryptfs_crypt_stat *crypt_stat;
  312. crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat;
  313. ecryptfs_put_lower_file(inode);
  314. kmem_cache_free(ecryptfs_file_info_cache,
  315. ecryptfs_file_to_private(file));
  316. return 0;
  317. }
  318. static int
  319. ecryptfs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
  320. {
  321. return vfs_fsync(ecryptfs_file_to_lower(file), datasync);
  322. }
  323. static int ecryptfs_fasync(int fd, struct file *file, int flag)
  324. {
  325. int rc = 0;
  326. struct file *lower_file = NULL;
  327. lower_file = ecryptfs_file_to_lower(file);
  328. if (lower_file->f_op && lower_file->f_op->fasync)
  329. rc = lower_file->f_op->fasync(fd, lower_file, flag);
  330. return rc;
  331. }
  332. static long
  333. ecryptfs_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
  334. {
  335. struct file *lower_file = NULL;
  336. long rc = -ENOTTY;
  337. #ifdef CONFIG_WTL_ENCRYPTION_FILTER
  338. if (cmd == ECRYPTFS_IOCTL_GET_ATTRIBUTES) {
  339. u32 __user *user_attr = (u32 __user *)arg;
  340. u32 attr = 0;
  341. char filename[NAME_MAX+1] = {0};
  342. struct dentry *ecryptfs_dentry = file->f_path.dentry;
  343. struct ecryptfs_mount_crypt_stat *mount_crypt_stat =
  344. &ecryptfs_superblock_to_private(ecryptfs_dentry->d_sb)
  345. ->mount_crypt_stat;
  346. struct inode *inode = ecryptfs_dentry->d_inode;
  347. struct ecryptfs_crypt_stat *crypt_stat =
  348. &ecryptfs_inode_to_private(inode)->crypt_stat;
  349. struct dentry *fp_dentry =
  350. ecryptfs_inode_to_private(inode)->lower_file->f_dentry;
  351. if (fp_dentry->d_name.len <= NAME_MAX)
  352. memcpy(filename, fp_dentry->d_name.name,
  353. fp_dentry->d_name.len + 1);
  354. mutex_lock(&crypt_stat->cs_mutex);
  355. if ((crypt_stat->flags & ECRYPTFS_ENCRYPTED
  356. || crypt_stat->flags & ECRYPTFS_ENCRYPTED_OTHER_DEVICE)
  357. || ((mount_crypt_stat->flags
  358. & ECRYPTFS_ENABLE_FILTERING)
  359. && (is_file_name_match
  360. (mount_crypt_stat, fp_dentry)
  361. || is_file_ext_match
  362. (mount_crypt_stat, filename)))) {
  363. if (crypt_stat->flags & ECRYPTFS_KEY_VALID)
  364. attr = ECRYPTFS_WAS_ENCRYPTED;
  365. else
  366. attr = ECRYPTFS_WAS_ENCRYPTED_OTHER_DEVICE;
  367. }
  368. mutex_unlock(&crypt_stat->cs_mutex);
  369. put_user(attr, user_attr);
  370. return 0;
  371. }
  372. #endif
  373. if (ecryptfs_file_to_private(file))
  374. lower_file = ecryptfs_file_to_lower(file);
  375. if (!(lower_file && lower_file->f_op && lower_file->f_op->unlocked_ioctl))
  376. return rc;
  377. switch (cmd) {
  378. case FITRIM:
  379. case FS_IOC_GETFLAGS:
  380. case FS_IOC_SETFLAGS:
  381. case FS_IOC_GETVERSION:
  382. case FS_IOC_SETVERSION:
  383. rc = lower_file->f_op->unlocked_ioctl(lower_file, cmd, arg);
  384. fsstack_copy_attr_all(file->f_path.dentry->d_inode,
  385. lower_file->f_path.dentry->d_inode);
  386. return rc;
  387. default:
  388. return rc;
  389. }
  390. }
  391. #ifdef CONFIG_COMPAT
  392. static long
  393. ecryptfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
  394. {
  395. struct file *lower_file = NULL;
  396. long rc = -ENOIOCTLCMD;
  397. if (ecryptfs_file_to_private(file))
  398. lower_file = ecryptfs_file_to_lower(file);
  399. if (!(lower_file && lower_file->f_op && lower_file->f_op->compat_ioctl))
  400. return rc;
  401. switch (cmd) {
  402. case FITRIM:
  403. case FS_IOC32_GETFLAGS:
  404. case FS_IOC32_SETFLAGS:
  405. case FS_IOC32_GETVERSION:
  406. case FS_IOC32_SETVERSION:
  407. rc = lower_file->f_op->compat_ioctl(lower_file, cmd, arg);
  408. fsstack_copy_attr_all(file->f_path.dentry->d_inode,
  409. lower_file->f_path.dentry->d_inode);
  410. return rc;
  411. default:
  412. return rc;
  413. }
  414. }
  415. #endif
  416. #ifdef CONFIG_WTL_ENCRYPTION_FILTER
  417. int is_file_name_match(struct ecryptfs_mount_crypt_stat *mcs,
  418. struct dentry *fp_dentry)
  419. {
  420. int i;
  421. char *str = NULL;
  422. if (!(strcmp("/", fp_dentry->d_name.name))
  423. || !(strcmp("", fp_dentry->d_name.name)))
  424. return 0;
  425. str = kzalloc(mcs->max_name_filter_len + 1, GFP_KERNEL);
  426. if (!str) {
  427. printk(KERN_ERR "%s: Out of memory whilst attempting "
  428. "to kzalloc [%zd] bytes\n", __func__,
  429. (mcs->max_name_filter_len + 1));
  430. return 0;
  431. }
  432. for (i = 0; i < ENC_NAME_FILTER_MAX_INSTANCE; i++) {
  433. int len = 0;
  434. struct dentry *p = fp_dentry;
  435. if (!strlen(mcs->enc_filter_name[i]))
  436. break;
  437. while (1) {
  438. if (len == 0) {
  439. len = strlen(p->d_name.name);
  440. if (len > mcs->max_name_filter_len)
  441. break;
  442. strcpy(str, p->d_name.name);
  443. } else {
  444. len = len + 1 + strlen(p->d_name.name) ;
  445. if (len > mcs->max_name_filter_len)
  446. break;
  447. strcat(str, "/");
  448. strcat(str, p->d_name.name);
  449. }
  450. if (strnicmp(str, mcs->enc_filter_name[i], len))
  451. break;
  452. p = p->d_parent;
  453. if (!(strcmp("/", p->d_name.name))
  454. || !(strcmp("", p->d_name.name))) {
  455. if (len == strlen(mcs->enc_filter_name[i])) {
  456. kfree(str);
  457. return 1;
  458. }
  459. break;
  460. }
  461. }
  462. }
  463. kfree(str);
  464. return 0;
  465. }
  466. int is_file_ext_match(struct ecryptfs_mount_crypt_stat *mcs, char *str)
  467. {
  468. int i;
  469. char ext[NAME_MAX + 1] = {0};
  470. char *token;
  471. int count = 0;
  472. while ((token = strsep(&str, ".")) != NULL) {
  473. strncpy(ext, token, NAME_MAX);
  474. count++;
  475. }
  476. if (count <= 1)
  477. return 0;
  478. for (i = 0; i < ENC_EXT_FILTER_MAX_INSTANCE; i++) {
  479. if (!strlen(mcs->enc_filter_ext[i]))
  480. return 0;
  481. if (strlen(ext) != strlen(mcs->enc_filter_ext[i]))
  482. continue;
  483. if (!strnicmp(ext, mcs->enc_filter_ext[i], strlen(ext)))
  484. return 1;
  485. }
  486. return 0;
  487. }
  488. #endif
  489. const struct file_operations ecryptfs_dir_fops = {
  490. .iterate = ecryptfs_readdir,
  491. .read = generic_read_dir,
  492. .unlocked_ioctl = ecryptfs_unlocked_ioctl,
  493. #ifdef CONFIG_COMPAT
  494. .compat_ioctl = ecryptfs_compat_ioctl,
  495. #endif
  496. .open = ecryptfs_open,
  497. .flush = ecryptfs_flush,
  498. .release = ecryptfs_release,
  499. .fsync = ecryptfs_fsync,
  500. .fasync = ecryptfs_fasync,
  501. .splice_read = generic_file_splice_read,
  502. .llseek = default_llseek,
  503. };
  504. const struct file_operations ecryptfs_main_fops = {
  505. .llseek = generic_file_llseek,
  506. .read = do_sync_read,
  507. .aio_read = ecryptfs_read_update_atime,
  508. .write = do_sync_write,
  509. .aio_write = generic_file_aio_write,
  510. .iterate = ecryptfs_readdir,
  511. .unlocked_ioctl = ecryptfs_unlocked_ioctl,
  512. #ifdef CONFIG_COMPAT
  513. .compat_ioctl = ecryptfs_compat_ioctl,
  514. #endif
  515. .mmap = ecryptfs_mmap,
  516. .open = ecryptfs_open,
  517. .flush = ecryptfs_flush,
  518. .release = ecryptfs_release,
  519. .fsync = ecryptfs_fsync,
  520. .fasync = ecryptfs_fasync,
  521. .splice_read = generic_file_splice_read,
  522. };