-------- Original Message -------- From: Otto Moerbeek <o...@drijf.net> To: bytevolc...@safe-mail.net Cc: tech@openbsd.org Subject: Re: [PATCH] Option for mount_tmpfs to populate the volume aftercreation. Date: Thu, 18 Sep 2014 10:54:34 +0200
> On Thu, Sep 18, 2014 at 08:40:44AM +0100, bytevolc...@safe-mail.net wrote: > > > This patch adds an option "-t template" to mount_tmpfs, which > > populates the new tmpfs volume with a directory > > immediately after creation. > > > > Man page update included for explanation. > > > > Much of the code was grafted from newfs > > which implements this for mount_mfs ("-P" option). > > > > Suggestions, fixes, criticism, etc. welcome. > > - Please do not mix the argument parsing changes with the new > functionality changes. Post separate diffs for that, Thanks for the info. Will fix set of diffs. > although I do not > see the point of removing mount_tmpfs_parseargs(). My rationale for this is as follows: in order for the new code to work, I need to store the user-provided template path somewhere. I could add an extra parameter to mount_tmpfs_parseargs() as one of the following: 1. char ** - risk optarg may change after the function has returned, assuming wanted to call getopt() after calling mount_tmpfs_parseargs() later on when they edit the code further 2. char* - point to yet another buffer allocated just to store the template path. Much better than above. Rather than going through one of the above, I thought a neater solution would be how newfs handles this, so I integrated mount_tmpfs_parseargs() into its caller. The code for tmpfs_parseargs() itself isn't removed; just relocated. That being said, if having this as a separate function will make the overall code easier to maintain, I'll work around it. It does not seem too difficult. > - Why use a different flag compared to mount_mfs? Mostly a semantics thing IMO. I just thought it made more sense to use "-t" as in "template", since most file attributes are copied over, as opposed to just "let's populate the directory with a bunch of files." As I was updating the man page I was thinking about whether to use "-t" or "-P", but then I figured "let's see what the devs think first." The next diff will end up using "-P" instead then based on your input. > - What's pathnames.h doing here? I thought it would be a good idea to include it in the diff in the same directory as I wasn't sure if this would compile on another person's machine; it compiles and works fine on mine though. I wasn't sure how include directories (#include "...") worked in the source tree so this was a just-in-case measure. If not needed, I am somewhat relieved. > -Otto - Adam.