From d36d835b48f3c280b254a9ca6d519d5c97d14ad4 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Wed, 12 Nov 1997 03:48:07 +0000 Subject: [PATCH] ChangeLog, Makefile.in, Makefile.pq, ext2_err.et.in, tst_getsize.c: Makefile.in, tst_getsize.c: Added new file which is used to test the ext2fs_get_device_size function. ext2_err.et.in (EXT2_ET_UNIMPLEMENTED): Added new error code. --- lib/ext2fs/ChangeLog | 7 +++++++ lib/ext2fs/Makefile.in | 4 ++++ lib/ext2fs/Makefile.pq | 1 - lib/ext2fs/ext2_err.et.in | 3 +++ lib/ext2fs/tst_getsize.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 lib/ext2fs/tst_getsize.c diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index 7b489b4..0e7adc5 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,3 +1,10 @@ +Tue Nov 11 22:46:45 1997 Theodore Ts'o + + * Makefile.in, tst_getsize.c: Added new file which is used to test + the ext2fs_get_device_size function. + + * ext2_err.et.in (EXT2_ET_UNIMPLEMENTED): Added new error code. + Sun Nov 2 20:36:13 1997 Theodore Ts'o * ext2fs.h: Make ext2fs_get_mem take an unsigned argument. diff --git a/lib/ext2fs/Makefile.in b/lib/ext2fs/Makefile.in index aeac210..692512d 100644 --- a/lib/ext2fs/Makefile.in +++ b/lib/ext2fs/Makefile.in @@ -165,6 +165,10 @@ tst_iscan: tst_iscan.o inode.o $(STATIC_LIBEXT2FS) $(CC) -o tst_iscan tst_iscan.o inode.o $(STATIC_LIBEXT2FS) \ $(LIBCOM_ERR) +tst_getsize: tst_getsize.o getsize.o $(STATIC_LIBEXT2FS) + $(CC) -o tst_getsize tst_getsize.o getsize.o $(STATIC_LIBEXT2FS) \ + $(LIBCOM_ERR) + check:: tst_badblocks tst_iscan ./tst_badblocks ./tst_iscan diff --git a/lib/ext2fs/Makefile.pq b/lib/ext2fs/Makefile.pq index 638c166..6afe1b4 100644 --- a/lib/ext2fs/Makefile.pq +++ b/lib/ext2fs/Makefile.pq @@ -24,7 +24,6 @@ OBJS= alloc.obj \ fileio.obj \ freefs.obj \ get_pathname.obj \ - getsize.obj \ icount.obj \ initialize.obj \ inline.obj \ diff --git a/lib/ext2fs/ext2_err.et.in b/lib/ext2fs/ext2_err.et.in index 80f5532..b815dd2 100644 --- a/lib/ext2fs/ext2_err.et.in +++ b/lib/ext2fs/ext2_err.et.in @@ -248,5 +248,8 @@ ec EXT2_ET_DB_NOT_FOUND, ec EXT2_ET_DIR_EXISTS, "Ext2 directory already exists" +ec EXT2_ET_UNIMPLEMENTED, + "Unimplemented ext2 library function" + end diff --git a/lib/ext2fs/tst_getsize.c b/lib/ext2fs/tst_getsize.c new file mode 100644 index 0000000..232fc2d --- /dev/null +++ b/lib/ext2fs/tst_getsize.c @@ -0,0 +1,46 @@ +/* + * tst_getsize.c --- this function tests the getsize function + * + * Copyright (C) 1997 by Theodore Ts'o. + * + * %Begin-Header% + * This file may be redistributed under the terms of the GNU Public + * License. + * %End-Header% + */ + +#include +#include +#if HAVE_UNISTD_H +#include +#endif +#include +#include +#include +#include +#include +#if HAVE_ERRNO_H +#include +#endif + +#include + +#include "ext2fs.h" + +int main(int argc, const char *argv[]) +{ + errcode_t retval; + blk_t blocks; + + if (argc < 2) { + fprintf(stderr, "%s device\n", argv[0]); + exit(1); + } + retval = ext2fs_get_device_size(argv[1], 1024, &blocks); + if (retval) { + com_err(argv[0], retval, "while getting device size"); + exit(1); + } + printf("%s is device has %d blocks.\n", argv[1], blocks); + return 0; +} -- 1.8.3.1