Skip to contentSkip to conversation

connector.h

DISCUSSION Andrew Morton 2 participants 3 messages Apr 1, 2005

lore
Share & tools
lore
#0 lore raw
Quoted 7 lines

struct cb_id

{
	__u32			idx;
	__u32			val;
};

It is vital that all data structures be skilfully commented - they are the key to understanding the code. Why the struct exists, which actor passes it to which other actor(s), whether the data structure is communicated with userspace, what other data structures it is aggregated with or linked to, locking rules, etc.

Quoted 2 lines

struct cn_msg
{

Please do

	struct cn_msg {
Quoted 2 lines

#define CN_CBQ_NAMELEN 32

Commentary?

#1 lore raw
Quoted 7 lines · Andrew Morton
Quoted 6 lines

struct cb_id

{
	__u32			idx;
	__u32			val;
};
Quoted 5 lines

It is vital that all data structures be skilfully commented - they are the key to understanding the code. Why the struct exists, which actor passes it to which other actor(s), whether the data structure is communicated with userspace, what other data structures it is aggregated with or linked to, locking rules, etc.

It is described in Documentation/connector/connector.txt. Should it also be placed here?

Quoted 6 lines
Quoted 2 lines

struct cn_msg
{

Please do

	struct cn_msg {

Neither structure declaration should have opening brace on the new string?

Quoted 4 lines
Quoted 2 lines

#define CN_CBQ_NAMELEN 32

Commentary?

Maximum allowed callback name - name will be truncated if it exceeds that limit.

I will place this doc in the code.

Signature · 3 lines
        Evgeniy Polyakov

Crash is better than data corruption -- Arthur Grabowski
#2 lore raw
Quoted 9 lines · Evgeniy Polyakov
Quoted 7 lines · Andrew Morton
Quoted 6 lines

struct cb_id

{
	__u32			idx;
	__u32			val;
};
Quoted 8 lines
Quoted 5 lines

It is vital that all data structures be skilfully commented - they are the key to understanding the code. Why the struct exists, which actor passes it to which other actor(s), whether the data structure is communicated with userspace, what other data structures it is aggregated with or linked to, locking rules, etc.

It is described in Documentation/connector/connector.txt. Should it also be placed here?

I think it's better to document these things in the code. Those structs which are communicated to userspace should be described in connector.txt because they are part of the API. But a lot of the structs you have there are purely knerel-internal.

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

struct cn_msg
{

Please do

	struct cn_msg {

Neither structure declaration should have opening brace on the new string?

I don't understand your question.

We lay out struct definitions thusly:

struct foo {
	int a;
	int b;
};