lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87bo69y197.fsf@sejong.aot.lge.com>
Date:	Thu, 11 Jul 2013 17:00:36 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Jiri Olsa <jolsa@...hat.com>
Cc:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Paul Mackerras <paulus@...ba.org>,
	Ingo Molnar <mingo@...nel.org>,
	Namhyung Kim <namhyung.kim@....com>,
	LKML <linux-kernel@...r.kernel.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	David Ahern <dsahern@...il.com>,
	Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 09/19] perf ftrace: Add 'record' sub-command

On Wed, 10 Jul 2013 16:28:21 +0200, Jiri Olsa wrote:
> On Wed, Jun 26, 2013 at 04:14:12PM +0900, Namhyung Kim wrote:
>> From: Namhyung Kim <namhyung.kim@....com>
>
> SNIP
>
>> +
>> +static int create_perf_directory(struct perf_ftrace *ftrace)
>> +{
>> +	int err;
>> +	char buf[PATH_MAX];
>> +	struct stat statbuf;
>> +
>> +	scnprintf(buf, sizeof(buf), "%s.dir", ftrace->dirname);
>> +
>> +	if (stat(buf, &statbuf) == 0) {
>> +		/* same name already exists - rename to *.old.dir */
>> +		char *old_name = malloc(strlen(buf) + 5);
>> +		if (old_name == NULL)
>> +			return -1;
>> +
>> +		scnprintf(old_name, strlen(buf) + 5,
>> +			  "%s.old.dir", ftrace->dirname);
>> +
>> +		if (remove_directory(old_name) < 0) {
>> +			perror("rmdir");
>> +			return -1;
>> +		}
>> +
>> +		if (rename(buf, old_name) < 0) {
>> +			perror("rename");
>> +			free(old_name);
>> +			return -1;
>> +		}
>> +
>> +		free(old_name);
>> +	}
>> +
>> +	err = mkdir(buf, 0755);
>> +	if (err < 0) {
>> +		perror("mkdir");
>> +		return -1;
>> +	}
>> +
>> +	strcat(buf, "/perf.header");
>> +
>> +	err = open(buf, O_RDWR | O_CREAT | O_TRUNC, 0644);
>> +	return err;
>> +}
>
> nitpick.. should this be rather be called create_perf_header,
> which calls create_perf_directory inside?

Looks reasonable.  I'll change the name.

Thanks,
Namhyung
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ