/[fuse.before_github]/perl-llin/Fuse.xs
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /perl-llin/Fuse.xs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

perl/trunk/Fuse.xs revision 18 by dpavlin, Wed Dec 21 15:33:37 2005 UTC perl-llin/Fuse.xs revision 26 by dpavlin, Mon Jan 2 22:24:03 2006 UTC
# Line 501  int _PLfuse_read (const char *file, char Line 501  int _PLfuse_read (const char *file, char
501                                  rv = 0;                                  rv = 0;
502                          }                          }
503                          if(rv > buflen)                          if(rv > buflen)
504                                  croak("%i: read() handler returned more than buflen! (%i > %i)",getpid(),rv,buflen);                                  croak("read() handler returned more than buflen! (%i > %i)",rv,buflen);
505                          if(rv)                          if(rv)
506                                  memcpy(buf,SvPV_nolen(mysv),rv);                                  memcpy(buf,SvPV_nolen(mysv),rv);
507                  }                  }
# Line 541  int _PLfuse_write (const char *file, con Line 541  int _PLfuse_write (const char *file, con
541          return rv;          return rv;
542  }  }
543    
544  int _PLfuse_statfs (const char *file, struct statfs *st) {  /* FIXME check for old fuse API (< 21?) and use statfs here */
545    int _PLfuse_statfs (const char *file, struct statvfs *st) {
546          int rv;          int rv;
547          char *rvstr;          char *rvstr;
548          FUSE_CONTEXT_PRE;          FUSE_CONTEXT_PRE;
# Line 555  int _PLfuse_statfs (const char *file, st Line 556  int _PLfuse_statfs (const char *file, st
556          SPAGAIN;          SPAGAIN;
557          if(rv > 5) {          if(rv > 5) {
558                  st->f_bsize    = POPi;                  st->f_bsize    = POPi;
559                  st->f_bfree    = POPi;                  st->f_bfree = st->f_bavail = POPi;
560                  st->f_blocks   = POPi;                  st->f_blocks   = POPi;
561                  st->f_ffree    = POPi;                  st->f_ffree = st->f_favail  = POPi;
562                  st->f_files    = POPi;                  st->f_files    = POPi;
563                  st->f_namelen  = POPi;                  st->f_namemax  = POPi;
564                    /* zero all other */
565                    st->f_frsize = 4096;
566                    st->f_fsid = 0;
567                    st->f_flag = 0;
568    
569                  if(rv > 6)                  if(rv > 6)
570                          rv = POPi;                          rv = POPi;
571                  else                  else
# Line 857  PROTOTYPES: DISABLE Line 863  PROTOTYPES: DISABLE
863  void  void
864  perl_fuse_main(...)  perl_fuse_main(...)
865          PREINIT:          PREINIT:
866          struct fuse_operations fops = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};          struct fuse_operations fops =
867                    {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
868                     NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
869          int i, fd, varnum = 0, debug, threaded, have_mnt;          int i, fd, varnum = 0, debug, threaded, have_mnt;
870          char *mountpoint;          char *mountpoint;
871          char *mountopts;          char *mountopts;
# Line 885  perl_fuse_main(...) Line 893  perl_fuse_main(...)
893          mountopts = SvPV_nolen(ST(3));          mountopts = SvPV_nolen(ST(3));
894          for(i=0;i<N_CALLBACKS;i++) {          for(i=0;i<N_CALLBACKS;i++) {
895                  SV *var = ST(i+4);                  SV *var = ST(i+4);
896          /* allow symbolic references, or real code references. */                  /* allow symbolic references, or real code references. */
897                  if((var != &PL_sv_undef) && (SvPOK(var) || (SvROK(var) && SvTYPE(SvRV(var)) == SVt_PVCV))) {                  if(SvOK(var) && (SvPOK(var) || (SvROK(var) && SvTYPE(SvRV(var)) == SVt_PVCV))) {
898                          void **tmp1 = (void**)&_available_ops, **tmp2 = (void**)&fops;                          void **tmp1 = (void**)&_available_ops, **tmp2 = (void**)&fops;
899                          tmp2[i] = tmp1[i];                          tmp2[i] = tmp1[i];
900    #ifdef FUSE_USE_ITHREADS
901                          if(threaded)                          if(threaded)
902                  /* note: under 5.8.7, this croaks for code references. */                  /* note: under 5.8.7, this croaks for code references. */
903                  SvSHARE(var);                  SvSHARE(var);
904    #endif
905                          _PLfuse_callbacks[i] = var;                          _PLfuse_callbacks[i] = var;
906                    } else
907                    if(SvOK(var)) {
908                            croak("invalid callback passed to perl_fuse_main "
909                                  "(%s is not a string, code ref, or undef).\n",
910                                  i+4,SvPVbyte_nolen(var));
911                  }                  }
912          }          }
913          /* FIXME: need to pass fusermount arguments */          /* FIXME: need to pass fusermount arguments */

Legend:
Removed from v.18  
changed lines
  Added in v.26

  ViewVC Help
Powered by ViewVC 1.1.26