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=-5.0 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 ED2AAC4727C for ; Wed, 30 Sep 2020 17:03:41 +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 1E52920754 for ; Wed, 30 Sep 2020 17:03:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="keohTrt5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1E52920754 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94) (envelope-from ) id 1kNfVc-0001FT-S3; Wed, 30 Sep 2020 13:03:16 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1kNfVa-0001FO-Jl for kernelnewbies@kernelnewbies.org; Wed, 30 Sep 2020 13:03:14 -0400 Received: by mail-pg1-x536.google.com with SMTP id 7so1434134pgm.11 for ; Wed, 30 Sep 2020 10:03:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=+o+e3J9UokTkzvJVnsf5ZuXmuxDWYsu53LlztRZcZpc=; b=keohTrt5UF3t/ZHYEW2OR2aK9PRthOWkpBak7pzFeUeJgEPwyYS+9N06TYMhjuKrx3 wc6HRJQm1r5XA5QhmENscEVvf8t7/JNcAe32lszBPZ0jjdtLMxJvH10s4qeN6KXIGJ23 NXUVl36G8dWwrWZG7unr1hO47huB/TbvAX/0wFecuC3j6Sfy90g+F/55kc05y1bI1X2B a8UNJIVjSi6MBKeg3jIL3wbSGxkFT16vbebHqYiRGKDiluUDVI0e6AfsHuJbtV0hB8nh 1Yf2G7J5eRvVPKMrm+A/uIrStgoE0n3H9BddaBSs9EIYQ8NeGcI1X1U0Qj2MN7/Hpx/H makQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=+o+e3J9UokTkzvJVnsf5ZuXmuxDWYsu53LlztRZcZpc=; b=Zso0BU0YThjhFt0ejVH/HKltpSEOb0fVXojzq8V8xiFHBB5sOo53vnuug4o1JktZrW 4aOh9ubWsZciNgUnQTEHjmoVF8Ap50RU8sTLhLbXoZZgwi0FcWtqrLp5i2q8JAZ9OV2u 8s2wOS1oyv86ZttR7rGxhA0vIcXNskqVffYJCHQEEw7zzes51HaEpqkZiohZ/GFLQsoe HfvSPd9O5syivXn3EKbIqJGI35Xo/vdZUzvanYe9FEPTPtN9U8on0XbuGSBYRNdbz6ce D/kk//KHSWSK4TLItMzdqfpxXHOs0f+3O3NQIzUDxPCWMMpnPEf96tloaM1DKQy7pIvA nt/g== X-Gm-Message-State: AOAM530Pkpel7zkmfo9fj7aNjYAyHvfCwVTlRfCW/rv9cj2YJsCwvHk9 1NZg9Yc911ZSkL5ngNrvZ6tUPWXSyeg= X-Google-Smtp-Source: ABdhPJzX4iJX/fUUm+Wd1UsjyQ1iqi+xvVUB3F6LKxlsiFSRdpjw4bgFP23gzlQ2qj8+MZmXNY5s5A== X-Received: by 2002:a62:19c1:0:b029:13c:1611:6529 with SMTP id 184-20020a6219c10000b029013c16116529mr3184238pfz.9.1601485329224; Wed, 30 Sep 2020 10:02:09 -0700 (PDT) Received: from [10.149.182.253] ([49.205.253.183]) by smtp.gmail.com with ESMTPSA id c12sm3234243pfj.164.2020.09.30.10.02.06 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 30 Sep 2020 10:02:07 -0700 (PDT) To: kernelnewbies@kernelnewbies.org From: ymdatta Subject: Accessing allocated space in a debugfs file Message-ID: Date: Wed, 30 Sep 2020 22:32:05 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 Content-Language: en-US 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 Hello everyone, I am trying to create a debugfs file for exposing some information to the userspace. (I am exploring on how to use debugfs) >From the documentation (Documentation/filesystems/debugfs.txt), i came across a function called struct dentry *debugfs_create_file_size(...,loff_t file_size); This essentially creates a file with an initial size. I want to write in this file, how should i be accessing the space created from previous function call. I have looked through the source code, but i have found very few places where this function is used. In one of the use cases [0], the memory equal to the size is allocated in the open file operation, and the private_data member is pointed to this. (Looking at [0] helps in understanding this). But from #kernelnewbies channel, i found that private_data is a pointer for tty/char drivers. Thanks for the help. [0]: https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/udc/atmel_usba_udc.c#L140 ymdatta. _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies