[Yaffs] Patches for special devices

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Alexis POLTI
Date:  
To: yaffs
Old-Topics: [Yaffs] Patch for special devices
Subject: [Yaffs] Patches for special devices
Hello !

another patch for special file handling. I believe this corrects two things :
- creation of nodes with correct MAJOR and MINOR under linux kernel > 2.5
- deletion of special files (in yaffs_unlinkWorker. Not sure of this one... :/ ).

Regards,

Alexis

diff -pruN ../../../downloads/yaffs/yaffs_guts.c yaffs_guts.c
--- ../../../downloads/yaffs/yaffs_guts.c       2005-03-02 20:03:51.000000000 +0000
+++ yaffs_guts.c        2005-03-02 20:03:58.000000000 +0000
@@ -1828,7 +1828,7 @@ yaffs_Object *yaffs_MknodDirectory(yaffs


  yaffs_Object *yaffs_MknodSpecial(yaffs_Object *parent,const char *name, __u32 mode, __u32 uid, __u32 gid, __u32 rdev)
  {
-       return yaffs_MknodObject(YAFFS_OBJECT_TYPE_DIRECTORY,parent,name,mode,uid,gid,NULL,NULL,rdev);
+       return yaffs_MknodObject(YAFFS_OBJECT_TYPE_SPECIAL,parent,name,mode,uid,gid,NULL,NULL,rdev);
  }


  yaffs_Object *yaffs_MknodSymLink(yaffs_Object *parent,const char *name, __u32 mode, __u32 uid, __u32 gid,const char 
*alias)
@@ -3967,6 +3967,7 @@ static int yaffs_UnlinkWorker(yaffs_Obje
                 switch(obj->variantType)
                 {
                         case YAFFS_OBJECT_TYPE_FILE:
+                       case YAFFS_OBJECT_TYPE_SPECIAL:
                                 return yaffs_UnlinkFile(obj);
                                 break;
                         case YAFFS_OBJECT_TYPE_DIRECTORY:



*************************

diff -pruN ../../../downloads/yaffs/yaffs_fs.c yaffs_fs.c
--- ../../../downloads/yaffs/yaffs_fs.c 2005-02-03 16:08:47.000000000 +0000
+++ yaffs_fs.c  2005-03-02 19:47:20.000000000 +0000
@@ -640,7 +640,11 @@ static void yaffs_FillInodeFromObject(st
                 switch (obj->st_mode & S_IFMT)
                 {
                         default: // fifo, device or socket
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+                               init_special_inode(inode, obj->st_mode,old_decode_dev(obj->st_rdev));
+#else
                                 init_special_inode(inode, obj->st_mode,(dev_t)(obj->st_rdev));
+#endif
                                 break;
                         case S_IFREG:   // file
                                 inode->i_op = &yaffs_file_inode_operations;
@@ -904,7 +908,11 @@ static int yaffs_mknod(struct inode *dir
                 default:
                         // Special (socket, fifo, device...)
                         T(YAFFS_TRACE_OS,("yaffs_mknod: making special\n"));
-                       obj = yaffs_MknodSpecial(parent,dentry->d_name.name,mode,current->uid, current->gid,rdev);
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+                        obj = yaffs_MknodSpecial(parent,dentry->d_name.name,mode,current->uid, 
current->gid,old_encode_dev(rdev));
+#else
+                        obj = yaffs_MknodSpecial(parent,dentry->d_name.name,mode,current->uid, current->gid,rdev);
+#endif
                         break;
                 case S_IFREG:   // file
                         T(YAFFS_TRACE_OS,("yaffs_mknod: making file\n"));