17574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall/*
27574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall * Copyright (C) 2012 The Android Open Source Project
37574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *
47574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall * Licensed under the Apache License, Version 2.0 (the "License");
57574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall * you may not use this file except in compliance with the License.
67574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall * You may obtain a copy of the License at
77574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *
87574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *      http://www.apache.org/licenses/LICENSE-2.0
97574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *
107574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall * Unless required by applicable law or agreed to in writing, software
117574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall * distributed under the License is distributed on an "AS IS" BASIS,
127574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
137574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall * See the License for the specific language governing permissions and
147574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall * limitations under the License.
157574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall */
167574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall
177574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall#ifndef __CORE_FS_MGR_PRIV_H
187574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall#define __CORE_FS_MGR_PRIV_H
197574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall
207574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall#include <cutils/klog.h>
217574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall#include <fs_mgr.h>
227574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall
237574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall#define INFO(x...)    KLOG_INFO("fs_mgr", x)
247574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall#define ERROR(x...)   KLOG_ERROR("fs_mgr", x)
257574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall
267574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall#define CRYPTO_TMPFS_OPTIONS "size=128m,mode=0771,uid=1000,gid=1000"
277574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall
287574c035b2dcf8316c562c648113be6be65cb061Ken Sumrallstruct fstab_rec {
297574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall    char *blk_dev;
307574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall    char *mnt_point;
317574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall    char *type;
327574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall    unsigned long flags;
337574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall    char *fs_options;
347574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall    int fs_mgr_flags;
357574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall    char *key_loc;
367574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall};
377574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall
387574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall#define WAIT_TIMEOUT 5
397574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall
407574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall/* fstab has the following format:
417574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *
427574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall * Any line starting with a # is a comment and ignored
437574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *
447574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall * Any blank line is ignored
457574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *
467574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall * All other lines must be in this format:
477574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *   <source>  <mount_point> <fs_type> <mount_flags> <fs_options> <fs_mgr_options>
487574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *
497574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *   <mount_flags> is a comma separated list of flags that can be passed to the
507574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *                 mount command.  The list includes noatime, nosuid, nodev, nodiratime,
517574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *                 ro, rw, remount, defaults.
527574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *
537574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *   <fs_options> is a comma separated list of options accepted by the filesystem being
547574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *                mounted.  It is passed directly to mount without being parsed
557574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *
567574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *   <fs_mgr_options> is a comma separated list of flags that control the operation of
577574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *                     the fs_mgr program.  The list includes "wait", which will wait till
587574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *                     the <source> file exists, and "check", which requests that the fs_mgr
597574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *                     run an fscheck program on the <source> before mounting the filesystem.
607574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *                     If check is specifed on a read-only filesystem, it is ignored.
617574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *                     Also, "encryptable" means that filesystem can be encrypted.
627574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *                     The "encryptable" flag _MUST_ be followed by a : and a string which
637574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *                     is the location of the encryption keys.  I can either be a path
647574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *                     to a file or partition which contains the keys, or the word "footer"
657574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *                     which means the keys are in the last 16 Kbytes of the partition
667574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *                     containing the filesystem.
677574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *
687574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall * When the fs_mgr is requested to mount all filesystems, it will first mount all the
697574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall * filesystems that do _NOT_ specify check (including filesystems that are read-only and
707574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall * specify check, because check is ignored in that case) and then it will check and mount
717574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall * filesystem marked with check.
727574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall *
737574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall */
747574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall
757574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall#define MF_WAIT      0x1
767574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall#define MF_CHECK     0x2
777574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall#define MF_CRYPT     0x4
787574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall
797574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall#endif /* __CORE_FS_MGR_PRIV_H */
807574c035b2dcf8316c562c648113be6be65cb061Ken Sumrall
81