X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=yaffs_vfs_multi.c;h=6e2f8f8a963d89c018d82a41e77cb98fcc5f47cb;hp=d6c25b55a1dcbdbbbeafe21ea765b70b24e8a976;hb=a233a8fc212a32a50cc5f572cd4946e91cc9ca93;hpb=a5bab2056ca3c68d3e15568f81a6e1d697d23da5 diff --git a/yaffs_vfs_multi.c b/yaffs_vfs_multi.c index d6c25b5..6e2f8f8 100644 --- a/yaffs_vfs_multi.c +++ b/yaffs_vfs_multi.c @@ -24,11 +24,11 @@ * the VFS. * * Special notes: - * >> 2.4: sb->u.generic_sbp points to the yaffs_dev_t associated with + * >> 2.4: sb->u.generic_sbp points to the struct yaffs_dev associated with * this superblock - * >> 2.6: sb->s_fs_info points to the yaffs_dev_t associated with this + * >> 2.6: sb->s_fs_info points to the struct yaffs_dev associated with this * superblock - * >> inode->u.generic_ip points to the associated yaffs_obj_t. + * >> inode->u.generic_ip points to the associated struct yaffs_obj. */ /* @@ -163,6 +163,7 @@ static uint32_t YCALCBLOCKS(uint64_t partition_size, uint32_t block_size) #include "yportenv.h" #include "yaffs_trace.h" #include "yaffs_guts.h" +#include "yaffs_attribs.h" #include "yaffs_linux.h" @@ -209,13 +210,13 @@ static struct inode *yaffs_iget(struct super_block *sb, unsigned long ino); #define yaffs_inode_to_obj_lv(iptr) ((iptr)->u.generic_ip) #endif -#define yaffs_inode_to_obj(iptr) ((yaffs_obj_t *)(yaffs_inode_to_obj_lv(iptr))) +#define yaffs_inode_to_obj(iptr) ((struct yaffs_obj *)(yaffs_inode_to_obj_lv(iptr))) #define yaffs_dentry_to_obj(dptr) yaffs_inode_to_obj((dptr)->d_inode) #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) -#define yaffs_super_to_dev(sb) ((yaffs_dev_t *)sb->s_fs_info) +#define yaffs_super_to_dev(sb) ((struct yaffs_dev *)sb->s_fs_info) #else -#define yaffs_super_to_dev(sb) ((yaffs_dev_t *)sb->u.generic_sbp) +#define yaffs_super_to_dev(sb) ((struct yaffs_dev *)sb->u.generic_sbp) #endif @@ -340,7 +341,7 @@ static void *yaffs_follow_link(struct dentry *dentry, struct nameidata *nd); static int yaffs_follow_link(struct dentry *dentry, struct nameidata *nd); #endif -static void yaffs_touch_super(yaffs_dev_t *dev); +static void yaffs_touch_super(struct yaffs_dev *dev); static loff_t yaffs_dir_llseek(struct file *file, loff_t offset, int origin); @@ -507,19 +508,19 @@ static int yaffs_vfs_setsize(struct inode *inode, loff_t newsize) } -static unsigned yaffs_gc_control_callback(yaffs_dev_t *dev) +static unsigned yaffs_gc_control_callback(struct yaffs_dev *dev) { return yaffs_gc_control; } -static void yaffs_gross_lock(yaffs_dev_t *dev) +static void yaffs_gross_lock(struct yaffs_dev *dev) { T(YAFFS_TRACE_LOCK, (TSTR("yaffs locking %p\n"), current)); down(&(yaffs_dev_to_lc(dev)->gross_lock)); T(YAFFS_TRACE_LOCK, (TSTR("yaffs locked %p\n"), current)); } -static void yaffs_gross_unlock(yaffs_dev_t *dev) +static void yaffs_gross_unlock(struct yaffs_dev *dev) { T(YAFFS_TRACE_LOCK, (TSTR("yaffs unlocking %p\n"), current)); up(&(yaffs_dev_to_lc(dev)->gross_lock)); @@ -552,8 +553,8 @@ struct dentry *yaffs2_get_parent(struct dentry *dentry) struct dentry *parent = ERR_PTR(-ENOENT); struct inode *inode; unsigned long parent_ino; - yaffs_obj_t *d_obj; - yaffs_obj_t *parent_obj; + struct yaffs_obj *d_obj; + struct yaffs_obj *parent_obj; d_obj = yaffs_inode_to_obj(dentry->d_inode); @@ -603,7 +604,7 @@ static struct export_operations yaffs_export_ops = * next object before the object is deleted. * * Many readdirs (and thus seach conexts) may be alive simulateously so - * each yaffs_dev_t has a list of these. + * each struct yaffs_dev has a list of these. * * A seach context lives for the duration of a readdir. * @@ -611,10 +612,10 @@ static struct export_operations yaffs_export_ops = */ struct yaffs_search_context { - yaffs_dev_t *dev; - yaffs_obj_t *dir_obj; - yaffs_obj_t *next_return; - struct ylist_head others; + struct yaffs_dev *dev; + struct yaffs_obj *dir_obj; + struct yaffs_obj *next_return; + struct list_head others; }; /* @@ -623,21 +624,21 @@ struct yaffs_search_context { * * Called at start of readdir. */ -static struct yaffs_search_context * yaffs_new_search(yaffs_obj_t *dir) +static struct yaffs_search_context * yaffs_new_search(struct yaffs_obj *dir) { - yaffs_dev_t *dev = dir->my_dev; + struct yaffs_dev *dev = dir->my_dev; struct yaffs_search_context *sc = YMALLOC(sizeof(struct yaffs_search_context)); if(sc){ sc->dir_obj = dir; sc->dev = dev; - if( ylist_empty(&sc->dir_obj->variant.dir_variant.children)) + if( list_empty(&sc->dir_obj->variant.dir_variant.children)) sc->next_return = NULL; else - sc->next_return = ylist_entry( + sc->next_return = list_entry( dir->variant.dir_variant.children.next, - yaffs_obj_t,siblings); - YINIT_LIST_HEAD(&sc->others); - ylist_add(&sc->others,&(yaffs_dev_to_lc(dev)->search_contexts)); + struct yaffs_obj,siblings); + INIT_LIST_HEAD(&sc->others); + list_add(&sc->others,&(yaffs_dev_to_lc(dev)->search_contexts)); } return sc; } @@ -648,7 +649,7 @@ static struct yaffs_search_context * yaffs_new_search(yaffs_obj_t *dir) static void yaffs_search_end(struct yaffs_search_context * sc) { if(sc){ - ylist_del(&sc->others); + list_del(&sc->others); YFREE(sc); } } @@ -664,15 +665,15 @@ static void yaffs_search_advance(struct yaffs_search_context *sc) return; if( sc->next_return == NULL || - ylist_empty(&sc->dir_obj->variant.dir_variant.children)) + list_empty(&sc->dir_obj->variant.dir_variant.children)) sc->next_return = NULL; else { - struct ylist_head *next = sc->next_return->siblings.next; + struct list_head *next = sc->next_return->siblings.next; if( next == &sc->dir_obj->variant.dir_variant.children) sc->next_return = NULL; /* end of list */ else - sc->next_return = ylist_entry(next,yaffs_obj_t,siblings); + sc->next_return = list_entry(next,struct yaffs_obj,siblings); } } @@ -681,21 +682,21 @@ static void yaffs_search_advance(struct yaffs_search_context *sc) * We check open search contexts and advance any which are currently * on the object being iterated. */ -static void yaffs_remove_obj_callback(yaffs_obj_t *obj) +static void yaffs_remove_obj_callback(struct yaffs_obj *obj) { - struct ylist_head *i; + struct list_head *i; struct yaffs_search_context *sc; - struct ylist_head *search_contexts = &(yaffs_dev_to_lc(obj->my_dev)->search_contexts); + struct list_head *search_contexts = &(yaffs_dev_to_lc(obj->my_dev)->search_contexts); /* Iterate through the directory search contexts. * If any are currently on the object being removed, then advance * the search context to the next object to prevent a hanging pointer. */ - ylist_for_each(i, search_contexts) { + list_for_each(i, search_contexts) { if (i) { - sc = ylist_entry(i, struct yaffs_search_context,others); + sc = list_entry(i, struct yaffs_search_context,others); if(sc->next_return == obj) yaffs_search_advance(sc); } @@ -712,7 +713,7 @@ static int yaffs_readlink(struct dentry *dentry, char __user *buffer, unsigned char *alias; int ret; - yaffs_dev_t *dev = yaffs_dentry_to_obj(dentry)->my_dev; + struct yaffs_dev *dev = yaffs_dentry_to_obj(dentry)->my_dev; yaffs_gross_lock(dev); @@ -730,13 +731,16 @@ static int yaffs_readlink(struct dentry *dentry, char __user *buffer, #if (YAFFS_NEW_FOLLOW_LINK == 1) static void *yaffs_follow_link(struct dentry *dentry, struct nameidata *nd) +{ + void *ret; #else static int yaffs_follow_link(struct dentry *dentry, struct nameidata *nd) -#endif { + int ret +#endif unsigned char *alias; - int ret; - yaffs_dev_t *dev = yaffs_dentry_to_obj(dentry)->my_dev; + int ret_int = 0; + struct yaffs_dev *dev = yaffs_dentry_to_obj(dentry)->my_dev; yaffs_gross_lock(dev); @@ -744,19 +748,23 @@ static int yaffs_follow_link(struct dentry *dentry, struct nameidata *nd) yaffs_gross_unlock(dev); if (!alias) { - ret = -ENOMEM; + ret_int = -ENOMEM; goto out; } #if (YAFFS_NEW_FOLLOW_LINK == 1) nd_set_link(nd, alias); - ret = (int)alias; + ret = alias; out: - return ERR_PTR(ret); + if(ret_int) + ret = ERR_PTR(ret_int); + return ret; #else ret = vfs_follow_link(nd, alias); kfree(alias); out: + if(ret_int) + ret = ret_int; return ret; #endif } @@ -768,7 +776,7 @@ void yaffs_put_link(struct dentry *dentry, struct nameidata *nd, void *alias) { #endif struct inode *yaffs_get_inode(struct super_block *sb, int mode, int dev, - yaffs_obj_t *obj); + struct yaffs_obj *obj); /* * Lookup is used to find objects in the fs @@ -781,10 +789,10 @@ static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry, static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry) #endif { - yaffs_obj_t *obj; + struct yaffs_obj *obj; struct inode *inode = NULL; /* NCB 2.5/2.6 needs NULL here */ - yaffs_dev_t *dev = yaffs_inode_to_obj(dir)->my_dev; + struct yaffs_dev *dev = yaffs_inode_to_obj(dir)->my_dev; if(current != yaffs_dev_to_lc(dev)->readdir_process) yaffs_gross_lock(dev); @@ -850,10 +858,10 @@ static void yaffs_put_inode(struct inode *inode) #endif -static void yaffs_unstitch_obj(struct inode *inode, yaffs_obj_t *obj) +static void yaffs_unstitch_obj(struct inode *inode, struct yaffs_obj *obj) { /* Clear the association between the inode and - * the yaffs_obj_t. + * the struct yaffs_obj. */ obj->my_inode = NULL; yaffs_inode_to_obj_lv(inode) = NULL; @@ -872,8 +880,8 @@ static void yaffs_unstitch_obj(struct inode *inode, yaffs_obj_t *obj) */ static void yaffs_evict_inode( struct inode *inode) { - yaffs_obj_t *obj; - yaffs_dev_t *dev; + struct yaffs_obj *obj; + struct yaffs_dev *dev; int deleteme = 0; obj = yaffs_inode_to_obj(inode); @@ -914,8 +922,8 @@ static void yaffs_evict_inode( struct inode *inode) static void yaffs_clear_inode(struct inode *inode) { - yaffs_obj_t *obj; - yaffs_dev_t *dev; + struct yaffs_obj *obj; + struct yaffs_dev *dev; obj = yaffs_inode_to_obj(inode); @@ -940,8 +948,8 @@ static void yaffs_clear_inode(struct inode *inode) */ static void yaffs_delete_inode(struct inode *inode) { - yaffs_obj_t *obj = yaffs_inode_to_obj(inode); - yaffs_dev_t *dev; + struct yaffs_obj *obj = yaffs_inode_to_obj(inode); + struct yaffs_dev *dev; T(YAFFS_TRACE_OS, (TSTR("yaffs_delete_inode: ino %d, count %d %s\n"), (int)inode->i_ino, @@ -968,9 +976,9 @@ static int yaffs_file_flush(struct file *file, fl_owner_t id) static int yaffs_file_flush(struct file *file) #endif { - yaffs_obj_t *obj = yaffs_dentry_to_obj(file->f_dentry); + struct yaffs_obj *obj = yaffs_dentry_to_obj(file->f_dentry); - yaffs_dev_t *dev = obj->my_dev; + struct yaffs_dev *dev = obj->my_dev; T(YAFFS_TRACE_OS, (TSTR("yaffs_file_flush object %d (%s)\n"), obj->obj_id, @@ -989,11 +997,11 @@ static int yaffs_readpage_nolock(struct file *f, struct page *pg) { /* Lifted from jffs2 */ - yaffs_obj_t *obj; + struct yaffs_obj *obj; unsigned char *pg_buf; int ret; - yaffs_dev_t *dev; + struct yaffs_dev *dev; T(YAFFS_TRACE_OS, (TSTR("yaffs_readpage_nolock at %08x, size %08x\n"), @@ -1065,12 +1073,12 @@ static int yaffs_writepage(struct page *page, struct writeback_control *wbc) static int yaffs_writepage(struct page *page) #endif { - yaffs_dev_t *dev; + struct yaffs_dev *dev; struct address_space *mapping = page->mapping; struct inode *inode; unsigned long end_index; char *buffer; - yaffs_obj_t *obj; + struct yaffs_obj *obj; int n_written = 0; unsigned n_bytes; loff_t i_size; @@ -1296,13 +1304,13 @@ static int yaffs_commit_write(struct file *f, struct page *pg, unsigned offset, #endif -static void yaffs_fill_inode_from_obj(struct inode *inode, yaffs_obj_t *obj) +static void yaffs_fill_inode_from_obj(struct inode *inode, struct yaffs_obj *obj) { if (inode && obj) { /* Check mode against the variant type and attempt to repair if broken. */ - __u32 mode = obj->yst_mode; + u32 mode = obj->yst_mode; switch (obj->variant_type) { case YAFFS_OBJECT_TYPE_FILE: if (!S_ISREG(mode)) { @@ -1404,7 +1412,7 @@ static void yaffs_fill_inode_from_obj(struct inode *inode, yaffs_obj_t *obj) } struct inode *yaffs_get_inode(struct super_block *sb, int mode, int dev, - yaffs_obj_t *obj) + struct yaffs_obj *obj) { struct inode *inode; @@ -1439,10 +1447,10 @@ struct inode *yaffs_get_inode(struct super_block *sb, int mode, int dev, static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n, loff_t *pos) { - yaffs_obj_t *obj; + struct yaffs_obj *obj; int n_written, ipos; struct inode *inode; - yaffs_dev_t *dev; + struct yaffs_dev *dev; obj = yaffs_dentry_to_obj(f->f_dentry); @@ -1498,8 +1506,8 @@ static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n, static ssize_t yaffs_hold_space(struct file *f) { - yaffs_obj_t *obj; - yaffs_dev_t *dev; + struct yaffs_obj *obj; + struct yaffs_dev *dev; int n_free_chunks; @@ -1519,8 +1527,8 @@ static ssize_t yaffs_hold_space(struct file *f) static void yaffs_release_space(struct file *f) { - yaffs_obj_t *obj; - yaffs_dev_t *dev; + struct yaffs_obj *obj; + struct yaffs_dev *dev; obj = yaffs_dentry_to_obj(f->f_dentry); @@ -1562,12 +1570,12 @@ static loff_t yaffs_dir_llseek(struct file *file, loff_t offset, int origin) static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir) { - yaffs_obj_t *obj; - yaffs_dev_t *dev; + struct yaffs_obj *obj; + struct yaffs_dev *dev; struct yaffs_search_context *sc; struct inode *inode = f->f_dentry->d_inode; unsigned long offset, curoffs; - yaffs_obj_t *l; + struct yaffs_obj *l; int ret_val = 0; char name[YAFFS_MAX_NAME_LENGTH + 1]; @@ -1690,10 +1698,10 @@ static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode, { struct inode *inode; - yaffs_obj_t *obj = NULL; - yaffs_dev_t *dev; + struct yaffs_obj *obj = NULL; + struct yaffs_dev *dev; - yaffs_obj_t *parent = yaffs_inode_to_obj(dir); + struct yaffs_obj *parent = yaffs_inode_to_obj(dir); int error = -ENOSPC; uid_t uid = YCRED(current)->fsuid; @@ -1793,8 +1801,8 @@ static int yaffs_unlink(struct inode *dir, struct dentry *dentry) { int ret_val; - yaffs_dev_t *dev; - yaffs_obj_t *obj; + struct yaffs_dev *dev; + struct yaffs_obj *obj; T(YAFFS_TRACE_OS, (TSTR("yaffs_unlink %d:%s\n"), @@ -1826,9 +1834,9 @@ static int yaffs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) { struct inode *inode = old_dentry->d_inode; - yaffs_obj_t *obj = NULL; - yaffs_obj_t *link = NULL; - yaffs_dev_t *dev; + struct yaffs_obj *obj = NULL; + struct yaffs_obj *link = NULL; + struct yaffs_dev *dev; T(YAFFS_TRACE_OS, (TSTR("yaffs_link\n"))); @@ -1864,8 +1872,8 @@ static int yaffs_link(struct dentry *old_dentry, struct inode *dir, static int yaffs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) { - yaffs_obj_t *obj; - yaffs_dev_t *dev; + struct yaffs_obj *obj; + struct yaffs_dev *dev; uid_t uid = YCRED(current)->fsuid; gid_t gid = (dir->i_mode & S_ISGID) ? dir->i_gid : YCRED(current)->fsgid; @@ -1900,8 +1908,8 @@ static int yaffs_sync_object(struct file *file, struct dentry *dentry, #endif { - yaffs_obj_t *obj; - yaffs_dev_t *dev; + struct yaffs_obj *obj; + struct yaffs_dev *dev; #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34)) struct dentry *dentry = file->f_path.dentry; #endif @@ -1926,9 +1934,9 @@ static int yaffs_sync_object(struct file *file, struct dentry *dentry, static int yaffs_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry) { - yaffs_dev_t *dev; + struct yaffs_dev *dev; int ret_val = YAFFS_FAIL; - yaffs_obj_t *target; + struct yaffs_obj *target; T(YAFFS_TRACE_OS, (TSTR("yaffs_rename\n"))); dev = yaffs_inode_to_obj(old_dir)->my_dev; @@ -1942,7 +1950,7 @@ static int yaffs_rename(struct inode *old_dir, struct dentry *old_dentry, if (target && target->variant_type == YAFFS_OBJECT_TYPE_DIRECTORY && - !ylist_empty(&target->variant.dir_variant.children)) { + !list_empty(&target->variant.dir_variant.children)) { T(YAFFS_TRACE_OS, (TSTR("target is non-empty dir\n"))); @@ -1977,7 +1985,7 @@ static int yaffs_setattr(struct dentry *dentry, struct iattr *attr) { struct inode *inode = dentry->d_inode; int error = 0; - yaffs_dev_t *dev; + struct yaffs_dev *dev; T(YAFFS_TRACE_OS, (TSTR("yaffs_setattr of object %d\n"), @@ -2028,8 +2036,8 @@ int yaffs_setxattr(struct dentry *dentry, const char *name, { struct inode *inode = dentry->d_inode; int error = 0; - yaffs_dev_t *dev; - yaffs_obj_t *obj = yaffs_inode_to_obj(inode); + struct yaffs_dev *dev; + struct yaffs_obj *obj = yaffs_inode_to_obj(inode); T(YAFFS_TRACE_OS, (TSTR("yaffs_setxattr of object %d\n"), @@ -2060,8 +2068,8 @@ ssize_t yaffs_getxattr(struct dentry *dentry, const char *name, void *buff, { struct inode *inode = dentry->d_inode; int error = 0; - yaffs_dev_t *dev; - yaffs_obj_t *obj = yaffs_inode_to_obj(inode); + struct yaffs_dev *dev; + struct yaffs_obj *obj = yaffs_inode_to_obj(inode); T(YAFFS_TRACE_OS, (TSTR("yaffs_getxattr \"%s\" from object %d\n"), @@ -2084,8 +2092,8 @@ int yaffs_removexattr(struct dentry *dentry, const char *name) { struct inode *inode = dentry->d_inode; int error = 0; - yaffs_dev_t *dev; - yaffs_obj_t *obj = yaffs_inode_to_obj(inode); + struct yaffs_dev *dev; + struct yaffs_obj *obj = yaffs_inode_to_obj(inode); T(YAFFS_TRACE_OS, (TSTR("yaffs_removexattr of object %d\n"), @@ -2114,8 +2122,8 @@ ssize_t yaffs_listxattr(struct dentry *dentry, char *buff, size_t size) { struct inode *inode = dentry->d_inode; int error = 0; - yaffs_dev_t *dev; - yaffs_obj_t *obj = yaffs_inode_to_obj(inode); + struct yaffs_dev *dev; + struct yaffs_obj *obj = yaffs_inode_to_obj(inode); T(YAFFS_TRACE_OS, (TSTR("yaffs_listxattr of object %d\n"), @@ -2141,16 +2149,16 @@ ssize_t yaffs_listxattr(struct dentry *dentry, char *buff, size_t size) #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) static int yaffs_statfs(struct dentry *dentry, struct kstatfs *buf) { - yaffs_dev_t *dev = yaffs_dentry_to_obj(dentry)->my_dev; + struct yaffs_dev *dev = yaffs_dentry_to_obj(dentry)->my_dev; struct super_block *sb = dentry->d_sb; #elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) static int yaffs_statfs(struct super_block *sb, struct kstatfs *buf) { - yaffs_dev_t *dev = yaffs_super_to_dev(sb); + struct yaffs_dev *dev = yaffs_super_to_dev(sb); #else static int yaffs_statfs(struct super_block *sb, struct statfs *buf) { - yaffs_dev_t *dev = yaffs_super_to_dev(sb); + struct yaffs_dev *dev = yaffs_super_to_dev(sb); #endif T(YAFFS_TRACE_OS, (TSTR("yaffs_statfs\n"))); @@ -2213,7 +2221,7 @@ static int yaffs_statfs(struct super_block *sb, struct statfs *buf) static void yaffs_flush_inodes(struct super_block *sb) { struct inode *iptr; - yaffs_obj_t *obj; + struct yaffs_obj *obj; list_for_each_entry(iptr,&sb->s_inodes, i_sb_list){ obj = yaffs_inode_to_obj(iptr); @@ -2228,7 +2236,7 @@ static void yaffs_flush_inodes(struct super_block *sb) static void yaffs_flush_super(struct super_block *sb, int do_checkpoint) { - yaffs_dev_t *dev = yaffs_super_to_dev(sb); + struct yaffs_dev *dev = yaffs_super_to_dev(sb); if(!dev) return; @@ -2240,7 +2248,7 @@ static void yaffs_flush_super(struct super_block *sb, int do_checkpoint) } -static unsigned yaffs_bg_gc_urgency(yaffs_dev_t *dev) +static unsigned yaffs_bg_gc_urgency(struct yaffs_dev *dev) { unsigned erased_chunks = dev->n_erased_blocks * dev->param.chunks_per_block; struct yaffs_linux_context *context = yaffs_dev_to_lc(dev); @@ -2265,7 +2273,7 @@ static int yaffs_do_sync_fs(struct super_block *sb, int request_checkpoint) { - yaffs_dev_t *dev = yaffs_super_to_dev(sb); + struct yaffs_dev *dev = yaffs_super_to_dev(sb); unsigned int oneshot_checkpoint = (yaffs_auto_checkpoint & 4); unsigned gc_urgent = yaffs_bg_gc_urgency(dev); int do_checkpoint; @@ -2314,7 +2322,7 @@ void yaffs_background_waker(unsigned long data) static int yaffs_bg_thread_fn(void *data) { - yaffs_dev_t *dev = (yaffs_dev_t *)data; + struct yaffs_dev *dev = (struct yaffs_dev *)data; struct yaffs_linux_context *context = yaffs_dev_to_lc(dev); unsigned long now = jiffies; unsigned long next_dir_update = now; @@ -2393,7 +2401,7 @@ static int yaffs_bg_thread_fn(void *data) return 0; } -static int yaffs_bg_start(yaffs_dev_t *dev) +static int yaffs_bg_start(struct yaffs_dev *dev) { int retval = 0; struct yaffs_linux_context *context = yaffs_dev_to_lc(dev); @@ -2414,7 +2422,7 @@ static int yaffs_bg_start(yaffs_dev_t *dev) return retval; } -static void yaffs_bg_stop(yaffs_dev_t *dev) +static void yaffs_bg_stop(struct yaffs_dev *dev) { struct yaffs_linux_context *ctxt = yaffs_dev_to_lc(dev); @@ -2431,12 +2439,12 @@ static int yaffs_bg_thread_fn(void *data) return 0; } -static int yaffs_bg_start(yaffs_dev_t *dev) +static int yaffs_bg_start(struct yaffs_dev *dev) { return 0; } -static void yaffs_bg_stop(yaffs_dev_t *dev) +static void yaffs_bg_stop(struct yaffs_dev *dev) { } #endif @@ -2484,8 +2492,8 @@ static int yaffs_sync_fs(struct super_block *sb) static struct inode *yaffs_iget(struct super_block *sb, unsigned long ino) { struct inode *inode; - yaffs_obj_t *obj; - yaffs_dev_t *dev = yaffs_super_to_dev(sb); + struct yaffs_obj *obj; + struct yaffs_dev *dev = yaffs_super_to_dev(sb); T(YAFFS_TRACE_OS, (TSTR("yaffs_iget for %lu\n"), ino)); @@ -2522,8 +2530,8 @@ static void yaffs_read_inode(struct inode *inode) * need to lock again. */ - yaffs_obj_t *obj; - yaffs_dev_t *dev = yaffs_super_to_dev(inode->i_sb); + struct yaffs_obj *obj; + struct yaffs_dev *dev = yaffs_super_to_dev(inode->i_sb); T(YAFFS_TRACE_OS, (TSTR("yaffs_read_inode for %d\n"), (int)inode->i_ino)); @@ -2541,12 +2549,12 @@ static void yaffs_read_inode(struct inode *inode) #endif -static YLIST_HEAD(yaffs_context_list); +static LIST_HEAD(yaffs_context_list); struct semaphore yaffs_context_lock; static void yaffs_put_super(struct super_block *sb) { - yaffs_dev_t *dev = yaffs_super_to_dev(sb); + struct yaffs_dev *dev = yaffs_super_to_dev(sb); T(YAFFS_TRACE_OS, (TSTR("yaffs_put_super\n"))); @@ -2569,7 +2577,7 @@ static void yaffs_put_super(struct super_block *sb) yaffs_gross_unlock(dev); down(&yaffs_context_lock); - ylist_del_init(&(yaffs_dev_to_lc(dev)->context_list)); + list_del_init(&(yaffs_dev_to_lc(dev)->context_list)); up(&yaffs_context_lock); if (yaffs_dev_to_lc(dev)->spare_buffer) { @@ -2592,7 +2600,7 @@ static void yaffs_mtd_put_super(struct super_block *sb) } -static void yaffs_touch_super(yaffs_dev_t *dev) +static void yaffs_touch_super(struct yaffs_dev *dev) { struct super_block *sb = yaffs_dev_to_lc(dev)->super; @@ -2601,7 +2609,7 @@ static void yaffs_touch_super(yaffs_dev_t *dev) sb->s_dirt = 1; } -typedef struct { +struct yaffs_options { int inband_tags; int skip_checkpoint_read; int skip_checkpoint_write; @@ -2612,10 +2620,10 @@ typedef struct { int lazy_loading_overridden; int empty_lost_and_found; int empty_lost_and_found_overridden; -} yaffs_options; +} ; #define MAX_OPT_LEN 30 -static int yaffs_parse_options(yaffs_options *options, const char *options_str) +static int yaffs_parse_options(struct yaffs_options *options, const char *options_str) { char cur_opt[MAX_OPT_LEN + 1]; int p; @@ -2684,22 +2692,22 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, int n_blocks; struct inode *inode = NULL; struct dentry *root; - yaffs_dev_t *dev = 0; + struct yaffs_dev *dev = 0; char devname_buf[BDEVNAME_SIZE + 1]; struct mtd_info *mtd; int err; char *data_str = (char *)data; struct yaffs_linux_context *context = NULL; - yaffs_param_t *param; + struct yaffs_param *param; int read_only = 0; - yaffs_options options; + struct yaffs_options options; unsigned mount_id; int found; struct yaffs_linux_context *context_iterator; - struct ylist_head *l; + struct list_head *l; sb->s_magic = YAFFS_MAGIC; sb->s_op = &yaffs_super_ops; @@ -2859,7 +2867,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, /* OK, so if we got here, we have an MTD that's NAND and looks * like it has the right capabilities - * Set the yaffs_dev_t up for mtd + * Set the struct yaffs_dev up for mtd */ if (!read_only && !(mtd->flags & MTD_WRITEABLE)){ @@ -2868,7 +2876,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, sb->s_flags |= MS_RDONLY; } - dev = kmalloc(sizeof(yaffs_dev_t), GFP_KERNEL); + dev = kmalloc(sizeof(struct yaffs_dev), GFP_KERNEL); context = kmalloc(sizeof(struct yaffs_linux_context),GFP_KERNEL); if(!dev || !context ){ @@ -2884,15 +2892,15 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, /* Deep shit could not allocate device structure */ T(YAFFS_TRACE_ALWAYS, (TSTR("yaffs_read_super: Failed trying to allocate " - "yaffs_dev_t. \n"))); + "struct yaffs_dev. \n"))); return NULL; } - memset(dev, 0, sizeof(yaffs_dev_t)); + memset(dev, 0, sizeof(struct yaffs_dev)); param = &(dev->param); memset(context,0,sizeof(struct yaffs_linux_context)); dev->os_context = context; - YINIT_LIST_HEAD(&(context->context_list)); + INIT_LIST_HEAD(&(context->context_list)); context->dev = dev; context->super = sb; @@ -3021,19 +3029,19 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, found = 0; for(mount_id=0; ! found; mount_id++){ found = 1; - ylist_for_each(l,&yaffs_context_list){ - context_iterator = ylist_entry(l,struct yaffs_linux_context,context_list); + list_for_each(l,&yaffs_context_list){ + context_iterator = list_entry(l,struct yaffs_linux_context,context_list); if(context_iterator->mount_id == mount_id) found = 0; } } context->mount_id = mount_id; - ylist_add_tail(&(yaffs_dev_to_lc(dev)->context_list), &yaffs_context_list); + list_add_tail(&(yaffs_dev_to_lc(dev)->context_list), &yaffs_context_list); up(&yaffs_context_lock); /* Directory search handling...*/ - YINIT_LIST_HEAD(&(yaffs_dev_to_lc(dev)->search_contexts)); + INIT_LIST_HEAD(&(yaffs_dev_to_lc(dev)->search_contexts)); param->remove_obj_fn = yaffs_remove_obj_callback; init_MUTEX(&(yaffs_dev_to_lc(dev)->gross_lock)); @@ -3185,7 +3193,7 @@ static DECLARE_FSTYPE(yaffs2_fs_type, "yaffs2", yaffs2_read_super, static struct proc_dir_entry *my_proc_entry; static struct proc_dir_entry *debug_proc_entry; -static char *yaffs_dump_dev_part0(char *buf, yaffs_dev_t * dev) +static char *yaffs_dump_dev_part0(char *buf, struct yaffs_dev * dev) { buf += sprintf(buf, "start_block.......... %d\n", dev->param.start_block); buf += sprintf(buf, "end_block............ %d\n", dev->param.end_block); @@ -3207,7 +3215,7 @@ static char *yaffs_dump_dev_part0(char *buf, yaffs_dev_t * dev) } -static char *yaffs_dump_dev_part1(char *buf, yaffs_dev_t * dev) +static char *yaffs_dump_dev_part1(char *buf, struct yaffs_dev * dev) { buf += sprintf(buf, "data_bytes_per_chunk. %d\n", dev->data_bytes_per_chunk); buf += sprintf(buf, "chunk_grp_bits....... %d\n", dev->chunk_grp_bits); @@ -3247,7 +3255,7 @@ static int yaffs_proc_read(char *page, char **start, off_t offset, int count, int *eof, void *data) { - struct ylist_head *item; + struct list_head *item; char *buf = page; int step = offset; int n = 0; @@ -3271,9 +3279,9 @@ static int yaffs_proc_read(char *page, down(&yaffs_context_lock); /* Locate and print the Nth entry. Order N-squared but N is small. */ - ylist_for_each(item, &yaffs_context_list) { - struct yaffs_linux_context *dc = ylist_entry(item, struct yaffs_linux_context, context_list); - yaffs_dev_t *dev = dc->dev; + list_for_each(item, &yaffs_context_list) { + struct yaffs_linux_context *dc = list_entry(item, struct yaffs_linux_context, context_list); + struct yaffs_dev *dev = dc->dev; if (n < (step & ~1)) { n+=2; @@ -3297,16 +3305,16 @@ static int yaffs_stats_proc_read(char *page, char **start, off_t offset, int count, int *eof, void *data) { - struct ylist_head *item; + struct list_head *item; char *buf = page; int n = 0; down(&yaffs_context_lock); /* Locate and print the Nth entry. Order N-squared but N is small. */ - ylist_for_each(item, &yaffs_context_list) { - struct yaffs_linux_context *dc = ylist_entry(item, struct yaffs_linux_context, context_list); - yaffs_dev_t *dev = dc->dev; + list_for_each(item, &yaffs_context_list) { + struct yaffs_linux_context *dc = list_entry(item, struct yaffs_linux_context, context_list); + struct yaffs_dev *dev = dc->dev; int erased_chunks;