2014-09-27 06:31:22 +08:00
|
|
|
/*
|
2016-01-15 05:50:22 +08: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.
|
2014-09-27 06:31:22 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.hpp"
|
2015-09-09 03:56:02 +08:00
|
|
|
#include "ugid.hpp"
|
2014-09-27 06:31:22 +08:00
|
|
|
|
2019-01-25 20:03:46 +08:00
|
|
|
#include <fuse.h>
|
|
|
|
|
2019-05-20 03:18:36 +08:00
|
|
|
namespace l
|
|
|
|
{
|
|
|
|
void
|
|
|
|
want_if_capable(fuse_conn_info *conn_,
|
|
|
|
const int flag_)
|
|
|
|
{
|
|
|
|
if(conn_->capable & flag_)
|
|
|
|
conn_->want |= flag_;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-25 20:03:46 +08:00
|
|
|
namespace FUSE
|
2014-09-27 06:31:22 +08:00
|
|
|
{
|
2019-01-25 20:03:46 +08:00
|
|
|
void *
|
|
|
|
init(fuse_conn_info *conn_)
|
2014-09-27 06:31:22 +08:00
|
|
|
{
|
2019-01-25 20:03:46 +08:00
|
|
|
ugid::init();
|
2015-09-09 03:56:02 +08:00
|
|
|
|
2019-05-20 03:18:36 +08:00
|
|
|
l::want_if_capable(conn_,FUSE_CAP_ASYNC_READ);
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_ATOMIC_O_TRUNC);
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_BIG_WRITES);
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_DONT_MASK);
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_IOCTL_DIR);
|
2019-05-20 12:18:56 +08:00
|
|
|
l::want_if_capable(conn_,FUSE_CAP_ASYNC_DIO);
|
2019-05-20 12:36:42 +08:00
|
|
|
l::want_if_capable(conn_,FUSE_CAP_PARALLEL_DIROPS);
|
2019-05-20 03:18:36 +08:00
|
|
|
if(Config::get().posix_acl)
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_POSIX_ACL);
|
2014-09-27 06:31:22 +08:00
|
|
|
|
2019-01-25 20:03:46 +08:00
|
|
|
return &Config::get_writable();
|
2014-09-27 06:31:22 +08:00
|
|
|
}
|
|
|
|
}
|