• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2012 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __CORE_FS_MGR_H
18 #define __CORE_FS_MGR_H
19 
20 #include <stdint.h>
21 #include <linux/dm-ioctl.h>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 struct fstab {
28     int num_entries;
29     struct fstab_rec *recs;
30     char *fstab_filename;
31 };
32 
33 struct fstab_rec {
34     char *blk_device;
35     char *mount_point;
36     char *fs_type;
37     unsigned long flags;
38     char *fs_options;
39     int fs_mgr_flags;
40     char *key_loc;
41     char *verity_loc;
42     long long length;
43     char *label;
44     int partnum;
45     int swap_prio;
46     unsigned int zram_size;
47 };
48 
49 struct fstab *fs_mgr_read_fstab(const char *fstab_path);
50 void fs_mgr_free_fstab(struct fstab *fstab);
51 int fs_mgr_mount_all(struct fstab *fstab);
52 int fs_mgr_do_mount(struct fstab *fstab, char *n_name, char *n_blk_device,
53                     char *tmp_mount_point);
54 int fs_mgr_do_tmpfs_mount(char *n_name);
55 int fs_mgr_unmount_all(struct fstab *fstab);
56 int fs_mgr_get_crypt_info(struct fstab *fstab, char *key_loc,
57                           char *real_blk_device, int size);
58 int fs_mgr_add_entry(struct fstab *fstab,
59                      const char *mount_point, const char *fs_type,
60                      const char *blk_device, long long length);
61 struct fstab_rec *fs_mgr_get_entry_for_mount_point(struct fstab *fstab, const char *path);
62 int fs_mgr_is_voldmanaged(struct fstab_rec *fstab);
63 int fs_mgr_is_nonremovable(struct fstab_rec *fstab);
64 int fs_mgr_is_encryptable(struct fstab_rec *fstab);
65 int fs_mgr_is_noemulatedsd(struct fstab_rec *fstab);
66 int fs_mgr_swapon_all(struct fstab *fstab);
67 #ifdef __cplusplus
68 }
69 #endif
70 
71 #endif /* __CORE_FS_MGR_H */
72 
73