Hi, I'm writing a file system under fuse-python. The main problem I'm facing now is that the flags which are provided by the fuse module when r/w are called, are screwing up the situation.
I wrote a file class for fuse as shown below. class FlusterFile(object): def __init__(self, path, flags, *mode): global WRITE_METHOD global NORMAL_WRITE global SNAP_WRITE global FRESH_SNAP tf.writelines("File initiating..\n") curdir = GetDirPath('.' + path) snapdir = '.' + path + '_snaps' snap_cnt = 0 if os.path.exists(snapdir): snap_cnt = len(os.listdir(snapdir)) elif FRESH_SNAP == 1: os.mkdir(snapdir) if FRESH_SNAP == 1: tf.writelines("Creating Fresh Snap\n") tf.writelines("File flags: %s mode: %s\n" % (flags,mode)) ### FIXME ### self.file = os.fdopen(os.open(snapdir + "/snap%s" % repr(snap_cnt +1), flags),flag2mode(flags)) self.fd = self.file.fileno() WRITE_METHOD = SNAP_WRITE FRESH_SNAP = 0 snap_cnt += 1 tf.writelines("Fresh Snap created %s %s %s\n" % (WRITE_METHOD,SNAP_WRITE,NORMAL_WRITE)) elif snap_cnt is 0: tf.writelines("Initiating Normal File...\n") self.file = os.fdopen(os.open("." + path, flags, *mode),flag2mode (flags)) self.fd = self.file.fileno() WRITE_METHOD = NORMAL_WRITE else: tf.writelines("Initiating latest Snap file..\n") self.file = os.fdopen(os.open(snapdir + "/snap%s" % repr (snap_cnt), flags, *mode),flag2mode(flags)) self.fd = self.file.fileno() WRITE_METHOD = SNAP_WRITE This init is called when we are accessing a file for r/w. Suppose the filesystem source is named fluster.py. (the filesystem mirrors files under /mnt/gfs_local to /fluster). When I set the FRESH_SNAP variable to 1 the error occurs and no file gets created. [r...@sreejith fuse]# ./flusterbeta.py /fluster/ [r...@sreejith fuse]# echo 'revenge' >> /fluster/fuse/fuse.txt -bash: /fluster/fuse/fuse.txt: No such file or directory Here I'm trying to pass the new data to a new snap file, which is to be created (but fuse doesn't allow this) Does this mean the fuse checks if the file is existing or not before it generates the appropriate flags ? -- http://mail.python.org/mailman/listinfo/python-list