fs/vboxsf/vboxsf_wrappers.c
Source file repositories/reference/linux-study-clean/fs/vboxsf/vboxsf_wrappers.c
File Facts
- System
- Linux kernel
- Corpus path
fs/vboxsf/vboxsf_wrappers.c- Extension
.c- Size
- 11165 bytes
- Lines
- 372
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mm.hlinux/slab.hlinux/vbox_err.hlinux/vbox_utils.hvfsmod.h
Detected Declarations
function vboxsf_connectfunction vboxsf_disconnectfunction vboxsf_callfunction vboxsf_map_folderfunction vboxsf_unmap_folderfunction whyfunction vboxsf_closefunction vboxsf_removefunction vboxsf_renamefunction vboxsf_readfunction vboxsf_writefunction vboxsf_dirinfofunction vboxsf_fsinfofunction vboxsf_readlinkfunction vboxsf_symlinkfunction vboxsf_set_utf8function vboxsf_set_symlinks
Annotated Snippet
// SPDX-License-Identifier: MIT
/*
* Wrapper functions for the shfl host calls.
*
* Copyright (C) 2006-2018 Oracle Corporation
*/
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/vbox_err.h>
#include <linux/vbox_utils.h>
#include "vfsmod.h"
#define SHFL_REQUEST \
(VMMDEV_REQUESTOR_KERNEL | VMMDEV_REQUESTOR_USR_DRV_OTHER | \
VMMDEV_REQUESTOR_CON_DONT_KNOW | VMMDEV_REQUESTOR_TRUST_NOT_GIVEN)
static u32 vboxsf_client_id;
int vboxsf_connect(void)
{
struct vbg_dev *gdev;
struct vmmdev_hgcm_service_location loc;
int err, vbox_status;
loc.type = VMMDEV_HGCM_LOC_LOCALHOST_EXISTING;
strcpy(loc.u.localhost.service_name, "VBoxSharedFolders");
gdev = vbg_get_gdev();
if (IS_ERR(gdev))
return -ENODEV; /* No guest-device */
err = vbg_hgcm_connect(gdev, SHFL_REQUEST, &loc,
&vboxsf_client_id, &vbox_status);
vbg_put_gdev(gdev);
return err ? err : vbg_status_code_to_errno(vbox_status);
}
void vboxsf_disconnect(void)
{
struct vbg_dev *gdev;
int vbox_status;
gdev = vbg_get_gdev();
if (IS_ERR(gdev))
return; /* guest-device is gone, already disconnected */
vbg_hgcm_disconnect(gdev, SHFL_REQUEST, vboxsf_client_id, &vbox_status);
vbg_put_gdev(gdev);
}
static int vboxsf_call(u32 function, void *parms, u32 parm_count, int *status)
{
struct vbg_dev *gdev;
int err, vbox_status;
gdev = vbg_get_gdev();
if (IS_ERR(gdev))
return -ESHUTDOWN; /* guest-dev removed underneath us */
err = vbg_hgcm_call(gdev, SHFL_REQUEST, vboxsf_client_id, function,
U32_MAX, parms, parm_count, &vbox_status);
vbg_put_gdev(gdev);
if (err < 0)
return err;
if (status)
*status = vbox_status;
return vbg_status_code_to_errno(vbox_status);
}
int vboxsf_map_folder(struct shfl_string *folder_name, u32 *root)
{
struct shfl_map_folder parms;
int err, status;
parms.path.type = VMMDEV_HGCM_PARM_TYPE_LINADDR_KERNEL;
parms.path.u.pointer.size = shfl_string_buf_size(folder_name);
parms.path.u.pointer.u.linear_addr = (uintptr_t)folder_name;
parms.root.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
parms.root.u.value32 = 0;
parms.delimiter.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
parms.delimiter.u.value32 = '/';
parms.case_sensitive.type = VMMDEV_HGCM_PARM_TYPE_32BIT;
Annotation
- Immediate include surface: `linux/mm.h`, `linux/slab.h`, `linux/vbox_err.h`, `linux/vbox_utils.h`, `vfsmod.h`.
- Detected declarations: `function vboxsf_connect`, `function vboxsf_disconnect`, `function vboxsf_call`, `function vboxsf_map_folder`, `function vboxsf_unmap_folder`, `function why`, `function vboxsf_close`, `function vboxsf_remove`, `function vboxsf_rename`, `function vboxsf_read`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.