VirtualBox

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

Last change on this file since 52320 was 48935, checked in by vboxsync, 11 years ago

Runtime: Whitespace and svn:keyword cleanups by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 3.9 KB
Line 
1/* $Id: tstRTFsQueries.cpp 48935 2013-10-07 21:19:37Z vboxsync $ */
2/** @file
3 * IPRT Testcase - RTFs Queries..
4 */
5
6/*
7 * Copyright (C) 2006-2011 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 * 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
27/*******************************************************************************
28* Header Files *
29*******************************************************************************/
30#include <iprt/path.h>
31#include <iprt/initterm.h>
32#include <iprt/stream.h>
33#include <iprt/err.h>
34
35
36int main(int argc, char **argv)
37{
38 RTR3InitExe(argc, &argv, 0);
39
40 /*
41 * Process all arguments (including the executable).
42 */
43 int cErrors = 0;
44 for (int i = 0; i < argc; i++)
45 {
46 RTPrintf("tstRTFsQueries: '%s'...\n", argv[i]);
47
48 uint32_t u32Serial;
49 int rc = RTFsQuerySerial(argv[i], &u32Serial);
50 if (RT_SUCCESS(rc))
51 RTPrintf("tstRTFsQueries: u32Serial=%#010RX32\n", u32Serial);
52 else
53 {
54 RTPrintf("tstRTFsQueries: RTFsQuerySerial failed, rc=%Rrc\n", rc);
55 cErrors++;
56 }
57
58 RTFOFF cbTotal = 42;
59 RTFOFF cbFree = 42;
60 uint32_t cbBlock = 42;
61 uint32_t cbSector = 42;
62 rc = RTFsQuerySizes(argv[i], &cbTotal, &cbFree, &cbBlock, &cbSector);
63 if (RT_SUCCESS(rc))
64 RTPrintf("tstRTFsQueries: cbTotal=%RTfoff cbFree=%RTfoff cbBlock=%d cbSector=%d\n",
65 cbTotal, cbFree, cbBlock, cbSector);
66 else
67 {
68 RTPrintf("tstRTFsQueries: RTFsQuerySerial failed, rc=%Rrc\n", rc);
69 cErrors++;
70 }
71
72 rc = RTFsQuerySizes(argv[i], NULL, NULL, NULL, NULL);
73 if (RT_FAILURE(rc))
74 {
75 RTPrintf("tstRTFsQueries: RTFsQuerySizes(nop) failed, rc=%Rrc\n", rc);
76 cErrors++;
77 }
78
79 RTFSTYPE enmType;
80 rc = RTFsQueryType(argv[i], &enmType);
81 if (RT_SUCCESS(rc))
82 RTPrintf("tstRTFsQueries: file system type is '%s'\n", RTFsTypeName(enmType));
83 else
84 {
85 RTPrintf("tstRTFsQueries: RTFsQueryType failed, rc=%Rrc\n", rc);
86 cErrors++;
87 }
88
89 RTFSPROPERTIES Props;
90 rc = RTFsQueryProperties(argv[i], &Props);
91 if (RT_SUCCESS(rc))
92 RTPrintf("tstRTFsQueries: cbMaxComponent=%u %s %s %s %s %s %s\n",
93 Props.cbMaxComponent,
94 Props.fCaseSensitive ? "case" : "not-case",
95 Props.fCompressed ? "compressed" : "not-compressed",
96 Props.fFileCompression ? "file-compression" : "no-file-compression",
97 Props.fReadOnly ? "readonly" : "readwrite",
98 Props.fRemote ? "remote" : "not-remote",
99 Props.fSupportsUnicode ? "supports-unicode" : "doesn't-support-unicode");
100 else
101 {
102 RTPrintf("tstRTFsQueries: RTFsQueryProperties failed, rc=%Rrc\n", rc);
103 cErrors++;
104 }
105 }
106
107 if (!cErrors)
108 RTPrintf("tstRTFsQueries: SUCCESS\n");
109 else
110 RTPrintf("tstRTFsQueries: FAIlURE - %u errors\n", cErrors);
111 return !!cErrors;
112}
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