On Wed, Jun 26, 2013 at 04:14:12PM +0900, Namhyung Kim wrote:
> From: Namhyung Kim <[email protected]>

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?

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to