From b024c319ab282b28af50fed15228217ba2ea2d3b Mon Sep 17 00:00:00 2001 From: short <> Date: Tue, 2 Sep 2003 05:19:13 +0000 Subject: [PATCH] +Report 'file size' for regular files during read_directory(). --- src/gnome-vfs-method.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/gnome-vfs-method.c b/src/gnome-vfs-method.c index 4d63b6f..fbd4b13 100644 --- a/src/gnome-vfs-method.c +++ b/src/gnome-vfs-method.c @@ -302,6 +302,9 @@ int i; FALSE); /* free_segment */ } +/* Do not lock 'libntfs' here as we are already locked + * inside ntfs_readdir(). + */ static int libntfs_gnomevfs_read_directory_filldir(struct libntfs_directory *libntfs_directory /* dirent */, const uchar_t *name,const int name_len,const int name_type,const s64 pos,const MFT_REF mref,const unsigned dt_type) { @@ -333,6 +336,32 @@ GnomeVFSFileInfo *file_info; if (file_info->type!=GNOME_VFS_FILE_TYPE_UNKNOWN) file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_TYPE; + /* Detect 'file_info->size': */ + if (file_info->type==GNOME_VFS_FILE_TYPE_REGULAR) { +ntfs_inode *inode; + + inode=ntfs_inode_open(libntfs_directory->inode->vol,mref); + /* FIXME: Check failed 'inode' open. */ + if (inode) { +ntfs_attr *attr; +int errint; + + attr=ntfs_attr_open( + inode, /* ni */ + AT_DATA, /* type */ + NULL, /* name */ + 0); /* name_len */ + /* FIXME: Check failed 'attr' open. */ + if (attr) { + file_info->size=attr->data_size; /* FIXME: Is 'data_size' the right field? */ + file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_SIZE; + ntfs_attr_close(attr); + } + errint=ntfs_inode_close(inode); + /* FIXME: Check 'errint'. */ + } + } + libntfs_directory->file_info_list=g_list_prepend(libntfs_directory->file_info_list,file_info); return 0; /* continue traversal */ -- 1.8.3.1