Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-9537 utils: implement "lfs getstripe --fid" for directories
[fs/lustre-release.git]
/
lustre
/
utils
/
lfs_project.c
diff --git
a/lustre/utils/lfs_project.c
b/lustre/utils/lfs_project.c
index
f16d825
..
8471c6d
100644
(file)
--- a/
lustre/utils/lfs_project.c
+++ b/
lustre/utils/lfs_project.c
@@
-51,9
+51,11
@@
#include "lfs_project.h"
#include <lustre/lustreapi.h>
#include "lfs_project.h"
#include <lustre/lustreapi.h>
+const char *progname;
+
struct lfs_project_item {
struct list_head lpi_list;
struct lfs_project_item {
struct list_head lpi_list;
- char
lpi_pathname[PATH_MAX]
;
+ char
*lpi_pathname
;
};
static int
};
static int
@@
-69,8
+71,12
@@
lfs_project_item_alloc(struct list_head *head, const char *pathname)
return -ENOMEM;
}
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 0;
}
@@
-118,7
+124,7
@@
static int project_get_xattr(const char *pathname, struct fsxattr *fsx,
return -errno;
}
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 (ret) {
fprintf(stderr, "%s: failed to get xattr for '%s': %s\n",
progname, pathname, strerror(errno));
@@
-207,7
+213,7
@@
project_set_one(const char *pathname, struct project_handle_control *phc)
if (phc->set_projid)
fsx.fsx_projid = phc->projid;
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 (ret)
fprintf(stderr, "%s: failed to set xattr for '%s': %s\n",
progname, pathname, strerror(errno));
@@
-235,7
+241,7
@@
project_clear_one(const char *pathname, struct project_handle_control *phc)
if (!phc->keep_projid)
fsx.fsx_projid = 0;
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));
if (ret)
fprintf(stderr, "%s: failed to set xattr for '%s': %s\n",
progname, pathname, strerror(errno));
@@
-334,6
+340,7
@@
static int lfs_project_iterate(const char *pathname,
phc, func);
if (!ret && rc)
ret = rc;
phc, func);
if (!ret && rc)
ret = rc;
+ free(lpi->lpi_pathname);
free(lpi);
}
free(lpi);
}
@@
-341,26
+348,26
@@
static int lfs_project_iterate(const char *pathname,
}
}
-in
line in
t 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);
}
{
return lfs_project_iterate(pathname, phc, project_check_one);
}
-in
line in
t 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);
}
{
return lfs_project_iterate(pathname, phc, project_clear_one);
}
-in
line in
t 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);
}
{
return lfs_project_iterate(pathname, phc, project_set_one);
}
-in
line in
t 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);
}
{
return lfs_project_iterate(pathname, phc, project_list_one);
}