Changeset 8686

Show
Ignore:
Timestamp:
12/21/10 10:37:09 (2 years ago)
Author:
mtmoore
Message:

xattr_handler member functions changed to the first argument being a struct dentry * instead of struct inode *. Each function also added an additional handler_flags function. maint/config/kernel.m4 updated with appropriate #defines. This version of kernel.m4 also include changes to detect a change in the ctl_table struct with other patches to follow

Location:
branches/Orange-Branch
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/Orange-Branch/maint/config/kernel.m4

    r8317 r8686  
    1616        NOSTDINCFLAGS="-Werror-implicit-function-declaration -nostdinc -isystem `$CC -print-file-name=include`" 
    1717 
    18         CFLAGS="$USR_CFLAGS $NOSTDINCFLAGS -I$lk_src/include -I$lk_src/include/asm/mach-default -DKBUILD_STR(s)=#s -DKBUILD_BASENAME=KBUILD_STR(empty)  -DKBUILD_MODNAME=KBUILD_STR(empty) -imacros $lk_src/include/linux/autoconf.h" 
     18        CFLAGS="$USR_CFLAGS $NOSTDINCFLAGS -I$lk_src/include -I$lk_src/include/asm/mach-default -DKBUILD_STR(s)=#s -DKBUILD_BASENAME=KBUILD_STR(empty)  -DKBUILD_MODNAME=KBUILD_STR(empty)" 
     19 
     20        dnl kernels > 2.6.32 now use generated/autoconf.h 
     21        if test -f $lk_src/include/generated/autoconf.h ; then 
     22                CFLAGS="$CFLAGS -imacros $lk_src/include/generated/autoconf.h" 
     23        else 
     24                CFLAGS="$CFLAGS -imacros $lk_src/include/linux/autoconf.h" 
     25        fi 
    1926 
    2027        dnl we probably need additional includes if this build is intended 
     
    12851292 
    12861293 
     1294        dnl 2.6.33 API change, 
     1295        dnl Removed .ctl_name from struct ctl_table. 
     1296        tmp_cflags=$CFLAGS 
     1297        CFLAGS="$CFLAGS -Werror" 
     1298        AC_MSG_CHECKING([whether struct ctl_table has ctl_name]) 
     1299        AC_TRY_COMPILE([ 
     1300                #define __KERNEL__ 
     1301                #include <linux/sysctl.h> 
     1302                static struct ctl_table c = { .ctl_name = 0, }; 
     1303        ],[ ], 
     1304        AC_MSG_RESULT(yes) 
     1305        AC_DEFINE(HAVE_CTL_NAME, 1, Define if struct ctl_table has ctl_name member), 
     1306        AC_MSG_RESULT(no) 
     1307        ) 
     1308 
     1309        dnl Removed .strategy from struct ctl_table. 
     1310        AC_MSG_CHECKING([whether struct ctl_table has strategy]) 
     1311        AC_TRY_COMPILE([ 
     1312                #define __KERNEL__ 
     1313                #include <linux/sysctl.h> 
     1314                static struct ctl_table c = { .strategy = 0, }; 
     1315        ], [ ], 
     1316        AC_MSG_RESULT(yes) 
     1317        AC_DEFINE(HAVE_STRATEGY_NAME, 1, Define if struct ctl_table has strategy member), 
     1318        AC_MSG_RESULT(no) 
     1319        ) 
     1320        CFLAGS=$tmp_cflags 
     1321 
     1322        dnl 2.6.33 changed the parameter signature of xattr_handler get  
     1323        dnl member functions to have a fifth argument and changed the first 
     1324        dnl parameter from struct inode to struct dentry. if the test fails 
     1325        dnl assume the old 4 param with struct inode 
     1326        tmp_cflags=$CFLAGS 
     1327        CFLAGS="$CFLAGS -Werror" 
     1328        AC_MSG_CHECKING(for five-param xattr_handler.get) 
     1329        AC_TRY_COMPILE([ 
     1330                #define __KERNEL__ 
     1331                #include <linux/dcache.h> 
     1332                #include <linux/xattr.h> 
     1333                static struct xattr_handler x; 
     1334                static int get_xattr_h( struct dentry *d, const char *n,  
     1335                                        void *b, size_t s, int h) 
     1336                { return 0; } 
     1337        ],  
     1338        [  
     1339            x.get = get_xattr_h; 
     1340        ], 
     1341        AC_MSG_RESULT(yes) 
     1342        AC_DEFINE(HAVE_XATTR_HANLDER_GET_FIVE_PARAM, 1, [Define if kernel xattr_handle get function has dentry as first parameter and a fifth parameter]), 
     1343        AC_MSG_RESULT(no) 
     1344        ) 
     1345 
     1346        dnl 2.6.33 changed the parameter signature of xattr_handler set  
     1347        dnl member functions to have a sixth argument and changed the first 
     1348        dnl parameter from struct inode to struct dentry. if the test fails 
     1349        dnl assume the old 5 param with struct inode 
     1350        tmp_cflags=$CFLAGS 
     1351        CFLAGS="$CFLAGS -Werror" 
     1352        AC_MSG_CHECKING(for six-param xattr_handler.set) 
     1353        AC_TRY_COMPILE([ 
     1354                #define __KERNEL__ 
     1355                #include <linux/dcache.h> 
     1356                #include <linux/xattr.h> 
     1357                static struct xattr_handler x; 
     1358                static int set_xattr_h( struct dentry *d, const char *n,  
     1359                                        const void *b, size_t s, int f, int h) 
     1360                { return 0; } 
     1361        ],  
     1362        [  
     1363            x.set = set_xattr_h; 
     1364        ], 
     1365        AC_MSG_RESULT(yes) 
     1366        AC_DEFINE(HAVE_XATTR_HANLDER_SET_SIX_PARAM, 1, [Define if kernel xattr_handle set function has dentry as first parameter and a sixth parameter]), 
     1367        AC_MSG_RESULT(no) 
     1368        ) 
     1369 
     1370        CFLAGS=$tmp_cflags 
     1371 
    12871372        CFLAGS=$oldcflags 
    12881373 
  • branches/Orange-Branch/src/kernel/linux-2.6/acl.c

    r7924 r8686  
    381381} 
    382382 
    383 static int pvfs2_xattr_get_acl_access(struct inode *inode, 
    384         const char *name, void *buffer, size_t size) 
     383static int pvfs2_xattr_get_acl_access( 
     384#ifdef HAVE_XATTR_HANLDER_GET_FIVE_PARAM 
     385        struct dentry *dentry, 
     386#else 
     387        struct inode *inode, 
     388#endif /* HAVE_XATTR_HANLDER_GET_FIVE_PARAM */ 
     389        const char *name,  
     390        void *buffer,  
     391        size_t size 
     392#ifdef HAVE_XATTR_HANLDER_GET_FIVE_PARAM 
     393        , int handler_flag 
     394#endif /* HAVE_XATTR_HANLDER_GET_FIVE_PARAM */ 
     395        ) 
    385396{ 
    386397    gossip_debug(GOSSIP_ACL_DEBUG, "pvfs2_xattr_get_acl_access %s\n", name); 
     
    390401        return -EINVAL; 
    391402    } 
     403#ifdef HAVE_XATTR_HANLDER_GET_FIVE_PARAM 
     404    return pvfs2_xattr_get_acl(dentry->d_inode, ACL_TYPE_ACCESS, buffer, size); 
     405#else 
    392406    return pvfs2_xattr_get_acl(inode, ACL_TYPE_ACCESS, buffer, size); 
    393 } 
    394  
    395 static int pvfs2_xattr_get_acl_default(struct inode *inode, 
    396         const char *name, void *buffer, size_t size) 
     407#endif /* HAVE_XATTR_HANLDER_GET_FIVE_PARAM */ 
     408} 
     409 
     410static int pvfs2_xattr_get_acl_default( 
     411#ifdef HAVE_XATTR_HANLDER_GET_FIVE_PARAM 
     412        struct dentry *dentry, 
     413#else 
     414        struct inode *inode, 
     415#endif /* HAVE_XATTR_HANLDER_GET_FIVE_PARAM */ 
     416        const char *name,  
     417        void *buffer,  
     418        size_t size 
     419#ifdef HAVE_XATTR_HANLDER_GET_FIVE_PARAM 
     420        , int handler_flags 
     421#endif /* HAVE_XATTR_HANLDER_GET_FIVE_PARAM */ 
     422        ) 
    397423{ 
    398424    gossip_debug(GOSSIP_ACL_DEBUG, "pvfs2_xattr_get_acl_default %s\n", name); 
     
    402428        return -EINVAL; 
    403429    } 
     430#ifdef HAVE_XATTR_HANLDER_GET_FIVE_PARAM 
     431    return pvfs2_xattr_get_acl(dentry->d_inode, ACL_TYPE_DEFAULT, buffer, size); 
     432#else 
    404433    return pvfs2_xattr_get_acl(inode, ACL_TYPE_DEFAULT, buffer, size); 
    405 } 
    406  
    407 static int 
    408 pvfs2_xattr_set_acl(struct inode *inode, int type, const void *value, 
     434#endif /* HAVE_XATTR_HANLDER_GET_FIVE_PARAM */ 
     435} 
     436 
     437static int pvfs2_xattr_set_acl( 
     438struct inode *inode, int type, const void *value, 
    409439        size_t size) 
    410440{ 
     
    466496} 
    467497 
    468 static int pvfs2_xattr_set_acl_access(struct inode *inode,  
    469         const char *name, const void *buffer, size_t size, int flags) 
     498static int pvfs2_xattr_set_acl_access( 
     499#ifdef HAVE_XATTR_HANLDER_SET_SIX_PARAM 
     500        struct dentry *dentry, 
     501#else 
     502        struct inode *inode,  
     503#endif /* HAVE_XATTR_HANLDER_SET_SIX_PARAM */ 
     504        const char *name,  
     505        const void *buffer,  
     506        size_t size,  
     507        int flags 
     508#ifdef HAVE_XATTR_HANLDER_SET_SIX_PARAM 
     509        , int handler_flags 
     510#endif /* HAVE_XATTR_HANLDER_SET_SIX_PARAM */ 
     511        ) 
    470512{ 
    471513    gossip_debug(GOSSIP_ACL_DEBUG, "pvfs2_xattr_set_acl_access: %s\n", name); 
     
    475517        return -EINVAL; 
    476518    } 
     519#ifdef HAVE_XATTR_HANLDER_SET_SIX_PARAM 
     520    return pvfs2_xattr_set_acl(dentry->d_inode, ACL_TYPE_ACCESS, buffer, size); 
     521#else 
    477522    return pvfs2_xattr_set_acl(inode, ACL_TYPE_ACCESS, buffer, size); 
    478 } 
    479  
    480 static int pvfs2_xattr_set_acl_default(struct inode *inode,  
    481         const char *name, const void *buffer, size_t size, int flags) 
     523#endif /* HAVE_XATTR_HANLDER_SET_SIX_PARAM */ 
     524} 
     525 
     526static int pvfs2_xattr_set_acl_default( 
     527#ifdef HAVE_XATTR_HANLDER_SET_SIX_PARAM 
     528        struct dentry *dentry, 
     529#else 
     530        struct inode *inode,  
     531#endif 
     532        const char *name,  
     533        const void *buffer,  
     534        size_t size,  
     535        int flags 
     536#ifdef HAVE_XATTR_HANLDER_SET_SIX_PARAM 
     537        , int handler_flags 
     538#endif /* #ifdef HAVE_XATTR_HANLDER_SET_SIX_PARAM */ 
     539        ) 
    482540{ 
    483541    gossip_debug(GOSSIP_ACL_DEBUG, "pvfs2_xattr_set_acl_default: %s\n", name); 
     
    487545        return -EINVAL; 
    488546    } 
     547#ifdef HAVE_XATTR_HANLDER_SET_SIX_PARAM 
     548    return pvfs2_xattr_set_acl(dentry->d_inode, ACL_TYPE_DEFAULT, buffer, size); 
     549#else 
    489550    return pvfs2_xattr_set_acl(inode, ACL_TYPE_DEFAULT, buffer, size); 
     551#endif 
    490552} 
    491553