From patchwork Fri Dec 14 12:01:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Kim_B=C3=B8ndergaard?= X-Patchwork-Id: 206418 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org X-Greylist: delayed 11076 seconds by postgrey-1.34 at bilbo; Fri, 14 Dec 2012 23:01:44 EST Received: from hugin.dotsrc.org (hugin.dotsrc.org [IPv6:2001:878:346::102]) by ozlabs.org (Postfix) with ESMTP id 141602C0097 for ; Fri, 14 Dec 2012 23:01:43 +1100 (EST) Received: from hugin.dotsrc.org (localhost [127.0.0.1]) by hugin.dotsrc.org (Postfix) with ESMTP id 90DB23F9CA for ; Fri, 14 Dec 2012 13:01:40 +0100 (CET) X-Original-To: dev@oe-lite.org Delivered-To: dev@oe-lite.org Received: from mail01.prevas.se (mail01.prevas.se [62.95.78.3]) by hugin.dotsrc.org (Postfix) with ESMTPS id 2AD563F9CA for ; Fri, 14 Dec 2012 13:01:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=prevas.dk; i=@prevas.dk; l=2212; q=dns/txt; s=ironport1; t=1355486499; x=1387022499; h=from:to:subject:date:message-id:in-reply-to:references: mime-version; bh=sC6I05kcLxWd1JgiPhBHT0XR7A7ciFst8VO/cXfUkUI=; b=h/u6blf2Kuwir3KN2w4mMVZIqNpEMP4F1ISm/ue1BGzmDqBuIEtyfYdK xhZnlpNs0sFZ0I9RKey145rmFsNvZcHa/0JJUAl163u2Nv2yrU6CPMzt0 wsrcRQk+JEOGbTD6vq3mhjk9mmB3K3bclbHah1s4OmW6GClLT360KBGCk 4=; X-IronPort-AV: E=Sophos;i="4.84,280,1355094000"; d="scan'208";a="2614228" Received: from vmprevas3.prevas.se (HELO smtp.prevas.se) ([172.16.8.103]) by ironport1.prevas.se with ESMTP/TLS/AES128-SHA; 14 Dec 2012 13:01:38 +0100 Received: from fire (172.16.10.61) by smtp.prevas.se (172.16.8.105) with Microsoft SMTP Server id 14.2.318.4; Fri, 14 Dec 2012 13:01:38 +0100 Received: by fire (Postfix, from userid 30019) id 64022C0C6F; Fri, 14 Dec 2012 13:01:38 +0100 (CET) From: =?UTF-8?q?Kim=20B=C3=B8ndergaard?= To: Subject: [PATCH 1/1] makedevs: Improved handling of multiple device generation i.e. count > 0 in device table Date: Fri, 14 Dec 2012 13:01:35 +0100 Message-ID: <00e516dc8a1188982f4b5d229a0e428bca4a13f9.1355486138.git.kibo@prevas.dk> X-Mailer: git-send-email 1.8.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: dev@oe-lite.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: OE-lite development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dev-bounces@oe-lite.org Errors-To: dev-bounces@oe-lite.org --- recipes/makedevs/makedevs-1.0.0/makedevs.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/recipes/makedevs/makedevs-1.0.0/makedevs.c b/recipes/makedevs/makedevs-1.0.0/makedevs.c index c7ad722..4953d79 100644 --- a/recipes/makedevs/makedevs-1.0.0/makedevs.c +++ b/recipes/makedevs/makedevs-1.0.0/makedevs.c @@ -179,6 +179,10 @@ static void add_new_fifo(char *name, char *path, unsigned long uid, Regular files must exist in the target root directory. If a char, block, fifo, or directory does not exist, it will be created. + + count can be prepended with an 'h' to indicate the numbers to append must be hex. + I.e. if start, inc and count are 0,1,h12 respectively the devices will be appended with + 0,1,2....9,a,b and not 0,1,2....9,10,11 which is the case if 'h' is omitted */ static int interpret_table_entry(char *line) { @@ -186,14 +190,24 @@ static int interpret_table_entry(char *line) char path[4096], type; unsigned long mode = 0755, uid = 0, gid = 0, major = 0, minor = 0; unsigned long start = 0, increment = 1, count = 0; + char countstr[20+1]; + char*pcountstr = countstr; + int do_hex = 0; - if (0 > sscanf(line, "%40s %c %lo %lu %lu %lu %lu %lu %lu %lu", path, + if (0 > sscanf(line, "%40s %c %lo %lu %lu %lu %lu %lu %lu %20s", path, &type, &mode, &uid, &gid, &major, &minor, &start, - &increment, &count)) + &increment, &countstr)) { return 1; } + if (countstr[0] == 'h') { + pcountstr++; + do_hex = 1; + } + if (0 > sscanf(pcountstr,"%lu", &count)) { + return 1; + } if (!strcmp(path, "/")) { error_msg_and_die("Device table entries require absolute paths"); } @@ -222,7 +236,11 @@ static int interpret_table_entry(char *line) char buf[80]; for (i = start; i < count; i++) { - sprintf(buf, "%s%d", name, i); + if (do_hex) { + sprintf(buf, "%s%x", name, i); + } else { + sprintf(buf, "%s%d", name, i); + } /* FIXME: MKDEV uses illicit insider knowledge of kernel * major/minor representation... */ rdev = MKDEV(major, minor + (i * increment - start));