Re: [PATCH] fsfreeze: suspend and resume access to an filesystem

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

 



On Tue, May 11, 2010 at 01:25:09AM -0400, Hajime Taira wrote:
>Hi,
>
>Here is patch that add new command fsfreeze.
>'fsfreeze' suspend and resume access to an filesystem (Linux Ext3/4, ReiserFS, JFS, XFS)
>It like xfs_freeze command for XFS filesystem. I ported one for other filesystem.
>Because util-linux-ng should have this. I think so.

<snip>

>+
>+int freeze_f(int fd)
>+{
>+	return ioctl(fd, FIFREEZE, 0);
>+}
>+
>+int unfreeze_f(int fd)
>+{
>+	return ioctl(fd, FITHAW, 0);
>+}
>+
>+void usage()

This needs to be "void usage(void)".


>+{
>+	fprintf(stderr, "fsfreeze -f | -u <mount point>\n");
>+	fprintf(stderr, "\n");
>+	fprintf(stderr, "fsfreeze -f /mnt/target\n");

The last message is not necessary.


>+}
>+
>+int main(int argc, char **argv)
>+{
>+	int fd;
>+	int ret = -1;
>+	char *path;
>+
>+	if(argc == 3)
>+	{
>+		path = argv[2];
>+		fd = open(path, O_WRONLY);
>+		if(fd < 0) {



Please keep one if-style in your code, either:

if (...) {
}

or:

if (...)
{
}


>+			if (errno == EISDIR) {
>+				fd = open(path, O_RDONLY);
>+				if (fd < 0) {
>+					perror(path);
>+					return ret;
>+				}
>+			} else {
>+				perror(path);
>+				return ret;
>+			}
>+		}

Do we have to do open() twice here? I doubt.

--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux