Changeset 31202 in vbox
- Timestamp:
- Jul 29, 2010 12:41:03 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 64204
- Location:
- trunk/src/VBox/Additions
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/Makefile.kmk
r29583 r31202 50 50 VBoxService_DEFS += VBOXSERVICE_CPUHOTPLUG 51 51 endif 52 ifdef VBOX_WITH_SHARED_FOLDERS 53 # darwin freebsd 54 if1of ($(KBUILD_TARGET), linux solaris) 55 VBoxService_DEFS += VBOX_WITH_SHARED_FOLDERS 56 endif 57 endif 52 58 53 59 VBoxService_SOURCES = \ … … 56 62 VBoxServiceUtils.cpp \ 57 63 VBoxServiceStats.cpp 64 58 65 ifdef VBOX_WITH_GUEST_CONTROL 59 66 VBoxService_SOURCES += \ … … 61 68 VBoxServiceControlExec.cpp 62 69 endif 70 63 71 ifdef VBOX_WITH_MEMBALLOON 64 72 VBoxService_SOURCES += \ … … 69 77 VBoxServicePageSharing.cpp 70 78 endif 79 71 80 ifdef VBOX_WITH_GUEST_PROPS 72 81 VBoxService_SOURCES.win = \ … … 76 85 VBoxServicePropCache.cpp 77 86 endif 87 78 88 if1of ($(KBUILD_TARGET), linux) 79 89 VBoxService_SOURCES += \ 80 90 VBoxServiceCpuHotPlug.cpp 81 91 endif 92 93 ifdef VBOX_WITH_SHARED_FOLDERS 94 if1of ($(KBUILD_TARGET), linux solaris) 95 VBoxService_SOURCES += \ 96 VBoxServiceAutoMount.cpp 97 VBoxService_SOURCES.linux += \ 98 ../../linux/sharedfolders/vbsfmount.c 99 endif 100 endif 101 82 102 VBoxService_SOURCES.win += \ 83 103 VBoxService-win.rc \ -
trunk/src/VBox/Additions/common/VBoxService/VBoxService.cpp
r30957 r31202 104 104 #ifdef VBOX_WITH_PAGE_SHARING 105 105 { &g_PageSharing, NIL_RTTHREAD, false, false, false, true }, 106 #endif 107 #ifdef VBOX_WITH_SHARED_FOLDERS 108 { &g_AutoMount, NIL_RTTHREAD, false, false, false, true }, 106 109 #endif 107 110 }; -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h
r30601 r31202 250 250 extern VBOXSERVICE g_PageSharing; 251 251 #endif 252 #ifdef VBOX_WITH_SHARED_FOLDERS 253 extern VBOXSERVICE g_AutoMount; 254 #endif 252 255 253 256 extern RTEXITCODE VBoxServiceSyntax(const char *pszFormat, ...); -
trunk/src/VBox/Additions/linux/sharedfolders/Makefile.kmk
r28998 r31202 88 88 mount.vboxsf_DEFS = _GNU_SOURCE 89 89 mount.vboxsf_SOURCES = \ 90 mount.vboxsf.c 91 90 mount.vboxsf.c \ 91 vbsfmount.c 92 92 93 93 ## Scripts needed for building kernel modules -
trunk/src/VBox/Additions/linux/sharedfolders/mount.vboxsf.c
r30153 r31202 8 8 9 9 /* 10 * Copyright (C) 2006-20 07Oracle Corporation10 * Copyright (C) 2006-2010 Oracle Corporation 11 11 * 12 12 * This file is part of VirtualBox Open Source Edition (OSE), as … … 53 53 } while (0) 54 54 55 struct opts56 {57 int uid;58 int gid;59 int ttl;60 int dmode;61 int fmode;62 int dmask;63 int fmask;64 int ronly;65 int noexec;66 int nodev;67 int nosuid;68 int remount;69 char nls_name[MAX_NLS_NAME];70 char *convertcp;71 };72 73 55 #define PANIC_ATTR __attribute ((noreturn, __format__ (__printf__, 1, 2))) 74 56 … … 113 95 114 96 static void 115 process_mount_opts(const char *s, struct opts *opts)97 process_mount_opts(const char *s, struct vbsf_mount_opts *opts) 116 98 { 117 99 const char *next = s; … … 319 301 exit(EXIT_FAILURE); 320 302 } 321 }322 }323 324 static void325 complete(char *host_name, char *mount_point,326 unsigned long flags, struct opts *opts)327 {328 FILE *f, *m;329 char *buf;330 size_t size;331 struct mntent e;332 333 m = open_memstream(&buf, &size);334 if (!m)335 panic_err("could not update mount table (failed to create memstream)");336 337 if (opts->uid)338 fprintf(m, "uid=%d,", opts->uid);339 if (opts->gid)340 fprintf(m, "gid=%d,", opts->gid);341 if (opts->ttl)342 fprintf(m, "ttl=%d,", opts->ttl);343 if (*opts->nls_name)344 fprintf(m, "iocharset=%s,", opts->nls_name);345 if (flags & MS_NOSUID)346 fprintf(m, "%s,", MNTOPT_NOSUID);347 if (flags & MS_RDONLY)348 fprintf(m, "%s,", MNTOPT_RO);349 else350 fprintf(m, "%s,", MNTOPT_RW);351 352 fclose(m);353 354 if (size > 0)355 buf[size - 1] = 0;356 else357 buf = "defaults";358 359 f = setmntent(MOUNTED, "a+");360 if (!f)361 panic_err("could not open mount table for update");362 363 e.mnt_fsname = host_name;364 e.mnt_dir = mount_point;365 e.mnt_type = "vboxsf";366 e.mnt_opts = buf;367 e.mnt_freq = 0;368 e.mnt_passno = 0;369 370 if (addmntent(f, &e))371 {372 if (size > 0)373 {374 memset(buf, 0, size);375 free(buf);376 }377 panic_err("could not add an entry to the mount table");378 }379 380 endmntent(f);381 382 if (size > 0)383 {384 memset(buf, 0, size);385 free(buf);386 303 } 387 304 } … … 461 378 char *mount_point; 462 379 struct vbsf_mount_info_new mntinf; 463 struct opts opts =380 struct vbsf_mount_opts opts = 464 381 { 465 382 0, /* uid */ … … 558 475 mntinf.fmask = opts.fmask; 559 476 477 /* 478 * Note: When adding and/or modifying parameters of the vboxsf mounting 479 * options you also would have to adjust VBoxServiceAutoMount.cpp 480 * to keep this code here slick without having VbglR3. 481 */ 560 482 err = mount(NULL, mount_point, "vboxsf", flags, &mntinf); 561 483 if (err == -1 && errno == EPROTO) … … 593 515 594 516 if (!nomtab) 595 complete(host_name, mount_point, flags, &opts); 517 { 518 err = vbsfmount_complete(host_name, mount_point, flags, &opts); 519 switch (err) 520 { 521 case 0: /* Success. */ 522 break; 523 524 case 1: 525 panic_err("%s: Could not update mount table (failed to create memstream).", argv[0]); 526 break; 527 528 case 2: 529 panic_err("%s: Could not open mount table for update.", argv[0]); 530 break; 531 532 case 3: 533 panic_err("%s: Could not add an entry to the mount table.", argv[0]); 534 break; 535 536 default: 537 panic_err("%s: Unknown error while completing mount operation: %d", argv[0], err); 538 break; 539 } 540 } 596 541 597 542 exit(EXIT_SUCCESS); -
trunk/src/VBox/Additions/linux/sharedfolders/vbsfmount.h
r28998 r31202 4 4 5 5 /* 6 * Copyright (C) 2006-20 07Oracle Corporation6 * Copyright (C) 2006-2010 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 21 21 #define MAX_NLS_NAME 32 22 22 23 /* Linux constraints the size of data mount argument to PAGE_SIZE - 1 */23 /* Linux constraints the size of data mount argument to PAGE_SIZE - 1. */ 24 24 struct vbsf_mount_info_old 25 25 { … … 53 53 }; 54 54 55 struct vbsf_mount_opts 56 { 57 int uid; 58 int gid; 59 int ttl; 60 int dmode; 61 int fmode; 62 int dmask; 63 int fmask; 64 int ronly; 65 int noexec; 66 int nodev; 67 int nosuid; 68 int remount; 69 char nls_name[MAX_NLS_NAME]; 70 char *convertcp; 71 }; 72 73 /** Completes the mount operation by adding the new mount point to mtab if required. */ 74 int vbsfmount_complete(const char *host_name, const char *mount_point, 75 unsigned long flags, struct vbsf_mount_opts *opts); 76 55 77 #endif /* vbsfmount.h */
Note:
See TracChangeset
for help on using the changeset viewer.