pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/45065: archivers/pax minix support



The following reply was made to PR pkg/45065; it has been noted by GNATS.

From: Thomas Cort <tcort%minix3.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: pkg/45065: archivers/pax minix support
Date: Tue, 19 Jul 2011 07:46:46 -0400

 After submitting the original patch, Minix's struct stat was enhanced to
 include the st_blksize member. That eliminates the st_blksize changes from
 the original patch. An update patch follows.
 
 Patch Summary:
 
  * Rename TODEV, MAJOR, and MINOR to PAX_TODEV, PAX_MAJOR, and PAX_MINOR
    to avoid a conflict with existing Minix macros.
 
  * setrlimit() isn't implemented on Minix, so we bypass setrlimit() if
    __minix is defined.
 
  * Minix has smaller types, so we define MFTENT_DUMMY_DEV to be SHRT_MAX
    instead of UINT_MAX when __minix is defined.
 
 diff --git a/archivers/pax/files/cpio.c b/archivers/pax/files/cpio.c
 index 57f3281..d47b0cb 100644
 --- a/archivers/pax/files/cpio.c
 +++ b/archivers/pax/files/cpio.c
 @@ -614,10 +614,10 @@ vcpio_rd(ARCHD *arcn, char *buf)
            HEX);
        devmajor = (dev_t)asc_ul(hd->c_maj, sizeof(hd->c_maj), HEX);
        devminor = (dev_t)asc_ul(hd->c_min, sizeof(hd->c_min), HEX);
 -      arcn->sb.st_dev = TODEV(devmajor, devminor);
 +      arcn->sb.st_dev = PAX_TODEV(devmajor, devminor);
        devmajor = (dev_t)asc_ul(hd->c_rmaj, sizeof(hd->c_maj), HEX);
        devminor = (dev_t)asc_ul(hd->c_rmin, sizeof(hd->c_min), HEX);
 -      arcn->sb.st_rdev = TODEV(devmajor, devminor);
 +      arcn->sb.st_rdev = PAX_TODEV(devmajor, devminor);
        arcn->crc = asc_ul(hd->c_chksum, sizeof(hd->c_chksum), HEX);
  
        /*
 @@ -787,13 +787,13 @@ vcpio_wr(ARCHD *arcn)
                HEX) ||
            ul_asc((u_long)arcn->sb.st_nlink, hd->c_nlink, sizeof(hd->c_nlink),
                HEX) ||
 -          ul_asc((u_long)MAJOR(arcn->sb.st_dev),hd->c_maj, sizeof(hd->c_maj),
 +          ul_asc((u_long)PAX_MAJOR(arcn->sb.st_dev),hd->c_maj, 
sizeof(hd->c_maj),
                HEX) ||
 -          ul_asc((u_long)MINOR(arcn->sb.st_dev),hd->c_min, sizeof(hd->c_min),
 +          ul_asc((u_long)PAX_MINOR(arcn->sb.st_dev),hd->c_min, 
sizeof(hd->c_min),
                HEX) ||
 -          ul_asc((u_long)MAJOR(arcn->sb.st_rdev),hd->c_rmaj,sizeof(hd->c_maj),
 +          
ul_asc((u_long)PAX_MAJOR(arcn->sb.st_rdev),hd->c_rmaj,sizeof(hd->c_maj),
                HEX) ||
 -          ul_asc((u_long)MINOR(arcn->sb.st_rdev),hd->c_rmin,sizeof(hd->c_min),
 +          
ul_asc((u_long)PAX_MINOR(arcn->sb.st_rdev),hd->c_rmin,sizeof(hd->c_min),
                HEX) ||
            ul_asc((u_long)nsz, hd->c_namesize, sizeof(hd->c_namesize), HEX))
                goto out;
 diff --git a/archivers/pax/files/ftree.c b/archivers/pax/files/ftree.c
 index cbe221e..0ef9c77 100644
 --- a/archivers/pax/files/ftree.c
 +++ b/archivers/pax/files/ftree.c
 @@ -451,7 +451,11 @@ next_file(ARCHD *arcn)
        int             cnt;
        time_t          atime, mtime;
        char            *curlink;
 +#ifndef __minix
  #define MFTENT_DUMMY_DEV      UINT_MAX
 +#else
 +#define MFTENT_DUMMY_DEV SHRT_MAX
 +#endif
  
        curlink = NULL;
  #ifndef SMALL
 diff --git a/archivers/pax/files/gen_subs.c b/archivers/pax/files/gen_subs.c
 index 8dd1a77..db8e3ea 100644
 --- a/archivers/pax/files/gen_subs.c
 +++ b/archivers/pax/files/gen_subs.c
 @@ -167,8 +167,8 @@ ls_list(ARCHD *arcn, time_t now, FILE *fp)
         * print device id's for devices, or sizes for other nodes
         */
        if ((arcn->type == PAX_CHR) || (arcn->type == PAX_BLK))
 -              (void)fprintf(fp, "%4lu,%4lu ", (long) MAJOR(sbp->st_rdev),
 -                  (long) MINOR(sbp->st_rdev));
 +              (void)fprintf(fp, "%4lu,%4lu ", (long) PAX_MAJOR(sbp->st_rdev),
 +                  (long) PAX_MINOR(sbp->st_rdev));
        else {
                (void)fprintf(fp, OFFT_FP("9") " ", (OFFT_T)sbp->st_size);
        }
 diff --git a/archivers/pax/files/pack_dev.c b/archivers/pax/files/pack_dev.c
 index 7b74724..b2b96b2 100644
 --- a/archivers/pax/files/pack_dev.c
 +++ b/archivers/pax/files/pack_dev.c
 @@ -90,7 +90,7 @@ pack_native(int n, u_long numbers[], const char **error)
        portdev_t dev = 0;
  
        if (n == 2) {
 -              dev = TODEV(numbers[0], numbers[1]);
 +              dev = PAX_TODEV(numbers[0], numbers[1]);
                if (major(dev) != numbers[0])
                        *error = iMajorError;
                else if (minor(dev) != numbers[1])
 diff --git a/archivers/pax/files/pax.c b/archivers/pax/files/pax.c
 index 93ce072..263cf97 100644
 --- a/archivers/pax/files/pax.c
 +++ b/archivers/pax/files/pax.c
 @@ -405,6 +405,7 @@ gen_init(void)
        struct sigaction n_hand;
        struct sigaction o_hand;
  
 +#ifndef __minix
        /*
         * Really needed to handle large archives. We can run out of memory for
         * internal tables really fast when we have a whole lot of files...
 @@ -440,7 +441,7 @@ gen_init(void)
                (void)setrlimit(RLIMIT_RSS , &reslimit);
        }
  #endif
 -
 +#endif /* __minix */
        /*
         * Handle posix locale
         *
 diff --git a/archivers/pax/files/pax.h b/archivers/pax/files/pax.h
 index 8e8faa1..affb57e 100644
 --- a/archivers/pax/files/pax.h
 +++ b/archivers/pax/files/pax.h
 @@ -247,22 +247,22 @@ typedef struct oplist {
  
  #ifdef HOSTPROG
  # include "pack_dev.h"                        /* explicitly use NetBSD's 
macros */
 -# define MAJOR(x)     major_netbsd(x)
 -# define MINOR(x)     minor_netbsd(x)
 -# define TODEV(x, y)  makedev_netbsd((x), (y))
 +# define PAX_MAJOR(x) major_netbsd(x)
 +# define PAX_MINOR(x) minor_netbsd(x)
 +# define PAX_TODEV(x, y)      makedev_netbsd((x), (y))
  #else
  # ifdef __HAIKU__
  #  define major(x)            ((int)(0x00ff & ((x) >> 8)))
  #  define minor(x)            ((int)(0xffff00ff & (x)))
  #  define makedev(maj,min)    ((0xff00 & ((maj)<<8))|(0xffff00ff & (min)))
  # endif
 -# define MAJOR(x)     major(x)
 -# define MINOR(x)     minor(x)
 +# define PAX_MAJOR(x) major(x)
 +# define PAX_MINOR(x) minor(x)
  # ifdef __QNXNTO__
  # include <sys/netmgr.h>
 -#  define TODEV(x, y) makedev(ND_LOCAL_NODE, (x), (y))
 +#  define PAX_TODEV(x, y)     makedev(ND_LOCAL_NODE, (x), (y))
  # else
 -#  define TODEV(x, y) makedev((x), (y))
 +#  define PAX_TODEV(x, y)     makedev((x), (y))
  # endif
  #endif
  
 diff --git a/archivers/pax/files/tar.c b/archivers/pax/files/tar.c
 index ebfece1..39c93cb 100644
 --- a/archivers/pax/files/tar.c
 +++ b/archivers/pax/files/tar.c
 @@ -941,7 +941,7 @@ ustar_rd(ARCHD *arcn, char *buf)
                }
                devmajor = (dev_t)asc_ul(hd->devmajor,sizeof(hd->devmajor),OCT);
                devminor = (dev_t)asc_ul(hd->devminor,sizeof(hd->devminor),OCT);
 -              arcn->sb.st_rdev = TODEV(devmajor, devminor);
 +              arcn->sb.st_rdev = PAX_TODEV(devmajor, devminor);
                break;
        case SYMTYPE:
        case LNKTYPE:
 @@ -1155,9 +1155,9 @@ ustar_wr(ARCHD *arcn)
                        hd->typeflag = CHRTYPE;
                else
                        hd->typeflag = BLKTYPE;
 -              if (ul_oct((u_long)MAJOR(arcn->sb.st_rdev), hd->devmajor,
 +              if (ul_oct((u_long)PAX_MAJOR(arcn->sb.st_rdev), hd->devmajor,
                   sizeof(hd->devmajor), 3) ||
 -                 ul_oct((u_long)MINOR(arcn->sb.st_rdev), hd->devminor,
 +                 ul_oct((u_long)PAX_MINOR(arcn->sb.st_rdev), hd->devminor,
                   sizeof(hd->devminor), 3) ||
                   ul_oct((u_long)0L, hd->size, sizeof(hd->size), 3))
                        return size_err("DEVTYPE", arcn);
 


Home | Main Index | Thread Index | Old Index