lkml.org 
[lkml]   [2005]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: review of ocfs2
Hi,

On 5/30/05, Andi Kleen <ak@suse.de> wrote:
> +static int ocfs2_do_request_vote(ocfs_super *osb,
> + u64 blkno,
> + unsigned int generation,
> + enum ocfs2_vote_request type,
> + int orphaned_slot,
> + struct ocfs2_net_response_cb *callback)
> ...
> + request = kmalloc(sizeof(*request), GFP_KERNEL);
> + if (!request) {
> + status = -ENOMEM;
> + mlog_errno(status);
> + goto bail;
> + }
> + memset(request, 0, sizeof(*request));
>
> kcalloc

Actually, the latest preferred form for

kcalloc(1, sizeof(*p), GFP_KERNEL)

is the following (as suggested by Al Viro):

request = kmalloc(sizeof(*request), GFP_KERNEL);
if (!request) {
status = -ENOMEM;
mlog_errno(status);
goto bail;
}
*request = (ocfs2_vote_msg) { .md1.v_generic1 = htonl(priv) };
hdr = &request->v_hdr;

response_id = ocfs2_new_response_id(osb);

*hdr = (ocfs2_msg_hdr) {
.h_response_id = htonl(response_id);
.h_request = htonl(type);
.h_blkno = cpu_to_be64(blkno);
.h_generation = htonl(generation);
.h_node_num = htonl((unsigned int) osb->node_num)
};

Pekka
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-05-30 13:49    [W:0.041 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site