summaryrefslogtreecommitdiff
path: root/source3/torture/cmd_vfs.c
diff options
context:
space:
mode:
authorSteven Danneman <steven.danneman@isilon.com>2009-01-22 20:14:38 -0800
committerSteven Danneman <steven.danneman@isilon.com>2009-02-09 23:56:16 -0800
commitaf0e199b31ea4132e369508d72888757887b3327 (patch)
tree38be76f86b5c7b226785ed8c5cec559fab775756 /source3/torture/cmd_vfs.c
parent9a7491e83177ba32e30f29e1b84b8b8be9888953 (diff)
downloadsamba-af0e199b31ea4132e369508d72888757887b3327.tar.gz
samba-af0e199b31ea4132e369508d72888757887b3327.tar.bz2
samba-af0e199b31ea4132e369508d72888757887b3327.zip
Add an optional SMB_STRUCT_SMB parameter to VFS_OP_READDIR
* this allows VFS implementations that prefetch stat information on readdir to return it through one VFS call * backwards compatibility is maintained by passing in NULL * if the system readdir doesn't return stat info, the stat struct is set to invalid
Diffstat (limited to 'source3/torture/cmd_vfs.c')
-rw-r--r--source3/torture/cmd_vfs.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c
index 31eb27b756..f273cedb90 100644
--- a/source3/torture/cmd_vfs.c
+++ b/source3/torture/cmd_vfs.c
@@ -141,20 +141,51 @@ static NTSTATUS cmd_opendir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc
static NTSTATUS cmd_readdir(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
{
- SMB_STRUCT_DIRENT *dent;
+ const char *user;
+ const char *group;
+ SMB_STRUCT_STAT st;
+ SMB_STRUCT_DIRENT *dent = NULL;
if (vfs->currentdir == NULL) {
printf("readdir: error=-1 (no open directory)\n");
return NT_STATUS_UNSUCCESSFUL;
}
- dent = SMB_VFS_READDIR(vfs->conn, vfs->currentdir);
+ dent = SMB_VFS_READDIR(vfs->conn, vfs->currentdir, &st);
if (dent == NULL) {
printf("readdir: NULL\n");
return NT_STATUS_OK;
}
printf("readdir: %s\n", dent->d_name);
+ if (VALID_STAT(st)) {
+ printf(" stat available");
+ if (S_ISREG(st.st_mode)) printf(" Regular File\n");
+ else if (S_ISDIR(st.st_mode)) printf(" Directory\n");
+ else if (S_ISCHR(st.st_mode)) printf(" Character Device\n");
+ else if (S_ISBLK(st.st_mode)) printf(" Block Device\n");
+ else if (S_ISFIFO(st.st_mode)) printf(" Fifo\n");
+ else if (S_ISLNK(st.st_mode)) printf(" Symbolic Link\n");
+ else if (S_ISSOCK(st.st_mode)) printf(" Socket\n");
+ printf(" Size: %10u", (unsigned int)st.st_size);
+#ifdef HAVE_STAT_ST_BLOCKS
+ printf(" Blocks: %9u", (unsigned int)st.st_blocks);
+#endif
+#ifdef HAVE_STAT_ST_BLKSIZE
+ printf(" IO Block: %u\n", (unsigned int)st.st_blksize);
+#endif
+ printf(" Device: 0x%10x", (unsigned int)st.st_dev);
+ printf(" Inode: %10u", (unsigned int)st.st_ino);
+ printf(" Links: %10u\n", (unsigned int)st.st_nlink);
+ printf(" Access: %05o", (st.st_mode) & 007777);
+ printf(" Uid: %5lu/%.16s Gid: %5lu/%.16s\n",
+ (unsigned long)st.st_uid, user,
+ (unsigned long)st.st_gid, group);
+ printf(" Access: %s", ctime(&(st.st_atime)));
+ printf(" Modify: %s", ctime(&(st.st_mtime)));
+ printf(" Change: %s", ctime(&(st.st_ctime)));
+ }
+
return NT_STATUS_OK;
}