/*
- * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
+ * Copyright (c) 2000-2001 Silicon Graphics, Inc.
+ * All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA 94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <sys/types.h>
#include <lib/hsm.h>
#include <lib/errtest.h>
-#ifdef linux
+#include <getopt.h>
#include <string.h>
-#endif
+
/*---------------------------------------------------------------------------
static void
usage(void)
{
- int i;
-
fprintf(stderr, "usage:\t%s [-v] [-s sid] ls_path directoryname\n",
Progname);
exit(1);
dm_sessid_t sid = DM_NO_SESSION;
char *pathname = NULL;
char *ls_path = NULL;
- dm_off_t offset = 0;
+ dm_off_t offset = 0, end;
dm_off_t ex_off = 0;
dm_extent_t extent[20];
u_int nelem;
dm_token_t test_token;
char *name;
int opt;
- int i;
int Vflag = 0;
char filename[128];
char command[128];
pathname = argv[optind+1];
if (dm_init_service(&name) == -1) {
- fprintf(stdout, "Can't inititalize the DMAPI\n");
+ fprintf(stdout, "Can't initialize the DMAPI\n");
exit(1);
}
if (sid == DM_NO_SESSION)
exit(1);
}
+ /*
+ * The kernel always rounds the offset up to the next block
+ * size, so we can only probes up to the previous to last block.
+ */
+ end = (29604 / blocksize) * blocksize;
+
/* Check that dm_probe_hole returns an extent from the next
* highest multiple of the block size, to the end of the file
*/
- i = 0;
- for (offset = 0; offset < 29604; offset++) {
+ for (offset = 0; offset < end; offset++) {
if (dm_probe_hole(sid, hanp, hlen, DM_NO_TOKEN, offset, length,
&roff, &rlen)) {
fprintf(stdout, "dm_probe_hole failed on pass %lld (%s)\n",
dm_probe_hole(sid, hanp, hlen, DM_NO_TOKEN, 30000, length,
&roff, &rlen))
/*---------------------------------------------------------*/
- /* PROBLEM: No error is produced.
- /* off+len >= filesize should produce E2BIG...
ERRTEST(E2BIG,
"probe (to past EOF)",
dm_probe_hole(sid, hanp, hlen, DM_NO_TOKEN, 15000, 150000,
EXCLTEST("punch", hanp, hlen, test_token,
dm_punch_hole(sid, hanp, hlen, test_token, 0, 0))
/*---------------------------------------------------------*/
+ /*
+ * No idea where that EAGAIN should come from, it's never
+ * returned from the kernel.
+ *
+ * -- hch
+ */
+#if 0
ERRTEST(EAGAIN,
"punch",
dm_punch_hole(sid, hanp, hlen, DM_NO_TOKEN,
1, length))
+#endif
/*---------------------------------------------------------*/
if ((test_vp = handle_clone(hanp, hlen)) == NULL) {
fprintf(stderr,