@@ -365,7 +365,14 @@ def __call__(self, *args, **kw):
365365
366366########### Custom objects for transmitting system structures to FUSE
367367
368- class Stat (object ):
368+ class FuseStruct (object ):
369+
370+ def __init__ (self , ** kw ):
371+ for k in kw :
372+ setattr (self , k , kw [k ])
373+
374+
375+ class Stat (FuseStruct ):
369376 """
370377 Auxiliary class which can be filled up stat attributes.
371378 The attributes are undefined by default.
@@ -375,13 +382,13 @@ class Stat(object):
375382
376383
377384
378- class StatVfs (object ):
385+ class StatVfs (FuseStruct ):
379386 """
380387 Auxiliary class which can be filled up statvfs attributes.
381388 The attributes are 0 by default.
382389 """
383390
384- def __init__ (self ):
391+ def __init__ (self , ** kw ):
385392
386393 self .f_bsize = 0
387394 self .f_frsize = 0
@@ -394,9 +401,10 @@ def __init__(self):
394401 self .f_flag = 0
395402 self .f_namemax = 0
396403
404+ FuseStruct .__init__ (self , ** kw )
397405
398406
399- class Direntry (object ):
407+ class Direntry (FuseStruct ):
400408 """
401409 Auxiliary class for carrying directory entry data.
402410 Initialized with `name`. Further attributes (each
@@ -421,21 +429,24 @@ class Direntry(object):
421429 attributes doesn't make sense in that context.
422430 """
423431
424- def __init__ (self , name ):
432+ def __init__ (self , name , ** kw ):
425433
426434 self .name = name
427435 self .offset = 0
428436 self .type = 0
429437 self .ino = 0
430438
439+ FuseStruct .__init__ (self , ** kw )
431440
432441
433- class FuseFileInfo :
442+ class FuseFileInfo (FuseStruct ):
443+
444+ def __init__ (self , ** kw ):
434445
435- def __init__ (self , keep = False , direct_io = False ):
436- self .keep = keep
437- self .direct_io = direct_io
446+ self .keep = False
447+ self .direct_io = False
438448
449+ FuseStruct .__init__ (self , ** kw )
439450
440451
441452
0 commit comments