Browse Source

VFS: don't use vfs_s_inode::data_offset for file name normalization.

Use new member vfs_s_entry::leading_spaces for that.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Andrew Borodin 2 years ago
parent
commit
5db6715a5f
2 changed files with 5 additions and 4 deletions
  1. 3 3
      lib/vfs/direntry.c
  2. 2 1
      lib/vfs/xdirentry.h

+ 3 - 3
lib/vfs/direntry.c

@@ -1720,18 +1720,18 @@ vfs_s_normalize_filename_leading_spaces (struct vfs_s_inode *root_inode, size_t
     {
         struct vfs_s_entry *entry = VFS_ENTRY (iter->data);
 
-        if ((size_t) entry->ino->data_offset > final_num_spaces)
+        if ((size_t) entry->leading_spaces > final_num_spaces)
         {
             char *source_name, *spacer;
 
             source_name = entry->name;
-            spacer = g_strnfill (entry->ino->data_offset - final_num_spaces, ' ');
+            spacer = g_strnfill ((size_t) entry->leading_spaces - final_num_spaces, ' ');
             entry->name = g_strconcat (spacer, source_name, (char *) NULL);
             g_free (spacer);
             g_free (source_name);
         }
 
-        entry->ino->data_offset = -1;
+        entry->leading_spaces = -1;
     }
 }
 

+ 2 - 1
lib/vfs/xdirentry.h

@@ -79,6 +79,7 @@ struct vfs_s_entry
     struct vfs_s_inode *dir;    /* Directory we are in, i.e. our parent */
     char *name;                 /* Name of this entry */
     struct vfs_s_inode *ino;    /* ... and its inode */
+    ssize_t leading_spaces;     /* number of leading spases in the file name */
 };
 
 /* Single virtual file - inode */
@@ -197,7 +198,7 @@ void vfs_s_normalize_filename_leading_spaces (struct vfs_s_inode *root_inode, si
 static inline void
 vfs_s_store_filename_leading_spaces (struct vfs_s_entry *entry, size_t position)
 {
-    entry->ino->data_offset = (off_t) position;
+    entry->leading_spaces = (ssize_t) position;
 }
 
 #endif