RAIDframe write coalescing

2012-12-10 Thread Edgar Fuß
Another RAIDframe question: Suppose I have a level 5 RAIDframe set accross five components. I choose a SPSU value of 8, i.e. 16kB as a stripe size. Now, I write a suitably aligned 64kB chunk (i.e. four stripes worth) of data. Will RAIDframe issue four 4kB writes to each component or a single 16kB

Re: RAIDframe write coalescing

2012-12-10 Thread Thor Lancelot Simon
On Mon, Dec 10, 2012 at 12:58:49PM +0100, Edgar Fu? wrote: Another RAIDframe question: Suppose I have a level 5 RAIDframe set accross five components. I choose a SPSU value of 8, i.e. 16kB as a stripe size. Now, I write a suitably aligned 64kB chunk (i.e. four stripes worth) of data. Will

Re: KNF and the C preprocessor

2012-12-10 Thread Eric Haszlakiewicz
On Mon, Dec 10, 2012 at 09:36:35AM -0600, David Young wrote: What do people think about setting stricter guidelines for using the C preprocessor than the guidelines from the past? Example guidelines: The C preprocessor MAY be used for 1 Lazy evaluation: unlike a function call's arguments,

Re: fixing compat_12 getdents

2012-12-10 Thread Alan Barrett
also, EINVAL doesn't seem like a great error code for this condition. it's not an input parameter that's causing the error, but rather that the required output format cannot express the data to be returned. I think solaris uses EOVERFLOW for this kind of situation, and ERANGE doesn't seem

Re: KNF and the C preprocessor

2012-12-10 Thread Alan Barrett
On Mon, 10 Dec 2012, David Young wrote: What do people think about setting stricter guidelines for using the C preprocessor than the guidelines from the past? Maybe. The C preprocessor MUST NOT be used for 1 In-line code: 'static inline' subroutines are virtually always better than macros.

Re: KNF and the C preprocessor

2012-12-10 Thread David Young
On Mon, Dec 10, 2012 at 07:37:14PM +, David Laight wrote: On Mon, Dec 10, 2012 at 09:36:35AM -0600, David Young wrote: What do people think about setting stricter guidelines for using the C preprocessor than the guidelines from the past? Example guidelines: ... 4 Computed constants.

Re: KNF and the C preprocessor

2012-12-10 Thread David Young
On Mon, Dec 10, 2012 at 10:27:39PM +0200, Alan Barrett wrote: On Mon, 10 Dec 2012, David Young wrote: What do people think about setting stricter guidelines for using the C preprocessor than the guidelines from the past? Maybe. The C preprocessor MUST NOT be used for 1 In-line code:

Re: KNF and the C preprocessor

2012-12-10 Thread Thor Lancelot Simon
On Mon, Dec 10, 2012 at 07:37:14PM +, David Laight wrote: On Mon, Dec 10, 2012 at 09:36:35AM -0600, David Young wrote: What do people think about setting stricter guidelines for using the C preprocessor than the guidelines from the past? Example guidelines: ... 4 Computed constants.

Re: KNF and the C preprocessor

2012-12-10 Thread Thor Lancelot Simon
On Mon, Dec 10, 2012 at 02:28:28PM -0600, David Young wrote: On Mon, Dec 10, 2012 at 07:37:14PM +, David Laight wrote: a) #define macros tend to get optimised better. Better even than an __attribute__((always_inline)) function? I'd like to submit that neither are a good thing, because

Re: fixing compat_12 getdents

2012-12-10 Thread Christos Zoulas
In article 20121210195346.ga8...@apb-laptoy.apb.alt.za, Alan Barrett a...@cequrux.com wrote: also, EINVAL doesn't seem like a great error code for this condition. it's not an input parameter that's causing the error, but rather that the required output format cannot express the data to be

Re: fixing compat_12 getdents

2012-12-10 Thread David Laight
On Mon, Dec 10, 2012 at 09:53:46PM +0200, Alan Barrett wrote: also, EINVAL doesn't seem like a great error code for this condition. it's not an input parameter that's causing the error, but rather that the required output format cannot express the data to be returned. I think solaris uses

Re: KNF and the C preprocessor

2012-12-10 Thread David Young
On Mon, Dec 10, 2012 at 03:50:00PM -0500, Thor Lancelot Simon wrote: On Mon, Dec 10, 2012 at 02:28:28PM -0600, David Young wrote: On Mon, Dec 10, 2012 at 07:37:14PM +, David Laight wrote: a) #define macros tend to get optimised better. Better even than an

Re: KNF and the C preprocessor

2012-12-10 Thread Paul_Koning
On Dec 10, 2012, at 4:18 PM, David Young wrote: On Mon, Dec 10, 2012 at 03:50:00PM -0500, Thor Lancelot Simon wrote: On Mon, Dec 10, 2012 at 02:28:28PM -0600, David Young wrote: On Mon, Dec 10, 2012 at 07:37:14PM +, David Laight wrote: a) #define macros tend to get optimised better.

Re: KNF and the C preprocessor

2012-12-10 Thread David Laight
On Mon, Dec 10, 2012 at 03:50:00PM -0500, Thor Lancelot Simon wrote: On Mon, Dec 10, 2012 at 02:28:28PM -0600, David Young wrote: On Mon, Dec 10, 2012 at 07:37:14PM +, David Laight wrote: a) #define macros tend to get optimised better. Better even than an

Re: KNF and the C preprocessor

2012-12-10 Thread David Laight
On Mon, Dec 10, 2012 at 09:26:08PM +, paul_kon...@dell.com wrote: On Dec 10, 2012, at 4:18 PM, David Young wrote: On Mon, Dec 10, 2012 at 03:50:00PM -0500, Thor Lancelot Simon wrote: On Mon, Dec 10, 2012 at 02:28:28PM -0600, David Young wrote: On Mon, Dec 10, 2012 at 07:37:14PM

Re: KNF and the C preprocessor

2012-12-10 Thread Paul_Koning
On Dec 10, 2012, at 5:07 PM, David Laight wrote: On Mon, Dec 10, 2012 at 09:26:08PM +, paul_kon...@dell.com wrote: On Dec 10, 2012, at 4:18 PM, David Young wrote: On Mon, Dec 10, 2012 at 03:50:00PM -0500, Thor Lancelot Simon wrote: On Mon, Dec 10, 2012 at 02:28:28PM -0600, David

Re: KNF and the C preprocessor

2012-12-10 Thread Mouse
Explicit enums are a little better, no? And they do make things a lot more obvious when debugging. Sometimes. (Ab)using enums for bitmasks or other things that get arithmetic applied to them (eg, O_EXEC, to pick a recently-discussed example) is, IMO, broken - besides being unwarranted

Re: KNF and the C preprocessor

2012-12-10 Thread Mouse
I'd like to submit that neither are a good thing, because human beings are demonstrably quite bad at deciding when things should be inlined, particularly in terms of the cache effects of excessive inline use. Compilers are no better when - as is often the case for NetBSD - there is no

Re: KNF and the C preprocessor

2012-12-10 Thread Mouse
Consider the following code: #define cmd(n) \ if (__predict_true(ring_ptr ring_end)) \ *ring_ptr++ = n; \ else { \ ring_ptr = ring; \ *ring_ptr++ = n; \ ring_wrap_count++; \ } for (;;) { if

Re: fixing compat_12 getdents

2012-12-10 Thread Brett Lymn
On Mon, Dec 10, 2012 at 09:23:15PM +, David Laight wrote: Then people get upset because they say function foo() isn't allowed to set errno to 'bar'. It is rather a shame that posix tries to list all errno a function can return, not just those for explicit 'likely' (ie normal)

Re: KNF and the C preprocessor

2012-12-10 Thread Roland C. Dowdeswell
On Mon, Dec 10, 2012 at 09:36:35AM -0600, David Young wrote: What do people think about setting stricter guidelines for using the C preprocessor than the guidelines from the past? Example guidelines: The C preprocessor MAY be used for 1 Lazy evaluation: ... 2 Lexical manipulation: ...

How to map PCI memory to user space ?

2012-12-10 Thread Rohan Akela
Hi I am trying to map PCI device memory using mmap() to user space for powerpc based platform. I came across previous email thread where it is mentioned that it is possible to mmap PCI memory using pcimmap() implemented in dev/pci/pci_usrreq.c. I wrote a small application to map the the PCI

Re: KNF and the C preprocessor

2012-12-10 Thread Mouse
I would like to propose an additional, perhaps controversial, use. 5 Breaking the flow of control: #ifdef K5BAIL(x) do { ret = x; if (ret) { /* format error message and whatnot * in terms of #x.

Re: fixing compat_12 getdents

2012-12-10 Thread Mouse
Then people get upset because they say function foo() isn't allowed to set errno to 'bar'. Then how do you sanely write error handling routines? The error returns form part of the interface and should be documented as such. There are two kinds of error returns. There are error returns which

Re: KNF and the C preprocessor

2012-12-10 Thread David Holland
On Tue, Dec 11, 2012 at 01:27:09AM +, Roland C. Dowdeswell wrote: As an example, I often define a macro when I am using Kerberos or GSSAPI that looks roughly like: #ifdef K5BAIL(x) do { ret = x; if (ret) { /* format error message

re: KNF and the C preprocessor

2012-12-10 Thread matthew green
(Okay, that's not quite true. Using always_inline doesn't necessarily mean committing to gcc. But _depending on_ always_inline does, ISTM.) there are at least 3 other compilers i'm aware of that support always_inline attribute, along with many of other GCC specific features that aren't part

Re: KNF and the C preprocessor

2012-12-10 Thread David Laight
On Mon, Dec 10, 2012 at 06:47:16PM -0500, Mouse wrote: b) __LINE__ (etc) have the value of the use, not the definition. Yes, but if you use static inlines, the debugger's got both -- which it won't, if you use macros... Huh? Okay, what's the static inline version of log() here?