Page MenuHomeFreeBSD

fs.h: fix signed/unsigned issues, from NetBSD
AbandonedPublic

Authored by emaste on May 3 2017, 12:39 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 19, 8:25 PM
Unknown Object (File)
Sun, Oct 19, 8:25 PM
Unknown Object (File)
Sun, Oct 19, 6:28 AM
Unknown Object (File)
Sep 1 2025, 4:16 AM
Unknown Object (File)
Aug 3 2025, 7:20 PM
Unknown Object (File)
Jun 30 2025, 8:06 PM
Unknown Object (File)
Jun 30 2025, 3:28 PM
Unknown Object (File)
Jun 30 2025, 9:20 AM
Subscribers
None

Details

Reviewers
mckusick
kib
Summary
Test Plan

Tinderbox build

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

I dislike the direct use of uint64_t for disk address. Some abstraction is IMO warranted there, off_t use was relatively sane.

Note that our daddr_t type, which represents disk block number, is also signed.

The signedness warning arises because the UFS dinode di_size is u_int64_t. Is the right fix then just to sprinkle casts everywhere?

The signedness warning arises because the UFS dinode di_size is u_int64_t. Is the right fix then just to sprinkle casts everywhere?

I am not sure, and since I noted that e.g. lblktosize() is legitimately used for extended data blocks, which have negative indexes, I think changing signess there is tricky.
Are there too many relateed warnings in the makefs code ? Does makefs support ext attributes on UFS ?

sys/ufs/ffs/fs.h
577

For this change, please take a look at ufs/ffs/ffs_softdep.c:trunc_pages(). I suspect that it would break the calculation, or at least more consideration is required.

Instead of this change I can use D10589 and some casts sprinkled in makefs.

sys/ufs/ffs/fs.h
611

related issue arises here, where i_size is uint64_t and smallblktosize is signed