123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406 |
- #ifndef __UBIFS_H__
- #define __UBIFS_H__
- #ifndef __UBOOT__
- #include <asm/div64.h>
- #include <linux/statfs.h>
- #include <linux/fs.h>
- #include <linux/err.h>
- #include <linux/sched.h>
- #include <linux/slab.h>
- #include <linux/vmalloc.h>
- #include <linux/spinlock.h>
- #include <linux/mutex.h>
- #include <linux/rwsem.h>
- #include <linux/mtd/ubi.h>
- #include <linux/pagemap.h>
- #include <linux/backing-dev.h>
- #include <linux/security.h>
- #include "ubifs-media.h"
- #else
- #include <asm/atomic.h>
- #include <asm-generic/atomic-long.h>
- #include <ubi_uboot.h>
- #include <ubifs_uboot.h>
- #include <linux/ctype.h>
- #include <linux/time.h>
- #include <linux/math64.h>
- #include "ubifs-media.h"
- struct dentry;
- struct file;
- struct iattr;
- struct kstat;
- struct vfsmount;
- extern struct super_block *ubifs_sb;
- extern unsigned int ubifs_msg_flags;
- extern unsigned int ubifs_chk_flags;
- extern unsigned int ubifs_tst_flags;
- #define pgoff_t unsigned long
- struct page {
- pgoff_t index;
- void *addr;
- struct inode *inode;
- };
- void iput(struct inode *inode);
- #define NSEC_PER_SEC 1000000000L
- #define get_seconds() 0
- #define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 })
- struct timespec {
- time_t tv_sec;
- long tv_nsec;
- };
- static struct timespec current_fs_time(struct super_block *sb)
- {
- struct timespec now;
- now.tv_sec = 0;
- now.tv_nsec = 0;
- return now;
- };
- struct qstr {
- unsigned int hash;
- unsigned int len;
- #ifndef __UBOOT__
- const char *name;
- #else
- char *name;
- #endif
- };
- enum {
- SB_UNFROZEN = 0,
- SB_FREEZE_WRITE = 1,
- SB_FREEZE_PAGEFAULT = 2,
- SB_FREEZE_FS = 3,
- SB_FREEZE_COMPLETE = 4,
- };
- #define SB_FREEZE_LEVELS (SB_FREEZE_COMPLETE - 1)
- struct sb_writers {
- #ifndef __UBOOT__
-
- struct percpu_counter counter[SB_FREEZE_LEVELS];
- #endif
- wait_queue_head_t wait;
- int frozen;
- wait_queue_head_t wait_unfrozen;
- #ifdef CONFIG_DEBUG_LOCK_ALLOC
- struct lockdep_map lock_map[SB_FREEZE_LEVELS];
- #endif
- };
- struct address_space {
- struct inode *host;
- #ifndef __UBOOT__
- struct radix_tree_root page_tree;
- #endif
- spinlock_t tree_lock;
- unsigned int i_mmap_writable;
- struct rb_root i_mmap;
- struct list_head i_mmap_nonlinear;
- struct mutex i_mmap_mutex;
-
- unsigned long nrpages;
- pgoff_t writeback_index;
- const struct address_space_operations *a_ops;
- unsigned long flags;
- #ifndef __UBOOT__
- struct backing_dev_info *backing_dev_info;
- #endif
- spinlock_t private_lock;
- struct list_head private_list;
- void *private_data;
- } __attribute__((aligned(sizeof(long))));
- struct inode {
- umode_t i_mode;
- unsigned short i_opflags;
- kuid_t i_uid;
- kgid_t i_gid;
- unsigned int i_flags;
- #ifdef CONFIG_FS_POSIX_ACL
- struct posix_acl *i_acl;
- struct posix_acl *i_default_acl;
- #endif
- const struct inode_operations *i_op;
- struct super_block *i_sb;
- struct address_space *i_mapping;
- #ifdef CONFIG_SECURITY
- void *i_security;
- #endif
-
- unsigned long i_ino;
-
- union {
- const unsigned int i_nlink;
- unsigned int __i_nlink;
- };
- dev_t i_rdev;
- loff_t i_size;
- struct timespec i_atime;
- struct timespec i_mtime;
- struct timespec i_ctime;
- spinlock_t i_lock;
- unsigned short i_bytes;
- unsigned int i_blkbits;
- blkcnt_t i_blocks;
- #ifdef __NEED_I_SIZE_ORDERED
- seqcount_t i_size_seqcount;
- #endif
-
- unsigned long i_state;
- struct mutex i_mutex;
- unsigned long dirtied_when;
- struct hlist_node i_hash;
- struct list_head i_wb_list;
- struct list_head i_lru;
- struct list_head i_sb_list;
- union {
- struct hlist_head i_dentry;
- struct rcu_head i_rcu;
- };
- u64 i_version;
- atomic_t i_count;
- atomic_t i_dio_count;
- atomic_t i_writecount;
- const struct file_operations *i_fop;
- struct file_lock *i_flock;
- struct address_space i_data;
- #ifdef CONFIG_QUOTA
- struct dquot *i_dquot[MAXQUOTAS];
- #endif
- struct list_head i_devices;
- union {
- struct pipe_inode_info *i_pipe;
- struct block_device *i_bdev;
- struct cdev *i_cdev;
- };
- __u32 i_generation;
- #ifdef CONFIG_FSNOTIFY
- __u32 i_fsnotify_mask;
- struct hlist_head i_fsnotify_marks;
- #endif
- #ifdef CONFIG_IMA
- atomic_t i_readcount;
- #endif
- void *i_private;
- };
- struct super_operations {
- struct inode *(*alloc_inode)(struct super_block *sb);
- void (*destroy_inode)(struct inode *);
- void (*dirty_inode) (struct inode *, int flags);
- int (*write_inode) (struct inode *, struct writeback_control *wbc);
- int (*drop_inode) (struct inode *);
- void (*evict_inode) (struct inode *);
- void (*put_super) (struct super_block *);
- int (*sync_fs)(struct super_block *sb, int wait);
- int (*freeze_fs) (struct super_block *);
- int (*unfreeze_fs) (struct super_block *);
- #ifndef __UBOOT__
- int (*statfs) (struct dentry *, struct kstatfs *);
- #endif
- int (*remount_fs) (struct super_block *, int *, char *);
- void (*umount_begin) (struct super_block *);
- #ifndef __UBOOT__
- int (*show_options)(struct seq_file *, struct dentry *);
- int (*show_devname)(struct seq_file *, struct dentry *);
- int (*show_path)(struct seq_file *, struct dentry *);
- int (*show_stats)(struct seq_file *, struct dentry *);
- #endif
- #ifdef CONFIG_QUOTA
- ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
- ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
- #endif
- int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t);
- long (*nr_cached_objects)(struct super_block *, int);
- long (*free_cached_objects)(struct super_block *, long, int);
- };
- struct super_block {
- struct list_head s_list;
- dev_t s_dev;
- unsigned char s_blocksize_bits;
- unsigned long s_blocksize;
- loff_t s_maxbytes;
- struct file_system_type *s_type;
- const struct super_operations *s_op;
- const struct dquot_operations *dq_op;
- const struct quotactl_ops *s_qcop;
- const struct export_operations *s_export_op;
- unsigned long s_flags;
- unsigned long s_magic;
- struct dentry *s_root;
- struct rw_semaphore s_umount;
- int s_count;
- atomic_t s_active;
- #ifdef CONFIG_SECURITY
- void *s_security;
- #endif
- const struct xattr_handler **s_xattr;
- struct list_head s_inodes;
- #ifndef __UBOOT__
- struct hlist_bl_head s_anon;
- #endif
- struct list_head s_mounts;
- struct block_device *s_bdev;
- #ifndef __UBOOT__
- struct backing_dev_info *s_bdi;
- #endif
- struct mtd_info *s_mtd;
- struct hlist_node s_instances;
- #ifndef __UBOOT__
- struct quota_info s_dquot;
- #endif
- struct sb_writers s_writers;
- char s_id[32];
- u8 s_uuid[16];
- void *s_fs_info;
- unsigned int s_max_links;
- #ifndef __UBOOT__
- fmode_t s_mode;
- #endif
-
- u32 s_time_gran;
-
- struct mutex s_vfs_rename_mutex;
-
- char *s_subtype;
- #ifndef __UBOOT__
-
- char __rcu *s_options;
- #endif
- const struct dentry_operations *s_d_op;
-
- int cleancache_poolid;
- #ifndef __UBOOT__
- struct shrinker s_shrink;
- #endif
-
- atomic_long_t s_remove_count;
-
- int s_readonly_remount;
-
- struct workqueue_struct *s_dio_done_wq;
- #ifndef __UBOOT__
-
- struct list_lru s_dentry_lru ____cacheline_aligned_in_smp;
- struct list_lru s_inode_lru ____cacheline_aligned_in_smp;
- #endif
- struct rcu_head rcu;
- };
- struct file_system_type {
- const char *name;
- int fs_flags;
- #define FS_REQUIRES_DEV 1
- #define FS_BINARY_MOUNTDATA 2
- #define FS_HAS_SUBTYPE 4
- #define FS_USERNS_MOUNT 8
- #define FS_USERNS_DEV_MOUNT 16
- #define FS_RENAME_DOES_D_MOVE 32768
- struct dentry *(*mount) (struct file_system_type *, int,
- const char *, void *);
- void (*kill_sb) (struct super_block *);
- struct module *owner;
- struct file_system_type * next;
- struct hlist_head fs_supers;
- #ifndef __UBOOT__
- struct lock_class_key s_lock_key;
- struct lock_class_key s_umount_key;
- struct lock_class_key s_vfs_rename_key;
- struct lock_class_key s_writers_key[SB_FREEZE_LEVELS];
- struct lock_class_key i_lock_key;
- struct lock_class_key i_mutex_key;
- struct lock_class_key i_mutex_dir_key;
- #endif
- };
- struct vfsmount {
- struct dentry *mnt_root;
- struct super_block *mnt_sb;
- int mnt_flags;
- };
- struct path {
- struct vfsmount *mnt;
- struct dentry *dentry;
- };
- struct file {
- struct path f_path;
- #define f_dentry f_path.dentry
- #define f_vfsmnt f_path.mnt
- const struct file_operations *f_op;
- unsigned int f_flags;
- loff_t f_pos;
- unsigned int f_uid, f_gid;
- u64 f_version;
- #ifdef CONFIG_SECURITY
- void *f_security;
- #endif
-
- void *private_data;
- #ifdef CONFIG_EPOLL
-
- struct list_head f_ep_links;
- spinlock_t f_ep_lock;
- #endif
- #ifdef CONFIG_DEBUG_WRITECOUNT
- unsigned long f_mnt_write_state;
- #endif
- };
- #define get_seconds() 0
- #define PAGE_CACHE_SHIFT 12
- #define PAGE_CACHE_SIZE (1 << PAGE_CACHE_SHIFT)
- #if BITS_PER_LONG==32
- #define MAX_LFS_FILESIZE (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
- #elif BITS_PER_LONG==64
- #define MAX_LFS_FILESIZE 0x7fffffffffffffffUL
- #endif
- #define MS_RDONLY 1
- #define MS_NOSUID 2
- #define MS_NODEV 4
- #define MS_NOEXEC 8
- #define MS_SYNCHRONOUS 16
- #define MS_REMOUNT 32
- #define MS_MANDLOCK 64
- #define MS_DIRSYNC 128
- #define MS_NOATIME 1024
- #define MS_NODIRATIME 2048
- #define MS_BIND 4096
- #define MS_MOVE 8192
- #define MS_REC 16384
- #define MS_VERBOSE 32768
- #define MS_SILENT 32768
- #define MS_POSIXACL (1<<16)
- #define MS_UNBINDABLE (1<<17)
- #define MS_PRIVATE (1<<18)
- #define MS_SLAVE (1<<19)
- #define MS_SHARED (1<<20)
- #define MS_RELATIME (1<<21)
- #define MS_KERNMOUNT (1<<22)
- #define MS_I_VERSION (1<<23)
- #define MS_ACTIVE (1<<30)
- #define MS_NOUSER (1<<31)
- #define I_NEW 8
- #define S_SYNC 1
- #define S_NOATIME 2
- #define S_APPEND 4
- #define S_IMMUTABLE 8
- #define S_DEAD 16
- #define S_NOQUOTA 32
- #define S_DIRSYNC 64
- #define S_NOCMTIME 128
- #define S_SWAPFILE 256
- #define S_PRIVATE 512
- #define S_IFMT 00170000
- #define S_IFSOCK 0140000
- #define S_IFLNK 0120000
- #define S_IFREG 0100000
- #define S_IFBLK 0060000
- #define S_IFDIR 0040000
- #define S_IFCHR 0020000
- #define S_IFIFO 0010000
- #define S_ISUID 0004000
- #define S_ISGID 0002000
- #define S_ISVTX 0001000
- #define DT_UNKNOWN 0
- #define DT_FIFO 1
- #define DT_CHR 2
- #define DT_DIR 4
- #define DT_BLK 6
- #define DT_REG 8
- #define DT_LNK 10
- #define DT_SOCK 12
- #define DT_WHT 14
- #define I_DIRTY_SYNC 1
- #define I_DIRTY_DATASYNC 2
- #define I_DIRTY_PAGES 4
- #define I_NEW 8
- #define I_WILL_FREE 16
- #define I_FREEING 32
- #define I_CLEAR 64
- #define __I_LOCK 7
- #define I_LOCK (1 << __I_LOCK)
- #define __I_SYNC 8
- #define I_SYNC (1 << __I_SYNC)
- #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
- #define DNAME_INLINE_LEN_MIN 36
- struct dentry {
- unsigned int d_flags;
- spinlock_t d_lock;
- struct inode *d_inode;
-
- struct hlist_node d_hash;
- struct dentry *d_parent;
- struct qstr d_name;
- struct list_head d_lru;
-
- struct list_head d_subdirs;
- struct list_head d_alias;
- unsigned long d_time;
- struct super_block *d_sb;
- void *d_fsdata;
- #ifdef CONFIG_PROFILING
- struct dcookie_struct *d_cookie;
- #endif
- int d_mounted;
- unsigned char d_iname[DNAME_INLINE_LEN_MIN];
- };
- static inline ino_t parent_ino(struct dentry *dentry)
- {
- ino_t res;
- spin_lock(&dentry->d_lock);
- res = dentry->d_parent->d_inode->i_ino;
- spin_unlock(&dentry->d_lock);
- return res;
- }
- #define module_param_named(...)
- #define mutex_lock_nested(...)
- #define mutex_unlock_nested(...)
- #define mutex_is_locked(...) 0
- #endif
- #define UBIFS_VERSION 1
- #define ubifs_msg(c, fmt, ...) \
- pr_notice("UBIFS (ubi%d:%d): " fmt "\n", \
- (c)->vi.ubi_num, (c)->vi.vol_id, ##__VA_ARGS__)
- #ifndef __UBOOT__
- #define ubifs_err(c, fmt, ...) \
- pr_err("UBIFS error (ubi%d:%d pid %d): %s: " fmt "\n", \
- (c)->vi.ubi_num, (c)->vi.vol_id, current->pid, \
- __func__, ##__VA_ARGS__)
- #define ubifs_warn(c, fmt, ...) \
- pr_warn("UBIFS warning (ubi%d:%d pid %d): %s: " fmt "\n", \
- (c)->vi.ubi_num, (c)->vi.vol_id, current->pid, \
- __func__, ##__VA_ARGS__)
- #else
- #define ubifs_err(c, fmt, ...) \
- pr_err("UBIFS error (ubi%d:%d pid %d): %s: " fmt "\n", \
- (c)->vi.ubi_num, (c)->vi.vol_id, 0, \
- __func__, ##__VA_ARGS__)
- #define ubifs_warn(c, fmt, ...) \
- pr_warn("UBIFS warning (ubi%d:%d pid %d): %s: " fmt "\n", \
- (c)->vi.ubi_num, (c)->vi.vol_id, 0, \
- __func__, ##__VA_ARGS__)
- #endif
- #define ubifs_errc(c, fmt, ...) \
- do { \
- if (!(c)->probing) \
- ubifs_err(c, fmt, ##__VA_ARGS__); \
- } while (0)
- #define UBIFS_SUPER_MAGIC 0x24051905
- #define UBIFS_BLOCKS_PER_PAGE (PAGE_CACHE_SIZE / UBIFS_BLOCK_SIZE)
- #define UBIFS_BLOCKS_PER_PAGE_SHIFT (PAGE_CACHE_SHIFT - UBIFS_BLOCK_SHIFT)
- #define SQNUM_WARN_WATERMARK 0xFFFFFFFF00000000ULL
- #define SQNUM_WATERMARK 0xFFFFFFFFFF000000ULL
- #define MIN_INDEX_LEBS 2
- #define MIN_WRITE_SZ (UBIFS_DATA_NODE_SZ + 8)
- #define INUM_WARN_WATERMARK 0xFFF00000
- #define INUM_WATERMARK 0xFFFFFF00
- #define LPT_HEAP_SZ 256
- #define BGT_NAME_PATTERN "ubifs_bgt%d_%d"
- #define WBUF_TIMEOUT_SOFTLIMIT 3
- #define WBUF_TIMEOUT_HARDLIMIT 5
- #define MAX_INUM 0xFFFFFFFF
- #define NONDATA_JHEADS_CNT 2
- #define GCHD UBIFS_GC_HEAD
- #define BASEHD UBIFS_BASE_HEAD
- #define DATAHD UBIFS_DATA_HEAD
- #define LPROPS_NC 0x80000001
- #define UBIFS_TRUN_KEY UBIFS_KEY_TYPES_CNT
- #define UBIFS_INVALID_KEY UBIFS_KEY_TYPES_CNT
- #define CALC_DENT_SIZE(name_len) ALIGN(UBIFS_DENT_NODE_SZ + (name_len) + 1, 8)
- #define CALC_XATTR_BYTES(data_len) ALIGN(UBIFS_INO_NODE_SZ + (data_len) + 1, 8)
- #define OLD_ZNODE_AGE 20
- #define YOUNG_ZNODE_AGE 5
- #define WORST_COMPR_FACTOR 2
- #define COMPRESSED_DATA_NODE_BUF_SZ \
- (UBIFS_DATA_NODE_SZ + UBIFS_BLOCK_SIZE * WORST_COMPR_FACTOR)
- #define BOTTOM_UP_HEIGHT 64
- #define UBIFS_MAX_BULK_READ 32
- enum {
- WB_MUTEX_1 = 0,
- WB_MUTEX_2 = 1,
- WB_MUTEX_3 = 2,
- };
- enum {
- DIRTY_ZNODE = 0,
- COW_ZNODE = 1,
- OBSOLETE_ZNODE = 2,
- };
- enum {
- COMMIT_RESTING = 0,
- COMMIT_BACKGROUND,
- COMMIT_REQUIRED,
- COMMIT_RUNNING_BACKGROUND,
- COMMIT_RUNNING_REQUIRED,
- COMMIT_BROKEN,
- };
- enum {
- SCANNED_GARBAGE = 0,
- SCANNED_EMPTY_SPACE = -1,
- SCANNED_A_NODE = -2,
- SCANNED_A_CORRUPT_NODE = -3,
- SCANNED_A_BAD_PAD_NODE = -4,
- };
- enum {
- DIRTY_CNODE = 0,
- OBSOLETE_CNODE = 1,
- COW_CNODE = 2,
- };
- enum {
- LTAB_DIRTY = 1,
- LSAVE_DIRTY = 2,
- };
- enum {
- LEB_FREED,
- LEB_FREED_IDX,
- LEB_RETAINED,
- };
- struct ubifs_old_idx {
- struct rb_node rb;
- int lnum;
- int offs;
- };
- union ubifs_key {
- uint8_t u8[UBIFS_SK_LEN];
- uint32_t u32[UBIFS_SK_LEN/4];
- uint64_t u64[UBIFS_SK_LEN/8];
- __le32 j32[UBIFS_SK_LEN/4];
- };
- struct ubifs_scan_node {
- struct list_head list;
- union ubifs_key key;
- unsigned long long sqnum;
- int type;
- int offs;
- int len;
- void *node;
- };
- struct ubifs_scan_leb {
- int lnum;
- int nodes_cnt;
- struct list_head nodes;
- int endpt;
- void *buf;
- };
- struct ubifs_gced_idx_leb {
- struct list_head list;
- int lnum;
- int unmap;
- };
- struct ubifs_inode {
- struct inode vfs_inode;
- unsigned long long creat_sqnum;
- unsigned long long del_cmtno;
- unsigned int xattr_size;
- unsigned int xattr_cnt;
- unsigned int xattr_names;
- unsigned int dirty:1;
- unsigned int xattr:1;
- unsigned int bulk_read:1;
- unsigned int compr_type:2;
- struct mutex ui_mutex;
- spinlock_t ui_lock;
- loff_t synced_i_size;
- loff_t ui_size;
- int flags;
- pgoff_t last_page_read;
- pgoff_t read_in_a_row;
- int data_len;
- void *data;
- };
- struct ubifs_unclean_leb {
- struct list_head list;
- int lnum;
- int endpt;
- };
- enum {
- LPROPS_UNCAT = 0,
- LPROPS_DIRTY = 1,
- LPROPS_DIRTY_IDX = 2,
- LPROPS_FREE = 3,
- LPROPS_HEAP_CNT = 3,
- LPROPS_EMPTY = 4,
- LPROPS_FREEABLE = 5,
- LPROPS_FRDI_IDX = 6,
- LPROPS_CAT_MASK = 15,
- LPROPS_TAKEN = 16,
- LPROPS_INDEX = 32,
- };
- struct ubifs_lprops {
- int free;
- int dirty;
- int flags;
- int lnum;
- union {
- struct list_head list;
- int hpos;
- };
- };
- struct ubifs_lpt_lprops {
- int free;
- int dirty;
- unsigned tgc:1;
- unsigned cmt:1;
- };
- struct ubifs_lp_stats {
- int empty_lebs;
- int taken_empty_lebs;
- int idx_lebs;
- long long total_free;
- long long total_dirty;
- long long total_used;
- long long total_dead;
- long long total_dark;
- };
- struct ubifs_nnode;
- struct ubifs_cnode {
- struct ubifs_nnode *parent;
- struct ubifs_cnode *cnext;
- unsigned long flags;
- int iip;
- int level;
- int num;
- };
- struct ubifs_pnode {
- struct ubifs_nnode *parent;
- struct ubifs_cnode *cnext;
- unsigned long flags;
- int iip;
- int level;
- int num;
- struct ubifs_lprops lprops[UBIFS_LPT_FANOUT];
- };
- struct ubifs_nbranch {
- int lnum;
- int offs;
- union {
- struct ubifs_nnode *nnode;
- struct ubifs_pnode *pnode;
- struct ubifs_cnode *cnode;
- };
- };
- struct ubifs_nnode {
- struct ubifs_nnode *parent;
- struct ubifs_cnode *cnext;
- unsigned long flags;
- int iip;
- int level;
- int num;
- struct ubifs_nbranch nbranch[UBIFS_LPT_FANOUT];
- };
- struct ubifs_lpt_heap {
- struct ubifs_lprops **arr;
- int cnt;
- int max_cnt;
- };
- enum {
- LPT_SCAN_CONTINUE = 0,
- LPT_SCAN_ADD = 1,
- LPT_SCAN_STOP = 2,
- };
- struct ubifs_info;
- typedef int (*ubifs_lpt_scan_callback)(struct ubifs_info *c,
- const struct ubifs_lprops *lprops,
- int in_tree, void *data);
- struct ubifs_wbuf {
- struct ubifs_info *c;
- void *buf;
- int lnum;
- int offs;
- int avail;
- int used;
- int size;
- int jhead;
- int (*sync_callback)(struct ubifs_info *c, int lnum, int free, int pad);
- struct mutex io_mutex;
- spinlock_t lock;
- unsigned int no_timer:1;
- unsigned int need_sync:1;
- int next_ino;
- ino_t *inodes;
- };
- struct ubifs_bud {
- int lnum;
- int start;
- int jhead;
- struct list_head list;
- struct rb_node rb;
- };
- struct ubifs_jhead {
- struct ubifs_wbuf wbuf;
- struct list_head buds_list;
- unsigned int grouped:1;
- };
- struct ubifs_zbranch {
- union ubifs_key key;
- union {
- struct ubifs_znode *znode;
- void *leaf;
- };
- int lnum;
- int offs;
- int len;
- };
- struct ubifs_znode {
- struct ubifs_znode *parent;
- struct ubifs_znode *cnext;
- unsigned long flags;
- unsigned long time;
- int level;
- int child_cnt;
- int iip;
- int alt;
- int lnum;
- int offs;
- int len;
- struct ubifs_zbranch zbranch[];
- };
- struct bu_info {
- union ubifs_key key;
- struct ubifs_zbranch zbranch[UBIFS_MAX_BULK_READ];
- void *buf;
- int buf_len;
- int gc_seq;
- int cnt;
- int blk_cnt;
- int eof;
- };
- struct ubifs_node_range {
- union {
- int len;
- int min_len;
- };
- int max_len;
- };
- struct ubifs_compressor {
- int compr_type;
- struct crypto_comp *cc;
- struct mutex *comp_mutex;
- struct mutex *decomp_mutex;
- const char *name;
- const char *capi_name;
- #ifdef __UBOOT__
- int (*decompress)(const unsigned char *in, size_t in_len,
- unsigned char *out, size_t *out_len);
- #endif
- };
- struct ubifs_budget_req {
- unsigned int fast:1;
- unsigned int recalculate:1;
- #ifndef UBIFS_DEBUG
- unsigned int new_page:1;
- unsigned int dirtied_page:1;
- unsigned int new_dent:1;
- unsigned int mod_dent:1;
- unsigned int new_ino:1;
- unsigned int new_ino_d:13;
- unsigned int dirtied_ino:4;
- unsigned int dirtied_ino_d:15;
- #else
-
- unsigned int new_page;
- unsigned int dirtied_page;
- unsigned int new_dent;
- unsigned int mod_dent;
- unsigned int new_ino;
- unsigned int new_ino_d;
- unsigned int dirtied_ino;
- unsigned int dirtied_ino_d;
- #endif
- int idx_growth;
- int data_growth;
- int dd_growth;
- };
- struct ubifs_orphan {
- struct rb_node rb;
- struct list_head list;
- struct list_head new_list;
- struct ubifs_orphan *cnext;
- struct ubifs_orphan *dnext;
- ino_t inum;
- unsigned new:1;
- unsigned cmt:1;
- unsigned del:1;
- };
- struct ubifs_mount_opts {
- unsigned int unmount_mode:2;
- unsigned int bulk_read:2;
- unsigned int chk_data_crc:2;
- unsigned int override_compr:1;
- unsigned int compr_type:2;
- };
- struct ubifs_budg_info {
- long long idx_growth;
- long long data_growth;
- long long dd_growth;
- long long uncommitted_idx;
- unsigned long long old_idx_sz;
- int min_idx_lebs;
- unsigned int nospace:1;
- unsigned int nospace_rp:1;
- int page_budget;
- int inode_budget;
- int dent_budget;
- };
- struct ubifs_debug_info;
- struct ubifs_info {
- struct super_block *vfs_sb;
- #ifndef __UBOOT__
- struct backing_dev_info bdi;
- #endif
- ino_t highest_inum;
- unsigned long long max_sqnum;
- unsigned long long cmt_no;
- spinlock_t cnt_lock;
- int fmt_version;
- int ro_compat_version;
- unsigned char uuid[16];
- int lhead_lnum;
- int lhead_offs;
- int ltail_lnum;
- struct mutex log_mutex;
- int min_log_bytes;
- long long cmt_bud_bytes;
- struct rb_root buds;
- long long bud_bytes;
- spinlock_t buds_lock;
- int jhead_cnt;
- struct ubifs_jhead *jheads;
- long long max_bud_bytes;
- long long bg_bud_bytes;
- struct list_head old_buds;
- int max_bud_cnt;
- struct rw_semaphore commit_sem;
- int cmt_state;
- spinlock_t cs_lock;
- wait_queue_head_t cmt_wq;
- unsigned int big_lpt:1;
- unsigned int space_fixup:1;
- unsigned int no_chk_data_crc:1;
- unsigned int bulk_read:1;
- unsigned int default_compr:2;
- unsigned int rw_incompat:1;
- struct mutex tnc_mutex;
- struct ubifs_zbranch zroot;
- struct ubifs_znode *cnext;
- struct ubifs_znode *enext;
- int *gap_lebs;
- void *cbuf;
- void *ileb_buf;
- int ileb_len;
- int ihead_lnum;
- int ihead_offs;
- int *ilebs;
- int ileb_cnt;
- int ileb_nxt;
- struct rb_root old_idx;
- int *bottom_up_buf;
- struct ubifs_mst_node *mst_node;
- int mst_offs;
- int max_bu_buf_len;
- struct mutex bu_mutex;
- struct bu_info bu;
- struct mutex write_reserve_mutex;
- void *write_reserve_buf;
- int log_lebs;
- long long log_bytes;
- int log_last;
- int lpt_lebs;
- int lpt_first;
- int lpt_last;
- int orph_lebs;
- int orph_first;
- int orph_last;
- int main_lebs;
- int main_first;
- long long main_bytes;
- uint8_t key_hash_type;
- uint32_t (*key_hash)(const char *str, int len);
- int key_fmt;
- int key_len;
- int fanout;
- int min_io_size;
- int min_io_shift;
- int max_write_size;
- int max_write_shift;
- int leb_size;
- int leb_start;
- int half_leb_size;
- int idx_leb_size;
- int leb_cnt;
- int max_leb_cnt;
- int old_leb_cnt;
- unsigned int ro_media:1;
- unsigned int ro_mount:1;
- unsigned int ro_error:1;
- atomic_long_t dirty_pg_cnt;
- atomic_long_t dirty_zn_cnt;
- atomic_long_t clean_zn_cnt;
- spinlock_t space_lock;
- struct ubifs_lp_stats lst;
- struct ubifs_budg_info bi;
- unsigned long long calc_idx_sz;
- int ref_node_alsz;
- int mst_node_alsz;
- int min_idx_node_sz;
- int max_idx_node_sz;
- long long max_inode_sz;
- int max_znode_sz;
- int leb_overhead;
- int dead_wm;
- int dark_wm;
- int block_cnt;
- struct ubifs_node_range ranges[UBIFS_NODE_TYPES_CNT];
- struct ubi_volume_desc *ubi;
- struct ubi_device_info di;
- struct ubi_volume_info vi;
- struct rb_root orph_tree;
- struct list_head orph_list;
- struct list_head orph_new;
- struct ubifs_orphan *orph_cnext;
- struct ubifs_orphan *orph_dnext;
- spinlock_t orphan_lock;
- void *orph_buf;
- int new_orphans;
- int cmt_orphans;
- int tot_orphans;
- int max_orphans;
- int ohead_lnum;
- int ohead_offs;
- int no_orphs;
- struct task_struct *bgt;
- char bgt_name[sizeof(BGT_NAME_PATTERN) + 9];
- int need_bgt;
- int need_wbuf_sync;
- int gc_lnum;
- void *sbuf;
- struct list_head idx_gc;
- int idx_gc_cnt;
- int gc_seq;
- int gced_lnum;
- struct list_head infos_list;
- struct mutex umount_mutex;
- unsigned int shrinker_run_no;
- int space_bits;
- int lpt_lnum_bits;
- int lpt_offs_bits;
- int lpt_spc_bits;
- int pcnt_bits;
- int lnum_bits;
- int nnode_sz;
- int pnode_sz;
- int ltab_sz;
- int lsave_sz;
- int pnode_cnt;
- int nnode_cnt;
- int lpt_hght;
- int pnodes_have;
- struct mutex lp_mutex;
- int lpt_lnum;
- int lpt_offs;
- int nhead_lnum;
- int nhead_offs;
- int lpt_drty_flgs;
- int dirty_nn_cnt;
- int dirty_pn_cnt;
- int check_lpt_free;
- long long lpt_sz;
- void *lpt_nod_buf;
- void *lpt_buf;
- struct ubifs_nnode *nroot;
- struct ubifs_cnode *lpt_cnext;
- struct ubifs_lpt_heap lpt_heap[LPROPS_HEAP_CNT];
- struct ubifs_lpt_heap dirty_idx;
- struct list_head uncat_list;
- struct list_head empty_list;
- struct list_head freeable_list;
- struct list_head frdi_idx_list;
- int freeable_cnt;
- int in_a_category_cnt;
- int ltab_lnum;
- int ltab_offs;
- struct ubifs_lpt_lprops *ltab;
- struct ubifs_lpt_lprops *ltab_cmt;
- int lsave_cnt;
- int lsave_lnum;
- int lsave_offs;
- int *lsave;
- int lscan_lnum;
- long long rp_size;
- long long report_rp_size;
- kuid_t rp_uid;
- kgid_t rp_gid;
-
- unsigned int empty:1;
- unsigned int need_recovery:1;
- unsigned int replaying:1;
- unsigned int mounting:1;
- unsigned int remounting_rw:1;
- unsigned int probing:1;
- struct list_head replay_list;
- struct list_head replay_buds;
- unsigned long long cs_sqnum;
- unsigned long long replay_sqnum;
- struct list_head unclean_leb_list;
- struct ubifs_mst_node *rcvrd_mst_node;
- struct rb_root size_tree;
- struct ubifs_mount_opts mount_opts;
- #ifndef __UBOOT__
- struct ubifs_debug_info *dbg;
- #endif
- };
- extern struct list_head ubifs_infos;
- extern spinlock_t ubifs_infos_lock;
- extern atomic_long_t ubifs_clean_zn_cnt;
- extern struct kmem_cache *ubifs_inode_slab;
- extern const struct super_operations ubifs_super_operations;
- extern const struct xattr_handler *ubifs_xattr_handlers[];
- extern const struct address_space_operations ubifs_file_address_operations;
- extern const struct file_operations ubifs_file_operations;
- extern const struct inode_operations ubifs_file_inode_operations;
- extern const struct file_operations ubifs_dir_operations;
- extern const struct inode_operations ubifs_dir_inode_operations;
- extern const struct inode_operations ubifs_symlink_inode_operations;
- extern struct backing_dev_info ubifs_backing_dev_info;
- extern struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT];
- void ubifs_ro_mode(struct ubifs_info *c, int err);
- int ubifs_leb_read(const struct ubifs_info *c, int lnum, void *buf, int offs,
- int len, int even_ebadmsg);
- int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs,
- int len);
- int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len);
- int ubifs_leb_unmap(struct ubifs_info *c, int lnum);
- int ubifs_leb_map(struct ubifs_info *c, int lnum);
- int ubifs_is_mapped(const struct ubifs_info *c, int lnum);
- int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len);
- int ubifs_wbuf_seek_nolock(struct ubifs_wbuf *wbuf, int lnum, int offs);
- int ubifs_wbuf_init(struct ubifs_info *c, struct ubifs_wbuf *wbuf);
- int ubifs_read_node(const struct ubifs_info *c, void *buf, int type, int len,
- int lnum, int offs);
- int ubifs_read_node_wbuf(struct ubifs_wbuf *wbuf, void *buf, int type, int len,
- int lnum, int offs);
- int ubifs_write_node(struct ubifs_info *c, void *node, int len, int lnum,
- int offs);
- int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum,
- int offs, int quiet, int must_chk_crc);
- void ubifs_prepare_node(struct ubifs_info *c, void *buf, int len, int pad);
- void ubifs_prep_grp_node(struct ubifs_info *c, void *node, int len, int last);
- int ubifs_io_init(struct ubifs_info *c);
- void ubifs_pad(const struct ubifs_info *c, void *buf, int pad);
- int ubifs_wbuf_sync_nolock(struct ubifs_wbuf *wbuf);
- int ubifs_bg_wbufs_sync(struct ubifs_info *c);
- void ubifs_wbuf_add_ino_nolock(struct ubifs_wbuf *wbuf, ino_t inum);
- int ubifs_sync_wbufs_by_inode(struct ubifs_info *c, struct inode *inode);
- struct ubifs_scan_leb *ubifs_scan(const struct ubifs_info *c, int lnum,
- int offs, void *sbuf, int quiet);
- void ubifs_scan_destroy(struct ubifs_scan_leb *sleb);
- int ubifs_scan_a_node(const struct ubifs_info *c, void *buf, int len, int lnum,
- int offs, int quiet);
- struct ubifs_scan_leb *ubifs_start_scan(const struct ubifs_info *c, int lnum,
- int offs, void *sbuf);
- void ubifs_end_scan(const struct ubifs_info *c, struct ubifs_scan_leb *sleb,
- int lnum, int offs);
- int ubifs_add_snod(const struct ubifs_info *c, struct ubifs_scan_leb *sleb,
- void *buf, int offs);
- void ubifs_scanned_corruption(const struct ubifs_info *c, int lnum, int offs,
- void *buf);
- void ubifs_add_bud(struct ubifs_info *c, struct ubifs_bud *bud);
- void ubifs_create_buds_lists(struct ubifs_info *c);
- int ubifs_add_bud_to_log(struct ubifs_info *c, int jhead, int lnum, int offs);
- struct ubifs_bud *ubifs_search_bud(struct ubifs_info *c, int lnum);
- struct ubifs_wbuf *ubifs_get_wbuf(struct ubifs_info *c, int lnum);
- int ubifs_log_start_commit(struct ubifs_info *c, int *ltail_lnum);
- int ubifs_log_end_commit(struct ubifs_info *c, int new_ltail_lnum);
- int ubifs_log_post_commit(struct ubifs_info *c, int old_ltail_lnum);
- int ubifs_consolidate_log(struct ubifs_info *c);
- int ubifs_jnl_update(struct ubifs_info *c, const struct inode *dir,
- const struct qstr *nm, const struct inode *inode,
- int deletion, int xent);
- int ubifs_jnl_write_data(struct ubifs_info *c, const struct inode *inode,
- const union ubifs_key *key, const void *buf, int len);
- int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode);
- int ubifs_jnl_delete_inode(struct ubifs_info *c, const struct inode *inode);
- int ubifs_jnl_rename(struct ubifs_info *c, const struct inode *old_dir,
- const struct dentry *old_dentry,
- const struct inode *new_dir,
- const struct dentry *new_dentry, int sync);
- int ubifs_jnl_truncate(struct ubifs_info *c, const struct inode *inode,
- loff_t old_size, loff_t new_size);
- int ubifs_jnl_delete_xattr(struct ubifs_info *c, const struct inode *host,
- const struct inode *inode, const struct qstr *nm);
- int ubifs_jnl_change_xattr(struct ubifs_info *c, const struct inode *inode1,
- const struct inode *inode2);
- int ubifs_budget_space(struct ubifs_info *c, struct ubifs_budget_req *req);
- void ubifs_release_budget(struct ubifs_info *c, struct ubifs_budget_req *req);
- void ubifs_release_dirty_inode_budget(struct ubifs_info *c,
- struct ubifs_inode *ui);
- int ubifs_budget_inode_op(struct ubifs_info *c, struct inode *inode,
- struct ubifs_budget_req *req);
- void ubifs_release_ino_dirty(struct ubifs_info *c, struct inode *inode,
- struct ubifs_budget_req *req);
- void ubifs_cancel_ino_op(struct ubifs_info *c, struct inode *inode,
- struct ubifs_budget_req *req);
- long long ubifs_get_free_space(struct ubifs_info *c);
- long long ubifs_get_free_space_nolock(struct ubifs_info *c);
- int ubifs_calc_min_idx_lebs(struct ubifs_info *c);
- void ubifs_convert_page_budget(struct ubifs_info *c);
- long long ubifs_reported_space(const struct ubifs_info *c, long long free);
- long long ubifs_calc_available(const struct ubifs_info *c, int min_idx_lebs);
- int ubifs_find_free_space(struct ubifs_info *c, int min_space, int *offs,
- int squeeze);
- int ubifs_find_free_leb_for_idx(struct ubifs_info *c);
- int ubifs_find_dirty_leb(struct ubifs_info *c, struct ubifs_lprops *ret_lp,
- int min_space, int pick_free);
- int ubifs_find_dirty_idx_leb(struct ubifs_info *c);
- int ubifs_save_dirty_idx_lnums(struct ubifs_info *c);
- int ubifs_lookup_level0(struct ubifs_info *c, const union ubifs_key *key,
- struct ubifs_znode **zn, int *n);
- int ubifs_tnc_lookup_nm(struct ubifs_info *c, const union ubifs_key *key,
- void *node, const struct qstr *nm);
- int ubifs_tnc_locate(struct ubifs_info *c, const union ubifs_key *key,
- void *node, int *lnum, int *offs);
- int ubifs_tnc_add(struct ubifs_info *c, const union ubifs_key *key, int lnum,
- int offs, int len);
- int ubifs_tnc_replace(struct ubifs_info *c, const union ubifs_key *key,
- int old_lnum, int old_offs, int lnum, int offs, int len);
- int ubifs_tnc_add_nm(struct ubifs_info *c, const union ubifs_key *key,
- int lnum, int offs, int len, const struct qstr *nm);
- int ubifs_tnc_remove(struct ubifs_info *c, const union ubifs_key *key);
- int ubifs_tnc_remove_nm(struct ubifs_info *c, const union ubifs_key *key,
- const struct qstr *nm);
- int ubifs_tnc_remove_range(struct ubifs_info *c, union ubifs_key *from_key,
- union ubifs_key *to_key);
- int ubifs_tnc_remove_ino(struct ubifs_info *c, ino_t inum);
- struct ubifs_dent_node *ubifs_tnc_next_ent(struct ubifs_info *c,
- union ubifs_key *key,
- const struct qstr *nm);
- void ubifs_tnc_close(struct ubifs_info *c);
- int ubifs_tnc_has_node(struct ubifs_info *c, union ubifs_key *key, int level,
- int lnum, int offs, int is_idx);
- int ubifs_dirty_idx_node(struct ubifs_info *c, union ubifs_key *key, int level,
- int lnum, int offs);
- void destroy_old_idx(struct ubifs_info *c);
- int is_idx_node_in_tnc(struct ubifs_info *c, union ubifs_key *key, int level,
- int lnum, int offs);
- int insert_old_idx_znode(struct ubifs_info *c, struct ubifs_znode *znode);
- int ubifs_tnc_get_bu_keys(struct ubifs_info *c, struct bu_info *bu);
- int ubifs_tnc_bulk_read(struct ubifs_info *c, struct bu_info *bu);
- struct ubifs_znode *ubifs_tnc_levelorder_next(struct ubifs_znode *zr,
- struct ubifs_znode *znode);
- int ubifs_search_zbranch(const struct ubifs_info *c,
- const struct ubifs_znode *znode,
- const union ubifs_key *key, int *n);
- struct ubifs_znode *ubifs_tnc_postorder_first(struct ubifs_znode *znode);
- struct ubifs_znode *ubifs_tnc_postorder_next(struct ubifs_znode *znode);
- long ubifs_destroy_tnc_subtree(struct ubifs_znode *zr);
- struct ubifs_znode *ubifs_load_znode(struct ubifs_info *c,
- struct ubifs_zbranch *zbr,
- struct ubifs_znode *parent, int iip);
- int ubifs_tnc_read_node(struct ubifs_info *c, struct ubifs_zbranch *zbr,
- void *node);
- int ubifs_tnc_start_commit(struct ubifs_info *c, struct ubifs_zbranch *zroot);
- int ubifs_tnc_end_commit(struct ubifs_info *c);
- #ifndef __UBOOT__
- unsigned long ubifs_shrink_scan(struct shrinker *shrink,
- struct shrink_control *sc);
- unsigned long ubifs_shrink_count(struct shrinker *shrink,
- struct shrink_control *sc);
- #endif
- int ubifs_bg_thread(void *info);
- void ubifs_commit_required(struct ubifs_info *c);
- void ubifs_request_bg_commit(struct ubifs_info *c);
- int ubifs_run_commit(struct ubifs_info *c);
- void ubifs_recovery_commit(struct ubifs_info *c);
- int ubifs_gc_should_commit(struct ubifs_info *c);
- void ubifs_wait_for_commit(struct ubifs_info *c);
- int ubifs_read_master(struct ubifs_info *c);
- int ubifs_write_master(struct ubifs_info *c);
- int ubifs_read_superblock(struct ubifs_info *c);
- struct ubifs_sb_node *ubifs_read_sb_node(struct ubifs_info *c);
- int ubifs_write_sb_node(struct ubifs_info *c, struct ubifs_sb_node *sup);
- int ubifs_fixup_free_space(struct ubifs_info *c);
- int ubifs_validate_entry(struct ubifs_info *c,
- const struct ubifs_dent_node *dent);
- int ubifs_replay_journal(struct ubifs_info *c);
- int ubifs_garbage_collect(struct ubifs_info *c, int anyway);
- int ubifs_gc_start_commit(struct ubifs_info *c);
- int ubifs_gc_end_commit(struct ubifs_info *c);
- void ubifs_destroy_idx_gc(struct ubifs_info *c);
- int ubifs_get_idx_gc_leb(struct ubifs_info *c);
- int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp);
- int ubifs_add_orphan(struct ubifs_info *c, ino_t inum);
- void ubifs_delete_orphan(struct ubifs_info *c, ino_t inum);
- int ubifs_orphan_start_commit(struct ubifs_info *c);
- int ubifs_orphan_end_commit(struct ubifs_info *c);
- int ubifs_mount_orphans(struct ubifs_info *c, int unclean, int read_only);
- int ubifs_clear_orphans(struct ubifs_info *c);
- int ubifs_calc_lpt_geom(struct ubifs_info *c);
- int ubifs_create_dflt_lpt(struct ubifs_info *c, int *main_lebs, int lpt_first,
- int *lpt_lebs, int *big_lpt);
- int ubifs_lpt_init(struct ubifs_info *c, int rd, int wr);
- struct ubifs_lprops *ubifs_lpt_lookup(struct ubifs_info *c, int lnum);
- struct ubifs_lprops *ubifs_lpt_lookup_dirty(struct ubifs_info *c, int lnum);
- int ubifs_lpt_scan_nolock(struct ubifs_info *c, int start_lnum, int end_lnum,
- ubifs_lpt_scan_callback scan_cb, void *data);
- void ubifs_pack_lsave(struct ubifs_info *c, void *buf, int *lsave);
- void ubifs_pack_ltab(struct ubifs_info *c, void *buf,
- struct ubifs_lpt_lprops *ltab);
- void ubifs_pack_pnode(struct ubifs_info *c, void *buf,
- struct ubifs_pnode *pnode);
- void ubifs_pack_nnode(struct ubifs_info *c, void *buf,
- struct ubifs_nnode *nnode);
- struct ubifs_pnode *ubifs_get_pnode(struct ubifs_info *c,
- struct ubifs_nnode *parent, int iip);
- struct ubifs_nnode *ubifs_get_nnode(struct ubifs_info *c,
- struct ubifs_nnode *parent, int iip);
- int ubifs_read_nnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip);
- void ubifs_add_lpt_dirt(struct ubifs_info *c, int lnum, int dirty);
- void ubifs_add_nnode_dirt(struct ubifs_info *c, struct ubifs_nnode *nnode);
- uint32_t ubifs_unpack_bits(uint8_t **addr, int *pos, int nrbits);
- struct ubifs_nnode *ubifs_first_nnode(struct ubifs_info *c, int *hght);
- int ubifs_unpack_nnode(const struct ubifs_info *c, void *buf,
- struct ubifs_nnode *nnode);
- int ubifs_lpt_start_commit(struct ubifs_info *c);
- int ubifs_lpt_end_commit(struct ubifs_info *c);
- int ubifs_lpt_post_commit(struct ubifs_info *c);
- void ubifs_lpt_free(struct ubifs_info *c, int wr_only);
- const struct ubifs_lprops *ubifs_change_lp(struct ubifs_info *c,
- const struct ubifs_lprops *lp,
- int free, int dirty, int flags,
- int idx_gc_cnt);
- void ubifs_get_lp_stats(struct ubifs_info *c, struct ubifs_lp_stats *lst);
- void ubifs_add_to_cat(struct ubifs_info *c, struct ubifs_lprops *lprops,
- int cat);
- void ubifs_replace_cat(struct ubifs_info *c, struct ubifs_lprops *old_lprops,
- struct ubifs_lprops *new_lprops);
- void ubifs_ensure_cat(struct ubifs_info *c, struct ubifs_lprops *lprops);
- int ubifs_categorize_lprops(const struct ubifs_info *c,
- const struct ubifs_lprops *lprops);
- int ubifs_change_one_lp(struct ubifs_info *c, int lnum, int free, int dirty,
- int flags_set, int flags_clean, int idx_gc_cnt);
- int ubifs_update_one_lp(struct ubifs_info *c, int lnum, int free, int dirty,
- int flags_set, int flags_clean);
- int ubifs_read_one_lp(struct ubifs_info *c, int lnum, struct ubifs_lprops *lp);
- const struct ubifs_lprops *ubifs_fast_find_free(struct ubifs_info *c);
- const struct ubifs_lprops *ubifs_fast_find_empty(struct ubifs_info *c);
- const struct ubifs_lprops *ubifs_fast_find_freeable(struct ubifs_info *c);
- const struct ubifs_lprops *ubifs_fast_find_frdi_idx(struct ubifs_info *c);
- int ubifs_calc_dark(const struct ubifs_info *c, int spc);
- int ubifs_fsync(struct file *file, loff_t start, loff_t end, int datasync);
- int ubifs_setattr(struct dentry *dentry, struct iattr *attr);
- struct inode *ubifs_new_inode(struct ubifs_info *c, const struct inode *dir,
- umode_t mode);
- int ubifs_getattr(struct vfsmount *mnt, struct dentry *dentry,
- struct kstat *stat);
- int ubifs_setxattr(struct dentry *dentry, const char *name,
- const void *value, size_t size, int flags);
- ssize_t ubifs_getxattr(struct dentry *dentry, const char *name, void *buf,
- size_t size);
- ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size);
- int ubifs_removexattr(struct dentry *dentry, const char *name);
- int ubifs_init_security(struct inode *dentry, struct inode *inode,
- const struct qstr *qstr);
- struct inode *ubifs_iget(struct super_block *sb, unsigned long inum);
- int ubifs_iput(struct inode *inode);
- int ubifs_recover_master_node(struct ubifs_info *c);
- int ubifs_write_rcvrd_mst_node(struct ubifs_info *c);
- struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum,
- int offs, void *sbuf, int jhead);
- struct ubifs_scan_leb *ubifs_recover_log_leb(struct ubifs_info *c, int lnum,
- int offs, void *sbuf);
- int ubifs_recover_inl_heads(struct ubifs_info *c, void *sbuf);
- int ubifs_clean_lebs(struct ubifs_info *c, void *sbuf);
- int ubifs_rcvry_gc_commit(struct ubifs_info *c);
- int ubifs_recover_size_accum(struct ubifs_info *c, union ubifs_key *key,
- int deletion, loff_t new_size);
- int ubifs_recover_size(struct ubifs_info *c);
- void ubifs_destroy_size_tree(struct ubifs_info *c);
- long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
- void ubifs_set_inode_flags(struct inode *inode);
- #ifdef CONFIG_COMPAT
- long ubifs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
- #endif
- int __init ubifs_compressors_init(void);
- void ubifs_compressors_exit(void);
- void ubifs_compress(const struct ubifs_info *c, const void *in_buf, int in_len,
- void *out_buf, int *out_len, int *compr_type);
- int ubifs_decompress(const struct ubifs_info *c, const void *buf, int len,
- void *out, int *out_len, int compr_type);
- #include "debug.h"
- #include "misc.h"
- #include "key.h"
- #ifdef __UBOOT__
- void ubifs_umount(struct ubifs_info *c);
- #endif
- #endif
|