2525
2626#include "dfs_tmpfs.h"
2727
28- #define DBG_TAG "tmpfs"
29- #define DBG_LVL DBG_INFO
28+ #define DBG_TAG "tmpfs"
29+ #define DBG_LVL DBG_INFO
3030#include <rtdbg.h>
3131#ifdef RT_USING_PAGECACHE
3232#include "dfs_pcache.h"
3636static ssize_t dfs_tmp_page_read (struct dfs_file * file , struct dfs_page * page );
3737static ssize_t dfs_tmp_page_write (struct dfs_page * page );
3838
39- static struct dfs_aspace_ops dfs_tmp_aspace_ops =
40- {
39+ static struct dfs_aspace_ops dfs_tmp_aspace_ops = {
4140 .read = dfs_tmp_page_read ,
4241 .write = dfs_tmp_page_write ,
4342};
@@ -87,12 +86,12 @@ static int _get_subdir(const char *path, char *name)
8786{
8887 const char * subpath = path ;
8988 while (* subpath == '/' && * subpath )
90- subpath ++ ;
89+ subpath ++ ;
9190 while (* subpath != '/' && * subpath )
9291 {
9392 * name = * subpath ;
94- name ++ ;
95- subpath ++ ;
93+ name ++ ;
94+ subpath ++ ;
9695 }
9796 return 0 ;
9897}
@@ -180,9 +179,9 @@ int dfs_tmpfs_statfs(struct dfs_mnt *mnt, struct statfs *buf)
180179 RT_ASSERT (superblock != NULL );
181180 RT_ASSERT (buf != NULL );
182181
183- buf -> f_bsize = 512 ;
182+ buf -> f_bsize = 512 ;
184183 buf -> f_blocks = (superblock -> df_size + 511 ) / 512 ;
185- buf -> f_bfree = 1 ;
184+ buf -> f_bfree = 1 ;
186185 buf -> f_bavail = buf -> f_bfree ;
187186
188187 return RT_EOK ;
@@ -226,18 +225,18 @@ int dfs_tmpfs_ioctl(struct dfs_file *file, int cmd, void *args)
226225 return - EIO ;
227226}
228227
229- struct tmpfs_file * dfs_tmpfs_lookup (struct tmpfs_sb * superblock ,
230- const char * path ,
231- rt_size_t * size )
228+ struct tmpfs_file * dfs_tmpfs_lookup (struct tmpfs_sb * superblock ,
229+ const char * path ,
230+ rt_size_t * size )
232231{
233232 const char * subpath , * curpath , * filename = RT_NULL ;
234233 char subdir_name [TMPFS_NAME_MAX ];
235234 struct tmpfs_file * file , * curfile , * tmp ;
236235
237236 subpath = path ;
238237 while (* subpath == '/' && * subpath )
239- subpath ++ ;
240- if (! * subpath ) /* is root directory */
238+ subpath ++ ;
239+ if (!* subpath ) /* is root directory */
241240 {
242241 * size = 0 ;
243242 return & (superblock -> root );
@@ -248,12 +247,12 @@ struct tmpfs_file *dfs_tmpfs_lookup(struct tmpfs_sb *superblock,
248247
249248find_subpath :
250249 while (* subpath != '/' && * subpath )
251- subpath ++ ;
250+ subpath ++ ;
252251
253- if (! * subpath ) /* is last directory */
252+ if (!* subpath ) /* is last directory */
254253 filename = curpath ;
255254 else
256- subpath ++ ; /* skip '/' */
255+ subpath ++ ; /* skip '/' */
257256
258257 memset (subdir_name , 0 , TMPFS_NAME_MAX );
259258 _get_subdir (curpath , subdir_name );
@@ -453,7 +452,7 @@ static int dfs_tmpfs_open(struct dfs_file *file)
453452 }
454453
455454 RT_ASSERT (file -> vnode -> ref_count > 0 );
456- if (file -> vnode -> ref_count == 1 )
455+ if (file -> vnode -> ref_count == 1 )
457456 {
458457 rt_mutex_init (& file -> vnode -> lock , file -> dentry -> pathname , RT_IPC_FLAG_PRIO );
459458 }
@@ -492,8 +491,8 @@ static int dfs_tmpfs_stat(struct dfs_dentry *dentry, struct stat *st)
492491}
493492
494493static int dfs_tmpfs_getdents (struct dfs_file * file ,
495- struct dirent * dirp ,
496- uint32_t count )
494+ struct dirent * dirp ,
495+ uint32_t count )
497496{
498497 rt_size_t index , end ;
499498 struct dirent * d ;
@@ -504,7 +503,7 @@ static int dfs_tmpfs_getdents(struct dfs_file *file,
504503
505504 rt_mutex_take (& file -> vnode -> lock , RT_WAITING_FOREVER );
506505
507- superblock = d_file -> sb ;
506+ superblock = d_file -> sb ;
508507 RT_ASSERT (superblock != RT_NULL );
509508 RT_UNUSED (superblock );
510509
@@ -854,8 +853,7 @@ static int dfs_tmpfs_truncate(struct dfs_file *file, off_t offset)
854853 return 0 ;
855854}
856855
857- static const struct dfs_file_ops _tmp_fops =
858- {
856+ static const struct dfs_file_ops _tmp_fops = {
859857 .open = dfs_tmpfs_open ,
860858 .close = dfs_tmpfs_close ,
861859 .ioctl = dfs_tmpfs_ioctl ,
@@ -866,8 +864,7 @@ static const struct dfs_file_ops _tmp_fops =
866864 .truncate = dfs_tmpfs_truncate ,
867865};
868866
869- static const struct dfs_filesystem_ops _tmpfs_ops =
870- {
867+ static const struct dfs_filesystem_ops _tmpfs_ops = {
871868 .name = "tmp" ,
872869 .flags = DFS_FS_FLAG_DEFAULT ,
873870 .default_fops = & _tmp_fops ,
@@ -884,8 +881,7 @@ static const struct dfs_filesystem_ops _tmpfs_ops =
884881 .free_vnode = dfs_tmpfs_free_vnode
885882};
886883
887- static struct dfs_filesystem_type _tmpfs =
888- {
884+ static struct dfs_filesystem_type _tmpfs = {
889885 .fs_ops = & _tmpfs_ops ,
890886};
891887
0 commit comments