VirtualBox

Changeset 77739 in vbox for trunk/src/VBox/Additions/linux


Ignore:
Timestamp:
Mar 17, 2019 1:46:38 AM (6 years ago)
Author:
vboxsync
Message:

linux/vboxsf: More informative error message from mount.vboxsf when a shared folder was not found. Kernel module also logs this in dmesg and host release log. Cleaned up the super block read code in the process. bugref:9172

Location:
trunk/src/VBox/Additions/linux/sharedfolders
Files:
3 edited

Legend:

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

    r77534 r77739  
    378378    int c;
    379379    int err;
     380    int saved_errno;
    380381    int nomtab = 0;
    381382    unsigned long flags = MS_NODEV;
     
    497498     */
    498499    err = mount(host_name, mount_point, "vboxsf", flags, &mntinf);
    499     if (err == -1 && errno == EPROTO)
    500     {
    501         /* Sometimes the mount utility messes up the share name.  Try to
    502          * un-mangle it again. */
     500    saved_errno = errno;
     501
     502    /* Some versions of the mount utility (unknown which, if any) will turn the
     503       shared folder name into an absolute path.  So, we check if it starts with
     504       the CWD and removes it.  We must do this after failing, because there is
     505       not actual restrictions on the shared folder name wrt to slashes and such. */
     506    if (err == -1 && errno == ENXIO && host_name[0] == '/')
     507    {
    503508        char szCWD[4096];
    504         size_t cchCWD;
    505         if (!getcwd(szCWD, sizeof(szCWD)))
    506             panic_err("%s: failed to get the current working directory", argv[0]);
    507         cchCWD = strlen(szCWD);
    508         if (!strncmp(host_name, szCWD, cchCWD))
    509         {
    510             while (host_name[cchCWD] == '/')
    511                 ++cchCWD;
    512             /* We checked before that we have enough space */
    513             strcpy(mntinf.name, host_name + cchCWD);
    514         }
    515         err = mount(host_name, mount_point, "vboxsf", flags, &mntinf);
     509        if (getcwd(szCWD, sizeof(szCWD)) != NULL)
     510        {
     511            size_t cchCWD = strlen(szCWD);
     512            if (!strncmp(host_name, szCWD, cchCWD))
     513            {
     514                while (host_name[cchCWD] == '/')
     515                    ++cchCWD;
     516                if (host_name[cchCWD])
     517                {
     518                    /* We checked before that we have enough space. */
     519                    strcpy(mntinf.name, host_name + cchCWD);
     520                    err = mount(host_name, mount_point, "vboxsf", flags, &mntinf);
     521                    saved_errno = errno;
     522                }
     523            }
     524        }
     525        else
     526            fprintf(stderr, "%s: failed to get the current working directory: %s", argv[0], strerror(errno));
     527        errno = saved_errno;
    516528    }
    517529    if (err)
    518         panic_err("%s: mounting failed with the error", argv[0]);
     530    {
     531        if (saved_errno == ENXIO)
     532            panic("%s: shared folder '%s' was not found (check VM settings / spelling)\n", argv[0], host_name);
     533        else
     534            panic_err("%s: mounting failed with the error", argv[0]);
     535    }
    519536
    520537    if (!nomtab)
  • trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.c

    r77731 r77739  
    5353#include <linux/seq_file.h>
    5454#include <linux/vfs.h>
     55#include <iprt/err.h>
    5556#include <iprt/path.h>
    5657
     
    7778 * Copies options from the mount info structure into @a sf_g.
    7879 *
    79  * This is used both by vbsf_super_info_alloc() and vbsf_remount_fs().
     80 * This is used both by vbsf_super_info_alloc_and_map_it() and
     81 * vbsf_remount_fs().
    8082 */
    8183static void vbsf_super_info_copy_remount_options(struct vbsf_super_info *sf_g, struct vbsf_mount_info_new *info)
     
    130132}
    131133
    132 /* allocate super info, try to map host share */
    133 static int vbsf_super_info_alloc(struct vbsf_mount_info_new *info, struct vbsf_super_info **sf_gp)
    134 {
    135     int err, rc;
     134/**
     135 * Allocate the super info structure and try map the host share.
     136 */
     137static int vbsf_super_info_alloc_and_map_it(struct vbsf_mount_info_new *info, struct vbsf_super_info **sf_gp)
     138{
     139    int rc;
    136140    SHFLSTRING *str_name;
    137141    size_t name_len, str_len;
     
    139143
    140144    TRACE();
    141     sf_g = kmalloc(sizeof(*sf_g), GFP_KERNEL);
    142     if (!sf_g) {
    143         err = -ENOMEM;
    144         LogRelFunc(("could not allocate memory for super info\n"));
    145         goto fail0;
    146     }
    147 
    148     RT_ZERO(*sf_g);
    149 
    150     if (info->nullchar != '\0'
     145
     146    /*
     147     * Validate info.
     148     */
     149    if (   info->nullchar != '\0'
    151150        || info->signature[0] != VBSF_MOUNT_SIGNATURE_BYTE_0
    152151        || info->signature[1] != VBSF_MOUNT_SIGNATURE_BYTE_1
    153152        || info->signature[2] != VBSF_MOUNT_SIGNATURE_BYTE_2) {
    154         err = -EINVAL;
    155         goto fail1;
    156     }
    157 
    158     info->name[sizeof(info->name) - 1] = 0;
    159     info->nls_name[sizeof(info->nls_name) - 1] = 0;
    160 
    161     name_len = strlen(info->name);
    162     str_len = offsetof(SHFLSTRING, String.utf8) + name_len + 1;
     153        SFLOGRELBOTH(("vboxsf: Invalid info signature: %#x %#x %#x %#x!\n",
     154                      info->nullchar, info->signature[0], info->signature[1], info->signature[2]));
     155        return -EINVAL;
     156    }
     157    name_len = RTStrNLen(info->name, sizeof(info->name));
     158    if (name_len >= sizeof(info->name)) {
     159        SFLOGRELBOTH(("vboxsf: Specified shared folder name is not zero terminated!\n"));
     160        return -EINVAL;
     161    }
     162    if (RTStrNLen(info->nls_name, sizeof(info->nls_name)) >= sizeof(info->nls_name)) {
     163        SFLOGRELBOTH(("vboxsf: Specified nls name is not zero terminated!\n"));
     164        return -EINVAL;
     165    }
     166
     167    /*
     168     * Allocate memory.
     169     */
     170    str_len  = offsetof(SHFLSTRING, String.utf8) + name_len + 1;
    163171    str_name = kmalloc(str_len, GFP_KERNEL);
    164     if (!str_name) {
    165         err = -ENOMEM;
    166         LogRelFunc(("could not allocate memory for host name\n"));
    167         goto fail1;
    168     }
    169 
    170     str_name->u16Length = name_len;
    171     str_name->u16Size = name_len + 1;
    172     memcpy(str_name->String.utf8, info->name, name_len + 1);
    173 
     172    sf_g     = kmalloc(sizeof(*sf_g), GFP_KERNEL);
     173    if (sf_g && str_name) {
     174        RT_ZERO(*sf_g);
     175
     176        str_name->u16Length = name_len;
     177        str_name->u16Size = name_len + 1;
     178        memcpy(str_name->String.utf8, info->name, name_len + 1);
     179
     180        /*
     181         * Init the NLS support, if needed.
     182         */
     183        rc = 0;
    174184#define _IS_UTF8(_str)  (strcmp(_str, "utf8") == 0)
    175185#define _IS_EMPTY(_str) (strcmp(_str, "") == 0)
    176186
    177     /* Check if NLS charset is valid and not points to UTF8 table */
    178     sf_g->fNlsIsUtf8 = true;
    179     if (info->nls_name[0]) {
    180         if (_IS_UTF8(info->nls_name)) {
     187        /* Check if NLS charset is valid and not points to UTF8 table */
     188        sf_g->fNlsIsUtf8 = true;
     189        if (info->nls_name[0]) {
     190            if (_IS_UTF8(info->nls_name)) {
     191                sf_g->nls = NULL;
     192            } else {
     193                sf_g->fNlsIsUtf8 = false;
     194                sf_g->nls = load_nls(info->nls_name);
     195                if (!sf_g->nls) {
     196                    SFLOGRELBOTH(("vboxsf: Failed to load nls '%s'!\n", info->nls_name));
     197                    rc = -EINVAL;
     198                }
     199            }
     200        } else {
     201#ifdef CONFIG_NLS_DEFAULT
     202            /* If no NLS charset specified, try to load the default
     203             * one if it's not points to UTF8. */
     204            if (!_IS_UTF8(CONFIG_NLS_DEFAULT)
     205                && !_IS_EMPTY(CONFIG_NLS_DEFAULT)) {
     206                sf_g->fNlsIsUtf8 = false;
     207                sf_g->nls = load_nls_default();
     208            } else
     209                sf_g->nls = NULL;
     210#else
    181211            sf_g->nls = NULL;
    182         } else {
    183             sf_g->fNlsIsUtf8 = false;
    184             sf_g->nls = load_nls(info->nls_name);
    185             if (!sf_g->nls) {
    186                 err = -EINVAL;
    187                 LogFunc(("failed to load nls %s\n",
    188                      info->nls_name));
     212#endif
     213        }
     214#undef _IS_UTF8
     215#undef _IS_EMPTY
     216        if (rc == 0) {
     217            /*
     218             * Try mount it.
     219             */
     220            rc = VbglR0SfHostReqMapFolderWithContigSimple(str_name, virt_to_phys(str_name), RTPATH_DELIMITER,
     221                                                          true /*fCaseSensitive*/, &sf_g->map.root);
     222            if (RT_SUCCESS(rc)) {
    189223                kfree(str_name);
    190                 goto fail1;
     224
     225                /* The rest is shared with remount. */
     226                vbsf_super_info_copy_remount_options(sf_g, info);
     227
     228                *sf_gp = sf_g;
     229                return 0;
    191230            }
     231
     232            /*
     233             * bail out:
     234             */
     235            if (rc == VERR_FILE_NOT_FOUND) {
     236                LogRel(("vboxsf: SHFL_FN_MAP_FOLDER failed for '%s': share not found\n", info->name));
     237                rc = -ENXIO;
     238            } else {
     239                LogRel(("vboxsf: SHFL_FN_MAP_FOLDER failed for '%s': %Rrc\n", info->name, rc));
     240                rc = -EPROTO;
     241            }
     242            if (sf_g->nls)
     243                unload_nls(sf_g->nls);
    192244        }
    193245    } else {
    194 #ifdef CONFIG_NLS_DEFAULT
    195         /* If no NLS charset specified, try to load the default
    196          * one if it's not points to UTF8. */
    197         if (!_IS_UTF8(CONFIG_NLS_DEFAULT)
    198             && !_IS_EMPTY(CONFIG_NLS_DEFAULT)) {
    199             sf_g->fNlsIsUtf8 = false;
    200             sf_g->nls = load_nls_default();
    201         } else
    202             sf_g->nls = NULL;
    203 #else
    204         sf_g->nls = NULL;
    205 #endif
    206     }
    207 
    208 #undef _IS_UTF8
    209 #undef _IS_EMPTY
    210 
    211     rc = VbglR0SfHostReqMapFolderWithContigSimple(str_name, virt_to_phys(str_name), RTPATH_DELIMITER,
    212                               true /*fCaseSensitive*/, &sf_g->map.root);
    213     kfree(str_name);
    214 
    215     if (RT_FAILURE(rc)) {
    216         err = -EPROTO;
    217         LogFunc(("SHFL_FN_MAP_FOLDER failed rc=%Rrc\n", rc));
    218         goto fail2;
    219     }
    220 
    221     /* The rest is shared with remount. */
    222     vbsf_super_info_copy_remount_options(sf_g, info);
    223 
    224     *sf_gp = sf_g;
    225     return 0;
    226 
    227  fail2:
    228     if (sf_g->nls)
    229         unload_nls(sf_g->nls);
    230 
    231  fail1:
    232     kfree(sf_g);
    233 
    234  fail0:
    235     return err;
     246        SFLOGRELBOTH(("vboxsf: Could not allocate memory for super info!\n"));
     247        rc = -ENOMEM;
     248    }
     249    if (str_name)
     250        kfree(str_name);
     251    if (sf_g)
     252        kfree(sf_g);
     253    return rc;
    236254}
    237255
     
    260278    int rc = 0;
    261279/** @todo this needs sorting out between 3.19 and 4.11   */
    262 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) //&& LINUX_VERSION_CODE <= KERNEL_VERSION(3, 19, 0)
     280#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
    263281    /* Each new shared folder map gets a new uint64_t identifier,
    264282     * allocated in sequence.  We ASSUME the sequence will not wrap. */
     
    284302    bdi->capabilities = 0
    285303#  ifdef BDI_CAP_MAP_DIRECT
    286                   | BDI_CAP_MAP_DIRECT  /* MAP_SHARED */
     304                      | BDI_CAP_MAP_DIRECT  /* MAP_SHARED */
    287305#  endif
    288306#  ifdef BDI_CAP_MAP_COPY
     
    306324              ;
    307325#  ifdef BDI_CAP_STRICTLIMIT
    308     /* Smalles possible amount of dirty pages: %1 of RAM */
     326    /* Smalles possible amount of dirty pages: %1 of RAM.  We set this to
     327       try reduce amount of data that's out of sync with the host side.
     328       Besides, writepages isn't implemented, so flushing is extremely slow.
     329       Note! Extremely slow linux 3.0.0 msync doesn't seem to be related to this setting. */
    309330    bdi_set_max_ratio(bdi, 1);
    310331#  endif
     
    315336#  if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
    316337    if (!rc)
    317         rc = bdi_register(&sf_g->bdi, NULL, "vboxsf-%llu",
    318                   (unsigned long long)u64CurrentSequence);
     338        rc = bdi_register(&sf_g->bdi, NULL, "vboxsf-%llu", (unsigned long long)u64CurrentSequence);
    319339#  endif /* >= 2.6.26 */
    320 # endif  /* >= 2.6.24 */
     340# endif  /* 4.11.0 > version >= 2.6.24 */
    321341#endif   /* >= 2.6.0 */
    322342    return rc;
     
    336356
    337357/**
     358 * Creates the root inode and attaches it to the super block.
     359 *
     360 * @returns 0 on success, negative errno on failure.
     361 * @param   sb      The super block.
     362 * @param   sf_g    Our super block info.
     363 */
     364static int vbsf_create_root_inode(struct super_block *sb, struct vbsf_super_info *sf_g)
     365{
     366    SHFLFSOBJINFO fsinfo;
     367    int rc;
     368
     369    /*
     370     * Allocate and initialize the memory for our inode info structure.
     371     */
     372    struct vbsf_inode_info *sf_i = kmalloc(sizeof(*sf_i), GFP_KERNEL);
     373    SHFLSTRING             *path = kmalloc(sizeof(SHFLSTRING) + 1, GFP_KERNEL);
     374    if (sf_i && path) {
     375        sf_i->handle = SHFL_HANDLE_NIL;
     376        sf_i->force_restat = false;
     377        RTListInit(&sf_i->HandleList);
     378#ifdef VBOX_STRICT
     379        sf_i->u32Magic = SF_INODE_INFO_MAGIC;
     380#endif
     381        sf_i->path = path;
     382
     383        path->u16Length = 1;
     384        path->u16Size = 2;
     385        path->String.utf8[0] = '/';
     386        path->String.utf8[1] = 0;
     387
     388        /*
     389         * Stat the root directory (for inode info).
     390         */
     391        rc = vbsf_stat(__func__, sf_g, sf_i->path, &fsinfo, 0);
     392        if (rc == 0) {
     393            /*
     394             * Create the actual inode structure.
     395             * Note! ls -la does display '.' and '..' entries with st_ino == 0, so root is #1.
     396             */
     397#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 25)
     398            struct inode *iroot = iget_locked(sb, 1);
     399#else
     400            struct inode *iroot = iget(sb, 1);
     401#endif
     402            if (iroot) {
     403                vbsf_init_inode(iroot, sf_i, &fsinfo, sf_g);
     404                VBSF_SET_INODE_INFO(iroot, sf_i);
     405
     406#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 25)
     407                unlock_new_inode(iroot);
     408#endif
     409
     410                /*
     411                 * Now make it a root inode.
     412                 */
     413#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
     414                sb->s_root = d_make_root(iroot);
     415#else
     416                sb->s_root = d_alloc_root(iroot);
     417#endif
     418                if (sb->s_root) {
     419
     420                    return 0;
     421                }
     422
     423                SFLOGRELBOTH(("vboxsf: d_make_root failed!\n"));
     424#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0) /* d_make_root calls iput */
     425                iput(iroot);
     426#endif
     427                /* iput() will call vbsf_evict_inode()/vbsf_clear_inode(). */
     428                sf_i = NULL;
     429                path = NULL;
     430
     431                rc = -ENOMEM;
     432            } else {
     433                SFLOGRELBOTH(("vboxsf: failed to allocate root inode!\n"));
     434                rc = -ENOMEM;
     435            }
     436        } else
     437            SFLOGRELBOTH(("vboxsf: could not stat root of share: %d\n", rc));
     438    } else {
     439        SFLOGRELBOTH(("vboxsf: Could not allocate memory for root inode info!\n"));
     440        rc = -ENOMEM;
     441    }
     442    if (sf_i)
     443        kfree(sf_i);
     444    if (path)
     445        kfree(path);
     446    return rc;
     447}
     448
     449
     450/**
    338451 * This is called by vbsf_read_super_24() and vbsf_read_super_26() when vfs mounts
    339452 * the fs and wants to read super_block.
    340453 *
    341  * Calls vbsf_super_info_alloc() to map the folder and allocate super information
    342  * structure.
     454 * Calls vbsf_super_info_alloc_and_map_it() to map the folder and allocate super
     455 * information structure.
    343456 *
    344457 * Initializes @a sb, initializes root inode and dentry.
     
    348461static int vbsf_read_super_aux(struct super_block *sb, void *data, int flags)
    349462{
    350     int err;
    351     struct dentry *droot;
    352     struct inode *iroot;
    353     struct vbsf_inode_info *sf_i;
     463    int rc;
    354464    struct vbsf_super_info *sf_g;
    355     SHFLFSOBJINFO fsinfo;
    356     struct vbsf_mount_info_new *info;
    357     bool fInodePut = true;
    358465
    359466    TRACE();
    360467    if (!data) {
    361         LogFunc(("no mount info specified\n"));
     468        SFLOGRELBOTH(("vboxsf: No mount data. Is mount.vboxsf installed (typically in /sbin)?\n"));
    362469        return -EINVAL;
    363470    }
    364471
    365     info = data;
    366 
    367472    if (flags & MS_REMOUNT) {
    368         LogFunc(("remounting is not supported\n"));
     473        SFLOGRELBOTH(("vboxsf: Remounting is not supported!\n"));
    369474        return -ENOSYS;
    370475    }
    371476
    372     err = vbsf_super_info_alloc(info, &sf_g);
    373     if (err)
    374         goto fail0;
    375 
    376     sf_i = kmalloc(sizeof(*sf_i), GFP_KERNEL);
    377     if (!sf_i) {
    378         err = -ENOMEM;
    379         LogRelFunc(("could not allocate memory for root inode info\n"));
    380         goto fail1;
    381     }
    382 
    383     sf_i->handle = SHFL_HANDLE_NIL;
    384     sf_i->path = kmalloc(sizeof(SHFLSTRING) + 1, GFP_KERNEL);
    385     if (!sf_i->path) {
    386         err = -ENOMEM;
    387         LogRelFunc(("could not allocate memory for root inode path\n"));
    388         goto fail2;
    389     }
    390 
    391     sf_i->path->u16Length = 1;
    392     sf_i->path->u16Size = 2;
    393     sf_i->path->String.utf8[0] = '/';
    394     sf_i->path->String.utf8[1] = 0;
    395     sf_i->force_restat = false;
    396     RTListInit(&sf_i->HandleList);
    397 #ifdef VBOX_STRICT
    398     sf_i->u32Magic = SF_INODE_INFO_MAGIC;
    399 #endif
    400 
    401     err = vbsf_stat(__func__, sf_g, sf_i->path, &fsinfo, 0);
    402     if (err) {
    403         LogFunc(("could not stat root of share\n"));
    404         goto fail3;
    405     }
    406 
    407     sb->s_magic = 0xface;
    408     sb->s_blocksize = 1024;
     477    /*
     478     * Create our super info structure and map the shared folder.
     479     */
     480    rc = vbsf_super_info_alloc_and_map_it((struct vbsf_mount_info_new *)data, &sf_g);
     481    if (rc == 0) {
     482        /*
     483         * Initialize the super block structure (must be done before
     484         * root inode creation).
     485         */
     486        sb->s_magic = 0xface;
     487        sb->s_blocksize = 1024;
    409488#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 3)
    410     /* Required for seek/sendfile (see 'loff_t max' in fs/read_write.c / do_sendfile()). */
     489        /* Required for seek/sendfile (see 'loff_t max' in fs/read_write.c / do_sendfile()). */
    411490# if defined MAX_LFS_FILESIZE
    412     sb->s_maxbytes = MAX_LFS_FILESIZE;
     491        sb->s_maxbytes = MAX_LFS_FILESIZE;
    413492# elif BITS_PER_LONG == 32
    414     sb->s_maxbytes = (loff_t)ULONG_MAX << PAGE_SHIFT;
     493        sb->s_maxbytes = (loff_t)ULONG_MAX << PAGE_SHIFT;
    415494# else
    416     sb->s_maxbytes = INT64_MAX;
     495        sb->s_maxbytes = INT64_MAX;
    417496# endif
    418497#endif
    419     sb->s_op = &sf_super_ops;
     498        sb->s_op = &sf_super_ops;
    420499#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
    421     sb->s_d_op = &vbsf_dentry_ops;
    422 #endif
    423 
    424     /* Note! ls -la does display '.' and '..' entries with st_ino == 0, so root is #1. */
    425 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 25)
    426     iroot = iget_locked(sb, 1);
    427 #else
    428     iroot = iget(sb, 1);
    429 #endif
    430     if (!iroot) {
    431         err = -ENOMEM;  /* XXX */
    432         LogFunc(("could not get root inode\n"));
    433         goto fail3;
    434     }
    435 
    436     if (vbsf_init_backing_dev(sb, sf_g)) {
    437         err = -EINVAL;
    438         LogFunc(("could not init bdi\n"));
    439 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 25)
    440         unlock_new_inode(iroot);
    441 #endif
    442         goto fail4;
    443     }
    444 
    445     vbsf_init_inode(iroot, sf_i, &fsinfo, sf_g);
    446     VBSF_SET_INODE_INFO(iroot, sf_i);
    447 
    448 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 25)
    449     unlock_new_inode(iroot);
    450 #endif
    451 
    452 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
    453     droot = d_make_root(iroot);
    454 #else
    455     droot = d_alloc_root(iroot);
    456 #endif
    457     if (!droot) {
    458         err = -ENOMEM;  /* XXX */
    459         LogFunc(("d_alloc_root failed\n"));
    460 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)
    461         fInodePut = false;
    462 #endif
    463         goto fail5;
    464     }
    465 
    466     sb->s_root = droot;
    467     VBSF_SET_SUPER_INFO(sb, sf_g);
    468     return 0;
    469 
    470  fail5:
    471     vbsf_done_backing_dev(sb, sf_g);
    472 
    473  fail4:
    474     if (fInodePut)
    475         iput(iroot);
    476 
    477  fail3:
    478     kfree(sf_i->path);
    479 
    480  fail2:
    481     kfree(sf_i);
    482 
    483  fail1:
    484     vbsf_super_info_free(sf_g);
    485 
    486  fail0:
    487     return err;
     500        sb->s_d_op = &vbsf_dentry_ops;
     501#endif
     502
     503        /*
     504         * Initialize the backing device.  This is important for memory mapped
     505         * files among other things.
     506         */
     507        rc = vbsf_init_backing_dev(sb, sf_g);
     508        if (rc == 0) {
     509            /*
     510             * Create the root inode and we're done.
     511             */
     512            rc = vbsf_create_root_inode(sb, sf_g);
     513            if (rc == 0) {
     514                VBSF_SET_SUPER_INFO(sb, sf_g);
     515                SFLOGFLOW(("vbsf_read_super_aux: returns successfully\n"));
     516                return 0;
     517            }
     518            vbsf_done_backing_dev(sb, sf_g);
     519        } else
     520            SFLOGRELBOTH(("vboxsf: backing device information initialization failed: %d\n", rc));
     521        vbsf_super_info_free(sf_g);
     522    }
     523    return rc;
    488524}
    489525
  • trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h

    r77704 r77739  
    6060 */
    6161#if 1
    62 # define TRACE()          LogFunc(("tracepoint\n"))
    63 # define SFLOGFLOW(aArgs) Log(aArgs)
    64 # define SFLOG2(aArgs)    Log2(aArgs)
    65 # define SFLOG3(aArgs)    Log3(aArgs)
     62# define TRACE()                LogFunc(("tracepoint\n"))
     63# define SFLOGFLOW(aArgs)       Log(aArgs)
     64# define SFLOG2(aArgs)          Log2(aArgs)
     65# define SFLOG3(aArgs)          Log3(aArgs)
     66# define SFLOGRELBOTH(aArgs)    LogRel(aArgs)
    6667# ifdef LOG_ENABLED
    6768#  define SFLOG_ENABLED   1
    6869# endif
    6970#else
    70 # define TRACE()          RTLogBackdoorPrintf("%s: tracepoint\n", __FUNCTION__)
    71 # define SFLOGFLOW(aArgs) RTLogBackdoorPrintf aArgs
    72 # define SFLOG2(aArgs)    RTLogBackdoorPrintf aArgs
    73 # define SFLOG3(aArgs)    RTLogBackdoorPrintf aArgs
    74 # define SFLOG_ENABLED    1
     71# define TRACE()                RTLogBackdoorPrintf("%s: tracepoint\n", __FUNCTION__)
     72# define SFLOGFLOW(aArgs)       RTLogBackdoorPrintf aArgs
     73# define SFLOG2(aArgs)          RTLogBackdoorPrintf aArgs
     74# define SFLOG3(aArgs)          RTLogBackdoorPrintf aArgs
     75# define SFLOG_ENABLED          1
     76# define SFLOGRELBOTH(aArgs)    do { RTLogBackdoorPrintf aArgs; printk aArgs; } while (0)
    7577#endif
    7678
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