From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751778AbdBOUhj (ORCPT ); Wed, 15 Feb 2017 15:37:39 -0500 Received: from quartz.orcorp.ca ([184.70.90.242]:46590 "EHLO quartz.orcorp.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750791AbdBOUhh (ORCPT ); Wed, 15 Feb 2017 15:37:37 -0500 Date: Wed, 15 Feb 2017 13:37:34 -0700 From: Jason Gunthorpe To: matthew.gerlach@linux.intel.com Cc: Alan Tull , Moritz Fischer , linux-kernel , linux-fpga@vger.kernel.org Subject: Re: [RFC 7/8] fpga-region: add sysfs interface Message-ID: <20170215203734.GC5531@obsidianresearch.com> References: <1487175261-7051-1-git-send-email-atull@kernel.org> <1487175261-7051-8-git-send-email-atull@kernel.org> <20170215172157.GA3317@obsidianresearch.com> <20170215180612.GB3317@obsidianresearch.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.156 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 15, 2017 at 12:07:15PM -0800, matthew.gerlach@linux.intel.com wrote: > The format of the meta data associated with a fpga bitstream is certainly a > subject on its own. HTTP style plain text is definately easy to understand > and more importantly it is extendable. On the other hand, it seems > dangerous to be doing a lot of string parsing in the kernel. It is fairly close to binary parsing.. The process is - Find the first occurance of \n\n, must be less than XX bytes - Memcpy that from the sg list into a linear buffer - Replace all \n with \0 To access a key: - Case insensitive search for START + "Key: " or \0 + "Key: " - Return as a string the part after the match This isn't the sort of string parsing that typically gets you into trouble. If we can't code the above correctly then we will screw up safe binary parsing of strings too :) Jason