[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] ditch redundant integer types



The very few uses can easily be replaced by more standard ones.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/common/lib.c
+++ b/xen/common/lib.c
@@ -110,7 +110,8 @@ union uu {
 /*
  * Extract high and low shortwords from longword, and move low shortword of
  * longword to upper half of long, i.e., produce the upper longword of
- * ((quad_t)(x) << (number_of_bits_in_long/2)).  (`x' must actually be u_long.)
+ * ((quad_t)(x) << (number_of_bits_in_long/2)).  (`x' must actually be
+ * unsigned long.)
  *
  * These are used in the multiply code, to split a longword into upper
  * and lower halves, and to reassemble a product as a quad_t, shifted left
@@ -127,10 +128,10 @@ union uu {
 #define B (1 << HALF_BITS) /* digit base */
 
 /* Combine two `digits' to make a single two-digit number. */
-#define COMBINE(a, b) (((u_long)(a) << HALF_BITS) | (b))
+#define COMBINE(a, b) (((unsigned long)(a) << HALF_BITS) | (b))
 
 /* select a type for digits in base B */
-typedef u_long digit;
+typedef unsigned long digit;
 
 /*
  * Shift p[0]..p[len] left `sh' bits, ignoring any bits that
@@ -150,8 +151,8 @@ static void shl(register digit *p, regis
  * __qdivrem(u, v, rem) returns u/v and, optionally, sets *rem to u%v.
  *
  * We do this in base 2-sup-HALF_BITS, so that all intermediate products
- * fit within u_long.  As a consequence, the maximum length dividend and
- * divisor are 4 `digits' in this base (they are shorter if they have
+ * fit within unsigned long.  As a consequence, the maximum length dividend
+ * and divisor are 4 `digits' in this base (they are shorter if they have
  * leading zeros).
  */
 u64 __qdivrem(u64 uq, u64 vq, u64 *arq)
@@ -159,7 +160,7 @@ u64 __qdivrem(u64 uq, u64 vq, u64 *arq)
     union uu tmp;
     digit *u, *v, *q;
     register digit v1, v2;
-    u_long qhat, rhat, t;
+    unsigned long qhat, rhat, t;
     int m, n, d, j, i;
     digit uspace[5], vspace[5], qspace[5];
 
@@ -210,7 +211,7 @@ u64 __qdivrem(u64 uq, u64 vq, u64 *arq)
     v[4] = LHALF(tmp.ul[L]);
     for (n = 4; v[1] == 0; v++) {
         if (--n == 1) {
-            u_long rbj; /* r*B+u[j] (not root boy jim) */
+            unsigned long rbj; /* r*B+u[j] (not root boy jim) */
             digit q1, q2, q3, q4;
 
             /*
@@ -286,7 +287,8 @@ u64 __qdivrem(u64 uq, u64 vq, u64 *arq)
             rhat = uj1;
             goto qhat_too_big;
         } else {
-            u_long nn = COMBINE(uj0, uj1);
+            unsigned long nn = COMBINE(uj0, uj1);
+
             qhat = nn / v1;
             rhat = nn % v1;
         }
--- a/xen/crypto/rijndael.c
+++ b/xen/crypto/rijndael.c
@@ -1236,7 +1236,7 @@ rijndaelDecrypt(const u32 rk[/*4*(Nr + 1
 
 /* setup key context for encryption only */
 int
-rijndael_set_key_enc_only(rijndael_ctx *ctx, const u_char *key, int bits)
+rijndael_set_key_enc_only(rijndael_ctx *ctx, const unsigned char *key, int 
bits)
 {
        int rounds;
 
@@ -1252,7 +1252,7 @@ rijndael_set_key_enc_only(rijndael_ctx *
 
 /* setup key context for both encryption and decryption */
 int
-rijndael_set_key(rijndael_ctx *ctx, const u_char *key, int bits)
+rijndael_set_key(rijndael_ctx *ctx, const unsigned char *key, int bits)
 {
        int rounds;
 
@@ -1269,13 +1269,13 @@ rijndael_set_key(rijndael_ctx *ctx, cons
 }
 
 void
-rijndael_decrypt(rijndael_ctx *ctx, const u_char *src, u_char *dst)
+rijndael_decrypt(rijndael_ctx *ctx, const unsigned char *src, unsigned char 
*dst)
 {
        rijndaelDecrypt(ctx->dk, ctx->Nr, src, dst);
 }
 
 void
-rijndael_encrypt(rijndael_ctx *ctx, const u_char *src, u_char *dst)
+rijndael_encrypt(rijndael_ctx *ctx, const unsigned char *src, unsigned char 
*dst)
 {
        rijndaelEncrypt(ctx->ek, ctx->Nr, src, dst);
 }
--- a/xen/include/crypto/rijndael.h
+++ b/xen/include/crypto/rijndael.h
@@ -45,10 +45,10 @@ typedef struct {
        u32     dk[4*(AES_MAXROUNDS + 1)];      /* decrypt key schedule */
 } rijndael_ctx;
 
-int     rijndael_set_key(rijndael_ctx *, const u_char *, int);
-int     rijndael_set_key_enc_only(rijndael_ctx *, const u_char *, int);
-void    rijndael_decrypt(rijndael_ctx *, const u_char *, u_char *);
-void    rijndael_encrypt(rijndael_ctx *, const u_char *, u_char *);
+int     rijndael_set_key(rijndael_ctx *, const unsigned char *, int);
+int     rijndael_set_key_enc_only(rijndael_ctx *, const unsigned char *, int);
+void    rijndael_decrypt(rijndael_ctx *, const unsigned char *, unsigned char 
*);
+void    rijndael_encrypt(rijndael_ctx *, const unsigned char *, unsigned char 
*);
 
 int    rijndaelKeySetupEnc(unsigned int [], const unsigned char [], int);
 int    rijndaelKeySetupDec(unsigned int [], const unsigned char [], int);
--- a/xen/include/xen/elfstructs.h
+++ b/xen/include/xen/elfstructs.h
@@ -361,7 +361,7 @@ typedef struct {
 
 #define        ELF64_R_SYM(info)       ((info) >> 32)
 #define        ELF64_R_TYPE(info)      ((info) & 0xFFFFFFFF)
-#define ELF64_R_INFO(s,t)      (((s) << 32) + (u_int32_t)(t))
+#define ELF64_R_INFO(s,t)      (((s) << 32) + (uint32_t)(t))
 
 /*
  * Relocation types for x86_64 and ARM 64. We list only the ones Live Patch
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -30,32 +30,16 @@
 #define LONG_MIN        (-LONG_MAX - 1)
 #define ULONG_MAX       (~0UL)
 
-/* bsd */
-typedef unsigned char           u_char;
-typedef unsigned short          u_short;
-typedef unsigned int            u_int;
-typedef unsigned long           u_long;
-
-/* sysv */
-typedef unsigned char           unchar;
-typedef unsigned short          ushort;
-typedef unsigned int            uint;
-typedef unsigned long           ulong;
-
 typedef         __u8            uint8_t;
-typedef         __u8            u_int8_t;
 typedef         __s8            int8_t;
 
 typedef         __u16           uint16_t;
-typedef         __u16           u_int16_t;
 typedef         __s16           int16_t;
 
 typedef         __u32           uint32_t;
-typedef         __u32           u_int32_t;
 typedef         __s32           int32_t;
 
 typedef         __u64           uint64_t;
-typedef         __u64           u_int64_t;
 typedef         __s64           int64_t;
 
 struct domain;


Attachment: ditch-u_int-and-alike.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.