Linux NILFS development
 help / color / mirror / Atom feed
From: dexen deVries <dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: lscp & friends: indicate filesystem by directory
Date: Mon, 7 Mar 2011 10:51:25 +0100	[thread overview]
Message-ID: <201103071051.25290.dexen.devries@gmail.com> (raw)

Hi,

I've suspended issuing my current patches for lscp & friends till I implement 
the functionality Ryusuke mentioned.

Please review the following sketch of algorithm for all interactive utils:

char *dev, *dir, *object;
char canonical[PATH_MAX + 2];
struct stat statbuffer;

dev = dir = object = NULL;

if (optind < argc)
                object = argv[optind++];

if (object) {
	stat(object, &statbuffer);
	if (S_ISDIR(statbuffer))
		dir = myrealpath(object, canonical, sizeof(canonical));
	else
		dev = myrealpath(object, canonical, sizeof(canonical));
}
else
	dir = getwd(canonical);

/* a new function; traverses directory hierarchy up till it reaches nilfs 
mountpoint */
if (dir)
	dir = up_to_nilfs_mountpoint(dir);  

nilfs_open(dev, dir, ...);


The main difference to the current version is:
if no object is explicitly indicated on the command line, the tool uses 
current working directory. Thus by default it'd operate on the filesystem 
holding the current working directory -- rather than the first NILFS2 in 
/proc/mounts as it does currently.

To indicate which filesystem is to be used, I'd like to print a header line 
roughly like:
# device: /dev/sdb3

What's your opinion?
-- 
dexen deVries

[[[↓][→]]]

47. As Will Rogers would have said, "There is no such thing as a free 
variable."

(Alan Perlis, `Epigrams on Programming')
--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2011-03-07  9:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-07  9:51 dexen deVries [this message]
     [not found] ` <201103071051.25290.dexen.devries-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-03-08  2:31   ` lscp & friends: indicate filesystem by directory Ryusuke Konishi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201103071051.25290.dexen.devries@gmail.com \
    --to=dexen.devries-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox