[Gluster-users] glupy question
可樂我
colacolameme at gmail.com
Fri Aug 15 03:50:43 UTC 2014
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://supercolony.gluster.org/pipermail/gluster-users/attachments/20140815/65f89d6a/attachment.html>
More information about the Gluster-users
mailing list