From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752783AbdHNKYo (ORCPT ); Mon, 14 Aug 2017 06:24:44 -0400 Received: from mail-qt0-f169.google.com ([209.85.216.169]:34930 "EHLO mail-qt0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752712AbdHNKYm (ORCPT ); Mon, 14 Aug 2017 06:24:42 -0400 Message-ID: <1502706279.4978.3.camel@redhat.com> Subject: Re: [[PATCH v1] 08/37] [CIFS] SMBD: Define packet format for SMBD data transfer message From: Jeff Layton To: Christoph Hellwig , Long Li Cc: Steve French , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org, Long Li Date: Mon, 14 Aug 2017 06:24:39 -0400 In-Reply-To: <20170813101510.GC17287@infradead.org> References: <1501704648-20159-1-git-send-email-longli@exchange.microsoft.com> <1501704648-20159-9-git-send-email-longli@exchange.microsoft.com> <20170813101510.GC17287@infradead.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.24.4 (3.24.4-1.fc26) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2017-08-13 at 03:15 -0700, Christoph Hellwig wrote: > > +// SMBD data transfer packet with payload [MS-SMBD] 2.2.3 > > +struct smbd_data_transfer { > > + __le16 credits_requested; > > + __le16 credits_granted; > > + __le16 flags; > > + __le16 reserved; > > + __le32 remaining_data_length; > > + __le32 data_offset; > > + __le32 data_length; > > + __le32 padding; > > + char buffer[0]; > > Please use the actually standardized [] syntax for variable sized > arrays. Also normally this would be a __u8 to fit with the other > types, but I haven't seen the usage yet. > Yes, having a single-element array makes it harder to handle the indexes, etc. Flexible arrays are better. > > +} __packed; > > The structure is natually packed already, no need to add the > attribute. I think this should remain on structs that are intended to go across the wire. Could we ever end up with some exotic arch that stuffs some padding in there? Maybe I'm just paranoid, but I don't see any harm in leaving that here. -- Jeff Layton