-int cg_create(const char *controller, const char *path) {
- char *fs;
- int r;
-
- assert(controller);
- assert(path);
-
- if ((r = cg_get_path(controller, path, NULL, &fs)) < 0)
- return r;
-
- r = mkdir_parents(fs, 0755);
-
- if (r >= 0) {
- if (mkdir(fs, 0755) >= 0)
- r = 1;
- else if (errno == EEXIST)
- r = 0;
- else
- r = -errno;
- }
-
- free(fs);
-
- return r;
-}
-