Changeset 9249

Show
Ignore:
Timestamp:
03/14/12 02:55:14 (14 months ago)
Author:
k
Message:

Fix for MacOSX where getmattr and setmattr require an additional argument.

Location:
branches/stable
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branches/stable/configure.in

    r9245 r9249  
    11751175        AC_MSG_RESULT(yes) 
    11761176        AC_DEFINE(HAVE_FGETXATTR_EXTRA_ARGS, 1, Define if fgetxattr takes position and option arguments), 
     1177        AC_MSG_RESULT(no) 
     1178) 
     1179 
     1180dnl 
     1181dnl check if setxattr takes extra arguments 
     1182AC_MSG_CHECKING([for setxattr extra arguments]) 
     1183AC_TRY_COMPILE([ 
     1184        #include <sys/types.h> 
     1185        #ifdef HAVE_ATTR_XATTR_H 
     1186        #include <attr/xattr.h> 
     1187        #endif 
     1188        #ifdef HAVE_SYS_XATTR_H 
     1189        #include <sys/xattr.h> 
     1190        #endif 
     1191        ], 
     1192        [ 
     1193        setxattr(0, 0, 0, 0, 0, 0); 
     1194        ], 
     1195        AC_MSG_RESULT(yes) 
     1196        AC_DEFINE(HAVE_SETXATTR_EXTRA_ARGS, 1, Define if setxattr takes position and option arguments), 
     1197        AC_MSG_RESULT(no) 
     1198) 
     1199 
     1200dnl 
     1201dnl check if getxattr takes extra arguments 
     1202AC_MSG_CHECKING([for getxattr extra arguments]) 
     1203AC_TRY_COMPILE([ 
     1204        #include <sys/types.h> 
     1205        #ifdef HAVE_ATTR_XATTR_H 
     1206        #include <attr/xattr.h> 
     1207        #endif 
     1208        #ifdef HAVE_SYS_XATTR_H 
     1209        #include <sys/xattr.h> 
     1210        #endif 
     1211        ], 
     1212        [ 
     1213        getxattr(0, 0, 0, 0, 0, 0); 
     1214        ], 
     1215        AC_MSG_RESULT(yes) 
     1216        AC_DEFINE(HAVE_GETXATTR_EXTRA_ARGS, 1, Define if getxattr takes position and option arguments), 
    11771217        AC_MSG_RESULT(no) 
    11781218) 
  • branches/stable/src/apps/user/getmattr.c

    r7760 r9249  
    55 */ 
    66 
     7#include "pvfs2-config.h" 
    78#include <unistd.h> 
    89#include <stdio.h> 
     
    5859    /*Get the mirroring attributes for the given file*/ 
    5960    if (my_args.mode) { 
     61#ifdef HAVE_GETXATTR_EXTRA_ARGS 
     62       ret = getxattr(my_args.filename 
     63                     ,"user.pvfs2.mirror.mode" 
     64                     ,&mode 
     65                     ,sizeof(mode) 
     66                     ,0 
     67                     ,0 ); 
     68#else 
    6069       ret = getxattr(my_args.filename 
    6170                     ,"user.pvfs2.mirror.mode" 
    6271                     ,&mode 
    6372                     ,sizeof(mode) ); 
     73#endif 
    6474       if (!ret) 
    6575          perror("Failure to get mirror mode"); 
     
    8999 
    90100    if (my_args.copies){ 
     101#ifdef HAVE_GETXATTR_EXTRA_ARGS 
     102        ret = getxattr(my_args.filename 
     103                      ,"user.pvfs2.mirror.copies" 
     104                      ,&(copies) 
     105                      ,sizeof(copies) 
     106                      ,0 
     107                      ,0); 
     108#else 
    91109        ret = getxattr(my_args.filename 
    92110                      ,"user.pvfs2.mirror.copies" 
    93111                      ,&(copies) 
    94112                      ,sizeof(copies) ); 
     113#endif 
    95114        if (!ret) 
    96115           perror("Failure to get mirror copies"); 
  • branches/stable/src/apps/user/setmattr.c

    r7760 r9249  
    55 */ 
    66 
     7#include "pvfs2-config.h" 
    78#include <unistd.h> 
    89#include <stdio.h> 
     
    5859       printf("Setting mirror mode to %d\n" 
    5960             ,my_args.mode); 
     61#ifdef HAVE_SETXATTR_EXTRA_ARGS 
     62       ret = setxattr(my_args.filename 
     63                     ,"user.pvfs2.mirror.mode" 
     64                     ,&(my_args.mode) 
     65                     ,sizeof(my_args.mode) 
     66                     ,0 
     67                     ,0); 
     68#else 
    6069       ret = setxattr(my_args.filename 
    6170                     ,"user.pvfs2.mirror.mode" 
     
    6372                     ,sizeof(my_args.mode) 
    6473                     ,0); 
     74#endif 
    6575       if (ret) 
    6676          perror("Failure to set mirror mode"); 
     
    7080        printf("Setting number of mirrored copies to %d\n" 
    7181          ,my_args.copies); 
     82#ifdef HAVE_SETXATTR_EXTRA_ARGS 
     83        ret = setxattr(my_args.filename 
     84                      ,"user.pvfs2.mirror.copies" 
     85                      ,&(my_args.copies) 
     86                      ,sizeof(my_args.copies) 
     87                      ,0 
     88                      ,0); 
     89#else 
    7290        ret = setxattr(my_args.filename 
    7391                      ,"user.pvfs2.mirror.copies" 
     
    7593                      ,sizeof(my_args.copies) 
    7694                      ,0); 
     95#endif 
    7796        if (ret) 
    7897           perror("Failure to set mirror copies");