2019-01-25 07:03:46 -05:00
|
|
|
/*
|
|
|
|
|
Copyright (c) 2016, Antonio SJ Musumeci <trapexit@spawn.link>
|
|
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
|
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
2025-07-25 17:53:48 -05:00
|
|
|
#include "fuse_removexattr.hpp"
|
|
|
|
|
|
2019-01-25 07:03:46 -05:00
|
|
|
#include "config.hpp"
|
|
|
|
|
#include "errno.hpp"
|
|
|
|
|
|
2020-12-19 15:06:08 -05:00
|
|
|
#include "fuse.h"
|
2019-01-25 07:03:46 -05:00
|
|
|
|
|
|
|
|
|
2025-07-25 17:53:48 -05:00
|
|
|
int
|
2025-10-13 00:21:36 -04:00
|
|
|
FUSE::removexattr(const fuse_req_ctx_t *ctx_,
|
|
|
|
|
const char *fusepath_,
|
|
|
|
|
const char *attrname_)
|
2019-01-25 07:03:46 -05:00
|
|
|
{
|
2025-09-17 23:51:16 -04:00
|
|
|
const fs::path fusepath{fusepath_};
|
|
|
|
|
|
|
|
|
|
if(Config::is_ctrl_file(fusepath))
|
2025-11-13 20:45:52 -06:00
|
|
|
return -EROFS;
|
2025-07-25 17:53:48 -05:00
|
|
|
|
2025-09-06 12:03:51 -04:00
|
|
|
if(cfg.xattr.to_int())
|
|
|
|
|
return -cfg.xattr.to_int();
|
2025-07-25 17:53:48 -05:00
|
|
|
|
2025-11-13 20:45:52 -06:00
|
|
|
return cfg.removexattr(cfg.branches,
|
|
|
|
|
fusepath,
|
|
|
|
|
attrname_);
|
2019-01-25 07:03:46 -05:00
|
|
|
}
|