2003-05-22 01:28:29 +04:00
|
|
|
/*
|
|
|
|
* tst_getsize.c --- this function tests the getsize function
|
2008-08-28 07:07:54 +04:00
|
|
|
*
|
2003-05-22 01:28:29 +04:00
|
|
|
* Copyright (C) 1997 by Theodore Ts'o.
|
2008-08-28 07:07:54 +04:00
|
|
|
*
|
2003-05-22 01:28:29 +04:00
|
|
|
* %Begin-Header%
|
2010-05-18 05:31:56 +04:00
|
|
|
* This file may be redistributed under the terms of the GNU Library
|
|
|
|
* General Public License, version 2.
|
2003-05-22 01:28:29 +04:00
|
|
|
* %End-Header%
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#if HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#if HAVE_ERRNO_H
|
|
|
|
#include <errno.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "ext2_fs.h"
|
|
|
|
#include "ext2fs.h"
|
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
2010-05-18 06:31:45 +04:00
|
|
|
int lsectsize, psectsize;
|
2003-05-22 01:28:29 +04:00
|
|
|
int retval;
|
2008-08-28 07:07:54 +04:00
|
|
|
|
2003-05-22 01:28:29 +04:00
|
|
|
if (argc < 2) {
|
|
|
|
fprintf(stderr, "Usage: %s device\n", argv[0]);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2010-05-18 06:31:45 +04:00
|
|
|
retval = ext2fs_get_device_sectsize(argv[1], &lsectsize);
|
2003-05-22 01:28:29 +04:00
|
|
|
if (retval) {
|
|
|
|
com_err(argv[0], retval,
|
|
|
|
"while calling ext2fs_get_device_sectsize");
|
|
|
|
exit(1);
|
|
|
|
}
|
2010-05-18 06:31:45 +04:00
|
|
|
retval = ext2fs_get_device_phys_sectsize(argv[1], &psectsize);
|
|
|
|
if (retval) {
|
|
|
|
com_err(argv[0], retval,
|
|
|
|
"while calling ext2fs_get_device_phys_sectsize");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
printf("Device %s has logical/physical sector size of %d/%d.\n",
|
|
|
|
argv[1], lsectsize, psectsize);
|
2003-05-22 01:28:29 +04:00
|
|
|
exit(0);
|
|
|
|
}
|