Skip to contentSkip to conversation

Consolidate asm/futex.h

RFC In review Jeff Dike 2 participants 3 messages Jan 3, 2006 – Jan 4, 2006

Subsystems (2)
lore
Share & tools
lore

Jeff Dike

author
#0 lore raw

RFC 1/1 Consolidate asm/futex.h

Most of the architectures have the same asm/futex.h. The patch below consolidates them into asm-generic, with the arches including it from their own asm/futex.h.

Unless there are objections, I'm going to send this to Andrew in the next few days.

Jeff

include/asm-alpha/futex.h +1 -48
Index: linux-2.6.15/include/asm-alpha/futex.h
===================================================================
@@ -1,53 +1,6 @@
 #ifndef _ASM_FUTEX_H
 #define _ASM_FUTEX_H
 
-#ifdef __KERNEL__
+#include <asm-generic/futex.h>
 
-#include <linux/futex.h>
-#include <asm/errno.h>
-#include <asm/uaccess.h>
-
-static inline int
-futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
-{
-	int op = (encoded_op >> 28) & 7;
-	int cmp = (encoded_op >> 24) & 15;
-	int oparg = (encoded_op << 8) >> 20;
-	int cmparg = (encoded_op << 20) >> 20;
-	int oldval = 0, ret;
-	if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
-		oparg = 1 << oparg;
-
-	if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
-		return -EFAULT;
-
-	inc_preempt_count();
-
-	switch (op) {
-	case FUTEX_OP_SET:
-	case FUTEX_OP_ADD:
-	case FUTEX_OP_OR:
-	case FUTEX_OP_ANDN:
-	case FUTEX_OP_XOR:
-	default:
-		ret = -ENOSYS;
-	}
-
-	dec_preempt_count();
-
-	if (!ret) {
-		switch (cmp) {
-		case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
-		case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
-		case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
-		case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
-		case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
-		case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
-		default: ret = -ENOSYS;
-		}
-	}
-	return ret;
-}
-
-#endif
 #endif
include/asm-arm/futex.h +1 -48

54 lines not on this page · raw message

include/asm-arm26/futex.h +1 -48

54 lines not on this page · raw message

include/asm-cris/futex.h +1 -48

54 lines not on this page · raw message

include/asm-frv/futex.h +1 -48

54 lines not on this page · raw message

include/asm-generic/futex.h new file +53 -0

53 lines not on this page · raw message

include/asm-h8300/futex.h +1 -48

54 lines not on this page · raw message

include/asm-ia64/futex.h +1 -48

54 lines not on this page · raw message

include/asm-m32r/futex.h +1 -48

54 lines not on this page · raw message

include/asm-m68k/futex.h +1 -48

54 lines not on this page · raw message

include/asm-m68knommu/futex.h +1 -48

54 lines not on this page · raw message

include/asm-parisc/futex.h +1 -48

54 lines not on this page · raw message

include/asm-s390/futex.h +1 -48

54 lines not on this page · raw message

include/asm-sh/futex.h +1 -48

54 lines not on this page · raw message

include/asm-sh64/futex.h +1 -48

54 lines not on this page · raw message

include/asm-sparc/futex.h +1 -48

54 lines not on this page · raw message

include/asm-sparc64/futex.h +1 -48

54 lines not on this page · raw message

include/asm-um/futex.h +3 -9
Index: linux-2.6.15/include/asm-um/futex.h
===================================================================
@@ -1,12 +1,6 @@
-#ifndef __UM_FUTEX_H
-#define __UM_FUTEX_H
+#ifndef _ASM_FUTEX_H
+#define _ASM_FUTEX_H
 
-#include <linux/futex.h>
-#include <asm/errno.h>
-#include <asm/system.h>
-#include <asm/processor.h>
-#include <asm/uaccess.h>
-
-#include "asm/arch/futex.h"
+#include <asm-generic/futex.h>
 
 #endif
include/asm-v850/futex.h +1 -48

54 lines not on this page · raw message

#1 lore raw
Quoted 3 lines · Jeff Dike

Most of the architectures have the same asm/futex.h. The patch below consolidates them into asm-generic, with the arches including it from their own asm/futex.h.

That's ok - though for most architectures, that code is only a non-working stub returning -ENOSYS, so it's different from most stuff in asm-generic in being a generic non-implementation. May make however sense, however.

Don't forget mentioning in the changelog that for UML there is an implementation but it's wrong at the moment, so we're reverting it to the default stub.

Quoted 4 lines

Unless there are objections, I'm going to send this to Andrew in the next few days.

Jeff

Signature · 11 lines
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade

	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it
author
#2 lore raw
Quoted 3 lines · Blaisorblade

Don't forget mentioning in the changelog that for UML there is an implementation but it's wrong at the moment, so we're reverting it to the default stub.

OK, I'll add that.

Jeff