/* do the ioctl call */
ioctl_rc = USD_IOCTL(fd, USD_IOCTL_TAPEOPERATION, (void *)&tapeop);
- /* send the return code back to the parent */
- write(pipefd[1], &ioctl_rc, sizeof(int));
+ /*
+ * Send the return code back to the parent.
+ * If this fails, there's nothing we can do, but we must test
+ * it in order to avoid complier warnings on some platforms.
+ */
+ if (write(pipefd[1], &ioctl_rc, sizeof(int)) < 0) {
+ /* don't care */
+ }
exit(0);
} else { /* parent process */
USD_CLOSE(fd);
}
- /* send the return code back to the parent */
- write(pipefd[1], &open_rc, sizeof(open_rc));
+ /*
+ * Send the return code back to the parent.
+ * If this fails, there's nothing we can do, but we must test
+ * it in order to avoid complier warnings on some platforms.
+ */
+ if (write(pipefd[1], &open_rc, sizeof(open_rc)) < 0) {
+ /* don't care */
+ }
exit(0);
} else { /* parent process */
}
}
- /* the parent writes the control pipe after it closes the device */
- read(ctlpipe[0], &close_rc, sizeof(int));
+ /*
+ * The parent writes the control pipe after it closes the device.
+ * We don't actually care about the read; we're just using it to
+ * block until the parent is ready. But we must do something
+ * with the result, to avoid complier warnings on some platforms.
+ */
+ if (read(ctlpipe[0], &close_rc, sizeof(int)) < 0) {
+ /* don't care */
+ }
close(ctlpipe[0]);
/* do the close */
close_rc = USD_CLOSE(fd);
- /* send the return code back to the parent */
- write(pipefd[1], &close_rc, sizeof(int));
+ /*
+ * Send the return code back to the parent.
+ * If this fails, there's nothing we can do, but we must test
+ * it in order to avoid complier warnings on some platforms.
+ */
+ if (write(pipefd[1], &close_rc, sizeof(int)) < 0) {
+ /* don't care */
+ }
exit(0);
} else { /* parent process */
Rewind(usd_handle_t fid)
{
if (isafile) {
- afs_hyper_t startOff, stopOff;
- hzero(startOff);
+ afs_int64 stopOff;
- return (USD_SEEK(fid, startOff, SEEK_SET, &stopOff));
+ return (USD_SEEK(fid, 0, SEEK_SET, &stopOff));
} else {
return (ForkIoctl(fid, USDTAPE_REW, 0));
}
info->posCount = 0;
#if (defined(AFS_SUN_ENV) || defined(AFS_LINUX24_ENV))
if (!isafile) {
- afs_hyper_t off;
- hset64(off, 0, 0);
+ afs_int64 off;
+
+ off = 0;
USD_IOCTL(fid, USD_IOCTL_SETSIZE, &off);
}
#endif
int xflags;
afs_int32 code = 0, error = 0, rc = 0;
+ if (!info || !tape)
+ ERROR_EXIT(BUTM_BADARGUMENT);
+
if (info->debug)
printf("butm: Mount tape drive\n");
POLL();
info->error = 0;
- if (!info || !tape)
- ERROR_EXIT(BUTM_BADARGUMENT);
if (info->structVersion != BUTM_MAJORVERSION)
ERROR_EXIT(BUTM_OLDINTERFACE);
if (info->tmRock)
(void)PrepareAccess(fid); /* for NT */
- p = (struct progress *)malloc(sizeof(*p));
+ p = malloc(sizeof(*p));
info->tmRock = (char *)p;
p->fid = fid;
p->mountId = config.mountId = time(0);
afs_int32 fcode;
struct tapeLabel *tlabel;
struct progress *p;
- afs_hyper_t off; /* offset */
+ afs_int64 off; /* offset */
if (info->debug)
printf("butm: Write tape label\n");
if (isafile) {
p = (struct progress *)info->tmRock;
- hset64(off, 0, 0);
+ off = 0;
code = USD_IOCTL(p->fid, USD_IOCTL_SETSIZE, &off);
if (code)
ERROR_EXIT(BUTM_POSITION);
afs_int32 code = 0;
afs_int32 w;
osi_lloff_t posit;
- afs_uint32 c, d;
struct progress *p;
- afs_hyper_t startOff, stopOff; /* for normal file(non-tape) seeks */
+ afs_int64 stopOff; /* for normal file(non-tape) seeks */
if (info->debug)
printf("butm: Seek to the tape position %d\n", position);
p = (struct progress *)info->tmRock;
posit = (osi_lloff_t) position *(osi_lloff_t) BUTM_BLOCKSIZE;
- /* Not really necessary to do it this way, should be fixed */
-#ifdef O_LARGEFILE
- c = (posit >> 32);
- d = (posit & 0xffffffff);
-#else
- c = 0;
- d = posit;
-#endif
- hset64(startOff, c, d);
-
- w = USD_SEEK(p->fid, startOff, SEEK_SET, &stopOff);
+ w = USD_SEEK(p->fid, posit, SEEK_SET, &stopOff);
if (w)
info->error = w;
- if (hcmp(startOff, stopOff) != 0)
+ if (posit != stopOff)
ERROR_EXIT(BUTM_POSITION);
p->reading = p->writing = 0;
afs_int32 blockType;
afs_int32 w;
struct progress *p;
- afs_hyper_t startOff, stopOff; /* file seek offsets */
+ afs_int64 stopOff; /* file seek offsets */
if (info->debug)
printf("butm: Seek to end-of-dump\n");
if (isafile) {
p = (struct progress *)info->tmRock;
- hset64(startOff, 0, 0);
- w = USD_SEEK(p->fid, startOff, SEEK_END, &stopOff);
+ w = USD_SEEK(p->fid, 0, SEEK_END, &stopOff);
if (w) {
info->error = w;
ERROR_EXIT(BUTM_POSITION);
}
- if (hgetlo(stopOff) % BUTM_BLOCKSIZE)
+ if (stopOff % BUTM_BLOCKSIZE)
ERROR_EXIT(BUTM_POSITION);
- info->position = (hgetlo(stopOff) / BUTM_BLOCKSIZE);
+ info->position = (stopOff / BUTM_BLOCKSIZE);
} else {
/* Seek to the desired position */
code = SeekFile(info, (position - info->position) + 1);