Re: [PATCH 5/6] i386 virtualization - Make generic set wrprotect a macro

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

 



* [email protected] ([email protected]) wrote:
> Make the generic version of ptep_set_wrprotect a macro.  This is good for
> code uniformity, and fixes the build for architectures which include pgtable.h
> through headers into assembly code, but do not define a ptep_set_wrprotect
> function.

This one is unrelated to other descriptor related changes.  Why is it
included in this series?

> Signed-off-by: Zachary Amsden <[email protected]>
> Index: linux-2.6.13/include/asm-generic/pgtable.h
> ===================================================================
> --- linux-2.6.13.orig/include/asm-generic/pgtable.h	2005-08-12 12:12:55.000000000 -0700
> +++ linux-2.6.13/include/asm-generic/pgtable.h	2005-08-15 13:54:42.000000000 -0700
> @@ -313,11 +313,12 @@
>  #endif
>  
>  #ifndef __HAVE_ARCH_PTEP_SET_WRPROTECT
> -static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long address, pte_t *ptep)
> -{
> -	pte_t old_pte = *ptep;
> -	set_pte_at(mm, address, ptep, pte_wrprotect(old_pte));
> -}
> +#define ptep_set_wrprotect(__mm, __address, __ptep)			\
> +({									\
> +	pte_t __old_pte = *(__ptep);					\
> +	set_pte_at((__mm), (__address), (__ptep),			\
> +			pte_wrprotect(__old_pte));			\
> +})
>  #endif

I'm not sure I agree with this approach (although I understand the
motivation).  This should at least be a do {} while(0) type macro,
since it's not returning a value.

thanks,
-chris
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux