Class: RFuse::Filler

Inherits:
Object
  • Object
show all
Defined in:
ext/rfuse/filler.c,
ext/rfuse/filler.c

Overview

Used by RFuse::Fuse#readdir to collect directory entries

Instance Method Summary collapse

Constructor Details

#initializeObject



5
6
7
# File 'ext/rfuse/filler.c', line 5

VALUE rfiller_initialize(VALUE self){
  return self;
}

Instance Method Details

#push(name, stat, offset) ⇒ Object

Add a value into the filler

Parameters:

  • name (String)

    a file name

  • stat (Stat)

    Stat info representing the file, may be nil

  • offset (Integer)

    index of next entry, or zero

Returns:

  • self or nil if the buffer is full



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'ext/rfuse/filler.c', line 28

VALUE rfiller_push(VALUE self, VALUE name, VALUE stat, VALUE offset) {
  struct filler_t *f;
  Data_Get_Struct(self,struct filler_t,f);
  //Allow nil return instead of a stat

  int result;

  if (NIL_P(stat)) {
    result = f->filler(f->buffer,STR2CSTR(name),NULL,NUM2LONG(offset));
  } else {
    struct stat st;
    memset(&st, 0, sizeof(st));
    rstat2stat(stat,&st);
    result = f->filler(f->buffer,STR2CSTR(name),&st,NUM2LONG(offset));
  }

  return result ? Qnil : self;
}