Skip to content

[libc] Change fsfilcnt_t and fsblkcnt_t to be 64-bits long #99876

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2024

Conversation

mikhailramalho
Copy link
Member

In 32-bit systems with 64-bit offsets, both fsfilcnt_t and fsblkcnt_t are 64-bit long, just like 64-bit systems. This patch changes both types to be 64-bit long for all platforms and follows the reasoning used to change off_t: the standard only requires it to be an unsigned int, so making it 64-bit long doesn't violate this property.

It should be NFC for 64-bit systems.

@llvmbot
Copy link
Member

llvmbot commented Jul 22, 2024

@llvm/pr-subscribers-libc

Author: Mikhail R. Gadelha (mikhailramalho)

Changes

In 32-bit systems with 64-bit offsets, both fsfilcnt_t and fsblkcnt_t are 64-bit long, just like 64-bit systems. This patch changes both types to be 64-bit long for all platforms and follows the reasoning used to change off_t: the standard only requires it to be an unsigned int, so making it 64-bit long doesn't violate this property.

It should be NFC for 64-bit systems.


Full diff: https://github.com/llvm/llvm-project/pull/99876.diff

2 Files Affected:

  • (modified) libc/include/llvm-libc-types/fsblkcnt_t.h (+1-1)
  • (modified) libc/include/llvm-libc-types/fsfilcnt_t.h (+1-1)
diff --git a/libc/include/llvm-libc-types/fsblkcnt_t.h b/libc/include/llvm-libc-types/fsblkcnt_t.h
index 88a53d38cb1b3..c08b62e11bff5 100644
--- a/libc/include/llvm-libc-types/fsblkcnt_t.h
+++ b/libc/include/llvm-libc-types/fsblkcnt_t.h
@@ -9,6 +9,6 @@
 #ifndef LLVM_LIBC_TYPES_FSBLKCNT_T_H
 #define LLVM_LIBC_TYPES_FSBLKCNT_T_H
 
-typedef __SIZE_TYPE__ fsblkcnt_t;
+typedef __INT64_TYPE__ fsblkcnt_t;
 
 #endif // LLVM_LIBC_TYPES_FSBLKCNT_T_H
diff --git a/libc/include/llvm-libc-types/fsfilcnt_t.h b/libc/include/llvm-libc-types/fsfilcnt_t.h
index c5693591907ab..14949b18746b4 100644
--- a/libc/include/llvm-libc-types/fsfilcnt_t.h
+++ b/libc/include/llvm-libc-types/fsfilcnt_t.h
@@ -9,6 +9,6 @@
 #ifndef LLVM_LIBC_TYPES_FSFILCNT_T_H
 #define LLVM_LIBC_TYPES_FSFILCNT_T_H
 
-typedef __SIZE_TYPE__ fsfilcnt_t;
+typedef __INT64_TYPE__ fsfilcnt_t;
 
 #endif // LLVM_LIBC_TYPES_FSFILCNT_T_H

In 32-bit systems with 64-bit offsets, both fsfilcnt_t and fsblkcnt_t
are 64-bit long, just like 64-bit systems. This patch changes both types
to be 64-bit long for all platforms and follows the reasoning used to
change off_t: the standard only requires it to be an unsigned int, so
making it 64-bit long doesn't violate this property.
@mikhailramalho mikhailramalho force-pushed the change-fsblkcnt-fsfilcnt branch from ace35aa to 3e09e25 Compare July 22, 2024 14:04
@mikhailramalho mikhailramalho merged commit 7ddcf7a into llvm:main Jul 22, 2024
6 checks passed
@mikhailramalho mikhailramalho deleted the change-fsblkcnt-fsfilcnt branch July 22, 2024 15:06
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
In 32-bit systems with 64-bit offsets, both fsfilcnt_t and fsblkcnt_t are 64-bit long, just like 64-bit systems. This patch changes both types to be 64-bit long for all platforms and follows the reasoning used to change off_t: the standard only requires it to be an unsigned int, so making it 64-bit long doesn't violate this property.

It should be NFC for 64-bit systems.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants