VirtualBox

source: vbox/trunk/src/VBox/Additions/darwin/vboxfs/mount.vboxvfs.c@ 69206

Last change on this file since 69206 was 63526, checked in by vboxsync, 8 years ago

fixed headers

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1/* $Id: mount.vboxvfs.c 63526 2016-08-16 08:44:20Z vboxsync $ */
2/** @file
3 * VBoxVFS - mount tool.
4 */
5
6/*
7 * Copyright (C) 2013-2016 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#include <stdio.h>
19#include <unistd.h>
20#include <stdlib.h>
21#include <sys/mount.h>
22#include <errno.h>
23#include <string.h>
24
25#include "vboxvfs.h"
26
27static char *progname;
28
29static void
30usage(void)
31{
32 fprintf(stderr, "usage: %s [OPTIONS] <shared folder name> "
33 "<mount point>\n", progname);
34 exit(1);
35}
36
37int
38main(int argc, char *argv[])
39{
40 int rc;
41 int c;
42 char *sShareName;
43 char *sMountPoint;
44 struct vboxvfs_mount_info mnt_info;
45
46 /* Set program name */
47 progname = argv[0];
48
49 /* Parse command line */
50 while((c = getopt(argc, argv, "o:")) != -1)
51 {
52 switch(c)
53 {
54 case 'o': break;
55 default : usage();
56 }
57 }
58
59 /* Two arguments are rquired: <share name> and <mount point> */
60 if ((argc - optind) != 2)
61 usage();
62
63 sShareName = argv[optind++];
64 sMountPoint = argv[optind];
65
66 if (strlen(sShareName) > MAXPATHLEN)
67 {
68 fprintf(stderr, "Specified Shared Folder name too long\n");
69 return EINVAL;
70 }
71
72 mnt_info.magic = VBOXVFS_MOUNTINFO_MAGIC;
73 strcpy(mnt_info.name, sShareName);
74
75 rc = mount(VBOXVBFS_NAME, sMountPoint, 0, &mnt_info);
76 if (rc)
77 {
78 fprintf(stderr,
79 "Unable to mount shared folder (%s) '%s' to '%s': %s\n",
80 VBOXVBFS_NAME,
81 mnt_info.name,
82 sMountPoint,
83 strerror(errno));
84 return 1;
85 }
86
87 return 0;
88}
Note: See TracBrowser for help on using the repository browser.

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