mirror of https://github.com/xemu-project/xemu.git
virtiofsd: Format imported files to qemu style
Mostly using a set like: indent -nut -i 4 -nlp -br -cs -ce --no-space-after-function-call-names file clang-format -style=file -i -- file clang-tidy -fix-errors -checks=readability-braces-around-statements file clang-format -style=file -i -- file With manual cleanups. The .clang-format used is below. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed by: Aleksandar Markovic <amarkovic@wavecomp.com> Language: Cpp AlignAfterOpenBracket: Align AlignConsecutiveAssignments: false # although we like it, it creates churn AlignConsecutiveDeclarations: false AlignEscapedNewlinesLeft: true AlignOperands: true AlignTrailingComments: false # churn AllowAllParametersOfDeclarationOnNextLine: true AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: None AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false AlwaysBreakAfterReturnType: None # AlwaysBreakAfterDefinitionReturnType is taken into account AlwaysBreakBeforeMultilineStrings: false BinPackArguments: true BinPackParameters: true BraceWrapping: AfterControlStatement: false AfterEnum: false AfterFunction: true AfterStruct: false AfterUnion: false BeforeElse: false IndentBraces: false BreakBeforeBinaryOperators: None BreakBeforeBraces: Custom BreakBeforeTernaryOperators: false BreakStringLiterals: true ColumnLimit: 80 ContinuationIndentWidth: 4 Cpp11BracedListStyle: false DerivePointerAlignment: false DisableFormat: false ForEachMacros: [ 'CPU_FOREACH', 'CPU_FOREACH_REVERSE', 'CPU_FOREACH_SAFE', 'IOMMU_NOTIFIER_FOREACH', 'QLIST_FOREACH', 'QLIST_FOREACH_ENTRY', 'QLIST_FOREACH_RCU', 'QLIST_FOREACH_SAFE', 'QLIST_FOREACH_SAFE_RCU', 'QSIMPLEQ_FOREACH', 'QSIMPLEQ_FOREACH_SAFE', 'QSLIST_FOREACH', 'QSLIST_FOREACH_SAFE', 'QTAILQ_FOREACH', 'QTAILQ_FOREACH_REVERSE', 'QTAILQ_FOREACH_SAFE', 'QTAILQ_RAW_FOREACH', 'RAMBLOCK_FOREACH' ] IncludeCategories: - Regex: '^"qemu/osdep.h' Priority: -3 - Regex: '^"(block|chardev|crypto|disas|exec|fpu|hw|io|libdecnumber|migration|monitor|net|qapi|qemu|qom|standard-headers|sysemu|ui)/' Priority: -2 - Regex: '^"(elf.h|qemu-common.h|glib-compat.h|qemu-io.h|trace-tcg.h)' Priority: -1 - Regex: '.*' Priority: 1 IncludeIsMainRegex: '$' IndentCaseLabels: false IndentWidth: 4 IndentWrappedFunctionNames: false KeepEmptyLinesAtTheStartOfBlocks: false MacroBlockBegin: '.*_BEGIN$' # only PREC_BEGIN ? MacroBlockEnd: '.*_END$' MaxEmptyLinesToKeep: 2 PointerAlignment: Right ReflowComments: true SortIncludes: true SpaceAfterCStyleCast: false SpaceBeforeAssignmentOperators: true SpaceBeforeParens: ControlStatements SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 SpacesInContainerLiterals: true SpacesInParentheses: false SpacesInSquareBrackets: false Standard: Auto UseTab: Never ... Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
a3e23f3254
commit
7387863d03
|
@ -1,12 +1,12 @@
|
||||||
/*
|
/*
|
||||||
FUSE: Filesystem in Userspace
|
* FUSE: Filesystem in Userspace
|
||||||
Copyright (C) 2010 Miklos Szeredi <miklos@szeredi.hu>
|
* Copyright (C) 2010 Miklos Szeredi <miklos@szeredi.hu>
|
||||||
|
*
|
||||||
Functions for dealing with `struct fuse_buf` and `struct
|
* Functions for dealing with `struct fuse_buf` and `struct
|
||||||
fuse_bufvec`.
|
* fuse_bufvec`.
|
||||||
|
*
|
||||||
This program can be distributed under the terms of the GNU LGPLv2.
|
* This program can be distributed under the terms of the GNU LGPLv2.
|
||||||
See the file COPYING.LIB
|
* See the file COPYING.LIB
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
@ -14,10 +14,10 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "fuse_i.h"
|
#include "fuse_i.h"
|
||||||
#include "fuse_lowlevel.h"
|
#include "fuse_lowlevel.h"
|
||||||
|
#include <assert.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
size_t fuse_buf_size(const struct fuse_bufvec *bufv)
|
size_t fuse_buf_size(const struct fuse_bufvec *bufv)
|
||||||
{
|
{
|
||||||
|
@ -25,11 +25,12 @@ size_t fuse_buf_size(const struct fuse_bufvec *bufv)
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
|
|
||||||
for (i = 0; i < bufv->count; i++) {
|
for (i = 0; i < bufv->count; i++) {
|
||||||
if (bufv->buf[i].size == SIZE_MAX)
|
if (bufv->buf[i].size == SIZE_MAX) {
|
||||||
size = SIZE_MAX;
|
size = SIZE_MAX;
|
||||||
else
|
} else {
|
||||||
size += bufv->buf[i].size;
|
size += bufv->buf[i].size;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
@ -54,16 +55,19 @@ static ssize_t fuse_buf_write(const struct fuse_buf *dst, size_t dst_off,
|
||||||
res = write(dst->fd, (char *)src->mem + src_off, len);
|
res = write(dst->fd, (char *)src->mem + src_off, len);
|
||||||
}
|
}
|
||||||
if (res == -1) {
|
if (res == -1) {
|
||||||
if (!copied)
|
if (!copied) {
|
||||||
return -errno;
|
return -errno;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (res == 0)
|
if (res == 0) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
copied += res;
|
copied += res;
|
||||||
if (!(dst->flags & FUSE_BUF_FD_RETRY))
|
if (!(dst->flags & FUSE_BUF_FD_RETRY)) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
src_off += res;
|
src_off += res;
|
||||||
dst_off += res;
|
dst_off += res;
|
||||||
|
@ -88,16 +92,19 @@ static ssize_t fuse_buf_read(const struct fuse_buf *dst, size_t dst_off,
|
||||||
res = read(src->fd, (char *)dst->mem + dst_off, len);
|
res = read(src->fd, (char *)dst->mem + dst_off, len);
|
||||||
}
|
}
|
||||||
if (res == -1) {
|
if (res == -1) {
|
||||||
if (!copied)
|
if (!copied) {
|
||||||
return -errno;
|
return -errno;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (res == 0)
|
if (res == 0) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
copied += res;
|
copied += res;
|
||||||
if (!(src->flags & FUSE_BUF_FD_RETRY))
|
if (!(src->flags & FUSE_BUF_FD_RETRY)) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
dst_off += res;
|
dst_off += res;
|
||||||
src_off += res;
|
src_off += res;
|
||||||
|
@ -127,27 +134,32 @@ static ssize_t fuse_buf_fd_to_fd(const struct fuse_buf *dst, size_t dst_off,
|
||||||
|
|
||||||
res = fuse_buf_read(&tmp, 0, src, src_off, this_len);
|
res = fuse_buf_read(&tmp, 0, src, src_off, this_len);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
if (!copied)
|
if (!copied) {
|
||||||
return res;
|
return res;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (res == 0)
|
if (res == 0) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
read_len = res;
|
read_len = res;
|
||||||
res = fuse_buf_write(dst, dst_off, &tmp, 0, read_len);
|
res = fuse_buf_write(dst, dst_off, &tmp, 0, read_len);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
if (!copied)
|
if (!copied) {
|
||||||
return res;
|
return res;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (res == 0)
|
if (res == 0) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
copied += res;
|
copied += res;
|
||||||
|
|
||||||
if (res < this_len)
|
if (res < this_len) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
dst_off += res;
|
dst_off += res;
|
||||||
src_off += res;
|
src_off += res;
|
||||||
|
@ -169,11 +181,12 @@ static ssize_t fuse_buf_copy_one(const struct fuse_buf *dst, size_t dst_off,
|
||||||
char *srcmem = (char *)src->mem + src_off;
|
char *srcmem = (char *)src->mem + src_off;
|
||||||
|
|
||||||
if (dstmem != srcmem) {
|
if (dstmem != srcmem) {
|
||||||
if (dstmem + len <= srcmem || srcmem + len <= dstmem)
|
if (dstmem + len <= srcmem || srcmem + len <= dstmem) {
|
||||||
memcpy(dstmem, srcmem, len);
|
memcpy(dstmem, srcmem, len);
|
||||||
else
|
} else {
|
||||||
memmove(dstmem, srcmem, len);
|
memmove(dstmem, srcmem, len);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
} else if (!src_is_fd) {
|
} else if (!src_is_fd) {
|
||||||
|
@ -187,11 +200,12 @@ static ssize_t fuse_buf_copy_one(const struct fuse_buf *dst, size_t dst_off,
|
||||||
|
|
||||||
static const struct fuse_buf *fuse_bufvec_current(struct fuse_bufvec *bufv)
|
static const struct fuse_buf *fuse_bufvec_current(struct fuse_bufvec *bufv)
|
||||||
{
|
{
|
||||||
if (bufv->idx < bufv->count)
|
if (bufv->idx < bufv->count) {
|
||||||
return &bufv->buf[bufv->idx];
|
return &bufv->buf[bufv->idx];
|
||||||
else
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int fuse_bufvec_advance(struct fuse_bufvec *bufv, size_t len)
|
static int fuse_bufvec_advance(struct fuse_bufvec *bufv, size_t len)
|
||||||
{
|
{
|
||||||
|
@ -202,8 +216,9 @@ static int fuse_bufvec_advance(struct fuse_bufvec *bufv, size_t len)
|
||||||
if (bufv->off == buf->size) {
|
if (bufv->off == buf->size) {
|
||||||
assert(bufv->idx < bufv->count);
|
assert(bufv->idx < bufv->count);
|
||||||
bufv->idx++;
|
bufv->idx++;
|
||||||
if (bufv->idx == bufv->count)
|
if (bufv->idx == bufv->count) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
bufv->off = 0;
|
bufv->off = 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -214,8 +229,9 @@ ssize_t fuse_buf_copy(struct fuse_bufvec *dstv, struct fuse_bufvec *srcv,
|
||||||
{
|
{
|
||||||
size_t copied = 0;
|
size_t copied = 0;
|
||||||
|
|
||||||
if (dstv == srcv)
|
if (dstv == srcv) {
|
||||||
return fuse_buf_size(dstv);
|
return fuse_buf_size(dstv);
|
||||||
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
const struct fuse_buf *src = fuse_bufvec_current(srcv);
|
const struct fuse_buf *src = fuse_bufvec_current(srcv);
|
||||||
|
@ -225,8 +241,9 @@ ssize_t fuse_buf_copy(struct fuse_bufvec *dstv, struct fuse_bufvec *srcv,
|
||||||
size_t len;
|
size_t len;
|
||||||
ssize_t res;
|
ssize_t res;
|
||||||
|
|
||||||
if (src == NULL || dst == NULL)
|
if (src == NULL || dst == NULL) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
src_len = src->size - srcv->off;
|
src_len = src->size - srcv->off;
|
||||||
dst_len = dst->size - dstv->off;
|
dst_len = dst->size - dstv->off;
|
||||||
|
@ -234,19 +251,22 @@ ssize_t fuse_buf_copy(struct fuse_bufvec *dstv, struct fuse_bufvec *srcv,
|
||||||
|
|
||||||
res = fuse_buf_copy_one(dst, dstv->off, src, srcv->off, len, flags);
|
res = fuse_buf_copy_one(dst, dstv->off, src, srcv->off, len, flags);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
if (!copied)
|
if (!copied) {
|
||||||
return res;
|
return res;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
copied += res;
|
copied += res;
|
||||||
|
|
||||||
if (!fuse_bufvec_advance(srcv, res) ||
|
if (!fuse_bufvec_advance(srcv, res) ||
|
||||||
!fuse_bufvec_advance(dstv, res))
|
!fuse_bufvec_advance(dstv, res)) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (res < len)
|
if (res < len) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return copied;
|
return copied;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
/*
|
/*
|
||||||
FUSE: Filesystem in Userspace
|
* FUSE: Filesystem in Userspace
|
||||||
Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
* Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
||||||
|
*
|
||||||
This program can be distributed under the terms of the GNU LGPLv2.
|
* This program can be distributed under the terms of the GNU LGPLv2.
|
||||||
See the file COPYING.LIB.
|
* See the file COPYING.LIB.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FUSE_H_
|
#ifndef FUSE_H_
|
||||||
#define FUSE_H_
|
#define FUSE_H_
|
||||||
|
|
||||||
/** @file
|
/*
|
||||||
*
|
*
|
||||||
* This file defines the library interface of FUSE
|
* This file defines the library interface of FUSE
|
||||||
*
|
*
|
||||||
|
@ -19,15 +19,15 @@
|
||||||
#include "fuse_common.h"
|
#include "fuse_common.h"
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <time.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/statvfs.h>
|
#include <sys/statvfs.h>
|
||||||
|
#include <sys/types.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
/* ----------------------------------------------------------- *
|
/*
|
||||||
* Basic FUSE API *
|
* Basic FUSE API
|
||||||
* ----------------------------------------------------------- */
|
*/
|
||||||
|
|
||||||
/** Handle for a FUSE filesystem */
|
/** Handle for a FUSE filesystem */
|
||||||
struct fuse;
|
struct fuse;
|
||||||
|
@ -60,7 +60,8 @@ enum fuse_fill_dir_flags {
|
||||||
FUSE_FILL_DIR_PLUS = (1 << 1),
|
FUSE_FILL_DIR_PLUS = (1 << 1),
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Function to add an entry in a readdir() operation
|
/**
|
||||||
|
* Function to add an entry in a readdir() operation
|
||||||
*
|
*
|
||||||
* The *off* parameter can be any non-zero value that enables the
|
* The *off* parameter can be any non-zero value that enables the
|
||||||
* filesystem to identify the current point in the directory
|
* filesystem to identify the current point in the directory
|
||||||
|
@ -293,7 +294,8 @@ struct fuse_config {
|
||||||
* Almost all operations take a path which can be of any length.
|
* Almost all operations take a path which can be of any length.
|
||||||
*/
|
*/
|
||||||
struct fuse_operations {
|
struct fuse_operations {
|
||||||
/** Get file attributes.
|
/**
|
||||||
|
* Get file attributes.
|
||||||
*
|
*
|
||||||
* Similar to stat(). The 'st_dev' and 'st_blksize' fields are
|
* Similar to stat(). The 'st_dev' and 'st_blksize' fields are
|
||||||
* ignored. The 'st_ino' field is ignored except if the 'use_ino'
|
* ignored. The 'st_ino' field is ignored except if the 'use_ino'
|
||||||
|
@ -306,7 +308,8 @@ struct fuse_operations {
|
||||||
*/
|
*/
|
||||||
int (*getattr)(const char *, struct stat *, struct fuse_file_info *fi);
|
int (*getattr)(const char *, struct stat *, struct fuse_file_info *fi);
|
||||||
|
|
||||||
/** Read the target of a symbolic link
|
/**
|
||||||
|
* Read the target of a symbolic link
|
||||||
*
|
*
|
||||||
* The buffer should be filled with a null terminated string. The
|
* The buffer should be filled with a null terminated string. The
|
||||||
* buffer size argument includes the space for the terminating
|
* buffer size argument includes the space for the terminating
|
||||||
|
@ -316,7 +319,8 @@ struct fuse_operations {
|
||||||
*/
|
*/
|
||||||
int (*readlink)(const char *, char *, size_t);
|
int (*readlink)(const char *, char *, size_t);
|
||||||
|
|
||||||
/** Create a file node
|
/**
|
||||||
|
* Create a file node
|
||||||
*
|
*
|
||||||
* This is called for creation of all non-directory, non-symlink
|
* This is called for creation of all non-directory, non-symlink
|
||||||
* nodes. If the filesystem defines a create() method, then for
|
* nodes. If the filesystem defines a create() method, then for
|
||||||
|
@ -324,12 +328,13 @@ struct fuse_operations {
|
||||||
*/
|
*/
|
||||||
int (*mknod)(const char *, mode_t, dev_t);
|
int (*mknod)(const char *, mode_t, dev_t);
|
||||||
|
|
||||||
/** Create a directory
|
/**
|
||||||
|
* Create a directory
|
||||||
*
|
*
|
||||||
* Note that the mode argument may not have the type specification
|
* Note that the mode argument may not have the type specification
|
||||||
* bits set, i.e. S_ISDIR(mode) can be false. To obtain the
|
* bits set, i.e. S_ISDIR(mode) can be false. To obtain the
|
||||||
* correct directory type bits use mode|S_IFDIR
|
* correct directory type bits use mode|S_IFDIR
|
||||||
* */
|
*/
|
||||||
int (*mkdir)(const char *, mode_t);
|
int (*mkdir)(const char *, mode_t);
|
||||||
|
|
||||||
/** Remove a file */
|
/** Remove a file */
|
||||||
|
@ -341,7 +346,8 @@ struct fuse_operations {
|
||||||
/** Create a symbolic link */
|
/** Create a symbolic link */
|
||||||
int (*symlink)(const char *, const char *);
|
int (*symlink)(const char *, const char *);
|
||||||
|
|
||||||
/** Rename a file
|
/**
|
||||||
|
* Rename a file
|
||||||
*
|
*
|
||||||
* *flags* may be `RENAME_EXCHANGE` or `RENAME_NOREPLACE`. If
|
* *flags* may be `RENAME_EXCHANGE` or `RENAME_NOREPLACE`. If
|
||||||
* RENAME_NOREPLACE is specified, the filesystem must not
|
* RENAME_NOREPLACE is specified, the filesystem must not
|
||||||
|
@ -355,14 +361,16 @@ struct fuse_operations {
|
||||||
/** Create a hard link to a file */
|
/** Create a hard link to a file */
|
||||||
int (*link)(const char *, const char *);
|
int (*link)(const char *, const char *);
|
||||||
|
|
||||||
/** Change the permission bits of a file
|
/**
|
||||||
|
* Change the permission bits of a file
|
||||||
*
|
*
|
||||||
* `fi` will always be NULL if the file is not currenlty open, but
|
* `fi` will always be NULL if the file is not currenlty open, but
|
||||||
* may also be NULL if the file is open.
|
* may also be NULL if the file is open.
|
||||||
*/
|
*/
|
||||||
int (*chmod)(const char *, mode_t, struct fuse_file_info *fi);
|
int (*chmod)(const char *, mode_t, struct fuse_file_info *fi);
|
||||||
|
|
||||||
/** Change the owner and group of a file
|
/**
|
||||||
|
* Change the owner and group of a file
|
||||||
*
|
*
|
||||||
* `fi` will always be NULL if the file is not currenlty open, but
|
* `fi` will always be NULL if the file is not currenlty open, but
|
||||||
* may also be NULL if the file is open.
|
* may also be NULL if the file is open.
|
||||||
|
@ -372,7 +380,8 @@ struct fuse_operations {
|
||||||
*/
|
*/
|
||||||
int (*chown)(const char *, uid_t, gid_t, struct fuse_file_info *fi);
|
int (*chown)(const char *, uid_t, gid_t, struct fuse_file_info *fi);
|
||||||
|
|
||||||
/** Change the size of a file
|
/**
|
||||||
|
* Change the size of a file
|
||||||
*
|
*
|
||||||
* `fi` will always be NULL if the file is not currenlty open, but
|
* `fi` will always be NULL if the file is not currenlty open, but
|
||||||
* may also be NULL if the file is open.
|
* may also be NULL if the file is open.
|
||||||
|
@ -382,7 +391,8 @@ struct fuse_operations {
|
||||||
*/
|
*/
|
||||||
int (*truncate)(const char *, off_t, struct fuse_file_info *fi);
|
int (*truncate)(const char *, off_t, struct fuse_file_info *fi);
|
||||||
|
|
||||||
/** Open a file
|
/**
|
||||||
|
* Open a file
|
||||||
*
|
*
|
||||||
* Open flags are available in fi->flags. The following rules
|
* Open flags are available in fi->flags. The following rules
|
||||||
* apply.
|
* apply.
|
||||||
|
@ -431,7 +441,8 @@ struct fuse_operations {
|
||||||
*/
|
*/
|
||||||
int (*open)(const char *, struct fuse_file_info *);
|
int (*open)(const char *, struct fuse_file_info *);
|
||||||
|
|
||||||
/** Read data from an open file
|
/**
|
||||||
|
* Read data from an open file
|
||||||
*
|
*
|
||||||
* Read should return exactly the number of bytes requested except
|
* Read should return exactly the number of bytes requested except
|
||||||
* on EOF or error, otherwise the rest of the data will be
|
* on EOF or error, otherwise the rest of the data will be
|
||||||
|
@ -440,10 +451,10 @@ struct fuse_operations {
|
||||||
* value of the read system call will reflect the return value of
|
* value of the read system call will reflect the return value of
|
||||||
* this operation.
|
* this operation.
|
||||||
*/
|
*/
|
||||||
int (*read) (const char *, char *, size_t, off_t,
|
int (*read)(const char *, char *, size_t, off_t, struct fuse_file_info *);
|
||||||
struct fuse_file_info *);
|
|
||||||
|
|
||||||
/** Write data to an open file
|
/**
|
||||||
|
* Write data to an open file
|
||||||
*
|
*
|
||||||
* Write should return exactly the number of bytes requested
|
* Write should return exactly the number of bytes requested
|
||||||
* except on error. An exception to this is when the 'direct_io'
|
* except on error. An exception to this is when the 'direct_io'
|
||||||
|
@ -455,13 +466,15 @@ struct fuse_operations {
|
||||||
int (*write)(const char *, const char *, size_t, off_t,
|
int (*write)(const char *, const char *, size_t, off_t,
|
||||||
struct fuse_file_info *);
|
struct fuse_file_info *);
|
||||||
|
|
||||||
/** Get file system statistics
|
/**
|
||||||
|
* Get file system statistics
|
||||||
*
|
*
|
||||||
* The 'f_favail', 'f_fsid' and 'f_flag' fields are ignored
|
* The 'f_favail', 'f_fsid' and 'f_flag' fields are ignored
|
||||||
*/
|
*/
|
||||||
int (*statfs)(const char *, struct statvfs *);
|
int (*statfs)(const char *, struct statvfs *);
|
||||||
|
|
||||||
/** Possibly flush cached data
|
/**
|
||||||
|
* Possibly flush cached data
|
||||||
*
|
*
|
||||||
* BIG NOTE: This is not equivalent to fsync(). It's not a
|
* BIG NOTE: This is not equivalent to fsync(). It's not a
|
||||||
* request to sync dirty data.
|
* request to sync dirty data.
|
||||||
|
@ -487,11 +500,13 @@ struct fuse_operations {
|
||||||
* particular point. It may be called more times than expected, or not
|
* particular point. It may be called more times than expected, or not
|
||||||
* at all.
|
* at all.
|
||||||
*
|
*
|
||||||
* [close]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html
|
* [close]:
|
||||||
|
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html
|
||||||
*/
|
*/
|
||||||
int (*flush)(const char *, struct fuse_file_info *);
|
int (*flush)(const char *, struct fuse_file_info *);
|
||||||
|
|
||||||
/** Release an open file
|
/**
|
||||||
|
* Release an open file
|
||||||
*
|
*
|
||||||
* Release is called when there are no more references to an open
|
* Release is called when there are no more references to an open
|
||||||
* file: all file descriptors are closed and all memory mappings
|
* file: all file descriptors are closed and all memory mappings
|
||||||
|
@ -505,7 +520,8 @@ struct fuse_operations {
|
||||||
*/
|
*/
|
||||||
int (*release)(const char *, struct fuse_file_info *);
|
int (*release)(const char *, struct fuse_file_info *);
|
||||||
|
|
||||||
/** Synchronize file contents
|
/*
|
||||||
|
* Synchronize file contents
|
||||||
*
|
*
|
||||||
* If the datasync parameter is non-zero, then only the user data
|
* If the datasync parameter is non-zero, then only the user data
|
||||||
* should be flushed, not the meta data.
|
* should be flushed, not the meta data.
|
||||||
|
@ -524,7 +540,8 @@ struct fuse_operations {
|
||||||
/** Remove extended attributes */
|
/** Remove extended attributes */
|
||||||
int (*removexattr)(const char *, const char *);
|
int (*removexattr)(const char *, const char *);
|
||||||
|
|
||||||
/** Open directory
|
/*
|
||||||
|
* Open directory
|
||||||
*
|
*
|
||||||
* Unless the 'default_permissions' mount option is given,
|
* Unless the 'default_permissions' mount option is given,
|
||||||
* this method should check if opendir is permitted for this
|
* this method should check if opendir is permitted for this
|
||||||
|
@ -534,7 +551,8 @@ struct fuse_operations {
|
||||||
*/
|
*/
|
||||||
int (*opendir)(const char *, struct fuse_file_info *);
|
int (*opendir)(const char *, struct fuse_file_info *);
|
||||||
|
|
||||||
/** Read directory
|
/*
|
||||||
|
* Read directory
|
||||||
*
|
*
|
||||||
* The filesystem may choose between two modes of operation:
|
* The filesystem may choose between two modes of operation:
|
||||||
*
|
*
|
||||||
|
@ -552,11 +570,13 @@ struct fuse_operations {
|
||||||
int (*readdir)(const char *, void *, fuse_fill_dir_t, off_t,
|
int (*readdir)(const char *, void *, fuse_fill_dir_t, off_t,
|
||||||
struct fuse_file_info *, enum fuse_readdir_flags);
|
struct fuse_file_info *, enum fuse_readdir_flags);
|
||||||
|
|
||||||
/** Release directory
|
/**
|
||||||
|
* Release directory
|
||||||
*/
|
*/
|
||||||
int (*releasedir)(const char *, struct fuse_file_info *);
|
int (*releasedir)(const char *, struct fuse_file_info *);
|
||||||
|
|
||||||
/** Synchronize directory contents
|
/**
|
||||||
|
* Synchronize directory contents
|
||||||
*
|
*
|
||||||
* If the datasync parameter is non-zero, then only the user data
|
* If the datasync parameter is non-zero, then only the user data
|
||||||
* should be flushed, not the meta data
|
* should be flushed, not the meta data
|
||||||
|
@ -571,8 +591,7 @@ struct fuse_operations {
|
||||||
* parameter to the destroy() method. It overrides the initial
|
* parameter to the destroy() method. It overrides the initial
|
||||||
* value provided to fuse_main() / fuse_new().
|
* value provided to fuse_main() / fuse_new().
|
||||||
*/
|
*/
|
||||||
void *(*init) (struct fuse_conn_info *conn,
|
void *(*init)(struct fuse_conn_info *conn, struct fuse_config *cfg);
|
||||||
struct fuse_config *cfg);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up filesystem
|
* Clean up filesystem
|
||||||
|
@ -634,8 +653,7 @@ struct fuse_operations {
|
||||||
* allow file locking to work locally. Hence it is only
|
* allow file locking to work locally. Hence it is only
|
||||||
* interesting for network filesystems and similar.
|
* interesting for network filesystems and similar.
|
||||||
*/
|
*/
|
||||||
int (*lock) (const char *, struct fuse_file_info *, int cmd,
|
int (*lock)(const char *, struct fuse_file_info *, int cmd, struct flock *);
|
||||||
struct flock *);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the access and modification times of a file with
|
* Change the access and modification times of a file with
|
||||||
|
@ -697,7 +715,8 @@ struct fuse_operations {
|
||||||
int (*poll)(const char *, struct fuse_file_info *,
|
int (*poll)(const char *, struct fuse_file_info *,
|
||||||
struct fuse_pollhandle *ph, unsigned *reventsp);
|
struct fuse_pollhandle *ph, unsigned *reventsp);
|
||||||
|
|
||||||
/** Write contents of buffer to an open file
|
/*
|
||||||
|
* Write contents of buffer to an open file
|
||||||
*
|
*
|
||||||
* Similar to the write() method, but data is supplied in a
|
* Similar to the write() method, but data is supplied in a
|
||||||
* generic buffer. Use fuse_buf_copy() to transfer data to
|
* generic buffer. Use fuse_buf_copy() to transfer data to
|
||||||
|
@ -709,7 +728,8 @@ struct fuse_operations {
|
||||||
int (*write_buf)(const char *, struct fuse_bufvec *buf, off_t off,
|
int (*write_buf)(const char *, struct fuse_bufvec *buf, off_t off,
|
||||||
struct fuse_file_info *);
|
struct fuse_file_info *);
|
||||||
|
|
||||||
/** Store data from an open file in a buffer
|
/*
|
||||||
|
* Store data from an open file in a buffer
|
||||||
*
|
*
|
||||||
* Similar to the read() method, but data is stored and
|
* Similar to the read() method, but data is stored and
|
||||||
* returned in a generic buffer.
|
* returned in a generic buffer.
|
||||||
|
@ -723,8 +743,8 @@ struct fuse_operations {
|
||||||
* regions, they too must be allocated using malloc(). The
|
* regions, they too must be allocated using malloc(). The
|
||||||
* allocated memory will be freed by the caller.
|
* allocated memory will be freed by the caller.
|
||||||
*/
|
*/
|
||||||
int (*read_buf) (const char *, struct fuse_bufvec **bufp,
|
int (*read_buf)(const char *, struct fuse_bufvec **bufp, size_t size,
|
||||||
size_t size, off_t off, struct fuse_file_info *);
|
off_t off, struct fuse_file_info *);
|
||||||
/**
|
/**
|
||||||
* Perform BSD file locking operation
|
* Perform BSD file locking operation
|
||||||
*
|
*
|
||||||
|
@ -753,8 +773,7 @@ struct fuse_operations {
|
||||||
* request to specified range is guaranteed not to fail because of lack
|
* request to specified range is guaranteed not to fail because of lack
|
||||||
* of space on the file system media.
|
* of space on the file system media.
|
||||||
*/
|
*/
|
||||||
int (*fallocate) (const char *, int, off_t, off_t,
|
int (*fallocate)(const char *, int, off_t, off_t, struct fuse_file_info *);
|
||||||
struct fuse_file_info *);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy a range of data from one file to another
|
* Copy a range of data from one file to another
|
||||||
|
@ -768,18 +787,20 @@ struct fuse_operations {
|
||||||
* doing an inefficient copy of the data.
|
* doing an inefficient copy of the data.
|
||||||
*/
|
*/
|
||||||
ssize_t (*copy_file_range)(const char *path_in,
|
ssize_t (*copy_file_range)(const char *path_in,
|
||||||
struct fuse_file_info *fi_in,
|
struct fuse_file_info *fi_in, off_t offset_in,
|
||||||
off_t offset_in, const char *path_out,
|
const char *path_out,
|
||||||
struct fuse_file_info *fi_out,
|
struct fuse_file_info *fi_out, off_t offset_out,
|
||||||
off_t offset_out, size_t size, int flags);
|
size_t size, int flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find next data or hole after the specified offset
|
* Find next data or hole after the specified offset
|
||||||
*/
|
*/
|
||||||
off_t (*lseek) (const char *, off_t off, int whence, struct fuse_file_info *);
|
off_t (*lseek)(const char *, off_t off, int whence,
|
||||||
|
struct fuse_file_info *);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Extra context that may be needed by some filesystems
|
/*
|
||||||
|
* Extra context that may be needed by some filesystems
|
||||||
*
|
*
|
||||||
* The uid, gid and pid fields are not filled in case of a writepage
|
* The uid, gid and pid fields are not filled in case of a writepage
|
||||||
* operation.
|
* operation.
|
||||||
|
@ -859,15 +880,15 @@ struct fuse_context {
|
||||||
* Example usage, see hello.c
|
* Example usage, see hello.c
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
int fuse_main(int argc, char *argv[], const struct fuse_operations *op,
|
* int fuse_main(int argc, char *argv[], const struct fuse_operations *op,
|
||||||
void *private_data);
|
* void *private_data);
|
||||||
*/
|
*/
|
||||||
#define fuse_main(argc, argv, op, private_data) \
|
#define fuse_main(argc, argv, op, private_data) \
|
||||||
fuse_main_real(argc, argv, op, sizeof(*(op)), private_data)
|
fuse_main_real(argc, argv, op, sizeof(*(op)), private_data)
|
||||||
|
|
||||||
/* ----------------------------------------------------------- *
|
/*
|
||||||
* More detailed API *
|
* More detailed API
|
||||||
* ----------------------------------------------------------- */
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print available options (high- and low-level) to stdout. This is
|
* Print available options (high- and low-level) to stdout. This is
|
||||||
|
@ -910,8 +931,9 @@ void fuse_lib_help(struct fuse_args *args);
|
||||||
* @return the created FUSE handle
|
* @return the created FUSE handle
|
||||||
*/
|
*/
|
||||||
#if FUSE_USE_VERSION == 30
|
#if FUSE_USE_VERSION == 30
|
||||||
struct fuse *fuse_new_30(struct fuse_args *args, const struct fuse_operations *op,
|
struct fuse *fuse_new_30(struct fuse_args *args,
|
||||||
size_t op_size, void *private_data);
|
const struct fuse_operations *op, size_t op_size,
|
||||||
|
void *private_data);
|
||||||
#define fuse_new(args, op, size, data) fuse_new_30(args, op, size, data)
|
#define fuse_new(args, op, size, data) fuse_new_30(args, op, size, data)
|
||||||
#else
|
#else
|
||||||
struct fuse *fuse_new(struct fuse_args *args, const struct fuse_operations *op,
|
struct fuse *fuse_new(struct fuse_args *args, const struct fuse_operations *op,
|
||||||
|
@ -1082,12 +1104,11 @@ struct fuse_fs;
|
||||||
|
|
||||||
int fuse_fs_getattr(struct fuse_fs *fs, const char *path, struct stat *buf,
|
int fuse_fs_getattr(struct fuse_fs *fs, const char *path, struct stat *buf,
|
||||||
struct fuse_file_info *fi);
|
struct fuse_file_info *fi);
|
||||||
int fuse_fs_rename(struct fuse_fs *fs, const char *oldpath,
|
int fuse_fs_rename(struct fuse_fs *fs, const char *oldpath, const char *newpath,
|
||||||
const char *newpath, unsigned int flags);
|
unsigned int flags);
|
||||||
int fuse_fs_unlink(struct fuse_fs *fs, const char *path);
|
int fuse_fs_unlink(struct fuse_fs *fs, const char *path);
|
||||||
int fuse_fs_rmdir(struct fuse_fs *fs, const char *path);
|
int fuse_fs_rmdir(struct fuse_fs *fs, const char *path);
|
||||||
int fuse_fs_symlink(struct fuse_fs *fs, const char *linkname,
|
int fuse_fs_symlink(struct fuse_fs *fs, const char *linkname, const char *path);
|
||||||
const char *path);
|
|
||||||
int fuse_fs_link(struct fuse_fs *fs, const char *oldpath, const char *newpath);
|
int fuse_fs_link(struct fuse_fs *fs, const char *oldpath, const char *newpath);
|
||||||
int fuse_fs_release(struct fuse_fs *fs, const char *path,
|
int fuse_fs_release(struct fuse_fs *fs, const char *path,
|
||||||
struct fuse_file_info *fi);
|
struct fuse_file_info *fi);
|
||||||
|
@ -1143,8 +1164,7 @@ int fuse_fs_getxattr(struct fuse_fs *fs, const char *path, const char *name,
|
||||||
char *value, size_t size);
|
char *value, size_t size);
|
||||||
int fuse_fs_listxattr(struct fuse_fs *fs, const char *path, char *list,
|
int fuse_fs_listxattr(struct fuse_fs *fs, const char *path, char *list,
|
||||||
size_t size);
|
size_t size);
|
||||||
int fuse_fs_removexattr(struct fuse_fs *fs, const char *path,
|
int fuse_fs_removexattr(struct fuse_fs *fs, const char *path, const char *name);
|
||||||
const char *name);
|
|
||||||
int fuse_fs_bmap(struct fuse_fs *fs, const char *path, size_t blocksize,
|
int fuse_fs_bmap(struct fuse_fs *fs, const char *path, size_t blocksize,
|
||||||
uint64_t *idx);
|
uint64_t *idx);
|
||||||
int fuse_fs_ioctl(struct fuse_fs *fs, const char *path, unsigned int cmd,
|
int fuse_fs_ioctl(struct fuse_fs *fs, const char *path, unsigned int cmd,
|
||||||
|
|
|
@ -1,21 +1,23 @@
|
||||||
/* FUSE: Filesystem in Userspace
|
/*
|
||||||
Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
* FUSE: Filesystem in Userspace
|
||||||
|
* Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
||||||
This program can be distributed under the terms of the GNU LGPLv2.
|
*
|
||||||
See the file COPYING.LIB.
|
* This program can be distributed under the terms of the GNU LGPLv2.
|
||||||
|
* See the file COPYING.LIB.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @file */
|
/** @file */
|
||||||
|
|
||||||
#if !defined(FUSE_H_) && !defined(FUSE_LOWLEVEL_H_)
|
#if !defined(FUSE_H_) && !defined(FUSE_LOWLEVEL_H_)
|
||||||
#error "Never include <fuse_common.h> directly; use <fuse.h> or <fuse_lowlevel.h> instead."
|
#error \
|
||||||
|
"Never include <fuse_common.h> directly; use <fuse.h> or <fuse_lowlevel.h> instead."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef FUSE_COMMON_H_
|
#ifndef FUSE_COMMON_H_
|
||||||
#define FUSE_COMMON_H_
|
#define FUSE_COMMON_H_
|
||||||
|
|
||||||
#include "fuse_opt.h"
|
|
||||||
#include "fuse_log.h"
|
#include "fuse_log.h"
|
||||||
|
#include "fuse_opt.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
@ -41,64 +43,80 @@ struct fuse_file_info {
|
||||||
/** Open flags. Available in open() and release() */
|
/** Open flags. Available in open() and release() */
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
/** In case of a write operation indicates if this was caused
|
/*
|
||||||
by a delayed write from the page cache. If so, then the
|
* In case of a write operation indicates if this was caused
|
||||||
context's pid, uid, and gid fields will not be valid, and
|
* by a delayed write from the page cache. If so, then the
|
||||||
the *fh* value may not match the *fh* value that would
|
* context's pid, uid, and gid fields will not be valid, and
|
||||||
have been sent with the corresponding individual write
|
* the *fh* value may not match the *fh* value that would
|
||||||
requests if write caching had been disabled. */
|
* have been sent with the corresponding individual write
|
||||||
|
* requests if write caching had been disabled.
|
||||||
|
*/
|
||||||
unsigned int writepage:1;
|
unsigned int writepage:1;
|
||||||
|
|
||||||
/** Can be filled in by open, to use direct I/O on this file. */
|
/** Can be filled in by open, to use direct I/O on this file. */
|
||||||
unsigned int direct_io:1;
|
unsigned int direct_io:1;
|
||||||
|
|
||||||
/** Can be filled in by open. It signals the kernel that any
|
/*
|
||||||
currently cached file data (ie., data that the filesystem
|
* Can be filled in by open. It signals the kernel that any
|
||||||
provided the last time the file was open) need not be
|
* currently cached file data (ie., data that the filesystem
|
||||||
invalidated. Has no effect when set in other contexts (in
|
* provided the last time the file was open) need not be
|
||||||
particular it does nothing when set by opendir()). */
|
* invalidated. Has no effect when set in other contexts (in
|
||||||
|
* particular it does nothing when set by opendir()).
|
||||||
|
*/
|
||||||
unsigned int keep_cache:1;
|
unsigned int keep_cache:1;
|
||||||
|
|
||||||
/** Indicates a flush operation. Set in flush operation, also
|
/*
|
||||||
maybe set in highlevel lock operation and lowlevel release
|
* Indicates a flush operation. Set in flush operation, also
|
||||||
operation. */
|
* maybe set in highlevel lock operation and lowlevel release
|
||||||
|
* operation.
|
||||||
|
*/
|
||||||
unsigned int flush:1;
|
unsigned int flush:1;
|
||||||
|
|
||||||
/** Can be filled in by open, to indicate that the file is not
|
/*
|
||||||
seekable. */
|
* Can be filled in by open, to indicate that the file is not
|
||||||
|
* seekable.
|
||||||
|
*/
|
||||||
unsigned int nonseekable:1;
|
unsigned int nonseekable:1;
|
||||||
|
|
||||||
/* Indicates that flock locks for this file should be
|
/*
|
||||||
released. If set, lock_owner shall contain a valid value.
|
* Indicates that flock locks for this file should be
|
||||||
May only be set in ->release(). */
|
* released. If set, lock_owner shall contain a valid value.
|
||||||
|
* May only be set in ->release().
|
||||||
|
*/
|
||||||
unsigned int flock_release:1;
|
unsigned int flock_release:1;
|
||||||
|
|
||||||
/** Can be filled in by opendir. It signals the kernel to
|
/*
|
||||||
enable caching of entries returned by readdir(). Has no
|
* Can be filled in by opendir. It signals the kernel to
|
||||||
effect when set in other contexts (in particular it does
|
* enable caching of entries returned by readdir(). Has no
|
||||||
nothing when set by open()). */
|
* effect when set in other contexts (in particular it does
|
||||||
|
* nothing when set by open()).
|
||||||
|
*/
|
||||||
unsigned int cache_readdir:1;
|
unsigned int cache_readdir:1;
|
||||||
|
|
||||||
/** Padding. Reserved for future use*/
|
/** Padding. Reserved for future use*/
|
||||||
unsigned int padding:25;
|
unsigned int padding:25;
|
||||||
unsigned int padding2:32;
|
unsigned int padding2:32;
|
||||||
|
|
||||||
/** File handle id. May be filled in by filesystem in create,
|
/*
|
||||||
|
* File handle id. May be filled in by filesystem in create,
|
||||||
* open, and opendir(). Available in most other file operations on the
|
* open, and opendir(). Available in most other file operations on the
|
||||||
* same file handle. */
|
* same file handle.
|
||||||
|
*/
|
||||||
uint64_t fh;
|
uint64_t fh;
|
||||||
|
|
||||||
/** Lock owner id. Available in locking operations and flush */
|
/** Lock owner id. Available in locking operations and flush */
|
||||||
uint64_t lock_owner;
|
uint64_t lock_owner;
|
||||||
|
|
||||||
/** Requested poll events. Available in ->poll. Only set on kernels
|
/*
|
||||||
which support it. If unsupported, this field is set to zero. */
|
* Requested poll events. Available in ->poll. Only set on kernels
|
||||||
|
* which support it. If unsupported, this field is set to zero.
|
||||||
|
*/
|
||||||
uint32_t poll_events;
|
uint32_t poll_events;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**************************************************************************
|
/*
|
||||||
* Capability bits for 'fuse_conn_info.capable' and 'fuse_conn_info.want' *
|
* Capability bits for 'fuse_conn_info.capable' and 'fuse_conn_info.want'
|
||||||
**************************************************************************/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates that the filesystem supports asynchronous read requests.
|
* Indicates that the filesystem supports asynchronous read requests.
|
||||||
|
@ -489,21 +507,20 @@ struct fuse_conn_info_opts;
|
||||||
* -o async_read sets FUSE_CAP_ASYNC_READ in conn->want
|
* -o async_read sets FUSE_CAP_ASYNC_READ in conn->want
|
||||||
* -o sync_read unsets FUSE_CAP_ASYNC_READ in conn->want
|
* -o sync_read unsets FUSE_CAP_ASYNC_READ in conn->want
|
||||||
* -o atomic_o_trunc sets FUSE_CAP_ATOMIC_O_TRUNC in conn->want
|
* -o atomic_o_trunc sets FUSE_CAP_ATOMIC_O_TRUNC in conn->want
|
||||||
* -o no_remote_lock Equivalent to -o no_remote_flock,no_remote_posix_lock
|
* -o no_remote_lock Equivalent to -o
|
||||||
* -o no_remote_flock Unsets FUSE_CAP_FLOCK_LOCKS in conn->want
|
*no_remote_flock,no_remote_posix_lock -o no_remote_flock Unsets
|
||||||
* -o no_remote_posix_lock Unsets FUSE_CAP_POSIX_LOCKS in conn->want
|
*FUSE_CAP_FLOCK_LOCKS in conn->want -o no_remote_posix_lock Unsets
|
||||||
* -o [no_]splice_write (un-)sets FUSE_CAP_SPLICE_WRITE in conn->want
|
*FUSE_CAP_POSIX_LOCKS in conn->want -o [no_]splice_write (un-)sets
|
||||||
* -o [no_]splice_move (un-)sets FUSE_CAP_SPLICE_MOVE in conn->want
|
*FUSE_CAP_SPLICE_WRITE in conn->want -o [no_]splice_move (un-)sets
|
||||||
* -o [no_]splice_read (un-)sets FUSE_CAP_SPLICE_READ in conn->want
|
*FUSE_CAP_SPLICE_MOVE in conn->want -o [no_]splice_read (un-)sets
|
||||||
* -o [no_]auto_inval_data (un-)sets FUSE_CAP_AUTO_INVAL_DATA in conn->want
|
*FUSE_CAP_SPLICE_READ in conn->want -o [no_]auto_inval_data (un-)sets
|
||||||
* -o readdirplus=no unsets FUSE_CAP_READDIRPLUS in conn->want
|
*FUSE_CAP_AUTO_INVAL_DATA in conn->want -o readdirplus=no unsets
|
||||||
* -o readdirplus=yes sets FUSE_CAP_READDIRPLUS and unsets
|
*FUSE_CAP_READDIRPLUS in conn->want -o readdirplus=yes sets
|
||||||
* FUSE_CAP_READDIRPLUS_AUTO in conn->want
|
*FUSE_CAP_READDIRPLUS and unsets FUSE_CAP_READDIRPLUS_AUTO in conn->want -o
|
||||||
* -o readdirplus=auto sets FUSE_CAP_READDIRPLUS and
|
*readdirplus=auto sets FUSE_CAP_READDIRPLUS and FUSE_CAP_READDIRPLUS_AUTO
|
||||||
* FUSE_CAP_READDIRPLUS_AUTO in conn->want
|
*in conn->want -o [no_]async_dio (un-)sets FUSE_CAP_ASYNC_DIO in
|
||||||
* -o [no_]async_dio (un-)sets FUSE_CAP_ASYNC_DIO in conn->want
|
*conn->want -o [no_]writeback_cache (un-)sets FUSE_CAP_WRITEBACK_CACHE in
|
||||||
* -o [no_]writeback_cache (un-)sets FUSE_CAP_WRITEBACK_CACHE in conn->want
|
*conn->want -o time_gran=N sets conn->time_gran
|
||||||
* -o time_gran=N sets conn->time_gran
|
|
||||||
*
|
*
|
||||||
* Known options will be removed from *args*, unknown options will be
|
* Known options will be removed from *args*, unknown options will be
|
||||||
* passed through unchanged.
|
* passed through unchanged.
|
||||||
|
@ -552,9 +569,9 @@ const char *fuse_pkgversion(void);
|
||||||
*/
|
*/
|
||||||
void fuse_pollhandle_destroy(struct fuse_pollhandle *ph);
|
void fuse_pollhandle_destroy(struct fuse_pollhandle *ph);
|
||||||
|
|
||||||
/* ----------------------------------------------------------- *
|
/*
|
||||||
* Data buffer *
|
* Data buffer
|
||||||
* ----------------------------------------------------------- */
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Buffer flags
|
* Buffer flags
|
||||||
|
@ -700,18 +717,16 @@ struct fuse_bufvec {
|
||||||
|
|
||||||
/* Initialize bufvec with a single buffer of given size */
|
/* Initialize bufvec with a single buffer of given size */
|
||||||
#define FUSE_BUFVEC_INIT(size__) \
|
#define FUSE_BUFVEC_INIT(size__) \
|
||||||
((struct fuse_bufvec) { \
|
((struct fuse_bufvec){ /* .count= */ 1, \
|
||||||
/* .count= */ 1, \
|
|
||||||
/* .idx = */ 0, \
|
/* .idx = */ 0, \
|
||||||
/* .off = */ 0, \
|
/* .off = */ 0, /* .buf = */ \
|
||||||
/* .buf = */ { /* [0] = */ { \
|
{ /* [0] = */ { \
|
||||||
/* .size = */ (size__), \
|
/* .size = */ (size__), \
|
||||||
/* .flags = */ (enum fuse_buf_flags)0, \
|
/* .flags = */ (enum fuse_buf_flags)0, \
|
||||||
/* .mem = */ NULL, \
|
/* .mem = */ NULL, \
|
||||||
/* .fd = */ -1, \
|
/* .fd = */ -1, \
|
||||||
/* .pos = */ 0, \
|
/* .pos = */ 0, \
|
||||||
} } \
|
} } })
|
||||||
} )
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get total size of data in a fuse buffer vector
|
* Get total size of data in a fuse buffer vector
|
||||||
|
@ -732,9 +747,9 @@ size_t fuse_buf_size(const struct fuse_bufvec *bufv);
|
||||||
ssize_t fuse_buf_copy(struct fuse_bufvec *dst, struct fuse_bufvec *src,
|
ssize_t fuse_buf_copy(struct fuse_bufvec *dst, struct fuse_bufvec *src,
|
||||||
enum fuse_buf_copy_flags flags);
|
enum fuse_buf_copy_flags flags);
|
||||||
|
|
||||||
/* ----------------------------------------------------------- *
|
/*
|
||||||
* Signal handling *
|
* Signal handling
|
||||||
* ----------------------------------------------------------- */
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exit session on HUP, TERM and INT signals and ignore PIPE signal
|
* Exit session on HUP, TERM and INT signals and ignore PIPE signal
|
||||||
|
@ -766,9 +781,9 @@ int fuse_set_signal_handlers(struct fuse_session *se);
|
||||||
*/
|
*/
|
||||||
void fuse_remove_signal_handlers(struct fuse_session *se);
|
void fuse_remove_signal_handlers(struct fuse_session *se);
|
||||||
|
|
||||||
/* ----------------------------------------------------------- *
|
/*
|
||||||
* Compatibility stuff *
|
* Compatibility stuff
|
||||||
* ----------------------------------------------------------- */
|
*/
|
||||||
|
|
||||||
#if !defined(FUSE_USE_VERSION) || FUSE_USE_VERSION < 30
|
#if !defined(FUSE_USE_VERSION) || FUSE_USE_VERSION < 30
|
||||||
#error only API version 30 or greater is supported
|
#error only API version 30 or greater is supported
|
||||||
|
@ -781,11 +796,14 @@ void fuse_remove_signal_handlers(struct fuse_session *se);
|
||||||
* On 32bit systems please add -D_FILE_OFFSET_BITS=64 to your compile flags!
|
* On 32bit systems please add -D_FILE_OFFSET_BITS=64 to your compile flags!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 6) && !defined __cplusplus
|
#if defined(__GNUC__) && \
|
||||||
|
(__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 6) && \
|
||||||
|
!defined __cplusplus
|
||||||
_Static_assert(sizeof(off_t) == 8, "fuse: off_t must be 64bit");
|
_Static_assert(sizeof(off_t) == 8, "fuse: off_t must be 64bit");
|
||||||
#else
|
#else
|
||||||
struct _fuse_off_t_must_be_64bit_dummy_struct \
|
struct _fuse_off_t_must_be_64bit_dummy_struct {
|
||||||
{ unsigned _fuse_off_t_must_be_64bit:((sizeof(off_t) == 8) ? 1 : -1); };
|
unsigned _fuse_off_t_must_be_64bit:((sizeof(off_t) == 8) ? 1 : -1);
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* FUSE_COMMON_H_ */
|
#endif /* FUSE_COMMON_H_ */
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/*
|
/*
|
||||||
FUSE: Filesystem in Userspace
|
* FUSE: Filesystem in Userspace
|
||||||
Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
* Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
||||||
|
*
|
||||||
This program can be distributed under the terms of the GNU LGPLv2.
|
* This program can be distributed under the terms of the GNU LGPLv2.
|
||||||
See the file COPYING.LIB
|
* See the file COPYING.LIB
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fuse.h"
|
#include "fuse.h"
|
||||||
|
@ -88,7 +88,8 @@ int fuse_send_reply_iov_nofree(fuse_req_t req, int error, struct iovec *iov,
|
||||||
void fuse_free_req(fuse_req_t req);
|
void fuse_free_req(fuse_req_t req);
|
||||||
|
|
||||||
void fuse_session_process_buf_int(struct fuse_session *se,
|
void fuse_session_process_buf_int(struct fuse_session *se,
|
||||||
const struct fuse_buf *buf, struct fuse_chan *ch);
|
const struct fuse_buf *buf,
|
||||||
|
struct fuse_chan *ch);
|
||||||
|
|
||||||
|
|
||||||
#define FUSE_MAX_MAX_PAGES 256
|
#define FUSE_MAX_MAX_PAGES 256
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/*
|
/*
|
||||||
FUSE: Filesystem in Userspace
|
* FUSE: Filesystem in Userspace
|
||||||
Copyright (C) 2019 Red Hat, Inc.
|
* Copyright (C) 2019 Red Hat, Inc.
|
||||||
|
*
|
||||||
Logging API.
|
* Logging API.
|
||||||
|
*
|
||||||
This program can be distributed under the terms of the GNU LGPLv2.
|
* This program can be distributed under the terms of the GNU LGPLv2.
|
||||||
See the file COPYING.LIB
|
* See the file COPYING.LIB
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fuse_log.h"
|
#include "fuse_log.h"
|
||||||
|
@ -13,8 +13,7 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
static void default_log_func(
|
static void default_log_func(__attribute__((unused)) enum fuse_log_level level,
|
||||||
__attribute__(( unused )) enum fuse_log_level level,
|
|
||||||
const char *fmt, va_list ap)
|
const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
vfprintf(stderr, fmt, ap);
|
vfprintf(stderr, fmt, ap);
|
||||||
|
@ -24,8 +23,9 @@ static fuse_log_func_t log_func = default_log_func;
|
||||||
|
|
||||||
void fuse_set_log_func(fuse_log_func_t func)
|
void fuse_set_log_func(fuse_log_func_t func)
|
||||||
{
|
{
|
||||||
if (!func)
|
if (!func) {
|
||||||
func = default_log_func;
|
func = default_log_func;
|
||||||
|
}
|
||||||
|
|
||||||
log_func = func;
|
log_func = func;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/*
|
/*
|
||||||
FUSE: Filesystem in Userspace
|
* FUSE: Filesystem in Userspace
|
||||||
Copyright (C) 2019 Red Hat, Inc.
|
* Copyright (C) 2019 Red Hat, Inc.
|
||||||
|
*
|
||||||
This program can be distributed under the terms of the GNU LGPLv2.
|
* This program can be distributed under the terms of the GNU LGPLv2.
|
||||||
See the file COPYING.LIB.
|
* See the file COPYING.LIB.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FUSE_LOG_H_
|
#ifndef FUSE_LOG_H_
|
||||||
|
@ -45,8 +45,8 @@ enum fuse_log_level {
|
||||||
* @param fmt sprintf-style format string including newline
|
* @param fmt sprintf-style format string including newline
|
||||||
* @param ap format string arguments
|
* @param ap format string arguments
|
||||||
*/
|
*/
|
||||||
typedef void (*fuse_log_func_t)(enum fuse_log_level level,
|
typedef void (*fuse_log_func_t)(enum fuse_log_level level, const char *fmt,
|
||||||
const char *fmt, va_list ap);
|
va_list ap);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install a custom log handler function.
|
* Install a custom log handler function.
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,15 +1,16 @@
|
||||||
/*
|
/*
|
||||||
FUSE: Filesystem in Userspace
|
* FUSE: Filesystem in Userspace
|
||||||
Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
* Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
||||||
|
*
|
||||||
This program can be distributed under the terms of the GNU LGPLv2.
|
* This program can be distributed under the terms of the GNU LGPLv2.
|
||||||
See the file COPYING.LIB.
|
* See the file COPYING.LIB.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FUSE_LOWLEVEL_H_
|
#ifndef FUSE_LOWLEVEL_H_
|
||||||
#define FUSE_LOWLEVEL_H_
|
#define FUSE_LOWLEVEL_H_
|
||||||
|
|
||||||
/** @file
|
/**
|
||||||
|
* @file
|
||||||
*
|
*
|
||||||
* Low level API
|
* Low level API
|
||||||
*
|
*
|
||||||
|
@ -24,16 +25,16 @@
|
||||||
|
|
||||||
#include "fuse_common.h"
|
#include "fuse_common.h"
|
||||||
|
|
||||||
#include <utime.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/statvfs.h>
|
#include <sys/statvfs.h>
|
||||||
|
#include <sys/types.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
|
#include <utime.h>
|
||||||
|
|
||||||
/* ----------------------------------------------------------- *
|
/*
|
||||||
* Miscellaneous definitions *
|
* Miscellaneous definitions
|
||||||
* ----------------------------------------------------------- */
|
*/
|
||||||
|
|
||||||
/** The node ID of the root inode */
|
/** The node ID of the root inode */
|
||||||
#define FUSE_ROOT_ID 1
|
#define FUSE_ROOT_ID 1
|
||||||
|
@ -53,7 +54,8 @@ struct fuse_session;
|
||||||
|
|
||||||
/** Directory entry parameters supplied to fuse_reply_entry() */
|
/** Directory entry parameters supplied to fuse_reply_entry() */
|
||||||
struct fuse_entry_param {
|
struct fuse_entry_param {
|
||||||
/** Unique inode number
|
/**
|
||||||
|
* Unique inode number
|
||||||
*
|
*
|
||||||
* In lookup, zero means negative entry (from version 2.5)
|
* In lookup, zero means negative entry (from version 2.5)
|
||||||
* Returning ENOENT also means negative entry, but by setting zero
|
* Returning ENOENT also means negative entry, but by setting zero
|
||||||
|
@ -62,7 +64,8 @@ struct fuse_entry_param {
|
||||||
*/
|
*/
|
||||||
fuse_ino_t ino;
|
fuse_ino_t ino;
|
||||||
|
|
||||||
/** Generation number for this entry.
|
/**
|
||||||
|
* Generation number for this entry.
|
||||||
*
|
*
|
||||||
* If the file system will be exported over NFS, the
|
* If the file system will be exported over NFS, the
|
||||||
* ino/generation pairs need to be unique over the file
|
* ino/generation pairs need to be unique over the file
|
||||||
|
@ -74,7 +77,8 @@ struct fuse_entry_param {
|
||||||
*/
|
*/
|
||||||
uint64_t generation;
|
uint64_t generation;
|
||||||
|
|
||||||
/** Inode attributes.
|
/**
|
||||||
|
* Inode attributes.
|
||||||
*
|
*
|
||||||
* Even if attr_timeout == 0, attr must be correct. For example,
|
* Even if attr_timeout == 0, attr must be correct. For example,
|
||||||
* for open(), FUSE uses attr.st_size from lookup() to determine
|
* for open(), FUSE uses attr.st_size from lookup() to determine
|
||||||
|
@ -83,16 +87,20 @@ struct fuse_entry_param {
|
||||||
*/
|
*/
|
||||||
struct stat attr;
|
struct stat attr;
|
||||||
|
|
||||||
/** Validity timeout (in seconds) for inode attributes. If
|
/**
|
||||||
attributes only change as a result of requests that come
|
* Validity timeout (in seconds) for inode attributes. If
|
||||||
through the kernel, this should be set to a very large
|
* attributes only change as a result of requests that come
|
||||||
value. */
|
* through the kernel, this should be set to a very large
|
||||||
|
* value.
|
||||||
|
*/
|
||||||
double attr_timeout;
|
double attr_timeout;
|
||||||
|
|
||||||
/** Validity timeout (in seconds) for the name. If directory
|
/**
|
||||||
entries are changed/deleted only as a result of requests
|
* Validity timeout (in seconds) for the name. If directory
|
||||||
that come through the kernel, this should be set to a very
|
* entries are changed/deleted only as a result of requests
|
||||||
large value. */
|
* that come through the kernel, this should be set to a very
|
||||||
|
* large value.
|
||||||
|
*/
|
||||||
double entry_timeout;
|
double entry_timeout;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -134,9 +142,9 @@ struct fuse_forget_data {
|
||||||
#define FUSE_SET_ATTR_MTIME_NOW (1 << 8)
|
#define FUSE_SET_ATTR_MTIME_NOW (1 << 8)
|
||||||
#define FUSE_SET_ATTR_CTIME (1 << 10)
|
#define FUSE_SET_ATTR_CTIME (1 << 10)
|
||||||
|
|
||||||
/* ----------------------------------------------------------- *
|
/*
|
||||||
* Request methods and replies *
|
* Request methods and replies
|
||||||
* ----------------------------------------------------------- */
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Low level filesystem operations
|
* Low level filesystem operations
|
||||||
|
@ -267,8 +275,7 @@ struct fuse_lowlevel_ops {
|
||||||
* @param ino the inode number
|
* @param ino the inode number
|
||||||
* @param fi for future use, currently always NULL
|
* @param fi for future use, currently always NULL
|
||||||
*/
|
*/
|
||||||
void (*getattr) (fuse_req_t req, fuse_ino_t ino,
|
void (*getattr)(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi);
|
||||||
struct fuse_file_info *fi);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set file attributes
|
* Set file attributes
|
||||||
|
@ -396,7 +403,8 @@ struct fuse_lowlevel_ops {
|
||||||
void (*symlink)(fuse_req_t req, const char *link, fuse_ino_t parent,
|
void (*symlink)(fuse_req_t req, const char *link, fuse_ino_t parent,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
|
||||||
/** Rename a file
|
/**
|
||||||
|
* Rename a file
|
||||||
*
|
*
|
||||||
* If the target exists it should be atomically replaced. If
|
* If the target exists it should be atomically replaced. If
|
||||||
* the target's inode's lookup count is non-zero, the file
|
* the target's inode's lookup count is non-zero, the file
|
||||||
|
@ -500,8 +508,7 @@ struct fuse_lowlevel_ops {
|
||||||
* @param ino the inode number
|
* @param ino the inode number
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
*/
|
*/
|
||||||
void (*open) (fuse_req_t req, fuse_ino_t ino,
|
void (*open)(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi);
|
||||||
struct fuse_file_info *fi);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read data
|
* Read data
|
||||||
|
@ -557,8 +564,8 @@ struct fuse_lowlevel_ops {
|
||||||
* @param off offset to write to
|
* @param off offset to write to
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
*/
|
*/
|
||||||
void (*write) (fuse_req_t req, fuse_ino_t ino, const char *buf,
|
void (*write)(fuse_req_t req, fuse_ino_t ino, const char *buf, size_t size,
|
||||||
size_t size, off_t off, struct fuse_file_info *fi);
|
off_t off, struct fuse_file_info *fi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flush method
|
* Flush method
|
||||||
|
@ -596,10 +603,10 @@ struct fuse_lowlevel_ops {
|
||||||
* @param ino the inode number
|
* @param ino the inode number
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
*
|
*
|
||||||
* [close]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html
|
* [close]:
|
||||||
|
* http://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html
|
||||||
*/
|
*/
|
||||||
void (*flush) (fuse_req_t req, fuse_ino_t ino,
|
void (*flush)(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi);
|
||||||
struct fuse_file_info *fi);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release an open file
|
* Release an open file
|
||||||
|
@ -626,8 +633,7 @@ struct fuse_lowlevel_ops {
|
||||||
* @param ino the inode number
|
* @param ino the inode number
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
*/
|
*/
|
||||||
void (*release) (fuse_req_t req, fuse_ino_t ino,
|
void (*release)(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi);
|
||||||
struct fuse_file_info *fi);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Synchronize file contents
|
* Synchronize file contents
|
||||||
|
@ -673,8 +679,7 @@ struct fuse_lowlevel_ops {
|
||||||
* @param ino the inode number
|
* @param ino the inode number
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
*/
|
*/
|
||||||
void (*opendir) (fuse_req_t req, fuse_ino_t ino,
|
void (*opendir)(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi);
|
||||||
struct fuse_file_info *fi);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read directory
|
* Read directory
|
||||||
|
@ -934,8 +939,8 @@ struct fuse_lowlevel_ops {
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
* @param lock the region/type to test
|
* @param lock the region/type to test
|
||||||
*/
|
*/
|
||||||
void (*getlk) (fuse_req_t req, fuse_ino_t ino,
|
void (*getlk)(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi,
|
||||||
struct fuse_file_info *fi, struct flock *lock);
|
struct flock *lock);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acquire, modify or release a POSIX file lock
|
* Acquire, modify or release a POSIX file lock
|
||||||
|
@ -959,8 +964,7 @@ struct fuse_lowlevel_ops {
|
||||||
* @param lock the region/type to set
|
* @param lock the region/type to set
|
||||||
* @param sleep locking operation may sleep
|
* @param sleep locking operation may sleep
|
||||||
*/
|
*/
|
||||||
void (*setlk) (fuse_req_t req, fuse_ino_t ino,
|
void (*setlk)(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi,
|
||||||
struct fuse_file_info *fi,
|
|
||||||
struct flock *lock, int sleep);
|
struct flock *lock, int sleep);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1014,9 +1018,9 @@ struct fuse_lowlevel_ops {
|
||||||
* Note : the unsigned long request submitted by the application
|
* Note : the unsigned long request submitted by the application
|
||||||
* is truncated to 32 bits.
|
* is truncated to 32 bits.
|
||||||
*/
|
*/
|
||||||
void (*ioctl) (fuse_req_t req, fuse_ino_t ino, unsigned int cmd,
|
void (*ioctl)(fuse_req_t req, fuse_ino_t ino, unsigned int cmd, void *arg,
|
||||||
void *arg, struct fuse_file_info *fi, unsigned flags,
|
struct fuse_file_info *fi, unsigned flags, const void *in_buf,
|
||||||
const void *in_buf, size_t in_bufsz, size_t out_bufsz);
|
size_t in_bufsz, size_t out_bufsz);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Poll for IO readiness
|
* Poll for IO readiness
|
||||||
|
@ -1077,9 +1081,8 @@ struct fuse_lowlevel_ops {
|
||||||
* @param off offset to write to
|
* @param off offset to write to
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
*/
|
*/
|
||||||
void (*write_buf) (fuse_req_t req, fuse_ino_t ino,
|
void (*write_buf)(fuse_req_t req, fuse_ino_t ino, struct fuse_bufvec *bufv,
|
||||||
struct fuse_bufvec *bufv, off_t off,
|
off_t off, struct fuse_file_info *fi);
|
||||||
struct fuse_file_info *fi);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback function for the retrieve request
|
* Callback function for the retrieve request
|
||||||
|
@ -1125,8 +1128,8 @@ struct fuse_lowlevel_ops {
|
||||||
* @param fi file information
|
* @param fi file information
|
||||||
* @param op the locking operation, see flock(2)
|
* @param op the locking operation, see flock(2)
|
||||||
*/
|
*/
|
||||||
void (*flock) (fuse_req_t req, fuse_ino_t ino,
|
void (*flock)(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi,
|
||||||
struct fuse_file_info *fi, int op);
|
int op);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate requested space. If this function returns success then
|
* Allocate requested space. If this function returns success then
|
||||||
|
@ -1148,8 +1151,8 @@ struct fuse_lowlevel_ops {
|
||||||
* @param mode determines the operation to be performed on the given range,
|
* @param mode determines the operation to be performed on the given range,
|
||||||
* see fallocate(2)
|
* see fallocate(2)
|
||||||
*/
|
*/
|
||||||
void (*fallocate) (fuse_req_t req, fuse_ino_t ino, int mode,
|
void (*fallocate)(fuse_req_t req, fuse_ino_t ino, int mode, off_t offset,
|
||||||
off_t offset, off_t length, struct fuse_file_info *fi);
|
off_t length, struct fuse_file_info *fi);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read directory with attributes
|
* Read directory with attributes
|
||||||
|
@ -1209,11 +1212,10 @@ struct fuse_lowlevel_ops {
|
||||||
* @param len maximum size of the data to copy
|
* @param len maximum size of the data to copy
|
||||||
* @param flags passed along with the copy_file_range() syscall
|
* @param flags passed along with the copy_file_range() syscall
|
||||||
*/
|
*/
|
||||||
void (*copy_file_range) (fuse_req_t req, fuse_ino_t ino_in,
|
void (*copy_file_range)(fuse_req_t req, fuse_ino_t ino_in, off_t off_in,
|
||||||
off_t off_in, struct fuse_file_info *fi_in,
|
struct fuse_file_info *fi_in, fuse_ino_t ino_out,
|
||||||
fuse_ino_t ino_out, off_t off_out,
|
off_t off_out, struct fuse_file_info *fi_out,
|
||||||
struct fuse_file_info *fi_out, size_t len,
|
size_t len, int flags);
|
||||||
int flags);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find next data or hole after the specified offset
|
* Find next data or hole after the specified offset
|
||||||
|
@ -1480,9 +1482,9 @@ int fuse_reply_lock(fuse_req_t req, const struct flock *lock);
|
||||||
*/
|
*/
|
||||||
int fuse_reply_bmap(fuse_req_t req, uint64_t idx);
|
int fuse_reply_bmap(fuse_req_t req, uint64_t idx);
|
||||||
|
|
||||||
/* ----------------------------------------------------------- *
|
/*
|
||||||
* Filling a buffer in readdir *
|
* Filling a buffer in readdir
|
||||||
* ----------------------------------------------------------- */
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a directory entry to the buffer
|
* Add a directory entry to the buffer
|
||||||
|
@ -1512,8 +1514,7 @@ int fuse_reply_bmap(fuse_req_t req, uint64_t idx);
|
||||||
* @return the space needed for the entry
|
* @return the space needed for the entry
|
||||||
*/
|
*/
|
||||||
size_t fuse_add_direntry(fuse_req_t req, char *buf, size_t bufsize,
|
size_t fuse_add_direntry(fuse_req_t req, char *buf, size_t bufsize,
|
||||||
const char *name, const struct stat *stbuf,
|
const char *name, const struct stat *stbuf, off_t off);
|
||||||
off_t off);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a directory entry to the buffer with the attributes
|
* Add a directory entry to the buffer with the attributes
|
||||||
|
@ -1547,9 +1548,9 @@ size_t fuse_add_direntry_plus(fuse_req_t req, char *buf, size_t bufsize,
|
||||||
* @param out_count number of entries in out_iov
|
* @param out_count number of entries in out_iov
|
||||||
* @return zero for success, -errno for failure to send reply
|
* @return zero for success, -errno for failure to send reply
|
||||||
*/
|
*/
|
||||||
int fuse_reply_ioctl_retry(fuse_req_t req,
|
int fuse_reply_ioctl_retry(fuse_req_t req, const struct iovec *in_iov,
|
||||||
const struct iovec *in_iov, size_t in_count,
|
size_t in_count, const struct iovec *out_iov,
|
||||||
const struct iovec *out_iov, size_t out_count);
|
size_t out_count);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reply to finish ioctl
|
* Reply to finish ioctl
|
||||||
|
@ -1598,9 +1599,9 @@ int fuse_reply_poll(fuse_req_t req, unsigned revents);
|
||||||
*/
|
*/
|
||||||
int fuse_reply_lseek(fuse_req_t req, off_t off);
|
int fuse_reply_lseek(fuse_req_t req, off_t off);
|
||||||
|
|
||||||
/* ----------------------------------------------------------- *
|
/*
|
||||||
* Notification *
|
* Notification
|
||||||
* ----------------------------------------------------------- */
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify IO readiness event
|
* Notify IO readiness event
|
||||||
|
@ -1693,9 +1694,9 @@ int fuse_lowlevel_notify_inval_entry(struct fuse_session *se, fuse_ino_t parent,
|
||||||
* @param namelen strlen() of file name
|
* @param namelen strlen() of file name
|
||||||
* @return zero for success, -errno for failure
|
* @return zero for success, -errno for failure
|
||||||
*/
|
*/
|
||||||
int fuse_lowlevel_notify_delete(struct fuse_session *se,
|
int fuse_lowlevel_notify_delete(struct fuse_session *se, fuse_ino_t parent,
|
||||||
fuse_ino_t parent, fuse_ino_t child,
|
fuse_ino_t child, const char *name,
|
||||||
const char *name, size_t namelen);
|
size_t namelen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store data to the kernel buffers
|
* Store data to the kernel buffers
|
||||||
|
@ -1758,9 +1759,9 @@ int fuse_lowlevel_notify_retrieve(struct fuse_session *se, fuse_ino_t ino,
|
||||||
size_t size, off_t offset, void *cookie);
|
size_t size, off_t offset, void *cookie);
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------- *
|
/*
|
||||||
* Utility functions *
|
* Utility functions
|
||||||
* ----------------------------------------------------------- */
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the userdata from the request
|
* Get the userdata from the request
|
||||||
|
@ -1833,9 +1834,9 @@ void fuse_req_interrupt_func(fuse_req_t req, fuse_interrupt_func_t func,
|
||||||
int fuse_req_interrupted(fuse_req_t req);
|
int fuse_req_interrupted(fuse_req_t req);
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------- *
|
/*
|
||||||
* Inquiry functions *
|
* Inquiry functions
|
||||||
* ----------------------------------------------------------- */
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print low-level version information to stdout.
|
* Print low-level version information to stdout.
|
||||||
|
@ -1854,9 +1855,9 @@ void fuse_lowlevel_help(void);
|
||||||
*/
|
*/
|
||||||
void fuse_cmdline_help(void);
|
void fuse_cmdline_help(void);
|
||||||
|
|
||||||
/* ----------------------------------------------------------- *
|
/*
|
||||||
* Filesystem setup & teardown *
|
* Filesystem setup & teardown
|
||||||
* ----------------------------------------------------------- */
|
*/
|
||||||
|
|
||||||
struct fuse_cmdline_opts {
|
struct fuse_cmdline_opts {
|
||||||
int foreground;
|
int foreground;
|
||||||
|
@ -1886,8 +1887,7 @@ struct fuse_cmdline_opts {
|
||||||
* @param opts output argument for parsed options
|
* @param opts output argument for parsed options
|
||||||
* @return 0 on success, -1 on failure
|
* @return 0 on success, -1 on failure
|
||||||
*/
|
*/
|
||||||
int fuse_parse_cmdline(struct fuse_args *args,
|
int fuse_parse_cmdline(struct fuse_args *args, struct fuse_cmdline_opts *opts);
|
||||||
struct fuse_cmdline_opts *opts);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a low level session.
|
* Create a low level session.
|
||||||
|
@ -2014,9 +2014,9 @@ void fuse_session_unmount(struct fuse_session *se);
|
||||||
*/
|
*/
|
||||||
void fuse_session_destroy(struct fuse_session *se);
|
void fuse_session_destroy(struct fuse_session *se);
|
||||||
|
|
||||||
/* ----------------------------------------------------------- *
|
/*
|
||||||
* Custom event loop support *
|
* Custom event loop support
|
||||||
* ----------------------------------------------------------- */
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return file descriptor for communication with kernel.
|
* Return file descriptor for communication with kernel.
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
/*
|
/*
|
||||||
FUSE: Filesystem in Userspace
|
* FUSE: Filesystem in Userspace
|
||||||
Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
* Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
||||||
|
*
|
||||||
This program can be distributed under the terms of the GNU LGPLv2.
|
* This program can be distributed under the terms of the GNU LGPLv2.
|
||||||
See the file COPYING.LIB
|
* See the file COPYING.LIB
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Versioned symbols cannot be used in some cases because it
|
* Versioned symbols cannot be used in some cases because it
|
||||||
- confuse the dynamic linker in uClibc
|
* - confuse the dynamic linker in uClibc
|
||||||
- not supported on MacOSX (in MachO binary format)
|
* - not supported on MacOSX (in MachO binary format)
|
||||||
*/
|
*/
|
||||||
#if (!defined(__UCLIBC__) && !defined(__APPLE__))
|
#if (!defined(__UCLIBC__) && !defined(__APPLE__))
|
||||||
#define FUSE_SYMVER(x) __asm__(x)
|
#define FUSE_SYMVER(x) __asm__(x)
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
/*
|
/*
|
||||||
FUSE: Filesystem in Userspace
|
* FUSE: Filesystem in Userspace
|
||||||
Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
* Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
||||||
|
*
|
||||||
Implementation of option parsing routines (dealing with `struct
|
* Implementation of option parsing routines (dealing with `struct
|
||||||
fuse_args`).
|
* fuse_args`).
|
||||||
|
*
|
||||||
This program can be distributed under the terms of the GNU LGPLv2.
|
* This program can be distributed under the terms of the GNU LGPLv2.
|
||||||
See the file COPYING.LIB
|
* See the file COPYING.LIB
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "fuse_opt.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "fuse_i.h"
|
#include "fuse_i.h"
|
||||||
#include "fuse_opt.h"
|
|
||||||
#include "fuse_misc.h"
|
#include "fuse_misc.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
struct fuse_opt_context {
|
struct fuse_opt_context {
|
||||||
void *data;
|
void *data;
|
||||||
|
@ -36,8 +36,9 @@ void fuse_opt_free_args(struct fuse_args *args)
|
||||||
if (args) {
|
if (args) {
|
||||||
if (args->argv && args->allocated) {
|
if (args->argv && args->allocated) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < args->argc; i++)
|
for (i = 0; i < args->argc; i++) {
|
||||||
free(args->argv[i]);
|
free(args->argv[i]);
|
||||||
|
}
|
||||||
free(args->argv);
|
free(args->argv);
|
||||||
}
|
}
|
||||||
args->argc = 0;
|
args->argc = 0;
|
||||||
|
@ -60,8 +61,9 @@ int fuse_opt_add_arg(struct fuse_args *args, const char *arg)
|
||||||
assert(!args->argv || args->allocated);
|
assert(!args->argv || args->allocated);
|
||||||
|
|
||||||
newarg = strdup(arg);
|
newarg = strdup(arg);
|
||||||
if (!newarg)
|
if (!newarg) {
|
||||||
return alloc_failed();
|
return alloc_failed();
|
||||||
|
}
|
||||||
|
|
||||||
newargv = realloc(args->argv, (args->argc + 2) * sizeof(char *));
|
newargv = realloc(args->argv, (args->argc + 2) * sizeof(char *));
|
||||||
if (!newargv) {
|
if (!newargv) {
|
||||||
|
@ -80,8 +82,9 @@ static int fuse_opt_insert_arg_common(struct fuse_args *args, int pos,
|
||||||
const char *arg)
|
const char *arg)
|
||||||
{
|
{
|
||||||
assert(pos <= args->argc);
|
assert(pos <= args->argc);
|
||||||
if (fuse_opt_add_arg(args, arg) == -1)
|
if (fuse_opt_add_arg(args, arg) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (pos != args->argc - 1) {
|
if (pos != args->argc - 1) {
|
||||||
char *newarg = args->argv[args->argc - 1];
|
char *newarg = args->argv[args->argc - 1];
|
||||||
|
@ -117,8 +120,9 @@ static int add_opt_common(char **opts, const char *opt, int esc)
|
||||||
unsigned oldlen = *opts ? strlen(*opts) : 0;
|
unsigned oldlen = *opts ? strlen(*opts) : 0;
|
||||||
char *d = realloc(*opts, oldlen + 1 + strlen(opt) * 2 + 1);
|
char *d = realloc(*opts, oldlen + 1 + strlen(opt) * 2 + 1);
|
||||||
|
|
||||||
if (!d)
|
if (!d) {
|
||||||
return alloc_failed();
|
return alloc_failed();
|
||||||
|
}
|
||||||
|
|
||||||
*opts = d;
|
*opts = d;
|
||||||
if (oldlen) {
|
if (oldlen) {
|
||||||
|
@ -127,8 +131,9 @@ static int add_opt_common(char **opts, const char *opt, int esc)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; *opt; opt++) {
|
for (; *opt; opt++) {
|
||||||
if (esc && (*opt == ',' || *opt == '\\'))
|
if (esc && (*opt == ',' || *opt == '\\')) {
|
||||||
*d++ = '\\';
|
*d++ = '\\';
|
||||||
|
}
|
||||||
*d++ = *opt;
|
*d++ = *opt;
|
||||||
}
|
}
|
||||||
*d = '\0';
|
*d = '\0';
|
||||||
|
@ -154,19 +159,22 @@ static int add_opt(struct fuse_opt_context *ctx, const char *opt)
|
||||||
static int call_proc(struct fuse_opt_context *ctx, const char *arg, int key,
|
static int call_proc(struct fuse_opt_context *ctx, const char *arg, int key,
|
||||||
int iso)
|
int iso)
|
||||||
{
|
{
|
||||||
if (key == FUSE_OPT_KEY_DISCARD)
|
if (key == FUSE_OPT_KEY_DISCARD) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (key != FUSE_OPT_KEY_KEEP && ctx->proc) {
|
if (key != FUSE_OPT_KEY_KEEP && ctx->proc) {
|
||||||
int res = ctx->proc(ctx->data, arg, key, &ctx->outargs);
|
int res = ctx->proc(ctx->data, arg, key, &ctx->outargs);
|
||||||
if (res == -1 || !res)
|
if (res == -1 || !res) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
if (iso)
|
}
|
||||||
|
if (iso) {
|
||||||
return add_opt(ctx, arg);
|
return add_opt(ctx, arg);
|
||||||
else
|
} else {
|
||||||
return add_arg(ctx, arg);
|
return add_arg(ctx, arg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int match_template(const char *t, const char *arg, unsigned *sepp)
|
static int match_template(const char *t, const char *arg, unsigned *sepp)
|
||||||
{
|
{
|
||||||
|
@ -175,8 +183,9 @@ static int match_template(const char *t, const char *arg, unsigned *sepp)
|
||||||
sep = sep ? sep : strchr(t, ' ');
|
sep = sep ? sep : strchr(t, ' ');
|
||||||
if (sep && (!sep[1] || sep[1] == '%')) {
|
if (sep && (!sep[1] || sep[1] == '%')) {
|
||||||
int tlen = sep - t;
|
int tlen = sep - t;
|
||||||
if (sep[0] == '=')
|
if (sep[0] == '=') {
|
||||||
tlen++;
|
tlen++;
|
||||||
|
}
|
||||||
if (arglen >= tlen && strncmp(arg, t, tlen) == 0) {
|
if (arglen >= tlen && strncmp(arg, t, tlen) == 0) {
|
||||||
*sepp = sep - t;
|
*sepp = sep - t;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -192,9 +201,11 @@ static int match_template(const char *t, const char *arg, unsigned *sepp)
|
||||||
static const struct fuse_opt *find_opt(const struct fuse_opt *opt,
|
static const struct fuse_opt *find_opt(const struct fuse_opt *opt,
|
||||||
const char *arg, unsigned *sepp)
|
const char *arg, unsigned *sepp)
|
||||||
{
|
{
|
||||||
for (; opt && opt->templ; opt++)
|
for (; opt && opt->templ; opt++) {
|
||||||
if (match_template(opt->templ, arg, sepp))
|
if (match_template(opt->templ, arg, sepp)) {
|
||||||
return opt;
|
return opt;
|
||||||
|
}
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,39 +222,44 @@ static int process_opt_param(void *var, const char *format, const char *param,
|
||||||
if (format[1] == 's') {
|
if (format[1] == 's') {
|
||||||
char **s = var;
|
char **s = var;
|
||||||
char *copy = strdup(param);
|
char *copy = strdup(param);
|
||||||
if (!copy)
|
if (!copy) {
|
||||||
return alloc_failed();
|
return alloc_failed();
|
||||||
|
}
|
||||||
|
|
||||||
free(*s);
|
free(*s);
|
||||||
*s = copy;
|
*s = copy;
|
||||||
} else {
|
} else {
|
||||||
if (sscanf(param, format, var) != 1) {
|
if (sscanf(param, format, var) != 1) {
|
||||||
fuse_log(FUSE_LOG_ERR, "fuse: invalid parameter in option `%s'\n", arg);
|
fuse_log(FUSE_LOG_ERR, "fuse: invalid parameter in option `%s'\n",
|
||||||
|
arg);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int process_opt(struct fuse_opt_context *ctx,
|
static int process_opt(struct fuse_opt_context *ctx, const struct fuse_opt *opt,
|
||||||
const struct fuse_opt *opt, unsigned sep,
|
unsigned sep, const char *arg, int iso)
|
||||||
const char *arg, int iso)
|
|
||||||
{
|
{
|
||||||
if (opt->offset == -1U) {
|
if (opt->offset == -1U) {
|
||||||
if (call_proc(ctx, arg, opt->value, iso) == -1)
|
if (call_proc(ctx, arg, opt->value, iso) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
void *var = (char *)ctx->data + opt->offset;
|
void *var = (char *)ctx->data + opt->offset;
|
||||||
if (sep && opt->templ[sep + 1]) {
|
if (sep && opt->templ[sep + 1]) {
|
||||||
const char *param = arg + sep;
|
const char *param = arg + sep;
|
||||||
if (opt->templ[sep] == '=')
|
if (opt->templ[sep] == '=') {
|
||||||
param++;
|
param++;
|
||||||
if (process_opt_param(var, opt->templ + sep + 1,
|
}
|
||||||
param, arg) == -1)
|
if (process_opt_param(var, opt->templ + sep + 1, param, arg) ==
|
||||||
|
-1) {
|
||||||
return -1;
|
return -1;
|
||||||
} else
|
}
|
||||||
|
} else {
|
||||||
*(int *)var = opt->value;
|
*(int *)var = opt->value;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,13 +271,15 @@ static int process_opt_sep_arg(struct fuse_opt_context *ctx,
|
||||||
char *newarg;
|
char *newarg;
|
||||||
char *param;
|
char *param;
|
||||||
|
|
||||||
if (next_arg(ctx, arg) == -1)
|
if (next_arg(ctx, arg) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
param = ctx->argv[ctx->argctr];
|
param = ctx->argv[ctx->argctr];
|
||||||
newarg = malloc(sep + strlen(param) + 1);
|
newarg = malloc(sep + strlen(param) + 1);
|
||||||
if (!newarg)
|
if (!newarg) {
|
||||||
return alloc_failed();
|
return alloc_failed();
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(newarg, arg, sep);
|
memcpy(newarg, arg, sep);
|
||||||
strcpy(newarg + sep, param);
|
strcpy(newarg + sep, param);
|
||||||
|
@ -278,18 +296,20 @@ static int process_gopt(struct fuse_opt_context *ctx, const char *arg, int iso)
|
||||||
if (opt) {
|
if (opt) {
|
||||||
for (; opt; opt = find_opt(opt + 1, arg, &sep)) {
|
for (; opt; opt = find_opt(opt + 1, arg, &sep)) {
|
||||||
int res;
|
int res;
|
||||||
if (sep && opt->templ[sep] == ' ' && !arg[sep])
|
if (sep && opt->templ[sep] == ' ' && !arg[sep]) {
|
||||||
res = process_opt_sep_arg(ctx, opt, sep, arg,
|
res = process_opt_sep_arg(ctx, opt, sep, arg, iso);
|
||||||
iso);
|
} else {
|
||||||
else
|
|
||||||
res = process_opt(ctx, opt, sep, arg, iso);
|
res = process_opt(ctx, opt, sep, arg, iso);
|
||||||
if (res == -1)
|
}
|
||||||
|
if (res == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} else
|
} else {
|
||||||
return call_proc(ctx, arg, FUSE_OPT_KEY_OPT, iso);
|
return call_proc(ctx, arg, FUSE_OPT_KEY_OPT, iso);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int process_real_option_group(struct fuse_opt_context *ctx, char *opts)
|
static int process_real_option_group(struct fuse_opt_context *ctx, char *opts)
|
||||||
{
|
{
|
||||||
|
@ -298,24 +318,24 @@ static int process_real_option_group(struct fuse_opt_context *ctx, char *opts)
|
||||||
int end = 0;
|
int end = 0;
|
||||||
|
|
||||||
while (!end) {
|
while (!end) {
|
||||||
if (*s == '\0')
|
if (*s == '\0') {
|
||||||
end = 1;
|
end = 1;
|
||||||
|
}
|
||||||
if (*s == ',' || end) {
|
if (*s == ',' || end) {
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
*d = '\0';
|
*d = '\0';
|
||||||
res = process_gopt(ctx, opts, 1);
|
res = process_gopt(ctx, opts, 1);
|
||||||
if (res == -1)
|
if (res == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
d = opts;
|
d = opts;
|
||||||
} else {
|
} else {
|
||||||
if (s[0] == '\\' && s[1] != '\0') {
|
if (s[0] == '\\' && s[1] != '\0') {
|
||||||
s++;
|
s++;
|
||||||
if (s[0] >= '0' && s[0] <= '3' &&
|
if (s[0] >= '0' && s[0] <= '3' && s[1] >= '0' && s[1] <= '7' &&
|
||||||
s[1] >= '0' && s[1] <= '7' &&
|
|
||||||
s[2] >= '0' && s[2] <= '7') {
|
s[2] >= '0' && s[2] <= '7') {
|
||||||
*d++ = (s[0] - '0') * 0100 +
|
*d++ = (s[0] - '0') * 0100 + (s[1] - '0') * 0010 +
|
||||||
(s[1] - '0') * 0010 +
|
|
||||||
(s[2] - '0');
|
(s[2] - '0');
|
||||||
s += 2;
|
s += 2;
|
||||||
} else {
|
} else {
|
||||||
|
@ -347,43 +367,49 @@ static int process_option_group(struct fuse_opt_context *ctx, const char *opts)
|
||||||
|
|
||||||
static int process_one(struct fuse_opt_context *ctx, const char *arg)
|
static int process_one(struct fuse_opt_context *ctx, const char *arg)
|
||||||
{
|
{
|
||||||
if (ctx->nonopt || arg[0] != '-')
|
if (ctx->nonopt || arg[0] != '-') {
|
||||||
return call_proc(ctx, arg, FUSE_OPT_KEY_NONOPT, 0);
|
return call_proc(ctx, arg, FUSE_OPT_KEY_NONOPT, 0);
|
||||||
else if (arg[1] == 'o') {
|
} else if (arg[1] == 'o') {
|
||||||
if (arg[2])
|
if (arg[2]) {
|
||||||
return process_option_group(ctx, arg + 2);
|
return process_option_group(ctx, arg + 2);
|
||||||
else {
|
} else {
|
||||||
if (next_arg(ctx, arg) == -1)
|
if (next_arg(ctx, arg) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return process_option_group(ctx,
|
return process_option_group(ctx, ctx->argv[ctx->argctr]);
|
||||||
ctx->argv[ctx->argctr]);
|
|
||||||
}
|
}
|
||||||
} else if (arg[1] == '-' && !arg[2]) {
|
} else if (arg[1] == '-' && !arg[2]) {
|
||||||
if (add_arg(ctx, arg) == -1)
|
if (add_arg(ctx, arg) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
ctx->nonopt = ctx->outargs.argc;
|
ctx->nonopt = ctx->outargs.argc;
|
||||||
return 0;
|
return 0;
|
||||||
} else
|
} else {
|
||||||
return process_gopt(ctx, arg, 0);
|
return process_gopt(ctx, arg, 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int opt_parse(struct fuse_opt_context *ctx)
|
static int opt_parse(struct fuse_opt_context *ctx)
|
||||||
{
|
{
|
||||||
if (ctx->argc) {
|
if (ctx->argc) {
|
||||||
if (add_arg(ctx, ctx->argv[0]) == -1)
|
if (add_arg(ctx, ctx->argv[0]) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (ctx->argctr = 1; ctx->argctr < ctx->argc; ctx->argctr++)
|
for (ctx->argctr = 1; ctx->argctr < ctx->argc; ctx->argctr++) {
|
||||||
if (process_one(ctx, ctx->argv[ctx->argctr]) == -1)
|
if (process_one(ctx, ctx->argv[ctx->argctr]) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ctx->opts) {
|
if (ctx->opts) {
|
||||||
if (fuse_opt_insert_arg(&ctx->outargs, 1, "-o") == -1 ||
|
if (fuse_opt_insert_arg(&ctx->outargs, 1, "-o") == -1 ||
|
||||||
fuse_opt_insert_arg(&ctx->outargs, 2, ctx->opts) == -1)
|
fuse_opt_insert_arg(&ctx->outargs, 2, ctx->opts) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* If option separator ("--") is the last argument, remove it */
|
/* If option separator ("--") is the last argument, remove it */
|
||||||
if (ctx->nonopt && ctx->nonopt == ctx->outargs.argc &&
|
if (ctx->nonopt && ctx->nonopt == ctx->outargs.argc &&
|
||||||
|
@ -405,8 +431,9 @@ int fuse_opt_parse(struct fuse_args *args, void *data,
|
||||||
.proc = proc,
|
.proc = proc,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!args || !args->argv || !args->argc)
|
if (!args || !args->argv || !args->argc) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ctx.argc = args->argc;
|
ctx.argc = args->argc;
|
||||||
ctx.argv = args->argv;
|
ctx.argv = args->argv;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/*
|
/*
|
||||||
FUSE: Filesystem in Userspace
|
* FUSE: Filesystem in Userspace
|
||||||
Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
* Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
||||||
|
*
|
||||||
This program can be distributed under the terms of the GNU LGPLv2.
|
* This program can be distributed under the terms of the GNU LGPLv2.
|
||||||
See the file COPYING.LIB.
|
* See the file COPYING.LIB.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef FUSE_OPT_H_
|
#ifndef FUSE_OPT_H_
|
||||||
|
@ -91,13 +91,19 @@ struct fuse_opt {
|
||||||
* Key option. In case of a match, the processing function will be
|
* Key option. In case of a match, the processing function will be
|
||||||
* called with the specified key.
|
* called with the specified key.
|
||||||
*/
|
*/
|
||||||
#define FUSE_OPT_KEY(templ, key) { templ, -1U, key }
|
#define FUSE_OPT_KEY(templ, key) \
|
||||||
|
{ \
|
||||||
|
templ, -1U, key \
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last option. An array of 'struct fuse_opt' must end with a NULL
|
* Last option. An array of 'struct fuse_opt' must end with a NULL
|
||||||
* template value
|
* template value
|
||||||
*/
|
*/
|
||||||
#define FUSE_OPT_END { NULL, 0, 0 }
|
#define FUSE_OPT_END \
|
||||||
|
{ \
|
||||||
|
NULL, 0, 0 \
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Argument list
|
* Argument list
|
||||||
|
@ -116,7 +122,10 @@ struct fuse_args {
|
||||||
/**
|
/**
|
||||||
* Initializer for 'struct fuse_args'
|
* Initializer for 'struct fuse_args'
|
||||||
*/
|
*/
|
||||||
#define FUSE_ARGS_INIT(argc, argv) { argc, argv, 0 }
|
#define FUSE_ARGS_INIT(argc, argv) \
|
||||||
|
{ \
|
||||||
|
argc, argv, 0 \
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Key value passed to the processing function if an option did not
|
* Key value passed to the processing function if an option did not
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
/*
|
/*
|
||||||
FUSE: Filesystem in Userspace
|
* FUSE: Filesystem in Userspace
|
||||||
Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
* Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
||||||
|
*
|
||||||
Utility functions for setting signal handlers.
|
* Utility functions for setting signal handlers.
|
||||||
|
*
|
||||||
This program can be distributed under the terms of the GNU LGPLv2.
|
* This program can be distributed under the terms of the GNU LGPLv2.
|
||||||
See the file COPYING.LIB
|
* See the file COPYING.LIB
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "fuse_lowlevel.h"
|
|
||||||
#include "fuse_i.h"
|
#include "fuse_i.h"
|
||||||
|
#include "fuse_lowlevel.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
static struct fuse_session *fuse_instance;
|
static struct fuse_session *fuse_instance;
|
||||||
|
|
||||||
|
@ -61,16 +61,19 @@ static int set_one_signal_handler(int sig, void (*handler)(int), int remove)
|
||||||
|
|
||||||
int fuse_set_signal_handlers(struct fuse_session *se)
|
int fuse_set_signal_handlers(struct fuse_session *se)
|
||||||
{
|
{
|
||||||
/* If we used SIG_IGN instead of the do_nothing function,
|
/*
|
||||||
then we would be unable to tell if we set SIG_IGN (and
|
* If we used SIG_IGN instead of the do_nothing function,
|
||||||
thus should reset to SIG_DFL in fuse_remove_signal_handlers)
|
* then we would be unable to tell if we set SIG_IGN (and
|
||||||
or if it was already set to SIG_IGN (and should be left
|
* thus should reset to SIG_DFL in fuse_remove_signal_handlers)
|
||||||
untouched. */
|
* or if it was already set to SIG_IGN (and should be left
|
||||||
|
* untouched.
|
||||||
|
*/
|
||||||
if (set_one_signal_handler(SIGHUP, exit_handler, 0) == -1 ||
|
if (set_one_signal_handler(SIGHUP, exit_handler, 0) == -1 ||
|
||||||
set_one_signal_handler(SIGINT, exit_handler, 0) == -1 ||
|
set_one_signal_handler(SIGINT, exit_handler, 0) == -1 ||
|
||||||
set_one_signal_handler(SIGTERM, exit_handler, 0) == -1 ||
|
set_one_signal_handler(SIGTERM, exit_handler, 0) == -1 ||
|
||||||
set_one_signal_handler(SIGPIPE, do_nothing, 0) == -1)
|
set_one_signal_handler(SIGPIPE, do_nothing, 0) == -1) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
fuse_instance = se;
|
fuse_instance = se;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -78,11 +81,12 @@ int fuse_set_signal_handlers(struct fuse_session *se)
|
||||||
|
|
||||||
void fuse_remove_signal_handlers(struct fuse_session *se)
|
void fuse_remove_signal_handlers(struct fuse_session *se)
|
||||||
{
|
{
|
||||||
if (fuse_instance != se)
|
if (fuse_instance != se) {
|
||||||
fuse_log(FUSE_LOG_ERR,
|
fuse_log(FUSE_LOG_ERR,
|
||||||
"fuse: fuse_remove_signal_handlers: unknown session\n");
|
"fuse: fuse_remove_signal_handlers: unknown session\n");
|
||||||
else
|
} else {
|
||||||
fuse_instance = NULL;
|
fuse_instance = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
set_one_signal_handler(SIGHUP, exit_handler, 1);
|
set_one_signal_handler(SIGHUP, exit_handler, 1);
|
||||||
set_one_signal_handler(SIGINT, exit_handler, 1);
|
set_one_signal_handler(SIGINT, exit_handler, 1);
|
||||||
|
|
|
@ -1,33 +1,35 @@
|
||||||
/*
|
/*
|
||||||
FUSE: Filesystem in Userspace
|
* FUSE: Filesystem in Userspace
|
||||||
Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
* Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
|
||||||
|
*
|
||||||
|
* Helper functions to create (simple) standalone programs. With the
|
||||||
|
* aid of these functions it should be possible to create full FUSE
|
||||||
|
* file system by implementing nothing but the request handlers.
|
||||||
|
|
||||||
Helper functions to create (simple) standalone programs. With the
|
* This program can be distributed under the terms of the GNU LGPLv2.
|
||||||
aid of these functions it should be possible to create full FUSE
|
* See the file COPYING.LIB.
|
||||||
file system by implementing nothing but the request handlers.
|
|
||||||
|
|
||||||
This program can be distributed under the terms of the GNU LGPLv2.
|
|
||||||
See the file COPYING.LIB.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "fuse_i.h"
|
#include "fuse_i.h"
|
||||||
|
#include "fuse_lowlevel.h"
|
||||||
#include "fuse_misc.h"
|
#include "fuse_misc.h"
|
||||||
#include "fuse_opt.h"
|
#include "fuse_opt.h"
|
||||||
#include "fuse_lowlevel.h"
|
|
||||||
#include "mount_util.h"
|
#include "mount_util.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stddef.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#define FUSE_HELPER_OPT(t, p) \
|
#define FUSE_HELPER_OPT(t, p) \
|
||||||
{ t, offsetof(struct fuse_cmdline_opts, p), 1 }
|
{ \
|
||||||
|
t, offsetof(struct fuse_cmdline_opts, p), 1 \
|
||||||
|
}
|
||||||
|
|
||||||
static const struct fuse_opt fuse_helper_opts[] = {
|
static const struct fuse_opt fuse_helper_opts[] = {
|
||||||
FUSE_HELPER_OPT("-h", show_help),
|
FUSE_HELPER_OPT("-h", show_help),
|
||||||
|
@ -82,7 +84,9 @@ struct fuse_conn_info_opts {
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CONN_OPTION(t, p, v) \
|
#define CONN_OPTION(t, p, v) \
|
||||||
{ t, offsetof(struct fuse_conn_info_opts, p), v }
|
{ \
|
||||||
|
t, offsetof(struct fuse_conn_info_opts, p), v \
|
||||||
|
}
|
||||||
static const struct fuse_opt conn_info_opt_spec[] = {
|
static const struct fuse_opt conn_info_opt_spec[] = {
|
||||||
CONN_OPTION("max_write=%u", max_write, 0),
|
CONN_OPTION("max_write=%u", max_write, 0),
|
||||||
CONN_OPTION("max_write=", set_max_write, 1),
|
CONN_OPTION("max_write=", set_max_write, 1),
|
||||||
|
@ -124,7 +128,8 @@ static const struct fuse_opt conn_info_opt_spec[] = {
|
||||||
|
|
||||||
void fuse_cmdline_help(void)
|
void fuse_cmdline_help(void)
|
||||||
{
|
{
|
||||||
printf(" -h --help print help\n"
|
printf(
|
||||||
|
" -h --help print help\n"
|
||||||
" -V --version print version\n"
|
" -V --version print version\n"
|
||||||
" -d -o debug enable debug output (implies -f)\n"
|
" -d -o debug enable debug output (implies -f)\n"
|
||||||
" -f foreground operation\n"
|
" -f foreground operation\n"
|
||||||
|
@ -147,9 +152,8 @@ static int fuse_helper_opt_proc(void *data, const char *arg, int key,
|
||||||
|
|
||||||
char mountpoint[PATH_MAX] = "";
|
char mountpoint[PATH_MAX] = "";
|
||||||
if (realpath(arg, mountpoint) == NULL) {
|
if (realpath(arg, mountpoint) == NULL) {
|
||||||
fuse_log(FUSE_LOG_ERR,
|
fuse_log(FUSE_LOG_ERR, "fuse: bad mount point `%s': %s\n", arg,
|
||||||
"fuse: bad mount point `%s': %s\n",
|
strerror(errno));
|
||||||
arg, strerror(errno));
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return fuse_opt_add_opt(&opts->mountpoint, mountpoint);
|
return fuse_opt_add_opt(&opts->mountpoint, mountpoint);
|
||||||
|
@ -164,16 +168,16 @@ static int fuse_helper_opt_proc(void *data, const char *arg, int key,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int fuse_parse_cmdline(struct fuse_args *args,
|
int fuse_parse_cmdline(struct fuse_args *args, struct fuse_cmdline_opts *opts)
|
||||||
struct fuse_cmdline_opts *opts)
|
|
||||||
{
|
{
|
||||||
memset(opts, 0, sizeof(struct fuse_cmdline_opts));
|
memset(opts, 0, sizeof(struct fuse_cmdline_opts));
|
||||||
|
|
||||||
opts->max_idle_threads = 10;
|
opts->max_idle_threads = 10;
|
||||||
|
|
||||||
if (fuse_opt_parse(args, opts, fuse_helper_opts,
|
if (fuse_opt_parse(args, opts, fuse_helper_opts, fuse_helper_opt_proc) ==
|
||||||
fuse_helper_opt_proc) == -1)
|
-1) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -218,9 +222,10 @@ int fuse_daemonize(int foreground)
|
||||||
(void)dup2(nullfd, 0);
|
(void)dup2(nullfd, 0);
|
||||||
(void)dup2(nullfd, 1);
|
(void)dup2(nullfd, 1);
|
||||||
(void)dup2(nullfd, 2);
|
(void)dup2(nullfd, 2);
|
||||||
if (nullfd > 2)
|
if (nullfd > 2) {
|
||||||
close(nullfd);
|
close(nullfd);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Propagate completion of daemon initialization */
|
/* Propagate completion of daemon initialization */
|
||||||
completed = 1;
|
completed = 1;
|
||||||
|
@ -236,21 +241,28 @@ int fuse_daemonize(int foreground)
|
||||||
void fuse_apply_conn_info_opts(struct fuse_conn_info_opts *opts,
|
void fuse_apply_conn_info_opts(struct fuse_conn_info_opts *opts,
|
||||||
struct fuse_conn_info *conn)
|
struct fuse_conn_info *conn)
|
||||||
{
|
{
|
||||||
if(opts->set_max_write)
|
if (opts->set_max_write) {
|
||||||
conn->max_write = opts->max_write;
|
conn->max_write = opts->max_write;
|
||||||
if(opts->set_max_background)
|
}
|
||||||
|
if (opts->set_max_background) {
|
||||||
conn->max_background = opts->max_background;
|
conn->max_background = opts->max_background;
|
||||||
if(opts->set_congestion_threshold)
|
}
|
||||||
|
if (opts->set_congestion_threshold) {
|
||||||
conn->congestion_threshold = opts->congestion_threshold;
|
conn->congestion_threshold = opts->congestion_threshold;
|
||||||
if(opts->set_time_gran)
|
}
|
||||||
|
if (opts->set_time_gran) {
|
||||||
conn->time_gran = opts->time_gran;
|
conn->time_gran = opts->time_gran;
|
||||||
if(opts->set_max_readahead)
|
}
|
||||||
|
if (opts->set_max_readahead) {
|
||||||
conn->max_readahead = opts->max_readahead;
|
conn->max_readahead = opts->max_readahead;
|
||||||
|
}
|
||||||
|
|
||||||
#define LL_ENABLE(cond, cap) \
|
#define LL_ENABLE(cond, cap) \
|
||||||
if (cond) conn->want |= (cap)
|
if (cond) \
|
||||||
|
conn->want |= (cap)
|
||||||
#define LL_DISABLE(cond, cap) \
|
#define LL_DISABLE(cond, cap) \
|
||||||
if (cond) conn->want &= ~(cap)
|
if (cond) \
|
||||||
|
conn->want &= ~(cap)
|
||||||
|
|
||||||
LL_ENABLE(opts->splice_read, FUSE_CAP_SPLICE_READ);
|
LL_ENABLE(opts->splice_read, FUSE_CAP_SPLICE_READ);
|
||||||
LL_DISABLE(opts->no_splice_read, FUSE_CAP_SPLICE_READ);
|
LL_DISABLE(opts->no_splice_read, FUSE_CAP_SPLICE_READ);
|
||||||
|
|
|
@ -34,8 +34,9 @@ static int mknod_wrapper(int dirfd, const char *path, const char *link,
|
||||||
|
|
||||||
if (S_ISREG(mode)) {
|
if (S_ISREG(mode)) {
|
||||||
res = openat(dirfd, path, O_CREAT | O_EXCL | O_WRONLY, mode);
|
res = openat(dirfd, path, O_CREAT | O_EXCL | O_WRONLY, mode);
|
||||||
if (res >= 0)
|
if (res >= 0) {
|
||||||
res = close(res);
|
res = close(res);
|
||||||
|
}
|
||||||
} else if (S_ISDIR(mode)) {
|
} else if (S_ISDIR(mode)) {
|
||||||
res = mkdirat(dirfd, path, mode);
|
res = mkdirat(dirfd, path, mode);
|
||||||
} else if (S_ISLNK(mode) && link != NULL) {
|
} else if (S_ISLNK(mode) && link != NULL) {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue