X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fsrc%2Ffstool.c;h=d49383184fd769bbd38f4bfc4ef88f94960dbe10;hb=a917f24ef7b003dcef54a3db2644cf9cb4bc2db2;hp=74ebc1461f40fb21d1b11ac7fc49a2f20bf613f7;hpb=41c991741920c98d978150842d9e06875cc32964;p=util-vserver.git diff --git a/util-vserver/src/fstool.c b/util-vserver/src/fstool.c index 74ebc14..d493831 100644 --- a/util-vserver/src/fstool.c +++ b/util-vserver/src/fstool.c @@ -22,15 +22,21 @@ #include "fstool.h" #include "util.h" -#include "wrappers.h" -#include "wrappers-dirent.h" #include #include #include #include +#include +#include +#include +#include +#define ENSC_WRAPPERS_DIRENT 1 +#define ENSC_WRAPPERS_FCNTL 1 +#define ENSC_WRAPPERS_UNISTD 1 +#include struct Arguments const * global_args = 0; @@ -90,7 +96,7 @@ iterateFilesystem(char const *path) // show current directory entry first if (lstat(".", &cur_st)==-1) perror("lstat()"); - else err += handleFile(".", path, &cur_st) ? 0 : 1; + else err += handleFile(".", path) ? 0 : 1; // strip trailing '/' while (path_len>0 && path[path_len-1]=='/') --path_len; @@ -116,7 +122,7 @@ iterateFilesystem(char const *path) { CONCAT_PATHS(path, path_len, ent->d_name); - err += handleFile(ent->d_name, new_path, &st) ? 0 : 1; + err += handleFile(ent->d_name, new_path) ? 0 : 1; } } @@ -177,7 +183,7 @@ processFile(char const *path) return iterateFilesystem(path); } else - return handleFile(path, path, &st); + return handleFile(path, path) ? 0 : 1; } int main(int argc, char *argv[]) @@ -189,13 +195,13 @@ int main(int argc, char *argv[]) .do_display_dot = false, .do_display_dir = false, .do_mapping = true, - .immutable = false, - .immulink = false, .ctx = VC_NOCTX, .is_legacy = false, .do_set = false, .do_unset = false, .local_fs = false, + .set_mask = 0, + .del_mask = 0 }; global_args = &args; @@ -207,9 +213,18 @@ int main(int argc, char *argv[]) switch (c) { case CMD_HELP : showHelp(1, argv[0], 0); case CMD_VERSION : showVersion(); - case CMD_IMMUTABLE : args.immutable = true; break; - case CMD_IMMULINK : args.immulink = true; break; - case CMD_LEGACY : args.is_legacy = true; break; + case CMD_IMMU : args.set_mask |= VC_IATTR_IMMUTABLE; /*@fallthrough@*/ + case CMD_IMMUX : args.set_mask |= VC_IATTR_IUNLINK; break; + case CMD_ADMIN : args.set_mask |= VC_IATTR_ADMIN; break; + case CMD_WATCH : args.set_mask |= VC_IATTR_WATCH; break; + case CMD_HIDE : args.set_mask |= VC_IATTR_HIDE; break; + case CMD_BARRIER : args.set_mask |= VC_IATTR_BARRIER; break; + case CMD_UNSET_IMMU : args.del_mask |= VC_IATTR_IMMUTABLE; /*@fallthrough@*/ + case CMD_UNSET_IMMUX : args.del_mask |= VC_IATTR_IUNLINK; break; + case CMD_UNSET_ADMIN : args.del_mask |= VC_IATTR_ADMIN; break; + case CMD_UNSET_WATCH : args.del_mask |= VC_IATTR_WATCH; break; + case CMD_UNSET_HIDE : args.del_mask |= VC_IATTR_HIDE; break; + case CMD_UNSET_BARRIER : args.del_mask |= VC_IATTR_BARRIER; break; case 'R' : args.do_recurse = true; break; case 'a' : args.do_display_dot = true; break; case 'd' : args.do_display_dir = true; break;