blob: 56fbf202379cee5838f7e3b4ae705b48230e9ebd [file] [log] [blame]
// Copyright 2019 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SMBFS_SMBFS_DAEMON_H_
#define SMBFS_SMBFS_DAEMON_H_
#include <fuse_lowlevel.h>
#include <sys/types.h>
#include <memory>
#include <string>
#include <base/files/file_path.h>
#include <base/files/scoped_temp_dir.h>
#include <base/macros.h>
#include <brillo/daemons/dbus_daemon.h>
namespace smbfs {
class Filesystem;
class FuseSession;
struct Options;
class SmbFsDaemon : public brillo::DBusDaemon {
public:
SmbFsDaemon(fuse_chan* chan, const Options& options);
~SmbFsDaemon() override;
protected:
// brillo::Daemon overrides.
int OnInit() override;
int OnEventLoopStarted() override;
private:
// Set up libsmbclient configuration files.
bool SetupSmbConf();
// Returns the full path to the given kerberos configuration file.
base::FilePath KerberosConfFilePath(const std::string& file_name);
fuse_chan* chan_;
const bool use_test_fs_;
const std::string share_path_;
const uid_t uid_;
const gid_t gid_;
const std::string mojo_id_;
std::unique_ptr<FuseSession> session_;
std::unique_ptr<Filesystem> fs_;
base::ScopedTempDir temp_dir_;
DISALLOW_COPY_AND_ASSIGN(SmbFsDaemon);
};
} // namespace smbfs
#endif // SMBFS_SMBFS_DAEMON_H_