file.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  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. void *dirent;
  73. struct dentry *dentry;
  74. filldir_t filldir;
  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. rc = buf->filldir(buf->dirent, name, name_size, offset, ino, d_type);
  99. kfree(name);
  100. if (rc >= 0)
  101. buf->entries_written++;
  102. out:
  103. return rc;
  104. }
  105. /**
  106. * ecryptfs_readdir
  107. * @file: The eCryptfs directory file
  108. * @dirent: Directory entry handle
  109. * @filldir: The filldir callback function
  110. */
  111. static int ecryptfs_readdir(struct file *file, void *dirent, filldir_t filldir)
  112. {
  113. int rc;
  114. struct file *lower_file;
  115. struct inode *inode;
  116. struct ecryptfs_getdents_callback buf;
  117. lower_file = ecryptfs_file_to_lower(file);
  118. lower_file->f_pos = file->f_pos;
  119. inode = file->f_path.dentry->d_inode;
  120. memset(&buf, 0, sizeof(buf));
  121. buf.dirent = dirent;
  122. buf.dentry = file->f_path.dentry;
  123. buf.filldir = filldir;
  124. buf.filldir_called = 0;
  125. buf.entries_written = 0;
  126. rc = vfs_readdir(lower_file, ecryptfs_filldir, (void *)&buf);
  127. file->f_pos = lower_file->f_pos;
  128. if (rc < 0)
  129. goto out;
  130. if (buf.filldir_called && !buf.entries_written)
  131. goto out;
  132. if (rc >= 0)
  133. fsstack_copy_attr_atime(inode,
  134. lower_file->f_path.dentry->d_inode);
  135. out:
  136. return rc;
  137. }
  138. struct kmem_cache *ecryptfs_file_info_cache;
  139. static int read_or_initialize_metadata(struct dentry *dentry)
  140. {
  141. struct inode *inode = dentry->d_inode;
  142. struct ecryptfs_mount_crypt_stat *mount_crypt_stat;
  143. struct ecryptfs_crypt_stat *crypt_stat;
  144. int rc;
  145. crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat;
  146. mount_crypt_stat = &ecryptfs_superblock_to_private(
  147. inode->i_sb)->mount_crypt_stat;
  148. #ifdef CONFIG_WTL_ENCRYPTION_FILTER
  149. if (crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED
  150. && crypt_stat->flags & ECRYPTFS_POLICY_APPLIED
  151. && crypt_stat->flags & ECRYPTFS_ENCRYPTED
  152. && !(crypt_stat->flags & ECRYPTFS_KEY_VALID)
  153. && !(crypt_stat->flags & ECRYPTFS_KEY_SET)
  154. && crypt_stat->flags & ECRYPTFS_I_SIZE_INITIALIZED) {
  155. crypt_stat->flags |= ECRYPTFS_ENCRYPTED_OTHER_DEVICE;
  156. }
  157. mutex_lock(&crypt_stat->cs_mutex);
  158. if ((mount_crypt_stat->flags & ECRYPTFS_ENABLE_NEW_PASSTHROUGH)
  159. && (crypt_stat->flags & ECRYPTFS_ENCRYPTED)) {
  160. if (ecryptfs_read_metadata(dentry)) {
  161. crypt_stat->flags &= ~(ECRYPTFS_I_SIZE_INITIALIZED
  162. | ECRYPTFS_ENCRYPTED);
  163. rc = 0;
  164. goto out;
  165. }
  166. } else if ((mount_crypt_stat->flags & ECRYPTFS_ENABLE_FILTERING)
  167. && (crypt_stat->flags & ECRYPTFS_ENCRYPTED)) {
  168. struct dentry *fp_dentry =
  169. ecryptfs_inode_to_private(inode)->lower_file->f_dentry;
  170. char filename[NAME_MAX+1] = {0};
  171. if (fp_dentry->d_name.len <= NAME_MAX)
  172. memcpy(filename, fp_dentry->d_name.name,
  173. fp_dentry->d_name.len + 1);
  174. if (is_file_name_match(mount_crypt_stat, fp_dentry)
  175. || is_file_ext_match(mount_crypt_stat, filename)) {
  176. if (ecryptfs_read_metadata(dentry))
  177. crypt_stat->flags &=
  178. ~(ECRYPTFS_I_SIZE_INITIALIZED
  179. | ECRYPTFS_ENCRYPTED);
  180. rc = 0;
  181. goto out;
  182. }
  183. }
  184. mutex_unlock(&crypt_stat->cs_mutex);
  185. #endif
  186. mutex_lock(&crypt_stat->cs_mutex);
  187. if (crypt_stat->flags & ECRYPTFS_POLICY_APPLIED &&
  188. crypt_stat->flags & ECRYPTFS_KEY_VALID) {
  189. rc = 0;
  190. goto out;
  191. }
  192. rc = ecryptfs_read_metadata(dentry);
  193. if (!rc)
  194. goto out;
  195. if (mount_crypt_stat->flags & ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED) {
  196. crypt_stat->flags &= ~(ECRYPTFS_I_SIZE_INITIALIZED
  197. | ECRYPTFS_ENCRYPTED);
  198. rc = 0;
  199. goto out;
  200. }
  201. if (!(mount_crypt_stat->flags & ECRYPTFS_XATTR_METADATA_ENABLED) &&
  202. !i_size_read(ecryptfs_inode_to_lower(inode))) {
  203. rc = ecryptfs_initialize_file(dentry, inode);
  204. if (!rc)
  205. goto out;
  206. }
  207. rc = -EIO;
  208. out:
  209. mutex_unlock(&crypt_stat->cs_mutex);
  210. return rc;
  211. }
  212. static int ecryptfs_mmap(struct file *file, struct vm_area_struct *vma)
  213. {
  214. struct file *lower_file = ecryptfs_file_to_lower(file);
  215. /*
  216. * Don't allow mmap on top of file systems that don't support it
  217. * natively. If FILESYSTEM_MAX_STACK_DEPTH > 2 or ecryptfs
  218. * allows recursive mounting, this will need to be extended.
  219. */
  220. if (!lower_file->f_op->mmap)
  221. return -ENODEV;
  222. return generic_file_mmap(file, vma);
  223. }
  224. /**
  225. * ecryptfs_open
  226. * @inode: inode speciying file to open
  227. * @file: Structure to return filled in
  228. *
  229. * Opens the file specified by inode.
  230. *
  231. * Returns zero on success; non-zero otherwise
  232. */
  233. static int ecryptfs_open(struct inode *inode, struct file *file)
  234. {
  235. int rc = 0;
  236. struct ecryptfs_crypt_stat *crypt_stat = NULL;
  237. struct dentry *ecryptfs_dentry = file->f_path.dentry;
  238. /* Private value of ecryptfs_dentry allocated in
  239. * ecryptfs_lookup() */
  240. struct dentry *lower_dentry;
  241. struct ecryptfs_file_info *file_info;
  242. /* Released in ecryptfs_release or end of function if failure */
  243. file_info = kmem_cache_zalloc(ecryptfs_file_info_cache, GFP_KERNEL);
  244. ecryptfs_set_file_private(file, file_info);
  245. if (!file_info) {
  246. ecryptfs_printk(KERN_ERR,
  247. "Error attempting to allocate memory\n");
  248. rc = -ENOMEM;
  249. goto out;
  250. }
  251. lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry);
  252. crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat;
  253. mutex_lock(&crypt_stat->cs_mutex);
  254. if (!(crypt_stat->flags & ECRYPTFS_POLICY_APPLIED)) {
  255. ecryptfs_printk(KERN_DEBUG, "Setting flags for stat...\n");
  256. /* Policy code enabled in future release */
  257. crypt_stat->flags |= (ECRYPTFS_POLICY_APPLIED
  258. | ECRYPTFS_ENCRYPTED);
  259. }
  260. mutex_unlock(&crypt_stat->cs_mutex);
  261. rc = ecryptfs_get_lower_file(ecryptfs_dentry, inode);
  262. if (rc) {
  263. printk(KERN_ERR "%s: Error attempting to initialize "
  264. "the lower file for the dentry with name "
  265. "[%s]; rc = [%d]\n", __func__,
  266. ecryptfs_dentry->d_name.name, rc);
  267. goto out_free;
  268. }
  269. if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_ACCMODE)
  270. == O_RDONLY && (file->f_flags & O_ACCMODE) != O_RDONLY) {
  271. rc = -EPERM;
  272. printk(KERN_WARNING "%s: Lower file is RO; eCryptfs "
  273. "file must hence be opened RO\n", __func__);
  274. goto out_put;
  275. }
  276. ecryptfs_set_file_lower(
  277. file, ecryptfs_inode_to_private(inode)->lower_file);
  278. if (S_ISDIR(ecryptfs_dentry->d_inode->i_mode)) {
  279. ecryptfs_printk(KERN_DEBUG, "This is a directory\n");
  280. mutex_lock(&crypt_stat->cs_mutex);
  281. crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED);
  282. mutex_unlock(&crypt_stat->cs_mutex);
  283. rc = 0;
  284. goto out;
  285. }
  286. rc = read_or_initialize_metadata(ecryptfs_dentry);
  287. if (rc) {
  288. goto out_put;
  289. }
  290. ecryptfs_printk(KERN_DEBUG, "inode w/ addr = [0x%p], i_ino = "
  291. "[0x%.16lx] size: [0x%.16llx]\n", inode, inode->i_ino,
  292. (unsigned long long)i_size_read(inode));
  293. goto out;
  294. out_put:
  295. ecryptfs_put_lower_file(inode);
  296. out_free:
  297. kmem_cache_free(ecryptfs_file_info_cache,
  298. ecryptfs_file_to_private(file));
  299. out:
  300. return rc;
  301. }
  302. static int ecryptfs_flush(struct file *file, fl_owner_t td)
  303. {
  304. struct file *lower_file = ecryptfs_file_to_lower(file);
  305. if (lower_file->f_op && lower_file->f_op->flush) {
  306. filemap_write_and_wait(file->f_mapping);
  307. return lower_file->f_op->flush(lower_file, td);
  308. }
  309. return 0;
  310. }
  311. static int ecryptfs_release(struct inode *inode, struct file *file)
  312. {
  313. struct ecryptfs_crypt_stat *crypt_stat;
  314. crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat;
  315. ecryptfs_put_lower_file(inode);
  316. kmem_cache_free(ecryptfs_file_info_cache,
  317. ecryptfs_file_to_private(file));
  318. return 0;
  319. }
  320. static int
  321. ecryptfs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
  322. {
  323. return vfs_fsync(ecryptfs_file_to_lower(file), datasync);
  324. }
  325. static int ecryptfs_fasync(int fd, struct file *file, int flag)
  326. {
  327. int rc = 0;
  328. struct file *lower_file = NULL;
  329. lower_file = ecryptfs_file_to_lower(file);
  330. if (lower_file->f_op && lower_file->f_op->fasync)
  331. rc = lower_file->f_op->fasync(fd, lower_file, flag);
  332. return rc;
  333. }
  334. static long
  335. ecryptfs_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
  336. {
  337. struct file *lower_file = NULL;
  338. long rc = -ENOTTY;
  339. #ifdef CONFIG_WTL_ENCRYPTION_FILTER
  340. if (cmd == ECRYPTFS_IOCTL_GET_ATTRIBUTES) {
  341. u32 __user *user_attr = (u32 __user *)arg;
  342. u32 attr = 0;
  343. char filename[NAME_MAX+1] = {0};
  344. struct dentry *ecryptfs_dentry = file->f_path.dentry;
  345. struct ecryptfs_mount_crypt_stat *mount_crypt_stat =
  346. &ecryptfs_superblock_to_private(ecryptfs_dentry->d_sb)
  347. ->mount_crypt_stat;
  348. struct inode *inode = ecryptfs_dentry->d_inode;
  349. struct ecryptfs_crypt_stat *crypt_stat =
  350. &ecryptfs_inode_to_private(inode)->crypt_stat;
  351. struct dentry *fp_dentry =
  352. ecryptfs_inode_to_private(inode)->lower_file->f_dentry;
  353. if (fp_dentry->d_name.len <= NAME_MAX)
  354. memcpy(filename, fp_dentry->d_name.name,
  355. fp_dentry->d_name.len + 1);
  356. mutex_lock(&crypt_stat->cs_mutex);
  357. if ((crypt_stat->flags & ECRYPTFS_ENCRYPTED
  358. || crypt_stat->flags & ECRYPTFS_ENCRYPTED_OTHER_DEVICE)
  359. || ((mount_crypt_stat->flags
  360. & ECRYPTFS_ENABLE_FILTERING)
  361. && (is_file_name_match
  362. (mount_crypt_stat, fp_dentry)
  363. || is_file_ext_match
  364. (mount_crypt_stat, filename)))) {
  365. if (crypt_stat->flags & ECRYPTFS_KEY_VALID)
  366. attr = ECRYPTFS_WAS_ENCRYPTED;
  367. else
  368. attr = ECRYPTFS_WAS_ENCRYPTED_OTHER_DEVICE;
  369. }
  370. mutex_unlock(&crypt_stat->cs_mutex);
  371. put_user(attr, user_attr);
  372. return 0;
  373. }
  374. #endif
  375. if (ecryptfs_file_to_private(file))
  376. lower_file = ecryptfs_file_to_lower(file);
  377. if (!(lower_file && lower_file->f_op && lower_file->f_op->unlocked_ioctl))
  378. return rc;
  379. switch (cmd) {
  380. case FITRIM:
  381. case FS_IOC_GETFLAGS:
  382. case FS_IOC_SETFLAGS:
  383. case FS_IOC_GETVERSION:
  384. case FS_IOC_SETVERSION:
  385. rc = lower_file->f_op->unlocked_ioctl(lower_file, cmd, arg);
  386. fsstack_copy_attr_all(file->f_path.dentry->d_inode,
  387. lower_file->f_path.dentry->d_inode);
  388. return rc;
  389. default:
  390. return rc;
  391. }
  392. }
  393. #ifdef CONFIG_COMPAT
  394. static long
  395. ecryptfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
  396. {
  397. struct file *lower_file = NULL;
  398. long rc = -ENOIOCTLCMD;
  399. if (ecryptfs_file_to_private(file))
  400. lower_file = ecryptfs_file_to_lower(file);
  401. if (!(lower_file && lower_file->f_op && lower_file->f_op->compat_ioctl))
  402. return rc;
  403. switch (cmd) {
  404. case FITRIM:
  405. case FS_IOC32_GETFLAGS:
  406. case FS_IOC32_SETFLAGS:
  407. case FS_IOC32_GETVERSION:
  408. case FS_IOC32_SETVERSION:
  409. rc = lower_file->f_op->compat_ioctl(lower_file, cmd, arg);
  410. fsstack_copy_attr_all(file->f_path.dentry->d_inode,
  411. lower_file->f_path.dentry->d_inode);
  412. return rc;
  413. default:
  414. return rc;
  415. }
  416. }
  417. #endif
  418. #ifdef CONFIG_WTL_ENCRYPTION_FILTER
  419. int is_file_name_match(struct ecryptfs_mount_crypt_stat *mcs,
  420. struct dentry *fp_dentry)
  421. {
  422. int i;
  423. char *str = NULL;
  424. if (!(strcmp("/", fp_dentry->d_name.name))
  425. || !(strcmp("", fp_dentry->d_name.name)))
  426. return 0;
  427. str = kzalloc(mcs->max_name_filter_len + 1, GFP_KERNEL);
  428. if (!str) {
  429. printk(KERN_ERR "%s: Out of memory whilst attempting "
  430. "to kzalloc [%zd] bytes\n", __func__,
  431. (mcs->max_name_filter_len + 1));
  432. return 0;
  433. }
  434. for (i = 0; i < ENC_NAME_FILTER_MAX_INSTANCE; i++) {
  435. int len = 0;
  436. struct dentry *p = fp_dentry;
  437. if (!strlen(mcs->enc_filter_name[i]))
  438. break;
  439. while (1) {
  440. if (len == 0) {
  441. len = strlen(p->d_name.name);
  442. if (len > mcs->max_name_filter_len)
  443. break;
  444. strcpy(str, p->d_name.name);
  445. } else {
  446. len = len + 1 + strlen(p->d_name.name) ;
  447. if (len > mcs->max_name_filter_len)
  448. break;
  449. strcat(str, "/");
  450. strcat(str, p->d_name.name);
  451. }
  452. if (strnicmp(str, mcs->enc_filter_name[i], len))
  453. break;
  454. p = p->d_parent;
  455. if (!(strcmp("/", p->d_name.name))
  456. || !(strcmp("", p->d_name.name))) {
  457. if (len == strlen(mcs->enc_filter_name[i])) {
  458. kfree(str);
  459. return 1;
  460. }
  461. break;
  462. }
  463. }
  464. }
  465. kfree(str);
  466. return 0;
  467. }
  468. int is_file_ext_match(struct ecryptfs_mount_crypt_stat *mcs, char *str)
  469. {
  470. int i;
  471. char ext[NAME_MAX + 1] = {0};
  472. char *token;
  473. int count = 0;
  474. while ((token = strsep(&str, ".")) != NULL) {
  475. strncpy(ext, token, NAME_MAX);
  476. count++;
  477. }
  478. if (count <= 1)
  479. return 0;
  480. for (i = 0; i < ENC_EXT_FILTER_MAX_INSTANCE; i++) {
  481. if (!strlen(mcs->enc_filter_ext[i]))
  482. return 0;
  483. if (strlen(ext) != strlen(mcs->enc_filter_ext[i]))
  484. continue;
  485. if (!strnicmp(ext, mcs->enc_filter_ext[i], strlen(ext)))
  486. return 1;
  487. }
  488. return 0;
  489. }
  490. #endif
  491. const struct file_operations ecryptfs_dir_fops = {
  492. .readdir = ecryptfs_readdir,
  493. .read = generic_read_dir,
  494. .unlocked_ioctl = ecryptfs_unlocked_ioctl,
  495. #ifdef CONFIG_COMPAT
  496. .compat_ioctl = ecryptfs_compat_ioctl,
  497. #endif
  498. .open = ecryptfs_open,
  499. .flush = ecryptfs_flush,
  500. .release = ecryptfs_release,
  501. .fsync = ecryptfs_fsync,
  502. .fasync = ecryptfs_fasync,
  503. .splice_read = generic_file_splice_read,
  504. .llseek = default_llseek,
  505. };
  506. const struct file_operations ecryptfs_main_fops = {
  507. .llseek = generic_file_llseek,
  508. .read = do_sync_read,
  509. .aio_read = ecryptfs_read_update_atime,
  510. .write = do_sync_write,
  511. .aio_write = generic_file_aio_write,
  512. .readdir = ecryptfs_readdir,
  513. .unlocked_ioctl = ecryptfs_unlocked_ioctl,
  514. #ifdef CONFIG_COMPAT
  515. .compat_ioctl = ecryptfs_compat_ioctl,
  516. #endif
  517. .mmap = ecryptfs_mmap,
  518. .open = ecryptfs_open,
  519. .flush = ecryptfs_flush,
  520. .release = ecryptfs_release,
  521. .fsync = ecryptfs_fsync,
  522. .fasync = ecryptfs_fasync,
  523. .splice_read = generic_file_splice_read,
  524. };