+int op_create_dir(char *name, int stripe_count)
+{
+ struct ll_user_mkdir_stripe lums = { 0 };
+ int fd, rc = 0;
+ char *dot = ".";
+ char *dirname;
+
+ dirname = rindex(name, '/');
+ if (!dirname) {
+ dirname = "name";
+ name = dot;
+ } else {
+ *dirname = 0;
+ dirname++;
+ }
+ lums.lums_nstripes = stripe_count;
+ lums.lums_namelen = strlen(dirname);
+ lums.lums_name = dirname;
+ /* XXX: Probably users might want to specify permissions as well? */
+ lums.lums_mode = 0755;
+
+ fd = open(name, O_RDONLY|O_DIRECTORY);
+ if (name != dot)
+ *(dirname-1) = '/';
+ if (fd < 0) {
+ err_msg("unable to open '%s'",name);
+ rc = -errno;
+ return rc;
+ }
+
+ if (ioctl(fd, LL_IOC_MDC_MKDIRSTRIPE, &lums)) {
+ char *errmsg = strerror(errno);
+
+ fprintf(stderr, "error on ioctl for '%s' (%d): %s\n",
+ name, fd, errmsg);
+ rc = -errno;
+ }
+ if (close(fd) < 0) {
+ err_msg("error on close for '%s' (%d)", name, fd);
+ if (rc == 0)
+ rc = -errno;
+ }
+ return rc;
+}
+
+/* short term backwards compat only */
+int op_create_file(char *name, long stripe_size, int stripe_offset,
+ int stripe_count)
+{
+ return llapi_file_create(name, stripe_size, stripe_offset,
+ stripe_count, 0);
+}
+