~ubuntu-branches/ubuntu/hardy/fuse/hardy-security

« back to all changes in this revision

Viewing changes to include/fuse.h

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2007-08-04 08:09:00 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20070804080900-m1e9xpk5eitzmelg
Tags: 2.7.0-1ubuntu1
* Resynchronise with Debian (LP: #128292). Remaining changes:
  - Don't install the init script; install the udev rule and the module
    configuration file instead.
  - debian/45-fuse.rules: set /dev/fuse group to fuse.
  - debian/fuse-utils.modprobe: module configuration file that mounts the
    control filesystem when fuse is loaded and unmounts it when fuse is
    unloaded, along with checking that the control FS is mounting before
    unmounting it.
  - debian/fuse-utils.install: add the udev rule, the module configuration
    file, and ulockmgr_server.
  - Load fuse on install, and set it so it gets loaded on reboot.
  - Move fusermount and ulockmgr_server to /bin and associated libraries
    to /lib.
* Use dpkg-query to fetch conffile md5sums rather than parsing
  /var/lib/dpkg/status directly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
    FUSE: Filesystem in Userspace
3
 
    Copyright (C) 2001-2006  Miklos Szeredi <miklos@szeredi.hu>
 
3
    Copyright (C) 2001-2007  Miklos Szeredi <miklos@szeredi.hu>
4
4
 
5
5
    This program can be distributed under the terms of the GNU LGPL.
6
6
    See the file COPYING.LIB.
97
97
 
98
98
    /** Create a file node
99
99
     *
100
 
     * If the filesystem doesn't define a create() operation, mknod()
101
 
     * will be called for creation of all non-directory, non-symlink
102
 
     * nodes.
 
100
     * This is called for creation of all non-directory, non-symlink
 
101
     * nodes.  If the filesystem defines a create() method, then for
 
102
     * regular files that will be called instead.
103
103
     */
104
104
    int (*mknod) (const char *, mode_t, dev_t);
105
105
 
132
132
 
133
133
    /** Change the access and/or modification times of a file
134
134
     *
135
 
     * Deprecated, use utimes() instead.
 
135
     * Deprecated, use utimens() instead.
136
136
     */
137
137
    int (*utime) (const char *, struct utimbuf *);
138
138
 
463
463
 * @param argc the argument counter passed to the main() function
464
464
 * @param argv the argument vector passed to the main() function
465
465
 * @param op the file system operation
466
 
 * @param user_data user data set in context for init() method
 
466
 * @param user_data user data supplied in the context during the init() method
467
467
 * @return 0 on success, nonzero on failure
468
468
 */
469
469
/*
482
482
 *
483
483
 * @param ch the communication channel
484
484
 * @param args argument vector
485
 
 * @param op the operations
 
485
 * @param op the filesystem operations
486
486
 * @param op_size the size of the fuse_operations structure
487
 
 * @param user_data user data set in context for init() method
 
487
 * @param user_data user data supplied in the context during the init() method
488
488
 * @return the created FUSE handle
489
489
 */
490
490
struct fuse *fuse_new(struct fuse_chan *ch, struct fuse_args *args,
572
572
int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op,
573
573
                   size_t op_size, void *user_data);
574
574
 
 
575
/*
 
576
 * Stacking API
 
577
 */
 
578
 
 
579
/**
 
580
 * Fuse filesystem object
 
581
 *
 
582
 * This is opaque object represents a filesystem layer
 
583
 */
 
584
struct fuse_fs;
 
585
 
 
586
/*
 
587
 * These functions call the relevant filesystem operation, and return
 
588
 * the result.
 
589
 *
 
590
 * If the operation is not defined, they return -ENOSYS, with the
 
591
 * exception of fuse_fs_open, fuse_fs_release, fuse_fs_opendir,
 
592
 * fuse_fs_releasedir and fuse_fs_statfs, which return 0.
 
593
 */
 
594
 
 
595
int fuse_fs_getattr(struct fuse_fs *fs, const char *path, struct stat *buf);
 
596
int fuse_fs_fgetattr(struct fuse_fs *fs, const char *path, struct stat *buf,
 
597
                     struct fuse_file_info *fi);
 
598
int fuse_fs_rename(struct fuse_fs *fs, const char *oldpath,
 
599
                   const char *newpath);
 
600
int fuse_fs_unlink(struct fuse_fs *fs, const char *path);
 
601
int fuse_fs_rmdir(struct fuse_fs *fs, const char *path);
 
602
int fuse_fs_symlink(struct fuse_fs *fs, const char *linkname,
 
603
                    const char *path);
 
604
int fuse_fs_link(struct fuse_fs *fs, const char *oldpath, const char *newpath);
 
605
int fuse_fs_release(struct fuse_fs *fs,  const char *path,
 
606
                     struct fuse_file_info *fi);
 
607
int fuse_fs_open(struct fuse_fs *fs, const char *path,
 
608
                 struct fuse_file_info *fi);
 
609
int fuse_fs_read(struct fuse_fs *fs, const char *path, char *buf, size_t size,
 
610
                 off_t off, struct fuse_file_info *fi);
 
611
int fuse_fs_write(struct fuse_fs *fs, const char *path, const char *buf,
 
612
                  size_t size, off_t off, struct fuse_file_info *fi);
 
613
int fuse_fs_fsync(struct fuse_fs *fs, const char *path, int datasync,
 
614
                  struct fuse_file_info *fi);
 
615
int fuse_fs_flush(struct fuse_fs *fs, const char *path,
 
616
                  struct fuse_file_info *fi);
 
617
int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statvfs *buf);
 
618
int fuse_fs_opendir(struct fuse_fs *fs, const char *path,
 
619
                    struct fuse_file_info *fi);
 
620
int fuse_fs_readdir(struct fuse_fs *fs, const char *path, void *buf,
 
621
                    fuse_fill_dir_t filler, off_t off,
 
622
                    struct fuse_file_info *fi);
 
623
int fuse_fs_fsyncdir(struct fuse_fs *fs, const char *path, int datasync,
 
624
                     struct fuse_file_info *fi);
 
625
int fuse_fs_releasedir(struct fuse_fs *fs, const char *path,
 
626
                        struct fuse_file_info *fi);
 
627
int fuse_fs_create(struct fuse_fs *fs, const char *path, mode_t mode,
 
628
                   struct fuse_file_info *fi);
 
629
int fuse_fs_lock(struct fuse_fs *fs, const char *path,
 
630
                 struct fuse_file_info *fi, int cmd, struct flock *lock);
 
631
int fuse_fs_chmod(struct fuse_fs *fs, const char *path, mode_t mode);
 
632
int fuse_fs_chown(struct fuse_fs *fs, const char *path, uid_t uid, gid_t gid);
 
633
int fuse_fs_truncate(struct fuse_fs *fs, const char *path, off_t size);
 
634
int fuse_fs_ftruncate(struct fuse_fs *fs, const char *path, off_t size,
 
635
                      struct fuse_file_info *fi);
 
636
int fuse_fs_utimens(struct fuse_fs *fs, const char *path,
 
637
                    const struct timespec tv[2]);
 
638
int fuse_fs_access(struct fuse_fs *fs, const char *path, int mask);
 
639
int fuse_fs_readlink(struct fuse_fs *fs, const char *path, char *buf,
 
640
                     size_t len);
 
641
int fuse_fs_mknod(struct fuse_fs *fs, const char *path, mode_t mode,
 
642
                  dev_t rdev);
 
643
int fuse_fs_mkdir(struct fuse_fs *fs, const char *path, mode_t mode);
 
644
int fuse_fs_setxattr(struct fuse_fs *fs, const char *path, const char *name,
 
645
                     const char *value, size_t size, int flags);
 
646
int fuse_fs_getxattr(struct fuse_fs *fs, const char *path, const char *name,
 
647
                     char *value, size_t size);
 
648
int fuse_fs_listxattr(struct fuse_fs *fs, const char *path, char *list,
 
649
                      size_t size);
 
650
int fuse_fs_removexattr(struct fuse_fs *fs, const char *path,
 
651
                        const char *name);
 
652
int fuse_fs_bmap(struct fuse_fs *fs, const char *path, size_t blocksize,
 
653
                 uint64_t *idx);
 
654
void fuse_fs_init(struct fuse_fs *fs, struct fuse_conn_info *conn);
 
655
void fuse_fs_destroy(struct fuse_fs *fs);
 
656
 
 
657
/**
 
658
 * Create a new fuse filesystem object
 
659
 *
 
660
 * This is usually called from the factory of a fuse module to create
 
661
 * a new instance of a filesystem.
 
662
 *
 
663
 * @param op the filesystem operations
 
664
 * @param op_size the size of the fuse_operations structure
 
665
 * @param user_data user data supplied in the context during the init() method
 
666
 * @return a new filesystem object
 
667
 */
 
668
struct fuse_fs *fuse_fs_new(const struct fuse_operations *op, size_t op_size,
 
669
                            void *user_data);
 
670
 
 
671
/**
 
672
 * Filesystem module
 
673
 *
 
674
 * Filesystem modules are registered with the FUSE_REGISTER_MODULE()
 
675
 * macro.
 
676
 *
 
677
 * If the "-omodules=modname:..." option is present, filesystem
 
678
 * objects are created and pushed onto the stack with the 'factory'
 
679
 * function.
 
680
 */
 
681
struct fuse_module {
 
682
    /**
 
683
     * Name of filesystem
 
684
     */
 
685
    const char *name;
 
686
 
 
687
    /**
 
688
     * Factory for creating filesystem objects
 
689
     *
 
690
     * The function may use and remove options from 'args' that belong
 
691
     * to this module.
 
692
     *
 
693
     * For now the 'fs' vector always contains exactly one filesystem.
 
694
     * This is the filesystem which will be below the newly created
 
695
     * filesystem in the stack.
 
696
     *
 
697
     * @param args the command line arguments
 
698
     * @param fs NULL terminated filesystem object vector
 
699
     * @return the new filesystem object
 
700
     */
 
701
    struct fuse_fs *(*factory)(struct fuse_args *args, struct fuse_fs *fs[]);
 
702
 
 
703
    struct fuse_module *next;
 
704
    struct fusemod_so *so;
 
705
    int ctr;
 
706
};
 
707
 
 
708
/**
 
709
 * Register a filesystem module
 
710
 *
 
711
 * This function is used by FUSE_REGISTER_MODULE and there's usually
 
712
 * no need to call it directly
 
713
 */
 
714
void fuse_register_module(struct fuse_module *mod);
 
715
 
 
716
/**
 
717
 * Register filesystem module
 
718
 *
 
719
 * For the parameters, see description of the fields in 'struct
 
720
 * fuse_module'
 
721
 */
 
722
#define FUSE_REGISTER_MODULE(name_, factory_) \
 
723
static __attribute__((constructor)) void name_ ## _register(void) \
 
724
{ \
 
725
    static struct fuse_module mod = { #name_, factory_, NULL, NULL, 0 }; \
 
726
    fuse_register_module(&mod); \
 
727
}
 
728
 
 
729
 
575
730
/* ----------------------------------------------------------- *
576
731
 * Advanced API for event handling, don't worry about this...  *
577
732
 * ----------------------------------------------------------- */