Usenet comp.os.linux.announce (1993-2013)
 help / color / mirror / Atom feed
* Userfs: patch for operation with Linux 1.1.46+
@ 1994-08-26 13:59 Jeremy Fitzhardinge
  0 siblings, 0 replies; only message in thread
From: Jeremy Fitzhardinge @ 1994-08-26 13:59 UTC (permalink / raw)


Just as I released userfs 0.8, Linus decided to use long longs in
the kernel, which breaks the genser part of userfs.

Here's a patch which adds long long support to genser.  Apply
this patch in the genser directory and rebuild userfs.

This patch will also be available in:

   tsx-11.mit.edu: pub/linux/ALPHA/userfs/userfs-0.8-0.8.1.diff.gz
   sunsite.unc.edu: pub/Linux/ALPHA/userfs/userfs-0.8-0.8.1.diff.gz

	J


===================================================================
RCS file: /wrk/cvsroot/genser/coder.h,v
retrieving revision 1.2
diff -u -r1.2 coder.h
--- 1.2	1994/04/08 16:48:38
+++ coder.h	1994/08/22 18:16:38
@@ -4,7 +4,7 @@
 #define __CODER_H_SEEN__
 
 #ifndef __GNUC__
-#define __inline__
+#define __inline__	/* */
 #endif
 
 #ifndef __cplusplus
@@ -21,6 +21,8 @@
 typedef unsigned short Ushort;
 typedef unsigned long Ulong;
 typedef unsigned long Uint;
+typedef unsigned long long Ulonglong;
+typedef long long longlong;
 
 /** char **/
 __inline__ static unsigned char *encode_char(const char *ch, unsigned char *buf)
@@ -146,6 +148,71 @@
 	return 4;
 }
 
+/** long long */
+__inline__ static unsigned char *encode_longlong(const long long *l,
+						 unsigned char *buf)
+{
+	register long long lv = *l;
+
+	buf[0] = (lv >> 56) & 0xff;
+	buf[1] = (lv >> 48) & 0xff;
+	buf[2] = (lv >> 40) & 0xff;
+	buf[3] = (lv >> 32) & 0xff;
+	buf[4] = (lv >> 24) & 0xff;
+	buf[5] = (lv >> 16) & 0xff;
+	buf[6] = (lv >> 8)  & 0xff;
+	buf[7] =  lv        & 0xff;
+
+	return buf+8;
+}
+
+__inline__ static unsigned char *decode_longlong(long long *l,
+						 unsigned char *buf)
+{
+#define BUF(x)	((long long)(buf[x]))
+	*l = (BUF(0) << 56)|(BUF(1) << 48)|(BUF(2) << 40)|(BUF(3) << 32)|
+	     (BUF(4) << 24)|(BUF(5) << 16)|(BUF(6) <<  8)|BUF(7);
+#undef BUF
+	return buf+8;
+}
+
+__inline__ static unsigned int sizeof_longlong(const long long *c)
+{
+	return 8;
+}
+
+/** unsigned long long */
+__inline__ static unsigned char *encode_Ulonglong(const unsigned long long *l,
+						  unsigned char *buf)
+{
+	register unsigned long long lv = *l;
+
+	buf[0] = (lv >> 56) & 0xff;
+	buf[1] = (lv >> 48) & 0xff;
+	buf[2] = (lv >> 40) & 0xff;
+	buf[3] = (lv >> 32) & 0xff;
+	buf[4] = (lv >> 24) & 0xff;
+	buf[5] = (lv >> 16) & 0xff;
+	buf[6] = (lv >> 8)  & 0xff;
+	buf[7] =  lv        & 0xff;
+
+	return buf+8;
+}
+
+__inline__ static unsigned char *decode_Ulonglong(unsigned long long *l,
+						  unsigned char *buf)
+{
+#define BUF(x)	((unsigned long long)(buf[x]))
+	*l = (BUF(0) << 56)|(BUF(1) << 48)|(BUF(2) << 40)|(BUF(3) << 32)|
+	     (BUF(4) << 24)|(BUF(5) << 16)|(BUF(6) <<  8)|BUF(7);
+#undef BUF
+	return buf+8;
+}
+
+__inline__ static unsigned int sizeof_Ulonglong(const unsigned long long *c)
+{
+	return 8;
+}
 
 /** void **/
 __inline__ static unsigned char *encode_void(const void *v, unsigned char *buf)
===================================================================
RCS file: /wrk/cvsroot/genser/genhdr.c,v
retrieving revision 1.5
diff -u -r1.5 genhdr.c
--- 1.5	1994/05/26 06:57:57
+++ genhdr.c	1994/08/23 07:04:51
@@ -43,6 +43,7 @@
 		case Char:	str = "char"; break;
 		case Short:	str = "short"; break;
 		case Long:	str = "long"; break;
+		case LongLong:	str = "long long"; break;
 		case Float:	str = "float"; break;
 		case Double:	str = "double"; break;
 		default:	str = "???"; break;
===================================================================
RCS file: /wrk/cvsroot/genser/parser.y,v
retrieving revision 1.1
diff -u -r1.1 parser.y
--- 1.1	1994/04/07 11:11:23
+++ parser.y	1994/08/23 07:21:05
@@ -179,34 +179,41 @@
 /* Cruftyness to handle "long int" and "long double" */
 qual_type:	TYPE TYPE
 			{
+				Type *t1 = realtype($1);
+				Type *t2 = realtype($2);
 				$$ = NULL;
 
-				if ($1 != long_type && $1 != short_type)
+				if (t1 != long_type && t1 != short_type)
 				{
 					yyerror("Can only qualify with \"long\" or \"short\"");
 					YYERROR;
 				}
-				else if ($2->tclass != Scalar)
+				else if (t2->tclass != Scalar)
 				{
 					yyerror("Can only qualify scalar types");
 					YYERROR;
 				}
 				else
 				{
-					switch($2->i.scalar_i.size)
+					switch(t2->i.scalar_i.size)
 					{
 					case Float:
-						if ($1 == long_type)
+						if (t1 == long_type)
 						{
 							$$ = double_type;
 							break;
 						}
 					case Long:
-						if ($1 == short_type)
+						if (t1 == short_type)
 						{
 							$$ = short_type;
 							break;
 						}
+						if (t1 == long_type)
+						{
+							$$ = longlong_type;
+							break;
+						}
 
 					default:	$$ = $2;
 					}
@@ -241,6 +248,7 @@
 					case Char: t = Uchar_type; break;
 					case Short: t = Ushort_type; break;
 					case Long: t = Ulong_type; break;
+					case LongLong: t = Ulonglong_type; break;
 					default:
 						yyerror("only integral types can be unsigned");
 						YYERROR;
===================================================================
RCS file: /wrk/cvsroot/genser/symtab.c,v
retrieving revision 1.1
diff -u -r1.1 symtab.c
--- 1.1	1994/04/07 11:11:24
+++ symtab.c	1994/08/23 07:19:47
@@ -179,9 +179,11 @@
 	return t;
 }
 
+Type *Ulonglong_type;
 Type *Ulong_type;
 Type *Ushort_type;
 Type *Uchar_type;
+Type *longlong_type;
 Type *long_type;
 Type *short_type;
 Type *char_type;
@@ -217,6 +219,11 @@
 	t = Ulong_type = mkscalar(Long, 1);
 	t->nocode = 1;
 
+	t = longlong_type = mkscalar(LongLong, 0);
+	t->nocode = t->nohdr = 1;
+	t = Ulonglong_type = mkscalar(LongLong, 1);
+	t->nocode = 1;
+
 	t = float_type = mkscalar(Float, 0);
 	t->nocode = t->nohdr = 1;
 	t = double_type = mkscalar(Double, 1);
@@ -231,6 +238,8 @@
 	v->type->nocode = v->type->nohdr = 1;
 	global = add(global, v = mktypedef(long_type, "long"));
 	v->type->nocode = v->type->nohdr = 1;
+	global = add(global, v = mktypedef(longlong_type, "longlong"));
+	v->type->nocode = v->type->nohdr = 1;
 
 	global = add(global, v = mktypedef(float_type, "float"));
 	v->type->nocode = v->type->nohdr = 1;
@@ -239,17 +248,19 @@
 
 	global = add(global, v = mktypedef(void_type, "void"));
 	v->type->nohdr = v->type->nocode = v->type->norep = 1;
-	
+
 	global = add(global, v = mktypedef(Uchar_type, "Uchar"));
 	v->type->nocode = v->type->nohdr = 1;
 	global = add(global, v = mktypedef(Ushort_type, "Ushort"));
 	v->type->nocode = v->type->nohdr = 1;
 	global = add(global, v = mktypedef(Ulong_type, "Ulong"));
 	v->type->nocode = v->type->nohdr = 1;
+	global = add(global, v = mktypedef(Ulonglong_type, "Ulonglong"));
+	v->type->nocode = v->type->nohdr = 1;
+    	global = add(global, v=mktypedef(Ulong_type, "Uint"));
+	v->type->demand = v->type->nohdr = v->type->indir = 1;
 
 	global = add(global, v=mktypedef(long_type, "int"));
-	v->type->demand = v->type->nohdr = v->type->indir = 1;
-	global = add(global, v=mktypedef(Ulong_type, "Uint"));
 	v->type->demand = v->type->nohdr = v->type->indir = 1;
 }
 
===================================================================
RCS file: /wrk/cvsroot/genser/symtab.h,v
retrieving revision 1.1
diff -u -r1.1 symtab.h
--- 1.1	1994/04/07 11:11:24
+++ symtab.h	1994/08/22 17:09:37
@@ -22,6 +22,7 @@
 	Char,
 	Short,
 	Long,
+	LongLong,
 	Float,
 	Double
 };
@@ -95,9 +96,11 @@
 Type *realtype(Type *);
 
 /* Standard types */
+extern Type *Ulonglong_type;
 extern Type *Ulong_type;
 extern Type *Ushort_type;
 extern Type *Uchar_type;
+extern Type *longlong_type;
 extern Type *long_type;
 extern Type *short_type;
 extern Type *char_type;


--
Send submissions for comp.os.linux.announce to: linux-announce@tc.cornell.edu
Be sure to include Keywords: and a short description of your software.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1994-08-26 13:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-08-26 13:59 Userfs: patch for operation with Linux 1.1.46+ Jeremy Fitzhardinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox