VirtualBox

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


Ignore:
Timestamp:
Oct 9, 2015 12:26:17 PM (9 years ago)
Author:
vboxsync
Message:

mount.vboxsf.c: Doxygen fix and some simplifications.

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

Legend:

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

    r57176 r58143  
    628628 * @param dentry        directory cache entry
    629629 * @param mode          file mode
     630 * @param excl          Possible O_EXCL...
    630631 * @returns 0 on success, Linux error code otherwise
    631632 */
    632 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
     633#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) || defined(DOXYGEN_RUNNING)
    633634static int sf_create(struct inode *parent, struct dentry *dentry, umode_t mode, bool excl)
    634635#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 3, 0)
  • trunk/src/VBox/Additions/linux/sharedfolders/mount.vboxsf.c

    r56675 r58143  
     1/* $Id$ */
    12/** @file
    2  * vboxsf -- VirtualBox Guest Additions for Linux: mount(8) helper
     3 * VirtualBox Guest Additions for Linux - mount(8) helper.
    34 *
    45 * Parses options provided by mount (or user directly)
     
    89
    910/*
    10  * Copyright (C) 2006-2012 Oracle Corporation
     11 * Copyright (C) 2006-2015 Oracle Corporation
    1112 *
    1213 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2122
    2223#ifndef _GNU_SOURCE
    23 #define _GNU_SOURCE
     24# define _GNU_SOURCE
    2425#endif
    2526
    2627/* #define DEBUG */
    27 #define DBG if (0)
    2828#include <errno.h>
    2929#include <fcntl.h>
     
    4646#include "vbsfmount.h"
    4747
    48 /* Compile-time assertion.  If a == 0, we get two identical switch cases, which is not
    49    allowed. */
    50 #define CT_ASSERT(a) \
    51     do { \
    52         switch(0) { case 0: case (a): ; } \
    53     } while (0)
     48#include <iprt/assert.h>
     49
    5450
    5551#define PANIC_ATTR __attribute ((noreturn, __format__ (__printf__, 1, 2)))
     
    129125        int has_arg;
    130126        const char *desc;
    131     } handlers[]
    132     =
     127    } handlers[] =
    133128    {
    134129        {"rw",        HORW,        0, "mount read write (default)"},
     
    337332  * Print out a usage message and exit.
    338333  *
    339   * @param name The name of the application
     334  * @returns 1
     335  * @param   argv0      The name of the application
    340336  */
    341 static void __attribute ((noreturn)) usage(char *name)
     337static int usage(char *argv0)
    342338{
    343339    printf("Usage: %s [OPTIONS] NAME MOUNTPOINT\n"
     
    349345           "  -s                    sloppy parsing, ignore unrecognized mount options\n"
    350346           "  -o OPTION[,OPTION...] use the mount options specified\n"
    351            "\n", name);
     347           "\n", argv0);
    352348    printf("Available mount options are:\n"
    353349           "     rw                 mount writable (the default)\n"
     
    367363    printf("Less common used options:\n"
    368364           "     noexec,exec,nodev,dev,nosuid,suid\n");
    369     exit(1);
     365    return EXIT_FAILURE;
    370366}
    371367
    372368int
    373 main (int argc, char **argv)
     369main(int argc, char **argv)
    374370{
    375371    int c;
     
    398394        NULL,  /* convertcp */
    399395    };
     396    AssertCompile(sizeof(uid_t) == sizeof(int));
     397    AssertCompile(sizeof(gid_t) == sizeof(int));
    400398
    401399    mntinf.nullchar = '\0';
     
    411409        argv[0] = "mount.vboxsf";
    412410
    413     /* Compile-time assertions */
    414     CT_ASSERT(sizeof(uid_t) == sizeof(int));
    415     CT_ASSERT(sizeof(gid_t) == sizeof(int));
    416 
    417411    while ((c = getopt(argc, argv, "rwsno:h")) != -1)
    418412    {
     
    423417            case '?':
    424418            case 'h':
    425                 usage(argv[0]);
     419                return usage(argv[0]);
    426420
    427421            case 'r':
     
    447441
    448442    if (argc - optind < 2)
    449         usage(argv[0]);
     443        return usage(argv[0]);
    450444
    451445    host_name = argv[optind];
     
    551545    exit(EXIT_SUCCESS);
    552546}
     547
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