Further conversions from 32 to 64 bits

This commit is contained in:
Andrea Mazzoleni 2026-06-04 00:34:51 +02:00
parent d595072db2
commit 03f92a7c96
30 changed files with 251 additions and 156 deletions

View file

@ -888,11 +888,11 @@ static const char* find_smartctl(void)
* Return -1 on error, otherwise the size of data read
*/
#if HAVE_LINUX_DEVICE
static int sysread(const char* path, char* buf, size_t buf_size)
static ssize_t sysread(const char* path, char* buf, size_t buf_size)
{
int f;
int ret;
int len;
ssize_t len;
f = open(path, O_RDONLY);
if (f == -1) {
@ -929,7 +929,7 @@ static int sysread(const char* path, char* buf, size_t buf_size)
static int sysattr_vpd_pg80(const char* path, char* dst, size_t dst_size)
{
unsigned char buf[512];
int ret = sysread(path, (char*)buf, sizeof(buf));
ssize_t ret = sysread(path, (char*)buf, sizeof(buf));
/* need at least the header */
if (ret < 4) {
@ -1030,7 +1030,7 @@ static int sysattr_vpd_pg83(const char* path, char* dst, size_t dst_size)
{
unsigned char buf[4096];
int ret = sysread(path, (char*)buf, sizeof(buf));
ssize_t ret = sysread(path, (char*)buf, sizeof(buf));
if (ret < 4) {
/* LCOV_EXCL_START */
return -1;
@ -1149,7 +1149,7 @@ next:
#if HAVE_LINUX_DEVICE
static int sysattr(const char* path, char* buf, size_t buf_size)
{
int len;
ssize_t len;
len = sysread(path, buf, buf_size);
if (len < 0) {
@ -1560,7 +1560,7 @@ static int devdereference(uint64_t device, const char* dir, tommy_list* devlist)
#if HAVE_LINUX_DEVICE
static int tagread(const char* path, const char* tag, char* value, size_t value_size)
{
int ret;
ssize_t ret;
char buf[512];
size_t tag_len;
char* i;
@ -1709,7 +1709,7 @@ static blkid_cache cache = 0;
#if HAVE_LINUX_DEVICE
static int devuuid_dev(uint64_t device, char* uuid, size_t uuid_size)
{
int ret;
ssize_t ret;
DIR* d;
struct dirent* dd;
struct stat st;
@ -2644,12 +2644,12 @@ int fssnapshot_mount(const char* path, struct fssnapshot_struct* fss)
if (sfs.f_type == BTRFS_SUPER_MAGIC) {
/* btrfs reserved inode 256 for subvolume roots */
return fssnapshot_inode(path, sfs.f_type, 256, fss);
return fssnapshot_inode(path, BTRFS_SUPER_MAGIC, 256, fss);
} else if (sfs.f_type == BCACHEFS_SUPER_MAGIC) {
/* Bcachefs reserves inode 4096 for each subvolume's root directory */
return fssnapshot_inode(path, sfs.f_type, 4096, fss);
return fssnapshot_inode(path, BCACHEFS_SUPER_MAGIC, 4096, fss);
} else if (sfs.f_type == ZFS_SUPER_MAGIC) {
return fssnapshot_zfs(path, sfs.f_type, fss);
return fssnapshot_zfs(path, ZFS_SUPER_MAGIC, fss);
} else {
return -1;
}
@ -3233,7 +3233,7 @@ static dev_t devread(const char* path)
{
int f;
int ret;
int len;
ssize_t len;
char buf[64];
char* e;
unsigned ma;
@ -3273,7 +3273,7 @@ static dev_t devread(const char* path)
buf[len] = 0;
ma = strtoul(buf, &e, 10);
ma = strtou(buf, &e, 10);
if (*e != ':') {
/* LCOV_EXCL_START */
log_fatal(EEXTERNAL, "Invalid format in '%s' for '%s'.\n", path, buf);
@ -3281,7 +3281,7 @@ static dev_t devread(const char* path)
/* LCOV_EXCL_STOP */
}
mi = strtoul(e + 1, &e, 10);
mi = strtou(e + 1, &e, 10);
if (*e != 0 && !isspace((unsigned char)*e)) {
/* LCOV_EXCL_START */
log_fatal(EEXTERNAL, "Invalid format in '%s' for '%s'.\n", path, buf);
@ -3392,7 +3392,7 @@ static int devstat(dev_t device, uint64_t* count)
char path[PATH_MAX];
char buf[512];
int token;
int ret;
ssize_t ret;
char* i;
*count = 0;
@ -3551,7 +3551,7 @@ static void devattr(dev_t device, uint64_t* info, char* serial, char* family, ch
{
char path[PATH_MAX];
char buf[512];
int ret;
ssize_t ret;
(void)family; /* not available, smartctl uses an internal database to get it */
@ -3827,7 +3827,7 @@ static int devdownifup(dev_t device, const char* name, const char* smartctl, int
static int devup(dev_t device, const char* name)
{
char file[PATH_MAX];
int ret;
ssize_t ret;
int f;
void* buf;
uint64_t size;
@ -4262,7 +4262,7 @@ void os_abort(void)
#if HAVE_BACKTRACE && HAVE_BACKTRACE_SYMBOLS
void* stack[32];
char** messages;
size_t size;
unsigned size;
unsigned i;
#endif
@ -4397,7 +4397,7 @@ int ambient_temperature(void)
char label[128];
char* dash;
char* e;
long temp;
int temp;
if (strncmp(hwmon_entry->d_name, "temp", 4) != 0)
continue;
@ -4424,7 +4424,7 @@ int ambient_temperature(void)
/* LCOV_EXCL_STOP */
}
temp = strtol(value, &e, 10) / 1000;
temp = strtoi(value, &e, 10) / 1000;
if (*e != 0 && !isspace((unsigned char)*e)) {
/* LCOV_EXCL_START */
continue;
@ -4452,7 +4452,7 @@ int ambient_temperature(void)
/* LCOV_EXCL_STOP */
}
log_tag("thermal:ambient:device:%s:%s:%s:%s:%ld\n", entry->d_name, name, hwmon_name, label, temp);
log_tag("thermal:ambient:device:%s:%s:%s:%s:%d\n", entry->d_name, name, hwmon_name, label, temp);
/* check if temperature is in reasonable range */
if (temp < 15 || temp > 40)
@ -4464,7 +4464,7 @@ int ambient_temperature(void)
/* check if label matches possible ambient labels */
for (int i = 0; AMBIENT_LABEL[i]; ++i) {
if (worddigitstr(label, AMBIENT_LABEL[i]) != 0) {
log_tag("thermal:ambient:candidate:%ld\n", temp);
log_tag("thermal:ambient:candidate:%d\n", temp);
if (lowest_temp == 0 || lowest_temp > temp)
lowest_temp = temp;
break;
@ -4473,7 +4473,7 @@ int ambient_temperature(void)
/* accept also generic "temp1" */
if (strcmp(label, "temp1") == 0) {
log_tag("thermal:ambient:candidate:%ld\n", temp);
log_tag("thermal:ambient:candidate:%d\n", temp);
if (lowest_temp == 0 || lowest_temp > temp)
lowest_temp = temp;
}