<commit_before>/**
 * xrdp: A Remote Desktop Protocol server.
 *
 * Copyright (C) <NAME> 2013 <EMAIL>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * TODO
 *      o need to support sym links
 *      o when creating dir/file, ensure it does not already exist
 *      o enable changing metadata for files/folders (time, owner, mode etc)
 *      o do not allow dirs to be created in ino==1 except for .clipbard and share mounts
 *      o xrdp_fs needs to grow dynamically - currently it is fixed at 1k or 4k
 *      o fix the HACK where I have to use my own buf instead of g_buffer
 *        this is in func xfuse_check_wait_objs()
 *      o if fuse mount point is already mounted, I get segfault
 *      o in open, check for modes such as O_TRUNC, O_APPEND
 *      o copying over an existing file does not work
 *      o are we calling close?
 *      o need to keep track of open files, reqd during rename
 *      o fuse ops to support
 *          o rename (mv)
 *          o touch does not work
 *          o mknod (may not be required if create is correctly implemented)
 *          o symlink
 *          o keep track of lookup_count
 *          o chmod must work
 *          o cat >> file is not working
 *
 */

/* FUSE mount point */
char g_fuse_root_path[256] = "";

#ifndef XRDP_FUSE

/******************************************************************************
**                                                                           **
**                   when FUSE is NOT enabled in xrdp                        **
**                                                                           **
******************************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "arch.h"
#include "chansrv_fuse.h"

/* dummy calls when XRDP_FUSE is not defined */
int xfuse_init()                {}
int xfuse_deinit()              {}
int xfuse_check_wait_objs(void) {}
int xfuse_get_wait_objs(tbus *objs, int *count, int *timeout) {}
int xfuse_clear_clip_dir(void)  {}
int xfuse_file_contents_range(int stream_id, char *data, int data_bytes)     {}
int xfuse_file_contents_size(int stream_id, int file_size)                   {}
int xfuse_add_clip_dir_item(char *filename, int flags, int size, int lindex) {}
int xfuse_create_share(tui32 device_id, char *dirname)                       {}
void xfuse_devredir_cb_open_file(void *vp, tui32 DeviceId, tui32 FileId)     {}
void xfuse_devredir_cb_write_file(void *vp, char *buf, size_t length)        {}
void xfuse_devredir_cb_read_file(void *vp, char *buf, size_t length)         {}
void xfuse_devredir_cb_enum_dir(void *vp, struct xrdp_inode *xinode)         {}
void xfuse_devredir_cb_enum_dir_done(void *vp, tui32 IoStatus)               {}

#else

/******************************************************************************
**                                                                           **
**                     when FUSE is enabled in xrdp                          **
**                                                                           **
******************************************************************************/<commit_msg>o added some dummy functions to stop build from breaking   when --enable-fuse is not specified<commit_after>/**
 * xrdp: A Remote Desktop Protocol server.
 *
 * Copyright (C) <NAME> 2013 <EMAIL>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * TODO
 *      o need to support sym links
 *      o when creating dir/file, ensure it does not already exist
 *      o enable changing metadata for files/folders (time, owner, mode etc)
 *      o do not allow dirs to be created in ino==1 except for .clipbard and share mounts
 *      o xrdp_fs needs to grow dynamically - currently it is fixed at 1k or 4k
 *      o fix the HACK where I have to use my own buf instead of g_buffer
 *        this is in func xfuse_check_wait_objs()
 *      o if fuse mount point is already mounted, I get segfault
 *      o in open, check for modes such as O_TRUNC, O_APPEND
 *      o copying over an existing file does not work
 *      o are we calling close?
 *      o need to keep track of open files, reqd during rename
 *      o fuse ops to support
 *          o rename (mv)
 *          o touch does not work
 *          o mknod (may not be required if create is correctly implemented)
 *          o symlink
 *          o keep track of lookup_count
 *          o chmod must work
 *          o cat >> file is not working
 *
 */

/* FUSE mount point */
char g_fuse_root_path[256] = "";

#ifndef XRDP_FUSE

/******************************************************************************
**                                                                           **
**                   when FUSE is NOT enabled in xrdp                        **
**                                                                           **
******************************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "arch.h"
#include "chansrv_fuse.h"

/* dummy calls when XRDP_FUSE is not defined */
int xfuse_init()                {}
int xfuse_deinit()              {}
int xfuse_check_wait_objs(void) {}
int xfuse_get_wait_objs(tbus *objs, int *count, int *timeout) {}
int xfuse_clear_clip_dir(void)  {}
int xfuse_file_contents_range(int stream_id, char *data, int data_bytes)     {}
int xfuse_file_contents_size(int stream_id, int file_size)                   {}
int xfuse_add_clip_dir_item(char *filename, int flags, int size, int lindex) {}
int xfuse_create_share(tui32 device_id, char *dirname)                       {}
void xfuse_devredir_cb_open_file(void *vp, tui32 DeviceId, tui32 FileId)     {}
void xfuse_devredir_cb_write_file(void *vp, char *buf, size_t length)        {}
void xfuse_devredir_cb_read_file(void *vp, char *buf, size_t length)         {}
void xfuse_devredir_cb_enum_dir(void *vp, struct xrdp_inode *xinode)         {}
void xfuse_devredir_cb_enum_dir_done(void *vp, tui32 IoStatus)               {}
void xfuse_devredir_cb_rmdir_or_file(void *vp, tui32 IoStatus)               {}
void xfuse_devredir_cb_file_close(void *vp)                                  {}

#else

/******************************************************************************
**                                                                           **
**                     when FUSE is enabled in xrdp                          **
**                                                                           **
******************************************************************************/
{'fraction_non_alphanumeric': 0.15018936920464934, 'fraction_numerical': 0.006007574768185974, 'mean_word_length': 2.210901467505241, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 25, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1051946', 'n_tokens_mistral': 2096, 'n_tokens_neox': 2007, 'n_words': 752}