Add rpm_off_t type for file size types, use where spotted

- preliminaries for bumping up the max size, use rpm-specific type
  as off_t size varies, header data needs fixed size
This commit is contained in:
Panu Matilainen 2008-02-04 11:27:00 +02:00
parent f53c323372
commit e886043a10
27 changed files with 51 additions and 49 deletions

View File

@ -17,7 +17,7 @@ extern "C" {
/**
*/
typedef struct cpioSourceArchive_s {
unsigned int cpioArchiveSize;
rpm_off_t cpioArchiveSize;
FD_t cpioFdIn;
rpmfi cpioList;
} * CSA_t;

View File

@ -97,7 +97,7 @@ typedef struct FileList_s {
char * prefix;
int fileCount;
int totalFileSize;
rpm_off_t totalFileSize;
int processingFailed;
int passedSpecialDoc;
@ -1125,8 +1125,8 @@ static void genCpioListAndHeader(FileList fl,
(void) headerAddOrAppendEntry(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE,
&(flp->fileURL), 1);
if (sizeof(flp->fl_size) != sizeof(uint32_t)) {
uint32_t psize = (uint32_t)flp->fl_size;
if (sizeof(flp->fl_size) != sizeof(rpm_off_t)) {
rpm_off_t psize = (rpm_off_t)flp->fl_size;
(void) headerAddOrAppendEntry(h, RPMTAG_FILESIZES, RPM_INT32_TYPE,
&(psize), 1);
} else {

View File

@ -463,7 +463,7 @@ rpmRC writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileName,
SHA1 = _free(SHA1);
}
{ uint32_t payloadSize = csa->cpioArchiveSize;
{ rpm_off_t payloadSize = csa->cpioArchiveSize;
(void) headerAddEntry(sig, RPMSIGTAG_PAYLOADSIZE, RPM_INT32_TYPE,
&payloadSize, 1);
}

View File

@ -555,8 +555,8 @@ static int fssizesTag(Header h, rpm_tagtype_t* type,
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
const char ** filenames;
int32_t * filesizes;
uint32_t * usages;
rpm_off_t * filesizes;
rpm_off_t * usages;
rpm_count_t numFiles;
if (!hge(h, RPMTAG_FILESIZES, NULL, (rpm_data_t *) &filesizes, &numFiles)) {

View File

@ -489,9 +489,9 @@ FSM_t freeFSM(FSM_t fsm)
int fsmSetup(FSM_t fsm, fileStage goal,
const rpmts ts, const rpmfi fi, FD_t cfd,
unsigned int * archiveSize, char ** failedFile)
rpm_off_t * archiveSize, char ** failedFile)
{
size_t pos = 0;
rpm_off_t pos = 0;
int rc, ec = 0;
fsm->goal = goal;
@ -741,7 +741,7 @@ int fsmMapAttrs(FSM_t fsm)
static int expandRegular(FSM_t fsm)
{
const struct stat * st = &fsm->sb;
int left = st->st_size;
rpm_off_t left = st->st_size;
int rc = 0;
rc = fsmNext(fsm, FSM_WOPEN);
@ -1683,7 +1683,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
rpmts ts = fsmGetTs(fsm);
rpmfi fi = fsmGetFi(fsm);
void * ptr;
unsigned int archivePos = fdGetCpioPos(fsm->cfd);
rpm_off_t archivePos = fdGetCpioPos(fsm->cfd);
if (archivePos > fi->archivePos) {
fi->archivePos = archivePos;
ptr = rpmtsNotify(ts, fi->te, RPMCALLBACK_INST_PROGRESS,

View File

@ -130,7 +130,7 @@ struct fsm_s {
int ix; /*!< Current file iterator index. */
hardLink_t links; /*!< Pending hard linked file(s). */
hardLink_t li; /*!< Current hard linked file(s). */
unsigned int * archiveSize; /*!< Pointer to archive size. */
rpm_off_t * archiveSize; /*!< Pointer to archive size. */
char ** failedFile; /*!< First file name that failed. */
const char * subdir; /*!< Current file sub-directory. */
char subbuf[64]; /* XXX eliminate */
@ -211,7 +211,7 @@ int fsmSetup(FSM_t fsm, fileStage goal,
const rpmts ts,
const rpmfi fi,
FD_t cfd,
unsigned int * archiveSize,
rpm_off_t * archiveSize,
char ** failedFile);
/**

View File

@ -62,8 +62,8 @@ struct rpmpsm_s {
int chrootDone; /*!< Was chroot(2) done by pkgStage? */
int unorderedSuccessor; /*!< Can the PSM be run asynchronously? */
rpmCallbackType what; /*!< Callback type. */
unsigned long amount; /*!< Callback amount. */
unsigned long total; /*!< Callback total. */
rpm_off_t amount; /*!< Callback amount. */
rpm_off_t total; /*!< Callback total. */
rpmRC rc;
pkgStage goal;
pkgStage stage; /*!< Current psm stage. */

View File

@ -28,7 +28,7 @@
/**
*/
static void printFileInfo(char * te, const char * name,
unsigned int size, unsigned short mode,
rpm_off_t size, unsigned short mode,
unsigned int mtime,
unsigned short rdev, unsigned int nlink,
const char * owner, const char * group,
@ -185,7 +185,7 @@ int showQueryPackage(QVA_t qva, rpmts ts, Header h)
unsigned short frdev;
unsigned int fmtime;
rpmfileState fstate;
size_t fsize;
rpm_off_t fsize;
const char * fn;
char fmd5[32+1];
const char * fuser;

View File

@ -35,8 +35,8 @@ typedef enum rpmCallbackType_e {
typedef void * (*rpmCallbackFunction)
(const void * h,
const rpmCallbackType what,
const unsigned long amount,
const unsigned long total,
const rpm_off_t amount,
const rpm_off_t total,
fnpyKey key,
rpmCallbackData data);

View File

@ -470,8 +470,8 @@ extern int rpmcliProgressTotal;
*/
void * rpmShowProgress(const void * arg,
const rpmCallbackType what,
const unsigned long amount,
const unsigned long total,
const rpm_off_t amount,
const rpm_off_t total,
fnpyKey key,
void * data);

View File

@ -193,9 +193,9 @@ const char * rpmfiFLink(rpmfi fi)
return flink;
}
uint32_t rpmfiFSize(rpmfi fi)
rpm_off_t rpmfiFSize(rpmfi fi)
{
uint32_t fsize = 0;
rpm_off_t fsize = 0;
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
if (fi->fsizes != NULL)

View File

@ -223,7 +223,7 @@ extern const char * rpmfiFLink(rpmfi fi);
* @param fi file info set
* @return current file size, 0 on invalid
*/
uint32_t rpmfiFSize(rpmfi fi);
rpm_off_t rpmfiFSize(rpmfi fi);
/** \ingroup rpmfi
* Return current file rdev from file info set.

View File

@ -43,7 +43,7 @@ struct rpmfi_s {
/*?null?*/
const uint32_t * fflags; /*!< File flag(s) (from header) */
/*?null?*/
const uint32_t * fsizes; /*!< File size(s) (from header) */
const rpm_off_t * fsizes; /*!< File size(s) (from header) */
/*?null?*/
const uint32_t * fmtimes; /*!< File modification time(s) (from header) */
/*?null?*/
@ -108,8 +108,8 @@ struct rpmfi_s {
size_t astriplen;
size_t striplen;
unsigned int archivePos;
unsigned int archiveSize;
rpm_off_t archivePos;
rpm_off_t archiveSize;
mode_t dperms; /*!< Directory perms (0755) if not mapped. */
mode_t fperms; /*!< File perms (0644) if not mapped. */
const char ** apath;
@ -119,7 +119,7 @@ struct rpmfi_s {
int keep_header; /*!< Keep header? */
uint32_t color; /*!< Color bit(s) from file color union. */
sharedFileInfo replaced; /*!< (TR_ADDED) */
uint32_t * replacedSizes; /*!< (TR_ADDED) */
rpm_off_t * replacedSizes; /*!< (TR_ADDED) */
unsigned int record; /*!< (TR_REMOVED) */
int magic;
#define RPMFIMAGIC 0x09697923

View File

@ -29,7 +29,7 @@ int rpmcliProgressTotal = 0;
* @param amount current
* @param total final
*/
static void printHash(const unsigned long amount, const unsigned long total)
static void printHash(const rpm_off_t amount, const rpm_off_t total)
{
int hashesNeeded;
@ -74,8 +74,8 @@ static void printHash(const unsigned long amount, const unsigned long total)
void * rpmShowProgress(const void * arg,
const rpmCallbackType what,
const unsigned long amount,
const unsigned long total,
const rpm_off_t amount,
const rpm_off_t total,
fnpyKey key,
void * data)
{

View File

@ -301,7 +301,7 @@ uint32_t rpmteSetColor(rpmte te, uint32_t color)
return ocolor;
}
uint32_t rpmtePkgFileSize(rpmte te)
rpm_off_t rpmtePkgFileSize(rpmte te)
{
return (te != NULL ? te->pkgFileSize : 0);
}

View File

@ -165,7 +165,7 @@ void rpmteSetDBInstance(rpmte te, unsigned int instance);
* @param te transaction element
* @return size in bytes of package file.
*/
uint32_t rpmtePkgFileSize(rpmte te);
rpm_off_t rpmtePkgFileSize(rpmte te);
/** \ingroup rpmte
* Retrieve dependency tree depth of transaction element.

View File

@ -55,7 +55,7 @@ struct rpmte_s {
rpmfi fi; /*!< File information. */
uint32_t color; /*!< Color bit(s) from package dependencies. */
uint32_t pkgFileSize; /*!< No. of bytes in package file (approx). */
rpm_off_t pkgFileSize; /*!< No. of bytes in package file (approx). */
fnpyKey key; /*!< (TR_ADDED) Retrieval key. */
rpmRelocation * relocs; /*!< (TR_ADDED) Payload file relocations. */

View File

@ -1297,7 +1297,7 @@ int rpmtsInitDSI(const rpmts ts)
}
void rpmtsUpdateDSI(const rpmts ts, dev_t dev,
uint32_t fileSize, uint32_t prevSize, uint32_t fixupSize,
rpm_off_t fileSize, rpm_off_t prevSize, rpm_off_t fixupSize,
rpmFileAction action)
{
rpmDiskSpaceInfo dsi;
@ -1384,7 +1384,7 @@ void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
}
void * rpmtsNotify(rpmts ts, rpmte te,
rpmCallbackType what, unsigned long amount, unsigned long total)
rpmCallbackType what, rpm_off_t amount, rpm_off_t total)
{
void * ptr = NULL;
if (ts && ts->notify && te) {

View File

@ -603,7 +603,7 @@ int rpmtsInitDSI(const rpmts ts);
* @param action file disposition
*/
void rpmtsUpdateDSI(const rpmts ts, dev_t dev,
uint32_t fileSize, uint32_t prevSize, uint32_t fixupSize,
rpm_off_t fileSize, rpm_off_t prevSize, rpm_off_t fixupSize,
rpmFileAction action);
/** \ingroup rpmts
@ -623,7 +623,7 @@ void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te);
* @return callback dependent pointer
*/
void * rpmtsNotify(rpmts ts, rpmte te,
rpmCallbackType what, unsigned long amount, unsigned long total);
rpmCallbackType what, rpm_off_t amount, rpm_off_t total);
/** \ingroup rpmts
* Return number of (ordered) transaction set elements.

View File

@ -24,6 +24,8 @@ typedef uint32_t rpm_count_t;
typedef void * rpm_data_t;
typedef const void * rpm_constdata_t;
typedef uint32_t rpm_off_t;
typedef struct headerToken_s * Header;
typedef struct headerIterator_s * HeaderIterator;

View File

@ -106,7 +106,7 @@ const char * rpmDetectPGPVersion(pgpVersion * pgpVer)
* @param datalen length of header+payload
* @return rpmRC return code
*/
static inline rpmRC printSize(FD_t fd, size_t siglen, size_t pad, size_t datalen)
static inline rpmRC printSize(FD_t fd, size_t siglen, size_t pad, rpm_off_t datalen)
{
struct stat st;
int fdno = Fileno(fd);
@ -273,7 +273,7 @@ rpmRC rpmReadSignature(FD_t fd, Header * sighp, sigType sig_type, char ** msg)
{ size_t sigSize = headerSizeof(sigh, HEADER_MAGIC_YES);
size_t pad = (8 - (sigSize % 8)) % 8; /* 8-byte pad */
ssize_t trc;
uint32_t * archSize = NULL;
rpm_off_t * archSize = NULL;
/* Position at beginning of header. */
if (pad && (trc = timedRead(fd, (void *)block, pad)) != pad) {

View File

@ -15,8 +15,8 @@ extern int _psm_debug;
static void *other_notify(const void *h,
const rpmCallbackType what,
const unsigned long amount,
const unsigned long total,
const rpm_off_t amount,
const rpm_off_t total,
fnpyKey key,
rpmCallbackData data)
{

View File

@ -112,7 +112,7 @@ int rpmVerifyFile(const rpmts ts, const rpmfi fi,
if (flags & RPMVERIFY_MD5) {
unsigned char md5sum[16];
size_t fsize;
rpm_off_t fsize;
/* XXX If --nomd5, then prelinked library sizes are not corrected. */
rc = rpmDoDigest(PGPHASHALGO_MD5, fn, 0, md5sum, &fsize);

View File

@ -957,7 +957,7 @@ fprintf(stderr, "*** rpmts_GetKeys(%p) ts %p\n", s, s->ts);
*/
static void *
rpmtsCallback(const void * hd, const rpmCallbackType what,
const unsigned long amount, const unsigned long total,
const rpm_off_t amount, const rpm_off_t total,
const void * pkgKey, rpmCallbackData data)
{
Header h = (Header) hd;

View File

@ -23,7 +23,7 @@
#include "debug.h"
static int open_dso(const char * path, pid_t * pidp, size_t *fsizep)
static int open_dso(const char * path, pid_t * pidp, rpm_off_t *fsizep)
{
static const char * cmd = NULL;
static int initted = 0;
@ -122,7 +122,7 @@ exit:
}
int rpmDoDigest(pgpHashAlgo algo, const char * fn,int asAscii,
unsigned char * digest, size_t * fsizep)
unsigned char * digest, rpm_off_t * fsizep)
{
const char * path;
urltype ut = urlPath(fn, &path);

View File

@ -29,7 +29,7 @@ typedef enum rpmCompressedMagic_e {
* @return 0 on success, 1 on error
*/
int rpmDoDigest(pgpHashAlgo algo, const char * fn,int asAscii,
unsigned char * digest, size_t * fsizep);
unsigned char * digest, rpm_off_t * fsizep);
/** \ingroup rpmfileutil

View File

@ -66,8 +66,8 @@ struct _FD_s {
struct _FDDIGEST_s digests[FDDIGEST_MAX];
unsigned int firstFree; /* fadio: */
long int fileSize; /* fadio: */
long int fd_cpioPos; /* cpio: */
rpm_off_t fileSize; /* fadio: */
rpm_off_t fd_cpioPos; /* cpio: */
};
/** \ingroup rpmio