Merge ^/head r310169 through r310190.
This commit is contained in:
commit
aef228521c
@ -1379,7 +1379,8 @@ packages: .PHONY
|
||||
package-pkg: .PHONY
|
||||
rm -rf /tmp/ports.${TARGET} || :
|
||||
env ${WMAKEENV:Q} SRCDIR=${.CURDIR} PORTSDIR=${PORTSDIR} REVISION=${_REVISION} \
|
||||
PKG_VERSION=${PKG_VERSION} REPODIR=${REPODIR} WSTAGEDIR=${WSTAGEDIR} \
|
||||
PKG_CMD=${PKG_CMD} PKG_VERSION=${PKG_VERSION} REPODIR=${REPODIR} \
|
||||
WSTAGEDIR=${WSTAGEDIR} \
|
||||
sh ${.CURDIR}/release/scripts/make-pkg-package.sh
|
||||
|
||||
real-packages: stage-packages create-packages sign-packages .PHONY
|
||||
@ -1417,11 +1418,11 @@ create-world-packages: _pkgbootstrap .PHONY
|
||||
/^name/ { printf("===> Creating %s-", $$2); next } \
|
||||
/^version/ { print $$2; next } \
|
||||
' ${WSTAGEDIR}/$${pkgname}.ucl ; \
|
||||
pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \
|
||||
${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \
|
||||
create -M ${WSTAGEDIR}/$${pkgname}.ucl \
|
||||
-p ${WSTAGEDIR}/$${pkgname}.plist \
|
||||
-r ${WSTAGEDIR} \
|
||||
-o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} ; \
|
||||
-o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} ; \
|
||||
done
|
||||
|
||||
create-kernel-packages: _pkgbootstrap .PHONY
|
||||
@ -1445,11 +1446,11 @@ create-kernel-packages: _pkgbootstrap .PHONY
|
||||
/name/ { printf("===> Creating %s-", $$2); next } \
|
||||
/version/ {print $$2; next } ' \
|
||||
${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \
|
||||
pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \
|
||||
${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \
|
||||
create -M ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl \
|
||||
-p ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.plist \
|
||||
-r ${KSTAGEDIR}/${DISTDIR} \
|
||||
-o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION}
|
||||
-o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION}
|
||||
.endfor
|
||||
.endif
|
||||
.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
|
||||
@ -1474,25 +1475,25 @@ create-kernel-packages: _pkgbootstrap .PHONY
|
||||
/name/ { printf("===> Creating %s-", $$2); next } \
|
||||
/version/ {print $$2; next } ' \
|
||||
${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \
|
||||
pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \
|
||||
${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \
|
||||
create -M ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl \
|
||||
-p ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.plist \
|
||||
-r ${KSTAGEDIR}/kernel.${_kernel} \
|
||||
-o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION}
|
||||
-o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION}
|
||||
.endfor
|
||||
.endif
|
||||
.endfor
|
||||
.endif
|
||||
|
||||
sign-packages: _pkgbootstrap .PHONY
|
||||
@[ -L "${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/latest" ] && \
|
||||
unlink ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/latest ; \
|
||||
pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh repo \
|
||||
-o ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} \
|
||||
${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} \
|
||||
@[ -L "${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/latest" ] && \
|
||||
unlink ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/latest ; \
|
||||
${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh repo \
|
||||
-o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} \
|
||||
${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} \
|
||||
${PKGSIGNKEY} ; \
|
||||
ln -s ${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} \
|
||||
${REPODIR}/$$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/latest
|
||||
ln -s ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION} \
|
||||
${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/latest
|
||||
|
||||
#
|
||||
#
|
||||
|
@ -142,5 +142,8 @@ main(int argc, char **argv)
|
||||
bsdcat_next();
|
||||
}
|
||||
|
||||
if (a != NULL)
|
||||
archive_read_free(a);
|
||||
|
||||
exit(exit_status);
|
||||
}
|
||||
|
@ -1324,10 +1324,9 @@ lookup_name(struct cpio *cpio, struct name_cache **name_cache_variable,
|
||||
|
||||
|
||||
if (*name_cache_variable == NULL) {
|
||||
*name_cache_variable = malloc(sizeof(struct name_cache));
|
||||
*name_cache_variable = calloc(1, sizeof(struct name_cache));
|
||||
if (*name_cache_variable == NULL)
|
||||
lafe_errc(1, ENOMEM, "No more memory");
|
||||
memset(*name_cache_variable, 0, sizeof(struct name_cache));
|
||||
(*name_cache_variable)->size = name_cache_size;
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,13 @@ DEFINE_TEST(test_option_lz4)
|
||||
"but no such program is available on this system.");
|
||||
return;
|
||||
}
|
||||
/* On some systems the error won't be detected until closing
|
||||
time, by a 127 exit error returned by waitpid. */
|
||||
if (strstr(p, "Error closing") != NULL && !canLz4()) {
|
||||
skipping("This version of bsdcpio uses an external lz4 program "
|
||||
"but no such program is available on this system.");
|
||||
return;
|
||||
}
|
||||
failure("--lz4 option is broken: %s", p);
|
||||
assertEqualInt(r, 0);
|
||||
return;
|
||||
|
@ -373,7 +373,7 @@ typedef const char *archive_passphrase_callback(struct archive *,
|
||||
* 4) Repeatedly call archive_read_next_header to get information about
|
||||
* successive archive entries. Call archive_read_data to extract
|
||||
* data for entries of interest.
|
||||
* 5) Call archive_read_finish to end processing.
|
||||
* 5) Call archive_read_free to end processing.
|
||||
*/
|
||||
__LA_DECL struct archive *archive_read_new(void);
|
||||
|
||||
|
@ -280,11 +280,17 @@ acl_new_entry(struct archive_acl *acl,
|
||||
acl->acl_text = NULL;
|
||||
}
|
||||
|
||||
/* If there's a matching entry already in the list, overwrite it. */
|
||||
/*
|
||||
* If there's a matching entry already in the list, overwrite it.
|
||||
* NFSv4 entries may be repeated and are not overwritten.
|
||||
*
|
||||
* TODO: compare names of no id is provided (needs more rework)
|
||||
*/
|
||||
ap = acl->acl_head;
|
||||
aq = NULL;
|
||||
while (ap != NULL) {
|
||||
if (ap->type == type && ap->tag == tag && ap->id == id) {
|
||||
if (((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) == 0) &&
|
||||
ap->type == type && ap->tag == tag && ap->id == id) {
|
||||
if (id != -1 || (tag != ARCHIVE_ENTRY_ACL_USER &&
|
||||
tag != ARCHIVE_ENTRY_ACL_GROUP)) {
|
||||
ap->permset = permset;
|
||||
@ -296,10 +302,9 @@ acl_new_entry(struct archive_acl *acl,
|
||||
}
|
||||
|
||||
/* Add a new entry to the end of the list. */
|
||||
ap = (struct archive_acl_entry *)malloc(sizeof(*ap));
|
||||
ap = (struct archive_acl_entry *)calloc(1, sizeof(*ap));
|
||||
if (ap == NULL)
|
||||
return (NULL);
|
||||
memset(ap, 0, sizeof(*ap));
|
||||
if (aq == NULL)
|
||||
acl->acl_head = ap;
|
||||
else
|
||||
|
@ -302,6 +302,8 @@ aes_ctr_release(archive_crypto_ctx *ctx)
|
||||
static int
|
||||
aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
|
||||
{
|
||||
if ((ctx->ctx = EVP_CIPHER_CTX_new()) == NULL)
|
||||
return -1;
|
||||
|
||||
switch (key_len) {
|
||||
case 16: ctx->type = EVP_aes_128_ecb(); break;
|
||||
@ -314,7 +316,7 @@ aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
|
||||
memcpy(ctx->key, key, key_len);
|
||||
memset(ctx->nonce, 0, sizeof(ctx->nonce));
|
||||
ctx->encr_pos = AES_BLOCK_SIZE;
|
||||
EVP_CIPHER_CTX_init(&ctx->ctx);
|
||||
EVP_CIPHER_CTX_init(ctx->ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -324,10 +326,10 @@ aes_ctr_encrypt_counter(archive_crypto_ctx *ctx)
|
||||
int outl = 0;
|
||||
int r;
|
||||
|
||||
r = EVP_EncryptInit_ex(&ctx->ctx, ctx->type, NULL, ctx->key, NULL);
|
||||
r = EVP_EncryptInit_ex(ctx->ctx, ctx->type, NULL, ctx->key, NULL);
|
||||
if (r == 0)
|
||||
return -1;
|
||||
r = EVP_EncryptUpdate(&ctx->ctx, ctx->encr_buf, &outl, ctx->nonce,
|
||||
r = EVP_EncryptUpdate(ctx->ctx, ctx->encr_buf, &outl, ctx->nonce,
|
||||
AES_BLOCK_SIZE);
|
||||
if (r == 0 || outl != AES_BLOCK_SIZE)
|
||||
return -1;
|
||||
@ -337,7 +339,7 @@ aes_ctr_encrypt_counter(archive_crypto_ctx *ctx)
|
||||
static int
|
||||
aes_ctr_release(archive_crypto_ctx *ctx)
|
||||
{
|
||||
EVP_CIPHER_CTX_cleanup(&ctx->ctx);
|
||||
EVP_CIPHER_CTX_free(ctx->ctx);
|
||||
memset(ctx->key, 0, ctx->key_len);
|
||||
memset(ctx->nonce, 0, sizeof(ctx->nonce));
|
||||
return 0;
|
||||
|
@ -99,12 +99,12 @@ typedef struct {
|
||||
} archive_crypto_ctx;
|
||||
|
||||
#elif defined(HAVE_LIBCRYPTO)
|
||||
#include <openssl/evp.h>
|
||||
#include "archive_openssl_evp_private.h"
|
||||
#define AES_BLOCK_SIZE 16
|
||||
#define AES_MAX_KEY_SIZE 32
|
||||
|
||||
typedef struct {
|
||||
EVP_CIPHER_CTX ctx;
|
||||
EVP_CIPHER_CTX *ctx;
|
||||
const EVP_CIPHER *type;
|
||||
uint8_t key[AES_MAX_KEY_SIZE];
|
||||
unsigned key_len;
|
||||
|
@ -207,7 +207,9 @@ __archive_nettle_md5final(archive_md5_ctx *ctx, void *md)
|
||||
static int
|
||||
__archive_openssl_md5init(archive_md5_ctx *ctx)
|
||||
{
|
||||
EVP_DigestInit(ctx, EVP_md5());
|
||||
if ((*ctx = EVP_MD_CTX_new()) == NULL)
|
||||
return (ARCHIVE_FAILED);
|
||||
EVP_DigestInit(*ctx, EVP_md5());
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
@ -215,7 +217,7 @@ static int
|
||||
__archive_openssl_md5update(archive_md5_ctx *ctx, const void *indata,
|
||||
size_t insize)
|
||||
{
|
||||
EVP_DigestUpdate(ctx, indata, insize);
|
||||
EVP_DigestUpdate(*ctx, indata, insize);
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
@ -226,8 +228,11 @@ __archive_openssl_md5final(archive_md5_ctx *ctx, void *md)
|
||||
* this is meant to cope with that. Real fix is probably to fix
|
||||
* archive_write_set_format_xar.c
|
||||
*/
|
||||
if (ctx->digest)
|
||||
EVP_DigestFinal(ctx, md, NULL);
|
||||
if (*ctx) {
|
||||
EVP_DigestFinal(*ctx, md, NULL);
|
||||
EVP_MD_CTX_free(*ctx);
|
||||
*ctx = NULL;
|
||||
}
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
@ -359,7 +364,9 @@ __archive_nettle_ripemd160final(archive_rmd160_ctx *ctx, void *md)
|
||||
static int
|
||||
__archive_openssl_ripemd160init(archive_rmd160_ctx *ctx)
|
||||
{
|
||||
EVP_DigestInit(ctx, EVP_ripemd160());
|
||||
if ((*ctx = EVP_MD_CTX_new()) == NULL)
|
||||
return (ARCHIVE_FAILED);
|
||||
EVP_DigestInit(*ctx, EVP_ripemd160());
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
@ -367,14 +374,18 @@ static int
|
||||
__archive_openssl_ripemd160update(archive_rmd160_ctx *ctx, const void *indata,
|
||||
size_t insize)
|
||||
{
|
||||
EVP_DigestUpdate(ctx, indata, insize);
|
||||
EVP_DigestUpdate(*ctx, indata, insize);
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
__archive_openssl_ripemd160final(archive_rmd160_ctx *ctx, void *md)
|
||||
{
|
||||
EVP_DigestFinal(ctx, md, NULL);
|
||||
if (*ctx) {
|
||||
EVP_DigestFinal(*ctx, md, NULL);
|
||||
EVP_MD_CTX_free(*ctx);
|
||||
*ctx = NULL;
|
||||
}
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
@ -509,7 +520,9 @@ __archive_nettle_sha1final(archive_sha1_ctx *ctx, void *md)
|
||||
static int
|
||||
__archive_openssl_sha1init(archive_sha1_ctx *ctx)
|
||||
{
|
||||
EVP_DigestInit(ctx, EVP_sha1());
|
||||
if ((*ctx = EVP_MD_CTX_new()) == NULL)
|
||||
return (ARCHIVE_FAILED);
|
||||
EVP_DigestInit(*ctx, EVP_sha1());
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
@ -517,7 +530,7 @@ static int
|
||||
__archive_openssl_sha1update(archive_sha1_ctx *ctx, const void *indata,
|
||||
size_t insize)
|
||||
{
|
||||
EVP_DigestUpdate(ctx, indata, insize);
|
||||
EVP_DigestUpdate(*ctx, indata, insize);
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
@ -528,8 +541,11 @@ __archive_openssl_sha1final(archive_sha1_ctx *ctx, void *md)
|
||||
* this is meant to cope with that. Real fix is probably to fix
|
||||
* archive_write_set_format_xar.c
|
||||
*/
|
||||
if (ctx->digest)
|
||||
EVP_DigestFinal(ctx, md, NULL);
|
||||
if (*ctx) {
|
||||
EVP_DigestFinal(*ctx, md, NULL);
|
||||
EVP_MD_CTX_free(*ctx);
|
||||
*ctx = NULL;
|
||||
}
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
@ -733,7 +749,9 @@ __archive_nettle_sha256final(archive_sha256_ctx *ctx, void *md)
|
||||
static int
|
||||
__archive_openssl_sha256init(archive_sha256_ctx *ctx)
|
||||
{
|
||||
EVP_DigestInit(ctx, EVP_sha256());
|
||||
if ((*ctx = EVP_MD_CTX_new()) == NULL)
|
||||
return (ARCHIVE_FAILED);
|
||||
EVP_DigestInit(*ctx, EVP_sha256());
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
@ -741,14 +759,18 @@ static int
|
||||
__archive_openssl_sha256update(archive_sha256_ctx *ctx, const void *indata,
|
||||
size_t insize)
|
||||
{
|
||||
EVP_DigestUpdate(ctx, indata, insize);
|
||||
EVP_DigestUpdate(*ctx, indata, insize);
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
__archive_openssl_sha256final(archive_sha256_ctx *ctx, void *md)
|
||||
{
|
||||
EVP_DigestFinal(ctx, md, NULL);
|
||||
if (*ctx) {
|
||||
EVP_DigestFinal(*ctx, md, NULL);
|
||||
EVP_MD_CTX_free(*ctx);
|
||||
*ctx = NULL;
|
||||
}
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
@ -928,7 +950,9 @@ __archive_nettle_sha384final(archive_sha384_ctx *ctx, void *md)
|
||||
static int
|
||||
__archive_openssl_sha384init(archive_sha384_ctx *ctx)
|
||||
{
|
||||
EVP_DigestInit(ctx, EVP_sha384());
|
||||
if ((*ctx = EVP_MD_CTX_new()) == NULL)
|
||||
return (ARCHIVE_FAILED);
|
||||
EVP_DigestInit(*ctx, EVP_sha384());
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
@ -936,14 +960,18 @@ static int
|
||||
__archive_openssl_sha384update(archive_sha384_ctx *ctx, const void *indata,
|
||||
size_t insize)
|
||||
{
|
||||
EVP_DigestUpdate(ctx, indata, insize);
|
||||
EVP_DigestUpdate(*ctx, indata, insize);
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
__archive_openssl_sha384final(archive_sha384_ctx *ctx, void *md)
|
||||
{
|
||||
EVP_DigestFinal(ctx, md, NULL);
|
||||
if (*ctx) {
|
||||
EVP_DigestFinal(*ctx, md, NULL);
|
||||
EVP_MD_CTX_free(*ctx);
|
||||
*ctx = NULL;
|
||||
}
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
@ -1147,7 +1175,9 @@ __archive_nettle_sha512final(archive_sha512_ctx *ctx, void *md)
|
||||
static int
|
||||
__archive_openssl_sha512init(archive_sha512_ctx *ctx)
|
||||
{
|
||||
EVP_DigestInit(ctx, EVP_sha512());
|
||||
if ((*ctx = EVP_MD_CTX_new()) == NULL)
|
||||
return (ARCHIVE_FAILED);
|
||||
EVP_DigestInit(*ctx, EVP_sha512());
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
@ -1155,14 +1185,18 @@ static int
|
||||
__archive_openssl_sha512update(archive_sha512_ctx *ctx, const void *indata,
|
||||
size_t insize)
|
||||
{
|
||||
EVP_DigestUpdate(ctx, indata, insize);
|
||||
EVP_DigestUpdate(*ctx, indata, insize);
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
__archive_openssl_sha512final(archive_sha512_ctx *ctx, void *md)
|
||||
{
|
||||
EVP_DigestFinal(ctx, md, NULL);
|
||||
if (*ctx) {
|
||||
EVP_DigestFinal(*ctx, md, NULL);
|
||||
EVP_MD_CTX_free(*ctx);
|
||||
*ctx = NULL;
|
||||
}
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@
|
||||
defined(ARCHIVE_CRYPTO_SHA384_OPENSSL) ||\
|
||||
defined(ARCHIVE_CRYPTO_SHA512_OPENSSL)
|
||||
#define ARCHIVE_CRYPTO_OPENSSL 1
|
||||
#include <openssl/evp.h>
|
||||
#include "archive_openssl_evp_private.h"
|
||||
#endif
|
||||
|
||||
/* Windows crypto headers */
|
||||
@ -161,7 +161,7 @@ typedef CC_MD5_CTX archive_md5_ctx;
|
||||
#elif defined(ARCHIVE_CRYPTO_MD5_NETTLE)
|
||||
typedef struct md5_ctx archive_md5_ctx;
|
||||
#elif defined(ARCHIVE_CRYPTO_MD5_OPENSSL)
|
||||
typedef EVP_MD_CTX archive_md5_ctx;
|
||||
typedef EVP_MD_CTX *archive_md5_ctx;
|
||||
#elif defined(ARCHIVE_CRYPTO_MD5_WIN)
|
||||
typedef Digest_CTX archive_md5_ctx;
|
||||
#else
|
||||
@ -175,7 +175,7 @@ typedef RIPEMD160_CTX archive_rmd160_ctx;
|
||||
#elif defined(ARCHIVE_CRYPTO_RMD160_NETTLE)
|
||||
typedef struct ripemd160_ctx archive_rmd160_ctx;
|
||||
#elif defined(ARCHIVE_CRYPTO_RMD160_OPENSSL)
|
||||
typedef EVP_MD_CTX archive_rmd160_ctx;
|
||||
typedef EVP_MD_CTX *archive_rmd160_ctx;
|
||||
#else
|
||||
typedef unsigned char archive_rmd160_ctx;
|
||||
#endif
|
||||
@ -189,7 +189,7 @@ typedef CC_SHA1_CTX archive_sha1_ctx;
|
||||
#elif defined(ARCHIVE_CRYPTO_SHA1_NETTLE)
|
||||
typedef struct sha1_ctx archive_sha1_ctx;
|
||||
#elif defined(ARCHIVE_CRYPTO_SHA1_OPENSSL)
|
||||
typedef EVP_MD_CTX archive_sha1_ctx;
|
||||
typedef EVP_MD_CTX *archive_sha1_ctx;
|
||||
#elif defined(ARCHIVE_CRYPTO_SHA1_WIN)
|
||||
typedef Digest_CTX archive_sha1_ctx;
|
||||
#else
|
||||
@ -209,7 +209,7 @@ typedef CC_SHA256_CTX archive_sha256_ctx;
|
||||
#elif defined(ARCHIVE_CRYPTO_SHA256_NETTLE)
|
||||
typedef struct sha256_ctx archive_sha256_ctx;
|
||||
#elif defined(ARCHIVE_CRYPTO_SHA256_OPENSSL)
|
||||
typedef EVP_MD_CTX archive_sha256_ctx;
|
||||
typedef EVP_MD_CTX *archive_sha256_ctx;
|
||||
#elif defined(ARCHIVE_CRYPTO_SHA256_WIN)
|
||||
typedef Digest_CTX archive_sha256_ctx;
|
||||
#else
|
||||
@ -227,7 +227,7 @@ typedef CC_SHA512_CTX archive_sha384_ctx;
|
||||
#elif defined(ARCHIVE_CRYPTO_SHA384_NETTLE)
|
||||
typedef struct sha384_ctx archive_sha384_ctx;
|
||||
#elif defined(ARCHIVE_CRYPTO_SHA384_OPENSSL)
|
||||
typedef EVP_MD_CTX archive_sha384_ctx;
|
||||
typedef EVP_MD_CTX *archive_sha384_ctx;
|
||||
#elif defined(ARCHIVE_CRYPTO_SHA384_WIN)
|
||||
typedef Digest_CTX archive_sha384_ctx;
|
||||
#else
|
||||
@ -247,7 +247,7 @@ typedef CC_SHA512_CTX archive_sha512_ctx;
|
||||
#elif defined(ARCHIVE_CRYPTO_SHA512_NETTLE)
|
||||
typedef struct sha512_ctx archive_sha512_ctx;
|
||||
#elif defined(ARCHIVE_CRYPTO_SHA512_OPENSSL)
|
||||
typedef EVP_MD_CTX archive_sha512_ctx;
|
||||
typedef EVP_MD_CTX *archive_sha512_ctx;
|
||||
#elif defined(ARCHIVE_CRYPTO_SHA512_WIN)
|
||||
typedef Digest_CTX archive_sha512_ctx;
|
||||
#else
|
||||
|
@ -248,10 +248,9 @@ archive_entry_new2(struct archive *a)
|
||||
{
|
||||
struct archive_entry *entry;
|
||||
|
||||
entry = (struct archive_entry *)malloc(sizeof(*entry));
|
||||
entry = (struct archive_entry *)calloc(1, sizeof(*entry));
|
||||
if (entry == NULL)
|
||||
return (NULL);
|
||||
memset(entry, 0, sizeof(*entry));
|
||||
entry->archive = a;
|
||||
return (entry);
|
||||
}
|
||||
|
@ -176,8 +176,10 @@ __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
|
||||
static int
|
||||
__hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len)
|
||||
{
|
||||
HMAC_CTX_init(ctx);
|
||||
HMAC_Init(ctx, key, key_len, EVP_sha1());
|
||||
*ctx = HMAC_CTX_new();
|
||||
if (*ctx == NULL)
|
||||
return -1;
|
||||
HMAC_Init_ex(*ctx, key, key_len, EVP_sha1(), NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -185,22 +187,22 @@ static void
|
||||
__hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data,
|
||||
size_t data_len)
|
||||
{
|
||||
HMAC_Update(ctx, data, data_len);
|
||||
HMAC_Update(*ctx, data, data_len);
|
||||
}
|
||||
|
||||
static void
|
||||
__hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len)
|
||||
{
|
||||
unsigned int len = (unsigned int)*out_len;
|
||||
HMAC_Final(ctx, out, &len);
|
||||
HMAC_Final(*ctx, out, &len);
|
||||
*out_len = len;
|
||||
}
|
||||
|
||||
static void
|
||||
__hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
|
||||
{
|
||||
HMAC_CTX_cleanup(ctx);
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
HMAC_CTX_free(*ctx);
|
||||
*ctx = NULL;
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -70,9 +70,9 @@ typedef struct {
|
||||
typedef struct hmac_sha1_ctx archive_hmac_sha1_ctx;
|
||||
|
||||
#elif defined(HAVE_LIBCRYPTO)
|
||||
#include <openssl/hmac.h>
|
||||
#include "archive_openssl_hmac_private.h"
|
||||
|
||||
typedef HMAC_CTX archive_hmac_sha1_ctx;
|
||||
typedef HMAC_CTX* archive_hmac_sha1_ctx;
|
||||
|
||||
#else
|
||||
|
||||
|
48
contrib/libarchive/libarchive/archive_openssl_evp_private.h
Normal file
48
contrib/libarchive/libarchive/archive_openssl_evp_private.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*-
|
||||
* Copyright (c) 2003-2007 Tim Kientzle
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef ARCHIVE_OPENSSL_EVP_PRIVATE_H_INCLUDED
|
||||
#define ARCHIVE_OPENSSL_EVP_PRIVATE_H_INCLUDED
|
||||
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/opensslv.h>
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
#include <stdlib.h> /* malloc, free */
|
||||
#include <string.h> /* memset */
|
||||
static inline EVP_MD_CTX *EVP_MD_CTX_new(void)
|
||||
{
|
||||
EVP_MD_CTX *ctx = (EVP_MD_CTX *)calloc(1, sizeof(EVP_MD_CTX));
|
||||
return ctx;
|
||||
}
|
||||
|
||||
static inline void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
|
||||
{
|
||||
EVP_MD_CTX_cleanup(ctx);
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
free(ctx);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
48
contrib/libarchive/libarchive/archive_openssl_hmac_private.h
Normal file
48
contrib/libarchive/libarchive/archive_openssl_hmac_private.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*-
|
||||
* Copyright (c) 2003-2007 Tim Kientzle
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef ARCHIVE_OPENSSL_HMAC_PRIVATE_H_INCLUDED
|
||||
#define ARCHIVE_OPENSSL_HMAC_PRIVATE_H_INCLUDED
|
||||
|
||||
#include <openssl/hmac.h>
|
||||
#include <openssl/opensslv.h>
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
#include <stdlib.h> /* malloc, free */
|
||||
#include <string.h> /* memset */
|
||||
static inline HMAC_CTX *HMAC_CTX_new(void)
|
||||
{
|
||||
HMAC_CTX *ctx = (HMAC_CTX *)calloc(1, sizeof(HMAC_CTX));
|
||||
return ctx;
|
||||
}
|
||||
|
||||
static inline void HMAC_CTX_free(HMAC_CTX *ctx)
|
||||
{
|
||||
HMAC_CTX_cleanup(ctx);
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
free(ctx);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -26,6 +26,10 @@
|
||||
#include "archive_platform.h"
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#ifdef HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#include "archive_options_private.h"
|
||||
|
||||
static const char *
|
||||
@ -105,8 +109,11 @@ _archive_set_options(struct archive *a, const char *options,
|
||||
if (options == NULL || options[0] == '\0')
|
||||
return ARCHIVE_OK;
|
||||
|
||||
data = (char *)malloc(strlen(options) + 1);
|
||||
strcpy(data, options);
|
||||
if ((data = strdup(options)) == NULL) {
|
||||
archive_set_error(a,
|
||||
ENOMEM, "Out of memory adding file to list");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
s = (const char *)data;
|
||||
|
||||
do {
|
||||
|
@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
static int choose_filters(struct archive_read *);
|
||||
static int choose_format(struct archive_read *);
|
||||
static int close_filters(struct archive_read *);
|
||||
static struct archive_vtable *archive_read_vtable(void);
|
||||
static int64_t _archive_filter_bytes(struct archive *, int);
|
||||
static int _archive_filter_code(struct archive *, int);
|
||||
@ -528,7 +529,7 @@ archive_read_open1(struct archive *_a)
|
||||
{
|
||||
slot = choose_format(a);
|
||||
if (slot < 0) {
|
||||
__archive_read_close_filters(a);
|
||||
close_filters(a);
|
||||
a->archive.state = ARCHIVE_STATE_FATAL;
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
@ -582,7 +583,6 @@ choose_filters(struct archive_read *a)
|
||||
/* Verify the filter by asking it for some data. */
|
||||
__archive_read_filter_ahead(a->filter, 1, &avail);
|
||||
if (avail < 0) {
|
||||
__archive_read_close_filters(a);
|
||||
__archive_read_free_filters(a);
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
@ -601,7 +601,6 @@ choose_filters(struct archive_read *a)
|
||||
a->filter = filter;
|
||||
r = (best_bidder->init)(a->filter);
|
||||
if (r != ARCHIVE_OK) {
|
||||
__archive_read_close_filters(a);
|
||||
__archive_read_free_filters(a);
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
@ -986,8 +985,8 @@ _archive_read_data_block(struct archive *_a,
|
||||
return (a->format->read_data)(a, buff, size, offset);
|
||||
}
|
||||
|
||||
int
|
||||
__archive_read_close_filters(struct archive_read *a)
|
||||
static int
|
||||
close_filters(struct archive_read *a)
|
||||
{
|
||||
struct archive_read_filter *f = a->filter;
|
||||
int r = ARCHIVE_OK;
|
||||
@ -1010,6 +1009,9 @@ __archive_read_close_filters(struct archive_read *a)
|
||||
void
|
||||
__archive_read_free_filters(struct archive_read *a)
|
||||
{
|
||||
/* Make sure filters are closed and their buffers are freed */
|
||||
close_filters(a);
|
||||
|
||||
while (a->filter != NULL) {
|
||||
struct archive_read_filter *t = a->filter->upstream;
|
||||
free(a->filter);
|
||||
@ -1052,7 +1054,7 @@ _archive_read_close(struct archive *_a)
|
||||
/* TODO: Clean up the formatters. */
|
||||
|
||||
/* Release the filter objects. */
|
||||
r1 = __archive_read_close_filters(a);
|
||||
r1 = close_filters(a);
|
||||
if (r1 < r)
|
||||
r = r1;
|
||||
|
||||
|
@ -133,7 +133,6 @@ archive_read_append_filter(struct archive *_a, int code)
|
||||
a->filter = filter;
|
||||
r2 = (bidder->init)(a->filter);
|
||||
if (r2 != ARCHIVE_OK) {
|
||||
__archive_read_close_filters(a);
|
||||
__archive_read_free_filters(a);
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
@ -191,7 +190,6 @@ archive_read_append_filter_program_signature(struct archive *_a,
|
||||
a->filter = filter;
|
||||
r = (bidder->init)(a->filter);
|
||||
if (r != ARCHIVE_OK) {
|
||||
__archive_read_close_filters(a);
|
||||
__archive_read_free_filters(a);
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ struct tree {
|
||||
int initial_filesystem_id;
|
||||
int current_filesystem_id;
|
||||
int max_filesystem_id;
|
||||
int allocated_filesytem;
|
||||
int allocated_filesystem;
|
||||
|
||||
int entry_fd;
|
||||
int entry_eof;
|
||||
@ -1382,7 +1382,7 @@ update_current_filesystem(struct archive_read_disk *a, int64_t dev)
|
||||
|
||||
for (i = 0; i < t->max_filesystem_id; i++) {
|
||||
if (t->filesystem_table[i].dev == dev) {
|
||||
/* There is the filesytem ID we've already generated. */
|
||||
/* There is the filesystem ID we've already generated. */
|
||||
t->current_filesystem_id = i;
|
||||
t->current_filesystem = &(t->filesystem_table[i]);
|
||||
return (ARCHIVE_OK);
|
||||
@ -1390,10 +1390,10 @@ update_current_filesystem(struct archive_read_disk *a, int64_t dev)
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the new filesytem which we have to generate a new ID for.
|
||||
* This is the new filesystem which we have to generate a new ID for.
|
||||
*/
|
||||
fid = t->max_filesystem_id++;
|
||||
if (t->max_filesystem_id > t->allocated_filesytem) {
|
||||
if (t->max_filesystem_id > t->allocated_filesystem) {
|
||||
size_t s;
|
||||
void *p;
|
||||
|
||||
@ -1406,7 +1406,7 @@ update_current_filesystem(struct archive_read_disk *a, int64_t dev)
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
t->filesystem_table = (struct filesystem *)p;
|
||||
t->allocated_filesytem = s;
|
||||
t->allocated_filesystem = s;
|
||||
}
|
||||
t->current_filesystem_id = fid;
|
||||
t->current_filesystem = &(t->filesystem_table[fid]);
|
||||
@ -2063,8 +2063,7 @@ tree_push(struct tree *t, const char *path, int filesystem_id,
|
||||
{
|
||||
struct tree_entry *te;
|
||||
|
||||
te = malloc(sizeof(*te));
|
||||
memset(te, 0, sizeof(*te));
|
||||
te = calloc(1, sizeof(*te));
|
||||
te->next = t->stack;
|
||||
te->parent = t->current;
|
||||
if (te->parent)
|
||||
@ -2122,9 +2121,8 @@ tree_open(const char *path, int symlink_mode, int restore_time)
|
||||
{
|
||||
struct tree *t;
|
||||
|
||||
if ((t = malloc(sizeof(*t))) == NULL)
|
||||
if ((t = calloc(1, sizeof(*t))) == NULL)
|
||||
return (NULL);
|
||||
memset(t, 0, sizeof(*t));
|
||||
archive_string_init(&t->path);
|
||||
archive_string_ensure(&t->path, 31);
|
||||
t->initial_symlink_mode = symlink_mode;
|
||||
|
@ -52,12 +52,11 @@ struct archive_read_extract *
|
||||
__archive_read_get_extract(struct archive_read *a)
|
||||
{
|
||||
if (a->extract == NULL) {
|
||||
a->extract = (struct archive_read_extract *)malloc(sizeof(*a->extract));
|
||||
a->extract = (struct archive_read_extract *)calloc(1, sizeof(*a->extract));
|
||||
if (a->extract == NULL) {
|
||||
archive_set_error(&a->archive, ENOMEM, "Can't extract");
|
||||
return (NULL);
|
||||
}
|
||||
memset(a->extract, 0, sizeof(*a->extract));
|
||||
a->cleanup_archive_extract = archive_read_extract_cleanup;
|
||||
}
|
||||
return (a->extract);
|
||||
|
@ -70,12 +70,11 @@ archive_read_open_memory2(struct archive *a, const void *buff,
|
||||
{
|
||||
struct read_memory_data *mine;
|
||||
|
||||
mine = (struct read_memory_data *)malloc(sizeof(*mine));
|
||||
mine = (struct read_memory_data *)calloc(1, sizeof(*mine));
|
||||
if (mine == NULL) {
|
||||
archive_set_error(a, ENOMEM, "No memory");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
memset(mine, 0, sizeof(*mine));
|
||||
mine->start = mine->p = (const unsigned char *)buff;
|
||||
mine->end = mine->start + size;
|
||||
mine->read_size = read_size;
|
||||
|
@ -252,7 +252,6 @@ int64_t __archive_read_consume(struct archive_read *, int64_t);
|
||||
int64_t __archive_read_filter_consume(struct archive_read_filter *, int64_t);
|
||||
int __archive_read_program(struct archive_read_filter *, const char *);
|
||||
void __archive_read_free_filters(struct archive_read *);
|
||||
int __archive_read_close_filters(struct archive_read *);
|
||||
struct archive_read_extract *__archive_read_get_extract(struct archive_read *);
|
||||
|
||||
|
||||
|
@ -320,30 +320,14 @@ uudecode_bidder_bid(struct archive_read_filter_bidder *self,
|
||||
if (l > 45)
|
||||
/* Normally, maximum length is 45(character 'M'). */
|
||||
return (0);
|
||||
while (l && len-nl > 0) {
|
||||
if (l > 0) {
|
||||
if (!uuchar[*b++])
|
||||
return (0);
|
||||
if (!uuchar[*b++])
|
||||
return (0);
|
||||
len -= 2;
|
||||
--l;
|
||||
}
|
||||
if (l > 0) {
|
||||
if (!uuchar[*b++])
|
||||
return (0);
|
||||
--len;
|
||||
--l;
|
||||
}
|
||||
if (l > 0) {
|
||||
if (!uuchar[*b++])
|
||||
return (0);
|
||||
--len;
|
||||
--l;
|
||||
}
|
||||
if (l > len - nl)
|
||||
return (0); /* Line too short. */
|
||||
while (l) {
|
||||
if (!uuchar[*b++])
|
||||
return (0);
|
||||
--len;
|
||||
--l;
|
||||
}
|
||||
if (len-nl < 0)
|
||||
return (0);
|
||||
if (len-nl == 1 &&
|
||||
(uuchar[*b] || /* Check sum. */
|
||||
(*b >= 'a' && *b <= 'z'))) {/* Padding data(MINIX). */
|
||||
|
@ -213,7 +213,7 @@ struct _7zip {
|
||||
int header_is_encoded;
|
||||
uint64_t header_bytes_remaining;
|
||||
unsigned long header_crc32;
|
||||
/* Header offset to check that reading pointes of the file contens
|
||||
/* Header offset to check that reading points of the file contents
|
||||
* will not exceed the header. */
|
||||
uint64_t header_offset;
|
||||
/* Base offset of the archive file for a seek in case reading SFX. */
|
||||
|
@ -104,13 +104,12 @@ archive_read_support_format_ar(struct archive *_a)
|
||||
archive_check_magic(_a, ARCHIVE_READ_MAGIC,
|
||||
ARCHIVE_STATE_NEW, "archive_read_support_format_ar");
|
||||
|
||||
ar = (struct ar *)malloc(sizeof(*ar));
|
||||
ar = (struct ar *)calloc(1, sizeof(*ar));
|
||||
if (ar == NULL) {
|
||||
archive_set_error(&a->archive, ENOMEM,
|
||||
"Can't allocate ar data");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
memset(ar, 0, sizeof(*ar));
|
||||
ar->strtab = NULL;
|
||||
|
||||
r = __archive_read_register_format(a,
|
||||
@ -316,7 +315,7 @@ _ar_read_header(struct archive_read *a, struct archive_entry *entry,
|
||||
* If we can't look up the real name, warn and return
|
||||
* the entry with the wrong name.
|
||||
*/
|
||||
if (ar->strtab == NULL || number > ar->strtab_size) {
|
||||
if (ar->strtab == NULL || number >= ar->strtab_size) {
|
||||
archive_set_error(&a->archive, EINVAL,
|
||||
"Can't find long filename for GNU/SVR4 archive entry");
|
||||
archive_entry_copy_pathname(entry, filename);
|
||||
|
@ -814,8 +814,8 @@ header_odc(struct archive_read *a, struct cpio *cpio,
|
||||
* NOTE: if a filename suffix is ".z", it is the file gziped by afio.
|
||||
* it would be nice that we can show uncompressed file size and we can
|
||||
* uncompressed file contents automatically, unfortunately we have nothing
|
||||
* to get a uncompressed file size while reading each header. it means
|
||||
* we also cannot uncompressed file contens under the our framework.
|
||||
* to get a uncompressed file size while reading each header. It means
|
||||
* we also cannot uncompress file contents under our framework.
|
||||
*/
|
||||
static int
|
||||
header_afiol(struct archive_read *a, struct cpio *cpio,
|
||||
|
@ -229,13 +229,12 @@ archive_read_support_format_mtree(struct archive *_a)
|
||||
archive_check_magic(_a, ARCHIVE_READ_MAGIC,
|
||||
ARCHIVE_STATE_NEW, "archive_read_support_format_mtree");
|
||||
|
||||
mtree = (struct mtree *)malloc(sizeof(*mtree));
|
||||
mtree = (struct mtree *)calloc(1, sizeof(*mtree));
|
||||
if (mtree == NULL) {
|
||||
archive_set_error(&a->archive, ENOMEM,
|
||||
"Can't allocate mtree data");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
memset(mtree, 0, sizeof(*mtree));
|
||||
mtree->fd = -1;
|
||||
|
||||
r = __archive_read_register_format(a, mtree, "mtree",
|
||||
|
@ -647,13 +647,12 @@ archive_read_support_format_rar(struct archive *_a)
|
||||
archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW,
|
||||
"archive_read_support_format_rar");
|
||||
|
||||
rar = (struct rar *)malloc(sizeof(*rar));
|
||||
rar = (struct rar *)calloc(sizeof(*rar), 1);
|
||||
if (rar == NULL)
|
||||
{
|
||||
archive_set_error(&a->archive, ENOMEM, "Can't allocate rar data");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
memset(rar, 0, sizeof(*rar));
|
||||
|
||||
/*
|
||||
* Until enough data has been read, we cannot tell about
|
||||
|
@ -297,7 +297,7 @@ archive_read_format_tar_cleanup(struct archive_read *a)
|
||||
/*
|
||||
* Validate number field
|
||||
*
|
||||
* This has to be pretty lenient in order to accomodate the enormous
|
||||
* This has to be pretty lenient in order to accommodate the enormous
|
||||
* variety of tar writers in the world:
|
||||
* = POSIX (IEEE Std 1003.1-1988) ustar requires octal values with leading
|
||||
* zeros and allows fields to be terminated with space or null characters
|
||||
@ -423,7 +423,7 @@ archive_read_format_tar_options(struct archive_read *a,
|
||||
|
||||
tar = (struct tar *)(a->format->data);
|
||||
if (strcmp(key, "compat-2x") == 0) {
|
||||
/* Handle UTF-8 filnames as libarchive 2.x */
|
||||
/* Handle UTF-8 filenames as libarchive 2.x */
|
||||
tar->compat_2x = (val != NULL && val[0] != 0);
|
||||
tar->init_default_conversion = tar->compat_2x;
|
||||
return (ARCHIVE_OK);
|
||||
@ -2189,12 +2189,11 @@ gnu_add_sparse_entry(struct archive_read *a, struct tar *tar,
|
||||
{
|
||||
struct sparse_block *p;
|
||||
|
||||
p = (struct sparse_block *)malloc(sizeof(*p));
|
||||
p = (struct sparse_block *)calloc(1, sizeof(*p));
|
||||
if (p == NULL) {
|
||||
archive_set_error(&a->archive, ENOMEM, "Out of memory");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
memset(p, 0, sizeof(*p));
|
||||
if (tar->sparse_last != NULL)
|
||||
tar->sparse_last->next = p;
|
||||
else
|
||||
@ -2545,7 +2544,7 @@ tar_atol_base_n(const char *p, size_t char_cnt, int base)
|
||||
last_digit_limit = INT64_MAX % base;
|
||||
|
||||
/* the pointer will not be dereferenced if char_cnt is zero
|
||||
* due to the way the && operator is evaulated.
|
||||
* due to the way the && operator is evaluated.
|
||||
*/
|
||||
while (char_cnt != 0 && (*p == ' ' || *p == '\t')) {
|
||||
p++;
|
||||
|
@ -146,12 +146,11 @@ archive_read_support_format_warc(struct archive *_a)
|
||||
archive_check_magic(_a, ARCHIVE_READ_MAGIC,
|
||||
ARCHIVE_STATE_NEW, "archive_read_support_format_warc");
|
||||
|
||||
if ((w = malloc(sizeof(*w))) == NULL) {
|
||||
if ((w = calloc(1, sizeof(*w))) == NULL) {
|
||||
archive_set_error(&a->archive, ENOMEM,
|
||||
"Can't allocate warc data");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
memset(w, 0, sizeof(*w));
|
||||
|
||||
r = __archive_read_register_format(
|
||||
a, w, "warc",
|
||||
|
@ -1992,7 +1992,7 @@ archive_strncat_l(struct archive_string *as, const void *_p, size_t n,
|
||||
#if HAVE_ICONV
|
||||
|
||||
/*
|
||||
* Return -1 if conversion failes.
|
||||
* Return -1 if conversion fails.
|
||||
*/
|
||||
static int
|
||||
iconv_strncat_in_locale(struct archive_string *as, const void *_p,
|
||||
@ -2094,7 +2094,7 @@ iconv_strncat_in_locale(struct archive_string *as, const void *_p,
|
||||
|
||||
/*
|
||||
* Translate a string from a some CodePage to an another CodePage by
|
||||
* Windows APIs, and copy the result. Return -1 if conversion failes.
|
||||
* Windows APIs, and copy the result. Return -1 if conversion fails.
|
||||
*/
|
||||
static int
|
||||
strncat_in_codepage(struct archive_string *as,
|
||||
@ -3474,7 +3474,7 @@ strncat_from_utf8_libarchive2(struct archive_string *as,
|
||||
|
||||
/*
|
||||
* Convert a UTF-16BE/LE string to current locale and copy the result.
|
||||
* Return -1 if conversion failes.
|
||||
* Return -1 if conversion fails.
|
||||
*/
|
||||
static int
|
||||
win_strncat_from_utf16(struct archive_string *as, const void *_p, size_t bytes,
|
||||
@ -3598,7 +3598,7 @@ is_big_endian(void)
|
||||
|
||||
/*
|
||||
* Convert a current locale string to UTF-16BE/LE and copy the result.
|
||||
* Return -1 if conversion failes.
|
||||
* Return -1 if conversion fails.
|
||||
*/
|
||||
static int
|
||||
win_strncat_to_utf16(struct archive_string *as16, const void *_p,
|
||||
@ -3703,7 +3703,7 @@ win_strncat_to_utf16le(struct archive_string *as16, const void *_p,
|
||||
|
||||
/*
|
||||
* Convert a UTF-16BE string to current locale and copy the result.
|
||||
* Return -1 if conversion failes.
|
||||
* Return -1 if conversion fails.
|
||||
*/
|
||||
static int
|
||||
best_effort_strncat_from_utf16(struct archive_string *as, const void *_p,
|
||||
@ -3761,7 +3761,7 @@ best_effort_strncat_from_utf16le(struct archive_string *as, const void *_p,
|
||||
|
||||
/*
|
||||
* Convert a current locale string to UTF-16BE/LE and copy the result.
|
||||
* Return -1 if conversion failes.
|
||||
* Return -1 if conversion fails.
|
||||
*/
|
||||
static int
|
||||
best_effort_strncat_to_utf16(struct archive_string *as16, const void *_p,
|
||||
|
@ -109,10 +109,9 @@ archive_write_new(void)
|
||||
struct archive_write *a;
|
||||
unsigned char *nulls;
|
||||
|
||||
a = (struct archive_write *)malloc(sizeof(*a));
|
||||
a = (struct archive_write *)calloc(1, sizeof(*a));
|
||||
if (a == NULL)
|
||||
return (NULL);
|
||||
memset(a, 0, sizeof(*a));
|
||||
a->archive.magic = ARCHIVE_WRITE_MAGIC;
|
||||
a->archive.state = ARCHIVE_STATE_NEW;
|
||||
a->archive.vtable = archive_write_vtable();
|
||||
@ -126,12 +125,11 @@ archive_write_new(void)
|
||||
|
||||
/* Initialize a block of nulls for padding purposes. */
|
||||
a->null_length = 1024;
|
||||
nulls = (unsigned char *)malloc(a->null_length);
|
||||
nulls = (unsigned char *)calloc(1, a->null_length);
|
||||
if (nulls == NULL) {
|
||||
free(a);
|
||||
return (NULL);
|
||||
}
|
||||
memset(nulls, 0, a->null_length);
|
||||
a->nulls = nulls;
|
||||
return (&a->archive);
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ drive_compressor_independence(struct archive_write_filter *f, const char *p,
|
||||
archive_le32enc(data->out, outsize);
|
||||
data->out += 4;
|
||||
} else {
|
||||
/* The buffer is not compressed. The commpressed size was
|
||||
/* The buffer is not compressed. The compressed size was
|
||||
* bigger than its uncompressed size. */
|
||||
archive_le32enc(data->out, length | 0x80000000);
|
||||
data->out += 4;
|
||||
@ -608,7 +608,7 @@ drive_compressor_dependence(struct archive_write_filter *f, const char *p,
|
||||
archive_le32enc(data->out, outsize);
|
||||
data->out += 4;
|
||||
} else {
|
||||
/* The buffer is not compressed. The commpressed size was
|
||||
/* The buffer is not compressed. The compressed size was
|
||||
* bigger than its uncompressed size. */
|
||||
archive_le32enc(data->out, length | 0x80000000);
|
||||
data->out += 4;
|
||||
|
@ -1779,10 +1779,9 @@ archive_write_disk_new(void)
|
||||
{
|
||||
struct archive_write_disk *a;
|
||||
|
||||
a = (struct archive_write_disk *)malloc(sizeof(*a));
|
||||
a = (struct archive_write_disk *)calloc(1, sizeof(*a));
|
||||
if (a == NULL)
|
||||
return (NULL);
|
||||
memset(a, 0, sizeof(*a));
|
||||
a->archive.magic = ARCHIVE_WRITE_DISK_MAGIC;
|
||||
/* We're ready to write a header immediately. */
|
||||
a->archive.state = ARCHIVE_STATE_HEADER;
|
||||
@ -2701,7 +2700,7 @@ check_symlinks(struct archive_write_disk *a)
|
||||
* See also : http://msdn.microsoft.com/en-us/library/aa365247.aspx
|
||||
*/
|
||||
static void
|
||||
cleanup_pathname_win(struct archive_write_disk *a)
|
||||
cleanup_pathname_win(char *path)
|
||||
{
|
||||
wchar_t wc;
|
||||
char *p;
|
||||
@ -2712,7 +2711,7 @@ cleanup_pathname_win(struct archive_write_disk *a)
|
||||
mb = 0;
|
||||
complete = 1;
|
||||
utf8 = (strcmp(nl_langinfo(CODESET), "UTF-8") == 0)? 1: 0;
|
||||
for (p = a->name; *p != '\0'; p++) {
|
||||
for (p = path; *p != '\0'; p++) {
|
||||
++alen;
|
||||
if (*p == '\\') {
|
||||
/* If previous byte is smaller than 128,
|
||||
@ -2737,7 +2736,7 @@ cleanup_pathname_win(struct archive_write_disk *a)
|
||||
/*
|
||||
* Convert path separator in wide-character.
|
||||
*/
|
||||
p = a->name;
|
||||
p = path;
|
||||
while (*p != '\0' && alen) {
|
||||
l = mbtowc(&wc, p, alen);
|
||||
if (l == (size_t)-1) {
|
||||
@ -2778,7 +2777,7 @@ cleanup_pathname_fsobj(char *path, int *a_eno, struct archive_string *a_estr,
|
||||
}
|
||||
|
||||
#if defined(__CYGWIN__)
|
||||
cleanup_pathname_win(a);
|
||||
cleanup_pathname_win(path);
|
||||
#endif
|
||||
/* Skip leading '/'. */
|
||||
if (*src == '/') {
|
||||
|
@ -84,15 +84,13 @@ static void cleanup(void *);
|
||||
int
|
||||
archive_write_disk_set_standard_lookup(struct archive *a)
|
||||
{
|
||||
struct bucket *ucache = malloc(cache_size * sizeof(struct bucket));
|
||||
struct bucket *gcache = malloc(cache_size * sizeof(struct bucket));
|
||||
struct bucket *ucache = calloc(cache_size, sizeof(struct bucket));
|
||||
struct bucket *gcache = calloc(cache_size, sizeof(struct bucket));
|
||||
if (ucache == NULL || gcache == NULL) {
|
||||
free(ucache);
|
||||
free(gcache);
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
memset(ucache, 0, cache_size * sizeof(struct bucket));
|
||||
memset(gcache, 0, cache_size * sizeof(struct bucket));
|
||||
archive_write_disk_set_group_lookup(a, gcache, lookup_gid, cleanup);
|
||||
archive_write_disk_set_user_lookup(a, ucache, lookup_uid, cleanup);
|
||||
return (ARCHIVE_OK);
|
||||
|
@ -53,12 +53,11 @@ archive_write_open_memory(struct archive *a, void *buff, size_t buffSize, size_t
|
||||
{
|
||||
struct write_memory_data *mine;
|
||||
|
||||
mine = (struct write_memory_data *)malloc(sizeof(*mine));
|
||||
mine = (struct write_memory_data *)calloc(1, sizeof(*mine));
|
||||
if (mine == NULL) {
|
||||
archive_set_error(a, ENOMEM, "No memory");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
memset(mine, 0, sizeof(*mine));
|
||||
mine->buff = buff;
|
||||
mine->size = buffSize;
|
||||
mine->client_size = used;
|
||||
|
@ -126,12 +126,11 @@ archive_write_set_format_ar(struct archive_write *a)
|
||||
if (a->format_free != NULL)
|
||||
(a->format_free)(a);
|
||||
|
||||
ar = (struct ar_w *)malloc(sizeof(*ar));
|
||||
ar = (struct ar_w *)calloc(1, sizeof(*ar));
|
||||
if (ar == NULL) {
|
||||
archive_set_error(&a->archive, ENOMEM, "Can't allocate ar data");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
memset(ar, 0, sizeof(*ar));
|
||||
a->format_data = ar;
|
||||
|
||||
a->format_name = "ar";
|
||||
|
@ -116,12 +116,11 @@ archive_write_set_format_cpio_newc(struct archive *_a)
|
||||
if (a->format_free != NULL)
|
||||
(a->format_free)(a);
|
||||
|
||||
cpio = (struct cpio *)malloc(sizeof(*cpio));
|
||||
cpio = (struct cpio *)calloc(1, sizeof(*cpio));
|
||||
if (cpio == NULL) {
|
||||
archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
memset(cpio, 0, sizeof(*cpio));
|
||||
a->format_data = cpio;
|
||||
a->format_name = "cpio";
|
||||
a->format_options = archive_write_newc_options;
|
||||
|
@ -3024,8 +3024,8 @@ set_directory_record_rr(unsigned char *bp, int dr_len,
|
||||
* +----+----+----+----+----+
|
||||
* 10 11 12 13 14 15
|
||||
*
|
||||
* - cflg : flag of componet
|
||||
* - clen : length of componet
|
||||
* - cflg : flag of component
|
||||
* - clen : length of component
|
||||
*/
|
||||
const char *sl;
|
||||
char sl_last;
|
||||
|
@ -127,13 +127,12 @@ archive_write_set_format_pax(struct archive *_a)
|
||||
if (a->format_free != NULL)
|
||||
(a->format_free)(a);
|
||||
|
||||
pax = (struct pax *)malloc(sizeof(*pax));
|
||||
pax = (struct pax *)calloc(1, sizeof(*pax));
|
||||
if (pax == NULL) {
|
||||
archive_set_error(&a->archive, ENOMEM,
|
||||
"Can't allocate pax data");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
memset(pax, 0, sizeof(*pax));
|
||||
a->format_data = pax;
|
||||
a->format_name = "pax";
|
||||
a->format_options = archive_write_pax_options;
|
||||
|
@ -113,12 +113,11 @@ archive_write_set_format_shar(struct archive *_a)
|
||||
if (a->format_free != NULL)
|
||||
(a->format_free)(a);
|
||||
|
||||
shar = (struct shar *)malloc(sizeof(*shar));
|
||||
shar = (struct shar *)calloc(1, sizeof(*shar));
|
||||
if (shar == NULL) {
|
||||
archive_set_error(&a->archive, ENOMEM, "Can't allocate shar data");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
memset(shar, 0, sizeof(*shar));
|
||||
archive_string_init(&shar->work);
|
||||
archive_string_init(&shar->quoted_name);
|
||||
a->format_data = shar;
|
||||
|
@ -184,13 +184,12 @@ archive_write_set_format_ustar(struct archive *_a)
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
|
||||
ustar = (struct ustar *)malloc(sizeof(*ustar));
|
||||
ustar = (struct ustar *)calloc(1, sizeof(*ustar));
|
||||
if (ustar == NULL) {
|
||||
archive_set_error(&a->archive, ENOMEM,
|
||||
"Can't allocate ustar data");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
memset(ustar, 0, sizeof(*ustar));
|
||||
a->format_data = ustar;
|
||||
a->format_name = "ustar";
|
||||
a->format_options = archive_write_ustar_options;
|
||||
|
@ -161,13 +161,12 @@ archive_write_set_format_v7tar(struct archive *_a)
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
|
||||
v7tar = (struct v7tar *)malloc(sizeof(*v7tar));
|
||||
v7tar = (struct v7tar *)calloc(1, sizeof(*v7tar));
|
||||
if (v7tar == NULL) {
|
||||
archive_set_error(&a->archive, ENOMEM,
|
||||
"Can't allocate v7tar data");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
memset(v7tar, 0, sizeof(*v7tar));
|
||||
a->format_data = v7tar;
|
||||
a->format_name = "tar (non-POSIX)";
|
||||
a->format_options = archive_write_v7tar_options;
|
||||
|
@ -192,7 +192,7 @@ struct file {
|
||||
struct file *parent; /* parent directory entry */
|
||||
/*
|
||||
* To manage sub directory files.
|
||||
* We use 'chnext' a menber of struct file to chain.
|
||||
* We use 'chnext' (a member of struct file) to chain.
|
||||
*/
|
||||
struct {
|
||||
struct file *first;
|
||||
@ -258,7 +258,7 @@ struct xar {
|
||||
/*
|
||||
* The list of all file entries is used to manage struct file
|
||||
* objects.
|
||||
* We use 'next' a menber of struct file to chain.
|
||||
* We use 'next' (a member of struct file) to chain.
|
||||
*/
|
||||
struct {
|
||||
struct file *first;
|
||||
@ -266,7 +266,7 @@ struct xar {
|
||||
} file_list;
|
||||
/*
|
||||
* The list of hard-linked file entries.
|
||||
* We use 'hlnext' a menber of struct file to chain.
|
||||
* We use 'hlnext' (a member of struct file) to chain.
|
||||
*/
|
||||
struct archive_rb_tree hardlink_rbtree;
|
||||
};
|
||||
|
@ -80,7 +80,7 @@ DEFINE_TEST(test_archive_read_add_passphrase_single)
|
||||
__archive_read_reset_passphrase(ar);
|
||||
/* Fist call, we should get "pass1" as a passphrase. */
|
||||
assertEqualString("pass1", __archive_read_next_passphrase(ar));
|
||||
/* Second call, we should get NULL which means all the pssphrases
|
||||
/* Second call, we should get NULL which means all the passphrases
|
||||
* are passed already. */
|
||||
assertEqualString(NULL, __archive_read_next_passphrase(ar));
|
||||
|
||||
@ -100,7 +100,7 @@ DEFINE_TEST(test_archive_read_add_passphrase_multiple)
|
||||
assertEqualString("pass1", __archive_read_next_passphrase(ar));
|
||||
/* Second call, we should get "pass2" as a passphrase. */
|
||||
assertEqualString("pass2", __archive_read_next_passphrase(ar));
|
||||
/* Third call, we should get NULL which means all the pssphrases
|
||||
/* Third call, we should get NULL which means all the passphrases
|
||||
* are passed already. */
|
||||
assertEqualString(NULL, __archive_read_next_passphrase(ar));
|
||||
|
||||
@ -171,7 +171,7 @@ DEFINE_TEST(test_archive_read_add_passphrase_set_callback2)
|
||||
__archive_read_reset_passphrase(ar);
|
||||
/* Fist call, we should get "passCallBack" as a passphrase. */
|
||||
assertEqualString("passCallBack", __archive_read_next_passphrase(ar));
|
||||
/* Second call, we should get NULL which means all the pssphrases
|
||||
/* Second call, we should get NULL which means all the passphrases
|
||||
* are passed already. */
|
||||
assertEqualString(NULL, __archive_read_next_passphrase(ar));
|
||||
|
||||
@ -193,7 +193,7 @@ DEFINE_TEST(test_archive_read_add_passphrase_set_callback3)
|
||||
__archive_read_reset_passphrase(ar);
|
||||
/* After reset passphrase, we should get "passCallBack"passphrase. */
|
||||
assertEqualString("passCallBack", __archive_read_next_passphrase(ar));
|
||||
/* Second call, we should get NULL which means all the pssphrases
|
||||
/* Second call, we should get NULL which means all the passphrases
|
||||
* are passed already. */
|
||||
assertEqualString(NULL, __archive_read_next_passphrase(ar));
|
||||
|
||||
@ -218,7 +218,7 @@ DEFINE_TEST(test_archive_read_add_passphrase_multiple_with_callback)
|
||||
assertEqualString("pass2", __archive_read_next_passphrase(ar));
|
||||
/* Third call, we should get "passCallBack" as a passphrase. */
|
||||
assertEqualString("passCallBack", __archive_read_next_passphrase(ar));
|
||||
/* Fourth call, we should get NULL which means all the pssphrases
|
||||
/* Fourth call, we should get NULL which means all the passphrases
|
||||
* are passed already. */
|
||||
assertEqualString(NULL, __archive_read_next_passphrase(ar));
|
||||
|
||||
@ -251,7 +251,7 @@ DEFINE_TEST(test_archive_read_add_passphrase_multiple_with_callback2)
|
||||
assertEqualString("pass1", __archive_read_next_passphrase(ar));
|
||||
/* Third call, we should get "passCallBack" as a passphrase. */
|
||||
assertEqualString("pass2", __archive_read_next_passphrase(ar));
|
||||
/* Fourth call, we should get NULL which means all the pssphrases
|
||||
/* Fourth call, we should get NULL which means all the passphrases
|
||||
* are passed already. */
|
||||
assertEqualString(NULL, __archive_read_next_passphrase(ar));
|
||||
|
||||
|
@ -347,7 +347,7 @@ DEFINE_TEST(test_pax_filename_encoding_KOI8R)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check if the paltform completely supports the string conversion. */
|
||||
/* Check if the platform completely supports the string conversion. */
|
||||
a = archive_write_new();
|
||||
assertEqualInt(ARCHIVE_OK, archive_write_set_format_pax(a));
|
||||
if (archive_write_set_options(a, "hdrcharset=UTF-8") != ARCHIVE_OK) {
|
||||
@ -394,7 +394,7 @@ DEFINE_TEST(test_pax_filename_encoding_CP1251)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check if the paltform completely supports the string conversion. */
|
||||
/* Check if the platform completely supports the string conversion. */
|
||||
a = archive_write_new();
|
||||
assertEqualInt(ARCHIVE_OK, archive_write_set_format_pax(a));
|
||||
if (archive_write_set_options(a, "hdrcharset=UTF-8") != ARCHIVE_OK) {
|
||||
@ -440,7 +440,7 @@ DEFINE_TEST(test_pax_filename_encoding_EUCJP)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check if the paltform completely supports the string conversion. */
|
||||
/* Check if the platform completely supports the string conversion. */
|
||||
a = archive_write_new();
|
||||
assertEqualInt(ARCHIVE_OK, archive_write_set_format_pax(a));
|
||||
if (archive_write_set_options(a, "hdrcharset=UTF-8") != ARCHIVE_OK) {
|
||||
@ -488,7 +488,7 @@ DEFINE_TEST(test_pax_filename_encoding_CP932)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check if the paltform completely supports the string conversion. */
|
||||
/* Check if the platform completely supports the string conversion. */
|
||||
a = archive_write_new();
|
||||
assertEqualInt(ARCHIVE_OK, archive_write_set_format_pax(a));
|
||||
if (archive_write_set_options(a, "hdrcharset=UTF-8") != ARCHIVE_OK) {
|
||||
|
@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Test if the current filesytem is mounted with noatime option.
|
||||
* Test if the current filesystem is mounted with noatime option.
|
||||
*/
|
||||
static int
|
||||
atimeIsUpdated(void)
|
||||
|
@ -63,6 +63,13 @@ DEFINE_TEST(test_option_lz4)
|
||||
"but no such program is available on this system.");
|
||||
goto done;
|
||||
}
|
||||
/* On some systems the error won't be detected until closing
|
||||
time, by a 127 exit error returned by waitpid. */
|
||||
if (strstr(p, "Error closing") != NULL && !canLz4()) {
|
||||
skipping("This version of bsdcpio uses an external lz4 program "
|
||||
"but no such program is available on this system.");
|
||||
return;
|
||||
}
|
||||
failure("--lz4 option is broken: %s", p);
|
||||
assertEqualInt(r, 0);
|
||||
goto done;
|
||||
|
@ -28,7 +28,15 @@ SRCS= elftc_bfdtarget.c \
|
||||
INCS= libelftc.h
|
||||
CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common
|
||||
|
||||
MAN=
|
||||
MAN+= elftc.3 \
|
||||
elftc_bfd_find_target.3 \
|
||||
elftc_copyfile.3 \
|
||||
elftc_demangle.3 \
|
||||
elftc_reloc_type_str.3 \
|
||||
elftc_set_timestamps.3 \
|
||||
elftc_timestamp.3 \
|
||||
elftc_string_table_create.3 \
|
||||
elftc_version.3
|
||||
|
||||
# This same hack is in lib/libelf/Makefile and usr.bin/readelf/Makefile
|
||||
# We need to link against the correct version of these files. One
|
||||
|
@ -8,6 +8,7 @@ eval $(make -C ${SRCDIR} TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} buildenvvar
|
||||
export WRKDIRPREFIX=/tmp/ports.${TARGET}
|
||||
export WSTAGEDIR=${WSTAGEDIR}
|
||||
export REPODIR=${REPODIR}
|
||||
export PKG_CMD=${PKG_CMD}
|
||||
export PKG_VERSION=${PKG_VERSION}
|
||||
export WRKDIR=$(make -C ${PORTSDIR}/ports-mgmt/pkg -V WRKDIR)
|
||||
|
||||
@ -15,11 +16,11 @@ make -C ${PORTSDIR}/ports-mgmt/pkg TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
|
||||
CONFIGURE_ARGS="--host=$(uname -m)-portbld-freebsd${REVISION}" \
|
||||
stage create-manifest
|
||||
|
||||
pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh \
|
||||
${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh \
|
||||
create -v -m ${WRKDIR}/.metadir/ \
|
||||
-r ${WRKDIR}/stage \
|
||||
-p ${WRKDIR}/.PLIST.mktmp \
|
||||
-o ${REPODIR}/$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION}
|
||||
mkdir -p ${REPODIR}/$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION}/Latest/
|
||||
cd ${REPODIR}/$(pkg -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION}/Latest/ && \
|
||||
-o ${REPODIR}/$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION}
|
||||
mkdir -p ${REPODIR}/$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION}/Latest/
|
||||
cd ${REPODIR}/$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh config ABI)/${PKG_VERSION}/Latest/ && \
|
||||
ln -s ../pkg-*.txz
|
||||
|
@ -116,6 +116,9 @@
|
||||
# NLSMODE National Language Support files mode. [${NOBINMODE}]
|
||||
#
|
||||
# INCLUDEDIR Base path for standard C include files [/usr/include]
|
||||
#
|
||||
# PKG_CMD Program for creating and manipulating packages.
|
||||
# [pkg]
|
||||
|
||||
.if !target(__<bsd.own.mk>__)
|
||||
__<bsd.own.mk>__:
|
||||
@ -249,6 +252,8 @@ XZ_CMD?= xz -T ${XZ_THREADS}
|
||||
XZ_CMD?= xz
|
||||
.endif
|
||||
|
||||
PKG_CMD?= pkg
|
||||
|
||||
# Pointer to the top directory into which tests are installed. Should not be
|
||||
# overriden by Makefiles, but the user may choose to set this in src.conf(5).
|
||||
TESTSBASE?= /usr/tests
|
||||
|
@ -98,6 +98,7 @@ options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
|
||||
# Make an SMP-capable kernel by default
|
||||
options SMP # Symmetric MultiProcessor Kernel
|
||||
options DEVICE_NUMA # I/O Device Affinity
|
||||
options EARLY_AP_STARTUP
|
||||
|
||||
# CPU frequency control
|
||||
device cpufreq
|
||||
|
@ -94,6 +94,7 @@ options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
|
||||
# Make an SMP-capable kernel by default
|
||||
options SMP # Symmetric MultiProcessor Kernel
|
||||
options DEVICE_NUMA # I/O Device Affinity
|
||||
options EARLY_AP_STARTUP
|
||||
|
||||
# CPU frequency control
|
||||
device cpufreq
|
||||
|
@ -209,6 +209,12 @@ aw_debeclk_set_freq(struct clknode *clk, uint64_t fin, uint64_t *fout,
|
||||
|
||||
m = howmany(fin, *fout) - 1;
|
||||
|
||||
*fout = fin / (m + 1);
|
||||
*stop = 1;
|
||||
|
||||
if ((flags & CLK_SET_DRYRUN) != 0)
|
||||
return (0);
|
||||
|
||||
DEVICE_LOCK(sc);
|
||||
DEBECLK_READ(sc, &val);
|
||||
val &= ~CLK_RATIO_M;
|
||||
@ -216,9 +222,6 @@ aw_debeclk_set_freq(struct clknode *clk, uint64_t fin, uint64_t *fout,
|
||||
DEBECLK_WRITE(sc, val);
|
||||
DEVICE_UNLOCK(sc);
|
||||
|
||||
*fout = fin / (m + 1);
|
||||
*stop = 1;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -188,6 +188,12 @@ aw_hdmiclk_set_freq(struct clknode *clk, uint64_t fin, uint64_t *fout,
|
||||
if (best_diff == (int64_t)*fout)
|
||||
return (ERANGE);
|
||||
|
||||
*fout = fin / (1 << best_n) / (best_m + 1);
|
||||
*stop = 1;
|
||||
|
||||
if ((flags & CLK_SET_DRYRUN) != 0)
|
||||
return (0);
|
||||
|
||||
DEVICE_LOCK(sc);
|
||||
HDMICLK_READ(sc, &val);
|
||||
val &= ~(CLK_RATIO_N | CLK_RATIO_M);
|
||||
@ -196,9 +202,6 @@ aw_hdmiclk_set_freq(struct clknode *clk, uint64_t fin, uint64_t *fout,
|
||||
HDMICLK_WRITE(sc, val);
|
||||
DEVICE_UNLOCK(sc);
|
||||
|
||||
*fout = fin / (1 << best_n) / (best_m + 1);
|
||||
*stop = 1;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -389,57 +389,70 @@ aw_lcdclk_set_freq(struct clknode *clk, uint64_t fin, uint64_t *fout,
|
||||
int flags, int *stop)
|
||||
{
|
||||
struct aw_lcdclk_softc *sc;
|
||||
struct clknode *parent_clk;
|
||||
const char **parent_names;
|
||||
uint64_t pll_freq;
|
||||
uint32_t val, src_sel;
|
||||
int error, tcon_pll_div;
|
||||
|
||||
sc = clknode_get_softc(clk);
|
||||
|
||||
switch (sc->type) {
|
||||
case AW_LCD_CH0:
|
||||
if (sc->type == AW_LCD_CH0) {
|
||||
*stop = 0;
|
||||
break;
|
||||
case AW_LCD_CH1:
|
||||
if (sc->id != CLK_IDX_CH1_SCLK2)
|
||||
return (ENXIO);
|
||||
|
||||
src_sel = calc_tcon_pll(fin, *fout, &pll_freq, &tcon_pll_div);
|
||||
|
||||
/* Switch parent clock if necessary */
|
||||
if (src_sel != clknode_get_parent_idx(clk)) {
|
||||
error = clknode_set_parent_by_idx(clk, src_sel);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
}
|
||||
|
||||
error = clknode_set_freq(clknode_get_parent(clk), pll_freq,
|
||||
0, 0);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
error = clknode_enable(clknode_get_parent(clk));
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
/* Fetch new input frequency */
|
||||
error = clknode_get_freq(clknode_get_parent(clk), &pll_freq);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
/* Set LCD divisor */
|
||||
DEVICE_LOCK(sc);
|
||||
LCDCLK_READ(sc, &val);
|
||||
val &= ~CH1_CLK_DIV_RATIO_M;
|
||||
val |= ((tcon_pll_div - 1) << CH1_CLK_DIV_RATIO_M_SHIFT);
|
||||
LCDCLK_WRITE(sc, val);
|
||||
DEVICE_UNLOCK(sc);
|
||||
|
||||
*fout = pll_freq / tcon_pll_div;
|
||||
*stop = 1;
|
||||
|
||||
break;
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (sc->id != CLK_IDX_CH1_SCLK2)
|
||||
return (ENXIO);
|
||||
|
||||
src_sel = calc_tcon_pll(fin, *fout, &pll_freq, &tcon_pll_div);
|
||||
|
||||
parent_names = clknode_get_parent_names(clk);
|
||||
parent_clk = clknode_find_by_name(parent_names[src_sel]);
|
||||
|
||||
if (parent_clk == NULL)
|
||||
return (ERANGE);
|
||||
|
||||
/* Fetch input frequency */
|
||||
error = clknode_get_freq(parent_clk, &pll_freq);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
*fout = pll_freq / tcon_pll_div;
|
||||
*stop = 1;
|
||||
|
||||
if ((flags & CLK_SET_DRYRUN) != 0)
|
||||
return (0);
|
||||
|
||||
/* Switch parent clock if necessary */
|
||||
error = clknode_set_parent_by_idx(clk, src_sel);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
error = clknode_set_freq(parent_clk, pll_freq,
|
||||
0, 0);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
/* Fetch new input frequency */
|
||||
error = clknode_get_freq(parent_clk, &pll_freq);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
*fout = pll_freq / tcon_pll_div;
|
||||
|
||||
error = clknode_enable(parent_clk);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
/* Set LCD divisor */
|
||||
DEVICE_LOCK(sc);
|
||||
LCDCLK_READ(sc, &val);
|
||||
val &= ~CH1_CLK_DIV_RATIO_M;
|
||||
val |= ((tcon_pll_div - 1) << CH1_CLK_DIV_RATIO_M_SHIFT);
|
||||
LCDCLK_WRITE(sc, val);
|
||||
DEVICE_UNLOCK(sc);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,20 @@ struct aw_mmcclk_sc {
|
||||
bus_addr_t reg;
|
||||
};
|
||||
|
||||
struct phase_clk {
|
||||
uint64_t freq;
|
||||
int parent_idx;
|
||||
uint32_t ophase;
|
||||
uint32_t phase;
|
||||
uint32_t n;
|
||||
};
|
||||
|
||||
static struct phase_clk aw_mmcclk_phase[] = {
|
||||
{400000, CLK_SRC_SEL_OSC24M, 0, 0, 2},
|
||||
{25000000, CLK_SRC_SEL_PLL6, 0, 5, 2},
|
||||
{52000000, CLK_SRC_SEL_PLL6, 3, 5, 0},
|
||||
};
|
||||
|
||||
#define MODCLK_READ(sc, val) CLKDEV_READ_4((sc)->clkdev, (sc)->reg, (val))
|
||||
#define MODCLK_WRITE(sc, val) CLKDEV_WRITE_4((sc)->clkdev, (sc)->reg, (val))
|
||||
#define DEVICE_LOCK(sc) CLKDEV_DEVICE_LOCK((sc)->clkdev)
|
||||
@ -166,8 +180,10 @@ aw_mmcclk_set_freq(struct clknode *clk, uint64_t fin, uint64_t *fout,
|
||||
int flags, int *stop)
|
||||
{
|
||||
struct aw_mmcclk_sc *sc;
|
||||
uint32_t val, m, n, phase, ophase;
|
||||
int parent_idx, error;
|
||||
struct clknode *parent_clk;
|
||||
const char **parent_names;
|
||||
uint32_t val, m;
|
||||
int parent_idx, error, phase;
|
||||
|
||||
sc = clknode_get_softc(clk);
|
||||
|
||||
@ -175,52 +191,49 @@ aw_mmcclk_set_freq(struct clknode *clk, uint64_t fin, uint64_t *fout,
|
||||
* The ophase/phase values should be set by the MMC driver, but
|
||||
* there is currently no way to do this with the clk API
|
||||
*/
|
||||
if (*fout <= 400000) {
|
||||
parent_idx = CLK_SRC_SEL_OSC24M;
|
||||
ophase = 0;
|
||||
phase = 0;
|
||||
n = 2;
|
||||
} else if (*fout <= 25000000) {
|
||||
parent_idx = CLK_SRC_SEL_PLL6;
|
||||
ophase = 0;
|
||||
phase = 5;
|
||||
n = 2;
|
||||
} else if (*fout <= 52000000) {
|
||||
parent_idx = CLK_SRC_SEL_PLL6;
|
||||
ophase = 3;
|
||||
phase = 5;
|
||||
n = 0;
|
||||
} else
|
||||
return (ERANGE);
|
||||
|
||||
/* Switch parent clock, if necessary */
|
||||
if (parent_idx != clknode_get_parent_idx(clk)) {
|
||||
error = clknode_set_parent_by_idx(clk, parent_idx);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
/* Fetch new input frequency */
|
||||
error = clknode_get_freq(clknode_get_parent(clk), &fin);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
for (phase = 0; phase < nitems(aw_mmcclk_phase); phase++) {
|
||||
if (*fout <= aw_mmcclk_phase[phase].freq)
|
||||
break;
|
||||
}
|
||||
|
||||
m = ((fin / (1 << n)) / *fout) - 1;
|
||||
if (phase == nitems(aw_mmcclk_phase))
|
||||
return (ERANGE);
|
||||
|
||||
parent_names = clknode_get_parent_names(clk);
|
||||
parent_idx = aw_mmcclk_phase[phase].parent_idx;
|
||||
parent_clk = clknode_find_by_name(parent_names[parent_idx]);
|
||||
|
||||
if (parent_clk == NULL)
|
||||
return (ERANGE);
|
||||
|
||||
error = clknode_get_freq(parent_clk, &fin);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
m = ((fin / (1 << aw_mmcclk_phase[phase].n)) / *fout) - 1;
|
||||
|
||||
*fout = fin / (1 << aw_mmcclk_phase[phase].n) / (m + 1);
|
||||
*stop = 1;
|
||||
|
||||
if ((flags & CLK_SET_DRYRUN) != 0)
|
||||
return (0);
|
||||
|
||||
/* Switch to the correct parent if needed */
|
||||
error = clknode_set_parent_by_idx(clk, parent_idx);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
DEVICE_LOCK(sc);
|
||||
MODCLK_READ(sc, &val);
|
||||
val &= ~(CLK_RATIO_N | CLK_RATIO_M | CLK_PHASE_CTR |
|
||||
OUTPUT_CLK_PHASE_CTR);
|
||||
val |= (n << CLK_RATIO_N_SHIFT);
|
||||
val |= (aw_mmcclk_phase[phase].n << CLK_RATIO_N_SHIFT);
|
||||
val |= (m << CLK_RATIO_M_SHIFT);
|
||||
val |= (phase << CLK_PHASE_CTR_SHIFT);
|
||||
val |= (ophase << OUTPUT_CLK_PHASE_CTR_SHIFT);
|
||||
val |= (aw_mmcclk_phase[phase].phase << CLK_PHASE_CTR_SHIFT);
|
||||
val |= (aw_mmcclk_phase[phase].ophase << OUTPUT_CLK_PHASE_CTR_SHIFT);
|
||||
MODCLK_WRITE(sc, val);
|
||||
DEVICE_UNLOCK(sc);
|
||||
|
||||
*fout = fin / (1 << n) / (m + 1);
|
||||
*stop = 1;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,6 @@ static struct ofw_compat_data compat_data[] = {
|
||||
struct aw_modclk_sc {
|
||||
device_t clkdev;
|
||||
bus_addr_t reg;
|
||||
u_int parent_cnt;
|
||||
};
|
||||
|
||||
#define MODCLK_READ(sc, val) CLKDEV_READ_4((sc)->clkdev, (sc)->reg, (val))
|
||||
@ -102,7 +101,7 @@ aw_modclk_set_mux(struct clknode *clk, int index)
|
||||
|
||||
sc = clknode_get_softc(clk);
|
||||
|
||||
if (index < 0 || index >= sc->parent_cnt)
|
||||
if (index < 0 || index >= clknode_get_parents_num(clk))
|
||||
return (ERANGE);
|
||||
|
||||
DEVICE_LOCK(sc);
|
||||
@ -160,6 +159,8 @@ aw_modclk_set_freq(struct clknode *clk, uint64_t fin, uint64_t *fout,
|
||||
int flags, int *stop)
|
||||
{
|
||||
struct aw_modclk_sc *sc;
|
||||
struct clknode *parent_clk, *best_parent;
|
||||
const char **parent_names;
|
||||
uint32_t val, m, n, src, best_m, best_n, best_src;
|
||||
uint64_t cur_freq;
|
||||
int64_t best_diff, cur_diff;
|
||||
@ -170,11 +171,12 @@ aw_modclk_set_freq(struct clknode *clk, uint64_t fin, uint64_t *fout,
|
||||
best_diff = (int64_t)*fout;
|
||||
best_src = 0;
|
||||
|
||||
for (src = 0; src < sc->parent_cnt; src++) {
|
||||
error = clknode_set_parent_by_idx(clk, src);
|
||||
if (error != 0)
|
||||
parent_names = clknode_get_parent_names(clk);
|
||||
for (src = 0; src < clknode_get_parents_num(clk); src++) {
|
||||
parent_clk = clknode_find_by_name(parent_names[src]);
|
||||
if (parent_clk == NULL)
|
||||
continue;
|
||||
error = clknode_get_freq(clknode_get_parent(clk), &fin);
|
||||
error = clknode_get_freq(parent_clk, &fin);
|
||||
if (error != 0)
|
||||
continue;
|
||||
|
||||
@ -184,6 +186,7 @@ aw_modclk_set_freq(struct clknode *clk, uint64_t fin, uint64_t *fout,
|
||||
cur_diff = (int64_t)*fout - cur_freq;
|
||||
if (cur_diff >= 0 && cur_diff < best_diff) {
|
||||
best_src = src;
|
||||
best_parent = parent_clk;
|
||||
best_diff = cur_diff;
|
||||
best_m = m;
|
||||
best_n = n;
|
||||
@ -194,10 +197,17 @@ aw_modclk_set_freq(struct clknode *clk, uint64_t fin, uint64_t *fout,
|
||||
if (best_diff == (int64_t)*fout)
|
||||
return (ERANGE);
|
||||
|
||||
error = clknode_set_parent_by_idx(clk, best_src);
|
||||
error = clknode_get_freq(best_parent, &fin);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
error = clknode_get_freq(clknode_get_parent(clk), &fin);
|
||||
|
||||
*fout = fin / (1 << best_n) / (best_m + 1);
|
||||
*stop = 1;
|
||||
|
||||
if ((flags & CLK_SET_DRYRUN) != 0)
|
||||
return (0);
|
||||
|
||||
error = clknode_set_parent_by_idx(clk, best_src);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
@ -209,9 +219,6 @@ aw_modclk_set_freq(struct clknode *clk, uint64_t fin, uint64_t *fout,
|
||||
MODCLK_WRITE(sc, val);
|
||||
DEVICE_UNLOCK(sc);
|
||||
|
||||
*fout = fin / (1 << best_n) / (best_m + 1);
|
||||
*stop = 1;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -299,7 +306,6 @@ aw_modclk_attach(device_t dev)
|
||||
sc = clknode_get_softc(clk);
|
||||
sc->reg = paddr;
|
||||
sc->clkdev = device_get_parent(dev);
|
||||
sc->parent_cnt = def.parent_cnt;
|
||||
|
||||
clknode_register(clkdom, clk);
|
||||
|
||||
|
@ -342,6 +342,9 @@ a10_pll1_set_freq(struct aw_pll_sc *sc, uint64_t fin, uint64_t *fout,
|
||||
if (f == NULL)
|
||||
return (EINVAL);
|
||||
|
||||
if ((flags & CLK_SET_DRYRUN) != 0)
|
||||
return (0);
|
||||
|
||||
DEVICE_LOCK(sc);
|
||||
PLL_READ(sc, &val);
|
||||
val &= ~(A10_PLL1_FACTOR_N|A10_PLL1_FACTOR_K|A10_PLL1_FACTOR_M|
|
||||
@ -440,6 +443,9 @@ a10_pll2_set_freq(struct aw_pll_sc *sc, uint64_t fin, uint64_t *fout,
|
||||
post_div = 4;
|
||||
n = (*fout * pre_div * post_div * 2) / (2 * fin);
|
||||
|
||||
if ((flags & CLK_SET_DRYRUN) != 0)
|
||||
return (0);
|
||||
|
||||
DEVICE_LOCK(sc);
|
||||
PLL_READ(sc, &val);
|
||||
val &= ~(A10_PLL2_POST_DIV | A10_PLL2_FACTOR_N | A10_PLL2_PRE_DIV);
|
||||
@ -497,6 +503,9 @@ a10_pll3_set_freq(struct aw_pll_sc *sc, uint64_t fin, uint64_t *fout,
|
||||
*fout = m * A10_PLL3_REF_FREQ;
|
||||
}
|
||||
|
||||
if ((flags & CLK_SET_DRYRUN) != 0)
|
||||
return (0);
|
||||
|
||||
DEVICE_LOCK(sc);
|
||||
PLL_READ(sc, &val);
|
||||
val &= ~(A10_PLL3_MODE_SEL | A10_PLL3_FUNC_SET | A10_PLL3_FACTOR_M);
|
||||
@ -699,6 +708,9 @@ a13_pll2_set_freq(struct aw_pll_sc *sc, uint64_t fin, uint64_t *fout,
|
||||
post_div = 4;
|
||||
n = (*fout * pre_div * post_div * 2) / (2 * fin);
|
||||
|
||||
if ((flags & CLK_SET_DRYRUN) != 0)
|
||||
return (0);
|
||||
|
||||
DEVICE_LOCK(sc);
|
||||
PLL_READ(sc, &val);
|
||||
val &= ~(A13_PLL2_POST_DIV | A13_PLL2_FACTOR_N | A13_PLL2_PRE_DIV);
|
||||
@ -765,6 +777,9 @@ h3_pll2_set_freq(struct aw_pll_sc *sc, uint64_t fin, uint64_t *fout,
|
||||
if (f == NULL)
|
||||
return (EINVAL);
|
||||
|
||||
if ((flags & CLK_SET_DRYRUN) != 0)
|
||||
return (0);
|
||||
|
||||
DEVICE_LOCK(sc);
|
||||
PLL_READ(sc, &val);
|
||||
val &= ~(H3_PLL2_POST_DIV|H3_PLL2_FACTOR_N|H3_PLL2_PRE_DIV);
|
||||
@ -808,6 +823,9 @@ a23_pll1_set_freq(struct aw_pll_sc *sc, uint64_t fin, uint64_t *fout,
|
||||
if (f == NULL)
|
||||
return (EINVAL);
|
||||
|
||||
if ((flags & CLK_SET_DRYRUN) != 0)
|
||||
return (0);
|
||||
|
||||
DEVICE_LOCK(sc);
|
||||
PLL_READ(sc, &val);
|
||||
val &= ~(A23_PLL1_FACTOR_N|A23_PLL1_FACTOR_K|A23_PLL1_FACTOR_M|
|
||||
@ -860,6 +878,9 @@ h3_pll1_set_freq(struct aw_pll_sc *sc, uint64_t fin, uint64_t *fout,
|
||||
if (f == NULL)
|
||||
return (EINVAL);
|
||||
|
||||
if ((flags & CLK_SET_DRYRUN) != 0)
|
||||
return (0);
|
||||
|
||||
DEVICE_LOCK(sc);
|
||||
PLL_READ(sc, &val);
|
||||
|
||||
@ -1067,6 +1088,9 @@ a83t_pllcpux_set_freq(struct aw_pll_sc *sc, uint64_t fin, uint64_t *fout,
|
||||
if (n < A83T_PLLCPUX_FACTOR_N_MIN || n > A83T_PLLCPUX_FACTOR_N_MAX)
|
||||
return (EINVAL);
|
||||
|
||||
if ((flags & CLK_SET_DRYRUN) != 0)
|
||||
return (0);
|
||||
|
||||
DEVICE_LOCK(sc);
|
||||
PLL_READ(sc, &val);
|
||||
val &= ~A83T_PLLCPUX_FACTOR_N;
|
||||
|
@ -186,6 +186,9 @@ aw_thsclk_set_freq(struct clknode *clk, uint64_t fin, uint64_t *fout,
|
||||
if (best_diff == (int64_t)*fout || best_n == 0)
|
||||
return (ERANGE);
|
||||
|
||||
if ((flags & CLK_SET_DRYRUN) != 0)
|
||||
return (0);
|
||||
|
||||
DEVICE_LOCK(sc);
|
||||
THSCLK_READ(sc, &val);
|
||||
val &= ~CLK_DIV_RATIO;
|
||||
|
@ -746,7 +746,7 @@ cpsw_get_fdt_data(struct cpsw_softc *sc, int port)
|
||||
for (child = OF_child(sc->node); child != 0; child = OF_peer(child)) {
|
||||
if (OF_getprop_alloc(child, "name", 1, (void **)&name) < 0)
|
||||
continue;
|
||||
if (sscanf(name, "slave@%x", &mdio_child_addr) != 1) {
|
||||
if (sscanf(name, "slave@%lx", &mdio_child_addr) != 1) {
|
||||
OF_prop_free(name);
|
||||
continue;
|
||||
}
|
||||
|
@ -738,8 +738,8 @@ typedef struct dof_sec {
|
||||
((x) == DOF_SECT_PRARGS) || ((x) == DOF_SECT_PROFFS) || \
|
||||
((x) == DOF_SECT_INTTAB) || ((x) == DOF_SECT_XLTAB) || \
|
||||
((x) == DOF_SECT_XLMEMBERS) || ((x) == DOF_SECT_XLIMPORT) || \
|
||||
((x) == DOF_SECT_XLIMPORT) || ((x) == DOF_SECT_XLEXPORT) || \
|
||||
((x) == DOF_SECT_PREXPORT) || ((x) == DOF_SECT_PRENOFFS))
|
||||
((x) == DOF_SECT_XLEXPORT) || ((x) == DOF_SECT_PREXPORT) || \
|
||||
((x) == DOF_SECT_PRENOFFS))
|
||||
|
||||
typedef struct dof_ecbdesc {
|
||||
dof_secidx_t dofe_probes; /* link to DOF_SECT_PROBEDESC */
|
||||
|
@ -204,7 +204,7 @@ spigen_transfer(struct cdev *cdev, struct spigen_transfer *st)
|
||||
int error = 0;
|
||||
|
||||
mtx_lock(&sc->sc_mtx);
|
||||
if (st->st_command.iov_len == 0 || st->st_data.iov_len == 0)
|
||||
if (st->st_command.iov_len == 0)
|
||||
error = EINVAL;
|
||||
else if (st->st_command.iov_len > sc->sc_command_length_max ||
|
||||
st->st_data.iov_len > sc->sc_data_length_max)
|
||||
@ -221,16 +221,20 @@ spigen_transfer(struct cdev *cdev, struct spigen_transfer *st)
|
||||
M_DEVBUF, M_WAITOK);
|
||||
if (transfer.tx_cmd == NULL)
|
||||
return (ENOMEM);
|
||||
transfer.tx_data = transfer.rx_data = malloc(st->st_data.iov_len,
|
||||
M_DEVBUF, M_WAITOK);
|
||||
if (transfer.tx_data == NULL) {
|
||||
free(transfer.tx_cmd, M_DEVBUF);
|
||||
return (ENOMEM);
|
||||
if (st->st_data.iov_len > 0) {
|
||||
transfer.tx_data = transfer.rx_data = malloc(st->st_data.iov_len,
|
||||
M_DEVBUF, M_WAITOK);
|
||||
if (transfer.tx_data == NULL) {
|
||||
free(transfer.tx_cmd, M_DEVBUF);
|
||||
return (ENOMEM);
|
||||
}
|
||||
}
|
||||
else
|
||||
transfer.tx_data = transfer.rx_data = NULL;
|
||||
|
||||
error = copyin(st->st_command.iov_base, transfer.tx_cmd,
|
||||
transfer.tx_cmd_sz = transfer.rx_cmd_sz = st->st_command.iov_len);
|
||||
if (error == 0)
|
||||
if ((error == 0) && (st->st_data.iov_len > 0))
|
||||
error = copyin(st->st_data.iov_base, transfer.tx_data,
|
||||
transfer.tx_data_sz = transfer.rx_data_sz =
|
||||
st->st_data.iov_len);
|
||||
@ -239,7 +243,7 @@ spigen_transfer(struct cdev *cdev, struct spigen_transfer *st)
|
||||
if (error == 0) {
|
||||
error = copyout(transfer.rx_cmd, st->st_command.iov_base,
|
||||
transfer.rx_cmd_sz);
|
||||
if (error == 0)
|
||||
if ((error == 0) && (st->st_data.iov_len > 0))
|
||||
error = copyout(transfer.rx_data, st->st_data.iov_base,
|
||||
transfer.rx_data_sz);
|
||||
}
|
||||
|
@ -238,13 +238,8 @@ uart_pl011_getc(struct uart_bas *bas, struct mtx *hwmtx)
|
||||
* High-level UART interface.
|
||||
*/
|
||||
struct uart_pl011_softc {
|
||||
struct uart_softc base;
|
||||
uint8_t fcr;
|
||||
uint8_t ier;
|
||||
uint8_t mcr;
|
||||
|
||||
uint8_t ier_mask;
|
||||
uint8_t ier_rxbits;
|
||||
struct uart_softc base;
|
||||
uint16_t imsc; /* Interrupt mask */
|
||||
};
|
||||
|
||||
static int uart_pl011_bus_attach(struct uart_softc *);
|
||||
@ -309,14 +304,15 @@ UART_ACPI_CLASS_AND_DEVICE(acpi_compat_data);
|
||||
static int
|
||||
uart_pl011_bus_attach(struct uart_softc *sc)
|
||||
{
|
||||
struct uart_pl011_softc *psc;
|
||||
struct uart_bas *bas;
|
||||
int reg;
|
||||
|
||||
psc = (struct uart_pl011_softc *)sc;
|
||||
bas = &sc->sc_bas;
|
||||
|
||||
/* Enable interrupts */
|
||||
reg = (UART_RXREADY | RIS_RTIM | UART_TXEMPTY);
|
||||
__uart_setreg(bas, UART_IMSC, reg);
|
||||
psc->imsc = (UART_RXREADY | RIS_RTIM | UART_TXEMPTY);
|
||||
__uart_setreg(bas, UART_IMSC, psc->imsc);
|
||||
|
||||
/* Clear interrupts */
|
||||
__uart_setreg(bas, UART_ICR, IMSC_MASK_ALL);
|
||||
@ -372,12 +368,14 @@ uart_pl011_bus_ioctl(struct uart_softc *sc, int request, intptr_t data)
|
||||
static int
|
||||
uart_pl011_bus_ipend(struct uart_softc *sc)
|
||||
{
|
||||
struct uart_pl011_softc *psc;
|
||||
struct uart_bas *bas;
|
||||
uint32_t ints;
|
||||
int ipend;
|
||||
int reg;
|
||||
|
||||
psc = (struct uart_pl011_softc *)sc;
|
||||
bas = &sc->sc_bas;
|
||||
|
||||
uart_lock(sc->sc_hwmtx);
|
||||
ints = __uart_getreg(bas, UART_MIS);
|
||||
ipend = 0;
|
||||
@ -393,9 +391,7 @@ uart_pl011_bus_ipend(struct uart_softc *sc)
|
||||
ipend |= SER_INT_TXIDLE;
|
||||
|
||||
/* Disable TX interrupt */
|
||||
reg = __uart_getreg(bas, UART_IMSC);
|
||||
reg &= ~(UART_TXEMPTY);
|
||||
__uart_setreg(bas, UART_IMSC, reg);
|
||||
__uart_setreg(bas, UART_IMSC, psc->imsc & ~UART_TXEMPTY);
|
||||
}
|
||||
|
||||
uart_unlock(sc->sc_hwmtx);
|
||||
@ -472,10 +468,11 @@ uart_pl011_bus_setsig(struct uart_softc *sc, int sig)
|
||||
static int
|
||||
uart_pl011_bus_transmit(struct uart_softc *sc)
|
||||
{
|
||||
struct uart_pl011_softc *psc;
|
||||
struct uart_bas *bas;
|
||||
int reg;
|
||||
int i;
|
||||
|
||||
psc = (struct uart_pl011_softc *)sc;
|
||||
bas = &sc->sc_bas;
|
||||
uart_lock(sc->sc_hwmtx);
|
||||
|
||||
@ -489,9 +486,7 @@ uart_pl011_bus_transmit(struct uart_softc *sc)
|
||||
sc->sc_txbusy = 1;
|
||||
|
||||
/* Enable TX interrupt */
|
||||
reg = __uart_getreg(bas, UART_IMSC);
|
||||
reg |= (UART_TXEMPTY);
|
||||
__uart_setreg(bas, UART_IMSC, reg);
|
||||
__uart_setreg(bas, UART_IMSC, psc->imsc);
|
||||
}
|
||||
|
||||
uart_unlock(sc->sc_hwmtx);
|
||||
@ -506,23 +501,29 @@ uart_pl011_bus_transmit(struct uart_softc *sc)
|
||||
static void
|
||||
uart_pl011_bus_grab(struct uart_softc *sc)
|
||||
{
|
||||
struct uart_pl011_softc *psc;
|
||||
struct uart_bas *bas;
|
||||
|
||||
psc = (struct uart_pl011_softc *)sc;
|
||||
bas = &sc->sc_bas;
|
||||
|
||||
/* Disable interrupts on switch to polling */
|
||||
uart_lock(sc->sc_hwmtx);
|
||||
__uart_setreg(bas, UART_IMSC, /* Switch to RX polling while grabbed */
|
||||
~UART_RXREADY & __uart_getreg(bas, UART_IMSC));
|
||||
__uart_setreg(bas, UART_IMSC, psc->imsc & ~IMSC_MASK_ALL);
|
||||
uart_unlock(sc->sc_hwmtx);
|
||||
}
|
||||
|
||||
static void
|
||||
uart_pl011_bus_ungrab(struct uart_softc *sc)
|
||||
{
|
||||
struct uart_pl011_softc *psc;
|
||||
struct uart_bas *bas;
|
||||
|
||||
psc = (struct uart_pl011_softc *) sc;
|
||||
bas = &sc->sc_bas;
|
||||
|
||||
/* Switch to using interrupts while not grabbed */
|
||||
uart_lock(sc->sc_hwmtx);
|
||||
__uart_setreg(bas, UART_IMSC, /* Switch to RX interrupts while not grabbed */
|
||||
UART_RXREADY | __uart_getreg(bas, UART_IMSC));
|
||||
__uart_setreg(bas, UART_IMSC, psc->imsc);
|
||||
uart_unlock(sc->sc_hwmtx);
|
||||
}
|
||||
|
@ -96,6 +96,7 @@ options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
|
||||
# To make an SMP kernel, the next two lines are needed
|
||||
options SMP # Symmetric MultiProcessor Kernel
|
||||
device apic # I/O APIC
|
||||
options EARLY_AP_STARTUP
|
||||
|
||||
# CPU frequency control
|
||||
device cpufreq
|
||||
|
@ -75,6 +75,9 @@ device ext_resources
|
||||
|
||||
device gpio
|
||||
|
||||
device iicbus
|
||||
device iic
|
||||
|
||||
device scbus
|
||||
device da
|
||||
|
||||
|
@ -4,6 +4,7 @@ mips/ingenic/jz4780_dwc_fdt.c optional dwcotg
|
||||
mips/ingenic/jz4780_ehci.c optional ehci
|
||||
mips/ingenic/jz4780_mmc.c optional mmc
|
||||
mips/ingenic/jz4780_ohci.c optional ohci
|
||||
mips/ingenic/jz4780_smb.c optional iicbus
|
||||
mips/ingenic/jz4780_uart.c optional uart
|
||||
|
||||
mips/ingenic/jz4780_clock.c standard
|
||||
|
480
sys/mips/ingenic/jz4780_smb.c
Normal file
480
sys/mips/ingenic/jz4780_smb.c
Normal file
@ -0,0 +1,480 @@
|
||||
/*-
|
||||
* Copyright (c) 2016 Jared McNeill <jmcneill@invisible.ca>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Ingenic JZ4780 SMB Controller
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/rman.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/time.h>
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <dev/ofw/ofw_bus.h>
|
||||
#include <dev/ofw/ofw_bus_subr.h>
|
||||
|
||||
#include <dev/iicbus/iiconf.h>
|
||||
#include <dev/iicbus/iicbus.h>
|
||||
|
||||
#include <dev/extres/clk/clk.h>
|
||||
|
||||
#include <mips/ingenic/jz4780_smb.h>
|
||||
|
||||
#include "iicbus_if.h"
|
||||
|
||||
#define JZSMB_TIMEOUT ((300UL * hz) / 1000)
|
||||
|
||||
#define JZSMB_SPEED_STANDARD 100000
|
||||
#define JZSMB_SETUP_TIME_STANDARD 300
|
||||
#define JZSMB_HOLD_TIME_STANDARD 400
|
||||
#define JZSMB_PERIOD_MIN_STANDARD 4000
|
||||
#define JZSMB_PERIOD_MAX_STANDARD 4700
|
||||
|
||||
#define JZSMB_SPEED_FAST 400000
|
||||
#define JZSMB_SETUP_TIME_FAST 450
|
||||
#define JZSMB_HOLD_TIME_FAST 450
|
||||
#define JZSMB_PERIOD_MIN_FAST 600
|
||||
#define JZSMB_PERIOD_MAX_FAST 1300
|
||||
|
||||
#define JZSMB_HCNT_BASE 8
|
||||
#define JZSMB_HCNT_MIN 6
|
||||
#define JZSMB_LCNT_BASE 1
|
||||
#define JZSMB_LCNT_MIN 8
|
||||
|
||||
static inline int
|
||||
tstohz(const struct timespec *tsp)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
TIMESPEC_TO_TIMEVAL(&tv, tsp);
|
||||
return (tvtohz(&tv));
|
||||
}
|
||||
|
||||
static struct ofw_compat_data compat_data[] = {
|
||||
{ "ingenic,jz4780-i2c", 1 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static struct resource_spec jzsmb_spec[] = {
|
||||
{ SYS_RES_MEMORY, 0, RF_ACTIVE },
|
||||
{ -1, 0 }
|
||||
};
|
||||
|
||||
struct jzsmb_softc {
|
||||
struct resource *res;
|
||||
struct mtx mtx;
|
||||
clk_t clk;
|
||||
device_t iicbus;
|
||||
int busy;
|
||||
uint32_t i2c_freq;
|
||||
uint64_t bus_freq;
|
||||
uint32_t status;
|
||||
|
||||
struct iic_msg *msg;
|
||||
};
|
||||
|
||||
#define SMB_LOCK(sc) mtx_lock(&(sc)->mtx)
|
||||
#define SMB_UNLOCK(sc) mtx_unlock(&(sc)->mtx)
|
||||
#define SMB_ASSERT_LOCKED(sc) mtx_assert(&(sc)->mtx, MA_OWNED)
|
||||
#define SMB_READ(sc, reg) bus_read_2((sc)->res, (reg))
|
||||
#define SMB_WRITE(sc, reg, val) bus_write_2((sc)->res, (reg), (val))
|
||||
|
||||
static phandle_t
|
||||
jzsmb_get_node(device_t bus, device_t dev)
|
||||
{
|
||||
return (ofw_bus_get_node(bus));
|
||||
}
|
||||
|
||||
static int
|
||||
jzsmb_enable(struct jzsmb_softc *sc, int enable)
|
||||
{
|
||||
SMB_ASSERT_LOCKED(sc);
|
||||
|
||||
if (enable) {
|
||||
SMB_WRITE(sc, SMBENB, SMBENB_SMBENB);
|
||||
while ((SMB_READ(sc, SMBENBST) & SMBENBST_SMBEN) == 0)
|
||||
;
|
||||
} else {
|
||||
SMB_WRITE(sc, SMBENB, 0);
|
||||
while ((SMB_READ(sc, SMBENBST) & SMBENBST_SMBEN) != 0)
|
||||
;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
jzsmb_reset_locked(device_t dev, u_char addr)
|
||||
{
|
||||
struct jzsmb_softc *sc;
|
||||
uint16_t con;
|
||||
uint32_t period;
|
||||
int hcnt, lcnt, setup_time, hold_time;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
SMB_ASSERT_LOCKED(sc);
|
||||
|
||||
/* Setup master mode operation */
|
||||
|
||||
/* Disable SMB */
|
||||
jzsmb_enable(sc, 0);
|
||||
|
||||
/* Disable interrupts */
|
||||
SMB_WRITE(sc, SMBINTM, 0);
|
||||
|
||||
/* Set supported speed mode and expected SCL frequency */
|
||||
period = sc->bus_freq / sc->i2c_freq;
|
||||
con = SMBCON_REST | SMBCON_SLVDIS | SMBCON_MD;
|
||||
switch (sc->i2c_freq) {
|
||||
case JZSMB_SPEED_STANDARD:
|
||||
con |= SMBCON_SPD_STANDARD;
|
||||
setup_time = JZSMB_SETUP_TIME_STANDARD;
|
||||
hold_time = JZSMB_HOLD_TIME_STANDARD;
|
||||
hcnt = (period * JZSMB_PERIOD_MIN_STANDARD) /
|
||||
(JZSMB_PERIOD_MAX_STANDARD + JZSMB_PERIOD_MIN_STANDARD);
|
||||
lcnt = period - hcnt;
|
||||
hcnt = MAX(hcnt - JZSMB_HCNT_BASE, JZSMB_HCNT_MIN);
|
||||
lcnt = MAX(lcnt - JZSMB_LCNT_BASE, JZSMB_LCNT_MIN);
|
||||
SMB_WRITE(sc, SMBCON, con);
|
||||
SMB_WRITE(sc, SMBSHCNT, hcnt);
|
||||
SMB_WRITE(sc, SMBSLCNT, lcnt);
|
||||
break;
|
||||
case JZSMB_SPEED_FAST:
|
||||
con |= SMBCON_SPD_FAST;
|
||||
setup_time = JZSMB_SETUP_TIME_FAST;
|
||||
hold_time = JZSMB_HOLD_TIME_FAST;
|
||||
hcnt = (period * JZSMB_PERIOD_MIN_FAST) /
|
||||
(JZSMB_PERIOD_MAX_FAST + JZSMB_PERIOD_MIN_FAST);
|
||||
lcnt = period - hcnt;
|
||||
hcnt = MAX(hcnt - JZSMB_HCNT_BASE, JZSMB_HCNT_MIN);
|
||||
lcnt = MAX(lcnt - JZSMB_LCNT_BASE, JZSMB_LCNT_MIN);
|
||||
SMB_WRITE(sc, SMBCON, con);
|
||||
SMB_WRITE(sc, SMBFHCNT, hcnt);
|
||||
SMB_WRITE(sc, SMBFLCNT, lcnt);
|
||||
break;
|
||||
default:
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
setup_time = ((setup_time * sc->bus_freq / 1000) / 1000000) + 1;
|
||||
setup_time = MIN(1, MAX(255, setup_time));
|
||||
SMB_WRITE(sc, SMBSDASU, setup_time);
|
||||
|
||||
hold_time = ((hold_time * sc->bus_freq / 1000) / 1000000) - 1;
|
||||
hold_time = MAX(255, hold_time);
|
||||
if (hold_time >= 0)
|
||||
SMB_WRITE(sc, SMBSDAHD, hold_time | SMBSDAHD_HDENB);
|
||||
else
|
||||
SMB_WRITE(sc, SMBSDAHD, 0);
|
||||
|
||||
SMB_WRITE(sc, SMBTAR, addr >> 1);
|
||||
|
||||
if (addr != 0) {
|
||||
/* Enable SMB */
|
||||
jzsmb_enable(sc, 1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
jzsmb_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr)
|
||||
{
|
||||
struct jzsmb_softc *sc;
|
||||
int error;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
SMB_LOCK(sc);
|
||||
error = jzsmb_reset_locked(dev, addr);
|
||||
SMB_UNLOCK(sc);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
jzsmb_transfer_read(device_t dev, struct iic_msg *msg)
|
||||
{
|
||||
struct jzsmb_softc *sc;
|
||||
struct timespec start, diff;
|
||||
uint16_t con, resid;
|
||||
int timeo;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
timeo = JZSMB_TIMEOUT * msg->len;
|
||||
|
||||
SMB_ASSERT_LOCKED(sc);
|
||||
|
||||
con = SMB_READ(sc, SMBCON);
|
||||
con |= SMBCON_STPHLD;
|
||||
SMB_WRITE(sc, SMBCON, con);
|
||||
|
||||
getnanouptime(&start);
|
||||
for (resid = msg->len; resid > 0; resid--) {
|
||||
for (int i = 0; i < min(resid, 8); i++)
|
||||
SMB_WRITE(sc, SMBDC, SMBDC_CMD);
|
||||
for (;;) {
|
||||
getnanouptime(&diff);
|
||||
timespecsub(&diff, &start);
|
||||
if ((SMB_READ(sc, SMBST) & SMBST_RFNE) != 0) {
|
||||
msg->buf[msg->len - resid] =
|
||||
SMB_READ(sc, SMBDC) & SMBDC_DAT;
|
||||
break;
|
||||
} else
|
||||
DELAY(1000);
|
||||
|
||||
if (tstohz(&diff) >= timeo) {
|
||||
device_printf(dev,
|
||||
"read timeout (status=0x%02x)\n",
|
||||
SMB_READ(sc, SMBST));
|
||||
return (EIO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
con = SMB_READ(sc, SMBCON);
|
||||
con &= ~SMBCON_STPHLD;
|
||||
SMB_WRITE(sc, SMBCON, con);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
jzsmb_transfer_write(device_t dev, struct iic_msg *msg, int stop_hold)
|
||||
{
|
||||
struct jzsmb_softc *sc;
|
||||
struct timespec start, diff;
|
||||
uint16_t con, resid;
|
||||
int timeo;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
timeo = JZSMB_TIMEOUT * msg->len;
|
||||
|
||||
SMB_ASSERT_LOCKED(sc);
|
||||
|
||||
con = SMB_READ(sc, SMBCON);
|
||||
con |= SMBCON_STPHLD;
|
||||
SMB_WRITE(sc, SMBCON, con);
|
||||
|
||||
getnanouptime(&start);
|
||||
for (resid = msg->len; resid > 0; resid--) {
|
||||
for (;;) {
|
||||
getnanouptime(&diff);
|
||||
timespecsub(&diff, &start);
|
||||
if ((SMB_READ(sc, SMBST) & SMBST_TFNF) != 0) {
|
||||
SMB_WRITE(sc, SMBDC,
|
||||
msg->buf[msg->len - resid]);
|
||||
break;
|
||||
} else
|
||||
DELAY((1000 * hz) / JZSMB_TIMEOUT);
|
||||
|
||||
if (tstohz(&diff) >= timeo) {
|
||||
device_printf(dev,
|
||||
"write timeout (status=0x%02x)\n",
|
||||
SMB_READ(sc, SMBST));
|
||||
return (EIO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!stop_hold) {
|
||||
con = SMB_READ(sc, SMBCON);
|
||||
con &= ~SMBCON_STPHLD;
|
||||
SMB_WRITE(sc, SMBCON, con);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
jzsmb_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs)
|
||||
{
|
||||
struct jzsmb_softc *sc;
|
||||
uint32_t n;
|
||||
uint16_t con;
|
||||
int error;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
SMB_LOCK(sc);
|
||||
while (sc->busy)
|
||||
mtx_sleep(sc, &sc->mtx, 0, "i2cbuswait", 0);
|
||||
sc->busy = 1;
|
||||
sc->status = 0;
|
||||
|
||||
for (n = 0; n < nmsgs; n++) {
|
||||
/* Set target address */
|
||||
if (n == 0 || msgs[n].slave != msgs[n - 1].slave)
|
||||
jzsmb_reset_locked(dev, msgs[n].slave);
|
||||
|
||||
/* Set read or write */
|
||||
if ((msgs[n].flags & IIC_M_RD) != 0)
|
||||
error = jzsmb_transfer_read(dev, &msgs[n]);
|
||||
else
|
||||
error = jzsmb_transfer_write(dev, &msgs[n],
|
||||
n < nmsgs - 1);
|
||||
|
||||
if (error != 0)
|
||||
goto done;
|
||||
}
|
||||
|
||||
done:
|
||||
/* Send stop if necessary */
|
||||
con = SMB_READ(sc, SMBCON);
|
||||
con &= ~SMBCON_STPHLD;
|
||||
SMB_WRITE(sc, SMBCON, con);
|
||||
|
||||
/* Disable SMB */
|
||||
jzsmb_enable(sc, 0);
|
||||
|
||||
sc->msg = NULL;
|
||||
sc->busy = 0;
|
||||
wakeup(sc);
|
||||
SMB_UNLOCK(sc);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
jzsmb_probe(device_t dev)
|
||||
{
|
||||
if (!ofw_bus_status_okay(dev))
|
||||
return (ENXIO);
|
||||
|
||||
if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
|
||||
return (ENXIO);
|
||||
|
||||
device_set_desc(dev, "Ingenic JZ4780 SMB Controller");
|
||||
|
||||
return (BUS_PROBE_DEFAULT);
|
||||
}
|
||||
|
||||
static int
|
||||
jzsmb_attach(device_t dev)
|
||||
{
|
||||
struct jzsmb_softc *sc;
|
||||
phandle_t node;
|
||||
int error;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
node = ofw_bus_get_node(dev);
|
||||
mtx_init(&sc->mtx, device_get_nameunit(dev), "jzsmb", MTX_DEF);
|
||||
|
||||
error = clk_get_by_ofw_index(dev, 0, 0, &sc->clk);
|
||||
if (error != 0) {
|
||||
device_printf(dev, "cannot get clock\n");
|
||||
goto fail;
|
||||
}
|
||||
error = clk_enable(sc->clk);
|
||||
if (error != 0) {
|
||||
device_printf(dev, "cannot enable clock\n");
|
||||
goto fail;
|
||||
}
|
||||
error = clk_get_freq(sc->clk, &sc->bus_freq);
|
||||
if (error != 0 || sc->bus_freq == 0) {
|
||||
device_printf(dev, "cannot get bus frequency\n");
|
||||
return (error);
|
||||
}
|
||||
|
||||
if (bus_alloc_resources(dev, jzsmb_spec, &sc->res) != 0) {
|
||||
device_printf(dev, "cannot allocate resources for device\n");
|
||||
error = ENXIO;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (OF_getencprop(node, "clock-frequency", &sc->i2c_freq,
|
||||
sizeof(sc->i2c_freq)) != 0 || sc->i2c_freq == 0)
|
||||
sc->i2c_freq = 100000; /* Default to standard mode */
|
||||
|
||||
sc->iicbus = device_add_child(dev, "iicbus", -1);
|
||||
if (sc->iicbus == NULL) {
|
||||
device_printf(dev, "cannot add iicbus child device\n");
|
||||
error = ENXIO;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
bus_generic_attach(dev);
|
||||
|
||||
return (0);
|
||||
|
||||
fail:
|
||||
bus_release_resources(dev, jzsmb_spec, &sc->res);
|
||||
if (sc->clk != NULL)
|
||||
clk_release(sc->clk);
|
||||
mtx_destroy(&sc->mtx);
|
||||
return (error);
|
||||
}
|
||||
|
||||
static device_method_t jzsmb_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, jzsmb_probe),
|
||||
DEVMETHOD(device_attach, jzsmb_attach),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
|
||||
DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
|
||||
DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource),
|
||||
DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource),
|
||||
DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource),
|
||||
|
||||
/* OFW methods */
|
||||
DEVMETHOD(ofw_bus_get_node, jzsmb_get_node),
|
||||
|
||||
/* iicbus interface */
|
||||
DEVMETHOD(iicbus_callback, iicbus_null_callback),
|
||||
DEVMETHOD(iicbus_reset, jzsmb_reset),
|
||||
DEVMETHOD(iicbus_transfer, jzsmb_transfer),
|
||||
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static driver_t jzsmb_driver = {
|
||||
"iichb",
|
||||
jzsmb_methods,
|
||||
sizeof(struct jzsmb_softc),
|
||||
};
|
||||
|
||||
static devclass_t jzsmb_devclass;
|
||||
|
||||
EARLY_DRIVER_MODULE(iicbus, jzsmb, iicbus_driver, iicbus_devclass, 0, 0,
|
||||
BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE);
|
||||
EARLY_DRIVER_MODULE(jzsmb, simplebus, jzsmb_driver, jzsmb_devclass, 0, 0,
|
||||
BUS_PASS_RESOURCE + BUS_PASS_ORDER_MIDDLE);
|
||||
MODULE_VERSION(jzsmb, 1);
|
98
sys/mips/ingenic/jz4780_smb.h
Normal file
98
sys/mips/ingenic/jz4780_smb.h
Normal file
@ -0,0 +1,98 @@
|
||||
/*-
|
||||
* Copyright (c) 2016 Jared McNeill <jmcneill@invisible.ca>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Ingenic JZ4780 SMB Controller
|
||||
*/
|
||||
|
||||
#ifndef __JZ4780_SMB_H__
|
||||
#define __JZ4780_SMB_H__
|
||||
|
||||
#define SMBCON 0x00
|
||||
#define SMBCON_STPHLD (1 << 7)
|
||||
#define SMBCON_SLVDIS (1 << 6)
|
||||
#define SMBCON_REST (1 << 5)
|
||||
#define SMBCON_MATP (1 << 4)
|
||||
#define SMBCON_SATP (1 << 3)
|
||||
#define SMBCON_SPD (3 << 1)
|
||||
#define SMBCON_SPD_STANDARD (1 << 1)
|
||||
#define SMBCON_SPD_FAST (2 << 1)
|
||||
#define SMBCON_MD (1 << 0)
|
||||
#define SMBTAR 0x04
|
||||
#define SMBTAR_MATP (1 << 12)
|
||||
#define SMBTAR_SPECIAL (1 << 11)
|
||||
#define SMBTAR_GC_OR_START (1 << 10)
|
||||
#define SMBTAR_SMBTAR (0x3ff << 0)
|
||||
#define SMBSAR 0x08
|
||||
#define SMBDC 0x10
|
||||
#define SMBDC_CMD (1 << 8)
|
||||
#define SMBDC_DAT (0xff << 0)
|
||||
#define SMBSHCNT 0x14
|
||||
#define SMBSLCNT 0x18
|
||||
#define SMBFHCNT 0x1c
|
||||
#define SMBFLCNT 0x20
|
||||
#define SMBINTST 0x2c
|
||||
#define SMBINTM 0x30
|
||||
#define SMBRXTL 0x38
|
||||
#define SMBTXTL 0x3c
|
||||
#define SMBCINT 0x40
|
||||
#define SMBCRXUF 0x44
|
||||
#define SMBCRXOF 0x48
|
||||
#define SMBCTXOF 0x4c
|
||||
#define SMBCRXREQ 0x50
|
||||
#define SMBCTXABT 0x54
|
||||
#define SMBCRXDN 0x58
|
||||
#define SMBCACT 0x5c
|
||||
#define SMBCSTP 0x60
|
||||
#define SMBCSTT 0x64
|
||||
#define SMBCGC 0x68
|
||||
#define SMBENB 0x6c
|
||||
#define SMBENB_SMBENB (1 << 0)
|
||||
#define SMBST 0x70
|
||||
#define SMBST_SLVACT (1 << 6)
|
||||
#define SMBST_MSTACT (1 << 5)
|
||||
#define SMBST_RFF (1 << 4)
|
||||
#define SMBST_RFNE (1 << 3)
|
||||
#define SMBST_TFE (1 << 2)
|
||||
#define SMBST_TFNF (1 << 1)
|
||||
#define SMBST_ACT (1 << 0)
|
||||
#define SMBABTSRC 0x80
|
||||
#define SMBDMACR 0x88
|
||||
#define SMBDMATDLR 0x8c
|
||||
#define SMBDMARDLR 0x90
|
||||
#define SMBSDASU 0x94
|
||||
#define SMBACKGC 0x98
|
||||
#define SMBENBST 0x9c
|
||||
#define SMBENBST_SLVRDLST (1 << 2)
|
||||
#define SMBENBST_SLVDISB (1 << 1)
|
||||
#define SMBENBST_SMBEN (1 << 0)
|
||||
#define SMBSDAHD 0xd0
|
||||
#define SMBSDAHD_HDENB (1 << 8)
|
||||
#define SMBSDAHD_SDAHD (0xff << 0)
|
||||
|
||||
#endif /* !__JZ4780_SMB_H__ */
|
@ -252,6 +252,7 @@ SYSCTL_INT(_net_link_lagg, OID_AUTO, default_flowid_shift, CTLFLAG_RWTUN,
|
||||
&VNET_NAME(def_flowid_shift), 0,
|
||||
"Default setting for flowid shift for load sharing");
|
||||
|
||||
#pragma clang optimize off
|
||||
static void
|
||||
vnet_lagg_init(const void *unused __unused)
|
||||
{
|
||||
@ -1022,7 +1023,7 @@ lagg_port_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
||||
return (error);
|
||||
|
||||
fallback:
|
||||
if (lp->lp_ioctl != NULL)
|
||||
if (lp != NULL && lp->lp_ioctl != NULL)
|
||||
return ((*lp->lp_ioctl)(ifp, cmd, data));
|
||||
|
||||
return (EINVAL);
|
||||
|
@ -227,8 +227,8 @@ int vsnprintf(char *, size_t, const char *, __va_list) __printflike(3, 0);
|
||||
int vsnrprintf(char *, size_t, int, const char *, __va_list) __printflike(4, 0);
|
||||
int vsprintf(char *buf, const char *, __va_list) __printflike(2, 0);
|
||||
int ttyprintf(struct tty *, const char *, ...) __printflike(2, 3);
|
||||
int sscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2);
|
||||
int vsscanf(const char *, char const *, __va_list) __nonnull(1) __nonnull(2);
|
||||
int sscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2) __scanflike(2, 3);
|
||||
int vsscanf(const char *, char const *, __va_list) __nonnull(1) __nonnull(2) __scanflike(2, 0);
|
||||
long strtol(const char *, char **, int) __nonnull(1);
|
||||
u_long strtoul(const char *, char **, int) __nonnull(1);
|
||||
quad_t strtoq(const char *, char **, int) __nonnull(1);
|
||||
|
@ -1916,30 +1916,30 @@ swp_pager_meta_free(vm_object_t object, vm_pindex_t index, daddr_t count)
|
||||
static void
|
||||
swp_pager_meta_free_all(vm_object_t object)
|
||||
{
|
||||
daddr_t index = 0;
|
||||
struct swblock **pswap, *swap;
|
||||
vm_pindex_t index;
|
||||
daddr_t v;
|
||||
int i;
|
||||
|
||||
VM_OBJECT_ASSERT_WLOCKED(object);
|
||||
if (object->type != OBJT_SWAP)
|
||||
return;
|
||||
|
||||
while (object->un_pager.swp.swp_bcount) {
|
||||
struct swblock **pswap;
|
||||
struct swblock *swap;
|
||||
|
||||
index = 0;
|
||||
while (object->un_pager.swp.swp_bcount != 0) {
|
||||
mtx_lock(&swhash_mtx);
|
||||
pswap = swp_pager_hash(object, index);
|
||||
if ((swap = *pswap) != NULL) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < SWAP_META_PAGES; ++i) {
|
||||
daddr_t v = swap->swb_pages[i];
|
||||
v = swap->swb_pages[i];
|
||||
if (v != SWAPBLK_NONE) {
|
||||
--swap->swb_count;
|
||||
swp_pager_freeswapspace(v, 1);
|
||||
}
|
||||
}
|
||||
if (swap->swb_count != 0)
|
||||
panic("swap_pager_meta_free_all: swb_count != 0");
|
||||
panic(
|
||||
"swap_pager_meta_free_all: swb_count != 0");
|
||||
*pswap = swap->swb_hnext;
|
||||
uma_zfree(swap_zone, swap);
|
||||
--object->un_pager.swp.swp_bcount;
|
||||
|
@ -8126,6 +8126,65 @@ OLD_FILES+=usr/share/man/man1/size.1.gz
|
||||
OLD_FILES+=usr/share/man/man1/strings.1.gz
|
||||
OLD_FILES+=usr/share/man/man1/strip.1.gz
|
||||
OLD_FILES+=usr/share/man/man1/objcopy.1.gz
|
||||
# lib/libelf
|
||||
OLD_FILES+=usr/share/man/man3/elf.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_begin.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_cntl.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_end.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_errmsg.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_fill.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_flagdata.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_getarhdr.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_getarsym.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_getbase.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_getdata.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_getident.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_getscn.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_getphdrnum.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_getphnum.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_getshdrnum.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_getshnum.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_getshdrstrndx.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_getshstrndx.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_hash.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_kind.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_memory.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_next.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_open.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_rawfile.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_rand.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_strptr.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_update.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elf_version.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gelf.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gelf_checksum.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gelf_fsize.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gelf_getcap.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gelf_getclass.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gelf_getdyn.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gelf_getehdr.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gelf_getmove.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gelf_getphdr.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gelf_getrel.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gelf_getrela.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gelf_getshdr.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gelf_getsym.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gelf_getsyminfo.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gelf_getsymshndx.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gelf_newehdr.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gelf_newphdr.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gelf_update_ehdr.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/gelf_xlatetof.3.gz
|
||||
# lib/libelftc
|
||||
OLD_FILES+=usr/share/man/man3/elftc.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elftc_bfd_find_target.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elftc_copyfile.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elftc_demangle.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elftc_reloc_type_str.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elftc_set_timestamps.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elftc_timestamp.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elftc_string_table_create.3.gz
|
||||
OLD_FILES+=usr/share/man/man3/elftc_version.3.gz
|
||||
OLD_FILES+=usr/tests/usr.bin/yacc/Kyuafile
|
||||
OLD_FILES+=usr/tests/usr.bin/yacc/btyacc_calc1.y
|
||||
OLD_FILES+=usr/tests/usr.bin/yacc/btyacc_demo.y
|
||||
|
@ -619,8 +619,10 @@ fetch_progress() {
|
||||
|
||||
pct_fmt()
|
||||
{
|
||||
printf " \r"
|
||||
printf "($1/$2) %02.2f%% " `echo "scale=4;$LNC / $TOTAL * 100"|bc`
|
||||
if [ $TOTAL -gt 0 ]; then
|
||||
printf " \r"
|
||||
printf "($1/$2) %02.2f%% " `echo "scale=4;$LNC / $TOTAL * 100"|bc`
|
||||
fi
|
||||
}
|
||||
|
||||
fetch_progress_percent() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user