butm-restore-from-large-files-20030729

make restore also work from large files
This commit is contained in:
Derrick Brashear 2003-07-29 23:34:33 +00:00
parent 5227918cb9
commit f7c4f16110

View File

@ -31,6 +31,15 @@ RCSID
#include <afs/usd.h>
#include "error_macros.h"
#ifdef O_LARGEFILE
typedef off64_t osi_lloff_t;
#else /* O_LARGEFILE */
#ifdef AFS_HAVE_LLSEEK
typedef offset_t osi_lloff_t;
#else /* AFS_HAVE_LLSEEK */
typedef off_t osi_lloff_t;
#endif /* AFS_HAVE_LLSEEK */
#endif /* O_LARGEFILE */
extern int isafile;
@ -652,7 +661,7 @@ incPosition(info, fid, dataSize)
if (info->posCount >= 2147467264) { /* 2GB - 16K */
info->posCount = 0;
#if (defined(AFS_SUN_ENV) || defined(AFS_DEC_ENV))
#if (defined(AFS_SUN_ENV) || defined(AFS_DEC_ENV) || defined(AFS_LINUX24_ENV))
if (!isafile) {
hset64(off, 0, 0);
USD_IOCTL(fid, USD_IOCTL_SETSIZE, &off);
@ -1596,7 +1605,9 @@ file_Seek(info, position)
afs_int32 position;
{
afs_int32 code = 0;
afs_int32 posit, w;
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 */
@ -1611,9 +1622,18 @@ file_Seek(info, position)
if (isafile) {
p = (struct progress *)info->tmRock;
posit = (position * BUTM_BLOCKSIZE);
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);
hset64(startOff, 0, posit);
w = USD_SEEK(p->fid, startOff, SEEK_SET, &stopOff);
if (w)
info->error == w;