~ubuntu-branches/ubuntu/saucy/fuse-umfuse-iso9660/saucy

« back to all changes in this revision

Viewing changes to fuseiso9660.c

  • Committer: Bazaar Package Importer
  • Author(s): Filippo Giunchedi
  • Date: 2007-05-04 14:49:13 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070504144913-ym2183sw4oj70qmw
Tags: 0.2-1
new upstream version, manpage added 

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 *
4
4
 *   fuse/umfuse module for iso9660 filesystem support
5
5
 *   
6
 
 *   Copyright 2005,2006 Renzo Davoli University of Bologna - Italy
 
6
 *   Copyright 2005,2006,2007 Renzo Davoli University of Bologna - Italy
7
7
 *   
8
8
 *   This program is free software; you can redistribute it and/or modify
9
9
 *   it under the terms of the GNU General Public License as published by
10
 
 *   the Free Software Foundation; either version 2 of the License, or
11
 
 *   (at your option) any later version.
 
10
 *   the Free Software Foundation; either version 2 of the License
12
11
 *
13
12
 *   This program is distributed in the hope that it will be useful,
14
13
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
19
18
 *   with this program; if not, write to the Free Software Foundation, Inc.,
20
19
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21
20
 *
22
 
 *   $Id: fuseiso9660.c,v 1.2 2006/08/21 14:07:33 rd235 Exp $
 
21
 *   $Id: fuseiso9660.c,v 1.5 2007/04/23 10:00:16 garden Exp $
23
22
 *
24
23
 */
25
24
 
31
30
#endif
32
31
#endif
33
32
 
 
33
#include <config.h>
34
34
#include <fuse.h>
35
35
#include <stdio.h>
36
36
#include <stdlib.h>
46
46
#include <cdio/iso9660.h>
47
47
#include <cdio/logging.h>
48
48
#include "zisofs.h"
 
49
#include <v2fuseutils.h>
49
50
 
50
51
#ifdef HAVE_SETXATTR
51
52
#include <sys/xattr.h>
387
388
                memset (stbuf,0,sizeof(struct stat));
388
389
                /* XXX workaround
389
390
                 * should be unique and != existing devices */
390
 
                stbuf->st_dev=(dev_t) isofs;
 
391
                stbuf->st_dev=(dev_t) ((long)isofs);
391
392
                switch (isostat->type) {
392
393
                        case _STAT_FILE: 
393
394
                                stbuf->st_mode=__S_IFREG|0555;break;
537
538
        else 
538
539
#endif
539
540
        {
540
 
                struct iso9660fileinfo *fh9660=(struct iso9660fileinfo *)(fi->fh);
 
541
                struct iso9660fileinfo *fh9660=(struct iso9660fileinfo *)((long)(fi->fh));
541
542
                if (fh9660 ==NULL)
542
543
                        return -ENOENT;
543
544
                if (fh9660->pointer_block == NULL) /* UNCOMPRESSED ISO */
571
572
 
572
573
static int f_iso9660_release(const char *path, struct fuse_file_info *fi)
573
574
{
574
 
    struct iso9660fileinfo *fh9660=(struct iso9660fileinfo *)(fi->fh);
 
575
    struct iso9660fileinfo *fh9660=(struct iso9660fileinfo *)((long)(fi->fh));
575
576
                if (fh9660 != NULL) {
576
577
                        if (fh9660->pointer_block != NULL)
577
578
                                free(fh9660->pointer_block);
640
641
        return init_data;
641
642
}
642
643
#else
643
 
void *f_iso9660_init(void)
 
644
void *f_iso9660_init(struct fuse_conn_info *conn)
644
645
{
645
646
        struct fuse_context *mycontext;
646
647
        mycontext=fuse_get_context();
706
707
        struct fuse_context *mycontext;
707
708
        iso9660_t *isofs;
708
709
 
709
 
        if (argc < 3)
710
 
                return -1;
711
 
        //if (strcmp(argv[1],"-o")==0)
712
 
        //      argv+=2;
713
 
        //isofs=iso9660_open(argv[1]);
714
 
        isofs=iso9660_open_ext(argv[argc-2],ISO_EXTENSION_ALL);
 
710
        if (argc < 3) 
 
711
                v2f_usage(argv[0],&iso9660_oper);
 
712
        v2f_rearrangeargv(argc,argv);
 
713
        //isofs=iso9660_open_ext(argv[argc-2],ISO_EXTENSION_ALL);
 
714
        isofs=iso9660_open_ext(argv[1],ISO_EXTENSION_ALL);
715
715
        //printf("open %s %p\n",argv[argc-2],isofs);
716
716
        iso9660_ifs_read_superblock(isofs,ISO_EXTENSION_ALL);
717
717
        cdio_loglevel_default=CDIO_LOG_ERROR;
718
718
        if (isofs!=NULL) {
 
719
#if 0
719
720
#if ( FUSE_MINOR_VERSION <= 4 )
720
721
                fuse_fd = fuse_mount(argv[argc-1], "ro");
721
722
#else
722
723
                char *argargv[]={"ro",NULL};
723
724
                struct fuse_args arg={1,argargv,0};
724
 
                fuse_fd = fuse_mount(argv[argc-1], &arg);
 
725
 
 
726
                fuse_fd = fuse_mount(argv[argc+1], &arg);
725
727
#endif
726
728
#if ( FUSE_MINOR_VERSION <= 5 )
727
729
                fuse = fuse_new(fuse_fd, NULL, &iso9660_oper, sizeof(iso9660_oper));
730
732
                fuse = fuse_new(fuse_fd, &arg, &iso9660_oper, sizeof(iso9660_oper),isofs);
731
733
#endif
732
734
                //printf("MOUNT OKAY!\n");
733
 
 
734
735
                fuse_loop(fuse);
 
736
#endif
 
737
#if ( FUSE_MINOR_VERSION <= 5 )
 
738
                init_data=isofs;
 
739
                fuse_main(--argc,++argv,&iso9660_oper);
 
740
#else
 
741
                fuse_main(--argc,++argv,&iso9660_oper,isofs);
 
742
#endif
735
743
 
736
744
                iso9660_close(isofs);
737
745
                return 0;