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>
This commit is contained in:
Andrew Borodin 2022-06-18 09:30:25 +03:00
parent 52fd6215b0
commit 5db6715a5f
2 changed files with 5 additions and 4 deletions

View File

@ -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;
}
}

View File

@ -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