Whamcloud - gitweb
libext2fs: include config.h for HAVE_xxx defines
[tools/e2fsprogs.git] / lib / ext2fs / tst_getsectsize.c
1 /*
2  * tst_getsize.c --- this function tests the getsize function
3  *
4  * Copyright (C) 1997 by Theodore Ts'o.
5  *
6  * %Begin-Header%
7  * This file may be redistributed under the terms of the GNU Library
8  * General Public License, version 2.
9  * %End-Header%
10  */
11
12 #include "config.h"
13 #include <stdio.h>
14 #include <string.h>
15 #if HAVE_UNISTD_H
16 #include <unistd.h>
17 #endif
18 #include <fcntl.h>
19 #include <time.h>
20 #include <sys/stat.h>
21 #include <sys/types.h>
22 #if HAVE_ERRNO_H
23 #include <errno.h>
24 #endif
25
26 #include "ext2_fs.h"
27 #include "ext2fs.h"
28
29 int main(int argc, char **argv)
30 {
31         int     lsectsize, psectsize;
32         int     retval;
33
34         if (argc < 2) {
35                 fprintf(stderr, "Usage: %s device\n", argv[0]);
36                 exit(1);
37         }
38
39         retval = ext2fs_get_device_sectsize(argv[1], &lsectsize);
40         if (retval) {
41                 com_err(argv[0], retval,
42                         "while calling ext2fs_get_device_sectsize");
43                 exit(1);
44         }
45         retval = ext2fs_get_device_phys_sectsize(argv[1], &psectsize);
46         if (retval) {
47                 com_err(argv[0], retval,
48                         "while calling ext2fs_get_device_phys_sectsize");
49                 exit(1);
50         }
51         printf("Device %s has logical/physical sector size of %d/%d.\n",
52                argv[1], lsectsize, psectsize);
53         exit(0);
54 }