From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B76DDC43381 for ; Wed, 13 Mar 2019 06:57:22 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7D6C42075C for ; Wed, 13 Mar 2019 06:57:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D6C42075C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=vt.edu Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.91) (envelope-from ) id 1h3xow-0008K1-3S; Wed, 13 Mar 2019 02:56:58 -0400 Received: from omr1.cc.ipv6.vt.edu ([2607:b400:92:8300:0:c6:2117:b0e] helo=omr1.cc.vt.edu) by shelob.surriel.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1h3xou-0008Jv-2H for kernelnewbies@kernelnewbies.org; Wed, 13 Mar 2019 02:56:56 -0400 Received: from mr4.cc.vt.edu (mail.ipv6.vt.edu [IPv6:2607:b400:92:9:0:9d:8fcb:4116]) by omr1.cc.vt.edu (8.14.4/8.14.4) with ESMTP id x2D6usHv000986 for ; Wed, 13 Mar 2019 02:56:55 -0400 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by mr4.cc.vt.edu (8.14.7/8.14.7) with ESMTP id x2D6ungU013936 for ; Wed, 13 Mar 2019 02:56:54 -0400 Received: by mail-qk1-f200.google.com with SMTP id w134so716979qka.6 for ; Tue, 12 Mar 2019 23:56:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:in-reply-to:references :mime-version:date:message-id; bh=NHl5UXSbAgrvygl2F1I16Gtf47K+BJelR7+lhTTAhuc=; b=BFEp9yTtyAst8OLaD3itZCU5jDoiTGvxcFErpbxVYHPWuM6Br2FufLGZ9kKxrlnnKI RsxLHulBgVMXt29yHIzr4/UGUypItiLE5E9JnortH1G/Nl6zsJUVYwj3PchvcVK+T/y5 9tIsEn6xqx2Uny0bI4T/lCDQdo6hrrmVVewwcZG1WuXnPlAnrSDTeYYnrpIJkFFsBk/8 qgFW2XlHdNHa+yXmmi2woa9Jm6au6NoquFeYNGCdTv7lavjYIHKYonzldy9iNpXmkjxx JfNV2s8lXC4c7HNCE5CI7bOGg6zVsCqKutSRaaYejyHqUH++1gkvwoYzElBI5G+TdFgX dGSg== X-Gm-Message-State: APjAAAUqkWwhsP879vm6M2BFFMiLhMuk7qoXcG7Yeh1RmotMo3CnOUb1 Aij2vP2RQpwmQTkE+wPAnbIE7TXegkJfXc9Su/gfnw9+jRyNIcM+FS26c/UVXOON19ZTg8LTIG8 DI61F1fxPo7Hohg+YVdteiewuxx+o3N6abUeZfmk= X-Received: by 2002:ac8:21c9:: with SMTP id 9mr33255167qtz.78.1552460209130; Tue, 12 Mar 2019 23:56:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfVDa+S8BtML1CJEECOCQLmNzAK+8gEhI9Kjk7gTW6rfDP4BDsHL9J7paXbwRsTPOWDvX/Pg== X-Received: by 2002:ac8:21c9:: with SMTP id 9mr33255156qtz.78.1552460208932; Tue, 12 Mar 2019 23:56:48 -0700 (PDT) Received: from turing-police ([2601:5c0:c001:4341::3b7]) by smtp.gmail.com with ESMTPSA id 5sm7304654qtw.69.2019.03.12.23.56.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2019 23:56:47 -0700 (PDT) From: valdis.kletnieks@vt.edu X-Google-Original-From: Valdis.Kletnieks@vt.edu X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7+dev To: Jay Aurabind Subject: Re: Using binary attributes for configuration sysfs entries In-reply-to: References: Mime-Version: 1.0 Date: Wed, 13 Mar 2019 02:56:47 -0400 Message-ID: <27151.1552460207@turing-police> Cc: kernelnewbies X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org On Wed, 13 Mar 2019 12:02:02 +0530, Jay Aurabind said: > For the corresponding sysfs interface, since there are a lot of > parameters, would it be justified to use the same binary format though > sysfs_create_binary_file() ? The rationale is that it would be easier > to simply pack all the config options in the struct and send it in > once rather than individually write 40 files. This is what the > attached patch follows. Interface is added only for reception > parameters as of now. Sysfs has a rule of "one value per file" - and saying "the one value is the config struct we read/write to the file" is stretching that quite a bit. By the time you're doing all the marshaling of values in and out of this struct, there's no real benefit to do it via sysfs rather than the existing ioctl() call. Make sure you double-check that "the same binary format" means what you think it does when considering 32/64 bit architectures. While you're there, double check that the ioctl() works correctly for a 32-bit userspace program running on a 64-bit kernel - we have historically had an incredible number of API botches for that case. Of course, it helps your case considerably if you can point at something else in sysfs and say "The Foobar 9934 driver already does this".. :) On the other hand, having 40 files is just a massive race condition waiting to happen, especially if the device has hardware weirdness that imply that certain sets of (say) 3 or 5 parameters have to be changed in unison. _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies