tst_getsectsize.c revision 93d5c38791a3778eed18fe968cdd136d23d0fa07
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 Public
8 * License.
9 * %End-Header%
10 */
11
12#include <stdio.h>
13#include <string.h>
14#if HAVE_UNISTD_H
15#include <unistd.h>
16#endif
17#include <fcntl.h>
18#include <time.h>
19#include <sys/stat.h>
20#include <sys/types.h>
21#if HAVE_ERRNO_H
22#include <errno.h>
23#endif
24
25#include "ext2_fs.h"
26#include "ext2fs.h"
27
28int main(int argc, char **argv)
29{
30	int	sectsize;
31	int	retval;
32
33	if (argc < 2) {
34		fprintf(stderr, "Usage: %s device\n", argv[0]);
35		exit(1);
36	}
37
38	retval = ext2fs_get_device_sectsize(argv[1], &sectsize);
39	if (retval) {
40		com_err(argv[0], retval,
41			"while calling ext2fs_get_device_sectsize");
42		exit(1);
43	}
44	printf("Device %s has a hardware sector size of %d.\n",
45	       argv[1], sectsize);
46	exit(0);
47}
48