From: Jürg Billeter Date: Fri, 20 Feb 2009 20:13:34 +0000 (+0000) Subject: Add FUSE bindings, patch by John Carr, fixes bug 571187 X-Git-Tag: 0.5.7~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a42fdaa6b8f32f859b61ae09d67a1d2018b06fa6;p=thirdparty%2Fvala.git Add FUSE bindings, patch by John Carr, fixes bug 571187 2009-02-20 Jürg Billeter * vapi/Makefile.am: * vapi/fuse.deps: * vapi/fuse.vapi: * vapi/posix.vapi: Add FUSE bindings, patch by John Carr, fixes bug 571187 svn path=/trunk/; revision=2469 --- diff --git a/ChangeLog b/ChangeLog index 79bf62fd6..49e7d4604 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-02-20 Jürg Billeter + + * vapi/Makefile.am: + * vapi/fuse.deps: + * vapi/fuse.vapi: + * vapi/posix.vapi: + + Add FUSE bindings, patch by John Carr, fixes bug 571187 + 2009-02-20 Jürg Billeter * vapi/glib-2.0.vapi: diff --git a/vapi/Makefile.am b/vapi/Makefile.am index 6782d2478..470c3d8fc 100644 --- a/vapi/Makefile.am +++ b/vapi/Makefile.am @@ -12,6 +12,8 @@ dist_vapi_DATA = \ curses.vapi \ dbus-glib-1.vapi \ enchant.vapi \ + fuse.deps \ + fuse.vapi \ gconf-2.0.vapi \ glib-2.0.vapi \ gdk-2.0.deps \ diff --git a/vapi/fuse.deps b/vapi/fuse.deps new file mode 100644 index 000000000..b3188f742 --- /dev/null +++ b/vapi/fuse.deps @@ -0,0 +1 @@ +posix diff --git a/vapi/fuse.vapi b/vapi/fuse.vapi new file mode 100644 index 000000000..8232b20f7 --- /dev/null +++ b/vapi/fuse.vapi @@ -0,0 +1,114 @@ +/* fuse.vapi + * + * Copyright (C) 2009 Codethink Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * John Carr + */ + +using Posix; + +[CCode (cprefix = "fuse_", cheader_filename = "fuse/fuse.h")] +namespace Fuse { + [CCode (cname = "struct fuse_file_info")] + public struct FileInfo { + public int flags; + public ulong fh_old; + public int writepage; + public uint direct_io; + public uint keep_cache; + public uint flush; + public uint padding; + public uint64 fh; + public uint64 lock_owner; + } + + [CCode (cname = "struct fuse")] + public struct Fuse { + } + + [CCode (cname = "struct fuse_context")] + public struct Context { + Fuse fuse; + uid_t uid; + gid_t gid; + /*pid_t pid;*/ + void *private_data; + } + + [CCode (cname = "fuse_fill_dir_t")] + public static delegate int FillDir (void* buf, string name, stat? st, off_t offset); + + public static delegate int GetAttr (string path, stat* st); + public static delegate int Access (string path, int mask); + public static delegate int ReadLink (string path, char* buf, size_t size); + public static delegate int ReadDir (string path, void* buf, FillDir filler, off_t offset, FileInfo fi); + public static delegate int MkNod (string path, mode_t mode, dev_t rdev); + public static delegate int MkDir (string path, mode_t mode); + public static delegate int Unlink (string path); + public static delegate int RmDir (string path); + public static delegate int Symlink (string from, string to); + public static delegate int Rename (string from, string to); + public static delegate int Link (string from, string to); + public static delegate int Chmod (string path, mode_t mode); + public static delegate int Chown (string path, uid_t uid, gid_t gid); + public static delegate int Truncate (string path, off_t size); + public static delegate int Utimens (string path, timespec[2] ts); + public static delegate int Open (string path, FileInfo fi); + public static delegate int Read (string path, char* buf, size_t size, off_t offset, FileInfo fi); + public static delegate int Write (string path, char* buf, size_t size, off_t offset, FileInfo fi); + public static delegate int StatFs (string path, statvfs *stbuf); + public static delegate int Release (string path, FileInfo fi); + public static delegate int Fsync (string path, int isdatasync, FileInfo fi); + + public static delegate int SetXAttr (string path, string name, char* value, size_t size, int flags); + public static delegate int GetXAttr (string path, string name, char* value, size_t size); + public static delegate int ListXAttr (string path, char* list, size_t size); + public static delegate int RemoveXAttr (string path, string name); + + [CCode (cname = "struct fuse_operations")] + public struct Operations { + public GetAttr getattr; + public Access access; + public ReadLink readlink; + public ReadDir readdir; + public MkNod mknod; + public MkDir mkdir; + public Symlink symlink; + public Unlink unlink; + public RmDir rmdir; + public Rename rename; + public Link link; + public Chmod chmod; + public Chown chown; + public Truncate truncate; + public Utimens utimens; + public Open open; + public Read read; + public Write write; + public StatFs statfs; + public Release release; + public Fsync fsync; + public SetXAttr setxattr; + public GetXAttr getxattr; + public ListXAttr listxattr; + public RemoveXAttr removexattr; + } + + public int main ([CCode (array_length_pos = 0.9)] string[] args, Operations oper, void *user_data); + public Context get_context (); +} diff --git a/vapi/posix.vapi b/vapi/posix.vapi index 271ce0d0e..b3c2b9aa0 100644 --- a/vapi/posix.vapi +++ b/vapi/posix.vapi @@ -503,6 +503,183 @@ namespace Posix { [CCode (cheader_filename = "sys/socket.h")] public int socket (int domain, int type, int protocol); + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_IFMT; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_IFBLK; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_IFCHR; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_IFIFO; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_IFREG; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_IFDIR; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_IFLNK; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_IFSOCK; + + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_IRWXU; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_IRUSR; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_IWUSR; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_IXUSR; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_IRWXG; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_IRGRP; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_IWGRP; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_IXGRP; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_IRWXO; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_IROTH; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_IWOTH; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_IXOTH; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_ISUID; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_ISGID; + [CCode (cheader_filename = "sys/stat.h")] + public const mode_t S_ISVTX; + + [CCode (cheader_filename = "sys/stat.h")] + public bool S_ISBLK (mode_t mode); + [CCode (cheader_filename = "sys/stat.h")] + public bool S_ISCHR (mode_t mode); + [CCode (cheader_filename = "sys/stat.h")] + public bool S_ISDIR (mode_t mode); + [CCode (cheader_filename = "sys/stat.h")] + public bool S_ISFIFO (mode_t mode); + [CCode (cheader_filename = "sys/stat.h")] + public bool S_ISREG (mode_t mode); + [CCode (cheader_filename = "sys/stat.h")] + public bool S_ISLNK (mode_t mode); + [CCode (cheader_filename = "sys/stat.h")] + public bool S_ISSOCK (mode_t mode); + + [CCode (cheader_filename = "sys/stat.h", cname = "struct stat")] + public struct stat { + public dev_t st_dev; + public ino_t st_ino; + public mode_t st_mode; + public nlink_t st_nlink; + public uid_t st_uid; + public gid_t st_gid; + public dev_t st_rdev; + public size_t st_size; + public time_t st_atime; + public time_t st_mtime; + public time_t st_ctime; + public blksize_t st_blksize; + public blkcnt_t st_blocks; + } + + [SimpleType] + [IntegerType (rank = 9)] + [CCode (cheader_filename = "sys/statvfs.h")] + public struct fsblkcnt_t { + } + + [SimpleType] + [IntegerType (rank = 9)] + [CCode (cheader_filename = "sys/statvfs.h")] + public struct fsfilcnt_t { + } + + [CCode (cheader_filename = "sys/statvfs.h", cname = "struct statvfs")] + public struct statvfs { + public ulong f_bsize; + public ulong f_frsize; + public fsblkcnt_t f_blocks; + public fsblkcnt_t f_bfree; + public fsblkcnt_t f_bavail; + public fsfilcnt_t f_files; + public fsfilcnt_t f_ffree; + public fsfilcnt_t f_favail; + } + + [SimpleType] + [IntegerType (rank = 9)] + [CCode (cheader_filename = "sys/types.h")] + public struct off_t { + } + + [SimpleType] + [IntegerType (rank = 9)] + [CCode (cheader_filename = "sys/types.h")] + public struct uid_t { + } + + [SimpleType] + [IntegerType (rank = 9)] + [CCode (cheader_filename = "sys/types.h")] + public struct gid_t { + } + + [SimpleType] + [IntegerType (rank = 9)] + [CCode (cheader_filename = "sys/types.h")] + public struct mode_t { + } + + [SimpleType] + [IntegerType (rank = 9)] + [CCode (cheader_filename = "sys/types.h")] + public struct dev_t { + } + + [SimpleType] + [IntegerType (rank = 9)] + [CCode (cheader_filename = "sys/types.h")] + public struct ino_t { + } + + [SimpleType] + [IntegerType (rank = 9)] + [CCode (cheader_filename = "sys/types.h")] + public struct nlink_t { + } + + [SimpleType] + [IntegerType (rank = 9)] + [CCode (cheader_filename = "sys/types.h")] + public struct blksize_t { + } + + [SimpleType] + [IntegerType (rank = 9)] + [CCode (cheader_filename = "sys/types.h")] + public struct blkcnt_t { + } + + [CCode (cheader_filename = "time.h")] + public struct tm { + public int tm_sec; + public int tm_min; + public int tm_hour; + public int tm_mday; + public int tm_mon; + public int tm_year; + public int tm_wday; + public int tm_yday; + public int tm_isdt; + } + + [CCode (cheader_filename = "time.h")] + public struct timespec { + time_t tv_sec; + long tv_nsec; + } + [CCode (cheader_filename = "unistd.h")] public int close (int fd); [CCode (cheader_filename = "unistd.h")]