glupy question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everyone,

I try to write a new xlator by using glupy xlator
I try to translate gf_dirent_t structure to python class
it looks like

------------------------------------------------------------
c code structure:
struct _gf_dirent_t {
    union {
        struct list_head             list;
        struct {
            struct _gf_dirent_t *next;
            struct _gf_dirent_t *prev;
        };
    };
    uint64_t                             d_ino;
    uint64_t                             d_off;
    uint32_t                             d_len;
    uint32_t                             d_type;
        struct iatt                          d_stat;
        dict_t                              *dict;
        inode_t                             *inode;
    char                                 d_name[];
};

-------------------------------------------------------------------
python code class:
class gf_dirent_t (Structure):
    pass

class dirent_struct (Structure):
    _fields_ = [
            ("next", POINTER(gf_dirent_t)),
            ("prev", POINTER(gf_dirent_t))
                ]

class dirent_union (Union):
    _fields_ = [
        ("list", list_head),
        ("dirents", dirent_struct)
        ]

gf_dirent_t._fields_ = [
    ("dirent_list", dirent_union),
    ("d_ino",c_uint64),
    ("d_off",c_uint64),
    ("d_len",c_uint32),
    ("d_type", c_uint32),
    ("d_stat", iatt_t),
    ("dict", POINTER(dict_t)),
    ("inode", POINTER(inode_t)),
    ("d_name", c_char_p)
    ]
-----------------------------------------------------------------------
then I print the d_len variable of gf_dirent_t class (in python)
but it is different with the d_len variable of _gf_dirent_t (in c code)
the value in python is 3386792520
the value in c is 1

anyone can tell me the python class I write is correct or not?
what's the problem?
thanks your help!
thanks a lot




_______________________________________________
Gluster-users mailing list
Gluster-users@xxxxxxxxxxx
http://supercolony.gluster.org/mailman/listinfo/gluster-users

[Index of Archives]     [Gluster Development]     [Linux Filesytems Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux