[Libsysio-commit] HEAD: libsysio/include inode.h
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2009-09-22 22:33:47
|
Update of /cvsroot/libsysio/libsysio/include In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26122 Modified Files: inode.h Log Message: Depending on whether I_ASSOCIATIONS was defined the PB_SET_ASSOC macro was being built in two pretty different ways. With this change, the majority of the logic is the same and only whether or not to perform the pertinent list manipulations is different. Index: inode.h =================================================================== RCS file: /cvsroot/libsysio/libsysio/include/inode.h,v retrieving revision 1.62 retrieving revision 1.63 diff -u -w -b -B -p -r1.62 -r1.63 --- inode.h 9 Sep 2009 22:46:38 -0000 1.62 +++ inode.h 22 Sep 2009 22:33:37 -0000 1.63 @@ -397,6 +397,22 @@ struct pnode_base { PB_UNLOCK(_pb); \ } while (0) +#ifdef I_ASSOCIATIONS +#define _PB_ADD_ASSOC(_pb) \ + do { \ + LIST_INSERT_HEAD(&(_pb)->pb_ino->i_assoc, \ + (_pb), \ + pb_alinks); \ + } while (0) +#define _PB_REMOVE_ASSOC(_pb) \ + do { \ + LIST_REMOVE((_pb), pb_alinks); \ + } while (0) +#else +#define _PB_ADD_ASSOC(_pb) +#define _PB_REMOVE_ASSOC(_pb) +#endif + /* * Set path-base node association. * @@ -408,40 +424,22 @@ struct pnode_base { * NB(2): We no longer support re-association. Now, an association can be * set, anew, or cleared (only when destroying the path-base node. */ -#ifdef I_ASSOCIATIONS #define PB_SET_ASSOC(_pb, _ino) \ do { \ _PB_CHECK_LOCK((_pb), 1); \ if ((_pb)->pb_ino) { \ assert(!(_ino)); \ _I_CHECK_LOCK((_pb)->pb_ino, 1); \ - LIST_REMOVE((_pb), pb_alinks); \ + _PB_REMOVE_ASSOC(_pb); \ _I_RELE_NO_LOCK((_pb)->pb_ino); \ } \ (_pb)->pb_ino = (_ino); \ if ((_pb)->pb_ino) { \ _I_CHECK_LOCK((_pb)->pb_ino, 1); \ - LIST_INSERT_HEAD(&(_pb)->pb_ino->i_assoc, \ - (_pb), \ - pb_alinks); \ + _PB_ADD_ASSOC(_pb); \ _I_REF_NO_LOCK((_pb)->pb_ino); \ } \ } while (0) -#else -#define PB_SET_ASSOC(_pb, _ino) \ - do { \ - assert(!((_pb)->pb_ino && (_ino))); \ - if ((_pb)->pb_ino) { \ - _I_CHECK_LOCK((_pb)->pb_ino, 1); \ - _I_RELE_NO_LOCK((_pb)->pb_ino); \ - } \ - (_pb)->pb_ino = (_ino); \ - if ((_pb)->pb_ino) { \ - _I_CHECK_LOCK((_pb)->pb_ino, 1); \ - _I_REF_NO_LOCK((_pb)->pb_ino); \ - } \ - } while (0) -#endif /* * Since a file system may be multiply mounted, in different parts of the local |