#include "lfs_project.h"
#include <lustre/lustreapi.h>
+const char *progname;
+
struct lfs_project_item {
struct list_head lpi_list;
- char lpi_pathname[PATH_MAX];
+ char *lpi_pathname;
};
static int
return -ENOMEM;
}
- strncpy(lpi->lpi_pathname, pathname, sizeof(lpi->lpi_pathname) - 1);
- list_add_tail(&lpi->lpi_list, head);
+ lpi->lpi_pathname = strdup(pathname);
+ if (!lpi->lpi_pathname) {
+ free(lpi);
+ return -ENOMEM;
+ } else
+ list_add_tail(&lpi->lpi_list, head);
return 0;
}
return -errno;
}
- ret = ioctl(fd, LL_IOC_FSGETXATTR, fsx);
+ ret = ioctl(fd, FS_IOC_FSGETXATTR, fsx);
if (ret) {
fprintf(stderr, "%s: failed to get xattr for '%s': %s\n",
progname, pathname, strerror(errno));
if (phc->set_projid)
fsx.fsx_projid = phc->projid;
- ret = ioctl(fd, LL_IOC_FSSETXATTR, &fsx);
+ ret = ioctl(fd, FS_IOC_FSSETXATTR, &fsx);
if (ret)
fprintf(stderr, "%s: failed to set xattr for '%s': %s\n",
progname, pathname, strerror(errno));
if (!phc->keep_projid)
fsx.fsx_projid = 0;
- ret = ioctl(fd, LL_IOC_FSSETXATTR, &fsx);
+ ret = ioctl(fd, FS_IOC_FSSETXATTR, &fsx);
if (ret)
fprintf(stderr, "%s: failed to set xattr for '%s': %s\n",
progname, pathname, strerror(errno));
phc, func);
if (!ret && rc)
ret = rc;
+ free(lpi->lpi_pathname);
free(lpi);
}
}
-inline int lfs_project_check(const char *pathname,
- struct project_handle_control *phc)
+int lfs_project_check(const char *pathname,
+ struct project_handle_control *phc)
{
return lfs_project_iterate(pathname, phc, project_check_one);
}
-inline int lfs_project_clear(const char *pathname,
- struct project_handle_control *phc)
+int lfs_project_clear(const char *pathname,
+ struct project_handle_control *phc)
{
return lfs_project_iterate(pathname, phc, project_clear_one);
}
-inline int lfs_project_set(const char *pathname,
- struct project_handle_control *phc)
+int lfs_project_set(const char *pathname,
+ struct project_handle_control *phc)
{
return lfs_project_iterate(pathname, phc, project_set_one);
}
-inline int lfs_project_list(const char *pathname,
- struct project_handle_control *phc)
+int lfs_project_list(const char *pathname,
+ struct project_handle_control *phc)
{
return lfs_project_iterate(pathname, phc, project_list_one);
}