VirtualBox

source: vbox/trunk/src/VBox/Runtime/testcase/tstRTFsQueries.cpp@ 14515

Last change on this file since 14515 was 13837, checked in by vboxsync, 16 years ago

s/%Vr\([acfs]\)/%Rr\1/g - since I'm upsetting everyone anyway, better make the most of it...

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.8 KB
Line 
1/* $Id: tstRTFsQueries.cpp 13837 2008-11-05 02:54:02Z vboxsync $ */
2/** @file
3 * IPRT Testcase - RTFs Queries..
4 */
5
6/*
7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
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 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 *
26 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
27 * Clara, CA 95054 USA or visit http://www.sun.com if you need
28 * additional information or have any questions.
29 */
30
31/*******************************************************************************
32* Header Files *
33*******************************************************************************/
34#include <iprt/path.h>
35#include <iprt/runtime.h>
36#include <iprt/stream.h>
37#include <iprt/err.h>
38
39
40int main(int argc, char **argv)
41{
42 RTR3Init();
43
44 /*
45 * Process all arguments (including the executable).
46 */
47 int cErrors = 0;
48 for (int i = 0; i < argc; i++)
49 {
50 RTPrintf("tstRTFsQueries: '%s'...\n", argv[i]);
51
52 uint32_t u32Serial;
53 int rc = RTFsQuerySerial(argv[i], &u32Serial);
54 if (RT_SUCCESS(rc))
55 RTPrintf("tstRTFsQueries: u32Serial=%#010RX32\n", u32Serial);
56 else
57 {
58 RTPrintf("tstRTFsQueries: RTFsQuerySerial failed, rc=%Rrc\n", rc);
59 cErrors++;
60 }
61
62 RTFOFF cbTotal = 42;
63 RTFOFF cbFree = 42;
64 uint32_t cbBlock = 42;
65 uint32_t cbSector = 42;
66 rc = RTFsQuerySizes(argv[i], &cbTotal, &cbFree, &cbBlock, &cbSector);
67 if (RT_SUCCESS(rc))
68 RTPrintf("tstRTFsQueries: cbTotal=%RTfoff cbFree=%RTfoff cbBlock=%d cbSector=%d\n",
69 cbTotal, cbFree, cbBlock, cbSector);
70 else
71 {
72 RTPrintf("tstRTFsQueries: RTFsQuerySerial failed, rc=%Rrc\n", rc);
73 cErrors++;
74 }
75
76 rc = RTFsQuerySizes(argv[i], NULL, NULL, NULL, NULL);
77 if (RT_FAILURE(rc))
78 {
79 RTPrintf("tstRTFsQueries: RTFsQuerySizes(nop) failed, rc=%Rrc\n", rc);
80 cErrors++;
81 }
82
83 RTFSPROPERTIES Props;
84 rc = RTFsQueryProperties(argv[i], &Props);
85 if (RT_SUCCESS(rc))
86 RTPrintf("tstRTFsQueries: cbMaxComponent=%u %s %s %s %s %s %s\n",
87 Props.cbMaxComponent,
88 Props.fCaseSensitive ? "case" : "not-case",
89 Props.fCompressed ? "compressed" : "not-compressed",
90 Props.fFileCompression ? "file-compression" : "no-file-compression",
91 Props.fReadOnly ? "readonly" : "readwrite",
92 Props.fRemote ? "remote" : "not-remote",
93 Props.fSupportsUnicode ? "supports-unicode" : "doesn't-support-unicode");
94 else
95 {
96 RTPrintf("tstRTFsQueries: RTFsQueryProperties failed, rc=%Rrc\n", rc);
97 cErrors++;
98 }
99 }
100
101 if (!cErrors)
102 RTPrintf("tstRTFsQueries: SUCCESS\n");
103 else
104 RTPrintf("tstRTFsQueries: FAIlURE - %u errors\n", cErrors);
105 return !!cErrors;
106}
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