home *** CD-ROM | disk | FTP | other *** search
/ ftp.parl.clemson.edu / 2015-02-07.ftp.parl.clemson.edu.tar / ftp.parl.clemson.edu / pub / pvfs2 / orangefs-2.8.3-20110323.tar.gz / orangefs-2.8.3-20110323.tar / orangefs / patches / posix-ext / posix-extensions-cvs.patch < prev    next >
Text File  |  2008-01-07  |  35KB  |  1,039 lines

  1. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/arch/i386/kernel/syscall_table.S vanilla-new/arch/i386/kernel/syscall_table.S
  2. --- vanilla/arch/i386/kernel/syscall_table.S    2006-03-19 23:53:29.000000000 -0600
  3. +++ vanilla-new/arch/i386/kernel/syscall_table.S    2006-04-07 10:28:39.000000000 -0500
  4. @@ -310,3 +310,5 @@
  5.      .long sys_pselect6
  6.      .long sys_ppoll
  7.      .long sys_unshare        /* 310 */
  8. +    .long sys_openg
  9. +    .long sys_openfh
  10. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/arch/ia64/kernel/entry.S vanilla-new/arch/ia64/kernel/entry.S
  11. --- vanilla/arch/ia64/kernel/entry.S    2006-03-19 23:53:29.000000000 -0600
  12. +++ vanilla-new/arch/ia64/kernel/entry.S    2006-04-07 10:28:39.000000000 -0500
  13. @@ -1619,5 +1619,7 @@
  14.      data8 sys_ni_syscall            // reserved for pselect
  15.      data8 sys_ni_syscall            // 1295 reserved for ppoll
  16.      data8 sys_unshare
  17. +    data8 sys_openg
  18. +    data8 sys_openfh
  19.  
  20.      .org sys_call_table + 8*NR_syscalls    // guard against failures to increase NR_syscalls
  21. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/arch/powerpc/kernel/systbl.S vanilla-new/arch/powerpc/kernel/systbl.S
  22. --- vanilla/arch/powerpc/kernel/systbl.S    2006-03-19 23:53:29.000000000 -0600
  23. +++ vanilla-new/arch/powerpc/kernel/systbl.S    2006-04-07 10:28:39.000000000 -0500
  24. @@ -322,3 +322,5 @@
  25.  COMPAT_SYS(pselect6)
  26.  COMPAT_SYS(ppoll)
  27.  SYSCALL(unshare)
  28. +SYSCALL(openg)
  29. +SYSCALL(openfh)
  30. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/arch/x86_64/ia32/ia32entry.S vanilla-new/arch/x86_64/ia32/ia32entry.S
  31. --- vanilla/arch/x86_64/ia32/ia32entry.S    2006-03-19 23:53:29.000000000 -0600
  32. +++ vanilla-new/arch/x86_64/ia32/ia32entry.S    2006-04-07 10:28:39.000000000 -0500
  33. @@ -688,6 +688,8 @@
  34.      .quad sys_ni_syscall        /* pselect6 for now */
  35.      .quad sys_ni_syscall        /* ppoll for now */
  36.      .quad sys_unshare        /* 310 */
  37. +    .quad compat_sys_openg
  38. +    .quad compat_sys_openfh
  39.  ia32_syscall_end:        
  40.      .rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8
  41.          .quad ni_syscall
  42. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/fs/compat.c vanilla-new/fs/compat.c
  43. --- vanilla/fs/compat.c    2006-03-19 23:53:29.000000000 -0600
  44. +++ vanilla-new/fs/compat.c    2006-04-07 13:39:13.000000000 -0500
  45. @@ -1332,6 +1332,27 @@
  46.  }
  47.  
  48.  /*
  49. + * Exactly like fs/open.c: sys_openg(), except that it doesn't set the 
  50. + * O_LARGEFILE flag.
  51. + */
  52. +asmlinkage long
  53. +compat_sys_openg(const char __user *pathname, void __user *uhandle, size_t __user *uhandle_len,
  54. +        int flags, int mode)
  55. +{
  56. +    return do_sys_openg(pathname, uhandle, uhandle_len, flags, mode);
  57. +}
  58. +
  59. +/*
  60. + * Exactly like fs/open.c: sys_openg(), except that it doesn't set the 
  61. + * O_LARGEFILE flag.
  62. + */
  63. +asmlinkage long
  64. +compat_sys_openfh(const char __user *uhandle, int uhandle_len)
  65. +{
  66. +    return do_sys_openfh(uhandle, uhandle_len);
  67. +}
  68. +
  69. +/*
  70.   * compat_count() counts the number of arguments/envelopes. It is basically
  71.   * a copy of count() from fs/exec.c, except that it works with 32 bit argv
  72.   * and envp pointers.
  73. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/fs/open.c vanilla-new/fs/open.c
  74. --- vanilla/fs/open.c    2006-03-19 23:53:29.000000000 -0600
  75. +++ vanilla-new/fs/open.c    2006-04-26 22:06:15.000000000 -0500
  76. @@ -27,9 +27,37 @@
  77.  #include <linux/pagemap.h>
  78.  #include <linux/syscalls.h>
  79.  #include <linux/rcupdate.h>
  80. +#include <linux/scatterlist.h>
  81. +#include <linux/crypto.h>
  82. +#include <linux/types.h>
  83.  
  84.  #include <asm/unistd.h>
  85.  
  86. +void get_filesystem(struct file_system_type *fs);
  87. +void put_filesystem(struct file_system_type *fs);
  88. +struct file_system_type *get_fs_type(const char *name);
  89. +
  90. +int vfs_statfs_lite(struct super_block *sb, struct kstatfs *buf, int statfs_mask)
  91. +{
  92. +    int retval = -ENODEV;
  93. +
  94. +    if (sb) {
  95. +        retval = -ENOSYS;
  96. +        if (sb->s_op->statfs_lite) {
  97. +            memset(buf, 0, sizeof(*buf));
  98. +            retval = security_sb_statfs(sb);
  99. +            if (retval)
  100. +                return retval;
  101. +            retval = sb->s_op->statfs_lite(sb, buf, statfs_mask);
  102. +            if (retval == 0 && buf->f_frsize == 0 && (statfs_mask & STATFS_M_FRSIZE) != 0)
  103. +                buf->f_frsize = buf->f_bsize;
  104. +        }
  105. +    }
  106. +    return retval;
  107. +}
  108. +
  109. +EXPORT_SYMBOL(vfs_statfs_lite);
  110. +
  111.  int vfs_statfs(struct super_block *sb, struct kstatfs *buf)
  112.  {
  113.      int retval = -ENODEV;
  114. @@ -1100,6 +1128,638 @@
  115.  }
  116.  EXPORT_SYMBOL_GPL(sys_openat);
  117.  
  118. +static unsigned int diff(struct timeval *end, struct timeval *begin)
  119. +{
  120. +    if (end->tv_usec < begin->tv_usec) {
  121. +        end->tv_usec += 1000000; end->tv_sec--;
  122. +    }
  123. +    end->tv_sec  -= begin->tv_sec;
  124. +    end->tv_usec -= begin->tv_usec;
  125. +    return ((end->tv_sec * 1000000) + (end->tv_usec));
  126. +}
  127. +
  128. +/*
  129. + * Compute a simple crc checksum
  130. + */
  131. +static inline __u32 simple_crc_csum(struct file_handle *fhandle)
  132. +{
  133. +    struct file_handle_generic *fhg;
  134. +    __le32 *u;
  135. +    __u8 *c;
  136. +    __u32 i, j;
  137. +    
  138. +    fhg = &fhandle->fh_generic;
  139. +    /* upto and not including the fhg_crc_csum field */
  140. +    for (i = 0, u = (__le32 *) fhg; u < (__le32 *)(&fhg->fhg_crc_csum); ++u)
  141. +        i += le32_to_cpup(u);
  142. +    /* and over the entire fh_private buffer */
  143. +    c = (__u8 *) fhandle->fh_private;
  144. +    for (j = 0; j < fhandle->fh_private_length; ++j) 
  145. +        i += *(c + j);
  146. +    return i;
  147. +}
  148. +
  149. +/*
  150. + * Compute and return a crc32c checksum using the crypto subsystem
  151. + * API
  152. + */
  153. +static __u32 compute_crc32_csum(struct file_handle *fhandle)
  154. +{
  155. +#define MAX_SG_LIST 8
  156. +    __u32 csum;
  157. +    __u32 i;
  158. +    struct crypto_tfm *tfm;
  159. +    struct scatterlist sg[MAX_SG_LIST];
  160. +    struct timeval begin, end;
  161. +
  162. +    do_gettimeofday(&begin);
  163. +    if (crypto_alg_available("crc32c", 0) == 0) {
  164. +        csum = simple_crc_csum(fhandle);
  165. +        do_gettimeofday(&end);
  166. +        printk(KERN_DEBUG "compute_crc32_csum[simple]: took %d usecs\n", diff(&end, &begin));
  167. +        goto out;
  168. +    }
  169. +
  170. +    tfm = crypto_alloc_tfm("crc32c", 0);
  171. +    if (tfm == NULL) {
  172. +        csum = simple_crc_csum(fhandle);
  173. +        goto out;
  174. +    }
  175. +
  176. +    crypto_digest_init(tfm);
  177. +
  178. +    i = 0;
  179. +    sg_set_buf(&sg[i++], &fhandle->fh_generic, 
  180. +            offsetof(struct file_handle_generic, fhg_crc_csum));
  181. +    sg_set_buf(&sg[i++], fhandle->fh_private, fhandle->fh_private_length);
  182. +
  183. +    crypto_digest_update(tfm, sg, i);
  184. +    crypto_digest_final(tfm, (__u8*)&csum);
  185. +    crypto_free_tfm(tfm);
  186. +    do_gettimeofday(&end);
  187. +    printk(KERN_DEBUG "compute_crc32_csum[tfm]: took %d usecs\n", diff(&end, &begin));
  188. +out:
  189. +    return csum;
  190. +#undef MAX_SG_LIST
  191. +}
  192. +
  193. +/* 
  194. + * Store a crc32 check sum into the handle buffer
  195. + * NOTE: We expect fhandle->fh_private and fhandle->fh_private_length
  196. + * to be initialized prior to this call!
  197. + */
  198. +static inline void store_crc32_csum(struct file_handle *fhandle)
  199. +{
  200. +    /* Compute the CRC checksum over the handle buffer */
  201. +    __u32 csum = compute_crc32_csum(fhandle);
  202. +    /* Set the CRC checksum into the handle buffer */
  203. +    set_fh_field(&fhandle->fh_generic, crc_csum, csum);
  204. +    return;
  205. +}
  206. +
  207. +/* 
  208. + * Verifies if a file handle's structure's check sum
  209. + * matches with what user-space indicates.
  210. + * This should catch most of the simple buffer handle corruption
  211. + * cases (but not the maliciously crafted ones!) for which
  212. + * we have the keyed SHA1 (HMAC-SHA1) algorithm verification.
  213. + * NOTE: We expect fhandle->fh_private and fhandle->fh_private_length
  214. + * to be initialized prior to this call!
  215. + * Returns 1 in case verification was successful and 0
  216. + * otherwise.
  217. + */
  218. +static inline int verify_crc32_csum(struct file_handle *fhandle)
  219. +{
  220. +    __u32 csum, crc_csum;
  221. +
  222. +    /* Compute the CRC checksum over the handle buffer */
  223. +    csum = compute_crc32_csum(fhandle);
  224. +    /* Retrieve the CRC checksum from the handle buffer */
  225. +    get_fh_field(&fhandle->fh_generic, crc_csum, crc_csum);
  226. +    return (crc_csum == csum);
  227. +}
  228. +
  229. +/* 
  230. + * Compute a hmac-sha1 crypto check sum using a specified
  231. + * key and store it in the buffer pointed to by result.
  232. + * NOTE: We assume that fhandle->fh_private and
  233. + * fhandle->fh_private_length are initialized prior to this call.
  234. + * Returns 0 in case SHA1/HMAC-SHA1 was not built-in/compiled
  235. + * for the kernel
  236. + * Else returns length of the digest generated.
  237. + */
  238. +static unsigned int compute_hmac_sha1_csum(struct file_handle *fhandle, 
  239. +        char *key, int keylen, char *result)
  240. +{
  241. +#define MAX_SG_LIST 8
  242. +    __u32 i;
  243. +    struct crypto_tfm *tfm;
  244. +    struct scatterlist sg[MAX_SG_LIST];
  245. +    unsigned int ret;
  246. +    struct timeval begin, end;
  247. +    do_gettimeofday(&begin);
  248. +
  249. +    /* SHA1 is not available */
  250. +    if (crypto_alg_available("sha1", 0) == 0)
  251. +        return 0;
  252. +
  253. +    tfm = crypto_alloc_tfm("sha1", 0);
  254. +    if (tfm == NULL)
  255. +        return 0;
  256. +
  257. +    i = 0;
  258. +    sg_set_buf(&sg[i++], &fhandle->fh_generic, 
  259. +            offsetof(struct file_handle_generic, fhg_hmac_sha1));
  260. +    sg_set_buf(&sg[i++], fhandle->fh_private, fhandle->fh_private_length);
  261. +
  262. +    crypto_hmac(tfm, key, &keylen, sg, i, result);
  263. +    ret = crypto_tfm_alg_digestsize(tfm);
  264. +    crypto_free_tfm(tfm);
  265. +    do_gettimeofday(&end);
  266. +    printk(KERN_DEBUG "compute_hmac_sha1_csum: took %d usecs\n", diff(&end, &begin));
  267. +    return ret;
  268. +#undef MAX_SG_LIST
  269. +}
  270. +
  271. +/*
  272. + * Store a hmac-sha1 crypto check sum into the handle
  273. + * buffer.
  274. + */
  275. +static inline void store_hmac_csum(struct file_handle *fhandle,
  276. +        char *key, int keylen)
  277. +{
  278. +    compute_hmac_sha1_csum(fhandle, key, keylen,
  279. +            fhandle->fh_generic.fhg_hmac_sha1);
  280. +    return;
  281. +}
  282. +
  283. +/*
  284. + * Verifies if a file handle buffer's computed hmac-sha1 crypto
  285. + * check sum matches with whatever the user-space buffer claims
  286. + * Returns 1 in case verification was succesful and 0
  287. + * otherwise
  288. + */
  289. +static int verify_hmac_csum(struct file_handle *fhandle, char *key, int keylen)
  290. +{
  291. +    __u8 result[24];
  292. +    unsigned int result_len;
  293. +
  294. +    result_len = compute_hmac_sha1_csum(fhandle, key, keylen, result);
  295. +    /* Crypto is not supported. deny verification */
  296. +    if (result_len == 0) 
  297. +        return 0;
  298. +
  299. +    /* Check if user has tampered with the buffer */
  300. +    if (memcmp(fhandle->fh_generic.fhg_hmac_sha1, result, result_len) == 0)
  301. +        return 1;
  302. +    return 0;
  303. +}
  304. +
  305. +/*
  306. + * Copy the constructed file handle to a user-specified buffer.
  307. + * NOTE: We assume that fhandle->fh_private and
  308. + * fhandle->fh_private_length have been initialized
  309. + * prior to this routine
  310. + */
  311. +static int copy_handle(const void __user *uaddr, struct file_handle *fhandle)
  312. +{
  313. +    char __user *ptr = (char __user *) uaddr;
  314. +    struct timeval begin, end;
  315. +    do_gettimeofday(&begin);
  316. +
  317. +    /* Copy the VFS generic part of the handle */
  318. +    if (copy_to_user(ptr, &fhandle->fh_generic, 
  319. +                sizeof(struct file_handle_generic)))
  320. +        return -EFAULT;
  321. +
  322. +    /* Advance the user-buffer pointer */
  323. +    ptr += sizeof(struct file_handle_generic);
  324. +    /* Copy the FS specific part of the handle */
  325. +    if (copy_to_user(ptr, fhandle->fh_private, fhandle->fh_private_length))
  326. +        return -EFAULT;
  327. +    do_gettimeofday(&end);
  328. +    printk(KERN_DEBUG "copy_handle: took %d usecs\n", diff(&end, &begin));
  329. +    return 0;
  330. +}
  331. +
  332. +/*
  333. + * Copy a user-specified handle buffer to a temporary
  334. + * kernel buffer.
  335. + */
  336. +static void* move_handle_to_kernel(const void __user *uaddr, 
  337. +        size_t ulen, void *kaddr)
  338. +{
  339. +    if (uaddr != NULL) {
  340. +        if (copy_from_user(kaddr, uaddr, ulen))
  341. +            return ERR_PTR(-EFAULT);
  342. +    }
  343. +    return kaddr;
  344. +}
  345. +
  346. +/*
  347. + * Copy a specified size user-space handle buffer to a temporary
  348. + * kernel buffer and return a pointer to the kernel buffer.
  349. + * Encodes error in return pointer in case 
  350. + * operation failed for some reason.
  351. + */
  352. +static void *gethandle(const void __user *uhandle, size_t uhandle_len)
  353. +{
  354. +    void *tmp = NULL, *result = ERR_PTR(-EINVAL);
  355. +    struct timeval begin, end;
  356. +    do_gettimeofday(&begin);
  357. +
  358. +    do {
  359. +        if (uhandle_len <= 0 || uhandle_len > MAX_HANDLE_LEN) 
  360. +            break;
  361. +        result = ERR_PTR(-ENOMEM);
  362. +        tmp = kmalloc(uhandle_len, GFP_KERNEL);
  363. +        if (tmp == NULL) 
  364. +            break;
  365. +        result = move_handle_to_kernel(uhandle, uhandle_len, tmp);
  366. +    } while (0);
  367. +    do_gettimeofday(&end);
  368. +    printk(KERN_DEBUG "gethandle: took %d usecs\n", diff(&end, &begin));
  369. +    return result;
  370. +}
  371. +/*
  372. + * Frees memory allocated to a temporary kernel space buffer
  373. + * used for staging the handle copy from user-space.
  374. + */
  375. +static void puthandle(void *handle)
  376. +{
  377. +    if (handle)
  378. +        kfree(handle);
  379. +    return;
  380. +}
  381. +
  382. +/*
  383. + * Wrapper routine to obtain any FS specific keys that can be used
  384. + * for the HMAC-SHA1 calculation to make the handle returned
  385. + * by openg() tamper-proof or atleast tamper-detectable.
  386. + *    We dont use any keys in case FS does not provide one!
  387. + */
  388. +static void get_fs_key(struct super_block *sb, char **ppkey, int *keylen)
  389. +{
  390. +    struct timeval begin, end;
  391. +
  392. +    *ppkey = NULL;
  393. +    *keylen = 0;
  394. +    do_gettimeofday(&begin);
  395. +    /* underlying fs wishes to provide a key */
  396. +    if (sb && sb->s_op && sb->s_op->get_fs_key)
  397. +        sb->s_op->get_fs_key(sb, ppkey, keylen);
  398. +    do_gettimeofday(&end);
  399. +    printk(KERN_DEBUG "get_fs_key: took %d usecs\n", diff(&end, &begin));
  400. +    return;
  401. +}
  402. +
  403. +/*
  404. + * Free the memory allocated to fhandle->fh_private.
  405. + * This is done by either calling the provided destructor
  406. + * function if any (supplied by fill_handle callback of FS).
  407. + * or by calling kfree(). We expect FS to either use kmalloc()
  408. + * or supply a dtor function so that fh_private can be properly
  409. + * deallocated.
  410. + */
  411. +static void drop_file_handle_private(struct file_handle *fhandle)
  412. +{
  413. +    if (!fhandle || !fhandle->fh_private)
  414. +        return;
  415. +    if (fhandle->fh_private_dtor) 
  416. +        fhandle->fh_private_dtor(fhandle->fh_private);
  417. +    else 
  418. +        kfree(fhandle->fh_private);
  419. +    fhandle->fh_private = NULL;
  420. +    return;
  421. +}
  422. +
  423. +/*
  424. + * Associate and establish a file handle to a struct file mapping.
  425. + * NOTE: Linux VFS is inherently based off a dentry cache model
  426. + * and since we dont have any pathnames/filenames we need to create a anon.
  427. + * dentry to represent files opened using this system call.
  428. + */
  429. +static struct file *do_fh_open(const void *handle, size_t handle_len)
  430. +{
  431. +    struct file *filp = NULL;
  432. +    struct super_block *sb;
  433. +    struct inode *inode = NULL;
  434. +    struct file_handle fhandle;
  435. +    size_t min_len = sizeof(struct file_handle_generic);
  436. +    char *key = NULL;
  437. +    int   keylen = 0;
  438. +    struct timeval begin, end;
  439. +    
  440. +    /* Do some sanity checks on the handle lengths and handle buffer */
  441. +    if (handle_len <= min_len)
  442. +        return ERR_PTR(-EINVAL);
  443. +
  444. +    memcpy(&fhandle.fh_generic, handle, min_len);
  445. +    /* set the fields of the file handle prior to verification */
  446. +    fhandle.fh_private = (char *) handle + min_len;
  447. +    fhandle.fh_private_length = (handle_len - min_len);
  448. +    fhandle.fh_private_dtor = NULL;
  449. +    /* verify crc32 checksum on the handle buffer */
  450. +    if (!verify_crc32_csum(&fhandle))
  451. +        return ERR_PTR(-EACCES);
  452. +
  453. +    /*
  454. +     * Verification of HMAC SHA1 csum on the handle buffer cannot be 
  455. +     * done at this point  since we don't know which file
  456. +     * system/superblock it belongs to.
  457. +     */
  458. +
  459. +    /* Locate and get an active reference to a 
  460. +     * super-block that matches a given handle 
  461. +     */
  462. +    do_gettimeofday(&begin);
  463. +    sb = get_sb_handle(&fhandle);
  464. +    /* could not find any valid FS that owns this handle */
  465. +    if (!sb)
  466. +        return ERR_PTR(-EINVAL);
  467. +
  468. +    do_gettimeofday(&end);
  469. +    printk(KERN_DEBUG "get_sb_handle: took %d usecs\n", diff(&end, &begin));
  470. +    /* FS has not implemented a routine to query inode based on handle */
  471. +    if (!sb->s_op || !sb->s_op->find_inode_handle) {
  472. +        filp = ERR_PTR(-EOPNOTSUPP);
  473. +        goto out;
  474. +    }
  475. +    /* Check if underlying FS wishes to use a key */
  476. +    get_fs_key(sb, &key, &keylen);
  477. +    /* and verify the authenticity of the handle buffer */
  478. +    if (verify_hmac_csum(&fhandle, key, keylen) == 0) {
  479. +        /* Permission denied */
  480. +        filp = ERR_PTR(-EACCES);
  481. +        goto out;
  482. +    }
  483. +    do_gettimeofday(&begin);
  484. +    /* find an inode or allocate/lookup an inode based on the handle */
  485. +    inode = sb->s_op->find_inode_handle(sb, &fhandle);
  486. +    if (!IS_ERR(inode)) {
  487. +        struct dentry *anon_dentry;
  488. +        int flags = 0;
  489. +
  490. +        do_gettimeofday(&end);
  491. +        printk(KERN_DEBUG "s_op->find_inode_handle: took %d usecs\n", diff(&end, &begin));
  492. +
  493. +        get_fh_field(&fhandle.fh_generic, flags, flags);
  494. +        /* 
  495. +         * Associate a anonymous dentry to this inode in case there is none.
  496. +         * d_prune_aliases() will take care of freeeing all these dentries
  497. +         * which is called when the last reference to iput() calls
  498. +         * put_inode() which in turn calls the above function.
  499. +         */
  500. +        do_gettimeofday(&begin);
  501. +        anon_dentry = d_alloc_anon(inode);
  502. +        if (anon_dentry == NULL) {
  503. +            filp = ERR_PTR(-ENOMEM);
  504. +            goto drop_inode;
  505. +        }
  506. +        /* and setup file and inode mapping */
  507. +        filp = get_empty_filp();
  508. +        if (filp == NULL) {
  509. +            filp = ERR_PTR(-ENFILE);
  510. +            goto drop_dentry;
  511. +        }
  512. +        filp = __dentry_open(anon_dentry, NULL, flags, filp, NULL);
  513. +        if (IS_ERR(filp)) {
  514. +            /* in case of error __dentry_open drops the anon_dentry */
  515. +            goto drop_inode;
  516. +    drop_dentry:
  517. +            dput(anon_dentry);
  518. +    drop_inode:
  519. +            iput(inode);
  520. +        }
  521. +        else {
  522. +            do_gettimeofday(&end);
  523. +            printk(KERN_DEBUG "d_alloc_anon + misc.: took %d usecs\n", diff(&end, &begin));
  524. +        }
  525. +    }
  526. +    else {
  527. +        /* in case of error */
  528. +        filp = ERR_PTR(PTR_ERR(inode));
  529. +    }
  530. +out:
  531. +    /* drop our active reference to sb */
  532. +    drop_super(sb);
  533. +    return filp;
  534. +}
  535. +
  536. +long do_sys_openfh(const void __user *uhandle, size_t handle_len)
  537. +{
  538. +    void *tmp = gethandle(uhandle, handle_len);
  539. +    int fd = PTR_ERR(tmp);
  540. +
  541. +    if (!IS_ERR(tmp)) {
  542. +        struct timeval begin, end;
  543. +
  544. +        do_gettimeofday(&begin);
  545. +        fd = get_unused_fd();
  546. +        do_gettimeofday(&end);
  547. +        printk(KERN_DEBUG "get_unused_fd: took %d usecs\n", diff(&end, &begin));
  548. +        if (fd >= 0) {
  549. +            struct file *f;
  550. +
  551. +            do_gettimeofday(&begin);
  552. +            f = do_fh_open(tmp, handle_len);
  553. +            if (IS_ERR(f)) {
  554. +                put_unused_fd(fd);
  555. +                fd = PTR_ERR(f);
  556. +            } else {
  557. +                do_gettimeofday(&end);
  558. +                printk(KERN_DEBUG "do_fh_open: took %d usecs\n", diff(&end, &begin));
  559. +                do_gettimeofday(&begin);
  560. +                /* this file descriptor needs to be closed on exec */
  561. +                set_close_on_exec(fd, 1);
  562. +                fd_install(fd, f);
  563. +                do_gettimeofday(&end);
  564. +                printk(KERN_DEBUG "set_close, fd_install: took %d usecs\n", diff(&end, &begin));
  565. +            }
  566. +        }
  567. +        puthandle(tmp);
  568. +    }
  569. +    return fd;
  570. +}
  571. +
  572. +asmlinkage long sys_openfh(const void __user *uhandle, size_t handle_len)
  573. +{
  574. +    return do_sys_openfh(uhandle, handle_len);
  575. +}
  576. +
  577. +EXPORT_SYMBOL_GPL(sys_openfh);
  578. +
  579. +long do_sys_openg(const char __user *pathname, void __user *uhandle,
  580. +        size_t __user *uhandle_len, int flags, int mode)
  581. +{
  582. +    char *tmp = getname(pathname);
  583. +    long err = PTR_ERR(tmp);
  584. +
  585. +    if (!IS_ERR(tmp)) 
  586. +    {
  587. +        struct file *f = NULL;
  588. +        size_t handle_len = 0;
  589. +        size_t min_len = sizeof(struct file_handle_generic);
  590. +        struct file_handle fhandle;
  591. +        struct timeval begin, end;
  592. +
  593. +        memset(&fhandle, 0, sizeof(fhandle));
  594. +        if (get_user(handle_len, uhandle_len)) {
  595. +            err = -EFAULT;
  596. +            goto drop_name;
  597. +        }
  598. +        /* discard bogus values */
  599. +        if (handle_len < 0)
  600. +        {
  601. +            err = -EINVAL;
  602. +            goto drop_name;
  603. +        }
  604. +        /* or definitely insufficient buffer length */
  605. +        else if (handle_len > 0 && 
  606. +                handle_len < min_len)
  607. +        {
  608. +            err = -ERANGE;
  609. +            goto drop_name;
  610. +        }
  611. +        err = 0;
  612. +        do_gettimeofday(&begin);
  613. +        /* Try to open the file now */
  614. +        f = do_filp_open(AT_FDCWD, tmp, flags, mode);
  615. +        if (IS_ERR(f)) {
  616. +            /* File does not exist */
  617. +            err = PTR_ERR(f);
  618. +            goto drop_name;
  619. +        }
  620. +        else {
  621. +            /* Is this even possible? */
  622. +            if (!f->f_dentry || !f->f_dentry->d_inode)
  623. +            {
  624. +                err = -EINVAL;
  625. +                goto drop_filp;
  626. +            }
  627. +            /* Diallow anything but regular files */
  628. +            if (!S_ISREG(f->f_dentry->d_inode->i_mode)) {
  629. +                err = -EACCES;
  630. +                goto drop_filp;
  631. +            }
  632. +            else {
  633. +                /* Does FS define callback for openg? */
  634. +                if (!f->f_dentry->d_inode->i_op->fill_handle) {
  635. +                    /* not supported */
  636. +                    err = -EOPNOTSUPP;
  637. +                    goto drop_filp;
  638. +                }
  639. +                else {
  640. +                    do_gettimeofday(&end);
  641. +                    printk(KERN_DEBUG "do_filp_open: took %d usecs\n", diff(&end, &begin));
  642. +                    fhandle.fh_private = NULL;
  643. +                    fhandle.fh_private_length = 
  644. +                        handle_len ? (handle_len - min_len)    : 0;
  645. +                    fhandle.fh_private_dtor = NULL;
  646. +                    /* 
  647. +                     * if handle_len == 0, 
  648. +                     * FS is expected to give us the handle length it needs. 
  649. +                     */
  650. +                    do_gettimeofday(&begin);
  651. +                    err = f->f_dentry->d_inode->i_op->fill_handle(
  652. +                                f->f_dentry->d_inode, &fhandle);
  653. +                    if (err)
  654. +                        goto drop_filp;
  655. +
  656. +                    /* make sure that FS does not set it to an invalid length */
  657. +                    if (fhandle.fh_private_length <= 0) {
  658. +                        err = -EINVAL;
  659. +                        goto drop_private;
  660. +                    }
  661. +                    
  662. +                    /* try to copy the handle if requested */
  663. +                    if (handle_len > 0) {
  664. +                        __u32 magic, fsid;
  665. +                        struct kstatfs st;
  666. +                        char *key = NULL;
  667. +                        int  keylen = 0, statfs_mask = STATFS_M_TYPE | STATFS_M_FSID;
  668. +                        /*
  669. +                         * Check if fhandle.fh_private was not set.
  670. +                         */
  671. +                        if (fhandle.fh_private == NULL) {
  672. +                            err = -EINVAL;
  673. +                            goto drop_filp;
  674. +                        }
  675. +                        do_gettimeofday(&end);
  676. +                        printk(KERN_DEBUG "fill_handle: took %d usecs\n", diff(&end, &begin));
  677. +                        /*
  678. +                         * Check if the underlying FS wishes to supply a key for 
  679. +                         * the message authentication code.
  680. +                         * If it does not or in case of errors, we use a NULL key
  681. +                         * for the MAC
  682. +                         */
  683. +                        get_fs_key(f->f_dentry->d_inode->i_sb, &key, &keylen);
  684. +                        /* 
  685. +                         * Currently, we issue a statfs on the superblock to figure
  686. +                         * out the magic number and fsid for the file system.
  687. +                         * But this might translate to many network messages for many
  688. +                         * distributed/parallel file systems. Therefore, we need a 
  689. +                         * sb->statfs_lite() callback mechanism to get only those
  690. +                         * fields that don't require a network message.
  691. +                         * If FS does not support the callback, fallback to using statfs.
  692. +                         */
  693. +                        do_gettimeofday(&begin);
  694. +                        if ((err = vfs_statfs_lite(f->f_dentry->d_inode->i_sb, &st, statfs_mask)) < 0) {
  695. +                            //err = vfs_statfs(f->f_dentry->d_inode->i_sb, &st);
  696. +                            //if (err) 
  697. +                                goto drop_private;
  698. +                        }
  699. +                        do_gettimeofday(&end);
  700. +                        printk(KERN_DEBUG "statfs_lite: took %d usecs\n", diff(&end, &begin));
  701. +                        magic = st.f_type;
  702. +                        memcpy(&fsid, &st.f_fsid, sizeof(__u32));
  703. +                        /* set magic number, fsid, flags */
  704. +                        set_fh_field(&fhandle.fh_generic, magic, magic);
  705. +                        set_fh_field(&fhandle.fh_generic, fsid,  fsid);
  706. +                        set_fh_field(&fhandle.fh_generic, flags, flags);
  707. +
  708. +                        do_gettimeofday(&begin);
  709. +                        /* Compute and store crc check sum */
  710. +                        store_crc32_csum(&fhandle);
  711. +                        /* Compute and store HMAC-SHA1 crypto check sum */
  712. +                        store_hmac_csum(&fhandle, key, keylen);
  713. +                        /* copy opaque handle to user buffer */
  714. +                        err = copy_handle(uhandle, &fhandle);
  715. +                        if (err)
  716. +                            goto drop_private;
  717. +                        do_gettimeofday(&end);
  718. +                        printk(KERN_DEBUG "(crc, hmac, copy_handle): took %d usecs\n", diff(&end, &begin));
  719. +                    }
  720. +                    /* update the handle length reported to user-space */
  721. +                    handle_len = fhandle.fh_private_length + min_len;
  722. +                    /* and copy the new length to user space */
  723. +                    err = put_user(handle_len, uhandle_len);
  724. +            drop_private:
  725. +                    drop_file_handle_private(&fhandle);
  726. +                }
  727. +            }
  728. +drop_filp:
  729. +            filp_close(f, NULL);
  730. +        }
  731. +drop_name:
  732. +        putname(tmp);
  733. +    }
  734. +    return err;
  735. +}
  736. +
  737. +asmlinkage long sys_openg(const char __user *pathname, void __user *uhandle, 
  738. +        size_t __user *uhandle_len, int flags, int mode)
  739. +{
  740. +    if (force_o_largefile())
  741. +        flags |= O_LARGEFILE;
  742. +    return do_sys_openg(pathname, uhandle, uhandle_len, flags, mode);
  743. +}
  744. +
  745. +EXPORT_SYMBOL_GPL(sys_openg);
  746. +
  747.  #ifndef __alpha__
  748.  
  749.  /*
  750. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/fs/super.c vanilla-new/fs/super.c
  751. --- vanilla/fs/super.c    2006-03-19 23:53:29.000000000 -0600
  752. +++ vanilla-new/fs/super.c    2006-04-26 22:06:36.000000000 -0500
  753. @@ -799,6 +799,58 @@
  754.  
  755.  EXPORT_SYMBOL(get_sb_single);
  756.  
  757. +struct super_block *get_sb_handle(const struct file_handle *fhandle)
  758. +{
  759. +    /* walk through the list of superblocks */
  760. +    struct super_block *sb;
  761. +
  762. +    spin_lock(&sb_lock);
  763. +    list_for_each_entry (sb, &super_blocks, s_list) {
  764. +        struct kstatfs st;
  765. +
  766. +        sb->s_count++;
  767. +        spin_unlock(&sb_lock);
  768. +        down_read(&sb->s_umount);
  769. +        if (sb->s_root)
  770. +        {
  771. +            int err, statfs_mask = STATFS_M_TYPE | STATFS_M_FSID;
  772. +            /* 
  773. +             * Currently, we issue a statfs on the superblock to figure
  774. +             * out the type and fsid for the file system.
  775. +             * But this might translate to network messages for many
  776. +             * distributed/parallel file systems. Therefore, we need a 
  777. +             * statfs_lite() callback mechanism to get only those
  778. +             * fields that don't require a network message. We fall back to a
  779. +             * regular statfs in case the file system does not support a statfs_lite()
  780. +             * callback.
  781. +             */
  782. +            if ((err = vfs_statfs_lite(sb, &st, statfs_mask)) < 0) {
  783. +                //err = vfs_statfs(sb, &st);
  784. +            }
  785. +            
  786. +            if (err == 0) {
  787. +                __u32 fsid, magic; 
  788. +
  789. +                get_fh_field(&fhandle->fh_generic, fsid, fsid);
  790. +                get_fh_field(&fhandle->fh_generic, magic, magic);
  791. +                /* check if magic numbers and fsid matches */
  792. +                if (st.f_type == magic
  793. +                        && memcmp(&st.f_fsid, &fsid, sizeof(__u32)) == 0)
  794. +                {
  795. +                    return sb;
  796. +                }
  797. +            }
  798. +        }
  799. +        drop_super(sb);
  800. +        spin_lock(&sb_lock);
  801. +    }
  802. +    spin_unlock(&sb_lock);
  803. +    /* This function will not create a new superblock! */
  804. +    return NULL;
  805. +}
  806. +
  807. +EXPORT_SYMBOL_GPL(get_sb_handle);
  808. +
  809.  struct vfsmount *
  810.  do_kern_mount(const char *fstype, int flags, const char *name, void *data)
  811.  {
  812. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/include/asm-i386/unistd.h vanilla-new/include/asm-i386/unistd.h
  813. --- vanilla/include/asm-i386/unistd.h    2006-03-19 23:53:29.000000000 -0600
  814. +++ vanilla-new/include/asm-i386/unistd.h    2006-04-07 10:28:39.000000000 -0500
  815. @@ -316,8 +316,10 @@
  816.  #define __NR_pselect6        308
  817.  #define __NR_ppoll        309
  818.  #define __NR_unshare        310
  819. +#define __NR_openg      311
  820. +#define __NR_openfh     312
  821.  
  822. -#define NR_syscalls 311
  823. +#define NR_syscalls 313
  824.  
  825.  /*
  826.   * user-visible error numbers are in the range -1 - -128: see
  827. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/include/asm-ia64/unistd.h vanilla-new/include/asm-ia64/unistd.h
  828. --- vanilla/include/asm-ia64/unistd.h    2006-03-19 23:53:29.000000000 -0600
  829. +++ vanilla-new/include/asm-ia64/unistd.h    2006-04-07 10:28:39.000000000 -0500
  830. @@ -285,12 +285,14 @@
  831.  #define __NR_faccessat            1293
  832.  /* 1294, 1295 reserved for pselect/ppoll */
  833.  #define __NR_unshare            1296
  834. +#define __NR_openg         1297
  835. +#define __NR_openfh        1298
  836.  
  837.  #ifdef __KERNEL__
  838.  
  839.  #include <linux/config.h>
  840.  
  841. -#define NR_syscalls            273 /* length of syscall table */
  842. +#define NR_syscalls            275 /* length of syscall table */
  843.  
  844.  #define __ARCH_WANT_SYS_RT_SIGACTION
  845.  
  846. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/include/asm-powerpc/unistd.h vanilla-new/include/asm-powerpc/unistd.h
  847. --- vanilla/include/asm-powerpc/unistd.h    2006-03-19 23:53:29.000000000 -0600
  848. +++ vanilla-new/include/asm-powerpc/unistd.h    2006-04-07 10:28:39.000000000 -0500
  849. @@ -301,8 +301,10 @@
  850.  #define __NR_pselect6        280
  851.  #define __NR_ppoll        281
  852.  #define __NR_unshare        282
  853. +#define __NR_openg        283
  854. +#define __NR_openfh        284
  855.  
  856. -#define __NR_syscalls        283
  857. +#define __NR_syscalls        285
  858.  
  859.  #ifdef __KERNEL__
  860.  #define __NR__exit __NR_exit
  861. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/include/asm-x86_64/unistd.h vanilla-new/include/asm-x86_64/unistd.h
  862. --- vanilla/include/asm-x86_64/unistd.h    2006-03-19 23:53:29.000000000 -0600
  863. +++ vanilla-new/include/asm-x86_64/unistd.h    2006-04-07 10:28:39.000000000 -0500
  864. @@ -605,8 +605,12 @@
  865.  __SYSCALL(__NR_ppoll,    sys_ni_syscall)        /* for now */
  866.  #define __NR_unshare        272
  867.  __SYSCALL(__NR_unshare,    sys_unshare)
  868. +#define __NR_openg      273
  869. +__SYSCALL(__NR_openg,   sys_openg)
  870. +#define __NR_openfh     274
  871. +__SYSCALL(__NR_openfh,  sys_openfh)
  872.  
  873. -#define __NR_syscall_max __NR_unshare
  874. +#define __NR_syscall_max __NR_openfh
  875.  
  876.  #ifndef __NO_STUBS
  877.  
  878. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/include/linux/fs.h vanilla-new/include/linux/fs.h
  879. --- vanilla/include/linux/fs.h    2006-03-19 23:53:29.000000000 -0600
  880. +++ vanilla-new/include/linux/fs.h    2006-04-17 13:35:37.000000000 -0500
  881. @@ -991,6 +991,27 @@
  882.  #define HAVE_COMPAT_IOCTL 1
  883.  #define HAVE_UNLOCKED_IOCTL 1
  884.  
  885. +struct file_handle_generic {
  886. +    /* Filled by VFS */
  887. +    __le32   fhg_magic; /* magic number */
  888. +    __le32   fhg_fsid; /* file system identifier */
  889. +    __le32   fhg_flags;     /* flags associated with the file object */
  890. +    __le32   fhg_crc_csum; /* crc32c check sum of the blob */
  891. +    __u8     fhg_hmac_sha1[24]; /* hmac-sha1 message authentication code */
  892. +};
  893. +
  894. +struct file_handle {
  895. +    /* generic part filled by VFS */
  896. +    struct file_handle_generic fh_generic;
  897. +    /* FS specific part */
  898. +    void                      *fh_private;
  899. +    size_t                            fh_private_length;
  900. +    void                      (*fh_private_dtor)(void *);
  901. +};
  902. +
  903. +#define set_fh_field(X, Y, Z) (X)->fhg_##Y = cpu_to_le32(Z)
  904. +#define get_fh_field(X, Y, Z) Z = le32_to_cpu((X)->fhg_##Y)
  905. +
  906.  /*
  907.   * NOTE:
  908.   * read, write, poll, fsync, readv, writev, unlocked_ioctl and compat_ioctl
  909. @@ -1049,6 +1070,8 @@
  910.      ssize_t (*listxattr) (struct dentry *, char *, size_t);
  911.      int (*removexattr) (struct dentry *, const char *);
  912.      void (*truncate_range)(struct inode *, loff_t, loff_t);
  913. +    /* method needed for filling up handle */
  914. +    int (*fill_handle)(struct inode *, struct file_handle *);
  915.  };
  916.  
  917.  struct seq_file;
  918. @@ -1065,12 +1088,12 @@
  919.   * without the big kernel lock held in all filesystems.
  920.   */
  921.  struct super_operations {
  922. -       struct inode *(*alloc_inode)(struct super_block *sb);
  923. +   struct inode *(*alloc_inode)(struct super_block *sb);
  924.      void (*destroy_inode)(struct inode *);
  925.  
  926.      void (*read_inode) (struct inode *);
  927.    
  928. -       void (*dirty_inode) (struct inode *);
  929. +      void (*dirty_inode) (struct inode *);
  930.      int (*write_inode) (struct inode *, int);
  931.      void (*put_inode) (struct inode *);
  932.      void (*drop_inode) (struct inode *);
  933. @@ -1081,6 +1104,7 @@
  934.      void (*write_super_lockfs) (struct super_block *);
  935.      void (*unlockfs) (struct super_block *);
  936.      int (*statfs) (struct super_block *, struct kstatfs *);
  937. +    int (*statfs_lite) (struct super_block *, struct kstatfs *, int statfs_mask);
  938.      int (*remount_fs) (struct super_block *, int *, char *);
  939.      void (*clear_inode) (struct inode *);
  940.      void (*umount_begin) (struct super_block *);
  941. @@ -1089,6 +1113,8 @@
  942.  
  943.      ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
  944.      ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
  945. +    struct inode *(*find_inode_handle)(struct super_block *, const struct file_handle *);
  946. +    void    (*get_fs_key)(struct super_block *, char **ppkey, int *keylen);
  947.  };
  948.  
  949.  /* Inode state bits.  Protected by inode_lock. */
  950. @@ -1257,6 +1283,7 @@
  951.  struct super_block *get_sb_nodev(struct file_system_type *fs_type,
  952.      int flags, void *data,
  953.      int (*fill_super)(struct super_block *, void *, int));
  954. +struct super_block *get_sb_handle(const struct file_handle *handle);
  955.  void generic_shutdown_super(struct super_block *sb);
  956.  void kill_block_super(struct super_block *sb);
  957.  void kill_anon_super(struct super_block *sb);
  958. @@ -1292,6 +1319,7 @@
  959.                    struct vfsmount *);
  960.  
  961.  extern int vfs_statfs(struct super_block *, struct kstatfs *);
  962. +extern int vfs_statfs_lite(struct super_block *, struct kstatfs *, int statfs_mask);
  963.  
  964.  /* /sys/fs */
  965.  extern struct subsystem fs_subsys;
  966. @@ -1345,6 +1373,10 @@
  967.                 struct file *filp);
  968.  extern long do_sys_open(int fdf, const char __user *filename, int flags,
  969.              int mode);
  970. +
  971. +extern long do_sys_openfh(const void __user *uhandle, size_t handle_len);
  972. +extern long do_sys_openg(const char __user *pathname, void __user *uhandle, 
  973. +            size_t __user *uhandle_len, int flags, int mode);
  974.  extern struct file *filp_open(const char *, int, int);
  975.  extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
  976.  extern int filp_close(struct file *, fl_owner_t id);
  977. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/include/linux/limits.h vanilla-new/include/linux/limits.h
  978. --- vanilla/include/linux/limits.h    2006-03-19 23:53:29.000000000 -0600
  979. +++ vanilla-new/include/linux/limits.h    2006-04-07 17:25:07.000000000 -0500
  980. @@ -16,6 +16,7 @@
  981.  #define XATTR_NAME_MAX   255    /* # chars in an extended attribute name */
  982.  #define XATTR_SIZE_MAX 65536    /* size of an extended attribute value (64k) */
  983.  #define XATTR_LIST_MAX 65536    /* size of extended attribute namelist (64k) */
  984. +#define MAX_HANDLE_LEN   128  /* maximum size of a handle used by the openfh system call */
  985.  
  986.  #define RTSIG_MAX      32
  987.  
  988. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/include/linux/statfs.h vanilla-new/include/linux/statfs.h
  989. --- vanilla/include/linux/statfs.h    2006-03-19 23:53:29.000000000 -0600
  990. +++ vanilla-new/include/linux/statfs.h    2006-04-17 11:38:07.000000000 -0500
  991. @@ -5,6 +5,18 @@
  992.  
  993.  #include <asm/statfs.h>
  994.  
  995. +/* Masks used by statfs_lite callback */
  996. +#define STATFS_M_TYPE          (1 << 0)
  997. +#define STATFS_M_BSIZE      (1 << 1)
  998. +#define STATFS_M_BLOCKS        (1 << 2)
  999. +#define STATFS_M_BFREE      (1 << 3)
  1000. +#define STATFS_M_BAVAIL     (1 << 4)
  1001. +#define STATFS_M_FILES      (1 << 5)
  1002. +#define STATFS_M_FFREE      (1 << 6)
  1003. +#define STATFS_M_FSID       (1 << 7)
  1004. +#define STATFS_M_NAMELEN    (1 << 8)
  1005. +#define STATFS_M_FRSIZE    (1 << 9)
  1006. +
  1007.  struct kstatfs {
  1008.      long f_type;
  1009.      long f_bsize;
  1010. diff -Naur --exclude-from=/home/vilayann/redhat/BUILD/kernel-2.6.16/exclude vanilla/include/linux/syscalls.h vanilla-new/include/linux/syscalls.h
  1011. --- vanilla/include/linux/syscalls.h    2006-03-19 23:53:29.000000000 -0600
  1012. +++ vanilla-new/include/linux/syscalls.h    2006-04-07 13:56:07.000000000 -0500
  1013. @@ -327,6 +327,10 @@
  1014.  asmlinkage long sys_creat(const char __user *pathname, int mode);
  1015.  asmlinkage long sys_open(const char __user *filename,
  1016.                  int flags, int mode);
  1017. +asmlinkage long sys_openfh(const void __user *uhandle, 
  1018. +                size_t handle_len);
  1019. +asmlinkage long sys_openg(const char __user *pathname, void __user *uhandle, 
  1020. +                size_t *uhandle_len, int flags, int mode);
  1021.  asmlinkage long sys_close(unsigned int fd);
  1022.  asmlinkage long sys_access(const char __user *filename, int mode);
  1023.  asmlinkage long sys_vhangup(void);
  1024. @@ -566,7 +570,10 @@
  1025.  asmlinkage long compat_sys_newfstatat(unsigned int dfd, char __user * filename,
  1026.                        struct compat_stat __user *statbuf,
  1027.                        int flag);
  1028. +asmlinkage long compat_sys_open(const char __user *filename, int flags, int mode);
  1029.  asmlinkage long compat_sys_openat(unsigned int dfd, const char __user *filename,
  1030.                     int flags, int mode);
  1031. -
  1032. +asmlinkage long compat_sys_openg(const char __user *pathname, void __user *uhandle,
  1033. +                    size_t __user *uhandle_len, int flags, int mode);
  1034. +asmlinkage long compat_sys_openfh(const void __user *uhandle, size_t uhandle_len);
  1035.  #endif
  1036.