yaffs Merge branch 'namechange'
authorCharles Manning <cdhmanning@gmail.com>
Mon, 11 Oct 2010 22:35:05 +0000 (11:35 +1300)
committerCharles Manning <cdhmanning@gmail.com>
Mon, 11 Oct 2010 22:35:05 +0000 (11:35 +1300)
Merge in first set of yaffs name changes

Conflicts:
direct/python/yaffs_python_helper.c
direct/yaffsfs.c

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
1  2 
direct/basic-test/dtest.c
direct/python/yaffs_python_helper.c
direct/python/yaffsfs.py
direct/yaffsfs.c

Simple merge
@@@ -45,15 -45,5 +45,15 @@@ int yaffs_O_WRONLY(void) { return O_WRO
  int yaffs_O_RDWR(void) { return O_RDWR;}
  int yaffs_O_TRUNC(void) { return O_TRUNC;}
  
- int yaffs_set_trace(unsigned int tm) { return yaffs_traceMask=tm; }
- int yaffs_get_trace(void) { return yaffs_traceMask; }
+ int yaffs_set_trace(unsigned int tm) { return yaffs_trace_mask=tm; }
+ int yaffs_get_trace(void) { return yaffs_trace_mask; }
 +
 +int yaffs_S_IFMT(void){return S_IFMT;}
 +int yaffs_S_IFLNK(void){return S_IFLNK;}
 +int yaffs_S_IFDIR(void){return S_IFDIR;}
 +int yaffs_S_IFREG(void){return S_IFREG;}
 +int yaffs_S_IREAD(void){return S_IREAD;}
 +int yaffs_S_IWRITE(void){return S_IWRITE;}
 +int yaffs_S_IEXEC(void){return S_IEXEC;}
 +int yaffs_XATTR_CREATE(void){return XATTR_CREATE;}
 +int yaffs_XATTR_REPLACE(void){return XATTR_REPLACE;}
@@@ -240,25 -240,8 +240,25 @@@ yaffs_n_handles = ylib.yaffs_n_handle
  yaffs_n_handles.argtypes = [c_char_p]
  yaffs_n_handles.restype = c_int
  
- #int yaffs_StartUp(void)
- yaffs_StartUp = ylib.yaffs_StartUp
- yaffs_StartUp.argtypes = []
- yaffs_StartUp.restype = c_int
+ #int yaffs_start_up(void)
+ yaffs_start_up = ylib.yaffs_start_up
+ yaffs_start_up.argtypes = []
+ yaffs_start_up.restype = c_int
  
 +yaffs_O_CREAT=ylib.yaffs_O_CREAT()
 +yaffs_O_RDONLY=ylib.yaffs_O_RDONLY()
 +yaffs_O_WRONLY=ylib.yaffs_O_WRONLY()
 +yaffs_O_RDWR=ylib.yaffs_O_RDWR()
 +yaffs_O_TRUNC=ylib.yaffs_O_TRUNC()
 +
 +
 +yaffs_S_IFMT=ylib.yaffs_S_IFMT()
 +yaffs_S_IFLNK= ylib.yaffs_S_IFLNK()
 +yaffs_S_IFDIR =ylib.yaffs_S_IFDIR()
 +yaffs_S_IFREG=ylib.yaffs_S_IFREG()
 +yaffs_S_IREAD=ylib.yaffs_S_IREAD()
 +yaffs_S_IWRITE=ylib.yaffs_S_IWRITE()
 +yaffs_S_IEXEC=ylib.yaffs_S_IEXEC()  
 +yaffs_XATTR_CREATE=ylib.yaffs_XATTR_CREATE()
 +yaffs_XATTR_REPLACE=ylib.yaffs_XATTR_REPLACE()
 +yaffs_S_IEXEC=ylib.yaffs_S_IEXEC()
@@@ -31,8 -31,8 +31,8 @@@
  #define YAFFSFS_RW_SIZE  (1<<YAFFSFS_RW_SHIFT)
  
  /* Some forward references */
- static yaffs_Object *yaffsfs_FindObject(yaffs_Object *relativeDirectory, const YCHAR *path, int symDepth, int getEquiv);
- static void yaffsfs_RemoveObjectCallback(yaffs_Object *obj);
 -static yaffs_obj_t *yaffsfs_FindObject(yaffs_obj_t *relativeDirectory, const YCHAR *path, int symDepth);
++static yaffs_obj_t *yaffsfs_FindObject(yaffs_obj_t *relativeDirectory, const YCHAR *path, int symDepth, int getEquiv);
+ static void yaffsfs_RemoveObjectCallback(yaffs_obj_t *obj);
  
  unsigned int yaffs_wr_attempts;
  
@@@ -425,14 -425,11 +425,14 @@@ static yaffs_obj_t *yaffsfs_FindRoot(co
        return NULL;
  }
  
- static yaffs_Object *yaffsfs_FollowLink(yaffs_Object *obj,int symDepth)
+ static yaffs_obj_t *yaffsfs_FollowLink(yaffs_obj_t *obj,int symDepth)
  {
  
-               obj = yaffs_GetEquivalentObject(obj);
 +      if(obj)
-       while(obj && obj->variantType == YAFFS_OBJECT_TYPE_SYMLINK){
-               YCHAR *alias = obj->variant.symLinkVariant.alias;
++              obj = yaffs_get_equivalent_obj(obj);
 +
+       while(obj && obj->variant_type == YAFFS_OBJECT_TYPE_SYMLINK){
+               YCHAR *alias = obj->variant.symlink_variant.alias;
  
                if(yaffsfs_IsPathDivider(*alias))
                        /* Starts with a /, need to scan from root up */
@@@ -501,12 -498,13 +501,11 @@@ static yaffs_obj_t *yaffsfs_DoFindDirec
                        else if(yaffs_strcmp(str,_Y("..")) == 0)
                                dir = dir->parent;
                        else{
-                               dir = yaffs_FindObjectByName(dir,str);
+                               dir = yaffs_find_by_name(dir,str);
  
 -                              while(dir && dir->variant_type == YAFFS_OBJECT_TYPE_SYMLINK)
 -                                      dir = yaffsfs_FollowLink(dir,symDepth);
 -
 +                              dir = yaffsfs_FollowLink(dir,symDepth);
  
-                               if(dir && dir->variantType != YAFFS_OBJECT_TYPE_DIRECTORY)
+                               if(dir && dir->variant_type != YAFFS_OBJECT_TYPE_DIRECTORY)
                                        dir = NULL;
                        }
                }
@@@ -524,22 -522,17 +523,23 @@@ static yaffs_obj_t *yaffsfs_FindDirecto
  /*
   * yaffsfs_FindObject turns a path for an existing object into the object
   */
- static yaffs_Object *yaffsfs_FindObject(yaffs_Object *relativeDirectory, const YCHAR *path,int symDepth,int getEquiv)
 -static yaffs_obj_t *yaffsfs_FindObject(yaffs_obj_t *relativeDirectory, const YCHAR *path,int symDepth)
++static yaffs_obj_t *yaffsfs_FindObject(yaffs_obj_t *relativeDirectory, const YCHAR *path,int symDepth, int getEquiv)
  {
-       yaffs_Object *dir;
-       yaffs_Object *obj;
+       yaffs_obj_t *dir;
++      yaffs_obj_t *obj;
        YCHAR *name;
  
        dir = yaffsfs_FindDirectory(relativeDirectory,path,&name,symDepth);
  
        if(dir && *name)
-               obj = yaffs_FindObjectByName(dir,name);
 -              return yaffs_find_by_name(dir,name);
++              obj = yaffs_find_by_name(dir,name);
 +      else
 +              obj = dir;
 -      return dir;
 +      if(getEquiv)
-               obj = yaffs_GetEquivalentObject(obj);
++              obj = yaffs_get_equivalent_obj(obj);
 +
 +      return obj;
  }
  
  
@@@ -573,11 -566,11 +573,11 @@@ int yaffs_dup(int fd
  
  int yaffs_open_sharing(const YCHAR *path, int oflag, int mode, int sharing)
  {
-       yaffs_Object *obj = NULL;
-       yaffs_Object *dir = NULL;
+       yaffs_obj_t *obj = NULL;
+       yaffs_obj_t *dir = NULL;
        YCHAR *name;
        int handle = -1;
 -      yaffsfs_Handle *h = NULL;
 +      yaffsfs_Handle *yh = NULL;
        int openDenied = 0;
        int symDepth = 0;
        int errorReported = 0;
  
        if(handle >= 0){
  
 -              h = yaffsfs_GetHandlePointer(handle);
 +              yh = yaffsfs_GetHandlePointer(handle);
  
                /* try to find the exisiting object */
 -              obj = yaffsfs_FindObject(NULL,path,0);
 -
 -              if(obj && obj->variant_type == YAFFS_OBJECT_TYPE_SYMLINK)
 -                      obj = yaffsfs_FollowLink(obj,symDepth++);
 +              obj = yaffsfs_FindObject(NULL,path,0,1);
  
 -              if(obj)
 -                      obj = yaffs_get_equivalent_obj(obj);
 +              obj = yaffsfs_FollowLink(obj,symDepth++);
  
                if(obj &&
-                       obj->variantType != YAFFS_OBJECT_TYPE_FILE &&
-                       obj->variantType != YAFFS_OBJECT_TYPE_DIRECTORY)
+                       obj->variant_type != YAFFS_OBJECT_TYPE_FILE &&
+                       obj->variant_type != YAFFS_OBJECT_TYPE_DIRECTORY)
                        obj = NULL;
  
                if(obj){
                                 */
                        }
                        
 -                      h->inodeId = inodeId;
 -                      h->reading = (oflag & (O_RDONLY | O_RDWR)) ? 1 : 0;
 -                      h->writing = (oflag & (O_WRONLY | O_RDWR)) ? 1 : 0;
 -                      h->append =  (oflag & O_APPEND) ? 1 : 0;
 -                      h->position = 0;
 -                      h->shareRead = shareRead;
 -                      h->shareWrite = shareWrite;
 +                      yh->inodeId = inodeId;
 +                      yh->reading = (oflag & (O_RDONLY | O_RDWR)) ? 1 : 0;
 +                      yh->writing = (oflag & (O_WRONLY | O_RDWR)) ? 1 : 0;
 +                      yh->append =  (oflag & O_APPEND) ? 1 : 0;
 +                      yh->position = 0;
 +                      yh->shareRead = shareRead;
 +                      yh->shareWrite = shareWrite;
  
                        /* Hook inode to object */
-                         obj->myInode = (void*) &yaffsfs_inode[inodeId];
+                         obj->my_inode = (void*) &yaffsfs_inode[inodeId];
  
 -                        if((oflag & O_TRUNC) && h->writing)
 +                        if((oflag & O_TRUNC) && yh->writing)
-                                 yaffs_ResizeFile(obj,0);
+                                 yaffs_resize_file(obj,0);
                } else {
                        yaffsfs_PutHandle(handle);
                        if(!errorReported) {
@@@ -1186,21 -1185,22 +1186,21 @@@ static int yaffsfs_DoStat(yaffs_obj_t *
  {
        int retVal = -1;
  
-       obj = yaffs_GetEquivalentObject(obj);
 -      if(obj)
 -              obj = yaffs_get_equivalent_obj(obj);
++      obj = yaffs_get_equivalent_obj(obj);
  
        if(obj && buf){
-               buf->st_dev = (int)obj->myDev->osContext;
-               buf->st_ino = obj->objectId;
+               buf->st_dev = (int)obj->my_dev->os_context;
+               buf->st_ino = obj->obj_id;
                buf->st_mode = obj->yst_mode & ~S_IFMT; /* clear out file type bits */
  
-               if(obj->variantType == YAFFS_OBJECT_TYPE_DIRECTORY)
+               if(obj->variant_type == YAFFS_OBJECT_TYPE_DIRECTORY)
                        buf->st_mode |= S_IFDIR;
-               else if(obj->variantType == YAFFS_OBJECT_TYPE_SYMLINK)
+               else if(obj->variant_type == YAFFS_OBJECT_TYPE_SYMLINK)
                        buf->st_mode |= S_IFLNK;
-               else if(obj->variantType == YAFFS_OBJECT_TYPE_FILE)
+               else if(obj->variant_type == YAFFS_OBJECT_TYPE_FILE)
                        buf->st_mode |= S_IFREG;
  
-               buf->st_nlink = yaffs_GetObjectLinkCount(obj);
+               buf->st_nlink = yaffs_get_obj_link_count(obj);
                buf->st_uid = 0;
                buf->st_gid = 0;;
                buf->st_rdev = obj->yst_rdev;
@@@ -2095,9 -2088,9 +2095,9 @@@ yaffs_DIR *yaffs_opendir(const YCHAR *d
  
        yaffsfs_Lock();
  
 -      obj = yaffsfs_FindObject(NULL,dirname,0);
 +      obj = yaffsfs_FindObject(NULL,dirname,0,1);
  
-       if(obj && obj->variantType == YAFFS_OBJECT_TYPE_DIRECTORY){
+       if(obj && obj->variant_type == YAFFS_OBJECT_TYPE_DIRECTORY){
  
                dsc = YMALLOC(sizeof(yaffsfs_DirectorySearchContext));
                dir = (yaffs_DIR *)dsc;
@@@ -2319,9 -2312,11 +2319,9 @@@ int yaffs_mknod(const YCHAR *pathname, 
   */
  int yaffs_n_handles(const YCHAR *path)
  {
-       yaffs_Object *obj;
+       yaffs_obj_t *obj;
  
 -      obj = yaffsfs_FindObject(NULL,path,0);
 -      if(obj)
 -              obj = yaffs_get_equivalent_obj(obj);
 +      obj = yaffsfs_FindObject(NULL,path,0,1);
  
        return yaffsfs_CountHandles(obj);
  }