www.pudn.com > efs.rar > fs_config.h


/***********************************************************************
 * fs_config.h
 *
 * EFS2 configuration settings.
 * Copyright (C) 2006 QUALCOMM, Inc.
 *
 * This file contains all of the settable parameters used in EFS2.
 *
 ***********************************************************************/

/*===========================================================================

                        EDIT HISTORY FOR MODULE

  This section contains comments describing changes made to the module.
  Notice that changes are listed in reverse chronological order.

  $Header: //depot/asic/MSMSHARED/services/efs/MSM_EFS.01.02/fs_config.h#11 $ $DateTime: 2006/11/13 09:22:31 $ $Author: davidb $

when         who   what, where, why
----------   ---   ---------------------------------------------------------
2006-10-26   s h   Allow target to define FS_MAX_ITERATORS
2006-10-26   dlb   Put freemap changes back.
2006-10-11   dlb   Back out freemap changes for now.
2006-10-05   s h   Increase the default path length limits
2006-09-08   dlb   Add configuration parameters for buffer cache.
2006-06-14   dlb   Increase number of iterators.
2006-06-01   s h   More NODEV mountpoints, please
2006-05-22   dlb   Allow path and name max to be specified externally.
2006-06-17   yg    Changed some consts
2006-05-09   s h   Increased the number of nodev mountpoints.
2006-05-09   dlb   Add nodevfs.
2006-05-05   dlb   Return name and path limits to original values.
2006-04-18   dlb   Move hotplug definitions here as well.
2006-04-05   dlb   Create

===========================================================================*/

#ifndef __FS_CONFIG_H__
#define __FS_CONFIG_H__

/**********************************************************************
 * CONFIGURATION ITEMS
 *
 * These parameters can be configured as desired.  Note that changing their
 * values doesn't affect existing files in the filesystem.  If a build is
 * loaded with smaller parameters for these values than earlier builds,
 * files may become inaccessible.
 */

/* Maximum length of a full pathname, not including a trailing '\0'
 * character.  The filesystem only has a few buffers of this length, so it
 * doesn't increase EFS2's RAM usage much, however, other code (such as
 * fs_compat, and fs_am) us this value to allocate a large number of
 * buffers. */
#ifndef FS_PATH_MAX
  #define FS_PATH_MAX 1024
#endif

/* Maximum length of the 'name' component of a file.  The name is the
 * longest string of characters delimited by beginning of string, the '/'
 * character or the end of the string.  This is the maximum length for a
 * filename or directory name.
 */
#ifndef FS_NAME_MAX
  #define FS_NAME_MAX 768
#endif

/* Not a meaningful value.  Passed back via dia in the max_dir_entries
 * parameter.  Not used anywhere else in the code. */
#define FS_DIR_ENTRY_SIZE 50

/* Maximum number of EFS2 mountpoints.   Only "1" is supported!  */
#define FS_MAX_EFS_MOUNTS 1

/* The maximum number of EXTFS mountpoints.  Must match the size
 * of the device table in hotplug.   There must be one for each possible FAT
 * mountpoint: USB + SD/MMC + FTL. */
#define FS_MAX_EXTFS_MOUNTS     (8 + 2 + 1)

/* Maximum number of RMTEFS mounts */
#define FS_MAX_RMTEFS_MOUNTS    2

/* Maximum number of ROMFS mounts */
#define FS_MAX_ROMFS_MOUNTS     2

/* Maximum number of NODEV mounts.  Needs to be at least the size of the
 * EXTFS mounts.  Can be larger if they are used for something else.
 * If RMTEFS is managed by hotplug, those need NODEV slots as well.
 * Add three for additional mountpoints used by unit testing.
 * */
#define FS_MAX_NODEV_MOUNTS     (FS_MAX_EXTFS_MOUNTS +  \
                                 FS_MAX_RMTEFS_MOUNTS + \
                                 3)

/* The maximum number of mountpoints.  Defines the total number of
 * mountpoints available.  This should be the sum of the maximum for each
 * filesystem type compiled in. */
#define FS_MAX_MOUNTS (FS_MAX_EFS_MOUNTS +    \
                       FS_MAX_EXTFS_MOUNTS +  \
                       FS_MAX_RMTEFS_MOUNTS + \
                       FS_MAX_ROMFS_MOUNTS +  \
                       FS_MAX_NODEV_MOUNTS)

/* The maximum number of open directory iterators (returned by opendir).
 * These aren't all that expensive.  Although some mountpoint types may
 * allocate a FS_PATH_MAX sized buffer for each one. */
#ifndef FS_MAX_ITERATORS
  #define FS_MAX_ITERATORS        5
#endif

/**********************************************************************
 * Buffer cache configuration.  This is the number of EFS_PAGE_SIZE buffers
 * used by the buffering code (fs_buffer.c).  It needs to be at least as
 * large as the largest number of clusters that will be dirtied by a single
 * transaction.  It can be made larger, which will reduce some reads, but
 * keep in mind that there is no indexing on the cache, so cache misses
 * will cause a scan through the entire pool.
 */
#ifndef FS_BUFFER_NUMBER_BUFFERS
  #define FS_BUFFER_NUMBER_BUFFERS        30
#endif

/* To avoid a modulus on each cache lookup, we use a mask and some logic to
 * determine the cache value.  This value must be defined as
 *   2^(n+1)-1, where
 *   2^n <= FS_BUFFER_NUMBER_BUFFERS < 2^(n+1)
 * For example, for a number of buffers 8-15, you would use 15,
 * for 16-31 use 31, for 32-63, use 63, and so on.
 */
#ifndef FS_BUFFER_NUMBER_MASK
  #define FS_BUFFER_NUMBER_MASK           31
#endif

/**********************************************************************
 * Free bitmap size configuration.  This is the amount of buffer space we
 * set aside to hold the freemap.  The value is a size in bytes for the
 * cache.  It must be large enough to hold the number of clusters needed to
 * hold the freemap (1 bit per data cluster).  It needs to be at least
 *   ceil (total_clusters / 8)
 * rounded up to the nearest EFS_PAGE_SIZE.
 */
#ifndef FS_BUFFER_FREEMAP_SIZE
  #define FS_BUFFER_FREEMAP_SIZE          65536
#endif

/**********************************************************************
 * The following items shouldn't be changed (and don't need to be changed).
 * They are specifically tuned for characteristics of the B-tree itself.
 * Also, changes to these value would require the filesystem to be wiped.
 * */

/* Maximum length of a EFS item file (efs_raw_get/efs_raw_put).  The entire
 * database entry for the item should be no more than 1/3 of the available
 * space in a database node.  The smallest cluster size supported is 512.
 * This value allows room for the needed overhead. */
#define FS_ITEM_MAX  106

/* Maximum length of a symlink destination.  Should be the same as
 * FS_ITEM_MAX, for the same reasons given in its definition. */
#define FS_MAX_SYMLINK_TARGET  107

/* Size of each piece of a longname stored in the value field of the
 * database. */
#define FS_LONGNAME_PIECE_SIZE  108

/* Maximum 'value' size for a database entry.  Must be able to store the
 * largest item or symlink used by the filesystem.  There is only one
 * buffer of this size. */
#define FS_MAX_DB_VALUE  128

/* Theshold above which filenames are stored differently.  Because the
 * names are stored in a B-Tree, the length of the name stored there is
 * limited.  Names that are longer than this threshold are stored using a
 * hash and long name auxiliary entries. */
#define FS_SHORTNAME_THRESHOLD  128

/* This is the number of characters from the full filename that are stored
 * in the hash entry.  Prefixing the shortname with characters from the
 * long name causes the names to still generally sort correctly. */
#define FS_SHORTNAME_PREFIX_LEN 8

#endif /* not __FS_CONFIG_H__ */