Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Nov 1996 18:09:29 +1100 (EST)
From:      dawes@physics.usyd.edu.au
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/1966: Team doesn't support volumes larger than 3GB
Message-ID:  <199611060709.SAA00655@landfill.physics.usyd.edu.au>
Resent-Message-ID: <199611060710.XAA25165@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         1966
>Category:       ports
>Synopsis:       Team doesn't support volumes larger than 3GB
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov  5 23:10:01 PST 1996
>Last-Modified:
>Originator:     David Dawes
>Organization:
University of Sydney, Australia
>Release:        FreeBSD 2.2-CURRENT i386
>Environment:
>Description:

team-3.1 doesn't support volume/file sizes larger than 3GB.  The reason
for this is that is uses long/unsigned long to hold the size/offset values.

>How-To-Repeat:

Atempt to read/write a file larger than 3GB with team.

>Fix:
	
The following quick patch fixes this (although I don't know if it is the
"right" way to do it).  It replaces 'long' with 'off_t' in the appropriate
places, and adjusts the printf formats accordingly.

*** team.c.ORIG	Wed Nov  6 17:51:42 1996
--- team.c	Wed Nov  6 18:07:15 1996
***************
*** 58,65 ****
    upstream to it, which has much the same effect.
  */
  
! #define TeamLVOLSZ	(1L<<10)
! #define TeamHVOLSZ	((long unsigned) 3 * ((long unsigned) 1 << 30))
  
  #define TeamLBUFSZ	(64)		/* Low buffer size		*/
  #define TeamDBUFSZ	(60*512)	/* Default buffer size		*/
--- 58,65 ----
    upstream to it, which has much the same effect.
  */
  
! #define TeamLVOLSZ	(off_t unsigned)(1L<<10)
! #define TeamHVOLSZ	((off_t unsigned) 3 * ((off_t unsigned) 1 << 62))
  
  #define TeamLBUFSZ	(64)		/* Low buffer size		*/
  #define TeamDBUFSZ	(60*512)	/* Default buffer size		*/
***************
*** 195,201 ****
  {
    int 	    fd;
    short	    status;
!   long unsigned   size;
  };
  
  local Fd		FdIn,FdOut;
--- 195,201 ----
  {
    int 	    fd;
    short	    status;
!   off_t unsigned   size;
  };
  
  local Fd		FdIn,FdOut;
***************
*** 204,210 ****
  (
    fast Fd		  *fd
  _ int			  ffd
! _ long unsigned		  size
  )
  {
    fd->status = (ffd >= 0) ? FdOPEN :   FdCLOSED;
--- 204,210 ----
  (
    fast Fd		  *fd
  _ int			  ffd
! _ off_t unsigned	  size
  )
  {
    fd->status = (ffd >= 0) ? FdOPEN :   FdCLOSED;
***************
*** 257,268 ****
    to->fd	= from->fd;
  }
  
! local long unsigned	FdRetry on((fd,which,done,space)) is
  (
    fast Fd		  *fd
  _ char			  *which
! _ long unsigned		  done
! _ long unsigned		  space
  )
  {
    int			  tty;
--- 257,268 ----
    to->fd	= from->fd;
  }
  
! local off_t unsigned	FdRetry on((fd,which,done,space)) is
  (
    fast Fd		  *fd
  _ char			  *which
! _ off_t	unsigned	  done
! _ off_t	unsigned	  space
  )
  {
    int			  tty;
***************
*** 303,311 ****
      (void) sprintf(errmsg,"Error %d",errno);
  #endif
      if (errno)
!       mesg("'%s' on %s after %luk. Continue [cyn] ? ",errmsg,which,done>>10);
      else
!       mesg("EOF on %s after %luk. Continue [cyn] ? ",which,done>>10);
  
      read(tty,reply,sizeof reply);
    }
--- 303,311 ----
      (void) sprintf(errmsg,"Error %d",errno);
  #endif
      if (errno)
!       mesg("'%s' on %s after %quk. Continue [cyn] ? ",errmsg,which,done>>10);
      else
!       mesg("EOF on %s after %quk. Continue [cyn] ? ",which,done>>10);
  
      read(tty,reply,sizeof reply);
    }
***************
*** 330,336 ****
  local unsigned		FdCanDo on((remaining,available)) is
  (
    fast address		  remaining
! _ fast long unsigned	  available
  )
  {
    return (remaining < available)
--- 330,336 ----
  local unsigned		FdCanDo on((remaining,available)) is
  (
    fast address		  remaining
! _ fast off_t unsigned	  available
  )
  {
    return (remaining < available)
***************
*** 342,351 ****
    fast Fd		  *fd
  _ pointer		  buffer
  _ fast address		  todo
! _ long unsigned		  done
  )
  {
!   fast long unsigned	  space;
    fast int		  bytesRead;
    fast address		  justDone;
  
--- 342,351 ----
    fast Fd		  *fd
  _ pointer		  buffer
  _ fast address		  todo
! _ off_t unsigned	  done
  )
  {
!   fast off_t unsigned	  space;
    fast int		  bytesRead;
    fast address		  justDone;
  
***************
*** 383,392 ****
    fast Fd		  *fd
  _ pointer		  buffer
  _ fast address		  todo
! _ long unsigned		  done
  )
  {
!   fast long unsigned	  space;
    fast int		  bytesWritten;
    fast address		  justDone;
  
--- 383,392 ----
    fast Fd		  *fd
  _ pointer		  buffer
  _ fast address		  todo
! _ off_t unsigned	  done
  )
  {
!   fast off_t unsigned	  space;
    fast int		  bytesWritten;
    fast address		  justDone;
  
***************
*** 463,469 ****
  {
    Token			  token;
    short			  status;
!   long unsigned		  done;
  };
  
  local bool		StreamSend on((fd,token,status,done)) is
--- 463,469 ----
  {
    Token			  token;
    short			  status;
!   off_t unsigned	  done;
  };
  
  local bool		StreamSend on((fd,token,status,done)) is
***************
*** 471,477 ****
    fast Fd		  *fd
  _ Token 		  token
  _ short 		  status
! _ long unsigned		  done
  )
  {
    fast int		  n;
--- 471,477 ----
    fast Fd		  *fd
  _ Token 		  token
  _ short 		  status
! _ off_t unsigned	  done
  )
  {
    fast int		  n;
***************
*** 493,499 ****
    fast Fd		  *fd
  _ Token 		  *tokenp
  _ short 		  *statusp
! _ long unsigned		  *donep
  )
  {
    fast int		  n;
--- 493,499 ----
    fast Fd		  *fd
  _ Token 		  *tokenp
  _ short 		  *statusp
! _ off_t unsigned	  *donep
  )
  {
    fast int		  n;
***************
*** 546,552 ****
  #define GuyRECEIVE(guy,tokenp,statusp,donep) \
    StreamReceive(&guy->upStream,tokenp,statusp,donep)
  
! local bool		GuyStop of((Guy *,char *,long unsigned));
  
  local bool		GuyStart on((guy,bufsize)) is
  (
--- 546,552 ----
  #define GuyRECEIVE(guy,tokenp,statusp,donep) \
    StreamReceive(&guy->upStream,tokenp,statusp,donep)
  
! local bool		GuyStop of((Guy *,char *,off_t unsigned));
  
  local bool		GuyStart on((guy,bufsize)) is
  (
***************
*** 557,563 ****
    fast char		  *buffer;
    Token 		  token;
    short 		  status;
!   long unsigned		  done;
    bool		  received;
    static int 		  bytesRead,bytesWritten;
  
--- 557,563 ----
    fast char		  *buffer;
    Token 		  token;
    short 		  status;
!   off_t unsigned	  done;
    bool		  received;
    static int 		  bytesRead,bytesWritten;
  
***************
*** 587,593 ****
      done += bytesRead;
  
      if (verbose)
!       mesg("%luk read   \r",done>>10);
  
      if (!GuySEND(guy,TokenREAD,FdIn.status,done))
        GuyStop(guy,"guy cannot send READ",done);
--- 587,593 ----
      done += bytesRead;
  
      if (verbose)
!       mesg("%quk read   \r",done>>10);
  
      if (!GuySEND(guy,TokenREAD,FdIn.status,done))
        GuyStop(guy,"guy cannot send READ",done);
***************
*** 605,611 ****
      done += bytesWritten;
  
      if (verbose)
!       mesg("%luk written\r",done>>10);
  
      if (!GuySEND(guy,TokenWRITE,FdOut.status,done))
        GuyStop(guy,"guy cannot send WRITE",done);
--- 605,611 ----
      done += bytesWritten;
  
      if (verbose)
!       mesg("%quk written\r",done>>10);
  
      if (!GuySEND(guy,TokenWRITE,FdOut.status,done))
        GuyStop(guy,"guy cannot send WRITE",done);
***************
*** 629,635 ****
  (
    fast Guy		  *guy
  _ char			  *errormsg
! _ long unsigned		  done
  )
  {
    Mesg(("GuyStop guy %#o\n",guy));
--- 629,635 ----
  (
    fast Guy		  *guy
  _ char			  *errormsg
! _ off_t unsigned	  done
  )
  {
    Mesg(("GuyStop guy %#o\n",guy));
***************
*** 637,644 ****
    if (done)
    {
      if (report)
!       mesg("%lu kilobytes, %lu seconds\r\n",
! 	  done>>10,(long unsigned) (time((time_t *) 0)-origin));
      else if (verbose)
        mesg("\n");
    }
--- 637,644 ----
    if (done)
    {
      if (report)
!       mesg("%qu kilobytes, %lu seconds\r\n",
! 	  done>>10,(off_t unsigned) (time((time_t *) 0)-origin));
      else if (verbose)
        mesg("\n");
    }
***************
*** 707,714 ****
  (
    fast Team		  *team
  _ address		  bufsize
! _ long unsigned		  isize
! _ long unsigned		  osize
  )
  {
    /*
--- 707,714 ----
  (
    fast Team		  *team
  _ address		  bufsize
! _ off_t unsigned		  isize
! _ off_t unsigned		  osize
  )
  {
    /*
***************
*** 924,931 ****
  syntax: team [-[vr]] [-iI[bkm] [-oO[bkm] [N[bkm] [P]]\n\
    copies standard input to output\n\
    -v gives ongoing report, -r final report\n\
!   I is input volume size (default %lum)\n\
!   O is output volume size (default %lum)\n\
    N is buffer size (default %luk)\n\
    P is number of processes (default %u)\n\
    (postfix b means *512, k means *1KB, m means *1MB)\n\
--- 924,931 ----
  syntax: team [-[vr]] [-iI[bkm] [-oO[bkm] [N[bkm] [P]]\n\
    copies standard input to output\n\
    -v gives ongoing report, -r final report\n\
!   I is input volume size (default %qum)\n\
!   O is output volume size (default %qum)\n\
    N is buffer size (default %luk)\n\
    P is number of processes (default %u)\n\
    (postfix b means *512, k means *1KB, m means *1MB)\n\
***************
*** 937,955 ****
    /*NOTREACHED*/
  }
  
! local long unsigned	atos on((s)) is
  (
    fast char		  *s
  )
  {
!   fast unsigned long	  l;
  
    for (
      s, l = 0L;
      *s >= '0' && *s <= '9';
      s++
    )
!     l = l*10L + (long unsigned) (*s-'0');
  
    if (*s == 'b') l *= (1L<<9);
    if (*s == 'k') l *= (1L<<10);
--- 937,955 ----
    /*NOTREACHED*/
  }
  
! local off_t unsigned	atos on((s)) is
  (
    fast char		  *s
  )
  {
!   fast off_t unsigned	  l;
  
    for (
      s, l = 0L;
      *s >= '0' && *s <= '9';
      s++
    )
!     l = l*10L + (off_t unsigned) (*s-'0');
  
    if (*s == 'b') l *= (1L<<9);
    if (*s == 'k') l *= (1L<<10);
***************
*** 968,975 ****
    short unsigned	  teamsize;
  
    address		  bufsize;
!   long unsigned		  isize;
!   long unsigned		  osize;
    int			  opt;
  
    teamsize = TeamDTEAMSZ;
--- 968,975 ----
    short unsigned	  teamsize;
  
    address		  bufsize;
!   off_t unsigned	  isize;
!   off_t unsigned	  osize;
    int			  opt;
  
    teamsize = TeamDTEAMSZ;
***************
*** 985,991 ****
        isize = atos(optarg);
        if (isize < TeamLVOLSZ || isize > TeamHVOLSZ)
        {
! 	fprintf(stderr,"team: invalid input volume size %lu\n",isize);
  	usage();
        }
    
--- 985,991 ----
        isize = atos(optarg);
        if (isize < TeamLVOLSZ || isize > TeamHVOLSZ)
        {
! 	fprintf(stderr,"team: invalid input volume size %qu\n",isize);
  	usage();
        }
    
***************
*** 993,999 ****
        osize = atos(optarg);
        if (osize < TeamLVOLSZ || osize > TeamHVOLSZ)
        {
! 	fprintf(stderr,"team: invalid output volume size %lu\n",osize);
  	usage();
        }
  
--- 993,999 ----
        osize = atos(optarg);
        if (osize < TeamLVOLSZ || osize > TeamHVOLSZ)
        {
! 	fprintf(stderr,"team: invalid output volume size %qu\n",osize);
  	usage();
        }
  
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199611060709.SAA00655>