return 0;
}
+int hw_mkdir(const char *dir) {
+ char tmp[STRING_SIZE];
+ char *p = NULL;
+ size_t len;
+ int r;
+
+ snprintf(tmp, sizeof(tmp),"%s",dir);
+ len = strlen(tmp);
+
+ if (tmp[len - 1] == '/') {
+ tmp[len - 1] = 0;
+ }
+
+ for (p = tmp + 1; *p; p++) {
+ if (*p == '/') {
+ *p = 0;
+
+ // Create target if it does not exist
+ if (access(tmp, X_OK) != 0) {
+ r = mkdir(tmp, S_IRWXU|S_IRWXG|S_IRWXO);
+
+ if (r) {
+ return r;
+ }
+ }
+
+ *p = '/';
+ }
+ }
+
+ // Create target if it does not exist
+ if (access(tmp, X_OK) != 0) {
+ r = mkdir(tmp, S_IRWXU|S_IRWXG|S_IRWXO);
+
+ if (r) {
+ return r;
+ }
+ }
+
+ return 0;
+}
+
+
int hw_create_btrfs_subvolume(const char* output, const char* subvolume) {
char command [STRING_SIZE];
int r;