VirtualBox

Ignore:
Timestamp:
Sep 20, 2007 7:27:19 AM (17 years ago)
Author:
vboxsync
Message:

Implement statfs call for Linux guests. Makes volume info (e.g. df) work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/sharedfolders/utils.c

    r4860 r4909  
    1919
    2020#include "vfsmod.h"
     21#include <linux/nfs_fs.h>
     22#include <linux/vfs.h>
    2123
    2224/* #define USE_VMALLOC */
     
    590592}
    591593
     594int sf_get_volume_info(struct super_block *sb, STRUCT_STATFS *stat)
     595{
     596        struct sf_glob_info *sf_g;
     597        SHFLVOLINFO SHFLVolumeInfo;
     598        uint32_t cbBuffer;
     599        int rc;
     600
     601        sf_g = GET_GLOB_INFO (sb);
     602        cbBuffer = sizeof(SHFLVolumeInfo);
     603        rc = vboxCallFSInfo(&client_handle, &sf_g->map, 0, SHFL_INFO_GET | SHFL_INFO_VOLUME,
     604                            &cbBuffer, (PSHFLDIRINFO)&SHFLVolumeInfo);
     605        if (VBOX_FAILURE(rc))
     606            return -RTErrConvertToErrno(rc);
     607
     608        stat->f_type        = NFS_SUPER_MAGIC; /* XXX vboxsf type? */
     609        stat->f_bsize       = SHFLVolumeInfo.ulBytesPerAllocationUnit;
     610        stat->f_blocks      = SHFLVolumeInfo.ullTotalAllocationBytes
     611                            / SHFLVolumeInfo.ulBytesPerAllocationUnit;
     612        stat->f_bfree       = SHFLVolumeInfo.ullAvailableAllocationBytes
     613                            / SHFLVolumeInfo.ulBytesPerAllocationUnit;
     614        stat->f_bavail      = SHFLVolumeInfo.ullAvailableAllocationBytes
     615                            / SHFLVolumeInfo.ulBytesPerAllocationUnit;
     616        stat->f_files       = 1000;
     617        stat->f_ffree       = 1000; /* don't return 0 here since the guest may think
     618                                     * that it is not possible to create any more files */
     619        stat->f_fsid.val[0] = 0;
     620        stat->f_fsid.val[1] = 0;
     621        stat->f_namelen     = 255;
     622        return 0;
     623}
     624
    592625struct dentry_operations sf_dentry_ops = {
    593626        .d_revalidate = sf_dentry_revalidate
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette