lscp & friends: indicate filesystem by directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux BTRFS]     [Linux CIFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux